Documentation ¶
Overview ¶
Package os implements an operating system routines useful for graphics
Index ¶
- Constants
- Variables
- func Close(fd int) error
- func CreateAnonymousFile(size int64) (fd *os.File, err error)
- func CreateTmpfileCloexec(tmpdir, tmpname string) (*os.File, error)
- func MkOsTemp(tmpdir string, tmpname []byte, flags int, x1 byte, x2 byte, x3 byte) (*os.File, error)
- func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)
- func Munmap(data []byte) error
- func ParseUnixRights(m *SocketControlMessage) (fds []int, err error)
- func Sendmsg(fd int, msg []byte, oob []byte, sockaddr Sockaddr, z int) error
- func UnixRights(fd int) []byte
- type Sockaddr
- type SocketControlMessage
Constants ¶
const MapPrivate = syscall.MAP_PRIVATE
MapPrivate Private mapping
MapShared Share this mapping
const ProtRead = syscall.PROT_READ
ProtRead Pages may be read
const ProtWrite = syscall.PROT_WRITE
ProtWrite Pages may be written
Variables ¶
var ErrFileIsNil = errors.New("CreateTmpfileCloexec: file is nil")
ErrFileIsNil error means a temp file could not be created
var ErrUnlink = errors.New("CreateTmpfileCloexec: unlink error")
ErrUnlink is a CreateTmpfileCloexec error that means a temp file was created but couldn't be deleted to make it anonymous.
Functions ¶
func CreateAnonymousFile ¶
CreateAnonymousFile creates anon fd, in case of the ErrUnlink error, the fd is valid. The file just isn't anonymous and can't be deleted. You can either ignore the ErrUnlink error and proceed, but it is your responsibility to Close the fd. In case of other errors, the fd is not valid and does not need to be closed.
func CreateTmpfileCloexec ¶
CreateTmpfileCloexec creates a temp file that will be cloexec. In case of the ErrUnlink error, the fd is valid.
func MkOsTemp ¶
func MkOsTemp(tmpdir string, tmpname []byte, flags int, x1 byte, x2 byte, x3 byte) (*os.File, error)
MkOsTemp is a Golang version of the popular C library function call The string can contain the pattern consisting of XXX that will be replaced with a high-entropy alphanumeric sequence, if you want more entropic string you can put more XXX (in multiples of 3 X) up to the recommended value of 27 X shorter sequence of XXX will make your MkOsTemp more prone to the failure the buffer tmpname will be overwritten by the high entropic buffer x1, x2, x3 are the three X characters we are replacing, it can be another character altogether.
func ParseUnixRights ¶
func ParseUnixRights(m *SocketControlMessage) (fds []int, err error)
ParseUnixRights calls a system call to parse unix rights
Types ¶
type SocketControlMessage ¶
type SocketControlMessage = syscall.SocketControlMessage
SocketControlMessage is a socket control message
func ParseSocketControlMessage ¶
func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error)
ParseSocketControlMessage calls a system call to parse a Socket Control Message