Add public headers

Declarations for the string core, stdio, stdlib, unistd, errno, sys/types, and the raw syscall interface; the FILE layout stays private in src/internal.h.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
2026-08-30 04:09:45 -04:00
co-authored by Sisyphus
parent 228ed097f0
commit aca40a69b0
7 changed files with 289 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
/*
* sys/syscall.h — the raw syscall interface.
*
* syscall() is the ONLY place in nulsl-libc that talks the kernel ABI.
* Everything above it (read, write, exit, ...) is a wrapper.
*
* SYS_* constants below are the x86_64 numbers for the syscalls the libc
* itself wraps or its tests use. They are #ifndef-guarded so kernel UAPI
* headers can coexist. Extend the table as needed (docs/syscalls.md).
*/
#ifndef _NULSL_SYS_SYSCALL_H
#define _NULSL_SYS_SYSCALL_H
#ifdef __cplusplus
extern "C" {
#endif
long syscall(long number, ...);
/* x86_64 syscall numbers (Linux ABI). */
#ifndef SYS_read
#define SYS_read 0
#endif
#ifndef SYS_write
#define SYS_write 1
#endif
#ifndef SYS_open
#define SYS_open 2
#endif
#ifndef SYS_close
#define SYS_close 3
#endif
#ifndef SYS_getpid
#define SYS_getpid 39
#endif
#ifndef SYS_exit
#define SYS_exit 60
#endif
#ifndef SYS_unlink
#define SYS_unlink 87
#endif
#ifndef SYS_clock_gettime
#define SYS_clock_gettime 228
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NULSL_SYS_SYSCALL_H */
+25
View File
@@ -0,0 +1,25 @@
/*
* sys/types.h — primitive system types for nulsl-libc.
*/
#ifndef _NULSL_SYS_TYPES_H
#define _NULSL_SYS_TYPES_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef long ssize_t;
typedef long off_t;
typedef long pid_t;
typedef unsigned int uid_t;
typedef unsigned int gid_t;
typedef unsigned long mode_t;
#ifdef __cplusplus
}
#endif
#endif /* _NULSL_SYS_TYPES_H */