1 // Copyright 2018 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.
12 // Unveil implements the unveil syscall.
13 // For more information see unveil(2).
14 // Note that the special case of blocking further
15 // unveil calls is handled by UnveilBlock.
16 func Unveil(path string, flags string) error {
17 pathPtr, err := syscall.BytePtrFromString(path)
21 flagsPtr, err := syscall.BytePtrFromString(flags)
25 _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
32 // UnveilBlock blocks future unveil calls.
33 // For more information see unveil(2).
34 func UnveilBlock() error {
35 // Both pointers must be nil.
36 var pathUnsafe, flagsUnsafe unsafe.Pointer
37 _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0)