Files
bux-lang/lib/Os.bux
T
dimgigov a785747c37
ci / build (ubuntu) (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
feat: Linux/cloud platform stack (TLS, registry, static/cross, selfhost PM)
Ship the QUALITY_PLAN platform focus: thin/minimal runtime, --static/--target,
Nexus HTTPS/mTLS with graceful stop, lock checksums + install --locked,
selfhost registry (search/add/HTTP), containers, and CI smokes for cloud path.
2026-07-23 23:00:55 +03:00

60 lines
1.6 KiB
Plaintext

module Std::Os {
extern func bux_argc() -> int;
extern func bux_argv(index: int) -> String;
extern func bux_getenv(name: String) -> String;
extern func bux_setenv(name: String, value: String) -> int;
extern func bux_getcwd() -> String;
extern func bux_chdir(path: String) -> int;
extern func bux_exit(code: int);
extern func bux_install_stop_handlers();
extern func bux_should_stop() -> int;
extern func bux_set_stop_listen_fd(fd: int);
func Os_ArgsCount() -> int {
return bux_argc();
}
func Os_Args(index: int) -> String {
return bux_argv(index);
}
func Os_GetEnv(name: String) -> String {
return bux_getenv(name);
}
func Os_SetEnv(name: String, value: String) -> bool {
return bux_setenv(name, value) == 0;
}
func Os_GetCwd() -> String {
return bux_getcwd();
}
func Os_Chdir(path: String) -> bool {
return bux_chdir(path) == 0;
}
/* Terminate the process with the given exit code */
func Os_Exit(code: int) {
bux_exit(code);
}
/// Install SIGINT/SIGTERM handlers that set a cooperative stop flag
/// (and close the listen fd if registered via Os_SetStopListenFd).
func Os_InstallStopHandlers() {
bux_install_stop_handlers();
}
/// True after SIGINT/SIGTERM (or if handlers not installed: always false).
func Os_ShouldStop() -> bool {
return bux_should_stop() != 0;
}
/// Register the server listen fd so stop signals can unblock accept().
func Os_SetStopListenFd(fd: int) {
bux_set_stop_listen_fd(fd);
}
}