Documentation
¶
Overview ¶
Package runtime provides stub declarations for the RTG runtime. This package is used for Go compiler type checking and IDE completion. The actual implementations are provided by the RTG compiler's builtins. This package should never be executed at runtime.
Index ¶
- Constants
- Variables
- func Call(target int64) int64
- func Config(key string) any
- func EmbedBytes(bytes ...byte) (int64, int64)
- func EmbedCString(s string) (int64, int64)
- func EmbedConfigCString(key string) (int64, int64)
- func EmbedConfigString(key string) (int64, int64)
- func EmbedString(s string) (int64, int64)
- func GotoLabel(label int64)
- func ISB()
- func Ifdef(flag string) bool
- func Load8(ptr, offset int64) int64
- func Load16(ptr, offset int64) int64
- func Load32(ptr, offset int64) int64
- func Load64(ptr, offset int64) int64
- func LogKmsg(msg string)
- func Printf(format string, args ...any)
- func Store8(ptr, offset, value int64)
- func Store16(ptr, offset, value int64)
- func Store32(ptr, offset, value int64)
- func Store64(ptr, offset, value int64)
- func Syscall(num int64, args ...any) int64
Constants ¶
const ( SYS_EXIT int64 = 0 SYS_EXIT_GROUP int64 = 1 SYS_WRITE int64 = 2 SYS_READ int64 = 3 SYS_OPENAT int64 = 4 SYS_CLOSE int64 = 5 SYS_MMAP int64 = 6 SYS_MUNMAP int64 = 7 SYS_MOUNT int64 = 8 SYS_MKDIRAT int64 = 9 SYS_MKNODAT int64 = 10 SYS_CHROOT int64 = 11 SYS_CHDIR int64 = 12 SYS_SETHOSTNAME int64 = 13 SYS_IOCTL int64 = 14 SYS_DUP3 int64 = 15 SYS_SETSID int64 = 16 SYS_REBOOT int64 = 17 SYS_INIT_MODULE int64 = 18 SYS_CLOCK_SETTIME int64 = 19 SYS_CLOCK_GETTIME int64 = 20 SYS_SOCKET int64 = 21 SYS_SENDTO int64 = 22 SYS_RECVFROM int64 = 23 SYS_EXECVE int64 = 24 SYS_CLONE int64 = 25 SYS_WAIT4 int64 = 26 SYS_MPROTECT int64 = 27 SYS_GETPID int64 = 28 SYS_PIVOT_ROOT int64 = 29 SYS_UMOUNT2 int64 = 30 SYS_UNLINKAT int64 = 31 SYS_SYMLINKAT int64 = 32 )
Syscall numbers (architecture-independent definitions for type checking)
const ( O_RDONLY int64 = 0 O_WRONLY int64 = 1 O_RDWR int64 = 2 O_CREAT int64 = 0o100 O_TRUNC int64 = 0o1000 O_SYNC int64 = 0o4010000 )
File open flags
const ( PROT_READ int64 = 1 PROT_WRITE int64 = 2 PROT_EXEC int64 = 4 )
Memory protection flags
const ( MAP_SHARED int64 = 1 MAP_PRIVATE int64 = 2 MAP_ANONYMOUS int64 = 0x20 )
Memory map flags
const ( EBUSY int64 = -16 EPERM int64 = -1 EEXIST int64 = -17 EPIPE int64 = -32 )
Error numbers (as negative values for syscall returns)
const ( LINUX_REBOOT_MAGIC1 int64 = 0xfee1dead LINUX_REBOOT_MAGIC2 int64 = 672274793 LINUX_REBOOT_CMD_RESTART int64 = 0x01234567 LINUX_REBOOT_CMD_POWER_OFF int64 = 0x4321fedc )
Reboot magic numbers and commands
const ( AF_INET int64 = 2 AF_NETLINK int64 = 16 SOCK_DGRAM int64 = 2 SOCK_RAW int64 = 3 NETLINK_ROUTE int64 = 0 )
Network constants
const ( IFF_UP int64 = 0x1 SIOCSIFFLAGS int64 = 0x8914 SIOCSIFADDR int64 = 0x8916 SIOCSIFNETMASK int64 = 0x891c SIOCGIFINDEX int64 = 0x8933 RTM_NEWROUTE int64 = 24 NLM_F_REQUEST int64 = 0x1 NLM_F_CREATE int64 = 0x400 NLM_F_REPLACE int64 = 0x100 NLM_F_ACK int64 = 0x4 RT_TABLE_MAIN int64 = 254 RTPROT_BOOT int64 = 3 RT_SCOPE_UNIVERSE int64 = 0 RTN_UNICAST int64 = 1 RTA_OIF int64 = 4 RTA_GATEWAY int64 = 5 )
Network interface ioctl constants
const (
AT_FDCWD int64 = -100
)
File descriptor constants
const (
AT_REMOVEDIR int64 = 0x200
)
Unlink flags
const (
CLOCK_REALTIME int64 = 0
)
Clock constants
const (
MNT_DETACH int64 = 0x2
)
Mount/unmount flags
const (
SIGCHLD int64 = 17
)
Clone flags
const (
S_IFCHR int64 = 0o020000
)
File mode constants
const (
TIOCSCTTY int64 = 0x540E
)
TTY ioctl constants
Variables ¶
var GOARCH string = "amd64"
GOARCH is resolved at RTG compile time to the target architecture. The default value is for IDE completion only.
Functions ¶
func Config ¶
Config retrieves a compile-time configuration value by key. This is evaluated at RTG compile time, not at runtime. The key must be a string literal. Supported value types: string, int64 Returns error at compile time if key is not found.
func EmbedBytes ¶
EmbedBytes embeds raw bytes in the binary and returns a pointer and length. Usage: ptr, len := runtime.EmbedBytes(0x01, 0x02, 0x03)
func EmbedCString ¶
EmbedCString embeds a C-style string constant (with null terminator) and returns a pointer and length. The length returned is the original string length WITHOUT the null terminator. Usage: ptr, len := runtime.EmbedCString("hello")
func EmbedConfigCString ¶
EmbedConfigCString embeds a config string value as a C-style string (with null terminator). The key is looked up in CompileOptions.Config at compile time. The length returned is the original string length WITHOUT the null terminator. Usage: ptr, len := runtime.EmbedConfigCString("hostname")
func EmbedConfigString ¶
EmbedConfigString embeds a config string value in the binary and returns a pointer and length. The key is looked up in CompileOptions.Config at compile time. The string does NOT have a null terminator. Usage: ptr, len := runtime.EmbedConfigString("hostname")
func EmbedString ¶
EmbedString embeds a string constant in the binary and returns a pointer and length. The string does NOT have a null terminator. Usage: ptr, len := runtime.EmbedString("hello")
func ISB ¶
func ISB()
ISB is an instruction synchronization barrier (ARM64). Required after modifying code in memory before executing it.
func Ifdef ¶
Ifdef returns true if the named compile-time flag is set. This is evaluated at RTG compile time, not at runtime. The flag name must be a string literal. Undefined flags are treated as false.
func LogKmsg ¶
func LogKmsg(msg string)
LogKmsg writes a message to /dev/kmsg (kernel message buffer). The message is visible via dmesg. This is non-fatal if /dev/kmsg is unavailable.
func Store8 ¶
func Store8(ptr, offset, value int64)
Store8 stores an 8-bit value to memory at ptr+offset.
func Store16 ¶
func Store16(ptr, offset, value int64)
Store16 stores a 16-bit value to memory at ptr+offset.
func Store32 ¶
func Store32(ptr, offset, value int64)
Store32 stores a 32-bit value to memory at ptr+offset.
Types ¶
This section is empty.