]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: add ulibc — minimal userspace C library
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 07:19:46 +0000 (04:19 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:19:39 +0000 (23:19 -0300)
commit925909c43a145077a441b87403c0b2a077d0c99d
tree79c21c44425711224a1d23dbd14bad4f9d50b3ec
parent56e8448d656bfde9a651e2cbe2aa43c0b3cf9e1c
feat: add ulibc — minimal userspace C library

Create user/ulibc/ with headers and implementations for:
- crt0.S: _start entry point that calls main() then exit()
- syscall.h: raw INT 0x80 wrappers (_syscall0..5)
- unistd.c/h: POSIX wrappers (read, write, open, close, fork,
  execve, pipe, dup2, brk, getpid, chdir, mkdir, etc)
- string.c/h: memcpy, memset, memmove, strlen, strcmp, strcpy,
  strchr, strcat, etc
- stdlib.c/h: malloc/free (bump allocator via brk), calloc,
  realloc, atoi, exit
- stdio.c/h: printf, puts, putchar, snprintf, vsnprintf with
  format specifiers: %d %i %u %x %X %s %c %p %%
- errno.c/h: errno variable + error codes + __syscall_ret helper

Build system: user/ulibc/Makefile produces libulibc.a static lib.
Main Makefile updated with ULIBC_LIB target.

Future user programs can link against libulibc.a instead of
duplicating syscall wrappers inline.

Passes: make (kernel), ulibc builds clean, QEMU smoke test OK.
15 files changed:
.gitignore
Makefile
user/ulibc/Makefile [new file with mode: 0644]
user/ulibc/include/errno.h [new file with mode: 0644]
user/ulibc/include/stdio.h [new file with mode: 0644]
user/ulibc/include/stdlib.h [new file with mode: 0644]
user/ulibc/include/string.h [new file with mode: 0644]
user/ulibc/include/syscall.h [new file with mode: 0644]
user/ulibc/include/unistd.h [new file with mode: 0644]
user/ulibc/src/crt0.S [new file with mode: 0644]
user/ulibc/src/errno.c [new file with mode: 0644]
user/ulibc/src/stdio.c [new file with mode: 0644]
user/ulibc/src/stdlib.c [new file with mode: 0644]
user/ulibc/src/string.c [new file with mode: 0644]
user/ulibc/src/unistd.c [new file with mode: 0644]