Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
#ifndef _KERNEL_LIBKERN_BITS_ERRNO_H
#define _KERNEL_LIBKERN_BITS_ERRNO_H
// clang-format off
#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 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#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 ETXTBSY 26 /* Text file busy */
#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 EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define EDEADLK 35 /* Resource deadlock would occur */
#define ENAMETOOLONG 36 /* File name too long */
#define ENOLCK 37 /* No record locks available */
#define ENOSYS 38 /* Function not implemented */
#define ENOTEMPTY 39 /* Directory not empty */
#define ELOOP 40 /* Too many symbolic links encountered */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define ENOMSG 42 /* No message of desired type */
#define EIDRM 43 /* Identifier removed */
#define ECHRNG 44 /* Channel number out of range */
#define EL2NSYNC 45 /* Level 2 not synchronized */
#define EL3HLT 46 /* Level 3 halted */
#define EL3RST 47 /* Level 3 reset */
#define ELNRNG 48 /* Link number out of range */
#define EUNATCH 49 /* Protocol driver not attached */
#define ENOCSI 50 /* No CSI structure available */
#define EL2HLT 51 /* Level 2 halted */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL 54 /* Exchange full */
#define ENOANO 55 /* No anode */
#define EBADRQC 56 /* Invalid request code */
#define EBADSLT 57 /* Invalid slot */
#define EDEADLOCK EDEADLK
#define EBFONT 59 /* Bad font file format */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* Object is remote */
#define ENOLINK 67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 72 /* Multihop attempted */
#define EDOTDOT 73 /* RFS specific error */
#define EBADMSG 74 /* Not a data message */
#define EOVERFLOW 75 /* Value too large for defined data type */
#define ENOTUNIQ 76 /* Name not unique on network */
#define EBADFD 77 /* File descriptor in bad state */
#define EREMCHG 78 /* Remote address changed */
#define ELIBACC 79 /* Can not access a needed shared library */
#define ELIBBAD 80 /* Accessing a corrupted shared library */
#define ELIBSCN 81 /* .lib section in a.out corrupted */
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
#define EILSEQ 84 /* Illegal byte sequence */
#define ERESTART 85 /* Interrupted system call should be restarted */
#define ESTRPIPE 86 /* Streams pipe error */
#define EUSERS 87 /* Too many users */
#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 ESOCKTNOSUPPORT 94 /* Socket type not supported */
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
#define EADDRINUSE 98 /* Address already in use */
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
#define ENETDOWN 100 /* Network is down */
#define ENETUNREACH 101 /* Network is unreachable */
#define ENETRESET 102 /* Network dropped connection because of reset */
#define ECONNABORTED 103 /* Software caused connection abort */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
#define EISCONN 106 /* Transport endpoint is already connected */
#define ENOTCONN 107 /* Transport endpoint is not connected */
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
#define ETIMEDOUT 110 /* Connection timed out */
#define ECONNREFUSED 111 /* Connection refused */
#define EHOSTDOWN 112 /* Host is down */
#define EHOSTUNREACH 113 /* No route to host */
#define EALREADY 114 /* Operation already in progress */
#define EINPROGRESS 115 /* Operation now in progress */
#define ESTALE 116 /* Stale NFS file handle */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
#define EDQUOT 122 /* Quota exceeded */
#define ENOMEDIUM 123 /* No medium found */
#define EMEDIUMTYPE 124 /* Wrong medium type */
#define EBADARCH 125 /* Bad arch */
// clang-format on
#endif // _KERNEL_LIBKERN_BITS_ERRNO_H

View File

@@ -0,0 +1,19 @@
#ifndef _KERNEL_LIBKERN_BITS_FCNTL_H
#define _KERNEL_LIBKERN_BITS_FCNTL_H
#define SEEK_SET 0x1
#define SEEK_CUR 0x2
#define SEEK_END 0x3
/* OPEN */
#define O_RDONLY 0x1
#define O_WRONLY 0x2
#define O_RDWR (O_RDONLY | O_WRONLY)
#define O_DIRECTORY 0x4
#define O_CREAT 0x8
#define O_TRUNC 0x10
#define O_APPEND 0x20
#define O_EXCL 0x40
#define O_EXEC 0x80
#endif // _KERNEL_LIBKERN_BITS_FCNTL_H

View File

@@ -0,0 +1,44 @@
#ifndef _KERNEL_LIBKERN_BITS_SIGNAL_H
#define _KERNEL_LIBKERN_BITS_SIGNAL_H
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL SIGIO
#define SIGPWR 30
#define SIGSYS 31
typedef void (*sighandler_t)(int);
#define SIG_DFL ((sighandler_t)0)
#define SIG_ERR ((sighandler_t)-1)
#define SIG_IGN ((sighandler_t)1)
#endif // _KERNEL_LIBKERN_BITS_SIGNAL_H

View File

