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/sockcmsg_unix_other.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/sockcmsg_unix_other.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go new file mode 100644 index 0000000..4a1eab3 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go | |||
@@ -0,0 +1,46 @@ | |||
1 | // Copyright 2019 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 aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos | ||
6 | |||
7 | package unix | ||
8 | |||
9 | import ( | ||
10 | "runtime" | ||
11 | ) | ||
12 | |||
13 | // Round the length of a raw sockaddr up to align it properly. | ||
14 | func cmsgAlignOf(salen int) int { | ||
15 | salign := SizeofPtr | ||
16 | |||
17 | // dragonfly needs to check ABI version at runtime, see cmsgAlignOf in | ||
18 | // sockcmsg_dragonfly.go | ||
19 | switch runtime.GOOS { | ||
20 | case "aix": | ||
21 | // There is no alignment on AIX. | ||
22 | salign = 1 | ||
23 | case "darwin", "ios", "illumos", "solaris": | ||
24 | // NOTE: It seems like 64-bit Darwin, Illumos and Solaris | ||
25 | // kernels still require 32-bit aligned access to network | ||
26 | // subsystem. | ||
27 | if SizeofPtr == 8 { | ||
28 | salign = 4 | ||
29 | } | ||
30 | case "netbsd", "openbsd": | ||
31 | // NetBSD and OpenBSD armv7 require 64-bit alignment. | ||
32 | if runtime.GOARCH == "arm" { | ||
33 | salign = 8 | ||
34 | } | ||
35 | // NetBSD aarch64 requires 128-bit alignment. | ||
36 | if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" { | ||
37 | salign = 16 | ||
38 | } | ||
39 | case "zos": | ||
40 | // z/OS socket macros use [32-bit] sizeof(int) alignment, | ||
41 | // not pointer width. | ||
42 | salign = SizeofInt | ||
43 | } | ||
44 | |||
45 | return (salen + salign - 1) & ^(salign - 1) | ||
46 | } | ||