Module
Module documentation.
moduleos.fd
Classes
Classes and inheritance.
Functions
Free functions and class methods.
functionos.fd::__os_fd_socket
Signature
extern func __os_fd_socket(domain: Int, typ: Int, protocol: Int) -> Int;extern func __os_fd_socket(domain: Int, typ: Int, protocol: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_fd_close`.@briefBinds the low-level runtime symbol `__os_fd_socket`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- domainSocket domain or logical domain selected for the operation.
- typType selector used by the native, protocol, or reflection operation.
- protocolProtocol name or version selected for the network operation.
@returnReturns the operation result as `Int`.
functionos.fd::__os_fd_close
Signature
extern func __os_fd_close(fd: Int) -> Int;extern func __os_fd_close(fd: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_fd_ioctl`.@briefBinds the low-level runtime symbol `__os_fd_close`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns the operation result as `Int`.
functionos.fd::__os_fd_ioctl
Signature
extern func __os_fd_ioctl(fd: Int, request: Int, data: String, out_len: Int) -> String;extern func __os_fd_ioctl(fd: Int, request: Int, data: String, out_len: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__os_fd_connect_sockaddr`.@briefBinds the low-level runtime symbol `__os_fd_ioctl`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- requestRequest object, request id, or encoded request payload to process.
- dataInput or output data buffer.
- out_lenSize or length value that limits how much data the operation processes.
@returnReturns the operation result as `String`.
functionos.fd::__os_fd_connect_sockaddr
Signature
extern func __os_fd_connect_sockaddr(fd: Int, sockaddr: String) -> Int;extern func __os_fd_connect_sockaddr(fd: Int, sockaddr: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_fd_getsockopt`.@briefBinds the low-level runtime symbol `__os_fd_connect_sockaddr`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- sockaddrNative socket address pointer passed to the operating-system call.
@returnReturns the operation result as `Int`.
functionos.fd::__os_fd_getsockopt
Signature
extern func __os_fd_getsockopt(fd: Int, level: Int, optname: Int, max_bytes: Int) -> String;extern func __os_fd_getsockopt(fd: Int, level: Int, optname: Int, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__os_fd_set_nonblock`.@briefBinds the low-level runtime symbol `__os_fd_getsockopt`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- levelCompression level, log level, nesting level, or protocol level value.
- optnameSocket option name or platform option identifier.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionos.fd::__os_fd_set_nonblock
Signature
extern func __os_fd_set_nonblock(fd: Int) -> Int;extern func __os_fd_set_nonblock(fd: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_fd_sock_dgram`.@briefBinds the low-level runtime symbol `__os_fd_set_nonblock`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns the operation result as `Int`.
functionos.fd::__os_fd_sock_dgram
Signature
extern func __os_fd_sock_dgram() -> Int;extern func __os_fd_sock_dgram() -> Int;
/*@briefBinds the low-level runtime symbol `__os_fd_sock_dgram`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionos.fd::sock_dgram
Signature
func sock_dgram() -> Intfunc sock_dgram() -> Int {
return __os_fd_sock_dgram();
}@briefProvides the system library operation `sock_dgram`.
@detailsExecutes the `sock_dgram` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionos.fd::socket
Signature
func socket(domain: Int, typ: Int, protocol: Int) -> Int, ErrCodefunc socket(domain: Int, typ: Int, protocol: Int) -> Int, ErrCode {
if domain < 0 || typ < 0 || protocol < 0 {
return -1, std.ERR_INVALID;@briefProvides the system library operation `socket`.
@detailsExecutes the `socket` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- domainSocket domain or logical domain selected for the operation.
- typType selector used by the native, protocol, or reflection operation.
- protocolProtocol name or version selected for the network operation.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.fd::close
Signature
func close(fd: Int) -> ErrCodefunc close(fd: Int) -> ErrCode {
if fd < 0 {
return std.ERR_INVALID;@briefCloses resources and makes later operations unavailable with `close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.fd::ioctl
Signature
func ioctl(fd: Int, request: Int, data: bytes.Bytes, out_len: Int) -> bytes.Bytes, ErrCodefunc ioctl(fd: Int, request: Int, data: bytes.Bytes, out_len: Int) -> bytes.Bytes, ErrCode {
if fd < 0 || request < 0 || out_len < 0 {
return "", std.ERR_INVALID;@briefProvides the system library operation `ioctl`.
@detailsExecutes the `ioctl` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- requestRequest object, request id, or encoded request payload to process.
- dataInput or output data buffer.
- out_lenSize or length value that limits how much data the operation processes.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.fd::connect_sockaddr
Signature
func connect_sockaddr(fd: Int, sockaddr: bytes.Bytes) -> ErrCodefunc connect_sockaddr(fd: Int, sockaddr: bytes.Bytes) -> ErrCode {
if fd < 0 || bytes.len(sockaddr) == 0 {
return std.ERR_INVALID;@briefProvides the system library operation `connect_sockaddr`.
@detailsExecutes the `connect_sockaddr` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- sockaddrNative socket address pointer passed to the operating-system call.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.fd::getsockopt
Signature
func getsockopt(fd: Int, level: Int, optname: Int, max_bytes: Int) -> bytes.Bytes, ErrCodefunc getsockopt(fd: Int, level: Int, optname: Int, max_bytes: Int) -> bytes.Bytes, ErrCode {
if fd < 0 || max_bytes <= 0 {
return "", std.ERR_INVALID;@briefProvides the system library operation `getsockopt`.
@detailsExecutes the `getsockopt` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- levelCompression level, log level, nesting level, or protocol level value.
- optnameSocket option name or platform option identifier.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.fd::set_nonblock
Signature
func set_nonblock(fd: Int) -> ErrCodefunc set_nonblock(fd: Int) -> ErrCode {
if fd < 0 {
return std.ERR_INVALID;@briefSets state or configuration with `set_nonblock`.
@detailsExecutes the `set_nonblock` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).