...
Run Format

Source file src/syscall/syscall_linux_arm64.go

Documentation: syscall

     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  package syscall
     6  
     7  const (
     8  	_SYS_dup       = SYS_DUP3
     9  	_SYS_setgroups = SYS_SETGROUPS
    10  )
    11  
    12  //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
    13  //sys	Fchown(fd int, uid int, gid int) (err error)
    14  //sys	Fstat(fd int, stat *Stat_t) (err error)
    15  //sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
    16  //sys	fstatat(dirfd int, path string, stat *Stat_t, flags 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  //sys	Listen(s int, n int) (err error)
    25  //sys	Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
    26  //sys	Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
    27  //sys	Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
    28  //sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
    29  //sys	Setfsgid(gid int) (err error)
    30  //sys	Setfsuid(uid int) (err error)
    31  //sysnb	Setregid(rgid int, egid int) (err error)
    32  //sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
    33  //sysnb	Setresuid(ruid int, euid int, suid int) (err error)
    34  //sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
    35  //sysnb	Setreuid(ruid int, euid int) (err error)
    36  //sys	Shutdown(fd int, how int) (err error)
    37  //sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
    38  
    39  func Stat(path string, stat *Stat_t) (err error) {
    40  	return Fstatat(_AT_FDCWD, path, stat, 0)
    41  }
    42  
    43  func Lchown(path string, uid int, gid int) (err error) {
    44  	return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW)
    45  }
    46  
    47  func Lstat(path string, stat *Stat_t) (err error) {
    48  	return Fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
    49  }
    50  
    51  //sys	Statfs(path string, buf *Statfs_t) (err error)
    52  //sys	SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2
    53  //sys	Truncate(path string, length int64) (err error)
    54  //sys	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
    55  //sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
    56  //sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    57  //sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
    58  //sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
    59  //sysnb	setgroups(n int, list *_Gid_t) (err error)
    60  //sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
    61  //sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
    62  //sysnb	socket(domain int, typ int, proto int) (fd int, err error)
    63  //sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
    64  //sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    65  //sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
    66  //sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
    67  //sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
    68  //sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
    69  //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
    70  //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
    71  
    72  type sigset_t struct {
    73  	X__val [16]uint64
    74  }
    75  
    76  //sys	pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_t) (n int, err error) = SYS_PSELECT6
    77  
    78  func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
    79  	var ts *Timespec
    80  	if timeout != nil {
    81  		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
    82  	}
    83  	return pselect(nfd, r, w, e, ts, nil)
    84  }
    85  
    86  //sysnb	Gettimeofday(tv *Timeval) (err error)
    87  //sysnb	Time(t *Time_t) (tt Time_t, 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 Pipe(p []int) (err error) {
    98  	if len(p) != 2 {
    99  		return EINVAL
   100  	}
   101  	var pp [2]_C_int
   102  	err = pipe2(&pp, 0)
   103  	p[0] = int(pp[0])
   104  	p[1] = int(pp[1])
   105  	return
   106  }
   107  
   108  //sysnb pipe2(p *[2]_C_int, flags int) (err error)
   109  
   110  func Pipe2(p []int, flags int) (err error) {
   111  	if len(p) != 2 {
   112  		return EINVAL
   113  	}
   114  	var pp [2]_C_int
   115  	err = pipe2(&pp, flags)
   116  	p[0] = int(pp[0])
   117  	p[1] = int(pp[1])
   118  	return
   119  }
   120  
   121  func (r *PtraceRegs) PC() uint64 { return r.Pc }
   122  
   123  func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
   124  
   125  func (iov *Iovec) SetLen(length int) {
   126  	iov.Len = uint64(length)
   127  }
   128  
   129  func (msghdr *Msghdr) SetControllen(length int) {
   130  	msghdr.Controllen = uint64(length)
   131  }
   132  
   133  func (cmsg *Cmsghdr) SetLen(length int) {
   134  	cmsg.Len = uint64(length)
   135  }
   136  
   137  func InotifyInit() (fd int, err error) {
   138  	return InotifyInit1(0)
   139  }
   140  
   141  // TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
   142  // these when the deprecated syscalls that the syscall package relies on
   143  // are removed.
   144  const (
   145  	SYS_GETPGRP      = 1060
   146  	SYS_UTIMES       = 1037
   147  	SYS_FUTIMESAT    = 1066
   148  	SYS_PAUSE        = 1061
   149  	SYS_USTAT        = 1070
   150  	SYS_UTIME        = 1063
   151  	SYS_LCHOWN       = 1032
   152  	SYS_TIME         = 1062
   153  	SYS_EPOLL_CREATE = 1042
   154  	SYS_EPOLL_WAIT   = 1069
   155  )
   156  
   157  func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
   158  	panic("not implemented")
   159  }
   160  

View as plain text