Source file src/syscall/syscall_linux_mips64x.go

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

View as plain text