diff --git a/programs/develop/ktcc/trunk/libc.obj/source/crt/crt0.asm b/programs/develop/ktcc/trunk/libc.obj/source/crt/crt0.asm index 460938b27..ecfa9f00c 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/crt/crt0.asm +++ b/programs/develop/ktcc/trunk/libc.obj/source/crt/crt0.asm @@ -55,7 +55,7 @@ start: mov dl, cl ; parameter starts cmp al, '"' jz @f ; quotes loaded - mov dh, ch ; parameter without quotes + mov dh, ch ; parameter without quotes dec esi call push_param inc esi diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.c b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.c index 3709bd43e..5382cc62f 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.c @@ -1,7 +1,6 @@ #include #include #include -#include "_exit.h" void _exit(int status) { @@ -14,9 +13,7 @@ void __libc_exit(int status, void (*before_exit)(int status)) if (status && status != 128) { fprintf(stderr, "\nexit code: %d\n", status); } - - WRITE_EXIT_CODE(status); - + if (before_exit) { before_exit(status); } diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.h b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.h deleted file mode 100644 index 0e0865a15..000000000 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/_exit.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __STDLIB_EXIT_H__ -#define __STDLIB_EXIT_H__ - -#include -#include -#include - -#define __PATH_TO_STATUS_FILE "/tmp0/1/.libc" -#define __STATUS_FILE_EXTENSION ".status" -#define __STATUS_FILE_FORMAT "%d" -#define __FULL_STATUS_FILE_NAME __PATH_TO_STATUS_FILE "/%d" __STATUS_FILE_EXTENSION -#define __FULL_STATUS_FILE_NAME_SIZE (sizeof(__PATH_TO_STATUS_FILE) + 32 + sizeof(__STATUS_FILE_EXTENSION)) - -void __libc_exit(int status, void (*before_exit)(int status)); - -// Save exit code -inline void WRITE_EXIT_CODE(int status) -{ - mkdir(__PATH_TO_STATUS_FILE); - - char buff[__FULL_STATUS_FILE_NAME_SIZE]; - ksys_thread_t t; - - _ksys_thread_info(&t, -1); - snprintf(buff, sizeof(buff), __FULL_STATUS_FILE_NAME, t.pid); - - FILE* f = fopen(buff, "w"); - - if (f) { - snprintf(buff, sizeof(buff), __STATUS_FILE_FORMAT, status); - fputs(buff, f); - fflush(f); - fclose(f); - } else { - _ksys_debug_puts("error while write status\n"); - } -} - -// Read exit code -inline int READ_EXIT_CODE(int pid, ksys_thread_t* t) -{ - char buff[__FULL_STATUS_FILE_NAME_SIZE]; - int status = 0; - bool free_t = false; - - if (!t) { - t = malloc(sizeof(ksys_thread_t)); - _ksys_thread_info(t, -1); - free_t = true; - } - snprintf(buff, sizeof(buff), __FULL_STATUS_FILE_NAME, t->pid); - - FILE* f = fopen(buff, "r"); - if (f) { - fscanf(f, __STATUS_FILE_FORMAT, &status); - fclose(f); - } else if (t && t->slot_state == 4) // it was stopped before it created status file - { - status = -1; - } - - if (free_t) { - free(t); - } - - return status; -} - -#endif // __STDLIB_EXIT_H__ diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/abort.c b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/abort.c index 884da55d4..a494f357f 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/abort.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/abort.c @@ -1,3 +1,8 @@ +/* +* SPDX-License-Identifier: GPL-2.0-only +* Copyright (C) 2026 KolibriOS team +*/ + #include #include #include diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/atexit.c b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/atexit.c index f06d1578e..89c2a6682 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/atexit.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/atexit.c @@ -1,3 +1,8 @@ +/* +* SPDX-License-Identifier: GPL-2.0-only +* Copyright (C) 2026 KolibriOS team +*/ + #include struct atexit_n { diff --git a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/exit.c b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/exit.c index 3f6afd26e..f23ff7433 100644 --- a/programs/develop/ktcc/trunk/libc.obj/source/stdlib/exit.c +++ b/programs/develop/ktcc/trunk/libc.obj/source/stdlib/exit.c @@ -1,9 +1,15 @@ -/* Copyright (C) 2021 Logaev Maxim (turbocat2001), GPLv2 */ +/* +* SPDX-License-Identifier: GPL-2.0-only +* Copyright (C) 2021 Logaev Maxim +* Copyright (C) 2026 KolibriOS team +*/ #include #include #include "_exit.h" +/* +TODO static void __close_all() { } @@ -11,6 +17,7 @@ static void __close_all() static void __free_all_mem() { } +*/ void __normal_exit(int status) {