unveil.go (view raw)
1//go:build openbsd
2// +build openbsd
3
4// Doesn't do anything yet.
5
6package main
7
8/*
9#include <stdlib.h>
10#include <unistd.h>
11*/
12import "C"
13
14import (
15 "fmt"
16 "unsafe"
17)
18
19func Unveil(path string, perms string) error {
20 cpath := C.CString(path)
21 defer C.free(unsafe.Pointer(cpath))
22 cperms := C.CString(perms)
23 defer C.free(unsafe.Pointer(cperms))
24
25 rv, err := C.unveil(cpath, cperms)
26 if rv != 0 {
27 return fmt.Errorf("unveil(%s, %s) failure (%d)", path, perms, err)
28 }
29 return nil
30}