diff options
Diffstat (limited to 'lib/mlibc/options/posix/include')
85 files changed, 0 insertions, 4760 deletions
diff --git a/lib/mlibc/options/posix/include/arpa/inet.h b/lib/mlibc/options/posix/include/arpa/inet.h deleted file mode 100644 index 599987e..0000000 --- a/lib/mlibc/options/posix/include/arpa/inet.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _ARPA_INET_H -#define _ARPA_INET_H - -#include <netinet/in.h> -#include <stdint.h> -#include <sys/socket.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -uint32_t htonl(uint32_t); -uint16_t htons(uint16_t); -uint32_t ntohl(uint32_t); -uint16_t ntohs(uint16_t); - -// ---------------------------------------------------------------------------- -// IPv4 address manipulation. -// ---------------------------------------------------------------------------- - -in_addr_t inet_addr(const char *); -char *inet_ntoa(struct in_addr); - -// GLIBC replacement for inet_addr(). -int inet_aton(const char *, struct in_addr *); - -// ---------------------------------------------------------------------------- -// Generic IP address manipulation. -// ---------------------------------------------------------------------------- -const char *inet_ntop(int, const void *__restrict, char *__restrict, - socklen_t) __attribute__((__nonnull__(3))); -int inet_pton(int, const char *__restrict, void *__restrict); - -struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); -in_addr_t inet_netof(struct in_addr in); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _ARPA_INET_H - diff --git a/lib/mlibc/options/posix/include/bits/posix/fd_set.h b/lib/mlibc/options/posix/include/bits/posix/fd_set.h deleted file mode 100644 index 554738e..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/fd_set.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MLIBC_FD_SET_H -#define MLIBC_FD_SET_H - -#include <bits/types.h> - -typedef struct { - union { - __mlibc_uint8 __mlibc_elems[128]; - // Some programs require the fds_bits field to be present - __mlibc_uint8 fds_bits[128]; - }; -} fd_set; - -#endif // MLIBC_FD_SET_H diff --git a/lib/mlibc/options/posix/include/bits/posix/id_t.h b/lib/mlibc/options/posix/include/bits/posix/id_t.h deleted file mode 100644 index f222bc1..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/id_t.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _MLIBC_ID_T_H -#define _MLIBC_ID_T_H - -typedef unsigned int id_t; - -#endif // _MLIBC_ID_T_H diff --git a/lib/mlibc/options/posix/include/bits/posix/in_addr_t.h b/lib/mlibc/options/posix/include/bits/posix/in_addr_t.h deleted file mode 100644 index bac9ff2..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/in_addr_t.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef MLIBC_IN_ADDR_H -#define MLIBC_IN_ADDR_H - -#include <stdint.h> - -typedef uint32_t in_addr_t; - -#endif // MLIBC_IN_ADDR_H diff --git a/lib/mlibc/options/posix/include/bits/posix/in_port_t.h b/lib/mlibc/options/posix/include/bits/posix/in_port_t.h deleted file mode 100644 index 0368159..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/in_port_t.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef MLIBC_IN_PORT_H -#define MLIBC_IN_PORT_H - -#include <stdint.h> - -typedef uint16_t in_port_t; - -#endif // MLIBC_IN_PORT_H diff --git a/lib/mlibc/options/posix/include/bits/posix/iovec.h b/lib/mlibc/options/posix/include/bits/posix/iovec.h deleted file mode 100644 index c004f1c..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/iovec.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef MLIBC_IOVEC_H -#define MLIBC_IOVEC_H - -#include <bits/types.h> - -struct iovec { - void *iov_base; - __mlibc_size iov_len; -}; - -#endif // MLIBC_IOVEC_H diff --git a/lib/mlibc/options/posix/include/bits/posix/locale_t.h b/lib/mlibc/options/posix/include/bits/posix/locale_t.h deleted file mode 100644 index c128d58..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/locale_t.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _LOCALE_T_H -#define _LOCALE_T_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *locale_t; - -#ifdef __cplusplus -} -#endif - -#endif // _LOCALE_T_H diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_ctype.h b/lib/mlibc/options/posix/include/bits/posix/posix_ctype.h deleted file mode 100644 index 2b11057..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_ctype.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _POSIX_CTYPE_H -#define _POSIX_CTYPE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/posix/locale_t.h> - -#ifndef __MLIBC_ABI_ONLY - -int isalnum_l(int c, locale_t loc); -int isalpha_l(int c, locale_t loc); -int isblank_l(int c, locale_t loc); -int iscntrl_l(int c, locale_t loc); -int isdigit_l(int c, locale_t loc); -int isgraph_l(int c, locale_t loc); -int islower_l(int c, locale_t loc); -int isprint_l(int c, locale_t loc); -int ispunct_l(int c, locale_t loc); -int isspace_l(int c, locale_t loc); -int isupper_l(int c, locale_t loc); -int isxdigit_l(int c, locale_t loc); - -int isascii_l(int c, locale_t loc); - -int tolower_l(int c, locale_t loc); -int toupper_l(int c, locale_t loc); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _POSIX_CTYPE_H diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_locale.h b/lib/mlibc/options/posix/include/bits/posix/posix_locale.h deleted file mode 100644 index 7554bc5..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_locale.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef MLIBC_POSIX_LOCALE_H -#define MLIBC_POSIX_LOCALE_H - -#include <bits/posix/locale_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -locale_t newlocale(int category_mask, const char *locale, locale_t base); -void freelocale(locale_t locobj); -locale_t uselocale(locale_t locobj); -locale_t duplocale(locale_t locobj); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // MLIBC_POSIX_LOCALE_H diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_signal.h b/lib/mlibc/options/posix/include/bits/posix/posix_signal.h deleted file mode 100644 index 20f030f..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_signal.h +++ /dev/null @@ -1,111 +0,0 @@ - -#ifndef MLIBC_POSIX_SIGNAL_H -#define MLIBC_POSIX_SIGNAL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/ansi/time_t.h> -#include <bits/ansi/timespec.h> -#include <bits/posix/pthread_t.h> -#include <bits/sigset_t.h> -#include <stddef.h> -#include <stdint.h> -#include <mlibc-config.h> - -#define FPE_INTDIV 1 /* integer divide by zero */ -#define FPE_INTOVF 2 /* integer overflow */ -#define FPE_FLTDIV 3 /* floating point divide by zero */ -#define FPE_FLTOVF 4 /* floating point overflow */ -#define FPE_FLTUND 5 /* floating point underflow */ -#define FPE_FLTRES 6 /* floating point inexact result */ -#define FPE_FLTINV 7 /* floating point invalid operation */ -#define FPE_FLTSUB 8 /* subscript out of range */ - -#define TRAP_BRKPT 1 /* process breakpoint */ -#define TRAP_TRACE 2 /* process trace trap */ - -// Start Glibc stuff - -struct _libc_fpxreg { - unsigned short int significand[4]; - unsigned short int exponent; - unsigned short int __glibc_reserved1[3]; -}; - -struct _libc_xmmreg { - uint32_t element[4]; -}; - -struct _libc_fpstate { - uint16_t cwd; - int16_t swd; - uint16_t ftw; - uint16_t fop; - uint64_t rip; - uint64_t dp; - uint32_t mxcsr; - uint32_t mxcr_mask; - struct _libc_fpxreg _st[8]; - struct _libc_xmmreg _xmm[16]; - uint32_t __glibc_reserved1[24]; -}; - -typedef struct _libc_fpstate *fpregset_t; -// End Glibc stuff - -typedef unsigned long int greg_t; - -#define FPE_INTDIV 1 /* integer divide by zero */ -#define FPE_INTOVF 2 /* integer overflow */ -#define FPE_FLTDIV 3 /* floating point divide by zero */ -#define FPE_FLTOVF 4 /* floating point overflow */ -#define FPE_FLTUND 5 /* floating point underflow */ -#define FPE_FLTRES 6 /* floating point inexact result */ -#define FPE_FLTINV 7 /* floating point invalid operation */ -#define FPE_FLTSUB 8 /* subscript out of range */ - -#define TRAP_BRKPT 1 /* process breakpoint */ -#define TRAP_TRACE 2 /* process trace trap */ - -#ifndef __MLIBC_ABI_ONLY - -// functions to block / wait for signals -int sigsuspend(const sigset_t *); -int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict); - -int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict); -int pthread_kill(pthread_t, int); - -// functions to handle signals -int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict); -int sigpending(sigset_t *); - -int siginterrupt(int sig, int flag); - -int sigaltstack(const stack_t *__restrict ss, stack_t *__restrict oss); - -// functions to raise signals -int kill(pid_t, int); -int killpg(int, int); - -int sigtimedwait(const sigset_t *__restrict set, siginfo_t *__restrict info, const struct timespec *__restrict timeout); -int sigwait(const sigset_t *__restrict set, int *__restrict sig); -int sigwaitinfo(const sigset_t *__restrict set, siginfo_t *__restrict info); - -// Glibc extension -#if __MLIBC_GLIBC_OPTION -int sigisemptyset(const sigset_t *set); -#endif // __MLIBC_GLIBC_OPTION - -int sigqueue(pid_t pid, int sig, const union sigval value); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // MLIBC_POSIX_SIGNAL_H - diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_stdio.h b/lib/mlibc/options/posix/include/bits/posix/posix_stdio.h deleted file mode 100644 index 4572a04..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_stdio.h +++ /dev/null @@ -1,72 +0,0 @@ - -#ifndef MLIBC_POSIX_STDIO_H -#define MLIBC_POSIX_STDIO_H - -#include <bits/off_t.h> -#include <bits/size_t.h> -#include <bits/ssize_t.h> - -// MISSING: var_list - -#ifdef __cplusplus -extern "C" { -#endif - -#define P_tmpdir "/tmp" - -#ifndef __MLIBC_ABI_ONLY - -typedef struct __mlibc_file_base FILE; - -int fileno(FILE *file); -FILE *fdopen(int fd, const char *mode); - -FILE *fmemopen(void *__restrict, size_t, const char *__restrict); -int pclose(FILE *); -FILE *popen(const char*, const char *); -FILE *open_memstream(char **, size_t *); - -int fseeko(FILE *stream, off_t offset, int whence); -off_t ftello(FILE *stream); - -int dprintf(int fd, const char *format, ...); -int vdprintf(int fd, const char *format, __builtin_va_list args); - -char *fgetln(FILE *, size_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#define RENAME_EXCHANGE (1 << 1) - -// GNU extensions -typedef ssize_t (cookie_read_function_t)(void *, char *, size_t); -typedef ssize_t (cookie_write_function_t)(void *, const char *, size_t); -typedef int (cookie_seek_function_t)(void *, off_t *, int); -typedef int (cookie_close_function_t)(void *); - -typedef struct _IO_cookie_io_functions_t { - cookie_read_function_t *read; - cookie_write_function_t *write; - cookie_seek_function_t *seek; - cookie_close_function_t *close; -} cookie_io_functions_t; - -#ifndef __MLIBC_ABI_ONLY - -#if defined(_GNU_SOURCE) - -FILE *fopencookie(void *__restrict cookie, const char *__restrict mode, cookie_io_functions_t io_funcs); - -#endif // defined(_GNU_SOURCE) - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -// MISSING: various functions and macros - -#endif /* MLIBC_POSIX_STDIO_H */ - - diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_stdlib.h b/lib/mlibc/options/posix/include/bits/posix/posix_stdlib.h deleted file mode 100644 index 5248fca..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_stdlib.h +++ /dev/null @@ -1,73 +0,0 @@ - -#ifndef MLIBC_POSIX_STDLIB_H -#define MLIBC_POSIX_STDLIB_H - -#include <bits/posix/locale_t.h> -#include <bits/size_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -long random(void); -double drand48(void); -void srand48(long int); -char *initstate(unsigned int, char *, size_t); -char *setstate(char *); -void srandom(unsigned int); - -// ---------------------------------------------------------------------------- -// Environment. -// ---------------------------------------------------------------------------- - -int putenv(char *); -int setenv(const char *, const char *, int); -int unsetenv(const char *); - -// ---------------------------------------------------------------------------- -// Path handling. -// ---------------------------------------------------------------------------- - -int mkstemp(char *); -int mkstemps(char *pattern, int suffixlen); -int mkostemp(char *, int flags); -int mkostemps(char *pattern, int suffixlen, int flags); -char *mkdtemp(char *path); - -char *realpath(const char *__restrict, char *__restrict); - -// ---------------------------------------------------------------------------- -// Pseudoterminals -// ---------------------------------------------------------------------------- - -int posix_openpt(int flags); -int grantpt(int fd); -int unlockpt(int fd); -char *ptsname(int fd); -int ptsname_r(int fd, char *buf, size_t len); - -double strtod_l(const char *__restrict__ nptr, char ** __restrict__ endptr, locale_t loc); -long double strtold_l(const char *__restrict__ nptr, char ** __restrict__ endptr, locale_t loc); -float strtof_l(const char *__restrict string, char **__restrict end, locale_t loc); - -int getloadavg(double *, int); - -// GNU extension -char *secure_getenv(const char *); -char *canonicalize_file_name(const char *); - -// BSD extension -void *reallocarray(void *, size_t, size_t); - -int clearenv(void); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // MLIBC_POSIX_STDLIB_H - diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_string.h b/lib/mlibc/options/posix/include/bits/posix/posix_string.h deleted file mode 100644 index 1f61942..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_string.h +++ /dev/null @@ -1,57 +0,0 @@ - -#ifndef MLIBC_POSIX_STRING_H -#define MLIBC_POSIX_STRING_H - -#include <alloca.h> -#include <bits/posix/locale_t.h> -#include <bits/size_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -char *strdup(const char *string); -char *strndup(const char *, size_t); -size_t strnlen(const char *, size_t); -char *strtok_r(char *__restrict, const char *__restrict, char **__restrict); -char *strsep(char **stringp, const char *delim); -char *strsignal(int sig); -char *stpcpy(char *__restrict, const char *__restrict); -char *stpncpy(char *__restrict, const char *__restrict, size_t n); -void *memccpy(void *__restrict dest, const void *__restrict src, int c, size_t n); - -int strcoll_l(const char *s1, const char *s2, locale_t locale); - -// GNU extensions. -#if defined(_GNU_SOURCE) -char *strcasestr(const char *, const char *); -#define strdupa(x) ({ \ - const char *str = (x); \ - size_t len = strlen(str) + 1; \ - char *buf = alloca(len); \ - (char *) memcpy(buf, str, len); \ -}) -#define strndupa(x, y) ({ \ - const char *str = (x); \ - size_t len = strnlen(str, (y)) + 1; \ - char *buf = alloca(len); \ - buf[len - 1] = '\0'; \ - (char *) memcpy(buf, str, len - 1); \ -}) -void *memrchr(const void *, int, size_t); -#endif /* defined(_GNU_SOURCE) */ - -// BSD extensions -size_t strlcpy(char *d, const char *s, size_t n); -size_t strlcat(char *d, const char *s, size_t n); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // MLIBC_POSIX_STRING_H - diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_time.h b/lib/mlibc/options/posix/include/bits/posix/posix_time.h deleted file mode 100644 index d3e8e1d..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_time.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MLIBC_POSIX_TIME_H -#define MLIBC_POSIX_TIME_H - -#include <bits/posix/timeval.h> - -#define TIMER_ABSTIME 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int utimes(const char *, const struct timeval[2]); - -// Not standardized, Linux and BSDs have it -int futimes(int, const struct timeval[2]); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // MLIBC_POSIX_TIME_H diff --git a/lib/mlibc/options/posix/include/bits/posix/posix_wctype.h b/lib/mlibc/options/posix/include/bits/posix/posix_wctype.h deleted file mode 100644 index 4d2887c..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/posix_wctype.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _POSIX_WCTYPE_H -#define _POSIX_WCTYPE_H - -#include <bits/posix/locale_t.h> -#include <bits/wint_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -typedef unsigned long wctype_t; -typedef unsigned long wctrans_t; - -int iswalnum_l(wint_t, locale_t); -int iswblank_l(wint_t, locale_t); -int iswcntrl_l(wint_t, locale_t); -int iswdigit_l(wint_t, locale_t); -int iswgraph_l(wint_t, locale_t); -int iswlower_l(wint_t, locale_t); -int iswprint_l(wint_t, locale_t); -int iswpunct_l(wint_t, locale_t); -int iswspace_l(wint_t, locale_t); -int iswupper_l(wint_t, locale_t); -int iswxdigit_l(wint_t, locale_t); -int iswalpha_l(wint_t, locale_t); - -wctype_t wctype_l(const char *); -int iswctype_l(wint_t, wctype_t); - -wint_t towlower_l(wint_t, locale_t); -wint_t towupper_l(wint_t, locale_t); - -wctrans_t wctrans_l(const char *, locale_t); -wint_t towctrans_l(wint_t, wctrans_t, locale_t); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _POSIX_WCTYPE_H diff --git a/lib/mlibc/options/posix/include/bits/posix/pthread_t.h b/lib/mlibc/options/posix/include/bits/posix/pthread_t.h deleted file mode 100644 index 1310c40..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/pthread_t.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _MLIBC_BITS_PTHREAD_T_HPP -#define _MLIBC_BITS_PTHREAD_T_HPP - -#include <bits/threads.h> - -typedef struct __mlibc_thread_data *pthread_t; - -#endif // _MLIBC_BITS_PTHREAD_T_HPP diff --git a/lib/mlibc/options/posix/include/bits/posix/stat.h b/lib/mlibc/options/posix/include/bits/posix/stat.h deleted file mode 100644 index 4dd081d..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/stat.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef MLIBC_STAT_H -#define MLIBC_STAT_H - -#include <abi-bits/stat.h> - -// Used by utimensat and friends -#define UTIME_NOW ((1l << 30) - 1l) -#define UTIME_OMIT ((1l << 30) - 2l) - -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) - -// POSIX compatibility macros -#define st_atime st_atim.tv_sec -#define st_mtime st_mtim.tv_sec -#define st_ctime st_ctim.tv_sec - -#endif // MLIBC_STAT_H - diff --git a/lib/mlibc/options/posix/include/bits/posix/timer_t.h b/lib/mlibc/options/posix/include/bits/posix/timer_t.h deleted file mode 100644 index b230501..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/timer_t.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _MLIBC_TIMER_T_H -#define _MLIBC_TIMER_T_H - -typedef void * timer_t; - -#endif // _MLIBC_TIMER_T_H diff --git a/lib/mlibc/options/posix/include/bits/posix/timeval.h b/lib/mlibc/options/posix/include/bits/posix/timeval.h deleted file mode 100644 index 445ee7f..0000000 --- a/lib/mlibc/options/posix/include/bits/posix/timeval.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MLIBC_TIMEVAL_H -#define MLIBC_TIMEVAL_H - -#include <bits/ansi/time_t.h> -#include <abi-bits/suseconds_t.h> - -struct timeval { - time_t tv_sec; - suseconds_t tv_usec; -}; - -#endif // MLIBC_TIMEVAL_H diff --git a/lib/mlibc/options/posix/include/byteswap.h b/lib/mlibc/options/posix/include/byteswap.h deleted file mode 100644 index 74b9fe2..0000000 --- a/lib/mlibc/options/posix/include/byteswap.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifndef _BYTESWAP_H -#define _BYTESWAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define bswap_16(x) __builtin_bswap16(x) -#define bswap_32(x) __builtin_bswap32(x) -#define bswap_64(x) __builtin_bswap64(x) - -// Some programs like eudev call these functions instead -#define __bswap_16(x) __builtin_bswap16(x) -#define __bswap_32(x) __builtin_bswap32(x) -#define __bswap_64(x) __builtin_bswap64(x) - -#ifdef __cplusplus -} -#endif - -#endif // _BYTESWAP_H - diff --git a/lib/mlibc/options/posix/include/dirent.h b/lib/mlibc/options/posix/include/dirent.h deleted file mode 100644 index b50566d..0000000 --- a/lib/mlibc/options/posix/include/dirent.h +++ /dev/null @@ -1,76 +0,0 @@ - -#ifndef _DIRENT_H -#define _DIRENT_H - -#include <abi-bits/ino_t.h> -#include <bits/off_t.h> -#include <bits/types.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define DT_UNKNOWN 0 -#define DT_FIFO 1 -#define DT_CHR 2 -#define DT_DIR 4 -#define DT_BLK 6 -#define DT_REG 8 -#define DT_LNK 10 -#define DT_SOCK 12 -#define DT_WHT 14 - -#define __MLIBC_DIRENT_BODY ino_t d_ino; \ - off_t d_off; \ - unsigned short d_reclen; \ - unsigned char d_type; \ - char d_name[1024]; - -struct dirent { - __MLIBC_DIRENT_BODY -}; - -struct dirent64 { - __MLIBC_DIRENT_BODY -}; - -#define d_fileno d_ino - -#undef __MLIBC_DIRENT_BODY - -#define IFTODT(mode) (((mode) & 0170000) >> 12) - -struct __mlibc_dir_struct { - int __handle; - __mlibc_size __ent_next; - __mlibc_size __ent_limit; - char __ent_buffer[2048]; - struct dirent __current; -}; - -typedef struct __mlibc_dir_struct DIR; - -#ifndef __MLIBC_ABI_ONLY - -int alphasort(const struct dirent **, const struct dirent **); -int closedir(DIR *); -int dirfd(DIR *); -DIR *fdopendir(int); -DIR *opendir(const char *); -struct dirent *readdir(DIR *); -int readdir_r(DIR *__restrict, struct dirent *__restrict, struct dirent **__restrict); -void rewinddir(DIR *); -int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), - int (*)(const struct dirent **, const struct dirent **)); -void seekdir(DIR *, long); -long telldir(DIR *); -int versionsort(const struct dirent **, const struct dirent **); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _DIRENT_H - diff --git a/lib/mlibc/options/posix/include/dlfcn.h b/lib/mlibc/options/posix/include/dlfcn.h deleted file mode 100644 index 3bb8a02..0000000 --- a/lib/mlibc/options/posix/include/dlfcn.h +++ /dev/null @@ -1,52 +0,0 @@ - -#ifndef _DLFCN_H -#define _DLFCN_H - -#define RTLD_LOCAL 0 -#define RTLD_NOW 1 -#define RTLD_GLOBAL 2 -#define RTLD_NOLOAD 4 -#define RTLD_NODELETE 8 -#define RTLD_DEEPBIND 16 -#define RTLD_LAZY 32 - -#define RTLD_NEXT ((void *)-1) -#define RTLD_DEFAULT ((void *)0) - -#define RTLD_DI_LINKMAP 2 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int dlclose(void *); -char *dlerror(void); -void *dlopen(const char *, int); -void *dlsym(void *__restrict, const char *__restrict); -void *dlvsym(void *__restrict, const char *__restrict, const char *__restrict); - -#endif /* !__MLIBC_ABI_ONLY */ - -//gnu extension -typedef struct { - const char *dli_fname; - void *dli_fbase; - const char *dli_sname; - void *dli_saddr; -} Dl_info; - -#ifndef __MLIBC_ABI_ONLY - -int dladdr(const void *, Dl_info *); -int dlinfo(void *, int, void *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _DLFCN_H - diff --git a/lib/mlibc/options/posix/include/fcntl.h b/lib/mlibc/options/posix/include/fcntl.h deleted file mode 100644 index 9983219..0000000 --- a/lib/mlibc/options/posix/include/fcntl.h +++ /dev/null @@ -1,76 +0,0 @@ - -#ifndef _FCNTL_H -#define _FCNTL_H - -#include <abi-bits/fcntl.h> -#include <abi-bits/seek-whence.h> -#include <abi-bits/mode_t.h> -#include <abi-bits/pid_t.h> -#include <bits/posix/iovec.h> -#include <bits/off_t.h> -#include <bits/ssize_t.h> -#include <bits/size_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define O_NDELAY O_NONBLOCK - -struct flock { - short l_type; - short l_whence; - off_t l_start; - off_t l_len; - pid_t l_pid; -}; - -#ifndef __MLIBC_ABI_ONLY - -int creat(const char *, mode_t); -int fallocate(int fd, int mode, off_t offset, off_t len); -int fcntl(int fd, int command, ...); -int open(const char *path, int flags, ...); -int openat(int, const char *, int, ...); -int posix_fadvise(int, off_t, off_t, int); -int posix_fallocate(int, off_t, off_t); - -#endif /* !__MLIBC_ABI_ONLY */ - -// This is a linux extension - -struct file_handle { - unsigned int handle_bytes; - int handle_type; - unsigned char f_handle[0]; -}; - -#ifndef __MLIBC_ABI_ONLY - -int name_to_handle_at(int, const char *, struct file_handle *, int *, int); -int open_by_handle_at(int, struct file_handle *, int); - -ssize_t splice(int fd_in, off_t *off_in, int fd_out, off_t *off_out, size_t len, unsigned int flags); -ssize_t vmsplice(int fd, const struct iovec *iov, size_t nr_segs, unsigned int flags); - -#endif /* !__MLIBC_ABI_ONLY */ - -#define SPLICE_F_MOVE 1 -#define SPLICE_F_NONBLOCK 2 -#define SPLICE_F_MORE 4 -#define SPLICE_F_GIFT 8 - -#define AT_NO_AUTOMOUNT 0x800 - -#define F_SETPIPE_SZ 1031 -#define F_GETPIPE_SZ 1032 - -#define FALLOC_FL_KEEP_SIZE 1 -#define FALLOC_FL_PUNCH_HOLE 2 - -#ifdef __cplusplus -} -#endif - -#endif // _FCNTL_H - diff --git a/lib/mlibc/options/posix/include/fnmatch.h b/lib/mlibc/options/posix/include/fnmatch.h deleted file mode 100644 index 3eccbd0..0000000 --- a/lib/mlibc/options/posix/include/fnmatch.h +++ /dev/null @@ -1,33 +0,0 @@ - -#ifndef _FNMATCH_H -#define _FNMATCH_H - -#ifdef __cplusplus -extern "C" { -#endif - -// POSIX-defined fnmatch() flags. -#define FNM_PATHNAME 0x1 -#define FNM_NOESCAPE 0x2 -#define FNM_PERIOD 0x4 - -// GNU extensions for fnmatch() flags. -#define FNM_LEADING_DIR 0x8 -#define FNM_CASEFOLD 0x10 -#define FNM_EXTMATCH 0x20 - -// fnmatch() return values. -#define FNM_NOMATCH 1 - -#ifndef __MLIBC_ABI_ONLY - -int fnmatch(const char *, const char *, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _FNMATCH_H - diff --git a/lib/mlibc/options/posix/include/ftw.h b/lib/mlibc/options/posix/include/ftw.h deleted file mode 100644 index bde283d..0000000 --- a/lib/mlibc/options/posix/include/ftw.h +++ /dev/null @@ -1,43 +0,0 @@ - -#ifndef _FTW_H -#define _FTW_H - -#include <bits/posix/stat.h> - -#define FTW_F 1 -#define FTW_D 2 -#define FTW_DNR 3 -#define FTW_DP 4 -#define FTW_NS 5 -#define FTW_SL 6 -#define FTW_SLN 7 - -#define FTW_PHYS 1 -#define FTW_MOUNT 2 -#define FTW_DEPTH 4 -#define FTW_CHDIR 8 - -#define FTW_CONTINUE 0 - -#ifdef __cplusplus -extern "C" { -#endif - -struct FTW { - int base; - int level; -}; - -#ifndef __MLIBC_ABI_ONLY - -int ftw(const char *, int (*)(const char *, const struct stat *, int), int); -int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *), int, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _FTW_H - diff --git a/lib/mlibc/options/posix/include/glob.h b/lib/mlibc/options/posix/include/glob.h deleted file mode 100644 index 2bf9e48..0000000 --- a/lib/mlibc/options/posix/include/glob.h +++ /dev/null @@ -1,58 +0,0 @@ - -#ifndef _GLOB_H -#define _GLOB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/size_t.h> - -#define GLOB_APPEND 0x01 -#define GLOB_DOOFFS 0x02 -#define GLOB_ERR 0x04 -#define GLOB_MARK 0x08 -#define GLOB_NOCHECK 0x10 -#define GLOB_NOESCAPE 0x20 -#define GLOB_NOSORT 0x40 -#define GLOB_PERIOD 0x80 -#define GLOB_TILDE 0x100 -#define GLOB_TILDE_CHECK 0x200 -#define GLOB_BRACE 0x400 -#define GLOB_NOMAGIC 0x800 -#define GLOB_ALTDIRFUNC 0x1000 -#define GLOB_ONLYDIR 0x2000 -#define GLOB_MAGCHAR 0x4000 - -#define GLOB_ABORTED 1 -#define GLOB_NOMATCH 2 -#define GLOB_NOSPACE 3 -#define GLOB_NOSYS 4 - -struct stat; -typedef struct glob_t { - size_t gl_pathc; - char **gl_pathv; - size_t gl_offs; - int gl_flags; - void (*gl_closedir) (void *); - struct dirent *(*gl_readdir) (void *); - void *(*gl_opendir) (const char *); - int (*gl_lstat) (const char *__restrict, struct stat *__restrict); - int (*gl_stat) (const char *__restrict, struct stat *__restrict); -} glob_t; - -#ifndef __MLIBC_ABI_ONLY - -int glob(const char *__restirct, int, int(*)(const char *, int), struct glob_t *__restrict); -void globfree(struct glob_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _GLOB_H - - diff --git a/lib/mlibc/options/posix/include/grp.h b/lib/mlibc/options/posix/include/grp.h deleted file mode 100644 index a50396e..0000000 --- a/lib/mlibc/options/posix/include/grp.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _GRP_H -#define _GRP_H - -#include <stddef.h> -#include <stdio.h> -#include <abi-bits/gid_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct group { - char *gr_name; - char *gr_passwd; - gid_t gr_gid; - char **gr_mem; -}; - -#ifndef __MLIBC_ABI_ONLY - -void endgrent(void); -struct group *getgrent(void); -struct group *getgrgid(gid_t); -int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); -struct group *getgrnam(const char *); -int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); -void setgrent(void); -int putgrent(const struct group *, FILE *); -struct group *fgetgrent(FILE *); - -int setgroups(size_t size, const gid_t *list); -int initgroups(const char *user, gid_t group); - -// Non standard extension -int getgrouplist(const char *, gid_t, gid_t *, int *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _GRP_H diff --git a/lib/mlibc/options/posix/include/langinfo.h b/lib/mlibc/options/posix/include/langinfo.h deleted file mode 100644 index 5436a54..0000000 --- a/lib/mlibc/options/posix/include/langinfo.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef _LANGINFO_H -#define _LANGINFO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/posix/locale_t.h> -#include <bits/nl_item.h> - -#ifndef __MLIBC_ABI_ONLY - -char *nl_langinfo(nl_item); -char *nl_langinfo_l(nl_item, locale_t); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _LANGINFO_H - diff --git a/lib/mlibc/options/posix/include/libgen.h b/lib/mlibc/options/posix/include/libgen.h deleted file mode 100644 index fa53fc5..0000000 --- a/lib/mlibc/options/posix/include/libgen.h +++ /dev/null @@ -1,28 +0,0 @@ - -#ifndef _LIBGEN_H -#define _LIBGEN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(basename) && defined(_GNU_SOURCE) -/* see: ./options/ansi/include/string.h, search for __mlibc_gnu_basename */ -# undef basename -#endif - -#ifndef __MLIBC_ABI_ONLY - -char *basename(char *); -#define basename basename -char *dirname(char *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _LIBGEN_H - - diff --git a/lib/mlibc/options/posix/include/mlibc/lookup.hpp b/lib/mlibc/options/posix/include/mlibc/lookup.hpp deleted file mode 100644 index 71f84e7..0000000 --- a/lib/mlibc/options/posix/include/mlibc/lookup.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef _MLIBC_LOOKUP -#define _MLIBC_LOOKUP - -#include <stdint.h> -#include <netinet/in.h> -#include <netdb.h> -#include <frg/string.hpp> -#include <frg/vector.hpp> -#include <frg/span.hpp> -#include <frg/array.hpp> -#include <mlibc/allocator.hpp> - -namespace mlibc { - -struct dns_addr_buf { - dns_addr_buf() - : name(getAllocator()) {} - frg::string<MemoryAllocator> name; - int family; - uint8_t addr[16]; -}; - -struct lookup_result { - lookup_result() - : buf(getAllocator()), aliases(getAllocator()) {} - frg::vector<struct dns_addr_buf, MemoryAllocator> buf; - frg::vector<frg::string<MemoryAllocator>, MemoryAllocator> aliases; -}; - -struct dns_header { - uint16_t identification; - uint16_t flags; - uint16_t no_q; - uint16_t no_ans; - uint16_t no_auths; - uint16_t no_additional; -}; - -struct ai_buf { - struct addrinfo ai; - union sa { - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - } sa; -}; - -int lookup_name_dns(struct lookup_result &buf, const char *name, - frg::string<MemoryAllocator> &canon_name); -int lookup_addr_dns(frg::span<char> name, frg::array<uint8_t, 16> &addr, int family); -int lookup_name_hosts(struct lookup_result &buf, const char *name, - frg::string<MemoryAllocator> &canon_name); -int lookup_addr_hosts(frg::span<char> name, frg::array<uint8_t, 16> &addr, int family); -int lookup_name_null(struct lookup_result &buf, int flags, int family); -int lookup_name_ip(struct lookup_result &buf, const char *name, int family); - -} // namespace mlibc - -#endif // _MLIBC_LOOKUP diff --git a/lib/mlibc/options/posix/include/mlibc/posix-file-io.hpp b/lib/mlibc/options/posix/include/mlibc/posix-file-io.hpp deleted file mode 100644 index ac316ac..0000000 --- a/lib/mlibc/options/posix/include/mlibc/posix-file-io.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef MLIBC_POSIX_FILE_IO_HPP -#define MLIBC_POSIX_FILE_IO_HPP - -#include <frg/span.hpp> -#include <frg/vector.hpp> -#include <mlibc/file-io.hpp> -#include <mlibc/allocator.hpp> - -namespace mlibc { - -struct mem_file : abstract_file { - mem_file(int flags, void (*do_dispose)(abstract_file *) = nullptr) : abstract_file{do_dispose}, _flags{flags} { }; - - int reopen(const char *path, const char *mode) override; -protected: - int determine_type(stream_type *type) override; - int determine_bufmode(buffer_mode *mode) override; - - virtual frg::span<char> _buffer() = 0; - virtual size_t _buffer_size() const = 0; - - off_t _pos = 0; - int _flags = 0; - // maintains the size of buffer contents as required by POSIX - off_t _max_size = 0; -}; - -struct memstream_mem_file final : public mem_file { - memstream_mem_file(char **ptr, size_t *sizeloc, int flags, void (*do_dispose)(abstract_file *) = nullptr); - - int close() override; - - int io_read(char *buffer, size_t max_size, size_t *actual_size) override; - int io_write(const char *buffer, size_t max_size, size_t *actual_size) override; - int io_seek(off_t offset, int whence, off_t *new_offset) override; - - frg::span<char> _buffer() override { - return {_buf.data(), _buffer_size()}; - } - - size_t _buffer_size() const override { - return _buf.size(); - } - -private: - void _update_ptrs(); - - // Where to write back buffer and size on flush and close. - char **_bufloc; - size_t *_sizeloc; - - frg::vector<char, MemoryAllocator> _buf = {getAllocator()}; -}; - -struct fmemopen_mem_file final : public mem_file { - fmemopen_mem_file(void *in_buf, size_t size, int flags, void (*do_dispose)(abstract_file *) = nullptr); - - int close() override; - - int io_read(char *buffer, size_t max_size, size_t *actual_size) override; - int io_write(const char *buffer, size_t max_size, size_t *actual_size) override; - int io_seek(off_t offset, int whence, off_t *new_offset) override; - - frg::span<char> _buffer() override { - return {reinterpret_cast<char *>(_inBuffer), _buffer_size()}; - } - - size_t _buffer_size() const override { - return _inBufferSize; - } - -private: - void *_inBuffer; - size_t _inBufferSize; - - bool _needsDeallocation = false; -}; - -struct cookie_file : abstract_file { - cookie_file(void *cookie, int flags, cookie_io_functions_t funcs, void (*do_dispose)(abstract_file *) = nullptr) - : abstract_file{do_dispose}, _cookie{cookie}, _flags{flags}, _funcs{funcs} { } - - int close() override; - int reopen(const char *path, const char *mode) override; -protected: - int determine_type(stream_type *type) override; - int determine_bufmode(buffer_mode *mode) override; - - int io_read(char *buffer, size_t max_size, size_t *actual_size) override; - int io_write(const char *buffer, size_t max_size, size_t *actual_size) override; - int io_seek(off_t offset, int whence, off_t *new_offset) override; - -private: - void *_cookie; - - int _flags; - cookie_io_functions_t _funcs; -}; - -} // namespace mlibc - -#endif // MLIBC_POSIX_FILE_IO_HPP diff --git a/lib/mlibc/options/posix/include/mlibc/posix-sysdeps.hpp b/lib/mlibc/options/posix/include/mlibc/posix-sysdeps.hpp deleted file mode 100644 index ba77b32..0000000 --- a/lib/mlibc/options/posix/include/mlibc/posix-sysdeps.hpp +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef MLIBC_POSIX_SYSDEPS -#define MLIBC_POSIX_SYSDEPS - -#include <stddef.h> - -#include <abi-bits/seek-whence.h> -#include <abi-bits/vm-flags.h> -#include <bits/off_t.h> -#include <bits/ssize_t.h> -#include <mlibc/fsfd_target.hpp> - -#include <fcntl.h> -#include <time.h> -#include <abi-bits/pid_t.h> -#include <abi-bits/socklen_t.h> -#include <bits/posix/stat.h> -#include <poll.h> -#include <stdarg.h> -#include <sys/socket.h> -#include <sys/resource.h> -#include <sys/utsname.h> -#include <sys/select.h> -#include <sys/sem.h> -#include <sys/statvfs.h> -#include <sys/time.h> -#include <sys/times.h> -#include <sys/wait.h> -#include <sched.h> -#include <termios.h> -#include <time.h> -#include <ucontext.h> - -namespace [[gnu::visibility("hidden")]] mlibc { - -void sys_libc_log(const char *message); -[[noreturn]] void sys_libc_panic(); - -[[noreturn]] void sys_exit(int status); -[[noreturn, gnu::weak]] void sys_thread_exit(); -int sys_clock_get(int clock, time_t *secs, long *nanos); - -int sys_open(const char *pathname, int flags, mode_t mode, int *fd); -[[gnu::weak]] int sys_flock(int fd, int options); - -[[gnu::weak]] int sys_open_dir(const char *path, int *handle); -[[gnu::weak]] int sys_read_entries(int handle, void *buffer, size_t max_size, - size_t *bytes_read); - -int sys_read(int fd, void *buf, size_t count, ssize_t *bytes_read); -[[gnu::weak]] int sys_readv(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read); - -int sys_write(int fd, const void *buf, size_t count, ssize_t *bytes_written); -[[gnu::weak]] int sys_pread(int fd, void *buf, size_t n, off_t off, ssize_t *bytes_read); -[[gnu::weak]] int sys_pwrite(int fd, const void *buf, size_t n, off_t off, ssize_t *bytes_read); - -int sys_seek(int fd, off_t offset, int whence, off_t *new_offset); -int sys_close(int fd); - -[[gnu::weak]] int sys_access(const char *path, int mode); -[[gnu::weak]] int sys_faccessat(int dirfd, const char *pathname, int mode, int flags); -[[gnu::weak]] int sys_dup(int fd, int flags, int *newfd); -[[gnu::weak]] int sys_dup2(int fd, int flags, int newfd); -// In contrast to the isatty() library function, the sysdep function uses return value -// zero (and not one) to indicate that the file is a terminal. -[[gnu::weak]] int sys_isatty(int fd); -[[gnu::weak]] int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags, - struct stat *statbuf); -[[gnu::weak]] int sys_statvfs(const char *path, struct statvfs *out); -[[gnu::weak]] int sys_fstatvfs(int fd, struct statvfs *out); -[[gnu::weak]] int sys_readlink(const char *path, void *buffer, size_t max_size, ssize_t *length); -[[gnu::weak]] int sys_rmdir(const char *path); -[[gnu::weak]] int sys_ftruncate(int fd, size_t size); -[[gnu::weak]] int sys_fallocate(int fd, off_t offset, size_t size); -[[gnu::weak]] int sys_unlinkat(int fd, const char *path, int flags); -[[gnu::weak]] int sys_openat(int dirfd, const char *path, int flags, mode_t mode, int *fd); -[[gnu::weak]] int sys_socket(int family, int type, int protocol, int *fd); -[[gnu::weak]] int sys_msg_send(int fd, const struct msghdr *hdr, int flags, ssize_t *length); -[[gnu::weak]] ssize_t sys_sendto(int fd, const void *buffer, size_t size, int flags, const struct sockaddr *sock_addr, socklen_t addr_length, ssize_t *length); -[[gnu::weak]] int sys_msg_recv(int fd, struct msghdr *hdr, int flags, ssize_t *length); -[[gnu::weak]] ssize_t sys_recvfrom(int fd, void *buffer, size_t size, int flags, struct sockaddr *sock_addr, socklen_t *addr_length, ssize_t *length); -[[gnu::weak]] int sys_listen(int fd, int backlog); -[[gnu::weak]] gid_t sys_getgid(); -[[gnu::weak]] gid_t sys_getegid(); -[[gnu::weak]] uid_t sys_getuid(); -[[gnu::weak]] uid_t sys_geteuid(); -[[gnu::weak]] pid_t sys_getpid(); -[[gnu::weak]] pid_t sys_gettid(); -[[gnu::weak]] pid_t sys_getppid(); -[[gnu::weak]] int sys_getpgid(pid_t pid, pid_t *pgid); -[[gnu::weak]] int sys_getsid(pid_t pid, pid_t *sid); -[[gnu::weak]] int sys_setpgid(pid_t pid, pid_t pgid); -[[gnu::weak]] int sys_setuid(uid_t uid); -[[gnu::weak]] int sys_seteuid(uid_t euid); -[[gnu::weak]] int sys_setgid(gid_t gid); -[[gnu::weak]] int sys_setegid(gid_t egid); -[[gnu::weak]] int sys_getgroups(size_t size, const gid_t *list, int *ret); -[[gnu::weak]] void sys_yield(); -[[gnu::weak]] int sys_sleep(time_t *secs, long *nanos); -[[gnu::weak]] int sys_fork(pid_t *child); -[[gnu::weak]] int sys_execve(const char *path, char *const argv[], char *const envp[]); -[[gnu::weak]] int sys_pselect(int num_fds, fd_set *read_set, fd_set *write_set, - fd_set *except_set, const struct timespec *timeout, const sigset_t *sigmask, int *num_events); -[[gnu::weak]] int sys_getrusage(int scope, struct rusage *usage); -[[gnu::weak]] int sys_getrlimit(int resource, struct rlimit *limit); -[[gnu::weak]] int sys_setrlimit(int resource, const struct rlimit *limit); -[[gnu::weak]] int sys_getpriority(int which, id_t who, int *value); -[[gnu::weak]] int sys_setpriority(int which, id_t who, int prio); -[[gnu::weak]] int sys_getschedparam(void *tcb, int *policy, struct sched_param *param); -[[gnu::weak]] int sys_setschedparam(void *tcb, int policy, const struct sched_param *param); -[[gnu::weak]] int sys_get_max_priority(int policy, int *out); -[[gnu::weak]] int sys_get_min_priority(int policy, int *out); -[[gnu::weak]] int sys_getcwd(char *buffer, size_t size); -[[gnu::weak]] int sys_chdir(const char *path); -[[gnu::weak]] int sys_fchdir(int fd); -[[gnu::weak]] int sys_chroot(const char *path); -[[gnu::weak]] int sys_mkdir(const char *path, mode_t mode); -[[gnu::weak]] int sys_mkdirat(int dirfd, const char *path, mode_t mode); -[[gnu::weak]] int sys_link(const char *old_path, const char *new_path); -[[gnu::weak]] int sys_linkat(int olddirfd, const char *old_path, int newdirfd, const char *new_path, int flags); -[[gnu::weak]] int sys_symlink(const char *target_path, const char *link_path); -[[gnu::weak]] int sys_symlinkat(const char *target_path, int dirfd, const char *link_path); -[[gnu::weak]] int sys_rename(const char *path, const char *new_path); -[[gnu::weak]] int sys_renameat(int olddirfd, const char *old_path, int newdirfd, const char *new_path); -[[gnu::weak]] int sys_fcntl(int fd, int request, va_list args, int *result); -[[gnu::weak]] int sys_ttyname(int fd, char *buf, size_t size); -[[gnu::weak]] int sys_fadvise(int fd, off_t offset, off_t length, int advice); -[[gnu::weak]] void sys_sync(); -[[gnu::weak]] int sys_fsync(int fd); -[[gnu::weak]] int sys_fdatasync(int fd); -[[gnu::weak]] int sys_chmod(const char *pathname, mode_t mode); -[[gnu::weak]] int sys_fchmod(int fd, mode_t mode); -[[gnu::weak]] int sys_fchmodat(int fd, const char *pathname, mode_t mode, int flags); -[[gnu::weak]] int sys_utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags); -[[gnu::weak]] int sys_mlock(const void *addr, size_t length); -[[gnu::weak]] int sys_munlock(const void *addr, size_t length); -[[gnu::weak]] int sys_mlockall(int flags); -[[gnu::weak]] int sys_mlock(const void *addr, size_t len); -[[gnu::weak]] int sys_munlockall(void); -[[gnu::weak]] int sys_mincore(void *addr, size_t length, unsigned char *vec); - -// mlibc assumes that anonymous memory returned by sys_vm_map() is zeroed by the kernel / whatever is behind the sysdeps -int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, off_t offset, void **window); - -[[gnu::weak]] int sys_vm_remap(void *pointer, size_t size, size_t new_size, void **window); -[[gnu::weak]] int sys_vm_protect(void *pointer, size_t size, int prot); - -int sys_vm_unmap(void *pointer, size_t size); - -[[gnu::weak]] int sys_setsid(pid_t *sid); -[[gnu::weak]] int sys_tcgetattr(int fd, struct termios *attr); -[[gnu::weak]] int sys_tcsetattr(int, int, const struct termios *attr); -[[gnu::weak]] int sys_tcflow(int, int); -[[gnu::weak]] int sys_tcflush(int fd, int queue); -[[gnu::weak]] int sys_tcdrain(int); -[[gnu::weak]] int sys_pipe(int *fds, int flags); -[[gnu::weak]] int sys_socketpair(int domain, int type_and_flags, int proto, int *fds); -[[gnu::weak]] int sys_poll(struct pollfd *fds, nfds_t count, int timeout, int *num_events); -[[gnu::weak]] int sys_ioctl(int fd, unsigned long request, void *arg, int *result); -[[gnu::weak]] int sys_getsockopt(int fd, int layer, int number, - void *__restrict buffer, socklen_t *__restrict size); -[[gnu::weak]] int sys_setsockopt(int fd, int layer, int number, - const void *buffer, socklen_t size); -[[gnu::weak]] int sys_shutdown(int sockfd, int how); -[[gnu::weak]] int sys_sigprocmask(int how, const sigset_t *__restrict set, - sigset_t *__restrict retrieve); -[[gnu::weak]] int sys_sigaction(int, const struct sigaction *__restrict, - struct sigaction *__restrict); -// NOTE: POSIX says that behavior of timeout = nullptr is unspecified. We treat this case -// as an infinite timeout, making sigtimedwait(..., nullptr) equivalent to sigwaitinfo(...) -[[gnu::weak]] int sys_sigtimedwait(const sigset_t *__restrict set, siginfo_t *__restrict info, const struct timespec *__restrict timeout, int *out_signal); -[[gnu::weak]] int sys_kill(int, int); -[[gnu::weak]] int sys_accept(int fd, int *newfd, struct sockaddr *addr_ptr, socklen_t *addr_length, int flags); -[[gnu::weak]] int sys_bind(int fd, const struct sockaddr *addr_ptr, socklen_t addr_length); -[[gnu::weak]] int sys_connect(int fd, const struct sockaddr *addr_ptr, socklen_t addr_length); -[[gnu::weak]] int sys_sockname(int fd, struct sockaddr *addr_ptr, socklen_t max_addr_length, - socklen_t *actual_length); -[[gnu::weak]] int sys_peername(int fd, struct sockaddr *addr_ptr, socklen_t max_addr_length, - socklen_t *actual_length); -[[gnu::weak]] int sys_gethostname(char *buffer, size_t bufsize); -[[gnu::weak]] int sys_sethostname(const char *buffer, size_t bufsize); -[[gnu::weak]] int sys_mkfifoat(int dirfd, const char *path, int mode); -[[gnu::weak]] int sys_getentropy(void *buffer, size_t length); -[[gnu::weak]] int sys_mknodat(int dirfd, const char *path, int mode, int dev); -[[gnu::weak]] int sys_umask(mode_t mode, mode_t *old); - -[[gnu::weak]] int sys_before_cancellable_syscall(ucontext_t *uctx); -[[gnu::weak]] int sys_tgkill(int tgid, int tid, int sig); - -[[gnu::weak]] int sys_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags); -[[gnu::weak]] int sys_sigaltstack(const stack_t *ss, stack_t *oss); -[[gnu::weak]] int sys_sigsuspend(const sigset_t *set); -[[gnu::weak]] int sys_sigpending(sigset_t *set); -[[gnu::weak]] int sys_setgroups(size_t size, const gid_t *list); -[[gnu::weak]] int sys_memfd_create(const char *name, int flags, int *fd); -[[gnu::weak]] int sys_madvise(void *addr, size_t length, int advice); -[[gnu::weak]] int sys_msync(void *addr, size_t length, int flags); - -[[gnu::weak]] int sys_getitimer(int which, struct itimerval *curr_value); -[[gnu::weak]] int sys_setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value); -[[gnu::weak]] int sys_timer_create(clockid_t clk, struct sigevent *__restrict evp, timer_t *__restrict res); -[[gnu::weak]] int sys_timer_settime(timer_t t, int flags, const struct itimerspec *__restrict val, struct itimerspec *__restrict old); -[[gnu::weak]] int sys_timer_delete(timer_t t); -[[gnu::weak]] int sys_times(struct tms *tms, clock_t *out); -[[gnu::weak]] int sys_uname(struct utsname *buf); -[[gnu::weak]] int sys_pause(); - -[[gnu::weak]] int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); -[[gnu::weak]] int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); -[[gnu::weak]] int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); -[[gnu::weak]] int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); -[[gnu::weak]] int sys_setreuid(uid_t ruid, uid_t euid); -[[gnu::weak]] int sys_setregid(gid_t rgid, gid_t egid); - -[[gnu::weak]] int sys_poll(struct pollfd *fds, nfds_t count, int timeout, int *num_events); - -[[gnu::weak]] int sys_if_indextoname(unsigned int index, char *name); -[[gnu::weak]] int sys_if_nametoindex(const char *name, unsigned int *ret); - -[[gnu::weak]] int sys_ptsname(int fd, char *buffer, size_t length); -[[gnu::weak]] int sys_unlockpt(int fd); - -[[gnu::weak]] int sys_thread_setname(void *tcb, const char *name); -[[gnu::weak]] int sys_thread_getname(void *tcb, char *name, size_t size); - -[[gnu::weak]] int sys_sysconf(int num, long *ret); - -[[gnu::weak]] int sys_semget(key_t key, int n, int fl, int *id); -[[gnu::weak]] int sys_semctl(int semid, int semnum, int cmd, void *semun, int *ret); - -[[gnu::weak]] int sys_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); -[[gnu::weak]] int sys_getthreadaffinity(pid_t tid, size_t cpusetsize, cpu_set_t *mask); - -[[gnu::weak]] int sys_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *mask); -[[gnu::weak]] int sys_setthreadaffinity(pid_t tid, size_t cpusetsize, const cpu_set_t *mask); - -[[gnu::weak]] int sys_waitid(idtype_t idtype, id_t id, siginfo_t *info, int options); - -} //namespace mlibc - -#endif // MLIBC_POSIX_SYSDEPS diff --git a/lib/mlibc/options/posix/include/mlibc/resolv_conf.hpp b/lib/mlibc/options/posix/include/mlibc/resolv_conf.hpp deleted file mode 100644 index 2a349c7..0000000 --- a/lib/mlibc/options/posix/include/mlibc/resolv_conf.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _MLIBC_RESOLV_CONF -#define _MLIBC_RESOLV_CONF - -#include <frg/string.hpp> -#include <frg/optional.hpp> -#include <mlibc/allocator.hpp> - -namespace mlibc { - -struct nameserver_data { - nameserver_data() - : name(getAllocator()) {} - frg::string<MemoryAllocator> name; - // for in the future we can also store options here -}; - -frg::optional<struct nameserver_data> get_nameserver(); - -} // namespace mlibc - -#endif // _MLIBC_RESOLV_CONF diff --git a/lib/mlibc/options/posix/include/mlibc/services.hpp b/lib/mlibc/options/posix/include/mlibc/services.hpp deleted file mode 100644 index 10dec47..0000000 --- a/lib/mlibc/options/posix/include/mlibc/services.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _MLIBC_SERVICES -#define _MLIBC_SERVICES - -#include <frg/small_vector.hpp> -#include <frg/vector.hpp> -#include <frg/string.hpp> -#include <mlibc/allocator.hpp> - -namespace mlibc { - -// Only two services for tcp and udp -#define SERV_MAX 2 - -struct service_buf { - service_buf() - : name(getAllocator()), aliases(getAllocator()) - { } - int port, protocol, socktype; - frg::string<MemoryAllocator> name; - frg::vector<frg::string<MemoryAllocator>, MemoryAllocator> aliases; -}; - -using service_result = frg::small_vector<service_buf, SERV_MAX, MemoryAllocator>; - -int lookup_serv_by_name(service_result &buf, const char *name, int proto, - int socktype, int flags); - -int lookup_serv_by_port(service_result &buf, int proto, int port); - - -} // namespace mlibc - -#endif // _MLIBC_SERVICES diff --git a/lib/mlibc/options/posix/include/mqueue.h b/lib/mlibc/options/posix/include/mqueue.h deleted file mode 100644 index 34ac990..0000000 --- a/lib/mlibc/options/posix/include/mqueue.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _MQUEUE_H -#define _MQUEUE_H - -#include <abi-bits/mqueue.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int mqd_t; - -#ifndef __MLIBC_ABI_ONLY - -int mq_getattr(mqd_t mqdes, struct mq_attr *attr); -int mq_setattr(mqd_t mqdes, const struct mq_attr *__restrict__ newattr, struct mq_attr *__restrict__ oldattr); -int mq_unlink(const char *name); -mqd_t mq_open(const char *name, int flags, ...); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif /* _MQUEUE_H */ - diff --git a/lib/mlibc/options/posix/include/net/if.h b/lib/mlibc/options/posix/include/net/if.h deleted file mode 100644 index 10016fd..0000000 --- a/lib/mlibc/options/posix/include/net/if.h +++ /dev/null @@ -1,118 +0,0 @@ - -#ifndef _NET_IF_H -#define _NET_IF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/socket.h> - -#define IF_NAMESIZE 16 -#define IFNAMSIZ IF_NAMESIZE -#define ALTIFNAMSIZ 128 -#define IFALIASZ 256 - -struct if_nameindex { - unsigned int if_index; - char *if_name; -}; - -struct ifmap { - unsigned long mem_start; - unsigned long mem_end; - unsigned short base_addr; - unsigned char irq; - unsigned char dma; - unsigned char port; -}; - -struct ifreq { - union { - char ifrn_name[IFNAMSIZ]; - } ifr_ifrn; - - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - struct sockaddr ifru_netmask; - struct sockaddr ifru_hwaddr; - short int ifru_flags; - int ifru_ivalue; - int ifru_mtu; - struct ifmap ifru_map; - char ifru_slave[IFNAMSIZ]; - char ifru_newname[IFNAMSIZ]; - char *ifru_data; - } ifr_ifru; -}; - -#define ifr_name ifr_ifrn.ifrn_name -#define ifr_hwaddr ifr_ifru.ifru_hwaddr -#define ifr_addr ifr_ifru.ifru_addr -#define ifr_dstaddr ifr_ifru.ifru_dstaddr -#define ifr_broadaddr ifr_ifru.ifru_broadaddr -#define ifr_netmask ifr_ifru.ifru_netmask -#define ifr_flags ifr_ifru.ifru_flags -#define ifr_metric ifr_ifru.ifru_ivalue -#define ifr_mtu ifr_ifru.ifru_mtu -#define ifr_map ifr_ifru.ifru_map -#define ifr_slave ifr_ifru.ifru_slave -#define ifr_data ifr_ifru.ifru_data -#define ifr_ifindex ifr_ifru.ifru_ivalue -#define ifr_bandwidth ifr_ifru.ifru_ivalue -#define ifr_qlen ifr_ifru.ifru_ivalue -#define ifr_newname ifr_ifru.ifru_newname - -struct ifconf { - int ifc_len; - union { - char *ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -}; - -#define ifc_buf ifc_ifcu.ifcu_buf -#define ifc_req ifc_ifcu.ifcu_req - -#ifndef __MLIBC_ABI_ONLY - -void if_freenameindex(struct if_nameindex *); -char *if_indextoname(unsigned int, char *); -struct if_nameindex *if_nameindex(void); -unsigned int if_nametoindex(const char *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#define IFHWADDRLEN 6 - -#define IFF_UP 0x1 -#define IFF_BROADCAST 0x2 -#define IFF_DEBUG 0x4 -#define IFF_LOOPBACK 0x8 -#define IFF_POINTOPOINT 0x10 -#define IFF_NOTRAILERS 0x20 -#define IFF_RUNNING 0x40 -#define IFF_NOARP 0x80 -#define IFF_PROMISC 0x100 -#define IFF_ALLMULTI 0x200 -#define IFF_MASTER 0x400 -#define IFF_SLAVE 0x800 -#define IFF_MULTICAST 0x1000 -#define IFF_PORTSEL 0x2000 -#define IFF_AUTOMEDIA 0x4000 -#define IFF_DYNAMIC 0x8000 -#define IFF_LOWER_UP 0x10000 -#define IFF_DORMANT 0x20000 -#define IFF_ECHO 0x40000 -#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \ - IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) - -#ifdef __cplusplus -} -#endif - -#endif // _NET_IF_H - - diff --git a/lib/mlibc/options/posix/include/net/if_arp.h b/lib/mlibc/options/posix/include/net/if_arp.h deleted file mode 100644 index de8a0c2..0000000 --- a/lib/mlibc/options/posix/include/net/if_arp.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef _NET_IF_ARP_H -#define _NET_IF_ARP_H - -#include <sys/types.h> -#include <sys/socket.h> -#include <stdint.h> - -#define ARPOP_REQUEST 1 -#define ARPOP_REPLY 2 -#define ARPOP_RREQUEST 3 -#define ARPOP_RREPLY 4 -#define ARPOP_InREQUEST 8 -#define ARPOP_InREPLY 9 -#define ARPOP_NAK 10 - -#define ARPHRD_NETROM 0 -#define ARPHRD_ETHER 1 -#define ARPHRD_EETHER 2 -#define ARPHRD_AX25 3 -#define ARPHRD_PRONET 4 -#define ARPHRD_CHAOS 5 -#define ARPHRD_IEEE802 6 -#define ARPHRD_ARCNET 7 -#define ARPHRD_APPLETLK 8 -#define ARPHRD_DLCI 15 -#define ARPHRD_ATM 19 -#define ARPHRD_METRICOM 23 -#define ARPHRD_IEEE1394 24 -#define ARPHRD_EUI64 27 -#define ARPHRD_INFINIBAND 32 -#define ARPHRD_SLIP 256 -#define ARPHRD_CSLIP 257 -#define ARPHRD_SLIP6 258 -#define ARPHRD_CSLIP6 259 -#define ARPHRD_RSRVD 260 -#define ARPHRD_ADAPT 264 -#define ARPHRD_ROSE 270 -#define ARPHRD_X25 271 -#define ARPHRD_HWX25 272 -#define ARPHRD_CAN 280 -#define ARPHRD_PPP 512 -#define ARPHRD_CISCO 513 -#define ARPHRD_HDLC ARPHRD_CISCO -#define ARPHRD_LAPB 516 -#define ARPHRD_DDCMP 517 -#define ARPHRD_RAWHDLC 518 -#define ARPHRD_RAWIP 519 - -#define ARPHRD_TUNNEL 768 -#define ARPHRD_TUNNEL6 769 -#define ARPHRD_FRAD 770 -#define ARPHRD_SKIP 771 -#define ARPHRD_LOOPBACK 772 -#define ARPHRD_LOCALTLK 773 -#define ARPHRD_FDDI 774 -#define ARPHRD_BIF 775 -#define ARPHRD_SIT 776 -#define ARPHRD_IPDDP 777 -#define ARPHRD_IPGRE 778 -#define ARPHRD_PIMREG 779 -#define ARPHRD_HIPPI 780 -#define ARPHRD_ASH 781 -#define ARPHRD_ECONET 782 -#define ARPHRD_IRDA 783 -#define ARPHRD_FCPP 784 -#define ARPHRD_FCAL 785 -#define ARPHRD_FCPL 786 -#define ARPHRD_FCFABRIC 787 -#define ARPHRD_IEEE802_TR 800 -#define ARPHRD_IEEE80211 801 -#define ARPHRD_IEEE80211_PRISM 802 -#define ARPHRD_IEEE80211_RADIOTAP 803 -#define ARPHRD_IEEE802154 804 -#define ARPHRD_IEEE802154_MONITOR 805 -#define ARPHRD_PHONET 820 -#define ARPHRD_PHONET_PIPE 821 -#define ARPHRD_CAIF 822 -#define ARPHRD_IP6GRE 823 -#define ARPHRD_NETLINK 824 -#define ARPHRD_6LOWPAN 825 -#define ARPHRD_VSOCKMON 826 - -#define ARPHRD_VOID 0xFFFF -#define ARPHRD_NONE 0xFFFE - -struct arphdr { - uint16_t ar_hrd; - uint16_t ar_pro; - uint8_t ar_hln; - uint8_t ar_pln; - uint16_t ar_op; -}; - -struct arpreq { - struct sockaddr arp_pa; - struct sockaddr arp_ha; - int arp_flags; - struct sockaddr arp_netmask; - char arp_dev[16]; -}; - -#endif // _NET_IF_ARP_H - diff --git a/lib/mlibc/options/posix/include/netdb.h b/lib/mlibc/options/posix/include/netdb.h deleted file mode 100644 index 368c74f..0000000 --- a/lib/mlibc/options/posix/include/netdb.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _NETDB_H -#define _NETDB_H - -#include <stdint.h> -#include <bits/size_t.h> -#include <bits/posix/in_port_t.h> -#include <bits/posix/in_addr_t.h> -#include <abi-bits/socklen_t.h> - -#define AI_PASSIVE 0x01 -#define AI_CANONNAME 0x02 -#define AI_NUMERICHOST 0x04 -#define AI_V4MAPPED 0x08 -#define AI_ALL 0x10 -#define AI_ADDRCONFIG 0x20 -#define AI_NUMERICSERV 0x40 - -#define NI_NOFQDN 0x01 -#define NI_NUMERICHOST 0x02 -#define NI_NAMEREQD 0x04 -#define NI_NUMERICSCOPE 0x08 -#define NI_DGRAM 0x10 - -#define NI_NUMERICSERV 2 -#define NI_MAXSERV 32 -#define NI_IDN 32 - -#define NI_MAXHOST 1025 - -#define EAI_AGAIN 1 -#define EAI_BADFLAGS 2 -#define EAI_FAIL 3 -#define EAI_FAMILY 4 -#define EAI_MEMORY 5 -#define EAI_NONAME 6 -#define EAI_SERVICE 7 -#define EAI_SOCKTYPE 8 -#define EAI_SYSTEM 9 -#define EAI_OVERFLOW 10 -#define EAI_NODATA 11 -#define EAI_ADDRFAMILY 12 - -#define HOST_NOT_FOUND 1 -#define TRY_AGAIN 2 -#define NO_RECOVERY 3 -#define NO_DATA 4 -#define NO_ADDRESS NO_DATA - -#define IPPORT_RESERVED 1024 - -#define _PATH_SERVICES "/etc/services" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int *__h_errno_location(void); -#define h_errno (*__h_errno_location()) - -#endif /* !__MLIBC_ABI_ONLY */ - -struct hostent { - char *h_name; - char **h_aliases; - int h_addrtype; - int h_length; - char **h_addr_list; -}; - -#define h_addr h_addr_list[0] // Required by some programs - -struct netent { - char *n_name; - char **n_aliases; - int n_addrtype; - uint32_t n_net; -}; - -struct protoent { - char *p_name; - char **p_aliases; - int p_proto; -}; - -struct servent { - char *s_name; - char **s_aliases; - int s_port; - char *s_proto; -}; - -struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - socklen_t ai_addrlen; - struct sockaddr *ai_addr; - char *ai_canonname; - struct addrinfo *ai_next; -}; - -#ifndef __MLIBC_ABI_ONLY - -void endhostent(void); -void endnetent(void); -void endprotoent(void); -void endservent(void); -void freeaddrinfo(struct addrinfo *); -const char *gai_strerror(int); -int getaddrinfo(const char *__restrict, const char *__restrict, - const struct addrinfo *__restrict, struct addrinfo **__restrict); -struct hostent *gethostent(void); -struct hostent *gethostbyname(const char *); -struct hostent *gethostbyname2(const char *, int); -struct hostent *gethostbyaddr(const void *, socklen_t, int); -int gethostbyaddr_r(const void *__restrict, socklen_t, int, struct hostent *__restrict, - char *__restrict, size_t, struct hostent **__restrict, int *__restrict); -int gethostbyname_r(const char *__restrict, struct hostent *__restrict, char *__restrict, size_t, - struct hostent **__restrict, int *__restrict); -int getnameinfo(const struct sockaddr *__restrict, socklen_t, - char *__restrict, socklen_t, char *__restrict, socklen_t, int); -struct netent *getnetbyaddr(uint32_t, int); -struct netent *getnetbyname(const char *); -struct netent *getnetent(void); -struct protoent *getprotobyname(const char *); -struct protoent *getprotobynumber(int); -struct protoent *getprotoent(void); -struct servent *getservbyname(const char *, const char *); -struct servent *getservbyport(int, const char *); -struct servent *getservent(void); -void sethostent(int); -void setnetent(int); -void setprotoent(int); -void setservent(int); - -// Deprecated GNU extension -const char *hstrerror(int err); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _NETDB_H diff --git a/lib/mlibc/options/posix/include/netinet/icmp6.h b/lib/mlibc/options/posix/include/netinet/icmp6.h deleted file mode 100644 index 7dfe237..0000000 --- a/lib/mlibc/options/posix/include/netinet/icmp6.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef _NETINET_ICMP6_H -#define _NETINET_ICMP6_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> -#include <abi-bits/in.h> -#include <mlibc-config.h> - -#if __MLIBC_GLIBC_OPTION -#include <bits/glibc/glibc_icmp6.h> -#endif // __MLIBC_GLIBC_OPTION - -#define ICMP6_FILTER 1 - -#define ICMP6_FILTER_BLOCK 1 -#define ICMP6_FILTER_PASS 2 -#define ICMP6_FILTER_BLOCKOTHERS 3 -#define ICMP6_FILTER_PASSONLY 4 -#define ICMP6_ECHO_REQUEST 128 - -struct icmp6_filter { - uint32_t icmp6_filt[8]; -}; - -struct icmp6_hdr { - uint8_t icmp6_type; - uint8_t icmp6_code; - uint16_t icmp6_cksum; - union { - uint32_t icmp6_un_data32[1]; - uint16_t icmp6_un_data16[2]; - uint8_t icmp6_un_data8[4]; - } icmp6_dataun; -}; - -#define icmp6_data32 icmp6_dataun.icmp6_un_data32 -#define icmp6_data16 icmp6_dataun.icmp6_un_data16 -#define icmp6_data8 icmp6_dataun.icmp6_un_data8 - -#define icmp6_pptr icmp6_data32[0] -#define icmp6_mtu icmp6_data32[0] -#define icmp6_id icmp6_data16[0] -#define icmp6_seq icmp6_data16[1] -#define icmp6_maxdelay icmp6_data16[0] - -#define ICMP6_FILTER_WILLPASS(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) & (1U << ((type) & 31))) == 0) - -#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) & (1U << ((type) & 31))) != 0) - -#define ICMP6_FILTER_SETPASS(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1U << ((type) & 31)))) - -#define ICMP6_FILTER_SETBLOCK(type, filterp) \ - ((((filterp)->icmp6_filt[(type) >> 5]) |= (1U << ((type) & 31)))) - -#define ICMP6_FILTER_SETPASSALL(filterp) \ - memset (filterp, 0, sizeof (struct icmp6_filter)); - -#define ICMP6_FILTER_SETBLOCKALL(filterp) \ - memset (filterp, 0xFF, sizeof (struct icmp6_filter)); - -#define ND_ROUTER_SOLICIT 133 -#define ND_ROUTER_ADVERT 134 -#define ND_NEIGHBOR_SOLICIT 135 -#define ND_NEIGHBOR_ADVERT 136 -#define ND_REDIRECT 137 - -struct nd_router_solicit { - struct icmp6_hdr nd_rs_hdr; -}; - -#define nd_rs_type nd_rs_hdr.icmp6_type -#define nd_rs_code nd_rs_hdr.icmp6_code -#define nd_rs_cksum nd_rs_hdr.icmp6_cksum -#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] - -struct nd_router_advert { - struct icmp6_hdr nd_ra_hdr; - uint32_t nd_ra_reachable; - uint32_t nd_ra_retransmit; -}; - -struct nd_opt_hdr { - uint8_t nd_opt_type; - uint8_t nd_opt_len; -}; - -#define ND_OPT_SOURCE_LINKADDR 1 -#define ND_OPT_TARGET_LINKADDR 2 -#define ND_OPT_PREFIX_INFORMATION 3 -#define ND_OPT_REDIRECTED_HEADER 4 -#define ND_OPT_MTU 5 -#define ND_OPT_RTR_ADV_INTERVAL 7 -#define ND_OPT_HOME_AGENT_INFO 8 - -struct nd_opt_prefix_info { - uint8_t nd_opt_pi_type; - uint8_t nd_opt_pi_len; - uint8_t nd_opt_pi_prefix_len; - uint8_t nd_opt_pi_flags_reserved; - uint32_t nd_opt_pi_valid_time; - uint32_t nd_opt_pi_preferred_time; - uint32_t nd_opt_pi_reserved2; - struct in6_addr nd_opt_pi_prefix; -}; - -#define ND_OPT_PI_FLAG_RADDR 0x20 -#define ND_OPT_PI_FLAG_AUTO 0x40 -#define ND_OPT_PI_FLAG_ONLINK 0x80 - -#define nd_ra_type nd_ra_hdr.icmp6_type -#define nd_ra_code nd_ra_hdr.icmp6_code -#define nd_ra_cksum nd_ra_hdr.icmp6_cksum -#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] -#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] -#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] - -#define ND_RA_FLAG_HOME_AGENT 0x20 -#define ND_RA_FLAG_OTHER 0x40 -#define ND_RA_FLAG_MANAGED 0x80 - -struct nd_opt_mtu { - uint8_t nd_opt_mtu_type; - uint8_t nd_opt_mtu_len; - uint16_t nd_opt_mtu_reserved; - uint32_t nd_opt_mtu_mtu; -}; - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_ICMP6_H - diff --git a/lib/mlibc/options/posix/include/netinet/if_ether.h b/lib/mlibc/options/posix/include/netinet/if_ether.h deleted file mode 100644 index c4ce173..0000000 --- a/lib/mlibc/options/posix/include/netinet/if_ether.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef _NETINET_IF_ETHER_H -#define _NETINET_IF_ETHER_H - -#include <net/if_arp.h> - -#define ETH_ALEN 6 -#define ETH_HLEN 14 -#define ETH_ZLEN 60 -#define ETH_FRAME_LEN 1514 -#define ETH_FCS_LEN 4 - -#define ETH_P_LOOP 0x0060 -#define ETH_P_PUP 0x0200 -#define ETH_P_PUPAT 0x0201 -#define ETH_P_IP 0x0800 -#define ETH_P_X25 0x0805 -#define ETH_P_ARP 0x0806 -#define ETH_P_BPQ 0x08FF -#define ETH_P_IEEEPUP 0x0a00 -#define ETH_P_IEEEPUPAT 0x0a01 -#define ETH_P_BATMAN 0x4305 -#define ETH_P_DEC 0x6000 -#define ETH_P_DNA_DL 0x6001 -#define ETH_P_DNA_RC 0x6002 -#define ETH_P_DNA_RT 0x6003 -#define ETH_P_LAT 0x6004 -#define ETH_P_DIAG 0x6005 -#define ETH_P_CUST 0x6006 -#define ETH_P_SCA 0x6007 -#define ETH_P_TEB 0x6558 -#define ETH_P_RARP 0x8035 -#define ETH_P_ATALK 0x809B -#define ETH_P_AARP 0x80F3 -#define ETH_P_8021Q 0x8100 -#define ETH_P_IPX 0x8137 -#define ETH_P_IPV6 0x86DD -#define ETH_P_PAUSE 0x8808 -#define ETH_P_SLOW 0x8809 -#define ETH_P_WCCP 0x883E -#define ETH_P_MPLS_UC 0x8847 -#define ETH_P_MPLS_MC 0x8848 -#define ETH_P_ATMMPOA 0x884c -#define ETH_P_PPP_DISC 0x8863 -#define ETH_P_PPP_SES 0x8864 -#define ETH_P_LINK_CTL 0x886c -#define ETH_P_ATMFATE 0x8884 -#define ETH_P_PAE 0x888E -#define ETH_P_AOE 0x88A2 -#define ETH_P_8021AD 0x88A8 -#define ETH_P_802_EX1 0x88B5 -#define ETH_P_TIPC 0x88CA -#define ETH_P_8021AH 0x88E7 -#define ETH_P_MVRP 0x88F5 -#define ETH_P_1588 0x88F7 -#define ETH_P_PRP 0x88FB -#define ETH_P_FCOE 0x8906 -#define ETH_P_TDLS 0x890D -#define ETH_P_FIP 0x8914 -#define ETH_P_80221 0x8917 -#define ETH_P_LOOPBACK 0x9000 -#define ETH_P_QINQ1 0x9100 -#define ETH_P_QINQ2 0x9200 -#define ETH_P_QINQ3 0x9300 -#define ETH_P_EDSA 0xDADA -#define ETH_P_AF_IUCV 0xFBFB - -#define ETH_P_802_3_MIN 0x0600 - -#define ETH_P_802_3 0x0001 -#define ETH_P_AX25 0x0002 -#define ETH_P_ALL 0x0003 -#define ETH_P_802_2 0x0004 -#define ETH_P_SNAP 0x0005 -#define ETH_P_DDCMP 0x0006 -#define ETH_P_WAN_PPP 0x0007 -#define ETH_P_PPP_MP 0x0008 -#define ETH_P_LOCALTALK 0x0009 -#define ETH_P_CAN 0x000C -#define ETH_P_CANFD 0x000D -#define ETH_P_PPPTALK 0x0010 -#define ETH_P_TR_802_2 0x0011 -#define ETH_P_MOBITEX 0x0015 -#define ETH_P_CONTROL 0x0016 -#define ETH_P_IRDA 0x0017 -#define ETH_P_ECONET 0x0018 -#define ETH_P_HDLC 0x0019 -#define ETH_P_ARCNET 0x001A -#define ETH_P_DSA 0x001B -#define ETH_P_TRAILER 0x001C -#define ETH_P_PHONET 0x00F5 -#define ETH_P_IEEE802154 0x00F6 -#define ETH_P_CAIF 0x00F7 - -#include <net/ethernet.h> -#include <net/if_arp.h> - -struct ether_arp { - struct arphdr ea_hdr; - uint8_t arp_sha[ETH_ALEN]; - uint8_t arp_spa[4]; - uint8_t arp_tha[ETH_ALEN]; - uint8_t arp_tpa[4]; -}; - -#endif //_NETINET_IF_ETHER_H diff --git a/lib/mlibc/options/posix/include/netinet/in.h b/lib/mlibc/options/posix/include/netinet/in.h deleted file mode 100644 index 9a42c47..0000000 --- a/lib/mlibc/options/posix/include/netinet/in.h +++ /dev/null @@ -1,118 +0,0 @@ - -#ifndef _NETINET_IN_H -#define _NETINET_IN_H - -#include <stdint.h> -#include <endian.h> -#include <sys/socket.h> // struct sockaddr -#include <abi-bits/socket.h> -#include <abi-bits/in.h> -#include <arpa/inet.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -extern const struct in6_addr in6addr_any; -extern const struct in6_addr in6addr_loopback; - -uint32_t htonl(uint32_t); -uint16_t htons(uint16_t); -uint32_t ntohl(uint32_t); -uint16_t ntohs(uint16_t); - -#endif /* !__MLIBC_ABI_ONLY */ - -#define IN6_IS_ADDR_UNSPECIFIED(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - !_a[0] && \ - !_a[1] && \ - !_a[2] && \ - !_a[3]; \ -}) -#define IN6_IS_ADDR_LOOPBACK(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - !_a[0] && \ - !_a[1] && \ - !_a[2] && \ - _a[3] == htonl(0x0001); \ -}) -#define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff) -#define IN6_IS_ADDR_LINKLOCAL(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - _a[0] & htonl(0xffc00000) == htonl(0xfe800000); \ -}) -#define IN6_IS_ADDR_SITELOCAL(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - _a[0] & htonl(0xffc00000) == htonl(0xfec00000); \ -}) -#define IN6_IS_ADDR_V4MAPPED(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - !_a[0] && \ - !_a[1] && \ - _a[2] == htonl(0xffff); \ -}) -#define __ARE_4_BYTE_EQUAL(a, b) \ - ((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && \ - (a)[3] == (b)[3] && (a)[4] == (b)[4]) -#define IN6_ARE_ADDR_EQUAL(a, b) \ - __ARE_4_BYTE_EQUAL((const uint32_t *)(a), (const uint32_t *)(b)) - -#define IN6_IS_ADDR_V4COMPAT(a) ({ \ - uint32_t *_a = (uint32_t *)(((struct in6_addr *) a)->s6_addr); \ - uint8_t *_a8 = (uint8_t *)(((struct in6_addr *) a)->s6_addr); \ - !_a[0] && !_a[1] && !_a[2] && (_a8[15] > 1); \ -}) -#define IN6_IS_ADDR_MC_NODELOCAL(a) ({ \ - (IN6_IS_ADDR_MULTICAST(a) && \ - ((((const uint8_t *)(a))[1] & 0xf) == 0x1)); \ -}) -#define IN6_IS_ADDR_MC_LINKLOCAL(a) ({ \ - (IN6_IS_ADDR_MULTICAST(a) && \ - ((((const uint8_t *)(a))[1] & 0xf) == 0x2)); \ -}) -#define IN6_IS_ADDR_MC_SITELOCAL(a) ({ \ - (IN6_IS_ADDR_MULTICAST(a) && \ - ((((const uint8_t *)(a))[1] & 0xf) == 0x5)); \ -}) -#define IN6_IS_ADDR_MC_ORGLOCAL(a) ({ \ - (IN6_IS_ADDR_MULTICAST(a) && \ - ((((const uint8_t *)(a))[1] & 0xf) == 0x8)); \ -}) -#define IN6_IS_ADDR_MC_GLOBAL(a) ({ \ - (IN6_IS_ADDR_MULTICAST(a) && \ - ((((const uint8_t *)(a))[1] & 0xf) == 0xe)); \ -}) - -#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) -#define IN_CLASSA_MAX 128 -#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) -#define IN_CLASSB_MAX 65536 -#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) -#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) -#define IN_MULTICAST(a) IN_CLASSD(a) -#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) - -#define IN_LOOPBACKNET 127 - -#define MCAST_EXCLUDE 0 -#define MCAST_INCLUDE 1 - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_IN_H - diff --git a/lib/mlibc/options/posix/include/netinet/ip.h b/lib/mlibc/options/posix/include/netinet/ip.h deleted file mode 100644 index 161aa18..0000000 --- a/lib/mlibc/options/posix/include/netinet/ip.h +++ /dev/null @@ -1,75 +0,0 @@ - -#ifndef _NETINET_IP_H -#define _NETINET_IP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <netinet/in.h> - -#define IPTOS_TOS_MASK 0x1E -#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) -#define IPTOS_LOWDELAY 0x10 -#define IPTOS_THROUGHPUT 0x08 -#define IPTOS_RELIABILITY 0x04 -#define IPTOS_LOWCOST 0x02 -#define IPTOS_MINCOST IPTOS_LOWCOST -#define IPTOS_CLASS_CS4 0x80 -#define IPTOS_CLASS_CS6 0xC0 - -#define IPDEFTTL 64 - -struct ip { -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int ip_hl:4; - unsigned int ip_v:4; -#endif -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int ip_v:4; - unsigned int ip_hl:4; -#endif - uint8_t ip_tos; - unsigned short ip_len; - unsigned short ip_id; - unsigned short ip_off; -#define IP_RF 0x8000 -#define IP_DF 0x4000 -#define IP_MF 0x2000 -#define IP_OFFMASK 0x1fff - uint8_t ip_ttl; - uint8_t ip_p; - unsigned short ip_sum; - struct in_addr ip_src, ip_dst; -}; - -#define IPVERSION 4 - -struct iphdr { -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int ihl:4; - unsigned int version:4; -#elif __BYTE_ORDER == __BIG_ENDIAN - unsigned int version:4; - unsigned int ihl:4; -#else -# error "Please fix <endian.h>" -#endif - uint8_t tos; - uint16_t tot_len; - uint16_t id; - uint16_t frag_off; - uint8_t ttl; - uint8_t protocol; - uint16_t check; - uint32_t saddr; - uint32_t daddr; -}; - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_IP_H - diff --git a/lib/mlibc/options/posix/include/netinet/ip6.h b/lib/mlibc/options/posix/include/netinet/ip6.h deleted file mode 100644 index 88f0cb6..0000000 --- a/lib/mlibc/options/posix/include/netinet/ip6.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _NETINET_IP6_H -#define _NETINET_IP6_H - -#include <netinet/in.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct ip6_hdr { - union { - struct ip6_hdrctl { - uint32_t ip6_un1_flow; - uint16_t ip6_un1_plen; - uint8_t ip6_un1_nxt; - uint8_t ip6_un1_hlim; - } ip6_un1; - uint8_t ip6_un2_vfc; - } ip6_ctlun; - struct in6_addr ip6_src; - struct in6_addr ip6_dst; -}; - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_IP6_H diff --git a/lib/mlibc/options/posix/include/netinet/ip_icmp.h b/lib/mlibc/options/posix/include/netinet/ip_icmp.h deleted file mode 100644 index 56615e4..0000000 --- a/lib/mlibc/options/posix/include/netinet/ip_icmp.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _NETINET_ICMP_H -#define _NETINET_ICMP_H - -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#include <netinet/in.h> -#include <netinet/ip.h> - -#define ICMP_ECHOREPLY 0 -#define ICMP_ECHO 8 -#define ICMP_ADVLENMIN (8 + sizeof(struct ip) + 8) - -struct icmp_ra_addr { - uint32_t ira_addr; - uint32_t ira_preference; -}; - -struct icmp { - uint8_t icmp_type; - uint8_t icmp_code; - uint16_t icmp_cksum; - union { - unsigned char ih_pptr; - struct in_addr ih_gwaddr; - struct ih_idseq { - uint16_t icd_id; - uint16_t icd_seq; - } ih_idseq; - uint32_t ih_void; - - struct ih_pmtu { - uint16_t ipm_void; - uint16_t ipm_nextmtu; - } ih_pmtu; - - struct ih_rtradv { - uint8_t irt_num_addrs; - uint8_t irt_wpa; - uint16_t irt_lifetime; - } ih_rtradv; - } icmp_hun; - union { - struct { - uint32_t its_otime; - uint32_t its_rtime; - uint32_t its_ttime; - } id_ts; - struct { - struct ip idi_ip; - } id_ip; - struct icmp_ra_addr id_radv; - uint32_t id_mask; - uint8_t id_data[1]; - } icmp_dun; -}; - -#define icmp_pptr icmp_hun.ih_pptr -#define icmp_gwaddr icmp_hun.ih_gwaddr -#define icmp_id icmp_hun.ih_idseq.icd_id -#define icmp_seq icmp_hun.ih_idseq.icd_seq -#define icmp_void icmp_hun.ih_void -#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void -#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu -#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs -#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa -#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime - -#define icmp_otime icmp_dun.id_ts.its_otime -#define icmp_rtime icmp_dun.id_ts.its_rtime -#define icmp_ttime icmp_dun.id_ts.its_ttime -#define icmp_ip icmp_dun.id_ip.idi_ip -#define icmp_radv icmp_dun.id_radv -#define icmp_mask icmp_dun.id_mask -#define icmp_data icmp_dun.id_data - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_ICMP_H diff --git a/lib/mlibc/options/posix/include/netinet/tcp.h b/lib/mlibc/options/posix/include/netinet/tcp.h deleted file mode 100644 index 9d64d7a..0000000 --- a/lib/mlibc/options/posix/include/netinet/tcp.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _NETINET_TCP_H -#define _NETINET_TCP_H - -#ifdef __cplusplus -extern "C" { -#endif - -// Define some macros using same ABI as Linux -#define TCP_NODELAY 1 -#define TCP_MAXSEG 2 -#define TCP_KEEPIDLE 4 -#define TCP_KEEPINTVL 5 -#define TCP_KEEPCNT 6 -#define TCP_DEFER_ACCEPT 9 -#define TCP_CONGESTION 13 -#define TCP_FASTOPEN 23 - -#define TCP_ESTABLISHED 1 -#define TCP_SYN_SENT 2 -#define TCP_SYN_RECV 3 -#define TCP_FIN_WAIT1 4 -#define TCP_FIN_WAIT2 5 -#define TCP_TIME_WAIT 6 -#define TCP_CLOSE 7 -#define TCP_CLOSE_WAIT 8 -#define TCP_LAST_ACK 9 -#define TCP_LISTEN 10 -#define TCP_CLOSING 11 -#define TCP_QUICKACK 12 - -#define SOL_TCP 6 - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_TCP_H diff --git a/lib/mlibc/options/posix/include/netinet/udp.h b/lib/mlibc/options/posix/include/netinet/udp.h deleted file mode 100644 index 5cc887d..0000000 --- a/lib/mlibc/options/posix/include/netinet/udp.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _NETINET_UDP_H -#define _NETINET_UDP_H - -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct udphdr { - union { - struct { - uint16_t uh_sport; - uint16_t uh_dport; - uint16_t uh_ulen; - uint16_t uh_sum; - }; - struct { - uint16_t source; - uint16_t dest; - uint16_t len; - uint16_t check; - }; - }; -}; - -#ifdef __cplusplus -} -#endif - -#endif // _NETINET_UDP_H diff --git a/lib/mlibc/options/posix/include/nl_types.h b/lib/mlibc/options/posix/include/nl_types.h deleted file mode 100644 index f0099ba..0000000 --- a/lib/mlibc/options/posix/include/nl_types.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef NL_TYPES_H -#define NL_TYPES_H - - - -#endif // NL_TYPES_H
\ No newline at end of file diff --git a/lib/mlibc/options/posix/include/poll.h b/lib/mlibc/options/posix/include/poll.h deleted file mode 100644 index 7550015..0000000 --- a/lib/mlibc/options/posix/include/poll.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _POLL_H -#define _POLL_H - -#include <sys/poll.h> - -#endif // _POLL_H diff --git a/lib/mlibc/options/posix/include/pthread.h b/lib/mlibc/options/posix/include/pthread.h deleted file mode 100644 index 739f607..0000000 --- a/lib/mlibc/options/posix/include/pthread.h +++ /dev/null @@ -1,325 +0,0 @@ - -#ifndef _PTHREAD_H -#define _PTHREAD_H - -#include <abi-bits/clockid_t.h> -#include <bits/cpu_set.h> -// TODO: pthread is not required to define size_t. -#include <bits/size_t.h> -#include <bits/posix/pthread_t.h> -#include <bits/threads.h> -#include <mlibc-config.h> - -#include <signal.h> -#include <stdint.h> - -// pthread.h is required to include sched.h and time.h -#include <sched.h> -#include <time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define PTHREAD_CREATE_JOINABLE __MLIBC_THREAD_CREATE_JOINABLE -#define PTHREAD_CREATE_DETACHED __MLIBC_THREAD_CREATE_DETACHED - -// Values for pthread_attr_{get,set}scope -#define PTHREAD_SCOPE_SYSTEM 0 -#define PTHREAD_SCOPE_PROCESS 1 - -// Values for pthread_attr_{get,set}inheritsched -#define PTHREAD_INHERIT_SCHED 0 -#define PTHREAD_EXPLICIT_SCHED 1 - -// values for pthread_{get,set}canceltype(). -#define PTHREAD_CANCEL_DEFERRED 0 -#define PTHREAD_CANCEL_ASYNCHRONOUS 1 - -// values for pthread_{get,set}cancelstate(). -#define PTHREAD_CANCEL_ENABLE 0 -#define PTHREAD_CANCEL_DISABLE 1 - -// values for pthread_mutexattr_{get,set}type(). -#define PTHREAD_MUTEX_DEFAULT __MLIBC_THREAD_MUTEX_DEFAULT -#define PTHREAD_MUTEX_NORMAL __MLIBC_THREAD_MUTEX_NORMAL -#define PTHREAD_MUTEX_ERRORCHECK __MLIBC_THREAD_MUTEX_ERRORCHECK -#define PTHREAD_MUTEX_RECURSIVE __MLIBC_THREAD_MUTEX_RECURSIVE - -// values for pthread_mutexattr_{get,set}robust(). -#define PTHREAD_MUTEX_STALLED __MLIBC_THREAD_MUTEX_STALLED -#define PTHREAD_MUTEX_ROBUST __MLIBC_THREAD_MUTEX_ROBUST - -// values for pthread_mutexattr_{get,set}pshared(). -#define PTHREAD_PROCESS_PRIVATE __MLIBC_THREAD_PROCESS_PRIVATE -#define PTHREAD_PROCESS_SHARED __MLIBC_THREAD_PROCESS_SHARED - -// Values for pthread_mutexattr_{get,set}protocol() -#define PTHREAD_PRIO_NONE __MLIBC_THREAD_PRIO_NONE -#define PTHREAD_PRIO_INHERIT __MLIBC_THREAD_PRIO_INHERIT -#define PTHREAD_PRIO_PROTECT __MLIBC_THREAD_PRIO_PROTECT - -#define PTHREAD_ONCE_INIT {0} -#define PTHREAD_COND_INITIALIZER {0} -#define PTHREAD_MUTEX_INITIALIZER {0, 0, 0, 0} -#define PTHREAD_RWLOCK_INITIALIZER {0, 0, 0} - -#define PTHREAD_CANCELED ((void*) -1) - -#define PTHREAD_BARRIER_SERIAL_THREAD -1 - -// values for pthread_key -#define PTHREAD_DESTRUCTOR_ITERATIONS 8 - -#define PTHREAD_INHERIT_SCHED 0 -#define PTHREAD_EXPLICIT_SCHED 1 - -#define PTHREAD_STACK_MIN 16384 - -#define PTHREAD_ATTR_NO_SIGMASK_NP (-1) - -// TODO: move to own file and include in sys/types.h -typedef struct __mlibc_threadattr pthread_attr_t; - -typedef uintptr_t pthread_key_t; - -struct __mlibc_once { - unsigned int __mlibc_done; -}; -typedef struct __mlibc_once pthread_once_t; - -typedef struct __mlibc_mutexattr pthread_mutexattr_t; - -typedef struct __mlibc_mutex pthread_mutex_t; - -typedef struct __mlibc_condattr pthread_condattr_t; - -typedef struct __mlibc_cond pthread_cond_t; - -struct __mlibc_barrierattr_struct { - int __mlibc_pshared; -}; -typedef struct __mlibc_barrierattr_struct pthread_barrierattr_t; - -struct __mlibc_barrier { - unsigned int __mlibc_waiting; - unsigned int __mlibc_inside; - unsigned int __mlibc_count; - unsigned int __mlibc_seq; - unsigned int __mlibc_flags; -}; -typedef struct __mlibc_barrier pthread_barrier_t; - -struct __mlibc_fair_rwlock { - unsigned int __mlibc_m; // Mutex. - unsigned int __mlibc_rc; // Reader count (not reference count). - unsigned int __mlibc_flags; -}; -typedef struct __mlibc_fair_rwlock pthread_rwlock_t; - -struct __mlibc_rwlockattr { - int __mlibc_pshared; -}; -typedef struct __mlibc_rwlockattr pthread_rwlockattr_t; - -#ifndef __MLIBC_ABI_ONLY - -// ---------------------------------------------------------------------------- -// pthread_attr and pthread functions. -// ---------------------------------------------------------------------------- - -// pthread_attr functions. -int pthread_attr_init(pthread_attr_t *); -int pthread_attr_destroy(pthread_attr_t *); - -int pthread_attr_getdetachstate(const pthread_attr_t *, int *); -int pthread_attr_setdetachstate(pthread_attr_t *, int); - -int pthread_attr_getstacksize(const pthread_attr_t *__restrict, size_t *__restrict); -int pthread_attr_setstacksize(pthread_attr_t *, size_t); - -int pthread_attr_getstackaddr(const pthread_attr_t *, void **); -int pthread_attr_setstackaddr(pthread_attr_t *, void *); - -int pthread_attr_getstack(const pthread_attr_t *, void **, size_t*); -int pthread_attr_setstack(pthread_attr_t *, void *, size_t); - -int pthread_attr_getguardsize(const pthread_attr_t *__restrict, size_t *__restrict); -int pthread_attr_setguardsize(pthread_attr_t *, size_t); - -int pthread_attr_getscope(const pthread_attr_t *, int*); -int pthread_attr_setscope(pthread_attr_t *, int); - -int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict); -int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict); - -int pthread_attr_getschedpolicy(const pthread_attr_t *__restrict, int *__restrict); -int pthread_attr_setschedpolicy(pthread_attr_t *__restrict, int); - -int pthread_attr_getinheritsched(const pthread_attr_t *__restrict, int *__restrict); -int pthread_attr_setinheritsched(pthread_attr_t *__restrict, int); - -int pthread_attr_getschedparam(const pthread_attr_t *__restrict, struct sched_param *__restrict); -int pthread_attr_setschedparam(pthread_attr_t *__restrict, const struct sched_param *__restrict); - -#if __MLIBC_LINUX_OPTION -int pthread_attr_getaffinity_np(const pthread_attr_t *__restrict, size_t, cpu_set_t *__restrict); -int pthread_attr_setaffinity_np(pthread_attr_t *__restrict, size_t, const cpu_set_t *__restrict); - -int pthread_attr_getsigmask_np(const pthread_attr_t *__restrict, sigset_t *__restrict); -int pthread_attr_setsigmask_np(pthread_attr_t *__restrict, const sigset_t *__restrict); - -int pthread_getattr_np(pthread_t, pthread_attr_t *); - -int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, cpu_set_t *cpuset); -int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset); -#endif /* __MLIBC_LINUX_OPTION */ - -// pthread functions. -int pthread_create(pthread_t *__restrict, const pthread_attr_t *__restrict, - void *(*) (void *), void *__restrict); -pthread_t pthread_self(void); -int pthread_equal(pthread_t, pthread_t); -__attribute__ ((__noreturn__)) void pthread_exit(void *); - -int pthread_join(pthread_t, void **); -int pthread_detach(pthread_t); - -void pthread_cleanup_push(void (*) (void *), void *); -void pthread_cleanup_pop(int); - -int pthread_setname_np(pthread_t, const char *); -int pthread_getname_np(pthread_t, char *, size_t); - -int pthread_attr_setstack(pthread_attr_t *, void *, size_t); -int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *); - -int pthread_getattr_np(pthread_t, pthread_attr_t *); - -int pthread_setschedparam(pthread_t, int, const struct sched_param *); -int pthread_getschedparam(pthread_t, int *, struct sched_param *); - -int pthread_setcanceltype(int, int *); -int pthread_setcancelstate(int, int *); -void pthread_testcancel(void); -int pthread_cancel(pthread_t); - -int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); - -// ---------------------------------------------------------------------------- -// pthread_key functions. -// ---------------------------------------------------------------------------- - -int pthread_key_create(pthread_key_t *, void (*) (void *)); -int pthread_key_delete(pthread_key_t); - -void *pthread_getspecific(pthread_key_t); -int pthread_setspecific(pthread_key_t, const void *); - -// ---------------------------------------------------------------------------- -// pthread_once functions. -// ---------------------------------------------------------------------------- - -int pthread_once(pthread_once_t *, void (*) (void)); - -// ---------------------------------------------------------------------------- -// pthread_mutexattr and pthread_mutex functions. -// ---------------------------------------------------------------------------- - -// pthread_mutexattr functions -int pthread_mutexattr_init(pthread_mutexattr_t *); -int pthread_mutexattr_destroy(pthread_mutexattr_t *); - -int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict, int *__restrict); -int pthread_mutexattr_settype(pthread_mutexattr_t *, int); - -int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict, int *__restrict); -int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); - -int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *); -int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); - -int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict, int *__restrict); -int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); - -int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *); -int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); - -// pthread_mutex functions -int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict); -int pthread_mutex_destroy(pthread_mutex_t *); - -int pthread_mutex_lock(pthread_mutex_t *); -int pthread_mutex_trylock(pthread_mutex_t *); -int pthread_mutex_timedlock(pthread_mutex_t *__restrict, - const struct timespec *__restrict); -int pthread_mutex_unlock(pthread_mutex_t *); - -int pthread_mutex_consistent(pthread_mutex_t *); - -// ---------------------------------------------------------------------------- -// pthread_condattr and pthread_cond functions. -// ---------------------------------------------------------------------------- - -int pthread_condattr_init(pthread_condattr_t *); -int pthread_condattr_destroy(pthread_condattr_t *); - -int pthread_condattr_getclock(const pthread_condattr_t *__restrict, clockid_t *__restrict); -int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); - -int pthread_condattr_getpshared(const pthread_condattr_t *__restrict, int *__restrict); -int pthread_condattr_setpshared(pthread_condattr_t *, int); - -int pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict); -int pthread_cond_destroy(pthread_cond_t *); - -int pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict); -int pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, - const struct timespec *__restrict); -int pthread_cond_signal(pthread_cond_t *); -int pthread_cond_broadcast(pthread_cond_t *); - -// ---------------------------------------------------------------------------- -// pthread_barrierattr and pthread_barrier functions. -// ---------------------------------------------------------------------------- - -int pthread_barrierattr_init(pthread_barrierattr_t *); -int pthread_barrierattr_destroy(pthread_barrierattr_t *); -int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); -int pthread_barrierattr_getpshared(const pthread_barrierattr_t *__restrict, - int *__restrict); - -int pthread_barrier_init(pthread_barrier_t *__restrict, const pthread_barrierattr_t *__restrict, - unsigned int); -int pthread_barrier_destroy(pthread_barrier_t *); - -int pthread_barrier_wait(pthread_barrier_t *); - -// ---------------------------------------------------------------------------- -// pthread_wrlockattr and pthread_rwlock functions. -// ---------------------------------------------------------------------------- - -int pthread_rwlockattr_init(pthread_rwlockattr_t *); -int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); -int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *__restrict, - int *__restrict); - -int pthread_rwlock_init(pthread_rwlock_t *__restrict, const pthread_rwlockattr_t *__restrict); -int pthread_rwlock_destroy(pthread_rwlock_t *); -int pthread_rwlock_trywrlock(pthread_rwlock_t *); -int pthread_rwlock_wrlock(pthread_rwlock_t *); -int pthread_rwlock_tryrdlock(pthread_rwlock_t *); -int pthread_rwlock_rdlock(pthread_rwlock_t *); -int pthread_rwlock_unlock(pthread_rwlock_t *); - -int pthread_getcpuclockid(pthread_t, clockid_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _PTHREAD_H - diff --git a/lib/mlibc/options/posix/include/pwd.h b/lib/mlibc/options/posix/include/pwd.h deleted file mode 100644 index b885f57..0000000 --- a/lib/mlibc/options/posix/include/pwd.h +++ /dev/null @@ -1,45 +0,0 @@ - -#ifndef _PWD_H -#define _PWD_H - -#include <abi-bits/uid_t.h> -#include <abi-bits/gid_t.h> -#include <bits/size_t.h> -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct passwd { - char *pw_name; - char *pw_passwd; - uid_t pw_uid; - gid_t pw_gid; - char *pw_gecos; - char *pw_dir; - char *pw_shell; -}; - -#define NSS_BUFLEN_PASSWD 512 - -#ifndef __MLIBC_ABI_ONLY - -void endpwent(void); -struct passwd *getpwent(void); -struct passwd *getpwnam(const char *); -int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **); -struct passwd *getpwuid(uid_t); -int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); -void setpwent(void); -int putpwent(const struct passwd *, FILE *); -struct passwd *fgetpwent(FILE *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _PWD_H - diff --git a/lib/mlibc/options/posix/include/regex.h b/lib/mlibc/options/posix/include/regex.h deleted file mode 100644 index b7f0a46..0000000 --- a/lib/mlibc/options/posix/include/regex.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _REGEX_H -#define _REGEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> - -typedef ptrdiff_t regoff_t; - -typedef struct re_pattern_buffer { - size_t re_nsub; - void *__opaque, *__padding[4]; - size_t __nsub2; - char __padding2; -} regex_t; - -typedef struct { - regoff_t rm_so; - regoff_t rm_eo; -} regmatch_t; - -// Flags for regcomp(). -#define REG_EXTENDED 1 -#define REG_ICASE 2 -#define REG_NEWLINE 4 -#define REG_NOSUB 8 - -// Flags for regexec(). -#define REG_NOTBOL 1 -#define REG_NOTEOL 2 - -// Errors for regcomp() and regexec(). -#define REG_OK 0 -#define REG_NOMATCH 1 -#define REG_BADPAT 2 -#define REG_ECOLLATE 3 -#define REG_ECTYPE 4 -#define REG_EESCAPE 5 -#define REG_ESUBREG 6 -#define REG_EBRACK 7 -#define REG_EPAREN 8 -#define REG_EBRACE 9 -#define REG_BADBR 10 -#define REG_ERANGE 11 -#define REG_ESPACE 12 -#define REG_BADRPT 13 - -// Obsolete in POSIX. -#define REG_ENOSYS -1 - -#ifndef __MLIBC_ABI_ONLY - -int regcomp(regex_t *__restrict, const char *__restrict, int); -int regexec(const regex_t *__restrict, const char *__restrict, size_t, regmatch_t *__restrict, int); -size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t); -void regfree(regex_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/mlibc/options/posix/include/sched.h b/lib/mlibc/options/posix/include/sched.h deleted file mode 100644 index 739d91e..0000000 --- a/lib/mlibc/options/posix/include/sched.h +++ /dev/null @@ -1,49 +0,0 @@ - -#ifndef _SCHED_H -#define _SCHED_H - -#include <abi-bits/pid_t.h> -#include <bits/threads.h> -#include <bits/size_t.h> -#include <mlibc-config.h> - -// MISSING: time_t, struct timespec - -// MISSING: POSIX [PS], [SS] and [TSP] options - -#ifdef __cplusplus -extern "C" { -#endif - -#if __MLIBC_LINUX_OPTION -#include <bits/linux/linux_sched.h> -#include <bits/linux/cpu_set.h> -#endif - -#define SCHED_OTHER 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 -#define SCHED_BATCH 3 -#define SCHED_IDLE 5 -#define SCHED_DEADLINE 6 -#define SCHED_RESET_ON_FORK 0x40000000 - -#ifndef __MLIBC_ABI_ONLY - -int sched_yield(void); - -int sched_get_priority_max(int policy); -int sched_get_priority_min(int policy); - -int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); - -int sched_getparam(pid_t pid, struct sched_param *param); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SCHED_H - diff --git a/lib/mlibc/options/posix/include/search.h b/lib/mlibc/options/posix/include/search.h deleted file mode 100644 index 02e1913..0000000 --- a/lib/mlibc/options/posix/include/search.h +++ /dev/null @@ -1,37 +0,0 @@ - -#ifndef _SEARCH_H -#define _SEARCH_H - -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - preorder, - postorder, - endorder, - leaf -} VISIT; - -#ifndef __MLIBC_ABI_ONLY - -void *tsearch(const void *, void **, int(*compar)(const void *, const void *)); -void *tfind(const void *, void *const *, int (*compar)(const void *, const void *)); -void *tdelete(const void *, void **, int(*compar)(const void *, const void *)); -void twalk(const void *, void (*action)(const void *, VISIT, int)); -void tdestroy(void *, void (*free_node)(void *)); - -void *lsearch(const void *key, void *base, size_t *nelp, size_t width, - int (*compar)(const void *, const void *)); -void *lfind(const void *key, const void *base, size_t *nelp, - size_t width, int (*compar)(const void *, const void *)); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SEARCH_H diff --git a/lib/mlibc/options/posix/include/semaphore.h b/lib/mlibc/options/posix/include/semaphore.h deleted file mode 100644 index 877527f..0000000 --- a/lib/mlibc/options/posix/include/semaphore.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _SEMAPHORE_H -#define _SEMAPHORE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/ansi/time_t.h> -#include <bits/ansi/timespec.h> - -#define SEM_VALUE_MAX 0x7FFFFFFF -#define SEM_FAILED ((sem_t *) 0) - -typedef struct sem_ { - unsigned int __mlibc_count; -} sem_t; - -#ifndef __MLIBC_ABI_ONLY - -int sem_init(sem_t *sem, int pshared, unsigned int initial_count); -sem_t *sem_open(const char *, int, ...); -int sem_close(sem_t *sem); -int sem_unlink(const char *); -int sem_destroy(sem_t *sem); -int sem_wait(sem_t *sem); -int sem_trywait(sem_t *sem); -int sem_timedwait(sem_t *sem, const struct timespec *abstime); -int sem_post(sem_t *sem); -int sem_getvalue(sem_t *sem, int *sval); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif //_SEMAPHORE_H diff --git a/lib/mlibc/options/posix/include/spawn.h b/lib/mlibc/options/posix/include/spawn.h deleted file mode 100644 index 3ab2004..0000000 --- a/lib/mlibc/options/posix/include/spawn.h +++ /dev/null @@ -1,82 +0,0 @@ - -#ifndef _SPAWN_H -#define _SPAWN_H - -#include <abi-bits/signal.h> -#include <abi-bits/mode_t.h> -#include <abi-bits/pid_t.h> -#include <sched.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int __flags; - pid_t __pgrp; - sigset_t __def, __mask; - int __prio, __pol; - void *__fn; - char __pad[64 - sizeof(void *)]; -} posix_spawnattr_t; - -typedef struct { - int __pad0[2]; - void *__actions; - int __pad[16]; -} posix_spawn_file_actions_t; - -// MISSIG: sigset_t - -struct sched_param; - -#define POSIX_SPAWN_RESETIDS 1 -#define POSIX_SPAWN_SETPGROUP 2 -#define POSIX_SPAWN_SETSIGDEF 4 -#define POSIX_SPAWN_SETSIGMASK 8 -#define POSIX_SPAWN_SETSCHEDPARAM 16 -#define POSIX_SPAWN_SETSCHEDULER 32 -#define POSIX_SPAWN_USEVFORK 64 -#define POSIX_SPAWN_SETSID 128 - -#ifndef __MLIBC_ABI_ONLY - -int posix_spawn(pid_t *__restrict pid, const char *__restrict path, - const posix_spawn_file_actions_t *file_actions, - const posix_spawnattr_t *__restrict attrs, - char *const argv[], char *const envp[]); - -int posix_spawnattr_init(posix_spawnattr_t *attr); -int posix_spawnattr_destroy(posix_spawnattr_t *attr); -int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags); -int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict attr, - const sigset_t *__restrict sigdefault); -int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict attr, - const struct sched_param *__restrict schedparam); -int posix_spawnattr_setschedpolicy(posix_spawnattr_t *attr, int schedpolicy); -int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict attr, - const sigset_t *__restrict sigmask); -int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup); -int posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions); -int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions); -int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions, - int fildes, int newfildes); -int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions, - int fildes); -int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict file_actions, - int fildes, const char *__restrict path, int oflag, mode_t mode); -int posix_spawnp(pid_t *__restrict pid, const char *__restrict file, - const posix_spawn_file_actions_t *file_actions, - const posix_spawnattr_t *__restrict attrp, - char *const argv[], char *const envp[]); - -// MISSING: all other functions - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // SPAWN_H - diff --git a/lib/mlibc/options/posix/include/strings.h b/lib/mlibc/options/posix/include/strings.h deleted file mode 100644 index a21c3d7..0000000 --- a/lib/mlibc/options/posix/include/strings.h +++ /dev/null @@ -1,32 +0,0 @@ - -#ifndef _STRINGS_H -#define _STRINGS_H - -#include <bits/size_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -char *index (const char *s, int c); -char *rindex(const char *s, int c); - -int ffs(int word); -int strcasecmp(const char *a, const char *b); -int strncasecmp(const char *a, const char *b, size_t size); - -/* Marked as obsolete in posix 2008 but used by at least tracker */ -int bcmp(const void *s1, const void *s2, size_t n); -void bcopy(const void *s1, void *s2, size_t n); -void bzero(void *s, size_t n); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _STRINGS_H - diff --git a/lib/mlibc/options/posix/include/sys/file.h b/lib/mlibc/options/posix/include/sys/file.h deleted file mode 100644 index add43d3..0000000 --- a/lib/mlibc/options/posix/include/sys/file.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef _SYS_FILE_H -#define _SYS_FILE_H - -#define LOCK_SH 1 -#define LOCK_EX 2 -#define LOCK_NB 4 -#define LOCK_UN 8 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int flock(int, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_FILE_H - diff --git a/lib/mlibc/options/posix/include/sys/ipc.h b/lib/mlibc/options/posix/include/sys/ipc.h deleted file mode 100644 index 8318dde..0000000 --- a/lib/mlibc/options/posix/include/sys/ipc.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _SYS_IPC_H -#define _SYS_IPC_H - -#include <abi-bits/uid_t.h> -#include <abi-bits/gid_t.h> -#include <abi-bits/mode_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define IPC_CREAT 01000 -#define IPC_EXCL 02000 -#define IPC_NOWAIT 04000 - -#define IPC_RMID 0 -#define IPC_SET 1 -#define IPC_STAT 2 -#define IPC_INFO 3 - -#define IPC_PRIVATE ((key_t) 0) - -#if defined(__aarch64__) || defined(__i386__) -#define IPC_64 0x100 -#elif defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64) -#define IPC_64 0 -#else -#error "Unsupported arch!" -#endif - -typedef int key_t; - -struct ipc_perm { - key_t __ipc_perm_key; - uid_t uid; - gid_t gid; - uid_t cuid; - gid_t cgid; - mode_t mode; - int __ipc_perm_seq; -}; - -#ifndef __MLIBC_ABI_ONLY - -key_t ftok(const char *, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/mlibc/options/posix/include/sys/mman.h b/lib/mlibc/options/posix/include/sys/mman.h deleted file mode 100644 index 784878e..0000000 --- a/lib/mlibc/options/posix/include/sys/mman.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H - -#include <mlibc-config.h> -#include <abi-bits/mode_t.h> -#include <abi-bits/vm-flags.h> -#include <bits/off_t.h> -#include <bits/size_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -void *mmap(void *, size_t, int, int, int, off_t); -int mprotect(void *, size_t, int); -int munmap(void *, size_t); - -int mlock(const void *, size_t); -int mlockall(int); -int munlock(const void *, size_t); -int munlockall(void); - -int posix_madvise(void *, size_t, int); -int msync(void *, size_t, int); - -int shm_open(const char *, int, mode_t); -int shm_unlink(const char *); - -// Linux extension: -void *mremap(void *, size_t, size_t, int, ...); -int remap_file_pages(void *, size_t, int, size_t, int); - -#if __MLIBC_LINUX_OPTION -int memfd_create(const char *, unsigned int); -int madvise(void *, size_t, int); -int mincore(void *, size_t, unsigned char *); -#endif /* __MLIBC_LINUX_OPTION */ - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_MMAN_H diff --git a/lib/mlibc/options/posix/include/sys/msg.h b/lib/mlibc/options/posix/include/sys/msg.h deleted file mode 100644 index d602f76..0000000 --- a/lib/mlibc/options/posix/include/sys/msg.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _SYS_MSG_H -#define _SYS_MSG_H - -#include <abi-bits/msg.h> -#include <bits/size_t.h> -#include <bits/ssize_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int msgget(key_t, int); - -int msgctl(int msqid, int cmd, struct msqid_ds *buf); - -ssize_t msgrcv(int, void *, size_t, long, int); -int msgsnd(int, const void *, size_t, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_MSG_H diff --git a/lib/mlibc/options/posix/include/sys/param.h b/lib/mlibc/options/posix/include/sys/param.h deleted file mode 100644 index 9bb4552..0000000 --- a/lib/mlibc/options/posix/include/sys/param.h +++ /dev/null @@ -1,36 +0,0 @@ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H - -#include <endian.h> -#include <limits.h> - -#define NBBY CHAR_BIT -#define NGROUPS NGROUPS_MAX - -// Report the same value as Linux here. -#define MAXNAMLEN 255 -#define MAXPATHLEN 4096 -#define HOST_NAME_MAX 64 -#define MAXSYMLINKS 20 -#define MAXHOSTNAMELEN HOST_NAME_MAX - -#ifdef __cplusplus -extern "C" { -#endif - -#undef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#undef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - -#define howmany(x, y) (((x) + ((y) - 1)) / (y)) - -#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_PARAM_H - diff --git a/lib/mlibc/options/posix/include/sys/poll.h b/lib/mlibc/options/posix/include/sys/poll.h deleted file mode 100644 index 3edecab..0000000 --- a/lib/mlibc/options/posix/include/sys/poll.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _SYS_POLL_H -#define _SYS_POLL_H - -#include <bits/types.h> -#include <bits/sigset_t.h> -#include <bits/ansi/timespec.h> -#include <abi-bits/poll.h> -#include <abi-bits/signal.h> -#include <mlibc-config.h> - -typedef __mlibc_size nfds_t; - -#ifdef __cplusplus -extern "C" { -#endif - -struct pollfd { - int fd; - short events; - short revents; -}; - -#ifndef __MLIBC_ABI_ONLY - -int poll(struct pollfd *, nfds_t, int); - -#if __MLIBC_LINUX_OPTION -int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask); -#endif // __MLIBC_LINUX_OPTION - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_POLL_H diff --git a/lib/mlibc/options/posix/include/sys/resource.h b/lib/mlibc/options/posix/include/sys/resource.h deleted file mode 100644 index c5453e2..0000000 --- a/lib/mlibc/options/posix/include/sys/resource.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include <abi-bits/pid_t.h> -#include <abi-bits/resource.h> -#include <bits/posix/id_t.h> -#include <abi-bits/suseconds_t.h> -#include <bits/ansi/time_t.h> -#include <bits/posix/timeval.h> - -#define PRIO_PROCESS 1 -#define PRIO_PGRP 2 -#define PRIO_USER 3 - -#define PRIO_MIN (-20) -#define PRIO_MAX 20 - -#define RLIM_INFINITY ((rlim_t)-1) -#define RLIM_SAVED_MAX ((rlim_t)-1) -#define RLIM_SAVED_CUR ((rlim_t)-1) - -#define RLIM_NLIMITS RLIMIT_NLIMITS - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long rlim_t; - -struct rlimit { - rlim_t rlim_cur; - rlim_t rlim_max; -}; - -#ifndef __MLIBC_ABI_ONLY - -int getpriority(int, id_t); -int setpriority(int, id_t, int); - -int getrusage(int, struct rusage *); -int getrlimit(int, struct rlimit *); -int setrlimit(int, const struct rlimit *); - -int prlimit(pid_t pid, int resource, const struct rlimit *new_limits, struct rlimit *old_limits); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_RESOURCE_H diff --git a/lib/mlibc/options/posix/include/sys/select.h b/lib/mlibc/options/posix/include/sys/select.h deleted file mode 100644 index 85a15b0..0000000 --- a/lib/mlibc/options/posix/include/sys/select.h +++ /dev/null @@ -1,49 +0,0 @@ - -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H - -#include <abi-bits/signal.h> - -#include <bits/ansi/time_t.h> -#include <bits/ansi/timespec.h> -#include <abi-bits/suseconds_t.h> -#include <bits/posix/timeval.h> -#include <bits/posix/fd_set.h> - -#define FD_SETSIZE 1024 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef long int __fd_mask; -#define __NFDBITS (8 * (int) sizeof (__fd_mask)) - -typedef __fd_mask fd_mask; -#define NFDBITS __NFDBITS - -#ifndef __MLIBC_ABI_ONLY - -void __FD_CLR(int fd, fd_set *); -int __FD_ISSET(int fd, fd_set *); -void __FD_SET(int fd, fd_set *); -void __FD_ZERO(fd_set *); - -#define FD_CLR(fd, set) __FD_CLR(fd, set) -#define FD_ISSET(fd, set) __FD_ISSET(fd, set) -#define FD_SET(fd, set) __FD_SET(fd, set) -#define FD_ZERO(set) __FD_ZERO(set) - -int select(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, - struct timeval *__restrict); -int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, - const sigset_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_SELECT_H - diff --git a/lib/mlibc/options/posix/include/sys/sem.h b/lib/mlibc/options/posix/include/sys/sem.h deleted file mode 100644 index cb3516a..0000000 --- a/lib/mlibc/options/posix/include/sys/sem.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _SYS_SEM_H -#define _SYS_SEM_H - -#include <bits/ansi/time_t.h> -#include <sys/ipc.h> -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define GETALL 13 -#define SETVAL 16 -#define SETALL 17 - -#define SEM_UNDO 0x1000 - -struct sembuf { - unsigned short int sem_num; - short int sem_op; - short int sem_flg; -}; - -struct semid_ds { - struct ipc_perm sem_perm; - time_t sem_otime; - time_t sem_ctime; - - unsigned long sem_nsems; -}; - -#ifndef __MLIBC_ABI_ONLY - -int semget(key_t, int, int); -int semop(int, struct sembuf *, size_t); -int semctl(int, int, int, ...); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_SEM_H diff --git a/lib/mlibc/options/posix/include/sys/shm.h b/lib/mlibc/options/posix/include/sys/shm.h deleted file mode 100644 index 3767ced..0000000 --- a/lib/mlibc/options/posix/include/sys/shm.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _SYS_SHM_H -#define _SYS_SHM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <abi-bits/pid_t.h> -#include <abi-bits/shm.h> -#include <bits/size_t.h> -#include <time.h> - -#include <sys/ipc.h> - -#define SHM_R 0400 -#define SHM_W 0200 - -#define SHM_RDONLY 010000 -#define SHM_RND 020000 -#define SHM_REMAP 040000 -#define SHM_EXEC 0100000 - -#define SHM_LOCK 11 -#define SHM_UNLOCK 12 -#define SHM_STAT 13 -#define SHM_INFO 14 -#define SHM_STAT_ANY 15 -#define SHM_DEST 01000 -#define SHM_LOCKED 02000 -#define SHM_HUGETLB 04000 -#define SHM_NORESERVE 010000 - -#define SHM_HUGE_SHIFT 26 -#define SHM_HUGE_MASK 0x3f -#define SHM_HUGE_64KB (16 << 26) -#define SHM_HUGE_512KB (19 << 26) -#define SHM_HUGE_1MB (20 << 26) -#define SHM_HUGE_2MB (21 << 26) -#define SHM_HUGE_8MB (23 << 26) -#define SHM_HUGE_16MB (24 << 26) -#define SHM_HUGE_32MB (25 << 26) -#define SHM_HUGE_256MB (28 << 26) -#define SHM_HUGE_512MB (29 << 26) -#define SHM_HUGE_1GB (30 << 26) -#define SHM_HUGE_2GB (31 << 26) -#define SHM_HUGE_16GB (34U << 26) - -typedef unsigned long shmatt_t; - -struct shmid_ds { - struct ipc_perm shm_perm; - size_t shm_segsz; - time_t shm_atime; - time_t shm_dtime; - time_t shm_ctime; - pid_t shm_cpid; - pid_t shm_lpid; - unsigned long shm_nattch; -}; - -struct shminfo { - unsigned long shmmax; - unsigned long shmmin; - unsigned long shmmni; - unsigned long shmseg; - unsigned long shmall; - unsigned long __unused[4]; -}; - -#ifndef __MLIBC_ABI_ONLY - -void *shmat(int, const void *, int); -int shmctl(int, int, struct shmid_ds *); -int shmdt(const void *); -int shmget(key_t, size_t, int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_SHM_H diff --git a/lib/mlibc/options/posix/include/sys/socket.h b/lib/mlibc/options/posix/include/sys/socket.h deleted file mode 100644 index 9552f93..0000000 --- a/lib/mlibc/options/posix/include/sys/socket.h +++ /dev/null @@ -1,105 +0,0 @@ - -#ifndef _SOCKET_H -#define _SOCKET_H - -#include <abi-bits/gid_t.h> -#include <abi-bits/pid_t.h> -#include <bits/size_t.h> -#include <abi-bits/socklen_t.h> -#include <bits/ssize_t.h> -#include <abi-bits/uid_t.h> -#include <bits/posix/iovec.h> -#include <abi-bits/socket.h> -#include <bits/ansi/time_t.h> -#include <bits/ansi/timespec.h> - -#include <stddef.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct sockaddr { - sa_family_t sa_family; - char sa_data[14]; -}; - -// Control message format: -// The offsets marked with ^ are aligned to alignof(size_t). -// -// |---HEADER---|---DATA---|---PADDING---|---HEADER---|... -// ^ ^ ^ -// |---------CMSG_LEN------| -// |---------------CMSG_SPACE------------| - -// Auxiliary macro. While there is basically no reason for applications -// to use this, it is exported by glibc. -#define CMSG_ALIGN(s) (((s) + __alignof__(size_t) - 1) & \ - ~(__alignof__(size_t) - 1)) - -// Basic macros to return content and padding size of a control message. -#define CMSG_LEN(s) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (s)) -#define CMSG_SPACE(s) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(s)) - -// Provides access to the data of a control message. -#define CMSG_DATA(c) ((char *)(c) + CMSG_ALIGN(sizeof(struct cmsghdr))) - -#define __MLIBC_CMSG_NEXT(c) ((char *)(c) + CMSG_ALIGN((c)->cmsg_len)) -#define __MLIBC_MHDR_LIMIT(m) ((char *)(m)->msg_control + (m)->msg_controllen) - -// For parsing control messages only. -// Returns a pointer to the first header or nullptr if there is none. -#define CMSG_FIRSTHDR(m) ((size_t)(m)->msg_controllen <= sizeof(struct cmsghdr) \ - ? (struct cmsghdr *)0 : (struct cmsghdr *) (m)->msg_control) - -// For parsing control messages only. -// Returns a pointer to the next header or nullptr if there is none. -#define CMSG_NXTHDR(m, c) \ - ((c)->cmsg_len < sizeof(struct cmsghdr) || \ - (ptrdiff_t)(sizeof(struct cmsghdr) + CMSG_ALIGN((c)->cmsg_len)) \ - >= __MLIBC_MHDR_LIMIT(m) - (char *)(c) \ - ? (struct cmsghdr *)0 : (struct cmsghdr *)__MLIBC_CMSG_NEXT(c)) - -struct linger{ - int l_onoff; - int l_linger; -}; - -struct ucred { - pid_t pid; - uid_t uid; - gid_t gid; -}; - -#ifndef __MLIBC_ABI_ONLY - -int accept(int, struct sockaddr *__restrict, socklen_t *__restrict); -int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int); -int bind(int, const struct sockaddr *, socklen_t); -int connect(int, const struct sockaddr *, socklen_t); -int getpeername(int, struct sockaddr *__restrict, socklen_t *__restrict); -int getsockname(int, struct sockaddr *__restrict, socklen_t *__restrict); -int getsockopt(int, int, int, void *__restrict, socklen_t *__restrict); -int listen(int, int); -ssize_t recv(int, void *, size_t, int); -ssize_t recvfrom(int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict); -ssize_t recvmsg(int, struct msghdr *, int); -ssize_t send(int, const void *, size_t, int); -ssize_t sendmsg(int, const struct msghdr *, int); -ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); -int recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, struct timespec *timeout); -int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, int flags); -int setsockopt(int, int, int, const void *, socklen_t); -int shutdown(int, int); -int sockatmark(int); -int socket(int, int, int); -int socketpair(int, int, int, int [2]); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _UNISTD_H - diff --git a/lib/mlibc/options/posix/include/sys/stat.h b/lib/mlibc/options/posix/include/sys/stat.h deleted file mode 100644 index 7159a77..0000000 --- a/lib/mlibc/options/posix/include/sys/stat.h +++ /dev/null @@ -1,37 +0,0 @@ - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include <bits/posix/stat.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int chmod(const char *, mode_t); -int fchmod(int, mode_t); -int fchmodat(int, const char *, mode_t, int); -int fstat(int fd, struct stat *result); -int fstatat(int, const char *__restrict, struct stat *__restrict, int); -int futimens(int fd, const struct timespec times[2]); -int lstat(const char *__restrict, struct stat *__restrict); -int mkdir(const char *, mode_t); -int mkdirat(int, const char *, mode_t); -int mkfifo(const char *, mode_t); -int mkfifoat(int, const char *, mode_t); -int mknod(const char *, mode_t, dev_t); -int mknodat(int, const char *, mode_t, dev_t); -int stat(const char *__restrict, struct stat *__restrict); -mode_t umask(mode_t); -int utimensat(int, const char *, const struct timespec times[2], int); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_STAT_H - diff --git a/lib/mlibc/options/posix/include/sys/statvfs.h b/lib/mlibc/options/posix/include/sys/statvfs.h deleted file mode 100644 index 0e4c308..0000000 --- a/lib/mlibc/options/posix/include/sys/statvfs.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _SYS_STATVFS_H -#define _SYS_STATVFS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <abi-bits/statvfs.h> - -#ifndef __MLIBC_ABI_ONLY - -int statvfs(const char *__restrict, struct statvfs *__restrict); -int fstatvfs(int, struct statvfs *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_STATVFS_H - diff --git a/lib/mlibc/options/posix/include/sys/syslog.h b/lib/mlibc/options/posix/include/sys/syslog.h deleted file mode 100644 index 7761ece..0000000 --- a/lib/mlibc/options/posix/include/sys/syslog.h +++ /dev/null @@ -1 +0,0 @@ -#include <syslog.h> diff --git a/lib/mlibc/options/posix/include/sys/termios.h b/lib/mlibc/options/posix/include/sys/termios.h deleted file mode 100644 index b23f171..0000000 --- a/lib/mlibc/options/posix/include/sys/termios.h +++ /dev/null @@ -1,6 +0,0 @@ - -#ifndef _SYS_TERMIOS_H -#define _SYS_TERMIOS_H -#include <termios.h> -#endif // _SYS_TERMIOS_H - diff --git a/lib/mlibc/options/posix/include/sys/time.h b/lib/mlibc/options/posix/include/sys/time.h deleted file mode 100644 index 838d7cc..0000000 --- a/lib/mlibc/options/posix/include/sys/time.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _SYS_TIME_H -#define _SYS_TIME_H - -#include <abi-bits/time.h> -#include <abi-bits/signal.h> -#include <abi-bits/clockid_t.h> -#include <bits/ansi/time_t.h> -#include <abi-bits/suseconds_t.h> -#include <bits/posix/timer_t.h> -#include <bits/posix/timeval.h> - -#include <sys/select.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -#ifndef __MLIBC_ABI_ONLY - -// TODO: this function is [OB]. disable it by default and add a macro to enable it -int gettimeofday(struct timeval *__restrict result, void *__restrict unused); -int settimeofday(const struct timeval *result, const struct timezone *zone); - -void timeradd(const struct timeval *a, const struct timeval *b, struct timeval *res); -void timersub(const struct timeval *a, const struct timeval *b, struct timeval *res); -void timerclear(struct timeval *tvp); -int timerisset(struct timeval *tvp); - -#endif /* !__MLIBC_ABI_ONLY */ - -// timercmp taken from musl -#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \ - (s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec) - -#ifndef __MLIBC_ABI_ONLY - -int getitimer(int which, struct itimerval *curr_value); -int setitimer(int which, const struct itimerval *new_value, - struct itimerval *old_value); - -int timer_create(clockid_t clockid, struct sigevent *__restrict sevp, timer_t *__restrict timerid); -int timer_settime(timer_t timerid, int flags, const struct itimerspec *__restrict new_value, - struct itimerspec *__restrict old_value); -int timer_gettime(timer_t timerid, struct itimerspec *curr_value); -int timer_delete(timer_t timerid); - -#endif /* !__MLIBC_ABI_ONLY */ - -// The following 2 macros are taken from musl -#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \ - (ts)->tv_sec = (tv)->tv_sec, \ - (ts)->tv_nsec = (tv)->tv_usec * 1000, \ - (void)0 ) -#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \ - (tv)->tv_sec = (ts)->tv_sec, \ - (tv)->tv_usec = (ts)->tv_nsec / 1000, \ - (void)0 ) - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_TIME_H diff --git a/lib/mlibc/options/posix/include/sys/times.h b/lib/mlibc/options/posix/include/sys/times.h deleted file mode 100644 index 2dd2889..0000000 --- a/lib/mlibc/options/posix/include/sys/times.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H - -// TODO: Only define the clock_t type. -#include <time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct tms { - clock_t tms_utime; - clock_t tms_stime; - clock_t tms_cutime; - clock_t tms_cstime; -}; - -#ifndef __MLIBC_ABI_ONLY - -clock_t times(struct tms *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_TIMES_H diff --git a/lib/mlibc/options/posix/include/sys/ttydefaults.h b/lib/mlibc/options/posix/include/sys/ttydefaults.h deleted file mode 100644 index c6d04f6..0000000 --- a/lib/mlibc/options/posix/include/sys/ttydefaults.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef _SYS_TTYDEFAULTS_H -#define _SYS_TTYDEFAULTS_H - -// Values taken from musl - -#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) -#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) -#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) -#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) -#define TTYDEF_SPEED (B9600) - -#define CTRL(x) ((x) & 037) -#define CEOF CTRL('d') - -#define CEOL '\0' -#define CEOL2 '\0' -#define CSTATUS '\0' - -#define CERASE 0177 -#define CINTR CTRL('c') -#define CKILL CTRL('u') -#define CMIN 1 -#define CQUIT 034 -#define CSUSP CTRL('z') -#define CTIME 0 -#define CDSUSP CTRL('y') -#define CSTART CTRL('q') -#define CSTOP CTRL('s') -#define CLNEXT CTRL('v') -#define CDISCARD CTRL('o') -#define CWERASE CTRL('w') -#define CREPRINT CTRL('r') -#define CEOT CEOF -#define CBRK CEOL -#define CRPRNT CREPRINT -#define CFLUSH CDISCARD - -#endif // _SYS_TTYDEFAULTS_H diff --git a/lib/mlibc/options/posix/include/sys/types.h b/lib/mlibc/options/posix/include/sys/types.h deleted file mode 100644 index ad837fc..0000000 --- a/lib/mlibc/options/posix/include/sys/types.h +++ /dev/null @@ -1,53 +0,0 @@ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -#include <bits/size_t.h> -#include <bits/ssize_t.h> -#include <bits/off_t.h> - -#include <bits/posix/id_t.h> -#include <abi-bits/uid_t.h> -#include <abi-bits/gid_t.h> -#include <abi-bits/pid_t.h> - -#include <abi-bits/mode_t.h> -#include <abi-bits/dev_t.h> -#include <abi-bits/ino_t.h> -#include <abi-bits/blksize_t.h> -#include <abi-bits/blkcnt_t.h> -#include <abi-bits/nlink_t.h> - -#include <bits/ansi/time_t.h> -#include <abi-bits/suseconds_t.h> - -#include <abi-bits/fsblkcnt_t.h> -#include <abi-bits/fsfilcnt_t.h> -#include <bits/posix/fd_set.h> - -#include <stdint.h> - -#include <sys/select.h> - -typedef unsigned int u_int; -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned long int u_long; -typedef char *caddr_t; -typedef off64_t loff_t; - -typedef unsigned long int ulong; -typedef unsigned short int ushort; -typedef unsigned int uint; - -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; - -// BSD extensions -typedef int64_t quad_t; -typedef uint64_t u_quad_t; - -#endif // _SYS_TYPES_H - diff --git a/lib/mlibc/options/posix/include/sys/uio.h b/lib/mlibc/options/posix/include/sys/uio.h deleted file mode 100644 index 04679a6..0000000 --- a/lib/mlibc/options/posix/include/sys/uio.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _SYS_UIO_H -#define _SYS_UIO_H - -#include <bits/posix/iovec.h> -#include <bits/ssize_t.h> -#include <bits/off_t.h> -#include <bits/size_t.h> -#include <limits.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define UIO_MAXIOV IOV_MAX - -#ifndef __MLIBC_ABI_ONLY - -ssize_t readv(int fd, const struct iovec *iov, int iovcnt); -ssize_t writev(int fd, const struct iovec *iov, int iovcnt); - -// Non standard extensions, also found on modern BSD's -ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset); -ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_UIO_H diff --git a/lib/mlibc/options/posix/include/sys/un.h b/lib/mlibc/options/posix/include/sys/un.h deleted file mode 100644 index bb9b5ad..0000000 --- a/lib/mlibc/options/posix/include/sys/un.h +++ /dev/null @@ -1,24 +0,0 @@ - -#ifndef _SYS_UN_H -#define _SYS_UN_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <abi-bits/socket.h> - -struct sockaddr_un { - sa_family_t sun_family; - char sun_path[108]; -}; - -// Evaluate to actual length of the `sockaddr_un' structure. -#define SUN_LEN(ptr) ((size_t) offsetof(struct sockaddr_un, sun_path) + strlen((ptr)->sun_path)) - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_UN_H - diff --git a/lib/mlibc/options/posix/include/sys/utsname.h b/lib/mlibc/options/posix/include/sys/utsname.h deleted file mode 100644 index bd7b174..0000000 --- a/lib/mlibc/options/posix/include/sys/utsname.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#include <abi-bits/utsname.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __MLIBC_ABI_ONLY - -int uname(struct utsname *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_UTSNAME_H - diff --git a/lib/mlibc/options/posix/include/sys/wait.h b/lib/mlibc/options/posix/include/sys/wait.h deleted file mode 100644 index 5081041..0000000 --- a/lib/mlibc/options/posix/include/sys/wait.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include <bits/posix/id_t.h> -#include <abi-bits/pid_t.h> -// for siginfo_t -#include <abi-bits/signal.h> -#include <abi-bits/wait.h> - -#ifdef __cplusplus -extern "C" { -#endif - -// According to POSIX, <sys/wait.h> does not make rusage available. -struct rusage; - -// TODO: move to own file and include in sys/types.h -typedef enum { - P_ALL, P_PID, P_PGID -} idtype_t; - -#ifndef __MLIBC_ABI_ONLY - -pid_t wait(int *status); -int waitid(idtype_t idtype, id_t id, siginfo_t *siginfo, int flags); -pid_t waitpid(pid_t pid, int *status, int flags); - -// GNU extensions. -pid_t wait3(int *, int, struct rusage *); -pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYS_WAIT_H - diff --git a/lib/mlibc/options/posix/include/syslog.h b/lib/mlibc/options/posix/include/syslog.h deleted file mode 100644 index 6c258cf..0000000 --- a/lib/mlibc/options/posix/include/syslog.h +++ /dev/null @@ -1,75 +0,0 @@ - -#ifndef _SYSLOG_H -#define _SYSLOG_H - -#include <stdarg.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define LOG_PID 0x01 -#define LOG_CONS 0x02 -#define LOG_NDELAY 0x08 -#define LOG_ODELAY 0x04 -#define LOG_NOWAIT 0x10 -#define LOG_PERROR 0x20 - -#define LOG_KERN (0<<3) -#define LOG_USER (1<<3) -#define LOG_MAIL (2<<3) -#define LOG_DAEMON (3<<3) -#define LOG_AUTH (4<<3) -#define LOG_SYSLOG (5<<3) -#define LOG_LPR (6<<3) -#define LOG_NEWS (7<<3) -#define LOG_UUCP (8<<3) -#define LOG_CRON (9<<3) -#define LOG_AUTHPRIV (10<<3) -#define LOG_FTP (11<<3) - -#define LOG_LOCAL0 (16<<3) -#define LOG_LOCAL1 (17<<3) -#define LOG_LOCAL2 (18<<3) -#define LOG_LOCAL3 (19<<3) -#define LOG_LOCAL4 (20<<3) -#define LOG_LOCAL5 (21<<3) -#define LOG_LOCAL6 (22<<3) -#define LOG_LOCAL7 (23<<3) - -#define LOG_PRIMASK 7 -#define LOG_PRI(p) ((p)&LOG_PRIMASK) -#define LOG_MAKEPRI(f, p) (((f)<<3) | (p)) -#define LOG_MASK(p) (1<<(p)) -#define LOG_UPTO(p) ((1<<((p)+1))-1) -#define LOG_NFACILITIES 24 -#define LOG_FACMASK (0x7F<<3) -#define LOG_FAC(p) (((p)&LOG_FACMASK)>>3) - -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#ifndef __MLIBC_ABI_ONLY - -void closelog(void); -void openlog(const char *, int, int); -int setlogmask(int); -void syslog(int, const char *, ...); - -// This is a linux extension -void vsyslog(int, const char *, va_list); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _SYSLOG_H - diff --git a/lib/mlibc/options/posix/include/termios.h b/lib/mlibc/options/posix/include/termios.h deleted file mode 100644 index a5a6a2f..0000000 --- a/lib/mlibc/options/posix/include/termios.h +++ /dev/null @@ -1,100 +0,0 @@ - -#ifndef _TERMIOS_H -#define _TERMIOS_H - -#include <abi-bits/pid_t.h> -#include <abi-bits/termios.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/winsize.h> - -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) -#include <sys/ttydefaults.h> -#endif - -// baud rate constants for speed_t -#define B0 0 -#define B50 1 -#define B75 2 -#define B110 3 -#define B134 4 -#define B150 5 -#define B200 6 -#define B300 7 -#define B600 8 -#define B1200 9 -#define B1800 10 -#define B2400 11 -#define B4800 12 -#define B9600 13 -#define B19200 14 -#define B38400 15 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 - -// constants for tcsetattr() -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -// constants for tcflush() -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -// constants for tcflow() -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 - -#ifndef __MLIBC_ABI_ONLY - -speed_t cfgetispeed(const struct termios *); -speed_t cfgetospeed(const struct termios *); -int cfsetispeed(struct termios *, speed_t); -int cfsetospeed(struct termios *, speed_t); -void cfmakeraw(struct termios *); -int tcdrain(int); -int tcflow(int, int); -int tcflush(int, int); -int tcgetattr(int fd, struct termios *attr); -pid_t tcgetsid(int); -int tcsendbreak(int, int); -int tcsetattr(int, int, const struct termios *); - -#endif /* !__MLIBC_ABI_ONLY */ - -// This is a linux extension - -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCGSID 0x5429 - -#ifdef __cplusplus -} -#endif - -#endif // _TERMIOS_H - diff --git a/lib/mlibc/options/posix/include/ucontext.h b/lib/mlibc/options/posix/include/ucontext.h deleted file mode 100644 index c50b0b1..0000000 --- a/lib/mlibc/options/posix/include/ucontext.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _UCONTEXT_H -#define _UCONTEXT_H - -#include <signal.h> - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#ifndef __MLIBC_ABI_ONLY - -int getcontext(ucontext_t *); -int setcontext(const ucontext_t *); -void makecontext(ucontext_t *, void (*)(void), int, ...); -int swapcontext(ucontext_t *, const ucontext_t *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // _UCONTEXT_H diff --git a/lib/mlibc/options/posix/include/unistd.h b/lib/mlibc/options/posix/include/unistd.h deleted file mode 100644 index d29257d..0000000 --- a/lib/mlibc/options/posix/include/unistd.h +++ /dev/null @@ -1,360 +0,0 @@ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include <mlibc-config.h> -#include <bits/types.h> -#include <bits/size_t.h> -#include <bits/ssize_t.h> -#include <bits/off_t.h> -#include <bits/types.h> -#include <abi-bits/access.h> -#include <abi-bits/uid_t.h> -#include <abi-bits/gid_t.h> -#include <abi-bits/pid_t.h> -#include <abi-bits/seek-whence.h> - -#if __MLIBC_SYSDEP_HAS_BITS_SYSCALL_H && __MLIBC_LINUX_OPTION -#include <bits/syscall.h> -#endif /* __MLIBC_SYSDEP_HAS_BITS_SYSCALL_H && __MLIBC_LINUX_OPTION */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define _POSIX_VERSION 200809L -#define _POSIX2_VERSION _POSIX_VERSION -#define _XOPEN_VERSION 700 - -#define _POSIX_FSYNC _POSIX_VERSION -#define _POSIX_IPV6 _POSIX_VERSION -#define _POSIX_JOB_CONTROL 1 -#define _POSIX_SAVED_IDS 1 -#define _POSIX_SHELL 1 -#define _POSIX_SPAWN _POSIX_VERSION -#define _POSIX_THREADS _POSIX_VERSION -#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION -#define _POSIX_MONOTONIC_CLOCK 0 - -#if __MLIBC_CRYPT_OPTION -#define _XOPEN_CRYPT 1 -#endif - -// MISSING: additional _POSIX and _XOPEN feature macros -// MISSING: _POSIX_TIMESTAMP_RESOLUTION and _POSIX2_SYMLINKS - -#define _CS_PATH 0 -#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 -#define _CS_GNU_LIBC_VERSION 2 -#define _CS_GNU_LIBPTHREAD_VERSION 3 -#define _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS 4 -#define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS 5 - -#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 1116 -#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 1117 -#define _CS_POSIX_V6_ILP32_OFF32_LIBS 1118 -#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS 1119 -#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 1120 -#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 1121 -#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 1122 -#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS 1123 -#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 1124 -#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 1125 -#define _CS_POSIX_V6_LP64_OFF64_LIBS 1126 -#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS 1127 -#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 1128 -#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 1129 -#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 1130 -#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS 1131 -#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1132 -#define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS 1133 -#define _CS_POSIX_V7_ILP32_OFF32_LIBS 1134 -#define _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS 1135 -#define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS 1136 -#define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS 1137 -#define _CS_POSIX_V7_ILP32_OFFBIG_LIBS 1138 -#define _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS 1139 -#define _CS_POSIX_V7_LP64_OFF64_CFLAGS 1140 -#define _CS_POSIX_V7_LP64_OFF64_LDFLAGS 1141 -#define _CS_POSIX_V7_LP64_OFF64_LIBS 1142 -#define _CS_POSIX_V7_LP64_OFF64_LINTFLAGS 1143 -#define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS 1144 -#define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS 1145 -#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS 1146 -#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 -#define _CS_V6_ENV 1148 -#define _CS_V7_ENV 1149 - -// MISSING: SEEK macros from stdio.h - -#define F_LOCK 1 -#define F_TEST 2 -#define F_TLOCK 3 -#define F_ULOCK 4 - -// MISSING: _PC macros -// For now, use the Linux ABI for _PC constants. -#define _PC_LINK_MAX 0 -#define _PC_MAX_CANON 1 -#define _PC_MAX_INPUT 2 -#define _PC_NAME_MAX 3 -#define _PC_PATH_MAX 4 -#define _PC_PIPE_BUF 5 -#define _PC_CHOWN_RESTRICTED 6 -#define _PC_NO_TRUNC 7 -#define _PC_VDISABLE 8 - -#define _PC_FILESIZEBITS 9 -#define _PC_SYMLINK_MAX 10 - -// MISSING: remaining _SC_macros -#define _SC_ARG_MAX 0 -#define _SC_GETPW_R_SIZE_MAX 1 -#define _SC_PHYS_PAGES 2 -#define _SC_PAGE_SIZE 3 -#define _SC_PAGESIZE _SC_PAGE_SIZE -#define _SC_OPEN_MAX 5 -#define _SC_NPROCESSORS_ONLN 6 -#define _SC_GETGR_R_SIZE_MAX 7 - -#define _SC_CHILD_MAX 8 -#define _SC_CLK_TCK 9 -#define _SC_NGROUPS_MAX 10 -#define _SC_VERSION 11 -#define _SC_SAVED_IDS 12 -#define _SC_JOB_CONTROL 13 -#define _SC_HOST_NAME_MAX 14 -#define _SC_LINE_MAX 15 -#define _SC_XOPEN_CRYPT 16 -#define _SC_NPROCESSORS_CONF 17 -#define _SC_SYMLOOP_MAX 18 -#define _SC_TTY_NAME_MAX 19 -#define _SC_RE_DUP_MAX 20 - -#define _SC_ATEXIT_MAX 21 -#define _SC_LOGIN_NAME_MAX 22 -#define _SC_THREAD_DESTRUCTOR_ITERATIONS 23 -#define _SC_THREAD_KEYS_MAX 24 -#define _SC_THREAD_STACK_MIN 25 -#define _SC_THREAD_THREADS_MAX 26 -#define _SC_TZNAME_MAX 27 -#define _SC_ASYNCHRONOUS_IO 28 -#define _SC_FSYNC 29 -#define _SC_MAPPED_FILES 30 -#define _SC_MEMLOCK 31 -#define _SC_MEMLOCK_RANGE 32 -#define _SC_MEMORY_PROTECTION 33 -#define _SC_MESSAGE_PASSING 34 -#define _SC_PRIORITY_SCHEDULING 35 -#define _SC_REALTIME_SIGNALS 36 -#define _SC_SEMAPHORES 37 -#define _SC_SHARED_MEMORY_OBJECTS 38 -#define _SC_SYNCHRONIZED_IO 39 -#define _SC_THREADS 40 -#define _SC_THREAD_ATTR_STACKADDR 41 -#define _SC_THREAD_ATTR_STACKSIZE 42 -#define _SC_THREAD_PRIORITY_SCHEDULING 43 -#define _SC_THREAD_PRIO_INHERIT 44 -#define _SC_THREAD_PRIO_PROTECT 45 -#define _SC_THREAD_PROCESS_SHARED 46 -#define _SC_THREAD_SAFE_FUNCTIONS 47 -#define _SC_TIMERS 48 -#define _SC_TIMER_MAX 49 -#define _SC_2_CHAR_TERM 50 -#define _SC_2_C_BIND 51 -#define _SC_2_C_DEV 52 -#define _SC_2_FORT_DEV 53 -#define _SC_2_FORT_RUN 54 -#define _SC_2_LOCALEDEF 55 -#define _SC_2_SW_DEV 56 -#define _SC_2_UPE 57 -#define _SC_2_VERSION 58 -#define _SC_CLOCK_SELECTION 59 -#define _SC_CPUTIME 60 -#define _SC_THREAD_CPUTIME 61 -#define _SC_MONOTONIC_CLOCK 62 -#define _SC_READER_WRITER_LOCKS 63 -#define _SC_SPIN_LOCKS 64 -#define _SC_REGEXP 65 -#define _SC_SHELL 66 -#define _SC_SPAWN 67 -#define _SC_2_PBS 68 -#define _SC_2_PBS_ACCOUNTING 69 -#define _SC_2_PBS_LOCATE 70 -#define _SC_2_PBS_TRACK 71 -#define _SC_2_PBS_MESSAGE 72 -#define _SC_STREAM_MAX 73 -#define _SC_AIO_LISTIO_MAX 74 -#define _SC_AIO_MAX 75 -#define _SC_DELAYTIMER_MAX 76 -#define _SC_MQ_OPEN_MAX 77 -#define _SC_MQ_PRIO_MAX 78 -#define _SC_RTSIG_MAX 79 -#define _SC_SIGQUEUE_MAX 80 -#define _SC_IOV_MAX 81 - -#define STDERR_FILENO 2 -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 - -#define _POSIX_VDISABLE '\0' - -#define L_ctermid 20 - -#ifndef intptr_t -typedef __mlibc_intptr intptr_t; -#endif - -#ifndef __MLIBC_ABI_ONLY - -int access(const char *path, int mode); -unsigned int alarm(unsigned int seconds); -int chdir(const char *path); -int chown(const char *path, uid_t uid, gid_t gid); -int close(int fd); -ssize_t confstr(int, char *, size_t); -char *ctermid(char *s); -int dup(int fd); -int dup2(int src_fd, int dest_fd); -__attribute__((__noreturn__)) void _exit(int status); -void endusershell(void); -int execl(const char *, const char *, ...); -int execle(const char *, const char *, ...); -int execlp(const char *, const char *, ...); -int execv(const char *, char *const []); -int execve(const char *path, char *const argv[], char *const envp[]); -int execvp(const char *, char *const[]); -int execvpe(const char *path, char *const argv[], char *const envp[]); -int faccessat(int, const char *, int, int); -int fchdir(int fd); -int fchown(int fd, uid_t uid, gid_t gid); -int fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flags); -int fdatasync(int); -int fexecve(int, char *const [], char *const []); -pid_t fork(void); -pid_t vfork(void); -long fpathconf(int, int); -int fsync(int); -int ftruncate(int, off_t); -char *getcwd(char *, size_t); -gid_t getegid(void); -uid_t geteuid(void); -gid_t getgid(void); -int getgroups(int, gid_t []); -long gethostid(void); -int gethostname(char *buffer, size_t max_length); -int sethostname(const char *buffer, size_t max_length); -char *getlogin(void); -int getlogin_r(char *, size_t); -int getopt(int, char *const [], const char *); -char *getpass(const char *); -pid_t getpgid(pid_t); -pid_t getpgrp(void); -pid_t getpid(void); -pid_t getppid(void); -pid_t getsid(pid_t); -uid_t getuid(void); -char *getusershell(void); -int isatty(int fd); -int lchown(const char *path, uid_t uid, gid_t gid); -int link(const char *, const char *); -int linkat(int, const char *, int, const char *, int); -int lockf(int, int, off_t); -off_t lseek(int fd, off_t offset, int whence); -off64_t lseek64(int fd, off64_t offset, int whence); -int nice(int); -long pathconf(const char *, int); -int pause(void); -int pipe(int [2]); -ssize_t pread(int, void *, size_t, off_t); -ssize_t pwrite(int, const void *, size_t, off_t); -ssize_t read(int fd, void *buffer, size_t size); -ssize_t readlink(const char *__restrict, char *__restrict, size_t); -ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t); -int rmdir(const char *); -int setegid(gid_t); -int seteuid(uid_t); -int setgid(gid_t); -int setpgid(pid_t, pid_t); -pid_t setpgrp(void); -int setregid(gid_t, gid_t); -int setreuid(uid_t, uid_t); -pid_t setsid(void); -int setuid(uid_t); -void setusershell(void); -unsigned int sleep(unsigned int); -void swab(const void *__restrict, void *__restrict, ssize_t); -int symlink(const char *, const char *); -int symlinkat(const char *, int, const char *); -void sync(void); -long sysconf(int); -pid_t tcgetpgrp(int); -int tcsetpgrp(int, pid_t); -int truncate(const char *, off_t); -char *ttyname(int); -int ttyname_r(int, char *, size_t); -int unlink(const char *); -int unlinkat(int, const char *, int); -ssize_t write(int fd, const void *buffer, size_t size); - -extern char **environ; -extern char *optarg; -extern int optind; -extern int opterr; -extern int optopt; - -#endif /* !__MLIBC_ABI_ONLY */ - -// Non-POSIX functions supported by Linux. -#if UINTPTR_MAX == UINT64_MAX -typedef __mlibc_uint64 useconds_t; -#else -typedef __mlibc_uint32 useconds_t; -#endif - -#ifndef __MLIBC_ABI_ONLY - -int getpagesize(void); -char *get_current_dir_name(void); -int usleep(useconds_t); -int chroot(const char *); -int daemon(int, int); - -// This is a Linux extension -pid_t gettid(void); -int getentropy(void *, size_t); - -int pipe2(int *pipefd, int flags); - -int setresuid(uid_t ruid, uid_t euid, uid_t suid); -int setresgid(gid_t rgid, gid_t egid, gid_t sgid); - -/* Glibc extensions. */ -int getdomainname(char *name, size_t len); -int setdomainname(const char *name, size_t len); - -int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); -int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); - -// Glibc doesn't provide them by default anymore, lock behind an option -#if __MLIBC_CRYPT_OPTION -char *crypt(const char *, const char *); -void encrypt(char block[64], int flags); -#endif - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#if __MLIBC_LINUX_OPTION -# include <bits/linux/linux_unistd.h> -#endif - -#if __MLIBC_BSD_OPTION -# include <bits/bsd/bsd_unistd.h> -#endif - -#endif // _UNISTD_H - diff --git a/lib/mlibc/options/posix/include/utime.h b/lib/mlibc/options/posix/include/utime.h deleted file mode 100644 index dcf053d..0000000 --- a/lib/mlibc/options/posix/include/utime.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _UTIME_H -#define _UTIME_H - -#include <bits/ansi/time_t.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct utimbuf { - time_t actime; - time_t modtime; -}; - -#ifndef __MLIBC_ABI_ONLY - -int utime(const char *, const struct utimbuf *); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif // _UTIME_H diff --git a/lib/mlibc/options/posix/include/wordexp.h b/lib/mlibc/options/posix/include/wordexp.h deleted file mode 100644 index e5d69ce..0000000 --- a/lib/mlibc/options/posix/include/wordexp.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _WORDEXP_H -#define _WORDEXP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <bits/size_t.h> - -#define WRDE_APPEND 1 -#define WRDE_DOOFFS 2 -#define WRDE_NOCMD 4 -#define WRDE_REUSE 8 -#define WRDE_SHOWERR 16 -#define WRDE_UNDEF 32 - -#define WRDE_SUCCESS 1 -#define WRDE_BADCHAR 1 -#define WRDE_BADVAL 2 -#define WRDE_CMDSUB 3 -#define WRDE_NOSPACE 4 -#define WRDE_SYNTAX 5 - -typedef struct { - size_t we_wordc; - char **we_wordv; - size_t we_offs; - char *we_strings; - size_t we_nbytes; -} wordexp_t; - -#ifndef __MLIBC_ABI_ONLY - -int wordexp(const char *s, wordexp_t *p, int flags); -void wordfree(wordexp_t *p); - -#endif /* !__MLIBC_ABI_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif |