aboutsummaryrefslogtreecommitdiff
path: root/misc/openat2.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/openat2.go')
-rw-r--r--misc/openat2.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/misc/openat2.go b/misc/openat2.go
deleted file mode 100644
index e5938ca..0000000
--- a/misc/openat2.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package misc
-
-import (
- "syscall"
- "unsafe"
-)
-
-const SYS_OPENAT2 = 437
-
-type Open_how_t struct {
- Flags uint64
- Mode uint64
- Resolve uint64
-}
-
-const (
- RESOLVE_BENEATH = 0x8
- RESOLVE_IN_ROOT = 0x10
- RESOLVE_NO_MAGICLINKS = 0x2
- RESOLVE_NO_SYMLINKS = 0x4
- RESOLVE_NO_XDEV = 0x1
-)
-
-// See openat2(2) on Linux
-func Openat2(dirfd int, path string, open_how *Open_how_t) (fd int, err error) {
- path_ptr, err := StringToBytePtr(path)
- if err != nil {
- return
- }
- _fd, _, errno := syscall.Syscall6(SYS_OPENAT2, uintptr(dirfd), uintptr(unsafe.Pointer(path_ptr)), uintptr(unsafe.Pointer(open_how)), uintptr(unsafe.Sizeof(Open_how_t{})), 0, 0)
- fd = int(_fd)
- if errno != 0 {
- err = errno
- }
- return
-}