@@ -0,0 +1,18 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_IOCTLS_H
#define _KERNEL_LIBKERN_BITS_SYS_IOCTLS_H
/* TTY */
#define TIOCGPGRP 0x0101
#define TIOCSPGRP 0x0102
#define TCGETS 0x0103
#define TCSETS 0x0104
#define TCSETSW 0x0105
#define TCSETSF 0x0106
/* BGA */
#define BGA_SWAP_BUFFERS 0x0101
#define BGA_GET_HEIGHT 0x0102
#define BGA_GET_WIDTH 0x0103
#define BGA_GET_SCALE 0x0104
#endif // _KERNEL_LIBKERN_BITS_SYS_IOCTLS_H

View File

@@ -0,0 +1,27 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_MMAN_H
#define _KERNEL_LIBKERN_BITS_SYS_MMAN_H
#include <libkern/types.h>
#define MAP_SHARED 0x01
#define MAP_PRIVATE 0x02
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
#define MAP_STACK 0x40
#define PROT_READ 0x1
#define PROT_WRITE 0x2
#define PROT_EXEC 0x4
#define PROT_NONE 0x0
struct mmap_params {
void* addr;
size_t size;
int prot;
int flags;
int fd;
off_t offset;
};
typedef struct mmap_params mmap_params_t;
#endif // _KERNEL_LIBKERN_BITS_SYS_MMAN_H

View File

@@ -0,0 +1,12 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_PTRACE_H
#define _KERNEL_LIBKERN_BITS_SYS_PTRACE_H
#include <libkern/types.h>
typedef int ptrace_request_t;
#define PTRACE_TRACEME (0x1)
#define PTRACE_CONT (0x2)
#define PTRACE_PEEKTEXT (0x3)
#define PTRACE_PEEKDATA (0x4)
#endif // _KERNEL_LIBKERN_BITS_SYS_PTRACE_H

View File

@@ -0,0 +1,18 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_SELECT_H
#define _KERNEL_LIBKERN_BITS_SYS_SELECT_H
#include <libkern/types.h>
#define FD_SETSIZE 32
struct fd_set {
uint8_t fds[FD_SETSIZE / 8];
};
typedef struct fd_set fd_set_t;
#define FD_SET(fd, fd_set_ptr) ((fd_set_ptr)->fds[fd / 8] |= (1 << (fd % 8)))
#define FD_CLR(fd, fd_set_ptr) ((fd_set_ptr)->fds[fd / 8] &= ~(1 << (fd % 8)))
#define FD_ZERO(fd_set_ptr) (memset((uint8_t*)(fd_set_ptr), 0, sizeof(fd_set_t)))
#define FD_ISSET(fd, fd_set_ptr) ((fd_set_ptr)->fds[fd / 8] & (1 << (fd % 8)))
#endif // _KERNEL_LIBKERN_BITS_SYS_SELECT_H

View File

@@ -0,0 +1,26 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_SOCKET_H
#define _KERNEL_LIBKERN_BITS_SYS_SOCKET_H
enum SOCK_DOMAINS {
PF_LOCAL,
PF_INET,
PF_INET6,
PF_IPX,
PF_NETLINK,
PF_X25,
PF_AX25,
PF_ATMPVC,
PF_APPLETALK,
PF_PACKET,
};
enum SOCK_TYPES {
SOCK_STREAM,
SOCK_DGRAM,
SOCK_SEQPACKET,
SOCK_RAW,
SOCK_RDM,
SOCK_PACKET,
};
#endif // _KERNEL_LIBKERN_BITS_SYS_SOCKET_H

View File

@@ -0,0 +1,64 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_STAT_H
#define _KERNEL_LIBKERN_BITS_SYS_STAT_H
#include <libkern/bits/time.h>
#include <libkern/types.h>
#define S_IFMT 0xF000
/* MODES */
#define S_IFSOCK 0xC000 /* [XSI] socket */
#define S_IFLNK 0xA000 /* [XSI] symbolic link */
#define S_IFREG 0x8000 /* [XSI] regular */
#define S_IFBLK 0x6000 /* [XSI] block special */
#define S_IFDIR 0x4000 /* [XSI] directory */
#define S_IFCHR 0x2000 /* [XSI] character special */
#define S_IFIFO 0x1000 /* [XSI] named pipe (fifo) */
#define S_ISUID 0x0800
#define S_ISGID 0x0400
#define S_ISVTX 0x0200
/* Read, write, execute/search by owner */
#define S_IRWXU 0x01c0
#define S_IRUSR 0x0100
#define S_IWUSR 0x0080
#define S_IXUSR 0x0040
/* Read, write, execute/search by group */
#define S_IRWXG 0x0038
#define S_IRGRP 0x0020
#define S_IWGRP 0x0010
#define S_IXGRP 0x0008
/* Read, write, execute/search by others */
#define S_IRWXO 0x0007
#define S_IROTH 0x0004
#define S_IWOTH 0x0002
#define S_IXOTH 0x0001
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* Inode number */
mode_t st_mode; /* File type and mode */
nlink_t st_nlink; /* Number of hard links */
uid_t st_uid; /* User ID of owner */
gid_t st_gid; /* Group ID of owner */
dev_t st_rdev; /* Device ID (if special file) */
off_t st_size; /* Total size, in bytes */
uint32_t st_blksize; /* Block size for filesystem I/O */
uint32_t st_blocks; /* Number of 512B blocks allocated */
struct timespec st_atim; /* Time of last access */
struct timespec st_mtim; /* Time of last modification */
struct timespec st_ctim; /* Time of last status change */
};
typedef struct stat stat_t;
#endif // _KERNEL_LIBKERN_BITS_SYS_STAT_H

