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

View as plain text