| // Copyright 2016 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. |
| // Pledge implements the pledge syscall. For more information see pledge(2). |
| func Pledge(promises string, paths []string) error { |
| promisesPtr, err := syscall.BytePtrFromString(promises) |
| promisesUnsafe, pathsUnsafe := unsafe.Pointer(promisesPtr), unsafe.Pointer(nil) |
| if pathsPtr, err = syscall.SlicePtrFromStrings(paths); err != nil { |
| pathsUnsafe = unsafe.Pointer(&pathsPtr[0]) |
| _, _, e := syscall.Syscall(_SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0) |