Source file src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build linux && (mips64 || mips64le)
     6  
     7  package unix
     8  
     9  //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    10  //sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
    11  //sys	Fchown(fd int, uid int, gid int) (err error)
    12  //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
    13  //sys	Ftruncate(fd int, length int64) (err error)
    14  //sysnb	Getegid() (egid int)
    15  //sysnb	Geteuid() (euid int)
    16  //sysnb	Getgid() (gid int)
    17  //sysnb	Getrlimit(resource int, rlim *Rlimit) (err error)
    18  //sysnb	Getuid() (uid int)
    19  //sys	Lchown(path string, uid int, gid int) (err error)
    20  //sys	Listen(s int, n int) (err error)
    21  //sys	Pause() (err error)
    22  //sys	pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    23  //sys	pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    24  //sys	Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
    25  //sys	Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
    26  
    27  func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
    28  	var ts *Timespec
    29  	if timeout != nil {
    30  		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
    31  	}
    32  	return pselect6(nfd, r, w, e, ts, nil)
    33  }
    34  
    35  //sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
    36  //sys	setfsgid(gid int) (prev int, err error)
    37  //sys	setfsuid(uid int) (prev int, err error)
    38  //sys	Shutdown(fd int, how int) (err error)
    39  //sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
    40  //sys	Statfs(path string, buf *Statfs_t) (err error)
    41  //sys	SyncFileRange(fd int, off int64, n int64, flags int) (err error)
    42  //sys	Truncate(path string, length int64) (err error)
    43  //sys	Ustat(dev int, ubuf *Ustat_t) (err error)
    44  //sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
    45  //sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    46  //sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    47  //sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    48  //sysnb	setgroups(n int, list *_Gid_t) (err error)
    49  //sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
    50  //sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
    51  //sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    52  //sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
    53  //sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    54  //sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    55  //sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    56  //sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
    57  //sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    58  //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
    59  //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    60  
    61  //sys	futimesat(dirfd int, path string, times *[2]Timeval) (err error)
    62  //sysnb	Gettimeofday(tv *Timeval) (err error)
    63  
    64  func Time(t *Time_t) (tt Time_t, err error) {
    65  	var tv Timeval
    66  	err = Gettimeofday(&tv)
    67  	if err != nil {
    68  		return 0, err
    69  	}
    70  	if t != nil {
    71  		*t = Time_t(tv.Sec)
    72  	}
    73  	return Time_t(tv.Sec), nil
    74  }
    75  
    76  //sys	Utime(path string, buf *Utimbuf) (err error)
    77  //sys	utimes(path string, times *[2]Timeval) (err error)
    78  
    79  func setTimespec(sec, nsec int64) Timespec {
    80  	return Timespec{Sec: sec, Nsec: nsec}
    81  }
    82  
    83  func setTimeval(sec, usec int64) Timeval {
    84  	return Timeval{Sec: sec, Usec: usec}
    85  }
    86  
    87  func Ioperm(from int, num int, on int) (err error) {
    88  	return ENOSYS
    89  }
    90  
    91  func Iopl(level int) (err error) {
    92  	return ENOSYS
    93  }
    94  
    95  type stat_t struct {
    96  	Dev        uint32
    97  	Pad0       [3]int32
    98  	Ino        uint64
    99  	Mode       uint32
   100  	Nlink      uint32
   101  	Uid        uint32
   102  	Gid        uint32
   103  	Rdev       uint32
   104  	Pad1       [3]uint32
   105  	Size       int64
   106  	Atime      uint32
   107  	Atime_nsec uint32
   108  	Mtime      uint32
   109  	Mtime_nsec uint32
   110  	Ctime      uint32
   111  	Ctime_nsec uint32
   112  	Blksize    uint32
   113  	Pad2       uint32
   114  	Blocks     int64
   115  }
   116  
   117  //sys	fstat(fd int, st *stat_t) (err error)
   118  //sys	fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
   119  //sys	lstat(path string, st *stat_t) (err error)
   120  //sys	stat(path string, st *stat_t) (err error)
   121  
   122  func Fstat(fd int, s *Stat_t) (err error) {
   123  	st := &stat_t{}
   124  	err = fstat(fd, st)
   125  	fillStat_t(s, st)
   126  	return
   127  }
   128  
   129  func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
   130  	st := &stat_t{}
   131  	err = fstatat(dirfd, path, st, flags)
   132  	fillStat_t(s, st)
   133  	return
   134  }
   135  
   136  func Lstat(path string, s *Stat_t) (err error) {
   137  	st := &stat_t{}
   138  	err = lstat(path, st)
   139  	fillStat_t(s, st)
   140  	return
   141  }
   142  
   143  func Stat(path string, s *Stat_t) (err error) {
   144  	st := &stat_t{}
   145  	err = stat(path, st)
   146  	fillStat_t(s, st)
   147  	return
   148  }
   149  
   150  func fillStat_t(s *Stat_t, st *stat_t) {
   151  	s.Dev = st.Dev
   152  	s.Ino = st.Ino
   153  	s.Mode = st.Mode
   154  	s.Nlink = st.Nlink
   155  	s.Uid = st.Uid
   156  	s.Gid = st.Gid
   157  	s.Rdev = st.Rdev
   158  	s.Size = st.Size
   159  	s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)}
   160  	s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)}
   161  	s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)}
   162  	s.Blksize = st.Blksize
   163  	s.Blocks = st.Blocks
   164  }
   165  
   166  func (r *PtraceRegs) PC() uint64 { return r.Epc }
   167  
   168  func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
   169  
   170  func (iov *Iovec) SetLen(length int) {
   171  	iov.Len = uint64(length)
   172  }
   173  
   174  func (msghdr *Msghdr) SetControllen(length int) {
   175  	msghdr.Controllen = uint64(length)
   176  }
   177  
   178  func (msghdr *Msghdr) SetIovlen(length int) {
   179  	msghdr.Iovlen = uint64(length)
   180  }
   181  
   182  func (cmsg *Cmsghdr) SetLen(length int) {
   183  	cmsg.Len = uint64(length)
   184  }
   185  
   186  func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
   187  	rsa.Service_name_len = uint64(length)
   188  }
   189  

View as plain text