mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[libc] Change exit status from int to long
Slightly breaking the C standard, but in a way that's unlikely to break things - allow 64-bit process exit status codes.
This commit is contained in:
@@ -19,7 +19,7 @@ object process : object {
|
|||||||
|
|
||||||
# Stop all threads and exit the current process
|
# Stop all threads and exit the current process
|
||||||
method exit [static noreturn] {
|
method exit [static noreturn] {
|
||||||
param result int32 # The result to retrun to the parent process
|
param result int64 # The result to retrun to the parent process
|
||||||
}
|
}
|
||||||
|
|
||||||
# Give the given process a handle that points to the same
|
# Give the given process a handle that points to the same
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ process::create_kernel_process(page_table *pml4)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
process::exit(int32_t code)
|
process::exit(int64_t code)
|
||||||
{
|
{
|
||||||
if (m_state == state::exited)
|
if (m_state == state::exited)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
/// Terminate this process.
|
/// Terminate this process.
|
||||||
/// \arg code The return code to exit with.
|
/// \arg code The return code to exit with.
|
||||||
void exit(int32_t code);
|
void exit(int64_t code);
|
||||||
|
|
||||||
/// Get the process' virtual memory space
|
/// Get the process' virtual memory space
|
||||||
vm_space & space() { return m_space; }
|
vm_space & space() { return m_space; }
|
||||||
@@ -95,7 +95,7 @@ private:
|
|||||||
// This constructor is called by create_kernel_process
|
// This constructor is called by create_kernel_process
|
||||||
process(page_table *kpml4);
|
process(page_table *kpml4);
|
||||||
|
|
||||||
int32_t m_return_code;
|
int64_t m_return_code;
|
||||||
|
|
||||||
vm_space m_space;
|
vm_space m_space;
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ process_kill(process *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
j6_status_t
|
j6_status_t
|
||||||
process_exit(int32_t status)
|
process_exit(int64_t status)
|
||||||
{
|
{
|
||||||
process &p = process::current();
|
process &p = process::current();
|
||||||
log::info(logs::task, "Process <%02lx> exiting with code %d", p.obj_id(), status);
|
log::info(logs::task, "Process <%02lx> exiting with code %#lx", p.obj_id(), status);
|
||||||
|
|
||||||
p.exit(status);
|
p.exit(status);
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ void* pvalloc(size_t);
|
|||||||
_Noreturn void abort( void );
|
_Noreturn void abort( void );
|
||||||
int atexit( void (*func)(void) );
|
int atexit( void (*func)(void) );
|
||||||
int at_quick_exit( void (*func)(void) );
|
int at_quick_exit( void (*func)(void) );
|
||||||
_Noreturn void exit( int status );
|
_Noreturn void exit( long status );
|
||||||
_Noreturn void _Exit( int status );
|
_Noreturn void _Exit( long status );
|
||||||
char *getenv( const char *name );
|
char *getenv( const char *name );
|
||||||
_Noreturn void quick_exit( int status );
|
_Noreturn void quick_exit( long status );
|
||||||
int system( const char *string );
|
int system( const char *string );
|
||||||
|
|
||||||
// Searching and sorting utilities
|
// Searching and sorting utilities
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ size_t quick_exit_count = 0;
|
|||||||
atexit_item quick_exit_array[max_atexit];
|
atexit_item quick_exit_array[max_atexit];
|
||||||
|
|
||||||
[[noreturn]] inline void
|
[[noreturn]] inline void
|
||||||
exit_with_callbacks(int status, atexit_item *cbs, size_t count)
|
exit_with_callbacks(long status, atexit_item *cbs, size_t count)
|
||||||
{
|
{
|
||||||
for (size_t i = count - 1; i < count; --i) {
|
for (size_t i = count - 1; i < count; --i) {
|
||||||
atexit_item &item = cbs[i];
|
atexit_item &item = cbs[i];
|
||||||
@@ -61,13 +61,13 @@ int at_quick_exit( void (*func)(void) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exit(int status)
|
exit(long status)
|
||||||
{
|
{
|
||||||
exit_with_callbacks(status, atexit_array, atexit_count);
|
exit_with_callbacks(status, atexit_array, atexit_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
quick_exit(int status)
|
quick_exit(long status)
|
||||||
{
|
{
|
||||||
exit_with_callbacks(status, quick_exit_array, quick_exit_count);
|
exit_with_callbacks(status, quick_exit_array, quick_exit_count);
|
||||||
}
|
}
|
||||||
@@ -75,11 +75,11 @@ quick_exit(int status)
|
|||||||
void
|
void
|
||||||
abort()
|
abort()
|
||||||
{
|
{
|
||||||
_Exit(INT32_MIN);
|
_Exit(INT64_MIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_Exit( int status )
|
_Exit( long status )
|
||||||
{
|
{
|
||||||
j6_process_exit(status);
|
j6_process_exit(status);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user