From 13f1d60946fcba6e6589f9a6a4d4e1b83a179039 Mon Sep 17 00:00:00 2001 From: Tom-on64 Date: Sat, 19 Oct 2024 15:21:41 +0200 Subject: [PATCH] Added a basic errno.h --- libc/errno/errno.c | 4 ++++ libc/include/errno.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 libc/errno/errno.c create mode 100644 libc/include/errno.h diff --git a/libc/errno/errno.c b/libc/errno/errno.c new file mode 100644 index 0000000..2126ddb --- /dev/null +++ b/libc/errno/errno.c @@ -0,0 +1,4 @@ +#include + +_errno_t errno = 0; + diff --git a/libc/include/errno.h b/libc/include/errno.h new file mode 100644 index 0000000..4d26153 --- /dev/null +++ b/libc/include/errno.h @@ -0,0 +1,39 @@ +#ifndef _ERRNO_H +#define _ERRNO_H + +// Basic POSIX defined error idk +enum { + EPERM = 1, // Operation not permitted + ENOENT, // No such file or directory + ESRCH, // No such process + EINTR, // Interrupted system call + EIO, // I/O error + ENXIO, // No such device or address + E2BIG, // Argument list too long + ENOEXEC, // Exec format error + EBADF, // Bad file descriptor + ECHILD, // No child processes + EAGAIN, // Resource temporarily unavailable + ENOMEM, // Out of memory + EACCES, // Permission denied + EFAULT, // Bad address + EBUSY, // Device or resource busy + EEXIST, // File exists + ENOTDIR, // Not a directory + EISDIR, // Is a directory + EINVAL, // Invalid argument + ENFILE, // File table overflow + EMFILE, // Too many open files + ENOTTY, // Not a typewriter + EFBIG, // File too large + ENOSPC, // No space left on device + ESPIPE, // Illegal seek + EROFS, // Read-only file system + EMLINK, // Too many links + EPIPE, // Broken pipe + EDQUOT, // Disk quota exceeded +}; + +extern int errno; + +#endif