...
Run Format

Source file src/syscall/syscall_linux_mips64x.go

Documentation: syscall

     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  // +build linux
     6  // +build mips64 mips64le
     7  
     8  package syscall
     9  
    10  const (
    11  	_SYS_dup       = SYS_DUP2
    12  	_SYS_setgroups = SYS_SETGROUPS
    13  )
    14  
    15  //sys	Dup2(oldfd int, newfd int) (err error)
    16  //sys	Fchown(fd int, uid int, gid int) (err error)
    17  //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
    18  //sys	Ftruncate(fd int, length int64) (err error)
    19  //sysnb	Getegid() (egid int)
    20  //sysnb	Geteuid() (euid int)
    21  //sysnb	Getgid() (gid int)
    22  //sysnb	Getrlimit(resource int, rlim *Rlimit) (err error)
    23  //sysnb	Getuid() (uid int)
    24  //sysnb	InotifyInit() (fd int, err error)
    25  //sys	Lchown(path string, uid int, gid int) (err error)
    26  //sys	Listen(s int, n int) (err error)
    27  //sys	Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    28  //sys	Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    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	Setregid(rgid int, egid int) (err error)
    34  //sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
    35  //sysnb	Setresuid(ruid int, euid int, suid int) (err error)
    36  //sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
    37  //sysnb	Setreuid(ruid int, euid 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	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, 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  type sigset_t struct {
    62  	X__val [16]uint64
    63  }
    64  
    65  //sys	pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_t) (n int, err error) = SYS_PSELECT6
    66  
    67  func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
    68  	ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
    69  	return pselect(nfd, r, w, e, &ts, nil)
    70  }
    71  
    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  func setTimespec(sec, nsec int64) Timespec {
    87  	return Timespec{Sec: sec, Nsec: nsec}
    88  }
    89  
    90  func setTimeval(sec, usec int64) Timeval {
    91  	return Timeval{Sec: sec, Usec: usec}
    92  }
    93  
    94  func Pipe(p []int) (err error) {
    95  	if len(p) != 2 {
    96  		return EINVAL
    97  	}
    98  	var pp [2]_C_int
    99  	err = pipe2(&pp, 0)
   100  	p[0] = int(pp[0])
   101  	p[1] = int(pp[1])
   102  	return
   103  }
   104  
   105  //sysnb pipe2(p *[2]_C_int, flags int) (err error)
   106  
   107  func Pipe2(p []int, flags int) (err error) {
   108  	if len(p) != 2 {
   109  		return EINVAL
   110  	}
   111  	var pp [2]_C_int
   112  	err = pipe2(&pp, flags)
   113  	p[0] = int(pp[0])
   114  	p[1] = int(pp[1])
   115  	return
   116  }
   117  
   118  func Ioperm(from int, num int, on int) (err error) {
   119  	return ENOSYS
   120  }
   121  
   122  func Iopl(level int) (err error) {
   123  	return ENOSYS
   124  }
   125  
   126  type stat_t struct {
   127  	Dev        uint32
   128  	Pad0       [3]int32
   129  	Ino        uint64
   130  	Mode       uint32
   131  	Nlink      uint32
   132  	Uid        uint32
   133  	Gid        uint32
   134  	Rdev       uint32
   135  	Pad1       [3]uint32
   136  	Size       int64
   137  	Atime      uint32
   138  	Atime_nsec uint32
   139  	Mtime      uint32
   140  	Mtime_nsec uint32
   141  	Ctime      uint32
   142  	Ctime_nsec uint32
   143  	Blksize    uint32
   144  	Pad2       uint32
   145  	Blocks     int64
   146  }
   147  
   148  //sys	fstat(fd int, st *stat_t) (err error)
   149  //sys	lstat(path string, st *stat_t) (err error)
   150  //sys	stat(path string, st *stat_t) (err error)
   151  
   152  func Fstat(fd int, s *Stat_t) (err error) {
   153  	st := &stat_t{}
   154  	err = fstat(fd, st)
   155  	fillStat_t(s, st)
   156  	return
   157  }
   158  
   159  func Lstat(path string, s *Stat_t) (err error) {
   160  	st := &stat_t{}
   161  	err = lstat(path, st)
   162  	fillStat_t(s, st)
   163  	return
   164  }
   165  
   166  func Stat(path string, s *Stat_t) (err error) {
   167  	st := &stat_t{}
   168  	err = stat(path, st)
   169  	fillStat_t(s, st)
   170  	return
   171  }
   172  
   173  func fillStat_t(s *Stat_t, st *stat_t) {
   174  	s.Dev = st.Dev
   175  	s.Ino = st.Ino
   176  	s.Mode = st.Mode
   177  	s.Nlink = st.Nlink
   178  	s.Uid = st.Uid
   179  	s.Gid = st.Gid
   180  	s.Rdev = st.Rdev
   181  	s.Size = st.Size
   182  	s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)}
   183  	s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)}
   184  	s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)}
   185  	s.Blksize = st.Blksize
   186  	s.Blocks = st.Blocks
   187  }
   188  
   189  func (r *PtraceRegs) PC() uint64 { return r.Regs[64] }
   190  
   191  func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc }
   192  
   193  func (iov *Iovec) SetLen(length int) {
   194  	iov.Len = uint64(length)
   195  }
   196  
   197  func (msghdr *Msghdr) SetControllen(length int) {
   198  	msghdr.Controllen = uint64(length)
   199  }
   200  
   201  func (cmsg *Cmsghdr) SetLen(length int) {
   202  	cmsg.Len = uint64(length)
   203  }
   204  
   205  func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
   206  	panic("not implemented")
   207  }
   208  

View as plain text