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_illumos.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_illumos.go')
| -rw-r--r-- | vendor/golang.org/x/sys/unix/syscall_illumos.go | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go new file mode 100644 index 0000000..a863f70 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | // Copyright 2021 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 | // illumos system calls not present on Solaris. | ||
| 6 | |||
| 7 | //go:build amd64 && illumos | ||
| 8 | |||
| 9 | package unix | ||
| 10 | |||
| 11 | import ( | ||
| 12 | "unsafe" | ||
| 13 | ) | ||
| 14 | |||
| 15 | func bytes2iovec(bs [][]byte) []Iovec { | ||
| 16 | iovecs := make([]Iovec, len(bs)) | ||
| 17 | for i, b := range bs { | ||
| 18 | iovecs[i].SetLen(len(b)) | ||
| 19 | if len(b) > 0 { | ||
| 20 | iovecs[i].Base = &b[0] | ||
| 21 | } else { | ||
| 22 | iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero)) | ||
| 23 | } | ||
| 24 | } | ||
| 25 | return iovecs | ||
| 26 | } | ||
| 27 | |||
| 28 | //sys readv(fd int, iovs []Iovec) (n int, err error) | ||
| 29 | |||
| 30 | func Readv(fd int, iovs [][]byte) (n int, err error) { | ||
| 31 | iovecs := bytes2iovec(iovs) | ||
| 32 | n, err = readv(fd, iovecs) | ||
| 33 | return n, err | ||
| 34 | } | ||
| 35 | |||
| 36 | //sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) | ||
| 37 | |||
| 38 | func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { | ||
| 39 | iovecs := bytes2iovec(iovs) | ||
| 40 | n, err = preadv(fd, iovecs, off) | ||
| 41 | return n, err | ||
| 42 | } | ||
| 43 | |||
| 44 | //sys writev(fd int, iovs []Iovec) (n int, err error) | ||
| 45 | |||
| 46 | func Writev(fd int, iovs [][]byte) (n int, err error) { | ||
| 47 | iovecs := bytes2iovec(iovs) | ||
| 48 | n, err = writev(fd, iovecs) | ||
| 49 | return n, err | ||
| 50 | } | ||
| 51 | |||
| 52 | //sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) | ||
| 53 | |||
| 54 | func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) { | ||
| 55 | iovecs := bytes2iovec(iovs) | ||
| 56 | n, err = pwritev(fd, iovecs, off) | ||
| 57 | return n, err | ||
| 58 | } | ||
| 59 | |||
| 60 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = libsocket.accept4 | ||
| 61 | |||
| 62 | func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { | ||
| 63 | var rsa RawSockaddrAny | ||
| 64 | var len _Socklen = SizeofSockaddrAny | ||
| 65 | nfd, err = accept4(fd, &rsa, &len, flags) | ||
| 66 | if err != nil { | ||
| 67 | return | ||
| 68 | } | ||
| 69 | if len > SizeofSockaddrAny { | ||
| 70 | panic("RawSockaddrAny too small") | ||
| 71 | } | ||
| 72 | sa, err = anyToSockaddr(fd, &rsa) | ||
| 73 | if err != nil { | ||
| 74 | Close(nfd) | ||
| 75 | nfd = 0 | ||
| 76 | } | ||
| 77 | return | ||
| 78 | } | ||