From 00b7cdb8d7061b4d6f9425a1b7fc31fd70d6db22 Mon Sep 17 00:00:00 2001 From: Marvin Friedrich Date: Tue, 13 Oct 2026 23:04:30 +0200 Subject: [PATCH] more uapi bits --- include/uapi/ioctls.h | 42 ++++++++++++- include/uapi/limits.h | 1 + include/uapi/resource.h | 30 ++++++++++ include/uapi/signal.h | 128 ++++++++++++++++++++++++++++++++++++++++ include/uapi/termios.h | 96 ++++++++++++++++++++++++++++++ include/uapi/wait.h | 4 ++ 6 files changed, 300 insertions(+), 1 deletion(-) create mode 100644 include/uapi/resource.h create mode 100644 include/uapi/signal.h create mode 100644 include/uapi/termios.h diff --git a/include/uapi/ioctls.h b/include/uapi/ioctls.h index b838d6c..593e21e 100644 --- a/include/uapi/ioctls.h +++ b/include/uapi/ioctls.h @@ -2,6 +2,46 @@ #ifndef __ZINNIA_UAPI_IOCTLS_H #define __ZINNIA_UAPI_IOCTLS_H -#define __FIONBIO 0x5421 +#define __IOC_VOID 0x00000000U +#define __IOC_OUT 0x40000000U +#define __IOC_IN 0x80000000U +#define __IOC_INOUT (__IOC_IN | __IOC_OUT) + +#define __IOC(inout, group, num, len) ((inout) | (((len) & 0x3FFF) << 16) | ((group) << 8) | (num)) +#define __IO(group, num) __IOC(__IOC_VOID, (group), (num), 0) +#define __IOR(group, num, type) __IOC(__IOC_OUT, (group), (num), sizeof(type)) +#define __IOW(group, num, type) __IOC(__IOC_IN, (group), (num), sizeof(type)) + +#define __TCGETS 0x5401 +#define __TCSETS 0x5402 +#define __TCSETSW 0x5403 +#define __TCSETSF 0x5404 +#define __TCFLSH 0x540B +#define __TIOCSCTTY 0x540E +#define __TIOCGPGRP 0x540F +#define __TIOCSPGRP 0x5410 +#define __TIOCGWINSZ 0x5413 +#define __TIOCSWINSZ 0x5414 +#define __FIONREAD 0x541B +#define __TIOCPKT 0x5420 +#define __FIONBIO 0x5421 +#define __TIOCNOTTY 0x5422 +#define __TIOCGSID 0x5429 +#define __TIOCSIG 0x5436 +#define __TIOCGPKT 0x5438 +#define __TIOCGNAME 0x5470 +#define __TIOCGPTN __IOR('T', 0x30, int) +#define __TIOCSPTLCK __IOW('T', 0x31, int) +#define __TIOCGPTLCK 3 + +#define __BLKGETSIZE64 __IOR('B', 0x00, unsigned long long) +#define __BLKSSZGET __IOR('B', 0x01, unsigned int) +#define __BLKRRPART __IO('B', 0x02) + +#define __TIOCPKT_DATA 0 +#define __TIOCPKT_FLUSHREAD 1 +#define __TIOCPKT_FLUSHWRITE 2 +#define __TIOCPKT_STOP 4 +#define __TIOCPKT_START 8 #endif diff --git a/include/uapi/limits.h b/include/uapi/limits.h index 2d6c903..598a6e8 100644 --- a/include/uapi/limits.h +++ b/include/uapi/limits.h @@ -5,5 +5,6 @@ #define __PATH_MAX 4096 #define __NAME_MAX 255 #define __SYMLINK_MAX 4096 +#define __PIPE_BUF 4096 #endif diff --git a/include/uapi/resource.h b/include/uapi/resource.h new file mode 100644 index 0000000..427f38d --- /dev/null +++ b/include/uapi/resource.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_RESOURCE_H +#define __ZINNIA_UAPI_RESOURCE_H + +#include + +#define __PRIO_PROCESS 0 +#define __PRIO_PGRP 1 +#define __PRIO_USER 2 + +#define __RLIMIT_CPU 0 +#define __RLIMIT_FSIZE 1 +#define __RLIMIT_DATA 2 +#define __RLIMIT_STACK 3 +#define __RLIMIT_CORE 4 +#define __RLIMIT_RSS 5 +#define __RLIMIT_NPROC 6 +#define __RLIMIT_NOFILE 7 +#define __RLIMIT_MEMLOCK 8 +#define __RLIMIT_AS 9 +#define __RLIMIT_NLIMITS 16 + +#define __RLIM_INFINITY ((__rlim_t) - 1) + +struct __rlimit { + __rlim_t rlim_cur; + __rlim_t rlim_max; +}; + +#endif diff --git a/include/uapi/signal.h b/include/uapi/signal.h new file mode 100644 index 0000000..752d18c --- /dev/null +++ b/include/uapi/signal.h @@ -0,0 +1,128 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_SIGNAL_H +#define __ZINNIA_UAPI_SIGNAL_H + +#include +#include + +#define __SIGABRT 1 +#define __SIGALRM 2 +#define __SIGBUS 3 +#define __SIGCHLD 4 +#define __SIGCONT 5 +#define __SIGFPE 6 +#define __SIGHUP 7 +#define __SIGILL 8 +#define __SIGINT 9 +#define __SIGKILL 10 +#define __SIGPIPE 11 +#define __SIGQUIT 12 +#define __SIGSEGV 13 +#define __SIGSTOP 14 +#define __SIGTERM 15 +#define __SIGTSTP 16 +#define __SIGTTIN 17 +#define __SIGTTOU 18 +#define __SIGUSR1 19 +#define __SIGUSR2 20 +#define __SIGWINCH 21 +#define __SIGSYS 22 +#define __SIGTRAP 23 +#define __SIGURG 24 +#define __SIGVTALRM 25 +#define __SIGXCPU 26 +#define __SIGXFSZ 27 +#define __SIGIO 28 +#define __SIGPOLL 29 +#define __SIGPROF 30 +#define __SIGPWR 31 +#define __SIGIOT 32 +#define __SIGCANCEL 33 +#define __SIGRTMIN 35 +#define __SIGRTMAX 64 +#define __NSIG 65 + +#define __SIG_DFL 0 +#define __SIG_IGN 1 + +#define __SIG_BLOCK 1 +#define __SIG_UNBLOCK 2 +#define __SIG_SETMASK 3 + +#define __SA_NOCLDSTOP (1 << 0) +#define __SA_ONSTACK (1 << 1) +#define __SA_RESETHAND (1 << 2) +#define __SA_RESTART (1 << 3) +#define __SA_SIGINFO (1 << 4) +#define __SA_NOCLDWAIT (1 << 5) +#define __SA_NODEFER (1 << 6) + +#define __MINSIGSTKSZ 2048 +#define __SS_ONSTACK 1 +#define __SS_DISABLE 2 + +#define __SIGEV_NONE 1 +#define __SIGEV_SIGNAL 2 +#define __SIGEV_THREAD 3 + +#define __SI_TKILL (-6) +#define __SI_TIMER (-2) +#define __SI_QUEUE (-1) +#define __SI_USER 0 +#define __SI_KERNEL 128 + +#define __ILL_ILLOPC 1 +#define __FPE_INTDIV 1 +#define __SEGV_MAPERR 1 +#define __SEGV_ACCERR 2 +#define __BUS_ADRALN 1 +#define __TRAP_BRKPT 1 + +#define __CLD_EXITED 1 +#define __CLD_KILLED 2 +#define __CLD_DUMPED 3 +#define __CLD_TRAPPED 4 +#define __CLD_STOPPED 5 +#define __CLD_CONTINUED 6 + +typedef uint64_t __sigset_t; + +union __sigval { + int sival_int; + void* sival_ptr; +}; + +struct __siginfo { + int si_signo; + int si_code; + int si_errno; + __pid_t si_pid; + __uid_t si_uid; + void* si_addr; + int si_status; + union __sigval si_value; +}; + +struct __sigaction { + uintptr_t sa_handler; + unsigned long sa_flags; + uintptr_t sa_restorer; + __sigset_t sa_mask; +}; + +struct __stack { + void* ss_sp; + size_t ss_size; + int ss_flags; +}; + +struct __sigevent { + union __sigval sigev_value; + int sigev_notify; + int sigev_signo; + void (*sigev_notify_function)(union __sigval); + void* sigev_notify_attributes; + __pid_t sigev_notify_thread_id; +}; + +#endif diff --git a/include/uapi/termios.h b/include/uapi/termios.h new file mode 100644 index 0000000..1d08201 --- /dev/null +++ b/include/uapi/termios.h @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: Unlicense */ +#ifndef __ZINNIA_UAPI_TERMIOS_H +#define __ZINNIA_UAPI_TERMIOS_H + +#include + +#define __NCCS 32 + +#define __VINTR 0 +#define __VQUIT 1 +#define __VERASE 2 +#define __VKILL 3 +#define __VEOF 4 +#define __VTIME 5 +#define __VMIN 6 +#define __VSWTC 7 +#define __VSTART 8 +#define __VSTOP 9 +#define __VSUSP 10 +#define __VEOL 11 +#define __VREPRINT 12 +#define __VDISCARD 13 +#define __VWERASE 14 +#define __VLNEXT 15 +#define __VEOL2 16 + +#define __IGNBRK 0000001 +#define __BRKINT 0000002 +#define __IGNPAR 0000004 +#define __PARMRK 0000010 +#define __INPCK 0000020 +#define __ISTRIP 0000040 +#define __INLCR 0000100 +#define __IGNCR 0000200 +#define __ICRNL 0000400 +#define __IUCLC 0001000 +#define __IXON 0002000 +#define __IXANY 0004000 +#define __IXOFF 0010000 + +#define __OPOST 0000001 +#define __OLCUC 0000002 +#define __ONLCR 0000004 +#define __OCRNL 0000010 +#define __ONOCR 0000020 +#define __ONLRET 0000040 + +#define __CSIZE 0000060 +#define __CS5 0000000 +#define __CS6 0000020 +#define __CS7 0000040 +#define __CS8 0000060 +#define __CSTOPB 0000100 +#define __CREAD 0000200 +#define __PARENB 0000400 +#define __PARODD 0001000 +#define __HUPCL 0002000 +#define __CLOCAL 0004000 + +#define __ISIG 0000001 +#define __ICANON 0000002 +#define __ECHO 0000010 +#define __ECHOE 0000020 +#define __ECHOK 0000040 +#define __ECHONL 0000100 +#define __NOFLSH 0000200 +#define __TOSTOP 0000400 +#define __IEXTEN 0100000 + +#define __TCIFLUSH 0 +#define __TCOFLUSH 1 +#define __TCIOFLUSH 2 + +typedef unsigned char __cc_t; +typedef unsigned int __speed_t; +typedef unsigned int __tcflag_t; + +struct __termios { + __tcflag_t c_iflag; + __tcflag_t c_oflag; + __tcflag_t c_cflag; + __tcflag_t c_lflag; + __cc_t c_line; + __cc_t c_cc[__NCCS]; + __speed_t c_ibaud; + __speed_t c_obaud; +}; + +struct __winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#endif diff --git a/include/uapi/wait.h b/include/uapi/wait.h index 41a46ab..b145446 100644 --- a/include/uapi/wait.h +++ b/include/uapi/wait.h @@ -9,4 +9,8 @@ #define __WCONTINUED 8 #define __WNOWAIT 0x01000000 +#define __P_ALL 0 +#define __P_PID 1 +#define __P_PGID 2 + #endif