diff options
author | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 |
commit | 404aeae4545d2426c089a5f8d5e82dae56f5212b (patch) | |
tree | 2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/golang.org/x/sys/unix/syscall_linux_arm64.go | |
parent | 209d8b0187ed025dec9ac149ebcced3462877bff (diff) | |
download | gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip |
Make Nix builds work
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_linux_arm64.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/syscall_linux_arm64.go | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go new file mode 100644 index 0000000..cf2ee6c --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go | |||
@@ -0,0 +1,184 @@ | |||
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 arm64 && linux | ||
6 | |||
7 | package unix | ||
8 | |||
9 | import "unsafe" | ||
10 | |||
11 | //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT | ||
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 Fstat(fd int, stat *Stat_t) (err error) | ||
15 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) | ||
16 | //sys Fstatfs(fd int, buf *Statfs_t) (err error) | ||
17 | //sys Ftruncate(fd int, length int64) (err error) | ||
18 | //sysnb Getegid() (egid int) | ||
19 | //sysnb Geteuid() (euid int) | ||
20 | //sysnb Getgid() (gid int) | ||
21 | //sysnb getrlimit(resource int, rlim *Rlimit) (err error) | ||
22 | //sysnb Getuid() (uid int) | ||
23 | //sys Listen(s int, n int) (err error) | ||
24 | //sys MemfdSecret(flags int) (fd 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 Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) | ||
28 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK | ||
29 | |||
30 | func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { | ||
31 | var ts *Timespec | ||
32 | if timeout != nil { | ||
33 | ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} | ||
34 | } | ||
35 | return pselect6(nfd, r, w, e, ts, nil) | ||
36 | } | ||
37 | |||
38 | //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) | ||
39 | //sys setfsgid(gid int) (prev int, err error) | ||
40 | //sys setfsuid(uid int) (prev int, err error) | ||
41 | //sys Shutdown(fd int, how int) (err error) | ||
42 | //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) | ||
43 | |||
44 | func Stat(path string, stat *Stat_t) (err error) { | ||
45 | return Fstatat(AT_FDCWD, path, stat, 0) | ||
46 | } | ||
47 | |||
48 | func Lchown(path string, uid int, gid int) (err error) { | ||
49 | return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW) | ||
50 | } | ||
51 | |||
52 | func Lstat(path string, stat *Stat_t) (err error) { | ||
53 | return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW) | ||
54 | } | ||
55 | |||
56 | //sys Statfs(path string, buf *Statfs_t) (err error) | ||
57 | //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) | ||
58 | //sys Truncate(path string, length int64) (err error) | ||
59 | |||
60 | func Ustat(dev int, ubuf *Ustat_t) (err error) { | ||
61 | return ENOSYS | ||
62 | } | ||
63 | |||
64 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) | ||
65 | //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) | ||
66 | //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) | ||
67 | //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) | ||
68 | //sysnb setgroups(n int, list *_Gid_t) (err error) | ||
69 | //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) | ||
70 | //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) | ||
71 | //sysnb socket(domain int, typ int, proto int) (fd int, err error) | ||
72 | //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) | ||
73 | //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) | ||
74 | //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) | ||
75 | //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) | ||
76 | //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) | ||
77 | //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) | ||
78 | //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) | ||
79 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) | ||
80 | |||
81 | //sysnb Gettimeofday(tv *Timeval) (err error) | ||
82 | |||
83 | func setTimespec(sec, nsec int64) Timespec { | ||
84 | return Timespec{Sec: sec, Nsec: nsec} | ||
85 | } | ||
86 | |||
87 | func setTimeval(sec, usec int64) Timeval { | ||
88 | return Timeval{Sec: sec, Usec: usec} | ||
89 | } | ||
90 | |||
91 | func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) { | ||
92 | if tv == nil { | ||
93 | return utimensat(dirfd, path, nil, 0) | ||
94 | } | ||
95 | |||
96 | ts := []Timespec{ | ||
97 | NsecToTimespec(TimevalToNsec(tv[0])), | ||
98 | NsecToTimespec(TimevalToNsec(tv[1])), | ||
99 | } | ||
100 | return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) | ||
101 | } | ||
102 | |||
103 | func Time(t *Time_t) (Time_t, error) { | ||
104 | var tv Timeval | ||
105 | err := Gettimeofday(&tv) | ||
106 | if err != nil { | ||
107 | return 0, err | ||
108 | } | ||
109 | if t != nil { | ||
110 | *t = Time_t(tv.Sec) | ||
111 | } | ||
112 | return Time_t(tv.Sec), nil | ||
113 | } | ||
114 | |||
115 | func Utime(path string, buf *Utimbuf) error { | ||
116 | tv := []Timeval{ | ||
117 | {Sec: buf.Actime}, | ||
118 | {Sec: buf.Modtime}, | ||
119 | } | ||
120 | return Utimes(path, tv) | ||
121 | } | ||
122 | |||
123 | func utimes(path string, tv *[2]Timeval) (err error) { | ||
124 | if tv == nil { | ||
125 | return utimensat(AT_FDCWD, path, nil, 0) | ||
126 | } | ||
127 | |||
128 | ts := []Timespec{ | ||
129 | NsecToTimespec(TimevalToNsec(tv[0])), | ||
130 | NsecToTimespec(TimevalToNsec(tv[1])), | ||
131 | } | ||
132 | return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) | ||
133 | } | ||
134 | |||
135 | // Getrlimit prefers the prlimit64 system call. See issue 38604. | ||
136 | func Getrlimit(resource int, rlim *Rlimit) error { | ||
137 | err := Prlimit(0, resource, nil, rlim) | ||
138 | if err != ENOSYS { | ||
139 | return err | ||
140 | } | ||
141 | return getrlimit(resource, rlim) | ||
142 | } | ||
143 | |||
144 | func (r *PtraceRegs) PC() uint64 { return r.Pc } | ||
145 | |||
146 | func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } | ||
147 | |||
148 | func (iov *Iovec) SetLen(length int) { | ||
149 | iov.Len = uint64(length) | ||
150 | } | ||
151 | |||
152 | func (msghdr *Msghdr) SetControllen(length int) { | ||
153 | msghdr.Controllen = uint64(length) | ||
154 | } | ||
155 | |||
156 | func (msghdr *Msghdr) SetIovlen(length int) { | ||
157 | msghdr.Iovlen = uint64(length) | ||
158 | } | ||
159 | |||
160 | func (cmsg *Cmsghdr) SetLen(length int) { | ||
161 | cmsg.Len = uint64(length) | ||
162 | } | ||
163 | |||
164 | func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { | ||
165 | rsa.Service_name_len = uint64(length) | ||
166 | } | ||
167 | |||
168 | func Pause() error { | ||
169 | _, err := ppoll(nil, 0, nil, nil) | ||
170 | return err | ||
171 | } | ||
172 | |||
173 | //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) | ||
174 | |||
175 | func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { | ||
176 | cmdlineLen := len(cmdline) | ||
177 | if cmdlineLen > 0 { | ||
178 | // Account for the additional NULL byte added by | ||
179 | // BytePtrFromString in kexecFileLoad. The kexec_file_load | ||
180 | // syscall expects a NULL-terminated string. | ||
181 | cmdlineLen++ | ||
182 | } | ||
183 | return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) | ||
184 | } | ||