common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IpcCreate = 00001000 /* create if key is nonexistent */
	IpcExcl   = 00002000 /* fail if key exists */
	IpcNoWait = 00004000 /* return error on wait */

	IpcRmid = 0 /* remove resource */
	IpcSet  = 1 /* set ipc_perm options */
	IpcStat = 2 /* get ipc_perm options */
	IpcInfo = 3 /* see ipcs */
)
View Source
const (
	O_NONBLOCK = syscall.O_NONBLOCK
)

Variables

This section is empty.

Functions

func AbsTimeoutToTimeSpec

func AbsTimeoutToTimeSpec(timeout time.Duration) *unix.Timespec

func FlagsForAccess

func FlagsForAccess(flag int) int

func FlagsForOpen

func FlagsForOpen(flag int) int

func IsInterruptedSyscallErr

func IsInterruptedSyscallErr(err error) bool

func IsTimeoutErr

func IsTimeoutErr(err error) bool

func OpenOrCreate

func OpenOrCreate(creator func(bool) error, flag int) (bool, error)

OpenOrCreate performs open/create file operation according to the given mode. It allows to find out if the object was opened or created.

creator is the function which performs actual operation.
	It is called with 'true', if it must create an object, and with false otherwise.
	It must return an 'not exists error' if the param is false, and the object does not exist.
	It must return an 'already exists error' if the param is true, and the object already exists.
flag is the combination of open flags from os package.
	If flag == os.O_CREATE, OpenOrCreate makes several attempts to open or create an object,
	and analyzes the return error. It tries to open the object first.

func SyscallErrHasCode

func SyscallErrHasCode(err error, code syscall.Errno) bool

func SyscallNameFromErr

func SyscallNameFromErr(err error) string

func TimeoutToTimeSpec

func TimeoutToTimeSpec(timeout time.Duration) *unix.Timespec

func TmpFilename

func TmpFilename(name string) string

func UninterruptedSyscall

func UninterruptedSyscall(f func() error) error

func UninterruptedSyscallTimeout

func UninterruptedSyscallTimeout(f func(time.Duration) error, timeout time.Duration) error

Types

type Key

type Key uint64

func Ftok

func Ftok(name string) (Key, error)

func KeyForName

func KeyForName(name string) (Key, error)

Jump to

Keyboard shortcuts

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