Process v0.1.0
_NSGetArgc
pub extern func _NSGetArgc() -> *int32
The address of the process's argument count. dyld fills it before the program starts, from the stack the kernel built. The count belongs to the process for its whole life and must not be written.
See also: https://keith.github.io/xcode-man-pages/environ.7.html
Returns: the address of the argument count, which is never null
_NSGetArgv
pub extern func _NSGetArgv() -> ***char8
The address of the process's argument vector. The vector holds the argument count's worth of NUL-terminated byte strings followed by a null, all owned by the process for its whole life.
See also: https://keith.github.io/xcode-man-pages/environ.7.html
Returns: the address of the argument vector, which is never null
_NSGetExecutablePath
pub extern func _NSGetExecutablePath(
buffer: *var char8,
size: *var uint32
) -> int32
Copies the path of the process's executable into buffer, NUL-terminated.
The path is the one the executable was loaded by, which may be relative or pass through symbolic links. When
buffer is too short nothing is copied and size is set to the size needed.
See also: https://keith.github.io/xcode-man-pages/dyld.3.html
Parameters
| Name | Type | Description |
|---|---|---|
buffer | *var char8 | receives the path |
size | *var uint32 | the buffer's size in bytes, or the size needed when it is too short |
Returns: zero on success, or -1 when the buffer is too short
_NSGetEnviron
pub extern func _NSGetEnviron() -> ***char8
The address of the process's environment vector.
The vector holds NUL-terminated name=value byte strings ended by a null. It is the C library's own environ,
so a call that changes the environment may replace the vector it points to.
See also: https://keith.github.io/xcode-man-pages/environ.7.html
Returns: the address of the environment vector, which is never null
Exit
pub func Exit(code: int32)
Ends the calling process with code.
Only the low eight bits reach a waiting parent. Does not return.
This is _exit rather than exit: nothing registered with atexit runs and no stream is flushed, which matches
what the Linux and FreeBSD packages do and is what a raw binding should do. A program wanting the other behaviour
should call C's exit through Rux/C.
Parameters
| Name | Type | Description |
|---|---|---|
code | int32 | the status to report to the parent |
GetPid
pub func GetPid() -> ProcessId
The calling process's own identifier. Cannot fail. Runs in constant time and allocates nothing.
Returns: the calling process's identifier