summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/unix/auxv.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2025-02-10 15:52:55 +0000
committerLibravatar GitHub <noreply@github.com>2025-02-10 15:52:55 +0000
commit4ac5447ad61f9afc73b542d9d6eb36e29fd79af4 (patch)
tree2a9c14fa9e8e984e6db9646213255563171e0508 /vendor/golang.org/x/sys/unix/auxv.go
parent[chore]: Bump github.com/minio/minio-go/v7 from 7.0.84 to 7.0.85 (#3772) (diff)
downloadgotosocial-4ac5447ad61f9afc73b542d9d6eb36e29fd79af4.tar.xz
[chore]: Bump golang.org/x/crypto from 0.32.0 to 0.33.0 (#3771)
Diffstat (limited to 'vendor/golang.org/x/sys/unix/auxv.go')
-rw-r--r--vendor/golang.org/x/sys/unix/auxv.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/auxv.go b/vendor/golang.org/x/sys/unix/auxv.go
new file mode 100644
index 000000000..37a82528f
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/auxv.go
@@ -0,0 +1,36 @@
+// Copyright 2025 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.21 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos)
+
+package unix
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+//go:linkname runtime_getAuxv runtime.getAuxv
+func runtime_getAuxv() []uintptr
+
+// Auxv returns the ELF auxiliary vector as a sequence of key/value pairs.
+// The returned slice is always a fresh copy, owned by the caller.
+// It returns an error on non-ELF platforms, or if the auxiliary vector cannot be accessed,
+// which happens in some locked-down environments and build modes.
+func Auxv() ([][2]uintptr, error) {
+ vec := runtime_getAuxv()
+ vecLen := len(vec)
+
+ if vecLen == 0 {
+ return nil, syscall.ENOENT
+ }
+
+ if vecLen%2 != 0 {
+ return nil, syscall.EINVAL
+ }
+
+ result := make([]uintptr, vecLen)
+ copy(result, vec)
+ return unsafe.Slice((*[2]uintptr)(unsafe.Pointer(&result[0])), vecLen/2), nil
+}