From 6c01de8b0d2bc310d8e21a2c350197d1f574e7aa Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 12 Apr 2026 13:45:37 +0200 Subject: [PATCH] Merge all libs into libu --- Makefile | 14 +------- aux/compiledb.sh | 14 +------- aux/devel.sh | 14 +------- aux/docs.sh | 14 +------- aux/format.sh | 14 +------- ce/Makefile | 15 -------- ce/ce.c | 4 +-- ce/edit.c | 2 +- ce/interp.c | 1 - devices/Makefile | 9 ----- devices/devices.c | 4 +-- init/Makefile | 12 ------- libarena/Makefile | 7 ---- libarena/src.mk | 3 -- libaux/.gitignore | 4 --- libaux/Makefile | 13 ------- libaux/amd64/setjmp.c | 34 ------------------ libaux/amd64/src.mk | 3 -- libaux/build/.gitignore | 1 - libaux/src.mk | 9 ----- libdebugconsole/.gitignore | 4 --- libdebugconsole/Makefile | 11 ------ libdebugconsole/build/.gitignore | 1 - libdebugconsole/src.mk | 3 -- libfat/.gitignore | 4 --- libfat/Makefile | 13 ------- libfat/build/.gitignore | 1 - libfat/src.mk | 5 --- libinput/.gitignore | 4 --- libinput/Makefile | 14 -------- libinput/build/.gitignore | 1 - libinput/src.mk | 5 --- libioutil/.gitignore | 4 --- libioutil/Makefile | 8 ----- libioutil/build/.gitignore | 1 - libioutil/src.mk | 5 --- libkb/.gitignore | 4 --- libkb/Makefile | 7 ---- libkb/build/.gitignore | 1 - libkb/src.mk | 3 -- libmalloc/.gitignore | 4 --- libmalloc/Makefile | 10 ------ libmalloc/build/.gitignore | 1 - libmalloc/src.mk | 3 -- libmath/.gitignore | 4 --- libmath/Makefile | 5 --- libmath/build/.gitignore | 1 - libmath/src.mk | 3 -- libprocess/.gitignore | 4 --- libprocess/Makefile | 9 ----- libprocess/amd64/.gitignore | 1 - libprocess/amd64/src.mk | 6 ---- libprocess/build/.gitignore | 1 - libprocess/process_self.c | 22 ------------ libprocess/process_self.h | 14 -------- libprocess/src.mk | 7 ---- libstring/.gitignore | 4 --- libstring/Makefile | 7 ---- libstring/build/.gitignore | 1 - libstring/src.mk | 5 --- libsystem/.gitignore | 4 --- libsystem/Makefile | 5 --- libsystem/amd64/.gitignore | 1 - libsystem/amd64/src.mk | 8 ----- libsystem/build/.gitignore | 1 - libsystem/init/.gitignore | 1 - libsystem/init/src.mk | 3 -- libsystem/src.mk | 6 ---- libterminal/.gitignore | 4 --- libterminal/Makefile | 7 ---- libterminal/build/.gitignore | 1 - libterminal/src.mk | 3 -- {libarena => libu}/.gitignore | 0 libu/Makefile | 11 ++++++ {libsystem/init => libu}/__premain.c | 4 +-- {libfat => libu}/_fat.c | 0 {libfat => libu}/_fat.h | 0 {libfat => libu}/_fatctx.h | 0 {libmalloc => libu}/_malloc_port.c | 0 {libaux => libu}/amd64/.gitignore | 0 {libsystem => libu}/amd64/_start.S | 0 {libprocess => libu}/amd64/clone_tramp.S | 0 {libprocess => libu}/amd64/clone_tramp1.c | 0 libu/amd64/src.mk | 12 +++++++ {libsystem => libu}/amd64/stall.c | 0 {libsystem => libu}/amd64/syscall.c | 0 {libsystem => libu}/amd64/syscall.h | 0 {libterminal => libu}/ansiq_LICENSE.txt | 0 {libterminal => libu}/ansiq_README.md | 0 {libarena => libu}/arena.c | 0 {libarena => libu}/arena.h | 0 {libaux => libu}/assert.h | 0 {libarena => libu}/build/.gitignore | 0 {libdebugconsole => libu}/debugconsole.c | 0 {libdebugconsole => libu}/debugconsole.h | 0 {libioutil => libu}/filereader.c | 0 {libioutil => libu}/filereader.h | 0 {libioutil => libu}/filewriter.c | 0 {libioutil => libu}/filewriter.h | 0 {libinput => libu}/in_gb.c | 0 {libinput => libu}/in_gb.h | 0 {libinput => libu}/in_input.c | 2 +- {libinput => libu}/in_input.h | 0 {libkb => libu}/kb.c | 0 {libkb => libu}/kb.h | 0 {libfat => libu}/libfat.c | 0 {libfat => libu}/libfat.h | 0 {libaux => libu}/list.h | 0 {libmalloc => libu}/malloc.c | 0 {libmalloc => libu}/malloc.h | 0 {libmath => libu}/math.c | 0 {libmath => libu}/math.h | 0 {libaux => libu}/minmax.h | 0 {libaux => libu}/mprintf.c | 2 +- {libaux => libu}/mprintf.h | 0 {libaux => libu}/path.c | 0 {libaux => libu}/path.h | 0 {libaux => libu}/printf.c | 0 {libaux => libu}/printf.h | 0 {libaux => libu}/printf_config.h | 0 {libprocess => libu}/process.c | 23 ++++++++++++ {libprocess => libu}/process.h | 10 ++++++ {libaux => libu}/setjmp.h | 0 libu/src.mk | 43 +++++++++++++++++++++++ {libsystem => libu}/stall.h | 0 {libsystem => libu}/str_status.h | 0 {libstring => libu}/strconv.c | 0 {libstring => libu}/strconv.h | 0 {libstring => libu}/string.c | 0 {libstring => libu}/string.h | 0 {libsystem => libu}/syscall.h | 0 {libsystem => libu}/system.c | 0 {libsystem => libu}/system.h | 0 {libterminal => libu}/tcommon.h | 0 {libterminal => libu}/tcursor.h | 0 {libterminal => libu}/terminal.c | 0 {libterminal => libu}/terminal.h | 0 {libterminal => libu}/tgraphics.h | 0 {libterminal => libu}/tscreen.h | 0 mailtest/Makefile | 9 ----- mailtest/mailtest.c | 4 +-- make/libarena.mk | 16 --------- make/libaux.mk | 16 --------- make/libdebugconsole.mk | 16 --------- make/libfat.mk | 16 --------- make/libinput.mk | 16 --------- make/libioutil.mk | 16 --------- make/libkb.mk | 16 --------- make/libmalloc.mk | 16 --------- make/libmath.mk | 16 --------- make/libprocess.mk | 16 --------- make/libstring.mk | 16 --------- make/libsystem.mk | 16 --------- make/libterminal.mk | 16 --------- make/libu.mk | 16 +++++++++ make/user.mk | 4 +-- sdutil/Makefile | 13 ------- sdutil/sdutil.c | 4 +-- usb/Makefile | 9 ----- usb/usb.c | 3 -- 160 files changed, 131 insertions(+), 692 deletions(-) delete mode 100644 libarena/Makefile delete mode 100644 libarena/src.mk delete mode 100644 libaux/.gitignore delete mode 100644 libaux/Makefile delete mode 100644 libaux/amd64/setjmp.c delete mode 100644 libaux/amd64/src.mk delete mode 100644 libaux/build/.gitignore delete mode 100644 libaux/src.mk delete mode 100644 libdebugconsole/.gitignore delete mode 100644 libdebugconsole/Makefile delete mode 100644 libdebugconsole/build/.gitignore delete mode 100644 libdebugconsole/src.mk delete mode 100644 libfat/.gitignore delete mode 100644 libfat/Makefile delete mode 100644 libfat/build/.gitignore delete mode 100644 libfat/src.mk delete mode 100644 libinput/.gitignore delete mode 100644 libinput/Makefile delete mode 100644 libinput/build/.gitignore delete mode 100644 libinput/src.mk delete mode 100644 libioutil/.gitignore delete mode 100644 libioutil/Makefile delete mode 100644 libioutil/build/.gitignore delete mode 100644 libioutil/src.mk delete mode 100644 libkb/.gitignore delete mode 100644 libkb/Makefile delete mode 100644 libkb/build/.gitignore delete mode 100644 libkb/src.mk delete mode 100644 libmalloc/.gitignore delete mode 100644 libmalloc/Makefile delete mode 100644 libmalloc/build/.gitignore delete mode 100644 libmalloc/src.mk delete mode 100644 libmath/.gitignore delete mode 100644 libmath/Makefile delete mode 100644 libmath/build/.gitignore delete mode 100644 libmath/src.mk delete mode 100644 libprocess/.gitignore delete mode 100644 libprocess/Makefile delete mode 100644 libprocess/amd64/.gitignore delete mode 100644 libprocess/amd64/src.mk delete mode 100644 libprocess/build/.gitignore delete mode 100644 libprocess/process_self.c delete mode 100644 libprocess/process_self.h delete mode 100644 libprocess/src.mk delete mode 100644 libstring/.gitignore delete mode 100644 libstring/Makefile delete mode 100644 libstring/build/.gitignore delete mode 100644 libstring/src.mk delete mode 100644 libsystem/.gitignore delete mode 100644 libsystem/Makefile delete mode 100644 libsystem/amd64/.gitignore delete mode 100644 libsystem/amd64/src.mk delete mode 100644 libsystem/build/.gitignore delete mode 100644 libsystem/init/.gitignore delete mode 100644 libsystem/init/src.mk delete mode 100644 libsystem/src.mk delete mode 100644 libterminal/.gitignore delete mode 100644 libterminal/Makefile delete mode 100644 libterminal/build/.gitignore delete mode 100644 libterminal/src.mk rename {libarena => libu}/.gitignore (100%) create mode 100644 libu/Makefile rename {libsystem/init => libu}/__premain.c (91%) rename {libfat => libu}/_fat.c (100%) rename {libfat => libu}/_fat.h (100%) rename {libfat => libu}/_fatctx.h (100%) rename {libmalloc => libu}/_malloc_port.c (100%) rename {libaux => libu}/amd64/.gitignore (100%) rename {libsystem => libu}/amd64/_start.S (100%) rename {libprocess => libu}/amd64/clone_tramp.S (100%) rename {libprocess => libu}/amd64/clone_tramp1.c (100%) create mode 100644 libu/amd64/src.mk rename {libsystem => libu}/amd64/stall.c (100%) rename {libsystem => libu}/amd64/syscall.c (100%) rename {libsystem => libu}/amd64/syscall.h (100%) rename {libterminal => libu}/ansiq_LICENSE.txt (100%) rename {libterminal => libu}/ansiq_README.md (100%) rename {libarena => libu}/arena.c (100%) rename {libarena => libu}/arena.h (100%) rename {libaux => libu}/assert.h (100%) rename {libarena => libu}/build/.gitignore (100%) rename {libdebugconsole => libu}/debugconsole.c (100%) rename {libdebugconsole => libu}/debugconsole.h (100%) rename {libioutil => libu}/filereader.c (100%) rename {libioutil => libu}/filereader.h (100%) rename {libioutil => libu}/filewriter.c (100%) rename {libioutil => libu}/filewriter.h (100%) rename {libinput => libu}/in_gb.c (100%) rename {libinput => libu}/in_gb.h (100%) rename {libinput => libu}/in_input.c (99%) rename {libinput => libu}/in_input.h (100%) rename {libkb => libu}/kb.c (100%) rename {libkb => libu}/kb.h (100%) rename {libfat => libu}/libfat.c (100%) rename {libfat => libu}/libfat.h (100%) rename {libaux => libu}/list.h (100%) rename {libmalloc => libu}/malloc.c (100%) rename {libmalloc => libu}/malloc.h (100%) rename {libmath => libu}/math.c (100%) rename {libmath => libu}/math.h (100%) rename {libaux => libu}/minmax.h (100%) rename {libaux => libu}/mprintf.c (97%) rename {libaux => libu}/mprintf.h (100%) rename {libaux => libu}/path.c (100%) rename {libaux => libu}/path.h (100%) rename {libaux => libu}/printf.c (100%) rename {libaux => libu}/printf.h (100%) rename {libaux => libu}/printf_config.h (100%) rename {libprocess => libu}/process.c (67%) rename {libprocess => libu}/process.h (78%) rename {libaux => libu}/setjmp.h (100%) create mode 100644 libu/src.mk rename {libsystem => libu}/stall.h (100%) rename {libsystem => libu}/str_status.h (100%) rename {libstring => libu}/strconv.c (100%) rename {libstring => libu}/strconv.h (100%) rename {libstring => libu}/string.c (100%) rename {libstring => libu}/string.h (100%) rename {libsystem => libu}/syscall.h (100%) rename {libsystem => libu}/system.c (100%) rename {libsystem => libu}/system.h (100%) rename {libterminal => libu}/tcommon.h (100%) rename {libterminal => libu}/tcursor.h (100%) rename {libterminal => libu}/terminal.c (100%) rename {libterminal => libu}/terminal.h (100%) rename {libterminal => libu}/tgraphics.h (100%) rename {libterminal => libu}/tscreen.h (100%) delete mode 100644 make/libarena.mk delete mode 100644 make/libaux.mk delete mode 100644 make/libdebugconsole.mk delete mode 100644 make/libfat.mk delete mode 100644 make/libinput.mk delete mode 100644 make/libioutil.mk delete mode 100644 make/libkb.mk delete mode 100644 make/libmalloc.mk delete mode 100644 make/libmath.mk delete mode 100644 make/libprocess.mk delete mode 100644 make/libstring.mk delete mode 100644 make/libsystem.mk delete mode 100644 make/libterminal.mk create mode 100644 make/libu.mk diff --git a/Makefile b/Makefile index 95ff32a..181a187 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,4 @@ include make/lz4.mk include make/apps.mk include make/kernel.mk include make/dist.mk -include make/libsystem.mk -include make/libmalloc.mk -include make/libterminal.mk -include make/libprocess.mk -include make/libstring.mk -include make/libkb.mk -include make/libaux.mk -include make/libarena.mk -include make/libioutil.mk -include make/libmath.mk -include make/libfat.mk -include make/libdebugconsole.mk -include make/libinput.mk +include make/libu.mk diff --git a/aux/compiledb.sh b/aux/compiledb.sh index 25e5781..f8a1c7e 100755 --- a/aux/compiledb.sh +++ b/aux/compiledb.sh @@ -3,17 +3,5 @@ set -x make -B all_compiledb_kernel -make -B all_compiledb_libmalloc -make -B all_compiledb_libsystem -make -B all_compiledb_libprocess -make -B all_compiledb_libterminal -make -B all_compiledb_libstring -make -B all_compiledb_libkb -make -B all_compiledb_libaux -make -B all_compiledb_libarena -make -B all_compiledb_libioutil -make -B all_compiledb_libmath -make -B all_compiledb_libfat -make -B all_compiledb_libdebugconsole -make -B all_compiledb_libinput +make -B all_compiledb_libu make -B compiledb_apps diff --git a/aux/devel.sh b/aux/devel.sh index 3b7ee21..7c2b8fc 100755 --- a/aux/devel.sh +++ b/aux/devel.sh @@ -10,19 +10,7 @@ fi make -B all_lz4 make -B all_kernel "$bt" -make -B all_libsystem "$bt" -make -B all_libmalloc "$bt" -make -B all_libprocess "$bt" -make -B all_libterminal "$bt" -make -B all_libstring "$bt" -make -B all_libkb "$bt" -make -B all_libaux "$bt" -make -B all_libarena "$bt" -make -B all_libioutil "$bt" -make -B all_libmath "$bt" -make -B all_libfat "$bt" -make -B all_libdebugconsole "$bt" -make -B all_libinput "$bt" +make -B all_libu "$bt" make -B all_apps "$bt" make -B all_dist ./aux/limine_iso_amd64.sh diff --git a/aux/docs.sh b/aux/docs.sh index 8d0d77b..033df2f 100755 --- a/aux/docs.sh +++ b/aux/docs.sh @@ -4,18 +4,6 @@ set -x ./aux/compiledb.sh -make -B docs_libmalloc -make -B docs_libsystem -make -B docs_libprocess -make -B docs_libstring -make -B docs_libterminal -make -B docs_libkb -make -B docs_libaux -make -B docs_libarena -make -B docs_libioutil -make -B docs_libmath -make -B docs_libfat -make -B docs_libdebugconsole -make -B docs_libinput +make -B docs_libu make -B docs_apps mkdocs build diff --git a/aux/format.sh b/aux/format.sh index 96934aa..68e20bf 100755 --- a/aux/format.sh +++ b/aux/format.sh @@ -3,17 +3,5 @@ set -x make -B format_kernel -make -B format_libsystem -make -B format_libterminal -make -B format_libprocess -make -B format_libmalloc -make -B format_libstring -make -B format_libkb -make -B format_libaux -make -B format_libarena -make -B format_libioutil -make -B format_libmath -make -B format_libfat -make -B format_libdebugconsole -make -B format_libinput +make -B format_libu make -B format_apps diff --git a/ce/Makefile b/ce/Makefile index bc091b1..d16094b 100644 --- a/ce/Makefile +++ b/ce/Makefile @@ -1,16 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libaux)) -$(eval $(call add_lib,libarena)) -$(eval $(call add_lib,libioutil)) -$(eval $(call add_lib,libterminal)) -$(eval $(call add_lib,libmalloc)) -$(eval $(call add_lib,libdebugconsole)) -$(eval $(call add_lib,libinput)) -$(eval $(call add_include,libkb)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/ce/ce.c b/ce/ce.c index 77c4a6e..ca99635 100644 --- a/ce/ce.c +++ b/ce/ce.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -78,8 +78,6 @@ static bool split_lines_cb (void* ctx, const char* start, size_t len) { } void app_main (void) { - libprocess_self_init (); - char scriptpathbuf[PATH_MAX]; char line[1024]; diff --git a/ce/edit.c b/ce/edit.c index 6783ef2..4fb1928 100644 --- a/ce/edit.c +++ b/ce/edit.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/ce/interp.c b/ce/interp.c index c83a6fd..c1603e9 100644 --- a/ce/interp.c +++ b/ce/interp.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/devices/Makefile b/devices/Makefile index 117cc7d..d16094b 100644 --- a/devices/Makefile +++ b/devices/Makefile @@ -1,10 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libaux)) -$(eval $(call add_lib,libmalloc)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/devices/devices.c b/devices/devices.c index b0b0cb3..0b9b5e9 100644 --- a/devices/devices.c +++ b/devices/devices.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -28,8 +28,6 @@ static void list_all_devices (void) { } void app_main (void) { - libprocess_self_init (); - char commandbuf[32]; memset (commandbuf, 0, sizeof (commandbuf)); diff --git a/init/Makefile b/init/Makefile index bb5406a..d16094b 100644 --- a/init/Makefile +++ b/init/Makefile @@ -1,13 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libterminal)) -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libdebugconsole)) -$(eval $(call add_lib,libaux)) -$(eval $(call add_lib,libkb)) -$(eval $(call add_lib,libmalloc)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/libarena/Makefile b/libarena/Makefile deleted file mode 100644 index ae34b23..0000000 --- a/libarena/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libmalloc)) - -libname := libarena - -include ../make/lib.mk diff --git a/libarena/src.mk b/libarena/src.mk deleted file mode 100644 index 80a4429..0000000 --- a/libarena/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += arena.c - -o += arena.o diff --git a/libaux/.gitignore b/libaux/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libaux/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libaux/Makefile b/libaux/Makefile deleted file mode 100644 index 397a025..0000000 --- a/libaux/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libmalloc)) -$(eval $(call add_include,libprocess)) -$(eval $(call add_include,libstring)) -$(eval $(call add_include,libdebugconsole)) - -libname := libaux - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - -include ../make/lib.mk diff --git a/libaux/amd64/setjmp.c b/libaux/amd64/setjmp.c deleted file mode 100644 index f2a9077..0000000 --- a/libaux/amd64/setjmp.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -/* https://nullprogram.com/blog/2023/02/12 */ - -__attribute__ ((naked, returns_twice)) int setjmp (jmp_buf buf) { - __asm__ volatile ("mov (%rsp), %rax\n" - "mov %rax, 0(%rcx)\n" - "lea 8(%rsp), %rax\n" - "mov %rax, 8(%rcx)\n" - "mov %rbp, 16(%rcx)\n" - "mov %rbx, 24(%rcx)\n" - "mov %rdi, 32(%rcx)\n" - "mov %rsi, 40(%rcx)\n" - "mov %r12, 48(%rcx)\n" - "mov %r13, 56(%rcx)\n" - "mov %r14, 64(%rcx)\n" - "mov %r15, 72(%rcx)\n" - "xor %eax, %eax\n" - "ret\n"); -} - -__attribute__ ((naked, noreturn)) void longjmp (jmp_buf buf, int ret) { - __asm__ volatile ("mov 72(%rcx), %r15\n" - "mov 64(%rcx), %r14\n" - "mov 56(%rcx), %r13\n" - "mov 48(%rcx), %r12\n" - "mov 40(%rcx), %rsi\n" - "mov 32(%rcx), %rdi\n" - "mov 24(%rcx), %rbx\n" - "mov 16(%rcx), %rbp\n" - "mov 8(%rcx), %rsp\n" - "mov %edx, %eax\n" - "jmp *0(%rcx)\n"); -} diff --git a/libaux/amd64/src.mk b/libaux/amd64/src.mk deleted file mode 100644 index 1fd23a6..0000000 --- a/libaux/amd64/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += amd64/setjmp.c - -o += amd64/setjmp.o diff --git a/libaux/build/.gitignore b/libaux/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libaux/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libaux/src.mk b/libaux/src.mk deleted file mode 100644 index 85dea92..0000000 --- a/libaux/src.mk +++ /dev/null @@ -1,9 +0,0 @@ -include $(platform)/src.mk - -c += printf.c \ - path.c \ - mprintf.c - -o += printf.o \ - path.o \ - mprintf.o diff --git a/libdebugconsole/.gitignore b/libdebugconsole/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libdebugconsole/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libdebugconsole/Makefile b/libdebugconsole/Makefile deleted file mode 100644 index ebc145c..0000000 --- a/libdebugconsole/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libmalloc)) -$(eval $(call add_include,libaux)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - -libname := libdebugconsole - -include ../make/lib.mk diff --git a/libdebugconsole/build/.gitignore b/libdebugconsole/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libdebugconsole/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libdebugconsole/src.mk b/libdebugconsole/src.mk deleted file mode 100644 index b6abdc3..0000000 --- a/libdebugconsole/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += debugconsole.c - -o += debugconsole.o diff --git a/libfat/.gitignore b/libfat/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libfat/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libfat/Makefile b/libfat/Makefile deleted file mode 100644 index 05d93fa..0000000 --- a/libfat/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libstring)) -$(eval $(call add_include,libaux)) - -cflags += -D"FAT_PRINTF(a)" - -DOCS_COLLECT = $$(git ls-files '*.c' '*.h' ':!\_fat.c' ':!\_fat.h' ':!\_fatctx.h') - -libname := libfat - -include ../make/lib.mk diff --git a/libfat/build/.gitignore b/libfat/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libfat/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libfat/src.mk b/libfat/src.mk deleted file mode 100644 index ec7ca1b..0000000 --- a/libfat/src.mk +++ /dev/null @@ -1,5 +0,0 @@ -c += _fat.c \ - libfat.c - -o += _fat.o \ - libfat.o diff --git a/libinput/.gitignore b/libinput/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libinput/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libinput/Makefile b/libinput/Makefile deleted file mode 100644 index 15ffea8..0000000 --- a/libinput/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libstring)) -$(eval $(call add_include,libmalloc)) -$(eval $(call add_include,libaux)) -$(eval $(call add_include,libterminal)) -$(eval $(call add_include,libarena)) -$(eval $(call add_include,libkb)) -$(eval $(call add_include,libprocess)) - -libname := libinput - -include ../make/lib.mk diff --git a/libinput/build/.gitignore b/libinput/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libinput/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libinput/src.mk b/libinput/src.mk deleted file mode 100644 index a78759a..0000000 --- a/libinput/src.mk +++ /dev/null @@ -1,5 +0,0 @@ -c += in_gb.c \ - in_input.c - -o += in_gb.o \ - in_input.o diff --git a/libioutil/.gitignore b/libioutil/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libioutil/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libioutil/Makefile b/libioutil/Makefile deleted file mode 100644 index 0ee0dcc..0000000 --- a/libioutil/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libstring)) - -libname := libioutil - -include ../make/lib.mk diff --git a/libioutil/build/.gitignore b/libioutil/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libioutil/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libioutil/src.mk b/libioutil/src.mk deleted file mode 100644 index 8cce3f7..0000000 --- a/libioutil/src.mk +++ /dev/null @@ -1,5 +0,0 @@ -c += filewriter.c \ - filereader.c - -o += filewriter.o \ - filereader.o diff --git a/libkb/.gitignore b/libkb/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libkb/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libkb/Makefile b/libkb/Makefile deleted file mode 100644 index 27360f3..0000000 --- a/libkb/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) - -libname := libkb - -include ../make/lib.mk diff --git a/libkb/build/.gitignore b/libkb/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libkb/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libkb/src.mk b/libkb/src.mk deleted file mode 100644 index 840aa90..0000000 --- a/libkb/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += kb.c - -o += kb.o diff --git a/libmalloc/.gitignore b/libmalloc/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libmalloc/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libmalloc/Makefile b/libmalloc/Makefile deleted file mode 100644 index 832b956..0000000 --- a/libmalloc/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libstring)) - -libname := libmalloc - -FORMAT = clang-format -i $$(git ls-files '*.c' '*.h' ':!malloc.c' ':!malloc.h') - -include ../make/lib.mk diff --git a/libmalloc/build/.gitignore b/libmalloc/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libmalloc/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libmalloc/src.mk b/libmalloc/src.mk deleted file mode 100644 index 4c3c432..0000000 --- a/libmalloc/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += malloc.c - -o += malloc.o diff --git a/libmath/.gitignore b/libmath/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libmath/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libmath/Makefile b/libmath/Makefile deleted file mode 100644 index 71ea81f..0000000 --- a/libmath/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../make/ufuncs.mk - -libname := libmath - -include ../make/lib.mk diff --git a/libmath/build/.gitignore b/libmath/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libmath/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libmath/src.mk b/libmath/src.mk deleted file mode 100644 index f4df5ac..0000000 --- a/libmath/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += math.c - -o += math.o diff --git a/libprocess/.gitignore b/libprocess/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libprocess/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libprocess/Makefile b/libprocess/Makefile deleted file mode 100644 index 87aaa71..0000000 --- a/libprocess/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) -$(eval $(call add_include,libmalloc)) -$(eval $(call add_include,libdebugconsole)) - -libname := libprocess - -include ../make/lib.mk diff --git a/libprocess/amd64/.gitignore b/libprocess/amd64/.gitignore deleted file mode 100644 index 5761abc..0000000 --- a/libprocess/amd64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/libprocess/amd64/src.mk b/libprocess/amd64/src.mk deleted file mode 100644 index 62013f1..0000000 --- a/libprocess/amd64/src.mk +++ /dev/null @@ -1,6 +0,0 @@ -c += amd64/clone_tramp1.c - -S += amd64/clone_tramp.S - -o += amd64/clone_tramp.o \ - amd64/clone_tramp1.o diff --git a/libprocess/build/.gitignore b/libprocess/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libprocess/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libprocess/process_self.c b/libprocess/process_self.c deleted file mode 100644 index efce891..0000000 --- a/libprocess/process_self.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -static int e_pid; -static int e_pgid; -static int pid; -static int pgid; - -void libprocess_self_init (void) { - e_pid = get_exec_pid (); - e_pgid = get_procgroup (e_pid); - pid = get_self_pid (); - pgid = get_procgroup (pid); -} - -int process_get_exec_pid (void) { return e_pid; } - -int process_get_exec_pgid (void) { return e_pgid; } - -int process_get_pid (void) { return pid; } - -int process_get_pgid (void) { return pgid; } diff --git a/libprocess/process_self.h b/libprocess/process_self.h deleted file mode 100644 index 6e21e7e..0000000 --- a/libprocess/process_self.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _LIBPROCESS_PROCESS_SELF_H -#define _LIBPROCESS_PROCESS_SELF_H - -void libprocess_self_init (void); - -int process_get_exec_pid (void); - -int process_get_exec_pgid (void); - -int process_get_pid (void); - -int process_get_pgid (void); - -#endif // _LIBPROCESS_PROCESS_SELF_H diff --git a/libprocess/src.mk b/libprocess/src.mk deleted file mode 100644 index 3e04574..0000000 --- a/libprocess/src.mk +++ /dev/null @@ -1,7 +0,0 @@ -include $(platform)/src.mk - -c += process.c \ - process_self.c - -o += process.o \ - process_self.o diff --git a/libstring/.gitignore b/libstring/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libstring/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libstring/Makefile b/libstring/Makefile deleted file mode 100644 index c7fd7f2..0000000 --- a/libstring/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) - -libname := libstring - -include ../make/lib.mk diff --git a/libstring/build/.gitignore b/libstring/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libstring/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libstring/src.mk b/libstring/src.mk deleted file mode 100644 index 98fb67a..0000000 --- a/libstring/src.mk +++ /dev/null @@ -1,5 +0,0 @@ -c += string.c \ - strconv.c - -o += string.o \ - strconv.o diff --git a/libsystem/.gitignore b/libsystem/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libsystem/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libsystem/Makefile b/libsystem/Makefile deleted file mode 100644 index 240335b..0000000 --- a/libsystem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../make/ufuncs.mk - -libname := libsystem - -include ../make/lib.mk diff --git a/libsystem/amd64/.gitignore b/libsystem/amd64/.gitignore deleted file mode 100644 index 5761abc..0000000 --- a/libsystem/amd64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/libsystem/amd64/src.mk b/libsystem/amd64/src.mk deleted file mode 100644 index a9801a4..0000000 --- a/libsystem/amd64/src.mk +++ /dev/null @@ -1,8 +0,0 @@ -c += amd64/syscall.c \ - amd64/stall.c - -S += amd64/_start.S - -o += amd64/_start.o \ - amd64/syscall.o \ - amd64/stall.o diff --git a/libsystem/build/.gitignore b/libsystem/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libsystem/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libsystem/init/.gitignore b/libsystem/init/.gitignore deleted file mode 100644 index 5761abc..0000000 --- a/libsystem/init/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/libsystem/init/src.mk b/libsystem/init/src.mk deleted file mode 100644 index e6c74ca..0000000 --- a/libsystem/init/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += init/__premain.c - -o += init/__premain.o diff --git a/libsystem/src.mk b/libsystem/src.mk deleted file mode 100644 index 5208875..0000000 --- a/libsystem/src.mk +++ /dev/null @@ -1,6 +0,0 @@ -include $(platform)/src.mk -include init/src.mk - -c += system.c - -o += system.o diff --git a/libterminal/.gitignore b/libterminal/.gitignore deleted file mode 100644 index de276e3..0000000 --- a/libterminal/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.o -*.json -docs/ -.cache/ diff --git a/libterminal/Makefile b/libterminal/Makefile deleted file mode 100644 index e6898fe..0000000 --- a/libterminal/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../make/ufuncs.mk - -$(eval $(call add_include,libsystem)) - -libname := libterminal - -include ../make/lib.mk diff --git a/libterminal/build/.gitignore b/libterminal/build/.gitignore deleted file mode 100644 index 10301e2..0000000 --- a/libterminal/build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.a diff --git a/libterminal/src.mk b/libterminal/src.mk deleted file mode 100644 index d1eb465..0000000 --- a/libterminal/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += terminal.c - -o += terminal.o diff --git a/libarena/.gitignore b/libu/.gitignore similarity index 100% rename from libarena/.gitignore rename to libu/.gitignore diff --git a/libu/Makefile b/libu/Makefile new file mode 100644 index 0000000..7aece48 --- /dev/null +++ b/libu/Makefile @@ -0,0 +1,11 @@ +FORMAT = clang-format -i $$(git ls-files '*.c' '*.h' ':!malloc.c' ':!malloc.h' \ + ':!\_fat.c' ':!\_fat.h' ':!\_fatctx.h') + +DOCS_COLLECT = $$(git ls-files '*.c' '*.h' ':!\_fat.c' ':!\_fat.h' ':!\_fatctx.h' \ + ':!malloc.c' ':!malloc.h') + +cflags += -DPRINTF_INCLUDE_CONFIG_H=1 -D"FAT_PRINTF(a)" + +libname := libu + +include ../make/lib.mk diff --git a/libsystem/init/__premain.c b/libu/__premain.c similarity index 91% rename from libsystem/init/__premain.c rename to libu/__premain.c index 6f7b974..57c6dc2 100644 --- a/libsystem/init/__premain.c +++ b/libu/__premain.c @@ -1,3 +1,4 @@ +#include #include #include @@ -20,8 +21,7 @@ static void clear_bss (void) { void __premain (void) { clear_bss (); - + process_self_init (); app_main (); - quit (); } diff --git a/libfat/_fat.c b/libu/_fat.c similarity index 100% rename from libfat/_fat.c rename to libu/_fat.c diff --git a/libfat/_fat.h b/libu/_fat.h similarity index 100% rename from libfat/_fat.h rename to libu/_fat.h diff --git a/libfat/_fatctx.h b/libu/_fatctx.h similarity index 100% rename from libfat/_fatctx.h rename to libu/_fatctx.h diff --git a/libmalloc/_malloc_port.c b/libu/_malloc_port.c similarity index 100% rename from libmalloc/_malloc_port.c rename to libu/_malloc_port.c diff --git a/libaux/amd64/.gitignore b/libu/amd64/.gitignore similarity index 100% rename from libaux/amd64/.gitignore rename to libu/amd64/.gitignore diff --git a/libsystem/amd64/_start.S b/libu/amd64/_start.S similarity index 100% rename from libsystem/amd64/_start.S rename to libu/amd64/_start.S diff --git a/libprocess/amd64/clone_tramp.S b/libu/amd64/clone_tramp.S similarity index 100% rename from libprocess/amd64/clone_tramp.S rename to libu/amd64/clone_tramp.S diff --git a/libprocess/amd64/clone_tramp1.c b/libu/amd64/clone_tramp1.c similarity index 100% rename from libprocess/amd64/clone_tramp1.c rename to libu/amd64/clone_tramp1.c diff --git a/libu/amd64/src.mk b/libu/amd64/src.mk new file mode 100644 index 0000000..33d556d --- /dev/null +++ b/libu/amd64/src.mk @@ -0,0 +1,12 @@ +c += amd64/syscall.c \ + amd64/stall.c \ + amd64/clone_tramp1.c + +S += amd64/_start.S \ + amd64/clone_tramp.S + +o += amd64/_start.o \ + amd64/syscall.o \ + amd64/stall.o \ + amd64/clone_tramp.o \ + amd64/clone_tramp1.o diff --git a/libsystem/amd64/stall.c b/libu/amd64/stall.c similarity index 100% rename from libsystem/amd64/stall.c rename to libu/amd64/stall.c diff --git a/libsystem/amd64/syscall.c b/libu/amd64/syscall.c similarity index 100% rename from libsystem/amd64/syscall.c rename to libu/amd64/syscall.c diff --git a/libsystem/amd64/syscall.h b/libu/amd64/syscall.h similarity index 100% rename from libsystem/amd64/syscall.h rename to libu/amd64/syscall.h diff --git a/libterminal/ansiq_LICENSE.txt b/libu/ansiq_LICENSE.txt similarity index 100% rename from libterminal/ansiq_LICENSE.txt rename to libu/ansiq_LICENSE.txt diff --git a/libterminal/ansiq_README.md b/libu/ansiq_README.md similarity index 100% rename from libterminal/ansiq_README.md rename to libu/ansiq_README.md diff --git a/libarena/arena.c b/libu/arena.c similarity index 100% rename from libarena/arena.c rename to libu/arena.c diff --git a/libarena/arena.h b/libu/arena.h similarity index 100% rename from libarena/arena.h rename to libu/arena.h diff --git a/libaux/assert.h b/libu/assert.h similarity index 100% rename from libaux/assert.h rename to libu/assert.h diff --git a/libarena/build/.gitignore b/libu/build/.gitignore similarity index 100% rename from libarena/build/.gitignore rename to libu/build/.gitignore diff --git a/libdebugconsole/debugconsole.c b/libu/debugconsole.c similarity index 100% rename from libdebugconsole/debugconsole.c rename to libu/debugconsole.c diff --git a/libdebugconsole/debugconsole.h b/libu/debugconsole.h similarity index 100% rename from libdebugconsole/debugconsole.h rename to libu/debugconsole.h diff --git a/libioutil/filereader.c b/libu/filereader.c similarity index 100% rename from libioutil/filereader.c rename to libu/filereader.c diff --git a/libioutil/filereader.h b/libu/filereader.h similarity index 100% rename from libioutil/filereader.h rename to libu/filereader.h diff --git a/libioutil/filewriter.c b/libu/filewriter.c similarity index 100% rename from libioutil/filewriter.c rename to libu/filewriter.c diff --git a/libioutil/filewriter.h b/libu/filewriter.h similarity index 100% rename from libioutil/filewriter.h rename to libu/filewriter.h diff --git a/libinput/in_gb.c b/libu/in_gb.c similarity index 100% rename from libinput/in_gb.c rename to libu/in_gb.c diff --git a/libinput/in_gb.h b/libu/in_gb.h similarity index 100% rename from libinput/in_gb.h rename to libu/in_gb.h diff --git a/libinput/in_input.c b/libu/in_input.c similarity index 99% rename from libinput/in_input.c rename to libu/in_input.c index 823f1ee..65ab659 100644 --- a/libinput/in_input.c +++ b/libu/in_input.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libinput/in_input.h b/libu/in_input.h similarity index 100% rename from libinput/in_input.h rename to libu/in_input.h diff --git a/libkb/kb.c b/libu/kb.c similarity index 100% rename from libkb/kb.c rename to libu/kb.c diff --git a/libkb/kb.h b/libu/kb.h similarity index 100% rename from libkb/kb.h rename to libu/kb.h diff --git a/libfat/libfat.c b/libu/libfat.c similarity index 100% rename from libfat/libfat.c rename to libu/libfat.c diff --git a/libfat/libfat.h b/libu/libfat.h similarity index 100% rename from libfat/libfat.h rename to libu/libfat.h diff --git a/libaux/list.h b/libu/list.h similarity index 100% rename from libaux/list.h rename to libu/list.h diff --git a/libmalloc/malloc.c b/libu/malloc.c similarity index 100% rename from libmalloc/malloc.c rename to libu/malloc.c diff --git a/libmalloc/malloc.h b/libu/malloc.h similarity index 100% rename from libmalloc/malloc.h rename to libu/malloc.h diff --git a/libmath/math.c b/libu/math.c similarity index 100% rename from libmath/math.c rename to libu/math.c diff --git a/libmath/math.h b/libu/math.h similarity index 100% rename from libmath/math.h rename to libu/math.h diff --git a/libaux/minmax.h b/libu/minmax.h similarity index 100% rename from libaux/minmax.h rename to libu/minmax.h diff --git a/libaux/mprintf.c b/libu/mprintf.c similarity index 97% rename from libaux/mprintf.c rename to libu/mprintf.c index b918a93..0e93d60 100644 --- a/libaux/mprintf.c +++ b/libu/mprintf.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/libaux/mprintf.h b/libu/mprintf.h similarity index 100% rename from libaux/mprintf.h rename to libu/mprintf.h diff --git a/libaux/path.c b/libu/path.c similarity index 100% rename from libaux/path.c rename to libu/path.c diff --git a/libaux/path.h b/libu/path.h similarity index 100% rename from libaux/path.h rename to libu/path.h diff --git a/libaux/printf.c b/libu/printf.c similarity index 100% rename from libaux/printf.c rename to libu/printf.c diff --git a/libaux/printf.h b/libu/printf.h similarity index 100% rename from libaux/printf.h rename to libu/printf.h diff --git a/libaux/printf_config.h b/libu/printf_config.h similarity index 100% rename from libaux/printf_config.h rename to libu/printf_config.h diff --git a/libprocess/process.c b/libu/process.c similarity index 67% rename from libprocess/process.c rename to libu/process.c index 1cb6fd7..a290e85 100644 --- a/libprocess/process.c +++ b/libu/process.c @@ -8,6 +8,14 @@ #include #include +static int e_pid; + +static int e_pgid; + +static int pid; + +static int pgid; + void _clone_tramp (void); struct process_data* process_spawn (process_func_t func, void* argument_ptr) { @@ -43,3 +51,18 @@ void process_data_free (struct process_data* pdata) { free (pdata->stack); free (pdata); } + +void process_self_init (void) { + e_pid = get_exec_pid (); + e_pgid = get_procgroup (e_pid); + pid = get_self_pid (); + pgid = get_procgroup (pid); +} + +int process_get_exec_pid (void) { return e_pid; } + +int process_get_exec_pgid (void) { return e_pgid; } + +int process_get_pid (void) { return pid; } + +int process_get_pgid (void) { return pgid; } diff --git a/libprocess/process.h b/libu/process.h similarity index 78% rename from libprocess/process.h rename to libu/process.h index 2114321..7ec672f 100644 --- a/libprocess/process.h +++ b/libu/process.h @@ -22,4 +22,14 @@ struct process_data* process_spawn (process_func_t func, void* argument_ptr); void process_data_free (struct process_data* pdata); +int process_get_exec_pid (void); + +int process_get_exec_pgid (void); + +int process_get_pid (void); + +int process_get_pgid (void); + +void process_self_init (void); + #endif // _LIBPROCESS_PROCESS_PROCESS_H diff --git a/libaux/setjmp.h b/libu/setjmp.h similarity index 100% rename from libaux/setjmp.h rename to libu/setjmp.h diff --git a/libu/src.mk b/libu/src.mk new file mode 100644 index 0000000..5cfdde6 --- /dev/null +++ b/libu/src.mk @@ -0,0 +1,43 @@ +include $(platform)/src.mk + +c += terminal.c \ + __premain.c \ + system.c \ + string.c \ + strconv.c \ + process.c \ + math.c \ + malloc.c \ + kb.c \ + filereader.c \ + filewriter.c \ + debugconsole.c \ + arena.c \ + mprintf.c \ + path.c \ + printf.c \ + _fat.c \ + libfat.c \ + in_gb.c \ + in_input.c + +o += terminal.o \ + __premain.o \ + system.o \ + string.o \ + strconv.o \ + process.o \ + math.o \ + malloc.o \ + kb.o \ + filereader.o \ + filewriter.o \ + debugconsole.o \ + arena.o \ + mprintf.o \ + path.o \ + printf.o \ + _fat.o \ + libfat.o \ + in_gb.o \ + in_input.o diff --git a/libsystem/stall.h b/libu/stall.h similarity index 100% rename from libsystem/stall.h rename to libu/stall.h diff --git a/libsystem/str_status.h b/libu/str_status.h similarity index 100% rename from libsystem/str_status.h rename to libu/str_status.h diff --git a/libstring/strconv.c b/libu/strconv.c similarity index 100% rename from libstring/strconv.c rename to libu/strconv.c diff --git a/libstring/strconv.h b/libu/strconv.h similarity index 100% rename from libstring/strconv.h rename to libu/strconv.h diff --git a/libstring/string.c b/libu/string.c similarity index 100% rename from libstring/string.c rename to libu/string.c diff --git a/libstring/string.h b/libu/string.h similarity index 100% rename from libstring/string.h rename to libu/string.h diff --git a/libsystem/syscall.h b/libu/syscall.h similarity index 100% rename from libsystem/syscall.h rename to libu/syscall.h diff --git a/libsystem/system.c b/libu/system.c similarity index 100% rename from libsystem/system.c rename to libu/system.c diff --git a/libsystem/system.h b/libu/system.h similarity index 100% rename from libsystem/system.h rename to libu/system.h diff --git a/libterminal/tcommon.h b/libu/tcommon.h similarity index 100% rename from libterminal/tcommon.h rename to libu/tcommon.h diff --git a/libterminal/tcursor.h b/libu/tcursor.h similarity index 100% rename from libterminal/tcursor.h rename to libu/tcursor.h diff --git a/libterminal/terminal.c b/libu/terminal.c similarity index 100% rename from libterminal/terminal.c rename to libu/terminal.c diff --git a/libterminal/terminal.h b/libu/terminal.h similarity index 100% rename from libterminal/terminal.h rename to libu/terminal.h diff --git a/libterminal/tgraphics.h b/libu/tgraphics.h similarity index 100% rename from libterminal/tgraphics.h rename to libu/tgraphics.h diff --git a/libterminal/tscreen.h b/libu/tscreen.h similarity index 100% rename from libterminal/tscreen.h rename to libu/tscreen.h diff --git a/mailtest/Makefile b/mailtest/Makefile index 41f3967..d16094b 100644 --- a/mailtest/Makefile +++ b/mailtest/Makefile @@ -1,10 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libdebugconsole)) -$(eval $(call add_lib,libaux)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/mailtest/mailtest.c b/mailtest/mailtest.c index b19f786..55436dd 100644 --- a/mailtest/mailtest.c +++ b/mailtest/mailtest.c @@ -1,13 +1,11 @@ #include -#include +#include #include #include #include #include void app_main (void) { - libprocess_self_init (); - char commandbuf[32]; memset (commandbuf, 0, sizeof (commandbuf)); char payloadbuf[32]; diff --git a/make/libarena.mk b/make/libarena.mk deleted file mode 100644 index fbb4fec..0000000 --- a/make/libarena.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libarena: - make -C libarena platform=$(platform) all - -all_compiledb_libarena: - bear --output libarena/compile_commands.json -- make -C libarena platform=$(platform) all - -clean_libarena: - make -C libarena platform=$(platform) clean - -format_libarena: - make -C libarena platform=$(platform) format - -docs_libarena: - make -C libarena platform=$(platform) docs - -.PHONY: all_libarena clean_libarena format_libarena docs_libarena all_compiledb_libarena diff --git a/make/libaux.mk b/make/libaux.mk deleted file mode 100644 index 24967b4..0000000 --- a/make/libaux.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libaux: - make -C libaux platform=$(platform) all - -all_compiledb_libaux: - bear --output libaux/compile_commands.json -- make -C libaux platform=$(platform) all - -clean_libaux: - make -C libaux platform=$(platform) clean - -format_libaux: - make -C libaux platform=$(platform) format - -docs_libaux: - make -C libaux platform=$(platform) docs - -.PHONY: all_libaux clean_libaux format_libaux docs_libaux all_compiledb_libaux diff --git a/make/libdebugconsole.mk b/make/libdebugconsole.mk deleted file mode 100644 index b1643aa..0000000 --- a/make/libdebugconsole.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libdebugconsole: - make -C libdebugconsole platform=$(platform) all - -all_compiledb_libdebugconsole: - bear --output libdebugconsole/compile_commands.json -- make -C libdebugconsole platform=$(platform) all - -clean_libdebugconsole: - make -C libdebugconsole platform=$(platform) clean - -format_libdebugconsole: - make -C libdebugconsole platform=$(platform) format - -docs_libdebugconsole: - make -C libdebugconsole platform=$(platform) docs - -.PHONY: all_libdebugconsole clean_libdebugconsole format_libdebugconsole docs_libdebugconsole all_compiledb_libdebugconsole diff --git a/make/libfat.mk b/make/libfat.mk deleted file mode 100644 index 3e5aeae..0000000 --- a/make/libfat.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libfat: - make -C libfat platform=$(platform) all - -all_compiledb_libfat: - bear --output libfat/compile_commands.json -- make -C libfat platform=$(platform) all - -clean_libfat: - make -C libfat platform=$(platform) clean - -format_libfat: - make -C libfat platform=$(platform) format - -docs_libfat: - make -C libfat platform=$(platform) docs - -.PHONY: all_libfat clean_libfat format_libfat docs_libfat all_compiledb_libfat diff --git a/make/libinput.mk b/make/libinput.mk deleted file mode 100644 index 640f7b4..0000000 --- a/make/libinput.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libinput: - make -C libinput platform=$(platform) all - -all_compiledb_libinput: - bear --output libinput/compile_commands.json -- make -C libinput platform=$(platform) all - -clean_libinput: - make -C libinput platform=$(platform) clean - -format_libinput: - make -C libinput platform=$(platform) format - -docs_libinput: - make -C libinput platform=$(platform) docs - -.PHONY: all_libinput clean_libinput format_libinput docs_libinput all_compiledb_libinput diff --git a/make/libioutil.mk b/make/libioutil.mk deleted file mode 100644 index 1db6cec..0000000 --- a/make/libioutil.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libioutil: - make -C libioutil platform=$(platform) all - -all_compiledb_libioutil: - bear --output libioutil/compile_commands.json -- make -C libioutil platform=$(platform) all - -clean_libioutil: - make -C libioutil platform=$(platform) clean - -format_libioutil: - make -C libioutil platform=$(platform) format - -docs_libioutil: - make -C libioutil platform=$(platform) docs - -.PHONY: all_libioutil clean_libioutil format_libioutil docs_libioutil all_compiledb_libioutil diff --git a/make/libkb.mk b/make/libkb.mk deleted file mode 100644 index 89d0725..0000000 --- a/make/libkb.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libkb: - make -C libkb platform=$(platform) all - -all_compiledb_libkb: - bear --output libkb/compile_commands.json -- make -C libkb platform=$(platform) all - -clean_libkb: - make -C libkb platform=$(platform) clean - -format_libkb: - make -C libkb platform=$(platform) format - -docs_libkb: - make -C libkb platform=$(platform) docs - -.PHONY: all_libkb clean_libkb format_libkb docs_libkb all_compiledb_libkb diff --git a/make/libmalloc.mk b/make/libmalloc.mk deleted file mode 100644 index 67801fc..0000000 --- a/make/libmalloc.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libmalloc: - make -C libmalloc platform=$(platform) all - -all_compiledb_libmalloc: - bear --output libmalloc/compile_commands.json -- make -C libmalloc platform=$(platform) all - -clean_libmalloc: - make -C libmalloc platform=$(platform) clean - -format_libmalloc: - make -C libmalloc platform=$(platform) format - -docs_libmalloc: - make -C libmalloc platform=$(platform) docs - -.PHONY: all_libmalloc clean_libmalloc format_libmalloc docs_libmalloc all_compiledb_libmalloc diff --git a/make/libmath.mk b/make/libmath.mk deleted file mode 100644 index 58257b7..0000000 --- a/make/libmath.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libmath: - make -C libmath platform=$(platform) all - -all_compiledb_libmath: - bear --output libmath/compile_commands.json -- make -C libmath platform=$(platform) all - -clean_libmath: - make -C libmath platform=$(platform) clean - -format_libmath: - make -C libmath platform=$(platform) format - -docs_libmath: - make -C libmath platform=$(platform) docs - -.PHONY: all_libmath clean_libmath format_libmath docs_libmath all_compiledb_libmath diff --git a/make/libprocess.mk b/make/libprocess.mk deleted file mode 100644 index 9cc13d0..0000000 --- a/make/libprocess.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libprocess: - make -C libprocess platform=$(platform) all - -all_compiledb_libprocess: - bear --output libprocess/compile_commands.json -- make -C libprocess platform=$(platform) all - -clean_libprocess: - make -C libprocess platform=$(platform) clean - -format_libprocess: - make -C libprocess platform=$(platform) format - -docs_libprocess: - make -C libprocess platform=$(platform) docs - -.PHONY: all_libprocess clean_libprocess format_libprocess docs_libprocess all_compiledb_libprocess diff --git a/make/libstring.mk b/make/libstring.mk deleted file mode 100644 index 6e5df7f..0000000 --- a/make/libstring.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libstring: - make -C libstring platform=$(platform) all - -all_compiledb_libstring: - bear --output libstring/compile_commands.json -- make -C libstring platform=$(platform) all - -clean_libstring: - make -C libstring platform=$(platform) clean - -format_libstring: - make -C libstring platform=$(platform) format - -docs_libstring: - make -C libstring platform=$(platform) docs - -.PHONY: all_libstring clean_libstring format_libstring docs_libstring all_compiledb_libstring diff --git a/make/libsystem.mk b/make/libsystem.mk deleted file mode 100644 index 48e4786..0000000 --- a/make/libsystem.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libsystem: - make -C libsystem platform=$(platform) all - -all_compiledb_libsystem: - bear --output libsystem/compile_commands.json -- make -C libsystem platform=$(platform) all - -clean_libsystem: - make -C libsystem platform=$(platform) clean - -format_libsystem: - make -C libsystem platform=$(platform) format - -docs_libsystem: - make -C libsystem platform=$(platform) docs - -.PHONY: all_libsystem clean_libsystem format_libsystem docs_libsystem all_compiledb_libsystem diff --git a/make/libterminal.mk b/make/libterminal.mk deleted file mode 100644 index 6590ad1..0000000 --- a/make/libterminal.mk +++ /dev/null @@ -1,16 +0,0 @@ -all_libterminal: - make -C libterminal platform=$(platform) all - -all_compiledb_libterminal: - bear --output libterminal/compile_commands.json -- make -C libterminal platform=$(platform) all - -clean_libterminal: - make -C libterminal platform=$(platform) clean - -format_libterminal: - make -C libterminal platform=$(platform) format - -docs_libterminal: - make -C libterminal platform=$(platform) docs - -.PHONY: all_libterminal clean_libterminal format_libterminal docs_libterminal all_compiledb_libterminal diff --git a/make/libu.mk b/make/libu.mk new file mode 100644 index 0000000..3d1f94c --- /dev/null +++ b/make/libu.mk @@ -0,0 +1,16 @@ +all_libu: + make -C libu platform=$(platform) all + +all_compiledb_libu: + bear --output libu/compile_commands.json -- make -C libu platform=$(platform) all + +clean_libu: + make -C libu platform=$(platform) clean + +format_libu: + make -C libu platform=$(platform) format + +docs_libu: + make -C libu platform=$(platform) docs + +.PHONY: all_libu clean_libu format_libu docs_libu all_compiledb_libu diff --git a/make/user.mk b/make/user.mk index a9d4cde..a268eca 100644 --- a/make/user.mk +++ b/make/user.mk @@ -2,8 +2,8 @@ cc := clang ld := ld.lld o := c := -ldflags += -L ../libsystem/build -l:libsystem.a -cflags += -isystem ../libsystem +ldflags += -L ../libu/build -l:libu.a +cflags += -isystem ../libu -DPRINTF_INCLUDE_CONFIG_H=1 -D"FAT_PRINTF(a)" extra_deps += include src.mk diff --git a/sdutil/Makefile b/sdutil/Makefile index 4d978ab..d16094b 100644 --- a/sdutil/Makefile +++ b/sdutil/Makefile @@ -1,14 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libaux)) -$(eval $(call add_lib,libmalloc)) -$(eval $(call add_lib,libdebugconsole)) -$(eval $(call add_lib,libinput)) -$(eval $(call add_lib,libfat)) -$(eval $(call add_include,libterminal)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/sdutil/sdutil.c b/sdutil/sdutil.c index 15bda06..3ae3277 100644 --- a/sdutil/sdutil.c +++ b/sdutil/sdutil.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -175,8 +175,6 @@ static void format_fat16 (const char* dev_name) { } void app_main (void) { - libprocess_self_init (); - char commandbuf[32]; memset (commandbuf, 0, sizeof (commandbuf)); char devnamebuf[64]; diff --git a/usb/Makefile b/usb/Makefile index 117cc7d..d16094b 100644 --- a/usb/Makefile +++ b/usb/Makefile @@ -1,10 +1 @@ -include ../make/ufuncs.mk - -$(eval $(call add_lib,libstring)) -$(eval $(call add_lib,libprocess)) -$(eval $(call add_lib,libaux)) -$(eval $(call add_lib,libmalloc)) - -cflags += -DPRINTF_INCLUDE_CONFIG_H=1 - include ../make/user.mk diff --git a/usb/usb.c b/usb/usb.c index 4d80d8d..edbfad2 100644 --- a/usb/usb.c +++ b/usb/usb.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -61,8 +60,6 @@ static void usb_eject (const char* dev_key) { } void app_main (void) { - libprocess_self_init (); - char commandbuf[32]; memset (commandbuf, 0, sizeof (commandbuf)); char devnamebuf[32];