package sysenc
import "github.com/cilium/ebpf/internal/sysenc"
Package sysenc provides efficient conversion of Go values to system call interfaces.
Index ¶
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.
func (Buffer) CopyTo ¶
CopyTo copies the buffer into dst.
Returns the number of copied bytes.
func (Buffer) Pointer ¶
Pointer returns the location where a syscall should write.
func (Buffer) Unmarshal ¶
Unmarshal the buffer into the provided value.
Source Files ¶
buffer.go doc.go layout.go marshal.go
- Version
- v0.12.0
- Published
- Oct 11, 2023
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 14 seconds ago –
Tools for package owners.