1
2
3
4
5 package unix
6
7 import (
8 "syscall"
9 "unsafe"
10 )
11
12
13
14
15
16 func Unveil(path string, flags string) error {
17 pathPtr, err := syscall.BytePtrFromString(path)
18 if err != nil {
19 return err
20 }
21 flagsPtr, err := syscall.BytePtrFromString(flags)
22 if err != nil {
23 return err
24 }
25 _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
26 if e != 0 {
27 return e
28 }
29 return nil
30 }
31
32
33
34 func UnveilBlock() error {
35
36 var pathUnsafe, flagsUnsafe unsafe.Pointer
37 _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0)
38 if e != 0 {
39 return e
40 }
41 return nil
42 }
43
View as plain text