os

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package os implements an operating system routines useful for graphics

Index

Constants

View Source
const MapPrivate = syscall.MAP_PRIVATE

MapPrivate Private mapping

View Source
const MapShared = syscall.MAP_SHARED

MapShared Share this mapping

View Source
const ProtRead = syscall.PROT_READ

ProtRead Pages may be read

View Source
const ProtWrite = syscall.PROT_WRITE

ProtWrite Pages may be written

Variables

View Source
var ErrFileIsNil = errors.New("CreateTmpfileCloexec: file is nil")

ErrFileIsNil error means a temp file could not be created

View Source
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 Close

func Close(fd int) error

Close closes the fd

func CreateAnonymousFile

func CreateAnonymousFile(size int64) (fd *os.File, err error)

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

func CreateTmpfileCloexec(tmpdir, tmpname string) (*os.File, error)

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 Mmap

func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)

Mmap calls the system call to map memory on a fd

func Munmap

func Munmap(data []byte) error

Munmap calls the system call to unmap memory

func ParseUnixRights

func ParseUnixRights(m *SocketControlMessage) (fds []int, err error)

ParseUnixRights calls a system call to parse unix rights

func Sendmsg

func Sendmsg(fd int, msg []byte, oob []byte, sockaddr Sockaddr, z int) error

Sendmsg sends information on fd using a Sendmsg system call

func UnixRights

func UnixRights(fd int) []byte

UnixRights calls a system call

Types

type Sockaddr

type Sockaddr = unix.Sockaddr

Sockaddr is a socket address

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL