Documentation ¶
Overview ¶
Package sysenc provides efficient conversion of Go values to system call interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Unmarshal a byte slice in the system's native endianness into data.
Returns an error if buf can't be unmarshalled according to the behaviour of binary.Read.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func Marshal ¶
Marshal turns data into a byte slice using the system's native endianness.
If possible, avoids allocations by directly using the backing memory of data. This means that the variable must not be modified for the lifetime of the returned Buffer.
Returns an error if the data can't be turned into a byte slice according to the behaviour of binary.Write.
func SyscallOutput ¶
SyscallOutput prepares a Buffer for a syscall to write into.
The buffer may point at the underlying memory of dst, in which case Unmarshal becomes a no-op.
The contents of the buffer are undefined and may be non-zero.
func UnsafeBuffer ¶
UnsafeBuffer constructs a Buffer for zero-copy unmarshaling.
[Pointer] is the only valid method to call on such a Buffer. Use [SyscallBuffer] instead if possible.