api
posix.ch
Declarations in posix.ch
1 declarationsprocess
Declarations
Public only
process#
Publicnamespace
namespace process
POSIX implementation of process management.
redirect_to_devnull#
function
func redirect_to_devnull(fd : int) : void
Redirect a file descriptor to /dev/null so un-captured output doesn't
posix_execute#
Publicfunction
NOTE: argv/envp and the program path are built in the PARENT, before
set_nonblock#
function
func set_nonblock(fd : int) : void
Make a file descriptor non-blocking so reads don't stall the timeout loop.
read_available#
function
func read_available(fd : int, data : *vector<u8>) : bool
Read whatever is currently available from a non-blocking fd, stopping on
posix_spawn#
Publicfunction
Same parent-side setup rule as posix_execute() above (no getenv()/malloc()
posix_wait#
Publicfunction
ArgvBuffer#
struct
struct ArgvBuffer {
var ptrs : *char[256]
var count : size_t
}
build_argv#
function
build_envp#
function
pipe#
Publicfunction
func pipe(pipefd : *int) : int
fork#
Publicfunction
func fork() : int
dup2#
Publicfunction
func dup2(oldfd : int, newfd : int) : int
execvp#
Publicfunction
func execvp(file : *char, argv : **char) : int
execve#
Publicfunction
func execve(file : *char, argv : **char, envp : **char) : int
waitpid#
Publicfunction
func waitpid(pid : int, status : *int, options : int) : int
_exit#
Publicfunction
func _exit(status : int) : void
close#
Publicfunction
func close(fd : int) : int
read#
Publicfunction
func read(fd : int, buf : *void, count : size_t) : isize
write#
Publicfunction
func write(fd : int, buf : *void, count : size_t) : isize
getpid#
Publicfunction
func getpid() : int
usleep#
Publicfunction
func usleep(usec : int) : int
chdir#
Publicfunction
func chdir(path : *char) : int
kill#
Publicfunction
func kill(pid : int, sig : int) : int
fcntl#
Publicfunction
func fcntl(fd : int, cmd : int, _ : any) : int
__errno_location#
Publicfunction
func __errno_location() : *int
access#
Publicfunction
func access(path : *char, mode : int) : int
lookup_program#
function
func lookup_program(prog : *char, out : *char, out_size : size_t) : *char
Resolve an executable name to a path usable by execve, searching PATH when
WIFEXITED#
function
func WIFEXITED(status : int) : bool
WEXITSTATUS#
function
func WEXITSTATUS(status : int) : int
WIFSIGNALED#
function
func WIFSIGNALED(status : int) : bool
WTERMSIG#
function
func WTERMSIG(status : int) : int
WIFSTOPPED#
function
func WIFSTOPPED(status : int) : bool
WSTOPSIG#
function
func WSTOPSIG(status : int) : int