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

View as plain text