From 885f5974cdf65b59415837ae97f5a14ef1350670 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 9 Dec 2025 19:20:15 +0100 Subject: feat: add gzip and new headers --- include/sys/cdefs.h | 12 ++++++++++++ include/sys/resource.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/sys/select.h | 4 +--- include/sys/time.h | 5 ++++- include/sys/wait.h | 26 ++++++-------------------- 5 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 include/sys/resource.h (limited to 'include/sys') diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 0ef66647..c3bb51c1 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -4,4 +4,16 @@ #define __BEGIN_DECLS extern "C" { #define __END_DECLS } +#define __dead __attribute__((__noreturn__)) + +#define __used __attribute__((__used__)) +#define __unused __attribute__((__unused__)) + +#define __packed __attribute__((__packed__)) +#define __aligned(x) __attribute__((__aligned__(x))) + +#define __malloc __attribute__((__malloc__)) + +#define __pure __attribute__((__pure__)) + #endif diff --git a/include/sys/resource.h b/include/sys/resource.h new file mode 100644 index 00000000..79fcf235 --- /dev/null +++ b/include/sys/resource.h @@ -0,0 +1,47 @@ +#ifndef __SYS_RESOURCE_H +#define __SYS_RESOURCE_H + +typedef __INT64_TYPE__ time_t; +typedef __INT64_TYPE__ suseconds_t; + +struct __timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) +#define RUSAGE_BOTH (-2) +#define RUSAGE_THREAD 1 + +struct rusage { + struct __timeval ru_utime; + struct __timeval ru_stime; + long ru_maxrss; + long ru_ixrss; + long ru_idrss; + long ru_isrss; + long ru_minflt; + long ru_majflt; + long ru_nswap; + long ru_inblock; + long ru_oublock; + long ru_msgsnd; + long ru_msgrcv; + long ru_nsignals; + long ru_nvcsw; + long ru_nivcsw; +}; + +#define PRIO_MIN (-20) +#define PRIO_MAX 20 + +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 + +int getpriority(int, int); +int setpriority(int, int, int); +int getrusage(int, struct rusage *); + +#endif diff --git a/include/sys/select.h b/include/sys/select.h index 44abc2e1..13c48dda 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -3,13 +3,11 @@ #define __BITS_SELECT_H_ #include -#undef __BITS_SELECT_H_ #define __BITS_TIMESPEC_H_ #include -#undef __BITS_TIMESPEC_H_ -typedef __INT32_TYPE__ sigset_t; +typedef __UINT64_TYPE__ sigset_t; int pselect(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, const struct timespec *restrict, const sigset_t *restrict); diff --git a/include/sys/time.h b/include/sys/time.h index 5f34e744..0746f411 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -3,10 +3,13 @@ #define __BITS_SELECT_H_ #include -#undef __BITS_SELECT_H_ + +struct timezone; int select(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, struct timeval *restrict); +int gettimeofday(struct timeval *, struct timezone *); +char *strtotimeval(const char *, struct timeval *); int utimes(const char *, const struct timeval[2]); #endif diff --git a/include/sys/wait.h b/include/sys/wait.h index 2a7438d7..ad935dc8 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -4,34 +4,20 @@ #define __BITS_WAIT_H_ #include +#define __BITS_SIGINFO_H_ +#include + +struct rusage; + #define WCONTINUED 0x00000008 #define WEXITED 0x00000004 #define WNOWAIT 0x01000000 #define WSTOPPED WUNTRACED -typedef __UINT32_TYPE__ id_t; -typedef __INT64_TYPE__ pid_t; -typedef __UINT32_TYPE__ uid_t; - -union sigval { - int sival_int; - void *sival_ptr; -}; - -typedef struct { - 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; -} siginfo_t; - typedef enum { P_ALL = 0, P_PID = 1, P_PGID = 2 } idtype_t; pid_t wait(int *); +pid_t wait3(int *, int, struct rusage *); int waitid(idtype_t, id_t, siginfo_t *, int); pid_t waitpid(pid_t, int *, int); -- cgit v1.2.3