diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-07-06 22:11:12 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-07-06 22:21:51 +0200 |
| commit | 55f32781ea611873a08f195d437fc0123919d685 (patch) | |
| tree | f0d953026bdb76fd97d079528bb5f80aa759c184 /src/libc/include | |
| parent | 6da94b9e8be7078f0249d1c0782e1375a01f8660 (diff) | |
| download | wnix-55f32781ea611873a08f195d437fc0123919d685.tar.gz | |
Setup libc skeleton
Diffstat (limited to 'src/libc/include')
| -rw-r--r-- | src/libc/include/errno.h | 43 | ||||
| -rw-r--r-- | src/libc/include/stddef.h | 8 | ||||
| -rw-r--r-- | src/libc/include/stdio.h | 17 | ||||
| -rw-r--r-- | src/libc/include/stdlib.h | 6 | ||||
| -rw-r--r-- | src/libc/include/string.h | 1 |
5 files changed, 67 insertions, 8 deletions
diff --git a/src/libc/include/errno.h b/src/libc/include/errno.h new file mode 100644 index 0000000..0456645 --- /dev/null +++ b/src/libc/include/errno.h @@ -0,0 +1,43 @@ +#ifndef _ERRNO_H +#define _ERRNO_H + +extern int errno; + +enum +{ + OK, + EPERM, + ENOENT, + ESRCH, + EINTR, + EIO, + ENXIO, + E2BIG, + ENOEXEC, + EBADF, + ECHILD, + EAGAIN, + ENOMEM, + EACCES, + EFAULT, + ENOTBLK, + EBUSY, + EEXIST, + EXDEV, + ENODEV, + ENOTDIR, + EISDIR, + EINVAL, + ENFILE, + EMFILE, + ENOTTY, + ETXTBSY, + EFBIG, + ENOSPC, + ESPIPE, + EROFS, + EMLINK, + EPIPE, +}; + +#endif diff --git a/src/libc/include/stddef.h b/src/libc/include/stddef.h deleted file mode 100644 index 123e46f..0000000 --- a/src/libc/include/stddef.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _STDDEF_H -#define _STDDEF_H - -#define NULL ((void *)0) - -typedef unsigned long size_t; - -#endif diff --git a/src/libc/include/stdio.h b/src/libc/include/stdio.h new file mode 100644 index 0000000..91d440b --- /dev/null +++ b/src/libc/include/stdio.h @@ -0,0 +1,17 @@ +#ifndef _STDIO_H +#define _STDIO_H + +enum +{ + EOF = -1 +}; + +typedef struct __file FILE; + +FILE *fopen(const char *__path, const char *__mode); +int printf(const char *__fmt, ...); +int fprintf(FILE *__stream, const char *__fmt, ...); + +extern FILE *stdin, *stdout, *stderr; + +#endif diff --git a/src/libc/include/stdlib.h b/src/libc/include/stdlib.h index 79d3122..839c868 100644 --- a/src/libc/include/stdlib.h +++ b/src/libc/include/stdlib.h @@ -1,7 +1,13 @@ #ifndef _STDLIB_H #define _STDLIB_H +#include <stddef.h> + #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 +void *malloc(size_t __n); +void *calloc(size_t __nemb, size_t __size); +void free(void *__p); + #endif diff --git a/src/libc/include/string.h b/src/libc/include/string.h index 7efda4e..20c9cf3 100644 --- a/src/libc/include/string.h +++ b/src/libc/include/string.h @@ -7,6 +7,7 @@ int memcmp(const void *__s1, const void *__s2, size_t __n); void *memcpy(void *__dst, const void *__src, size_t __n); void *memset(void *__dst, int __c, size_t __n); char *strchr(const char *__s, int __n); +char *strerror(int errnum); size_t strlen(const char *__s); #endif |
