Documentation
¶
Index ¶
- Constants
- Variables
- func AddrAsFunc(addr uintptr, typ interface{}) interface{}
- func ArgCopy(dst, src *ArgList)
- func AsFunc(p interface{}, typ interface{}) interface{}
- func AsPtr(v interface{}) (unsafe.Pointer, error)
- func AscTime(tm *TimeInfo) *byte
- func Assert(cond bool)
- func Atof(s string) float64
- func Atoi(s string) int
- func BoolToInt(v bool) int32
- func BytesN(p *byte, sz int) []bytedeprecated
- func CBytes(b []byte) *byte
- func CString(s string) *byte
- func CStringSlice(arr []string) **byte
- func Calloc(num, sz int) unsafe.Pointer
- func ClockGetRes(c Clock, ts *TimeSpec) int32
- func ClockGetTime(c Clock, ts *TimeSpec) int32
- func ClockSetTime(c Clock, ts *TimeSpec) int32
- func ErrCode(err error) int
- func Error() error
- func Free(p unsafe.Pointer)
- func FuncAddr(v interface{}) uintptr
- func FuncAddrUnsafe(v interface{}) unsafe.Pointer
- func FuncName() string
- func GoBytes(ptr *byte) []byte
- func GoBytesS(s []byte) []byte
- func GoString(s *byte) string
- func GoStringS(s []byte) string
- func GoWString(s *WChar) string
- func IndexBytePtr(p *byte, i int) *bytedeprecated
- func IndexUnsafePtr(p unsafe.Pointer, i int) unsafe.Pointerdeprecated
- func IsAlnum(c rune) bool
- func IsAlpha(c rune) bool
- func LoadAddInt32(p *int32, v int32) int32
- func LoadAndInt32(p *int32, v int32) int32
- func LoadNandInt32(p *int32, v int32) int32
- func LoadOrInt32(p *int32, v int32) int32
- func LoadSubInt32(p *int32, v int32) int32
- func LoadXorInt32(p *int32, v int32) int32
- func Malloc(sz int) unsafe.Pointer
- func Mbstowcs(a1 *WChar, a2 *byte, a3 uint32) uint32
- func MemChr(ptr *byte, ch byte, sz int) *byte
- func MemCmp(lhs, rhs unsafe.Pointer, sz int) int
- func MemCpy(dst, src unsafe.Pointer, sz int) unsafe.Pointer
- func MemMove(dst, src unsafe.Pointer, sz int) unsafe.Pointer
- func MemSet(p unsafe.Pointer, ch byte, sz int) unsafe.Pointer
- func PointerDiff(a, b unsafe.Pointer) int
- func Rand() int32
- func Realloc(buf unsafe.Pointer, sz int) unsafe.Pointer
- func Search(key, base unsafe.Pointer, num, size uint32, ...) unsafe.Pointer
- func SeedRand(seed uint32)
- func SetErr(err error)
- func Sort(base unsafe.Pointer, num, size uint32, compar func(a, b unsafe.Pointer) int32)
- func StrCSpn(a, b *byte) int
- func StrCaseCmp(a, b *byte) int
- func StrCat(dst, src *byte) *byte
- func StrChr(str *byte, ch byte) *byte
- func StrCmp(a, b *byte) int
- func StrCpy(dst, src *byte) *byte
- func StrCpyGo(dst *byte, src []byte)
- func StrCpyGoZero(dst *byte, src []byte)
- func StrDup(s *byte) *byte
- func StrError(e int) *byte
- func StrLen(str *byte) int
- func StrLenS(s []byte) int
- func StrNCaseCmp(a, b *byte, sz int) int
- func StrNCat(dst, src *byte, sz int) *byte
- func StrNCmp(a, b *byte, sz int) int
- func StrNCpy(dst, src *byte, sz int) *byte
- func StrNDup(s *byte, n int) *byte
- func StrRChr(str *byte, ch byte) *byte
- func StrSpn(str, chars *byte) int
- func StrStr(str, substr *byte) *byte
- func StrTok(src, delim *byte) *byte
- func ToPointer(p uintptr) unsafe.Pointer
- func ToUintptr(p unsafe.Pointer) uintptr
- func Uint16N(p *uint16, sz int) []uint16deprecated
- func Uint32N(p *uint32, sz int) []uint32deprecated
- func UnsafeBytesN(ptr unsafe.Pointer, sz int) []bytedeprecated
- func UnsafeUint16N(ptr unsafe.Pointer, sz int) []uint16deprecated
- func UnsafeUint32N(ptr unsafe.Pointer, sz int) []uint32deprecated
- func WStrCaseCmp(a, b *WChar) int
- func WStrCmp(a, b *WChar) int
- func WStrLen(str *WChar) uint64
- func WStrtol(s *WChar, end **WChar, base int) int
- func Wctob(wc WChar) int64
- type ArgList
- type Clock
- type ClockID
- type JumpBuf
- type Time
- type TimeInfo
- type TimeSpec
- type TimeVal
- type Timer
- type WChar
- func CWString(s string) *WChar
- func GoWSlice(ptr *WChar) []WChar
- func IndexWCharPtr(p *WChar, i int) *WChardeprecated
- func UnsafeWCharN(ptr unsafe.Pointer, sz uint64) []WChardeprecated
- func WCharN(p *WChar, sz uint64) []WChardeprecated
- func WStrCat(dst, src *WChar) *WChar
- func WStrChr(str *WChar, ch int64) *WChar
- func WStrCpy(dst, src *WChar) *WChar
- func WStrNCpy(dst, src *WChar, sz uint32) *WChar
- func WStrTok(src, delim *WChar) *WChar
Constants ¶
const CLOCKS_PER_SEC = 1000000 // us
const CLOCK_MONOTONIC = 1
const CLOCK_REALTIME = 0
const E2BIG = 2
Argument list too long.
const EACCES = 3
Permission denied.
const EADDRINUSE = 4
Address in use.
const EADDRNOTAVAIL = 5
Address not available.
const EAFNOSUPPORT = 6
Address family not supported.
const EAGAIN = 7
Resource unavailable, try again (may be the same value as EWOULDBLOCK).
const EALREADY = 8
Connection already in progress.
const EBADF = 9
Bad file descriptor.
const EBADMSG = 10
Bad message.
const EBUSY = 11
Device or resource busy.
const ECANCELED = 12
Operation canceled.
const ECHILD = 13
No child processes.
const ECONNABORTED = 14
Connection aborted.
const ECONNREFUSED = 15
Connection refused.
const ECONNRESET = 16
Connection reset.
const EDEADLK = 17
Resource deadlock would occur.
const EDESTADDRREQ = 18
Destination address required.
const EDOM = 19
Mathematics argument out of domain of function.
const EDQUOT = 20
Reserved.
const EEXIST = 21
File exists.
const EFAULT = 22
Bad address.
const EFBIG = 23
File too large.
const EHOSTUNREACH = 24
Host is unreachable.
const EIDRM = 25
Identifier removed.
const EILSEQ = 26
Illegal byte sequence.
const EINPROGRESS = 27
Operation in progress.
const EINTR = 28
Interrupted function.
const EINVAL = 29
Invalid argument.
const EIO = 30
I/O error.
const EISCONN = 31
Socket is connected.
const EISDIR = 32
Is a directory.
const ELOOP = 33
Too many levels of symbolic links.
const EMFILE = 34
File descriptor value too large.
const EMLINK = 35
Too many links.
const EMSGSIZE = 36
Message too large.
const EMULTIHOP = 37
Reserved.
const ENAMETOOLONG = 38
Filename too long.
const ENETDOWN = 39
Network is down.
const ENETRESET = 40
Connection aborted by network.
const ENETUNREACH = 41
Network unreachable.
const ENFILE = 42
Too many files open in system.
const ENOBUFS = 43
No buffer space available.
const ENODATA = 44
No message is available on the STREAM head read queue.
const ENODEV = 45
No such device.
const ENOENT = 46
No such file or directory.
const ENOEXEC = 47
Executable file format error.
const ENOLCK = 48
No locks available.
const ENOLINK = 49
Reserved.
const ENOMEM = 50
Not enough space.
const ENOMSG = 51
No message of the desired type.
const ENOPROTOOPT = 52
Protocol not available.
const ENOSPC = 53
No space left on device.
const ENOSR = 54
No STREAM resources.
const ENOSTR = 55
Not a STREAM.
const ENOSYS = 56
Functionality not supported.
const ENOTCONN = 57
The socket is not connected.
const ENOTDIR = 58
Not a directory or a symbolic link to a directory.
const ENOTEMPTY = 59
Directory not empty.
const ENOTRECOVERABLE = 60
Env not recoverable.
const ENOTSOCK = 61
Not a socket.
const ENOTSUP = 62
Not supported (may be the same value as EOPNOTSUPP).
const ENOTTY = 63
Inappropriate I/O control operation.
const ENXIO = 64
No such device or address.
const EOPNOTSUPP = 65
Operation not supported on socket (may be the same value as ENOTSUP).
const EOVERFLOW = 66
Value too large to be stored in data type.
const EOWNERDEAD = 67
Previous owner died.
const EPERM = 68
Operation not permitted.
const EPIPE = 69
Broken pipe.
const EPROTO = 79
Protocol error.
const EPROTONOSUPPORT = 80
Protocol not supported.
const EPROTOTYPE = 81
Protocol wrong type for socket.
const ERANGE = 82
Result too large.
const EROFS = 83
Read-only file system.
const ESPIPE = 84
Invalid seek.
const ESRCH = 85
No such process.
const ESTALE = 86
Reserved.
const ETIME = 87
Stream ioctl() timeout.
const ETIMEDOUT = 88
Connection timed out.
const ETXTBSY = 89
Text file busy.
const EWOULDBLOCK = 90
Operation would block (may be the same value as EAGAIN).
const EXDEV = 91
Cross-device link.
const RandMax = math.MaxInt32
const V1Defined = true
const WCharSize = int(unsafe.Sizeof(WChar(0)))
Variables ¶
var (
Errno int
)
Functions ¶
func AddrAsFunc ¶
func AddrAsFunc(addr uintptr, typ interface{}) interface{}
AddrAsFunc converts a function address to a function value. The caller must type-assert to an expected function type. The function type can be specified as (*func())(nil).
func AsFunc ¶
func AsFunc(p interface{}, typ interface{}) interface{}
AsFunc is a less restrictive version of AddrAsFunc. It accepts a pointer value that may be one of: uintptr, unsafe.Pointer, *T, int, uint.
func CStringSlice ¶
CStringSlice convers a Go string slice to a zero-terminated array of C string pointers.
func ClockGetRes ¶
func ClockGetTime ¶
func ClockSetTime ¶
func Error ¶
func Error() error
Error returns a Go error value that corresponds to the current Errno.
func FuncAddr ¶
func FuncAddr(v interface{}) uintptr
FuncAddr converts a function value to a uintptr.
func FuncAddrUnsafe ¶
FuncAddrUnsafe converts a function value to a unsafe.Pointer.
func GoBytes ¶
GoBytes makes a Go byte slice from a pointer to a zero-terminated byte array. The slice will point to the same memory as ptr.
func IndexBytePtr
deprecated
func LoadAddInt32 ¶
func LoadAndInt32 ¶
func LoadNandInt32 ¶
func LoadOrInt32 ¶
func LoadSubInt32 ¶
func LoadXorInt32 ¶
func MemChr ¶
MemChr finds the first occurrence of ch (after conversion to byte as if by byte(ch)) in the initial count characters (each interpreted as byte) of the object pointed to by ptr.
The behavior is undefined if access occurs beyond the end of the array searched. The behavior is undefined if ptr is a null pointer.
func MemCmp ¶
MemCmp compares the first count characters of the objects pointed to by lhs and rhs. The comparison is done lexicographically.
The sign of the result is the sign of the difference between the values of the first pair of bytes (both interpreted as byte) that differ in the objects being compared.
The behavior is undefined if access occurs beyond the end of either object pointed to by lhs and rhs. The behavior is undefined if either lhs or rhs is a null pointer.
func MemCpy ¶
MemCpy copies count characters from the object pointed to by src to the object pointed to by dest. Both objects are interpreted as arrays of byte.
The behavior is undefined if access occurs beyond the end of the dest array. If the objects overlap (which is a violation of the restrict contract), the behavior is undefined. The behavior is undefined if either dest or src is a null pointer.
func MemMove ¶
MemMove copies count characters from the object pointed to by src to the object pointed to by dest. Both objects are interpreted as arrays of byte. The objects may overlap: copying takes place as if the characters were copied to a temporary character array and then the characters were copied from the array to dest.
The behavior is undefined if access occurs beyond the end of the dest array. The behavior is undefined if either dest or src is a null pointer.
func MemSet ¶
MemSet copies the value ch (after conversion to byte as if by byte(ch)) into each of the first count characters of the object pointed to by dest.
The behavior is undefined if access occurs beyond the end of the dest array. The behavior is undefined if dest is a null pointer.
func SetErr ¶
func SetErr(err error)
SetErr sets the Errno value to a specified Go error equivalent.
func StrCaseCmp ¶
func StrCat ¶
StrCat appends a copy of the source string to the destination string. The terminating null character in destination is overwritten by the first character of source, and a null-character is included at the end of the new string formed by the concatenation of both in destination.
Destination and source shall not overlap.
func StrChr ¶
StrChr finds the first occurrence of ch (after conversion to byte as if by byte(ch)) in the null-terminated byte string pointed to by str (each character interpreted as unsigned char). The terminating null character is considered to be a part of the string and can be found when searching for '\x00'.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
The return value is a pointer to the found character in str, or null pointer if no such character is found.
func StrCpy ¶
StrCpy copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point).
To avoid overflows, the size of the array pointed by destination shall be long enough to contain the same C string as source (including the terminating null character), and should not overlap in memory with source.
func StrCpyGo ¶
StrCpyGo copies a Go slice into a C string pointed by dst. It won't add the null terminator.
func StrCpyGoZero ¶
StrCpyGoZero is the same as StrCpyGo, but adds a null terminator.
func StrLen ¶
StrLen returns the length of the given null-terminated byte string, that is, the number of characters in a character array whose first element is pointed to by str up to and not including the first null character.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
func StrNCaseCmp ¶
func StrNCat ¶
StrNCat appends the first num characters of source to destination, plus a terminating null-character.
If the length of the C string in source is less than num, only the content up to the terminating null-character is copied.
func StrNCpy ¶
StrNCpy copies the first num characters of source to destination. If the end of the source C string (which is signaled by a null-character) is found before num characters have been copied, destination is padded with zeros until a total of num characters have been written to it.
No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).
Destination and source shall not overlap (see MemMove for a safer alternative when overlapping).
func StrNDup ¶ added in v0.3.7
StrNDup copies a null-terminated C string up to N bytes. Null terminator is added if the string is larger than N.
func StrRChr ¶
StrRChr finds the last occurrence of ch (after conversion to byte as if by byte(ch)) in the null-terminated byte string pointed to by str (each character interpreted as unsigned char). The terminating null character is considered to be a part of the string and can be found when searching for '\x00'.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
The return value is a pointer to the found character in str, or null pointer if no such character is found.
func StrSpn ¶
StrSpn returns the length of the initial portion of str1 which consists only of characters that are part of str2.
The search does not include the terminating null-characters of either strings, but ends there.
func StrStr ¶
StrStr finds the first occurrence of the null-terminated byte string pointed to by substr in the null-terminated byte string pointed to by str. The terminating null characters are not compared.
The behavior is undefined if either str or substr is not a pointer to a null-terminated byte string.
The return value is a pointer to the first character of the found substring in str, or NULL if such substring is not found. If substr points to an empty string, str is returned.
func StrTok ¶
StrTok is used in a sequence of calls to split str into tokens, which are sequences of contiguous characters separated by any of the characters that are part of delimiters.
On a first call, the function expects a C string as argument for str, whose first character is used as the starting location to scan for tokens. In subsequent calls, the function expects a null pointer and uses the position right after the end of the last token as the new starting location for scanning.
To determine the beginning and the end of a token, the function first scans from the starting location for the first character not contained in delimiters (which becomes the beginning of the token). And then scans starting from this beginning of the token for the first character contained in delimiters, which becomes the end of the token. The scan also stops if the terminating null character is found.
This end of the token is automatically replaced by a null-character, and the beginning of the token is returned by the function.
Once the terminating null character of str is found in a call to strtok, all subsequent calls to this function (with a null pointer as the first argument) return a null pointer.
The point where the last token was found is kept internally by the function to be used on the next call (particular library implementations are not required to avoid data races).
func UnsafeBytesN
deprecated
func UnsafeUint16N
deprecated
func UnsafeUint32N
deprecated
func WStrCaseCmp ¶
Types ¶
type ArgList ¶
type ArgList struct {
// contains filtered or unexported fields
}
func (*ArgList) ArgUintptr ¶
type TimeInfo ¶
type WChar ¶
type WChar = uint16