Sixty-five headers sat side by side in include/, so `#include "irq.h"` said nothing about where irq.h was or what it belonged to, and errno.h, stat.h and fcntl.h at the top shadowed the system's for any host tool built with -I./include. They are in folders now -- arch/ core/ fs/ dev/ gfx/ net/ uapi/ (and ldls/ for the Linux driver layer) -- and every include names the folder, as Linux's do: "core/proc.h". Done mechanically and checked the hard way: the kernel built from this tree disassembles identically to the one built from the tree before it. The full image boots, and userland is the same set of programs. Paths in docs and comments follow; docs/guides/layout.md has a table of what is where, and tools/fix-includes.py rewrites old-style includes from the folders in the tree, for code written before this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
66 lines
3.2 KiB
C
66 lines
3.2 KiB
C
// Error numbers, matching the Linux x86_64 ABI values so that musl-linked
|
|
// programs interpret syscall failures correctly. Kernel code returns these
|
|
// negated (e.g. `return -ENOSYS;`), exactly like Linux does internally.
|
|
#ifndef SCHOS_ERRNO_H
|
|
#define SCHOS_ERRNO_H
|
|
|
|
#define EPERM 1 // Operation not permitted
|
|
#define ENOENT 2 // No such file or directory
|
|
#define ESRCH 3 // No such process
|
|
#define EINTR 4 // Interrupted system call
|
|
#define EIO 5 // I/O error
|
|
#define ENXIO 6 // No such device or address
|
|
#define E2BIG 7 // Argument list too long
|
|
#define ENOEXEC 8 // Exec format error
|
|
#define EBADF 9 // Bad file descriptor
|
|
#define ECHILD 10 // No child processes
|
|
#define EAGAIN 11 // Try again
|
|
#define ENOMEM 12 // Out of memory
|
|
#define EACCES 13 // Permission denied
|
|
#define EFAULT 14 // Bad address
|
|
#define ENOTBLK 15 // Block device required
|
|
#define EBUSY 16 // Device or resource busy
|
|
#define EEXIST 17 // File exists
|
|
#define EXDEV 18 // Cross-device link
|
|
#define ENODEV 19 // No such device
|
|
#define ENOTDIR 20 // Not a directory
|
|
#define EISDIR 21 // Is a directory
|
|
#define EINVAL 22 // Invalid argument
|
|
#define ENFILE 23 // File table overflow
|
|
#define EMFILE 24 // Too many open files
|
|
#define ENOTTY 25 // Not a typewriter
|
|
#define EFBIG 27 // File too large
|
|
#define ENOSPC 28 // No space left on device
|
|
#define ESPIPE 29 // Illegal seek
|
|
#define EROFS 30 // Read-only file system
|
|
#define EMLINK 31 // Too many links
|
|
#define EPIPE 32 // Broken pipe
|
|
#define ERANGE 34 // Math result not representable
|
|
#define ENAMETOOLONG 36 // File name too long
|
|
#define ENOSYS 38 // Function not implemented
|
|
#define ENOTEMPTY 39 // Directory not empty
|
|
#define ELOOP 40 // Too many symbolic links encountered
|
|
|
|
// Sockets. Same Linux x86_64 values, so strerror() in a musl-linked program
|
|
// prints the message the programmer expected rather than a neighbouring one.
|
|
#define ENOTSOCK 88 // Socket operation on non-socket
|
|
#define EDESTADDRREQ 89 // Destination address required
|
|
#define EMSGSIZE 90 // Message too long
|
|
#define EPROTOTYPE 91 // Protocol wrong type for socket
|
|
#define ENOPROTOOPT 92 // Protocol not available
|
|
#define EPROTONOSUPPORT 93 // Protocol not supported
|
|
#define EOPNOTSUPP 95 // Operation not supported on transport endpoint
|
|
#define EAFNOSUPPORT 97 // Address family not supported by protocol
|
|
#define EADDRINUSE 98 // Address already in use
|
|
#define EADDRNOTAVAIL 99 // Cannot assign requested address
|
|
#define ECONNRESET 104 // Connection reset by peer
|
|
#define EISCONN 106 // Transport endpoint is already connected
|
|
#define ENODATA 61 // No data available -- no such attribute
|
|
#define ENOBUFS 105 // No buffer space available
|
|
#define ENOTSUP 95 // Operation not supported
|
|
#define ENETDOWN 100 // Network is down
|
|
#define ENETUNREACH 101 // Network is unreachable
|
|
#define ENOTCONN 107 // Transport endpoint is not connected
|
|
#define ECONNREFUSED 111 // Connection refused
|
|
|
|
#endif // SCHOS_ERRNO_H
|