os::exit and os::fastexit added.

This commit is contained in:
Christoffer Lerno
2025-03-20 13:36:59 +01:00
parent d2c44717f1
commit 207bcfea02
5 changed files with 37 additions and 8 deletions

View File

@@ -97,6 +97,7 @@ extern fn CInt close(CInt fd) @if(!env::WIN32);
extern fn double difftime(Time_t time1, Time_t time2) @if(!env::WIN32);
extern fn DivResult div(CInt numer, CInt denom);
extern fn void exit(CInt status);
extern fn void _exit(CInt status) @extern("_Exit");
extern fn CInt fclose(CFile stream);
extern fn CFile fdopen(CInt fd, ZString mode) @if(!env::WIN32);
extern fn CInt feof(CFile stream);

View File

@@ -1,4 +1,4 @@
module libc::os;
module libc::os @if(env::LIBC);
// Linux
extern fn int* __errno_location() @if(env::LINUX);
@@ -22,7 +22,7 @@ extern fn void _get_errno(int* result) @if(env::WIN32);
extern fn void _set_errno(int err) @if(env::WIN32);
// Default
const ERRNO_DEFAULT @local = !env::LINUX && !env::DARWIN && !env::WIN32;
tlocal int _errno_c3 @if(ERRNO_DEFAULT) = 0;
fn void errno_set(int err) @if(ERRNO_DEFAULT) => _errno_c3 = err;
fn int errno() @if(ERRNO_DEFAULT) => _errno_c3;
module libc::os @if(!env::LIBC || !(env::LINUX || env::DARWIN || env::WIN32));
tlocal int _errno_c3 = 0;
fn void errno_set(int err) => _errno_c3 = err;
fn int errno() => _errno_c3;