View File

@@ -0,0 +1,15 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_UTSNAME_H
#define _KERNEL_LIBKERN_BITS_SYS_UTSNAME_H
#define UTSNAME_ENTRY_LEN 65
struct utsname {
char sysname[UTSNAME_ENTRY_LEN];
char nodename[UTSNAME_ENTRY_LEN];
char release[UTSNAME_ENTRY_LEN];
char version[UTSNAME_ENTRY_LEN];
char machine[UTSNAME_ENTRY_LEN];
};
typedef struct utsname utsname_t;
#endif // _KERNEL_LIBKERN_BITS_SYS_UTSNAME_H

View File

@@ -0,0 +1,7 @@
#ifndef _KERNEL_LIBKERN_BITS_SYS_WAIT_H
#define _KERNEL_LIBKERN_BITS_SYS_WAIT_H
#define WNOHANG 0x1
#define WUNTRACED 0x2
#endif // _KERNEL_LIBKERN_BITS_SYS_WAIT_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
#ifndef _KERNEL_LIBKERN_BITS_THREAD_H
#define _KERNEL_LIBKERN_BITS_THREAD_H
#include <libkern/types.h>
struct thread_create_params {
uint32_t entry_point;
uint32_t stack_start;
uint32_t stack_size;
};
typedef struct thread_create_params thread_create_params_t;
#endif // _KERNEL_LIBKERN_BITS_THREAD_H

View File

@@ -0,0 +1,51 @@
#ifndef _KERNEL_LIBKERN_BITS_TIME_H
#define _KERNEL_LIBKERN_BITS_TIME_H
#include <libkern/types.h>
struct timeval {
time_t tv_sec;
uint32_t tv_usec;
};
typedef struct timeval timeval_t;
#define DST_NONE 0 /* not on dst */
#define DST_USA 1 /* USA style dst */
#define DST_AUST 2 /* Australian style dst */
#define DST_WET 3 /* Western European dst */
#define DST_MET 4 /* Middle European dst */
#define DST_EET 5 /* Eastern European dst */
#define DST_CAN 6 /* Canada */
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
typedef struct timezone timezone_t;
struct timespec {
time_t tv_sec;
uint32_t tv_nsec;
};
typedef struct timespec timespec_t;
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
typedef struct tm tm_t;
typedef enum {
CLOCK_REALTIME,
CLOCK_MONOTONIC,
CLOCK_PROCESS_CPUTIME_ID,
CLOCK_THREAD_CPUTIME_ID,
} clockid_t;
#endif // _KERNEL_LIBKERN_BITS_TIME_H

View File

@@ -0,0 +1,31 @@
#ifndef _KERNEL_LIBKERN_BITS_TYPES_H
#define _KERNEL_LIBKERN_BITS_TYPES_H
typedef char __int8_t;
typedef short __int16_t;
typedef int __int32_t;
typedef long long __int64_t;
typedef unsigned char __uint8_t;
typedef unsigned short __uint16_t;
typedef unsigned int __uint32_t;
typedef unsigned long long __uint64_t;
typedef __uint32_t __dev_t; /* Type of device numbers. */
typedef __uint32_t __uid_t; /* Type of user identifications. */
typedef __uint32_t __gid_t; /* Type of group identifications. */
typedef __uint32_t __ino_t; /* Type of file serial numbers. */
typedef __uint64_t __ino64_t; /* Type of file serial numbers (LFS).*/
typedef __uint16_t __mode_t; /* Type of file attribute bitmasks. */
typedef __uint32_t __nlink_t; /* Type of file link counts. */
typedef __int64_t __off64_t; /* Type of file sizes and offsets (LFS). */
typedef __uint32_t __pid_t; /* Type of process identifications. */
typedef __uint32_t __fsid_t; /* Type of file system IDs. */
typedef __uint32_t __time_t; /* Seconds since the Epoch. */
#if defined(__x86_64__) || defined(__aarch64__) || (defined(__riscv) && (__riscv_xlen == 64))
typedef __int64_t __off_t; /* Type of file sizes and offsets. */
#else
typedef __int32_t __off_t; /* Type of file sizes and offsets. */
#endif
#endif // _KERNEL_LIBKERN_BITS_TYPES_H