[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:
2024-04-27 12:58:51 -07:00
parent 3b9efc11d0
commit bab2dd5c69
6 changed files with 14 additions and 14 deletions

View File

@@ -19,7 +19,7 @@ object process : object {
# Stop all threads and exit the current process
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

View File

@@ -46,7 +46,7 @@ process::create_kernel_process(page_table *pml4)
}
void
process::exit(int32_t code)
process::exit(int64_t code)
{
if (m_state == state::exited)
return;

View File

@@ -42,7 +42,7 @@ public:
/// Terminate this process.
/// \arg code The return code to exit with.
void exit(int32_t code);
void exit(int64_t code);
/// Get the process' virtual memory space
vm_space & space() { return m_space; }
@@ -95,7 +95,7 @@ private:
// This constructor is called by create_kernel_process
process(page_table *kpml4);
int32_t m_return_code;
int64_t m_return_code;
vm_space m_space;

View File

@@ -29,10 +29,10 @@ process_kill(process *self)
}
j6_status_t
process_exit(int32_t status)
process_exit(int64_t status)
{
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);

View File

@@ -66,10 +66,10 @@ void* pvalloc(size_t);
_Noreturn void abort( void );
int atexit( void (*func)(void) );
int at_quick_exit( void (*func)(void) );
_Noreturn void exit( int status );
_Noreturn void _Exit( int status );
_Noreturn void exit( long status );
_Noreturn void _Exit( long status );
char *getenv( const char *name );
_Noreturn void quick_exit( int status );
_Noreturn void quick_exit( long status );
int system( const char *string );
// Searching and sorting utilities

View File

@@ -21,7 +21,7 @@ size_t quick_exit_count = 0;
atexit_item quick_exit_array[max_atexit];
[[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) {
atexit_item &item = cbs[i];
@@ -61,13 +61,13 @@ int at_quick_exit( void (*func)(void) )
}
void
exit(int status)
exit(long status)
{
exit_with_callbacks(status, atexit_array, atexit_count);
}
void
quick_exit(int status)
quick_exit(long status)
{
exit_with_callbacks(status, quick_exit_array, quick_exit_count);
}
@@ -75,11 +75,11 @@ quick_exit(int status)
void
abort()
{
_Exit(INT32_MIN);
_Exit(INT64_MIN);
}
void
_Exit( int status )
_Exit( long status )
{
j6_process_exit(status);
}