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