LibC: Rewrite all the headers.
We now have more or less posix issue 2018 conforming libc headers. This was a really time consuming and boring operation but it had to be done. Now we get to actually start implementing libc :)
This commit is contained in:
parent
faa7bc6043
commit
faf14b880e
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#if defined(__is_kernel)
|
#if defined(__is_kernel)
|
||||||
#include <kernel/Panic.h>
|
#include <kernel/Panic.h>
|
||||||
#define ASSERT(cond) do { if (!(cond)) Kernel::panic("ASSERT("#cond") failed"); } while(false)
|
#define ASSERT(cond) do { if (!(cond)) Kernel::panic("ASSERT("#cond") failed"); } while (false)
|
||||||
#define ASSERT_NOT_REACHED() Kernel::panic("ASSERT_NOT_REACHED() failed")
|
#define ASSERT_NOT_REACHED() Kernel::panic("ASSERT_NOT_REACHED() failed")
|
||||||
#else
|
#else
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define ASSERT(cond) assert((cond) && "ASSERT("#cond") failed")
|
#define ASSERT(cond) assert((cond) && "ASSERT("#cond") failed")
|
||||||
#define ASSERT_NOT_REACHED() assert(false && "ASSERT_NOT_REACHED() failed")
|
#define ASSERT_NOT_REACHED() do { assert(false && "ASSERT_NOT_REACHED() failed"); __builtin_unreachable(); } while (false)
|
||||||
#endif
|
#endif
|
|
@ -1,20 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define SYS_EXIT 1
|
|
||||||
#define SYS_READ 2
|
|
||||||
#define SYS_WRITE 3
|
|
||||||
#define SYS_TERMID 4
|
|
||||||
#define SYS_CLOSE 5
|
|
||||||
#define SYS_OPEN 6
|
|
||||||
#define SYS_ALLOC 7
|
|
||||||
#define SYS_FREE 8
|
|
||||||
#define SYS_SEEK 9
|
|
||||||
#define SYS_TELL 10
|
|
||||||
#define SYS_GET_TERMIOS 11
|
|
||||||
#define SYS_SET_TERMIOS 12
|
|
||||||
|
|
||||||
#include <kernel/Attributes.h>
|
#include <kernel/Attributes.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.26)
|
||||||
project(libc CXX ASM)
|
project(libc CXX ASM)
|
||||||
|
|
||||||
set(LIBC_SOURCES
|
set(LIBC_SOURCES
|
||||||
|
assert.cpp
|
||||||
ctype.cpp
|
ctype.cpp
|
||||||
fcntl.cpp
|
fcntl.cpp
|
||||||
printf_impl.cpp
|
printf_impl.cpp
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void __assert_fail(const char* expr, const char* file, int line, const char* func)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "assert: %s:%d: %s: Assertion '%s' failed.\n", file, line, func, expr);
|
||||||
|
abort();
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef _AIO_H
|
||||||
|
#define _AIO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/aio.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_pthread_attr_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct aiocb
|
||||||
|
{
|
||||||
|
int aio_fildes; /* File descriptor. */
|
||||||
|
off_t aio_offset; /* File offset. */
|
||||||
|
volatile void* aio_buf; /* Location of buffer. */
|
||||||
|
size_t aio_nbytes; /* Length of transfer. */
|
||||||
|
int aio_reqprio; /* Request priority offset. */
|
||||||
|
struct sigevent aio_sigevent; /* Signal number and value. */
|
||||||
|
int aio_lio_opcode; /* Operation to be performed. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define AIO_ALLDONE 1
|
||||||
|
#define AIO_CANCELLED 2
|
||||||
|
#define AIO_NOTCANCELLED 3
|
||||||
|
#define LIO_NOP 4
|
||||||
|
#define LIO_NOWAIT 5
|
||||||
|
#define LIO_READ 6
|
||||||
|
#define LIO_WAIT 7
|
||||||
|
#define LIO_WRITE 8
|
||||||
|
|
||||||
|
int aio_cancel(int fildes, struct aiocb* aiocbp);
|
||||||
|
int aio_error(const struct aiocb* aiocbp);
|
||||||
|
int aio_fsync(int op, struct aiocb* aiocbp);
|
||||||
|
int aio_read(struct aiocb* aiocbp);
|
||||||
|
ssize_t aio_return(struct aiocb* aiocbp);
|
||||||
|
int aio_suspend(const struct aiocb* const list[], int nent, const struct timespec* timeout);
|
||||||
|
int aio_write(struct aiocb* aiocbp);
|
||||||
|
int lio_listio(int mode, struct aiocb* __restrict const list[__restrict], int nent, struct sigevent* __restrict sig);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef _INET_H
|
||||||
|
#define _INET_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
uint32_t htonl(uint32_t);
|
||||||
|
uint16_t htons(uint16_t);
|
||||||
|
uint32_t ntohl(uint32_t);
|
||||||
|
uint16_t ntohs(uint16_t);
|
||||||
|
|
||||||
|
in_addr_t inet_addr(const char* cp);
|
||||||
|
char* inet_ntoa(struct in_addr in);
|
||||||
|
const char* inet_ntop(int af, const void* __restrict src, char* __restrict dst, socklen_t size);
|
||||||
|
int inet_pton(int af, const char* __restrict src, void* __restrict dst);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,20 @@
|
||||||
#pragma once
|
#ifndef __ASSERT_H
|
||||||
|
#define _ASSERT_H 1
|
||||||
|
|
||||||
#include <stdlib.h>
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html
|
||||||
|
|
||||||
#define assert(expr) { if (!(expr)) abort(); }
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define assert(ignore)((void) 0)
|
||||||
|
#else
|
||||||
|
#define assert(expr) do { if (!(expr)) __assert_fail(#expr, __FILE__, __LINE__, __func__); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
void __assert_fail(const char*, const char*, int, const char*);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#pragma once
|
#ifndef _BITS_PRINTF_H
|
||||||
|
#define _BITS_PRINTF_H 1
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
int printf_impl(const char* format, va_list arguments, int (*putc_fun)(int, void*), void* data);
|
int printf_impl(const char* format, va_list arguments, int (*putc_fun)(int, void*), void* data);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,85 @@
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#if !defined(__pthread_attr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_attr_t))
|
||||||
|
#define __pthread_attr_t_defined 1
|
||||||
|
typedef int pthread_attr_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_attr_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_barrier_t_defined) && (defined(__need_all_types) || defined(__need_pthread_barrier_t))
|
||||||
|
#define __pthread_barrier_t_defined 1
|
||||||
|
typedef int pthread_barrier_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_barrier_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_barrierattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_barrierattr_t))
|
||||||
|
#define __pthread_barrierattr_t_defined 1
|
||||||
|
typedef int pthread_barrierattr_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_barrierattr_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_cond_t_defined) && (defined(__need_all_types) || defined(__need_pthread_cond_t))
|
||||||
|
#define __pthread_cond_t_defined 1
|
||||||
|
typedef int pthread_cond_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_cond_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_condattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_condattr_t))
|
||||||
|
#define __pthread_condattr_t_defined 1
|
||||||
|
typedef int pthread_condattr_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_condattr_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_key_t_defined) && (defined(__need_all_types) || defined(__need_pthread_key_t))
|
||||||
|
#define __pthread_key_t_defined 1
|
||||||
|
typedef int pthread_key_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_key_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_mutex_t_defined) && (defined(__need_all_types) || defined(__need_pthread_mutex_t))
|
||||||
|
#define __pthread_mutex_t_defined 1
|
||||||
|
typedef int pthread_mutex_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_mutex_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_mutexattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_mutexattr_t))
|
||||||
|
#define __pthread_mutexattr_t_defined 1
|
||||||
|
typedef int pthread_mutexattr_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_mutexattr_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_once_t_defined) && (defined(__need_all_types) || defined(__need_pthread_once_t))
|
||||||
|
#define __pthread_once_t_defined 1
|
||||||
|
typedef int pthread_once_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_once_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_rwlock_t_defined) && (defined(__need_all_types) || defined(__need_pthread_rwlock_t))
|
||||||
|
#define __pthread_rwlock_t_defined 1
|
||||||
|
typedef int pthread_rwlock_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_rwlock_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_rwlockattr_t_defined) && (defined(__need_all_types) || defined(__need_pthread_rwlockattr_t))
|
||||||
|
#define __pthread_rwlockattr_t_defined 1
|
||||||
|
typedef int pthread_rwlockattr_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_rwlockattr_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_spinlock_t_defined) && (defined(__need_all_types) || defined(__need_pthread_spinlock_t))
|
||||||
|
#define __pthread_spinlock_t_defined 1
|
||||||
|
typedef int pthread_spinlock_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_spinlock_t
|
||||||
|
|
||||||
|
#if !defined(__pthread_t_defined) && (defined(__need_all_types) || defined(__need_pthread_t))
|
||||||
|
#define __pthread_t_defined 1
|
||||||
|
typedef int pthread_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pthread_t
|
||||||
|
|
||||||
|
__END_DECLS
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef _BITS_TYPES_FILE_H
|
||||||
|
#define _BITS_TYPES_FILE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#ifndef __FILE_defined
|
||||||
|
#define __FILE_defined 1
|
||||||
|
struct FILE;
|
||||||
|
typedef struct FILE FILE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _BITS_LOCALE_T_H
|
||||||
|
#define _BITS_LOCALE_T_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#ifndef __locale_t_defined
|
||||||
|
#define __locale_t_defined 1
|
||||||
|
typedef int locale_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _BITS_TYPES_SA_FAMILY_T_H
|
||||||
|
#define _BITS_TYPES_SA_FAMILY_T_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#ifndef __sa_family_t_defined
|
||||||
|
#define __sa_family_t_defined 1
|
||||||
|
typedef unsigned int sa_family_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,83 @@
|
||||||
|
#ifndef _COMPLEX_H
|
||||||
|
#define _COMPLEX_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#define complex _Complex
|
||||||
|
#define _Complex_I (__extension__ 1.0iF)
|
||||||
|
#define I _Complex_I
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
double cabs(double complex);
|
||||||
|
float cabsf(float complex);
|
||||||
|
long double cabsl(long double complex);
|
||||||
|
double complex cacos(double complex);
|
||||||
|
float complex cacosf(float complex);
|
||||||
|
double complex cacosh(double complex);
|
||||||
|
float complex cacoshf(float complex);
|
||||||
|
long double complex cacoshl(long double complex);
|
||||||
|
long double complex cacosl(long double complex);
|
||||||
|
double carg(double complex);
|
||||||
|
float cargf(float complex);
|
||||||
|
long double cargl(long double complex);
|
||||||
|
double complex casin(double complex);
|
||||||
|
float complex casinf(float complex);
|
||||||
|
double complex casinh(double complex);
|
||||||
|
float complex casinhf(float complex);
|
||||||
|
long double complex casinhl(long double complex);
|
||||||
|
long double complex casinl(long double complex);
|
||||||
|
double complex catan(double complex);
|
||||||
|
float complex catanf(float complex);
|
||||||
|
double complex catanh(double complex);
|
||||||
|
float complex catanhf(float complex);
|
||||||
|
long double complex catanhl(long double complex);
|
||||||
|
long double complex catanl(long double complex);
|
||||||
|
double complex ccos(double complex);
|
||||||
|
float complex ccosf(float complex);
|
||||||
|
double complex ccosh(double complex);
|
||||||
|
float complex ccoshf(float complex);
|
||||||
|
long double complex ccoshl(long double complex);
|
||||||
|
long double complex ccosl(long double complex);
|
||||||
|
double complex cexp(double complex);
|
||||||
|
float complex cexpf(float complex);
|
||||||
|
long double complex cexpl(long double complex);
|
||||||
|
double cimag(double complex);
|
||||||
|
float cimagf(float complex);
|
||||||
|
long double cimagl(long double complex);
|
||||||
|
double complex clog(double complex);
|
||||||
|
float complex clogf(float complex);
|
||||||
|
long double complex clogl(long double complex);
|
||||||
|
double complex conj(double complex);
|
||||||
|
float complex conjf(float complex);
|
||||||
|
long double complex conjl(long double complex);
|
||||||
|
double complex cpow(double complex, double complex);
|
||||||
|
float complex cpowf(float complex, float complex);
|
||||||
|
long double complex cpowl(long double complex, long double complex);
|
||||||
|
double complex cproj(double complex);
|
||||||
|
float complex cprojf(float complex);
|
||||||
|
long double complex cprojl(long double complex);
|
||||||
|
double creal(double complex);
|
||||||
|
float crealf(float complex);
|
||||||
|
long double creall(long double complex);
|
||||||
|
double complex csin(double complex);
|
||||||
|
float complex csinf(float complex);
|
||||||
|
double complex csinh(double complex);
|
||||||
|
float complex csinhf(float complex);
|
||||||
|
long double complex csinhl(long double complex);
|
||||||
|
long double complex csinl(long double complex);
|
||||||
|
double complex csqrt(double complex);
|
||||||
|
float complex csqrtf(float complex);
|
||||||
|
long double complex csqrtl(long double complex);
|
||||||
|
double complex ctan(double complex);
|
||||||
|
float complex ctanf(float complex);
|
||||||
|
double complex ctanh(double complex);
|
||||||
|
float complex ctanhf(float complex);
|
||||||
|
long double complex ctanhl(long double complex);
|
||||||
|
long double complex ctanl(long double complex);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef _CPIO_H
|
||||||
|
#define _CPIO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define C_IRUSR 0000400
|
||||||
|
#define C_IWUSR 0000200
|
||||||
|
#define C_IXUSR 0000100
|
||||||
|
#define C_IRGRP 0000040
|
||||||
|
#define C_IWGRP 0000020
|
||||||
|
#define C_IXGRP 0000010
|
||||||
|
#define C_IROTH 0000004
|
||||||
|
#define C_IWOTH 0000002
|
||||||
|
#define C_IXOTH 0000001
|
||||||
|
#define C_ISUID 0004000
|
||||||
|
#define C_ISGID 0002000
|
||||||
|
#define C_ISVTX 0001000
|
||||||
|
#define C_ISDIR 0040000
|
||||||
|
#define C_ISFIFO 0010000
|
||||||
|
#define C_ISREG 0100000
|
||||||
|
#define C_ISBLK 0060000
|
||||||
|
#define C_ISCHR 0020000
|
||||||
|
#define C_ISCTG 0110000
|
||||||
|
#define C_ISLNK 0120000
|
||||||
|
#define C_ISSOCK 0140000
|
||||||
|
|
||||||
|
#define MAGIC "070707"
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,24 +1,48 @@
|
||||||
#pragma once
|
#ifndef _CTYPE_H
|
||||||
|
#define _CTYPE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
int isalnum(int);
|
int isalnum(int);
|
||||||
|
int isalnum_l(int, locale_t);
|
||||||
int isalpha(int);
|
int isalpha(int);
|
||||||
|
int isalpha_l(int, locale_t);
|
||||||
int isascii(int);
|
int isascii(int);
|
||||||
int isblank(int);
|
int isblank(int);
|
||||||
|
int isblank_l(int, locale_t);
|
||||||
int iscntrl(int);
|
int iscntrl(int);
|
||||||
|
int iscntrl_l(int, locale_t);
|
||||||
int isdigit(int);
|
int isdigit(int);
|
||||||
|
int isdigit_l(int, locale_t);
|
||||||
int isgraph(int);
|
int isgraph(int);
|
||||||
|
int isgraph_l(int, locale_t);
|
||||||
int islower(int);
|
int islower(int);
|
||||||
|
int islower_l(int, locale_t);
|
||||||
int isprint(int);
|
int isprint(int);
|
||||||
|
int isprint_l(int, locale_t);
|
||||||
int ispunct(int);
|
int ispunct(int);
|
||||||
|
int ispunct_l(int, locale_t);
|
||||||
int isspace(int);
|
int isspace(int);
|
||||||
|
int isspace_l(int, locale_t);
|
||||||
int isupper(int);
|
int isupper(int);
|
||||||
|
int isupper_l(int, locale_t);
|
||||||
int isxdigit(int);
|
int isxdigit(int);
|
||||||
|
int isxdigit_l(int, locale_t);
|
||||||
int toupper(int);
|
int toascii(int);
|
||||||
int tolower(int);
|
int tolower(int);
|
||||||
|
int tolower_l(int, locale_t);
|
||||||
|
int toupper(int);
|
||||||
|
int toupper_l(int, locale_t);
|
||||||
|
|
||||||
__END_DECLS
|
#define _toupper(val) ::toupper(val)
|
||||||
|
#define _tolower(val) ::tolower(val)
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,27 +1,36 @@
|
||||||
#pragma once
|
#ifndef _DIRENT_H
|
||||||
|
#define _DIRENT_H 1
|
||||||
|
|
||||||
#include <sys/types.h>
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_ino_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
struct DIR;
|
struct DIR;
|
||||||
|
typedef DIR DIR;
|
||||||
|
|
||||||
struct dirent
|
struct dirent
|
||||||
{
|
{
|
||||||
ino_t d_ino;
|
ino_t d_ino; /* File serial number. */
|
||||||
char d_name[];
|
char d_name[]; /* Filename string of entry. */
|
||||||
};
|
};
|
||||||
|
|
||||||
int alphasort(const struct dirent**, const struct dirent**);
|
int alphasort(const struct dirent** d1, const struct dirent** d2);
|
||||||
int closedir(DIR*);
|
int closedir(DIR* dirp);
|
||||||
int dirfd(DIR*);
|
int dirfd(DIR* dirp);
|
||||||
DIR* fdopendir(int);
|
DIR* fdopendir(int fd);
|
||||||
DIR* opendir(const char*);
|
DIR* opendir(const char* dirname);
|
||||||
struct dirent* readdir(DIR*);
|
struct dirent* readdir(DIR* dirp);
|
||||||
int readdir_r(DIR*, struct dirent*, struct dirent**);
|
int readdir_r(DIR* __restrict dirp, struct dirent* __restrict entry, struct dirent** __restrict result);
|
||||||
void rewinddir(DIR*);
|
void rewinddir(DIR* dirp);
|
||||||
int scandir(const char*, struct dirent***, int (*)(const struct dirent*), int (*)(const struct dirent**, const struct dirent**));
|
int scandir(const char* dir, struct dirent*** namelist, int (*sel)(const struct dirent*), int (*compar)(const struct dirent**, const struct dirent**));
|
||||||
void seekdir(DIR*, long);
|
void seekdir(DIR* dirp, long loc);
|
||||||
long telldir(DIR*);
|
long telldir(DIR* dirp);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _DLFCN_H
|
||||||
|
#define _DLFCN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dlfcn.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define RTLD_LAZY 1
|
||||||
|
#define RTLD_NOW 2
|
||||||
|
#define RTLD_GLOBAL 3
|
||||||
|
#define RTLD_LOCAL 4
|
||||||
|
|
||||||
|
int dlclose(void* handle);
|
||||||
|
char* dlerror(void);
|
||||||
|
void* dlopen(const char* file, int mode);
|
||||||
|
void* dlsym(void* __restrict handle, const char* __restrict name);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,12 @@
|
||||||
#pragma once
|
#ifndef _ERRNO_H
|
||||||
|
#define _ERRNO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define E2BIG 1
|
#define E2BIG 1
|
||||||
#define EACCES 2
|
#define EACCES 2
|
||||||
#define EADDRINUSE 3
|
#define EADDRINUSE 3
|
||||||
|
@ -83,13 +88,13 @@
|
||||||
#define ETXTBSY 79
|
#define ETXTBSY 79
|
||||||
#define EWOULDBLOCK 80
|
#define EWOULDBLOCK 80
|
||||||
#define EXDEV 81
|
#define EXDEV 81
|
||||||
#define EEXISTS 82
|
#define ENOTBLK 82
|
||||||
#define ENOTBLK 83
|
#define EEXISTS 83
|
||||||
|
|
||||||
#define errno errno
|
#define errno __errno
|
||||||
|
|
||||||
__BEGIN_DECLS
|
extern int __errno;
|
||||||
|
|
||||||
extern int errno;
|
__END_DECLS
|
||||||
|
|
||||||
__END_DECLS
|
#endif
|
||||||
|
|
|
@ -1,18 +1,106 @@
|
||||||
#pragma once
|
#ifndef _FCNTL_H
|
||||||
|
#define _FCNTL_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#define O_RDONLY (1 << 0)
|
|
||||||
#define O_WRONLY (1 << 1)
|
|
||||||
#define O_RDWR (O_RDONLY | O_WRONLY)
|
|
||||||
#define O_ACCMODE (O_RDONLY | O_WRONLY)
|
|
||||||
#define O_EXCL (1 << 2)
|
|
||||||
#define O_CREAT (1 << 3)
|
|
||||||
#define O_TRUNC (1 << 4)
|
|
||||||
#define O_APPEND (1 << 5)
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
int open(const char*, int, ...);
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define __need_mode_t
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define F_DUPFD 1
|
||||||
|
#define F_DUPFD_CLOEXEC 2
|
||||||
|
#define F_GETFD 3
|
||||||
|
#define F_SETFD 4
|
||||||
|
#define F_GETFL 5
|
||||||
|
#define F_SETFL 6
|
||||||
|
#define F_GETLK 7
|
||||||
|
#define F_SETLK 8
|
||||||
|
#define F_SETLKW 9
|
||||||
|
#define F_GETOWN 10
|
||||||
|
#define F_SETOWN 11
|
||||||
|
|
||||||
|
#define FD_CLOEXEC 1
|
||||||
|
|
||||||
|
#define F_RDLCK 1
|
||||||
|
#define F_UNLCK 2
|
||||||
|
#define F_WRLCK 3
|
||||||
|
|
||||||
|
// NOTE: also defined in stdio.h
|
||||||
|
#define SEEK_SET 1
|
||||||
|
#define SEEK_CUR 2
|
||||||
|
#define SEEK_END 3
|
||||||
|
|
||||||
|
/* bits 4-11 */
|
||||||
|
#define O_CLOEXEC 0x00010
|
||||||
|
#define O_CREAT 0x00020
|
||||||
|
#define O_DIRECTORY 0x00040
|
||||||
|
#define O_EXCL 0x00080
|
||||||
|
#define O_NOCTTY 0x00100
|
||||||
|
#define O_NOFOLLOW 0x00200
|
||||||
|
#define O_TRUNC 0x00400
|
||||||
|
#define O_TTY_INIT 0x00800
|
||||||
|
|
||||||
|
/* bits 12-16 */
|
||||||
|
#define O_APPEND 0x01000
|
||||||
|
#define O_DSYNC 0x02000
|
||||||
|
#define O_NONBLOCK 0x04000
|
||||||
|
#define O_RSYNC 0x08000
|
||||||
|
#define O_SYNC 0x10000
|
||||||
|
|
||||||
|
#define O_ACCMODE 0x00003
|
||||||
|
|
||||||
|
/* bits 0-1 */
|
||||||
|
#define O_RDONLY 0x00001
|
||||||
|
#define O_WRONLY 0x00002
|
||||||
|
#define O_RDWR (O_RDONLY | O_WRONLY)
|
||||||
|
|
||||||
|
/* bit 17 */
|
||||||
|
#define AT_FDCWD 0x20000
|
||||||
|
|
||||||
|
/* bit 18 */
|
||||||
|
#define AT_EACCESS 0x40000
|
||||||
|
|
||||||
|
/* bit 19 */
|
||||||
|
#define AT_SYMLINK_NOFOLLOW 0x80000
|
||||||
|
|
||||||
|
/* bit 20 */
|
||||||
|
#define AT_SYMLINK_FOLLOW 0x100000
|
||||||
|
|
||||||
|
/* bit 21 */
|
||||||
|
#define AT_REMOVEDIR 0x200000
|
||||||
|
|
||||||
|
/* bits 22-27 */
|
||||||
|
#define POSIX_FADV_DONTNEED 0x0400000
|
||||||
|
#define POSIX_FADV_NOREUSE 0x0800000
|
||||||
|
#define POSIX_FADV_NORMAL 0x1000000
|
||||||
|
#define POSIX_FADV_RANDOM 0x2000000
|
||||||
|
#define POSIX_FADV_SEQUENTIAL 0x4000000
|
||||||
|
#define POSIX_FADV_WILLNEED 0x8000000
|
||||||
|
|
||||||
|
struct flock
|
||||||
|
{
|
||||||
|
short l_type; /* Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. */
|
||||||
|
short l_whence; /* Flag for starting offset. */
|
||||||
|
off_t l_start; /* Relative offset in bytes. */
|
||||||
|
off_t l_len; /* Size; if 0 then until EOF. */
|
||||||
|
pid_t l_pid; /* Process ID of the process holding the lock; returned with F_GETLK. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int creat(const char* path, mode_t mode);
|
||||||
|
int fcntl(int fildes, int cmd, ...);
|
||||||
|
int open(const char* path, int oflag, ...);
|
||||||
|
int openat(int fd, const char* path, int oflag, ...);
|
||||||
|
int posix_fadvise(int fd, off_t offset, off_t len, int advice);
|
||||||
|
int posix_fallocate(int fd, off_t offset, off_t len);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef _FENV_H
|
||||||
|
#define _FENV_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fenv.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef _FMTMSG_H
|
||||||
|
#define _FMTMSG_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fmtmsg.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define MM_HARD 1
|
||||||
|
#define MM_SOFT 2
|
||||||
|
#define MM_FIRM 3
|
||||||
|
#define MM_APPL 4
|
||||||
|
#define MM_UTIL 5
|
||||||
|
#define MM_OPSYS 6
|
||||||
|
#define MM_RECOVER 7
|
||||||
|
#define MM_NRECOV 8
|
||||||
|
#define MM_HALT 9
|
||||||
|
#define MM_ERROR 10
|
||||||
|
#define MM_WARNING 11
|
||||||
|
#define MM_INFO 12
|
||||||
|
#define MM_NOSEV 13
|
||||||
|
#define MM_PRINT 14
|
||||||
|
#define MM_CONSOLE 15
|
||||||
|
|
||||||
|
#define MM_NULLLBL (char*)0
|
||||||
|
#define MM_NULLSEV 0
|
||||||
|
#define MM_NULLMC 0L
|
||||||
|
#define MM_NULLTXT (char*)0
|
||||||
|
#define MM_NULLACL (char*)0
|
||||||
|
#define MM_NULLTAG (char*)0
|
||||||
|
|
||||||
|
#define MM_OK 0
|
||||||
|
#define MM_NOTOK 1
|
||||||
|
#define MM_NOMSG 2
|
||||||
|
#define MM_NOCON 3
|
||||||
|
|
||||||
|
int fmtmsg(long classification, const char* label, int severity, const char* text, const char* action, const char* tag);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef _FNMATCH_H
|
||||||
|
#define _FNMATCH_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fnmatch.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define FNM_NOMATCH 1
|
||||||
|
#define FNM_PATHNAME 0x01
|
||||||
|
#define FNM_PERIOD 0x02
|
||||||
|
#define FNM_NOESCAPE 0x04
|
||||||
|
|
||||||
|
int fnmatch(const char* pattern, const char* string, int flags);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,36 @@
|
||||||
|
#ifndef _FTW_H
|
||||||
|
#define _FTW_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ftw.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
struct FTW
|
||||||
|
{
|
||||||
|
int base;
|
||||||
|
int level;
|
||||||
|
};
|
||||||
|
|
||||||
|
#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 3
|
||||||
|
#define FTW_CHDIR 4
|
||||||
|
|
||||||
|
int ftw(const char* path, int (*fn)(const char*, const struct stat* ptr, int flag), int ndirs);
|
||||||
|
int nftw(const char* path, int (*fn)(const char*, const struct stat*, int, struct FTW*), int fd_limit, int flags);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef _GLOB_H
|
||||||
|
#define _GLOB_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/glob.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.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_ABORTED 1
|
||||||
|
#define GLOB_NOMATCH 2
|
||||||
|
#define GLOB_NOSPACE 3
|
||||||
|
|
||||||
|
struct glob_t
|
||||||
|
{
|
||||||
|
size_t gl_pathc; /* Count of paths matched by pattern. */
|
||||||
|
char** gl_pathv; /* Pointer to a list of matched pathnames. */
|
||||||
|
size_t gl_offs; /* Slots to reserve at the beginning of gl_pathv. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int glob(const char* __restrict pattern, int flags, int (*errfunc)(const char* epath, int eerrno), glob_t* __restrict pglob);
|
||||||
|
void globfree(glob_t* pglob);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef _GRP_H
|
||||||
|
#define _GRP_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/grp.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_gid_t
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct group
|
||||||
|
{
|
||||||
|
char* gr_name; /* The name of the group. */
|
||||||
|
gid_t gr_gid; /* Numerical group ID. */
|
||||||
|
char** gr_mem; /* Pointer to a null-terminated array of character pointers to member names. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void endgrent(void);
|
||||||
|
struct group* getgrent(void);
|
||||||
|
struct group* getgrgid(gid_t gid);
|
||||||
|
int getgrgit_r(gid_t gid, struct group* grp, char* buffer, size_t bufsize, struct group** result);
|
||||||
|
struct group* getgrnam(const char* name);
|
||||||
|
int getgrnam_r(const char* name, struct group* grp, char* buffer, size_t bufsize, struct group** result);
|
||||||
|
void setgrent(void);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef _ICONV_H
|
||||||
|
#define _ICONV_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/iconv.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef void* iconv_t;
|
||||||
|
|
||||||
|
size_t iconv(iconv_t cd, char** __restrict inbuf, size_t* __restrict inbytesleft, char** __restrict outbuf, size_t* __restrict outbytesleft);
|
||||||
|
int iconv_close(iconv_t cd);
|
||||||
|
iconv_t iconv_open(const char* tocode, const char* fromcode);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,206 @@
|
||||||
|
#ifndef _INTTYPES_H
|
||||||
|
#define _INTTYPES_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define __need_wchar_t
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
intmax_t quot;
|
||||||
|
intmax_t rem;
|
||||||
|
} imaxdiv_t;
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
#define __PRI64_PREFIX "l"
|
||||||
|
#define __PRIPTR_PREFIX "l"
|
||||||
|
#else
|
||||||
|
#define __PRI64_PREFIX "ll"
|
||||||
|
#define __PRIPTR_PREFIX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PRId8 "d"
|
||||||
|
#define PRId16 "d"
|
||||||
|
#define PRId32 "d"
|
||||||
|
#define PRId64 __PRI64_PREFIX "d"
|
||||||
|
#define PRIdLEAST8 "d"
|
||||||
|
#define PRIdLEAST16 "d"
|
||||||
|
#define PRIdLEAST32 "d"
|
||||||
|
#define PRIdLEAST64 __PRI64_PREFIX "d"
|
||||||
|
#define PRIdFAST8 "d"
|
||||||
|
#define PRIdFAST16 __PRIPTR_PREFIX "d"
|
||||||
|
#define PRIdFAST32 __PRIPTR_PREFIX "d"
|
||||||
|
#define PRIdFAST64 __PRI64_PREFIX "d"
|
||||||
|
#define PRIdMAX __PRI64_PREFIX "d"
|
||||||
|
#define PRIdPTR __PRIPTR_PREFIX "d"
|
||||||
|
|
||||||
|
#define PRIi8 "i"
|
||||||
|
#define PRIi16 "i"
|
||||||
|
#define PRIi32 "i"
|
||||||
|
#define PRIi64 __PRI64_PREFIX "i"
|
||||||
|
#define PRIiLEAST8 "i"
|
||||||
|
#define PRIiLEAST16 "i"
|
||||||
|
#define PRIiLEAST32 "i"
|
||||||
|
#define PRIiLEAST64 __PRI64_PREFIX "i"
|
||||||
|
#define PRIiFAST8 "i"
|
||||||
|
#define PRIiFAST16 __PRIPTR_PREFIX "i"
|
||||||
|
#define PRIiFAST32 __PRIPTR_PREFIX "i"
|
||||||
|
#define PRIiFAST64 __PRI64_PREFIX "i"
|
||||||
|
#define PRIiMAX __PRI64_PREFIX "i"
|
||||||
|
#define PRIiPTR __PRIPTR_PREFIX "i"
|
||||||
|
|
||||||
|
#define PRIo8 "o"
|
||||||
|
#define PRIo16 "o"
|
||||||
|
#define PRIo32 "o"
|
||||||
|
#define PRIo64 __PRI64_PREFIX "o"
|
||||||
|
#define PRIoLEAST8 "o"
|
||||||
|
#define PRIoLEAST16 "o"
|
||||||
|
#define PRIoLEAST32 "o"
|
||||||
|
#define PRIoLEAST64 __PRI64_PREFIX "o"
|
||||||
|
#define PRIoFAST8 "o"
|
||||||
|
#define PRIoFAST16 __PRIPTR_PREFIX "o"
|
||||||
|
#define PRIoFAST32 __PRIPTR_PREFIX "o"
|
||||||
|
#define PRIoFAST64 __PRI64_PREFIX "o"
|
||||||
|
#define PRIoMAX __PRI64_PREFIX "o"
|
||||||
|
#define PRIoPTR __PRIPTR_PREFIX "o"
|
||||||
|
|
||||||
|
#define PRIu8 "u"
|
||||||
|
#define PRIu16 "u"
|
||||||
|
#define PRIu32 "u"
|
||||||
|
#define PRIu64 __PRI64_PREFIX "u"
|
||||||
|
#define PRIuLEAST8 "u"
|
||||||
|
#define PRIuLEAST16 "u"
|
||||||
|
#define PRIuLEAST32 "u"
|
||||||
|
#define PRIuLEAST64 __PRI64_PREFIX "u"
|
||||||
|
#define PRIuFAST8 "u"
|
||||||
|
#define PRIuFAST16 __PRIPTR_PREFIX "u"
|
||||||
|
#define PRIuFAST32 __PRIPTR_PREFIX "u"
|
||||||
|
#define PRIuFAST64 __PRI64_PREFIX "u"
|
||||||
|
#define PRIuMAX __PRI64_PREFIX "u"
|
||||||
|
#define PRIuPTR __PRIPTR_PREFIX "u"
|
||||||
|
|
||||||
|
#define PRIx8 "x"
|
||||||
|
#define PRIx16 "x"
|
||||||
|
#define PRIx32 "x"
|
||||||
|
#define PRIx64 __PRI64_PREFIX "x"
|
||||||
|
#define PRIxLEAST8 "x"
|
||||||
|
#define PRIxLEAST16 "x"
|
||||||
|
#define PRIxLEAST32 "x"
|
||||||
|
#define PRIxLEAST64 __PRI64_PREFIX "x"
|
||||||
|
#define PRIxFAST8 "x"
|
||||||
|
#define PRIxFAST16 __PRIPTR_PREFIX "x"
|
||||||
|
#define PRIxFAST32 __PRIPTR_PREFIX "x"
|
||||||
|
#define PRIxFAST64 __PRI64_PREFIX "x"
|
||||||
|
#define PRIxMAX __PRI64_PREFIX "x"
|
||||||
|
#define PRIxPTR __PRIPTR_PREFIX "x"
|
||||||
|
|
||||||
|
#define PRIX8 "X"
|
||||||
|
#define PRIX16 "X"
|
||||||
|
#define PRIX32 "X"
|
||||||
|
#define PRIX64 __PRI64_PREFIX "X"
|
||||||
|
#define PRIXLEAST8 "X"
|
||||||
|
#define PRIXLEAST16 "X"
|
||||||
|
#define PRIXLEAST32 "X"
|
||||||
|
#define PRIXLEAST64 __PRI64_PREFIX "X"
|
||||||
|
#define PRIXFAST8 "X"
|
||||||
|
#define PRIXFAST16 __PRIPTR_PREFIX "X"
|
||||||
|
#define PRIXFAST32 __PRIPTR_PREFIX "X"
|
||||||
|
#define PRIXFAST64 __PRI64_PREFIX "X"
|
||||||
|
#define PRIXMAX __PRI64_PREFIX "X"
|
||||||
|
#define PRIXPTR __PRIPTR_PREFIX "X"
|
||||||
|
|
||||||
|
#define SCNd8 "hhd"
|
||||||
|
#define SCNd16 "hd"
|
||||||
|
#define SCNd32 "d"
|
||||||
|
#define SCNd64 __PRI64_PREFIX "d"
|
||||||
|
#define SCNdLEAST8 "hhd"
|
||||||
|
#define SCNdLEAST16 "hd"
|
||||||
|
#define SCNdLEAST32 "d"
|
||||||
|
#define SCNdLEAST64 __PRI64_PREFIX "d"
|
||||||
|
#define SCNdFAST8 "hhd"
|
||||||
|
#define SCNdFAST16 __PRIPTR_PREFIX "d"
|
||||||
|
#define SCNdFAST32 __PRIPTR_PREFIX "d"
|
||||||
|
#define SCNdFAST64 __PRI64_PREFIX "d"
|
||||||
|
#define SCNdMAX __PRI64_PREFIX "d"
|
||||||
|
#define SCNdPTR __PRIPTR_PREFIX "d"
|
||||||
|
|
||||||
|
#define SCNi8 "hhi"
|
||||||
|
#define SCNi16 "hi"
|
||||||
|
#define SCNi32 "i"
|
||||||
|
#define SCNi64 __PRI64_PREFIX "i"
|
||||||
|
#define SCNiLEAST8 "hhi"
|
||||||
|
#define SCNiLEAST16 "hi"
|
||||||
|
#define SCNiLEAST32 "i"
|
||||||
|
#define SCNiLEAST64 __PRI64_PREFIX "i"
|
||||||
|
#define SCNiFAST8 "hhi"
|
||||||
|
#define SCNiFAST16 __PRIPTR_PREFIX "i"
|
||||||
|
#define SCNiFAST32 __PRIPTR_PREFIX "i"
|
||||||
|
#define SCNiFAST64 __PRI64_PREFIX "i"
|
||||||
|
#define SCNiMAX __PRI64_PREFIX "i"
|
||||||
|
#define SCNiPTR __PRIPTR_PREFIX "i"
|
||||||
|
|
||||||
|
#define SCNo8 "hho"
|
||||||
|
#define SCNo16 "ho"
|
||||||
|
#define SCNo32 "o"
|
||||||
|
#define SCNo64 __PRI64_PREFIX "o"
|
||||||
|
#define SCNoLEAST8 "hho"
|
||||||
|
#define SCNoLEAST16 "ho"
|
||||||
|
#define SCNoLEAST32 "o"
|
||||||
|
#define SCNoLEAST64 __PRI64_PREFIX "o"
|
||||||
|
#define SCNoFAST8 "hho"
|
||||||
|
#define SCNoFAST16 __PRIPTR_PREFIX "o"
|
||||||
|
#define SCNoFAST32 __PRIPTR_PREFIX "o"
|
||||||
|
#define SCNoFAST64 __PRI64_PREFIX "o"
|
||||||
|
#define SCNoMAX __PRI64_PREFIX "o"
|
||||||
|
#define SCNoPTR __PRIPTR_PREFIX "o"
|
||||||
|
|
||||||
|
#define SCNu8 "hhu"
|
||||||
|
#define SCNu16 "hu"
|
||||||
|
#define SCNu32 "u"
|
||||||
|
#define SCNu64 __PRI64_PREFIX "u"
|
||||||
|
#define SCNuLEAST8 "hhu"
|
||||||
|
#define SCNuLEAST16 "hu"
|
||||||
|
#define SCNuLEAST32 "u"
|
||||||
|
#define SCNuLEAST64 __PRI64_PREFIX "u"
|
||||||
|
#define SCNuFAST8 "hhu"
|
||||||
|
#define SCNuFAST16 __PRIPTR_PREFIX "u"
|
||||||
|
#define SCNuFAST32 __PRIPTR_PREFIX "u"
|
||||||
|
#define SCNuFAST64 __PRI64_PREFIX "u"
|
||||||
|
#define SCNuMAX __PRI64_PREFIX "u"
|
||||||
|
#define SCNuPTR __PRIPTR_PREFIX "u"
|
||||||
|
|
||||||
|
#define SCNx8 "hhx"
|
||||||
|
#define SCNx16 "hx"
|
||||||
|
#define SCNx32 "x"
|
||||||
|
#define SCNx64 __PRI64_PREFIX "x"
|
||||||
|
#define SCNxLEAST8 "hhx"
|
||||||
|
#define SCNxLEAST16 "hx"
|
||||||
|
#define SCNxLEAST32 "x"
|
||||||
|
#define SCNxLEAST64 __PRI64_PREFIX "x"
|
||||||
|
#define SCNxFAST8 "hhx"
|
||||||
|
#define SCNxFAST16 __PRIPTR_PREFIX "x"
|
||||||
|
#define SCNxFAST32 __PRIPTR_PREFIX "x"
|
||||||
|
#define SCNxFAST64 __PRI64_PREFIX "x"
|
||||||
|
#define SCNxMAX __PRI64_PREFIX "x"
|
||||||
|
#define SCNxPTR __PRIPTR_PREFIX "x"
|
||||||
|
|
||||||
|
#undef __PRI64_PREFIX
|
||||||
|
#undef __PRIPTR_PREFIX
|
||||||
|
|
||||||
|
intmax_t imaxabs(intmax_t);
|
||||||
|
imaxdiv_t imaxdiv(intmax_t, intmax_t);
|
||||||
|
intmax_t strtoimax(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
|
uintmax_t strtoumax(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
|
intmax_t wcstoimax(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
uintmax_t wcstoumax(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,74 @@
|
||||||
|
#ifndef _LANGINFO_H
|
||||||
|
#define _LANGINFO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
#include <nl_types.h>
|
||||||
|
|
||||||
|
#define CODESET 0
|
||||||
|
#define D_T_FMT 1
|
||||||
|
#define D_FMT 2
|
||||||
|
#define T_FMT 3
|
||||||
|
#define T_FMT_AMPM 4
|
||||||
|
#define AM_STR 5
|
||||||
|
#define PM_STR 6
|
||||||
|
#define DAY_1 7
|
||||||
|
#define DAY_2 8
|
||||||
|
#define DAY_3 9
|
||||||
|
#define DAY_4 10
|
||||||
|
#define DAY_5 11
|
||||||
|
#define DAY_6 12
|
||||||
|
#define DAY_7 13
|
||||||
|
#define ABDAY_1 14
|
||||||
|
#define ABDAY_2 15
|
||||||
|
#define ABDAY_3 16
|
||||||
|
#define ABDAY_4 17
|
||||||
|
#define ABDAY_5 18
|
||||||
|
#define ABDAY_6 19
|
||||||
|
#define ABDAY_7 20
|
||||||
|
#define MON_1 21
|
||||||
|
#define MON_2 22
|
||||||
|
#define MON_3 23
|
||||||
|
#define MON_4 24
|
||||||
|
#define MON_5 25
|
||||||
|
#define MON_6 26
|
||||||
|
#define MON_7 27
|
||||||
|
#define MON_8 28
|
||||||
|
#define MON_9 29
|
||||||
|
#define MON_10 30
|
||||||
|
#define MON_11 31
|
||||||
|
#define MON_12 32
|
||||||
|
#define ABMON_1 33
|
||||||
|
#define ABMON_2 34
|
||||||
|
#define ABMON_3 35
|
||||||
|
#define ABMON_4 36
|
||||||
|
#define ABMON_5 37
|
||||||
|
#define ABMON_6 38
|
||||||
|
#define ABMON_7 39
|
||||||
|
#define ABMON_8 40
|
||||||
|
#define ABMON_9 41
|
||||||
|
#define ABMON_10 42
|
||||||
|
#define ABMON_11 43
|
||||||
|
#define ABMON_12 44
|
||||||
|
#define ERA 45
|
||||||
|
#define ERA_D_FMT 46
|
||||||
|
#define ERA_D_T_FMT 47
|
||||||
|
#define ERA_T_FMT 48
|
||||||
|
#define ALT_DIGITS 49
|
||||||
|
#define RADIXCHAR 50
|
||||||
|
#define THOUSEP 51
|
||||||
|
#define YESEXPR 52
|
||||||
|
#define NOEXPR 53
|
||||||
|
#define CRNCYSTR 54
|
||||||
|
|
||||||
|
char* nl_langinfo(nl_item item);
|
||||||
|
char* nl_landinfo_l(nl_item item, locale_t locale);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef _LIBGEN_H
|
||||||
|
#define _LIBGEN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ligen.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
char* basename(char* path);
|
||||||
|
char* dirname(char* path);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _LIMITS_H
|
||||||
|
#define _LIMITS_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
// FIXME: What do I have to define here?
|
||||||
|
// glibc seems to only define numerical
|
||||||
|
// and posix constants
|
||||||
|
|
||||||
|
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
|
||||||
|
#include_next <limits.h>
|
||||||
|
#else
|
||||||
|
#error "unsupported compiler"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,25 +1,35 @@
|
||||||
#pragma once
|
#ifndef _LOCALE_H
|
||||||
|
#define _LOCALE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html#tag_13_24
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
#define LC_ALL 1
|
#define __need_NULL
|
||||||
#define LC_COLLATE 2
|
#include <stddef.h>
|
||||||
#define LC_CTYPE 3
|
|
||||||
#define LC_MESSAGES 4
|
|
||||||
#define LC_MONETARY 5
|
|
||||||
#define LC_NUMERIC 6
|
|
||||||
#define LC_TIME 7
|
|
||||||
|
|
||||||
#define LC_COLLATE_MASK 0x01
|
#define LC_COLLATE 0
|
||||||
#define LC_CTYPE_MASK 0x02
|
#define LC_CTYPE 1
|
||||||
#define LC_MESSAGES_MASK 0x04
|
#define LC_MESSAGES 2
|
||||||
#define LC_MONETARY_MASK 0x08
|
#define LC_MONETARY 3
|
||||||
#define LC_NUMERIC_MASK 0x10
|
#define LC_NUMERIC 4
|
||||||
#define LC_TIME_MASK 0x20
|
#define LC_TIME 5
|
||||||
#define LC_ALL_MASK 0x3F
|
#define LC_ALL 6
|
||||||
|
|
||||||
|
#define LC_COLLATE_MASK (1 << LC_COLLATE)
|
||||||
|
#define LC_CTYPE_MASK (1 << LC_CTYPE)
|
||||||
|
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
|
||||||
|
#define LC_MONETARY_MASK (1 << LC_MONETARY)
|
||||||
|
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
|
||||||
|
#define LC_TIME_MASK (1 << LC_TIME)
|
||||||
|
#define LC_ALL_MASK LC_COLLATE_MASK \
|
||||||
|
| LC_CTYPE_MASK \
|
||||||
|
| LC_MESSAGES_MASK \
|
||||||
|
| LC_MONETARY_MASK \
|
||||||
|
| LC_NUMERIC_MASK \
|
||||||
|
| LC_TIME_MASK
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -30,34 +40,34 @@ struct lconv
|
||||||
char frac_digits;
|
char frac_digits;
|
||||||
char* grouping;
|
char* grouping;
|
||||||
char* int_curr_symbol;
|
char* int_curr_symbol;
|
||||||
char int_frac_digits;
|
char int_frac_digits;
|
||||||
char int_n_cs_precedes;
|
char int_n_cs_precedes;
|
||||||
char int_n_sep_by_space;
|
char int_n_sep_by_space;
|
||||||
char int_n_sign_posn;
|
char int_n_sign_posn;
|
||||||
char int_p_cs_precedes;
|
char int_p_cs_precedes;
|
||||||
char int_p_sep_by_space;
|
char int_p_sep_by_space;
|
||||||
char int_p_sign_posn;
|
char int_p_sign_posn;
|
||||||
char* mon_decimal_point;
|
char* mon_decimal_point;
|
||||||
char* mon_grouping;
|
char* mon_grouping;
|
||||||
char* mon_thousands_sep;
|
char* mon_thousands_sep;
|
||||||
char* negative_sign;
|
char* negative_sign;
|
||||||
char n_cs_precedes;
|
char n_cs_precedes;
|
||||||
char n_sep_by_space;
|
char n_sep_by_space;
|
||||||
char n_sign_posn;
|
char n_sign_posn;
|
||||||
char* positive_sign;
|
char* positive_sign;
|
||||||
char p_cs_precedes;
|
char p_cs_precedes;
|
||||||
char p_sep_by_space;
|
char p_sep_by_space;
|
||||||
char p_sign_posn;
|
char p_sign_posn;
|
||||||
char* thousands_sep;
|
char* thousands_sep;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int locale_t;
|
locale_t duplocale(locale_t locobj);
|
||||||
|
void freelocale(locale_t locobj);
|
||||||
locale_t duplocale(locale_t);
|
struct lconv* localeconv(void);
|
||||||
void freelocale(locale_t);
|
locale_t newlocale(int category_mask, const char* locale, locale_t base);
|
||||||
struct lconv localeconv(void);
|
char* setlocale(int category, const char* locale);
|
||||||
locale_t newlocale(int, const char*, locale_t);
|
locale_t uselocale(locale_t newloc);
|
||||||
char* setlocale(int, const char*);
|
|
||||||
locale_t uselocale(locale_t);
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,16 +1,76 @@
|
||||||
#pragma once
|
#ifndef _MATH_H
|
||||||
|
#define _MATH_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
#define FP_INFINITE 1
|
|
||||||
#define FP_NAN 2
|
|
||||||
#define FP_NORMAL 3
|
|
||||||
#define FP_SUBNORMAL 4
|
|
||||||
#define FP_ZERO 5
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
extern int signgam;
|
#ifndef FLT_EVAL_METHOD
|
||||||
|
#define FLT_EVAL_METHOD 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FLT_EVAL_METHOD == 0
|
||||||
|
typedef float float_t;
|
||||||
|
typedef double double_t;
|
||||||
|
#elif FLT_EVAL_METHOD == 1
|
||||||
|
typedef double float_t;
|
||||||
|
typedef double double_t;
|
||||||
|
#elif FLT_EVAL_METHOD == 2
|
||||||
|
typedef long double float_t;
|
||||||
|
typedef long double double_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// FIXME: define these
|
||||||
|
#if 0
|
||||||
|
int fpclassify(real-floating x);
|
||||||
|
int isfinite(real-floating x);
|
||||||
|
int isgreater(real-floating x, real-floating y);
|
||||||
|
int isgreaterequal(real-floating x, real-floating y);
|
||||||
|
int isinf(real-floating x);
|
||||||
|
int isless(real-floating x, real-floating y);
|
||||||
|
int islessequal(real-floating x, real-floating y);
|
||||||
|
int islessgreater(real-floating x, real-floating y);
|
||||||
|
int isnan(real-floating x);
|
||||||
|
int isnormal(real-floating x);
|
||||||
|
int isunordered(real-floating x, real-floating y);
|
||||||
|
int signbit(real-floating x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define M_E 2.7182818284590452354
|
||||||
|
#define M_LOG2E 1.4426950408889634074
|
||||||
|
#define M_LOG10E 0.43429448190325182765
|
||||||
|
#define M_LN2 0.69314718055994530942
|
||||||
|
#define M_LN10 2.30258509299404568402
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#define M_PI_2 1.57079632679489661923
|
||||||
|
#define M_PI_4 0.78539816339744830962
|
||||||
|
#define M_1_PI 0.31830988618379067154
|
||||||
|
#define M_2_PI 0.63661977236758134308
|
||||||
|
#define M_2_SQRTPI 1.12837916709551257390
|
||||||
|
#define M_SQRT2 1.41421356237309504880
|
||||||
|
#define M_SQRT1_2 0.70710678118654752440
|
||||||
|
|
||||||
|
#define HUGE_VAL 1e10000
|
||||||
|
#define HUGE_VALF 1e10000f
|
||||||
|
#define HUGE_VALL 1e10000L
|
||||||
|
#define INFINITY HUGE_VALf
|
||||||
|
#define NAN (0.0f / 0.0f)
|
||||||
|
|
||||||
|
#define FP_INFINITE 0
|
||||||
|
#define FP_NAN 1
|
||||||
|
#define FP_NORMAL 2
|
||||||
|
#define FP_SUBNORMAL 3
|
||||||
|
#define FP_ZERO 4
|
||||||
|
|
||||||
|
#define FP_ILOGB0 -2147483647
|
||||||
|
#define FP_ILOGBNAN +2147483647
|
||||||
|
|
||||||
|
#define MATH_ERRNO 1
|
||||||
|
#define MATH_ERREXCEPT 2
|
||||||
|
|
||||||
|
#define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
|
||||||
|
|
||||||
double acos(double);
|
double acos(double);
|
||||||
float acosf(float);
|
float acosf(float);
|
||||||
|
@ -190,4 +250,8 @@ double y0(double);
|
||||||
double y1(double);
|
double y1(double);
|
||||||
double yn(int, double);
|
double yn(int, double);
|
||||||
|
|
||||||
|
extern int signgam;
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _MONETARY_H
|
||||||
|
#define _MONETARY_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/monetary.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define __need_ssize_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
ssize_t strfmon(char* __restrict s, size_t maxsize, const char* __restrict format, ...);
|
||||||
|
ssize_t strfmon_l(char* __restrict s, size_t maxsize, locale_t locale, const char* __restrict format, ...);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef _MQUEUE_H
|
||||||
|
#define _MQUEUE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define __need_pthread_attr_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef int mqd_t;
|
||||||
|
|
||||||
|
struct mq_attr
|
||||||
|
{
|
||||||
|
long mq_flags; /* Message queue flags. */
|
||||||
|
long mq_maxmsg; /* Maximum number of messages. */
|
||||||
|
long mq_msgsize; /* Maximum message size. */
|
||||||
|
long mq_curmsgs; /* Number of messages currently queued. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int mq_close(mqd_t mqdes);
|
||||||
|
int mq_getattr(mqd_t mqdes, struct mq_attr* mqstat);
|
||||||
|
int mq_notify(mqd_t mqdes, const struct sigevent* notification);
|
||||||
|
mqd_t mq_open(const char* name, int oflag, ...);
|
||||||
|
ssize_t mq_receive(mqd_t mqdes, char* msq_ptr, size_t msq_len, unsigned* msg_prio);
|
||||||
|
int mq_send(mqd_t mqdes, const char* msg_ptr, size_t msg_len, unsigned msg_prio);
|
||||||
|
int mq_setattr(mqd_t mqdes, const struct mq_attr* __restrict mqstat, struct mq_attr* __restrict omqstat);
|
||||||
|
ssize_t mq_timedreceive(mqd_t mqdes, char* __restrict msg_ptr, size_t msg_len, unsigned* __restrict msg_prio, const struct timespec* __restrict abstime);
|
||||||
|
int mq_timedsend(mqd_t mqdes, const char* msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec* abstime);
|
||||||
|
int mq_unlink(const char* name);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef _NDBM_H
|
||||||
|
#define _NDBM_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define DBM_REPLACE 1
|
||||||
|
#define DBM_INSERT 0
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define __need_mode_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void* dptr; /* A pointer to the application's data. */
|
||||||
|
size_t dsize; /* The size of the object pointed to by dptr */
|
||||||
|
} datum;
|
||||||
|
|
||||||
|
typedef int DBM;
|
||||||
|
|
||||||
|
int dbm_clearerr(DBM* db);
|
||||||
|
void dbm_close(DBM* db);
|
||||||
|
int dbm_delete(DBM* db, datum key);
|
||||||
|
int dbm_error(DBM* db);
|
||||||
|
datum dbm_fetch(DBM* db, datum key);
|
||||||
|
datum dbm_firstkey(DBM* db);
|
||||||
|
datum dbm_nextkey(DBM* db);
|
||||||
|
DBM* dbm_open(const char* file, int open_flags, mode_t file_mode);
|
||||||
|
int dbm_store(DBM* db, datum key, datum content, int store_mode);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef _NET_IF_H
|
||||||
|
#define _NET_IF_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
#define IF_NAMESIZE 16
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
struct if_nameindex
|
||||||
|
{
|
||||||
|
unsigned if_index; /* Numeric index of the interface. */
|
||||||
|
char* if_name; /* Null-terminated name of the interface. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void if_freenameindex(struct if_nameindex* ptr);
|
||||||
|
char* if_indextoname(unsigned ifindex, char* ifname);
|
||||||
|
struct if_nameindex* if_nameindex(void);
|
||||||
|
unsigned if_nametoindex(const char* ifname);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,111 @@
|
||||||
|
#ifndef _NETDB_H
|
||||||
|
#define _NETDB_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#define IPPORT_RESERVED 1024
|
||||||
|
|
||||||
|
#define AI_PASSIVE 0x01
|
||||||
|
#define AI_CANONNAME 0x02
|
||||||
|
#define AI_NUMERICHOST 0x04
|
||||||
|
#define AI_NUMERICSERV 0x08
|
||||||
|
#define AI_V4MAPPED 0x10
|
||||||
|
#define AI_ALL 0x20
|
||||||
|
#define AI_ADDRCONFIG 0x40
|
||||||
|
|
||||||
|
#define NI_NOFQDN 0x01
|
||||||
|
#define NI_NUMERICHOST 0x02
|
||||||
|
#define NI_NAMEREQD 0x04
|
||||||
|
#define NI_NUMERICSERV 0x08
|
||||||
|
#define NI_NUMERICSCOPE 0x10
|
||||||
|
#define NI_DGRAM 0x20
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
struct hostent
|
||||||
|
{
|
||||||
|
char* h_name; /* Official name of the host. */
|
||||||
|
char** h_aliases; /* A pointer to an array of pointers to alternative host names, terminated by a null pointer. */
|
||||||
|
int h_addrtype; /* Address type. */
|
||||||
|
int h_length; /* The length, in bytes, of the address. */
|
||||||
|
char** h_addr_list; /* A pointer to an array of pointers to network addresses (in network byte order) for the host, terminated by a null pointer. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct netent
|
||||||
|
{
|
||||||
|
char* n_name; /* Official, fully-qualified (including the domain) name of the host. */
|
||||||
|
char** n_aliases; /* A pointer to an array of pointers to alternative network names, terminated by a null pointer. */
|
||||||
|
int n_addrtype; /* The address type of the network. */
|
||||||
|
uint32_t n_net; /* The network number, in host byte order. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct protoent
|
||||||
|
{
|
||||||
|
char* p_name; /* Official name of the protocol. */
|
||||||
|
char** p_aliases; /* A pointer to an array of pointers to alternative protocol names, terminated by a null pointer. */
|
||||||
|
int p_proto; /* The protocol number. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct servent
|
||||||
|
{
|
||||||
|
char* s_name; /* Official name of the service. */
|
||||||
|
char** s_aliases; /* A pointer to an array of pointers to alternative service names, terminated by a null pointer. */
|
||||||
|
int s_port; /* A value which, when converted to uint16_t, yields the port number in network byte order at which the service resides. */
|
||||||
|
char* s_proto; /* The name of the protocol to use when contacting the service. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct addrinfo
|
||||||
|
{
|
||||||
|
int ai_flags; /* Input flags. */
|
||||||
|
int ai_family; /* Address family of socket. */
|
||||||
|
int ai_socktype; /* Socket type. */
|
||||||
|
int ai_protocol; /* Protocol of socket. */
|
||||||
|
socklen_t ai_addrlen; /* Length of socket address. */
|
||||||
|
struct sockaddr* ai_addr; /* Socket address of socket. */
|
||||||
|
char* ai_canonname; /* Canonical name of service location. */
|
||||||
|
struct addrinfo* ai_next; /* Pointer to next in list. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void endhostent(void);
|
||||||
|
void endnetent(void);
|
||||||
|
void endprotoent(void);
|
||||||
|
void endservent(void);
|
||||||
|
void freeaddrinfo(struct addrinfo* ai);
|
||||||
|
const char* gai_strerror(int ecode);
|
||||||
|
int getaddrinfo(const char* __restrict nodename, const char* __restrict servname, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res);
|
||||||
|
struct hostent* gethostent(void);
|
||||||
|
int getnameinfo(const struct sockaddr* __restrict sa, socklen_t salen, char* __restrict node, socklen_t nodelen, char* __restrict service, socklen_t servicelen, int flags);
|
||||||
|
struct netent* getnetbyaddr(uint32_t net, int type);
|
||||||
|
struct netent* getnetbyname(const char* name);
|
||||||
|
struct netent* getnetent(void);
|
||||||
|
struct protoent* getprotobyname(const char* name);
|
||||||
|
struct protoent* getprotobynumber(int proto);
|
||||||
|
struct protoent* getprotoent(void);
|
||||||
|
struct servent* getservbyname(const char* name, const char* proto);
|
||||||
|
struct servent* getservbyport(int port, const char* proto);
|
||||||
|
struct servent* getservent(void);
|
||||||
|
void sethostent(int stayopen);
|
||||||
|
void setnetent(int stayopen);
|
||||||
|
void setprotoent(int stayopen);
|
||||||
|
void setservent(int stayopen);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,92 @@
|
||||||
|
#ifndef _NETINET_IN_H
|
||||||
|
#define _NETINET_IN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#define IPPROTO_IP 1
|
||||||
|
#define IPPROTO_IPV6 2
|
||||||
|
#define IPPROTO_ICMP 3
|
||||||
|
#define IPPROTO_RAW 4
|
||||||
|
#define IPPROTO_TCP 5
|
||||||
|
#define IPPROTO_UDP 6
|
||||||
|
|
||||||
|
#define IPV6_JOIN_GROUP 1
|
||||||
|
#define IPV6_LEAVE_GROUP 2
|
||||||
|
#define IPV6_MULTICAST_HOPS 3
|
||||||
|
#define IPV6_MULTICAST_IF 4
|
||||||
|
#define IPV6_MULTICAST_LOOP 5
|
||||||
|
#define IPV6_UNICAST_HOPS 6
|
||||||
|
#define IPV6_V6ONLY 7
|
||||||
|
|
||||||
|
#define INADDR_ANY 0
|
||||||
|
#define INADDR_BROADCAST UINT32_MAX
|
||||||
|
|
||||||
|
#define INET_ADDRSTRLEN 16
|
||||||
|
#define INET6_ADDRSTRLEN 46
|
||||||
|
|
||||||
|
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
||||||
|
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define IN6_IS_ADDR_UNSPECIFIED(addr)
|
||||||
|
#define IN6_IS_ADDR_LOOPBACK(addr)
|
||||||
|
#define IN6_IS_ADDR_MULTICAST(addr)
|
||||||
|
#define IN6_IS_ADDR_LINKLOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_SITELOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_V4MAPPED(addr)
|
||||||
|
#define IN6_IS_ADDR_V4COMPAT(addr)
|
||||||
|
#define IN6_IS_ADDR_MC_NODELOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_MC_LINKLOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_MC_SITELOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_MC_ORGLOCAL(addr)
|
||||||
|
#define IN6_IS_ADDR_MC_GLOBAL(addr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef uint16_t in_port_t;
|
||||||
|
typedef uint32_t in_addr_t;
|
||||||
|
|
||||||
|
struct in_addr
|
||||||
|
{
|
||||||
|
in_addr_t s_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sockaddr_in
|
||||||
|
{
|
||||||
|
sa_family_t sin_family; /* AF_INET. */
|
||||||
|
in_port_t sin_port; /* Port number. */
|
||||||
|
struct in_addr sin_addr; /* IP address. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct in6_addr
|
||||||
|
{
|
||||||
|
uint8_t s6_addr[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sockaddr_in6
|
||||||
|
{
|
||||||
|
sa_family_t sin6_family; /* AF_INET6. */
|
||||||
|
in_port_t sin6_port; /* Port number. */
|
||||||
|
uint32_t sin6_flowinfo; /* IPv6 traffic class and flow information. */
|
||||||
|
struct in6_addr sin6_addr; /* IPv6 address. */
|
||||||
|
uint32_t sin6_scope_id; /* Set of interfaces for a scope. */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const struct in6_addr in6addr_any;
|
||||||
|
extern const struct in6_addr in6addr_loopback;
|
||||||
|
|
||||||
|
struct ipv6_mreq
|
||||||
|
{
|
||||||
|
struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast address. */
|
||||||
|
unsigned ipv6mr_interface; /* Interface index. */
|
||||||
|
};
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __NETINET_TCP_H
|
||||||
|
#define __NETINET_TCP_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define TCP_NODELAY 1
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _NL_TYPES_H
|
||||||
|
#define _NL_TYPES_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/nl_types.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef void* nl_catd;
|
||||||
|
typedef int nl_item;
|
||||||
|
|
||||||
|
#define NL_SETD 1
|
||||||
|
#define NL_CAT_LOCALE 1
|
||||||
|
|
||||||
|
int charclose(nl_catd catd);
|
||||||
|
char* catgets(nl_catd catd, int set_id, int msg_id, const char* s);
|
||||||
|
nl_catd catopen(const char* name, int oflag);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef _POLL_H
|
||||||
|
#define _POLL_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
struct pollfd
|
||||||
|
{
|
||||||
|
int fd; /* The following descriptor being polled. */
|
||||||
|
short events; /* The input event flags. */
|
||||||
|
short revents; /* The output event flags. */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef unsigned long nfds_t;
|
||||||
|
|
||||||
|
#define POLLIN 0x001
|
||||||
|
#define POLLRDNORM 0x002
|
||||||
|
#define POLLRDBAND 0x004
|
||||||
|
#define POLLPRI 0x008
|
||||||
|
#define POLLOUT 0x010
|
||||||
|
#define POLLWRNORM 0x020
|
||||||
|
#define POLLWRBAND 0x040
|
||||||
|
#define POLLERR 0x080
|
||||||
|
#define POLLHUP 0x100
|
||||||
|
#define POLLNVAL 0x200
|
||||||
|
|
||||||
|
int poll(struct pollfd fds[], nfds_t nfds, int timeout);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,165 @@
|
||||||
|
#ifndef _PTHREAD_H
|
||||||
|
#define _PTHREAD_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <sched.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_clockid_t
|
||||||
|
#define __need_pthread_attr_t
|
||||||
|
#define __need_pthread_barrier_t
|
||||||
|
#define __need_pthread_barrierattr_t
|
||||||
|
#define __need_pthread_cond_t
|
||||||
|
#define __need_pthread_condattr_t
|
||||||
|
#define __need_pthread_key_t
|
||||||
|
#define __need_pthread_mutex_t
|
||||||
|
#define __need_pthread_mutexattr_t
|
||||||
|
#define __need_pthread_once_t
|
||||||
|
#define __need_pthread_rwlock_t
|
||||||
|
#define __need_pthread_rwlockattr_t
|
||||||
|
#define __need_pthread_spinlock_t
|
||||||
|
#define __need_pthread_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define PTHREAD_BARRIER_SERIAL_THREAD 1
|
||||||
|
#define PTHREAD_CANCEL_ASYNCHRONOUS 2
|
||||||
|
#define PTHREAD_CANCEL_ENABLE 3
|
||||||
|
#define PTHREAD_CANCEL_DEFERRED 4
|
||||||
|
#define PTHREAD_CANCEL_DISABLE 5
|
||||||
|
#define PTHREAD_CANCELED 6
|
||||||
|
#define PTHREAD_CREATE_DETACHED 7
|
||||||
|
#define PTHREAD_CREATE_JOINABLE 8
|
||||||
|
#define PTHREAD_EXPLICIT_SCHED 9
|
||||||
|
#define PTHREAD_INHERIT_SCHED 10
|
||||||
|
#define PTHREAD_MUTEX_DEFAULT 11
|
||||||
|
#define PTHREAD_MUTEX_ERRORCHECK 12
|
||||||
|
#define PTHREAD_MUTEX_NORMAL 13
|
||||||
|
#define PTHREAD_MUTEX_RECURSIVE 14
|
||||||
|
#define PTHREAD_MUTEX_ROBUST 15
|
||||||
|
#define PTHREAD_MUTEX_STALLED 16
|
||||||
|
#define PTHREAD_ONCE_INIT 17
|
||||||
|
#define PTHREAD_PRIO_INHERIT 18
|
||||||
|
#define PTHREAD_PRIO_NONE 19
|
||||||
|
#define PTHREAD_PRIO_PROTECT 20
|
||||||
|
#define PTHREAD_PROCESS_SHARED 21
|
||||||
|
#define PTHREAD_PROCESS_PRIVATE 22
|
||||||
|
#define PTHREAD_SCOPE_PROCESS 23
|
||||||
|
#define PTHREAD_SCOPE_SYSTEM 24
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define PTHREAD_COND_INITIALIZER
|
||||||
|
#define PTHREAD_MUTEX_INITIALIZER
|
||||||
|
#define PTHREAD_RWLOCK_INITIALIZER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void(*child)(void));
|
||||||
|
int pthread_attr_destroy(pthread_attr_t* attr);
|
||||||
|
int pthread_attr_getdetachstate(const pthread_attr_t* attr, int* detachstate);
|
||||||
|
int pthread_attr_getguardsize(const pthread_attr_t* __restrict attr, size_t* __restrict guardsize);
|
||||||
|
int pthread_attr_getinheritsched(const pthread_attr_t* __restrict attr, int* __restrict inheritsched);
|
||||||
|
int pthread_attr_getschedparam(const pthread_attr_t* __restrict attr, struct sched_param* __restrict param);
|
||||||
|
int pthread_attr_getschedpolicy(const pthread_attr_t* __restrict attr, int* __restrict policy);
|
||||||
|
int pthread_attr_getscope(const pthread_attr_t* __restrict attr, int* __restrict contentionscope);
|
||||||
|
int pthread_attr_getstack(const pthread_attr_t* __restrict attr, void** __restrict stackaddr, size_t* __restrict stacksize);
|
||||||
|
int pthread_attr_getstacksize(const pthread_attr_t* __restrict attr, size_t* __restrict stacksize);
|
||||||
|
int pthread_attr_init(pthread_attr_t* attr);
|
||||||
|
int pthread_attr_setdetachstate(pthread_attr_t* attr, int detachstate);
|
||||||
|
int pthread_attr_setguardsize(pthread_attr_t* attr, size_t guardsize);
|
||||||
|
int pthread_attr_setinheritsched(pthread_attr_t* attr, int inheritsched);
|
||||||
|
int pthread_attr_setschedparam(pthread_attr_t* __restrict attr, const struct sched_param* __restrict param);
|
||||||
|
int pthread_attr_setschedpolicy(pthread_attr_t* attr, int policy);
|
||||||
|
int pthread_attr_setscope(pthread_attr_t* attr, int contentionscope);
|
||||||
|
int pthread_attr_setstack(pthread_attr_t* attr, void* stackaddr, size_t stacksize);
|
||||||
|
int pthread_attr_setstacksize(pthread_attr_t* attr, size_t stacksize);
|
||||||
|
int pthread_barrier_destroy(pthread_barrier_t* barrier);
|
||||||
|
int pthread_barrier_init(pthread_barrier_t* __restrict barrier, const pthread_barrierattr_t* __restrict attr, unsigned count);
|
||||||
|
int pthread_barrier_wait(pthread_barrier_t* barrier);
|
||||||
|
int pthread_barrierattr_destroy(pthread_barrierattr_t* attr);
|
||||||
|
int pthread_barrierattr_getpshared( const pthread_barrierattr_t* __restrict attr, int* __restrict pshared);
|
||||||
|
int pthread_barrierattr_init(pthread_barrierattr_t* attr);
|
||||||
|
int pthread_barrierattr_setpshared(pthread_barrierattr_t* attr, int pshared);
|
||||||
|
int pthread_cancel(pthread_t thread);
|
||||||
|
int pthread_cond_broadcast(pthread_cond_t* cond);
|
||||||
|
int pthread_cond_destroy(pthread_cond_t* cond);
|
||||||
|
int pthread_cond_init(pthread_cond_t* __restrict cond, const pthread_condattr_t* __restrict attr);
|
||||||
|
int pthread_cond_signal(pthread_cond_t* cond);
|
||||||
|
int pthread_cond_timedwait(pthread_cond_t* __restrict cond, pthread_mutex_t* __restrict mutex, const struct timespec* __restrict abstime);
|
||||||
|
int pthread_cond_wait(pthread_cond_t* __restrict cond, pthread_mutex_t* __restrict mutex);
|
||||||
|
int pthread_condattr_destroy(pthread_condattr_t* attr);
|
||||||
|
int pthread_condattr_getclock(const pthread_condattr_t* __restrict attr, clockid_t* __restrict clock_id);
|
||||||
|
int pthread_condattr_getpshared(const pthread_condattr_t* __restrict attr, int* __restrict pshared);
|
||||||
|
int pthread_condattr_init(pthread_condattr_t* attr);
|
||||||
|
int pthread_condattr_setclock(pthread_condattr_t* attr, clockid_t clock_id);
|
||||||
|
int pthread_condattr_setpshared(pthread_condattr_t* attr, int pshared);
|
||||||
|
int pthread_create(pthread_t* __restrict thread, const pthread_attr_t* __restrict attr, void *(*start_routine)(void*), void* __restrict arg);
|
||||||
|
int pthread_detach(pthread_t thread);
|
||||||
|
int pthread_equal(pthread_t t1, pthread_t t2);
|
||||||
|
void pthread_exit(void* value_ptr);
|
||||||
|
int pthread_getconcurrency(void);
|
||||||
|
int pthread_getcpuclockid(pthread_t thread_id, clockid_t* clock_id);
|
||||||
|
int pthread_getschedparam(pthread_t thread, int* __restrict policy, struct sched_param* __restrict param);
|
||||||
|
void* pthread_getspecific(pthread_key_t key);
|
||||||
|
int pthread_join(pthread_t thread, void** value_ptr);
|
||||||
|
int pthread_key_create(pthread_key_t* key, void (*destructor)(void*));
|
||||||
|
int pthread_key_delete(pthread_key_t key);
|
||||||
|
int pthread_mutex_consistent(pthread_mutex_t* mutex);
|
||||||
|
int pthread_mutex_destroy(pthread_mutex_t* mutex);
|
||||||
|
int pthread_mutex_getprioceiling(const pthread_mutex_t* __restrict mutex, int* __restrict prioceiling);
|
||||||
|
int pthread_mutex_init(pthread_mutex_t* __restrict mutex, const pthread_mutexattr_t* __restrict attr);
|
||||||
|
int pthread_mutex_lock(pthread_mutex_t* mutex);
|
||||||
|
int pthread_mutex_setprioceiling(pthread_mutex_t* __restrict mutex, int prioceiling, int* __restrict old_ceiling);
|
||||||
|
int pthread_mutex_timedlock(pthread_mutex_t* __restrict mutex, const struct timespec* __restrict abstime);
|
||||||
|
int pthread_mutex_trylock(pthread_mutex_t* mutex);
|
||||||
|
int pthread_mutex_unlock(pthread_mutex_t* mutex);
|
||||||
|
int pthread_mutexattr_destroy(pthread_mutexattr_t* attr);
|
||||||
|
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t* __restrict attr, int* __restrict prioceiling);
|
||||||
|
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t* __restrict attr, int* __restrict protocol);
|
||||||
|
int pthread_mutexattr_getpshared(const pthread_mutexattr_t* __restrict attr, int* __restrict pshared);
|
||||||
|
int pthread_mutexattr_getrobust(const pthread_mutexattr_t* __restrict attr, int* __restrict robust);
|
||||||
|
int pthread_mutexattr_gettype(const pthread_mutexattr_t* __restrict attr, int* __restrict type);
|
||||||
|
int pthread_mutexattr_init(pthread_mutexattr_t* attr);
|
||||||
|
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t* attr, int prioceiling);
|
||||||
|
int pthread_mutexattr_setprotocol(pthread_mutexattr_t* attr, int protocol);
|
||||||
|
int pthread_mutexattr_setpshared(pthread_mutexattr_t* attr, int pshared);
|
||||||
|
int pthread_mutexattr_setrobust(pthread_mutexattr_t* attr, int robust);
|
||||||
|
int pthread_mutexattr_settype(pthread_mutexattr_t* attr, int type);
|
||||||
|
int pthread_once(pthread_once_t* once_control, void (*init_routine)(void));
|
||||||
|
int pthread_rwlock_destroy(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlock_init(pthread_rwlock_t* __restrict rwlock, const pthread_rwlockattr_t* __restrict attr);
|
||||||
|
int pthread_rwlock_rdlock(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlock_timedrdlock(pthread_rwlock_t* __restrict rwlock, const struct timespec* __restrict abstime);
|
||||||
|
int pthread_rwlock_timedwrlock(pthread_rwlock_t* __restrict rwlock, const struct timespec* __restrict abstime);
|
||||||
|
int pthread_rwlock_tryrdlock(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlock_trywrlock(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlock_unlock(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlock_wrlock(pthread_rwlock_t* rwlock);
|
||||||
|
int pthread_rwlockattr_destroy(pthread_rwlockattr_t* attr);
|
||||||
|
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __restrict attr, int* __restrict pshared);
|
||||||
|
int pthread_rwlockattr_init(pthread_rwlockattr_t* attr);
|
||||||
|
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t* attr, int pshared);
|
||||||
|
pthread_t pthread_self(void);
|
||||||
|
int pthread_setcancelstate(int state, int* oldstate);
|
||||||
|
int pthread_setcanceltype(int type, int* oldtype);
|
||||||
|
int pthread_setconcurrency(int new_level);
|
||||||
|
int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param* param);
|
||||||
|
int pthread_setschedprio(pthread_t thread, int prio);
|
||||||
|
int pthread_setspecific(pthread_key_t key, const void* value);
|
||||||
|
int pthread_spin_destroy(pthread_spinlock_t* lock);
|
||||||
|
int pthread_spin_init(pthread_spinlock_t* lock, int pshared);
|
||||||
|
int pthread_spin_lock(pthread_spinlock_t* lock);
|
||||||
|
int pthread_spin_trylock(pthread_spinlock_t* lock);
|
||||||
|
int pthread_spin_unlock(pthread_spinlock_t* lock);
|
||||||
|
void pthread_testcancel(void);
|
||||||
|
|
||||||
|
void pthread_cleanup_pop(int execute);
|
||||||
|
void pthread_cleanup_push(void (*routine)(void*), void* arg);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef _PWD_H
|
||||||
|
#define _PWD_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_gid_t
|
||||||
|
#define __need_uid_t
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct passwd
|
||||||
|
{
|
||||||
|
char* pw_name; /* User's login name. */
|
||||||
|
uid_t pw_uid; /* Numerical user ID. */
|
||||||
|
gid_t pw_gid; /* Numerical group ID. */
|
||||||
|
char* pw_dir; /* Initial working directory. */
|
||||||
|
char* pw_shell; /* Program to use as shell. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void endpwent(void);
|
||||||
|
struct passwd* getpwent(void);
|
||||||
|
struct passwd* getpwnam(const char* name);
|
||||||
|
int getpwnam_r(const char* name, struct passwd* pwd, char* buffer, size_t bufsize, struct passwd** result);
|
||||||
|
struct passwd* getpwuid(uid_t uid);
|
||||||
|
int getpwuid_r(uid_t uid, struct passwd* pwd, char* buffer, size_t bufsize, struct passwd** result);
|
||||||
|
void setpwent(void);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef _REGEX_H
|
||||||
|
#define _REGEX_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
size_t re_nsub;
|
||||||
|
} regex_t;
|
||||||
|
|
||||||
|
typedef __PTRDIFF_TYPE__ regoff_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
regoff_t rm_so; /* Byte offset from start of string to start of substring. */
|
||||||
|
regoff_t rm_eo; /* Byte offset from start of string of the first character after the end of substring. */
|
||||||
|
} regmatch_t;
|
||||||
|
|
||||||
|
#define REG_EXTENDED 0x01
|
||||||
|
#define REG_ICASE 0x02
|
||||||
|
#define REG_NOSUB 0x04
|
||||||
|
#define REG_NEWLINE 0x80
|
||||||
|
|
||||||
|
#define REG_NOTBOL 0x0001
|
||||||
|
#define REG_NOTEOL 0x0002
|
||||||
|
#define REG_NOMATCH 0x0004
|
||||||
|
#define REG_BADPAT 0x0008
|
||||||
|
#define REG_ECOLLATE 0x0010
|
||||||
|
#define REG_ECTYPE 0x0020
|
||||||
|
#define REG_EESCAPE 0x0040
|
||||||
|
#define REG_ESUBREG 0x0080
|
||||||
|
#define REG_EBRACK 0x0100
|
||||||
|
#define REG_EPAREN 0x0200
|
||||||
|
#define REG_EBRACE 0x0400
|
||||||
|
#define REG_BADBR 0x0800
|
||||||
|
#define REG_ERANGE 0x1000
|
||||||
|
#define REG_ESPACE 0x2000
|
||||||
|
#define REG_BADRPT 0x4000
|
||||||
|
|
||||||
|
int regcomp(regex_t* __restrict preg, const char* __restrict pattern, int cflags);
|
||||||
|
size_t regerror(int errcode, const regex_t* __restrict preg, char* __restrict errbuf, size_t errbuf_size);
|
||||||
|
int regexec(const regex_t* __restrict preg, const char* __restrict string, size_t nmatch, regmatch_t pmatch[__restrict], int eflags);
|
||||||
|
void regfree(regex_t* preg);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef _SCHED_H
|
||||||
|
#define _SCHED_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct sched_param
|
||||||
|
{
|
||||||
|
int sched_priority; /* Process or thread execution scheduling priority. */
|
||||||
|
int sched_ss_low_priority; /* Low scheduling priority for sporadic server. */
|
||||||
|
struct timespec sched_ss_repl_period; /* Replenishment period for sporadic server. */
|
||||||
|
struct timespec sched_ss_init_budget; /* Initial budget for sporadic server. */
|
||||||
|
int sched_ss_max_repl; /* Maximum pending replenishments for sporadic server. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SCHED_FIFO 1
|
||||||
|
#define SCHED_RR 2
|
||||||
|
#define SCHED_SPORADIC 3
|
||||||
|
#define SCHED_OTHER 4
|
||||||
|
|
||||||
|
int sched_get_priority_max(int policy);
|
||||||
|
int sched_get_priority_min(int policy);
|
||||||
|
int sched_getparam(pid_t pid, struct sched_param* param);
|
||||||
|
int sched_getscheduler(pid_t pid);
|
||||||
|
int sched_rr_get_interval(pid_t pid, struct timespec* interval);
|
||||||
|
int sched_setparam(pid_t pid, const struct sched_param* param);
|
||||||
|
int sched_setscheduler(pid_t pid, int, const struct sched_param* param);
|
||||||
|
int sched_yield(void);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,36 @@
|
||||||
|
#ifndef _SEARCH_H
|
||||||
|
#define _SEARCH_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/search.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char* key;
|
||||||
|
void* data;
|
||||||
|
} ENTRY;
|
||||||
|
|
||||||
|
typedef enum { FIND, ENTER } ACTION;
|
||||||
|
typedef enum { preorder, postorder, endorder, leaf } VISIT;
|
||||||
|
|
||||||
|
int hcreate(size_t nel);
|
||||||
|
void hdestroy(void);
|
||||||
|
ENTRY* hsearch(ENTRY item, ACTION action);
|
||||||
|
void insque(void* element, void* pred);
|
||||||
|
void* lfind(const void* key, const void* base, size_t* nelp, size_t width, int (*compar)(const void*, const void*));
|
||||||
|
void* lsearch(const void* key, void* base, size_t* nelp, size_t width, int (*compar)(const void*, const void*));
|
||||||
|
void remque(void* element);
|
||||||
|
void* tdelete(const void* __restrict key, void** __restrict rootp, int(*compar)(const void*, const void*));
|
||||||
|
void* tfind(const void* key, void* const* rootp, int(*compar)(const void*, const void*));
|
||||||
|
void* tsearch(const void* key, void** rootp, int(*compar)(const void*, const void*));
|
||||||
|
void twalk(const void* root, void (*action)(const void*, VISIT, int));
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef _SEMAPHORE_H
|
||||||
|
#define _SEMAPHORE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
typedef void* sem_t;
|
||||||
|
|
||||||
|
#define SEM_FAILED ((sem_t*)0)
|
||||||
|
|
||||||
|
int sem_close(sem_t* sem);
|
||||||
|
int sem_destroy(sem_t* sem);
|
||||||
|
int sem_getvalue(sem_t* __restrict sem, int* __restrict sval);
|
||||||
|
int sem_init(sem_t* sem, int pshared, unsigned value);
|
||||||
|
sem_t* sem_open(const char* name, int oflag, ...);
|
||||||
|
int sem_post(sem_t* sem);
|
||||||
|
int sem_timedwait(sem_t* __restrict sem, const struct timespec* __restrict abstime);
|
||||||
|
int sem_trywait(sem_t* sem);
|
||||||
|
int sem_unlink(const char* name);
|
||||||
|
int sem_wait(sem_t* sem);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,19 +1,20 @@
|
||||||
#pragma once
|
#ifndef _SETJMP_H
|
||||||
|
#define _SETJMP_H 1
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/setjmp.h.html
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/setjmp.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef int* jmp_buf;
|
typedef int jmp_buf[1];
|
||||||
typedef int* sigjmp_buf;
|
typedef int sigjmp_buf[1];
|
||||||
|
|
||||||
void _longjmp(jmp_buf, int);
|
void longjmp(jmp_buf env, int val);
|
||||||
void longjmp(jmp_buf, int);
|
void siglongjmp(sigjmp_buf env, int val);
|
||||||
void siglongjmp(sigjmp_buf, int);
|
int setjmp(jmp_buf env);
|
||||||
int _setjmp(jmp_buf);
|
int sigsetjmp(sigjmp_buf env, int savemask);
|
||||||
int setjmp(jmp_buf);
|
|
||||||
int sigsetjmp(sigjmp_buf, int);
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,12 +1,167 @@
|
||||||
#pragma onces
|
#ifndef _SIGNAL_H
|
||||||
|
#define _SIGNAL_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef int sig_atomic_t;
|
#include <time.h>
|
||||||
|
|
||||||
int raise(int);
|
#define SIG_DFL 1
|
||||||
void (*signal(int, void (*)(int)))(int);
|
#define SIG_ERR 2
|
||||||
|
#define SIG_HOLD 3
|
||||||
|
#define SIG_IGN 4
|
||||||
|
|
||||||
|
#define __need_pthread_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_uid_t
|
||||||
|
#define __need_pid_t
|
||||||
|
#define __need_pthread_attr_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef int sigatomic_t;
|
||||||
|
typedef void* sigset_t;
|
||||||
|
|
||||||
|
union sigval
|
||||||
|
{
|
||||||
|
int sival_int; /* Integer signal value. */
|
||||||
|
void* sival_ptr; /* Pointer signal value. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sigevent
|
||||||
|
{
|
||||||
|
int sigev_notify; /* Notification type. */
|
||||||
|
int sigev_signo; /* Signal number. */
|
||||||
|
union sigval sigev_value; /* Signal value. */
|
||||||
|
void (*sigev_notify_function)(union sigval); /* Notification function. */
|
||||||
|
pthread_attr_t* sigev_notify_attributes; /* Notification attributes. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SIGEV_NONE 1
|
||||||
|
#define SIGEV_SIGNAL 2
|
||||||
|
#define SIGEV_THREAD 3
|
||||||
|
|
||||||
|
#define SIGABRT 1
|
||||||
|
#define SIGALRM 2
|
||||||
|
#define SIGBUS 3
|
||||||
|
#define SIGCHLD 4
|
||||||
|
#define SIGCONT 5
|
||||||
|
#define SIGFPE 6
|
||||||
|
#define SIGHUP 7
|
||||||
|
#define SIGILL 8
|
||||||
|
#define SIGINT 9
|
||||||
|
#define SIGKILL 10
|
||||||
|
#define SIGPIPE 11
|
||||||
|
#define SIGQUIT 12
|
||||||
|
#define SIGSEGV 13
|
||||||
|
#define SIGSTOP 14
|
||||||
|
#define SIGTERM 15
|
||||||
|
#define SIGTSTP 16
|
||||||
|
#define SIGTTIN 17
|
||||||
|
#define SIGTTOU 18
|
||||||
|
#define SIGUSR1 19
|
||||||
|
#define SIGUSR2 20
|
||||||
|
#define SIGPOLL 21
|
||||||
|
#define SIGPROF 22
|
||||||
|
#define SIGSYS 23
|
||||||
|
#define SIGTRAP 24
|
||||||
|
#define SIGURG 25
|
||||||
|
#define SIGVTALRM 26
|
||||||
|
#define SIGXCPU 27
|
||||||
|
#define SIGXFSZ 28
|
||||||
|
#define SIGRTMIN 29
|
||||||
|
#define SIGRTMAX (SIGRTMIN+32)
|
||||||
|
|
||||||
|
#define SIG_BLOCK 1
|
||||||
|
#define SIG_UNBLOCK 2
|
||||||
|
#define SIG_SETMASK 3
|
||||||
|
|
||||||
|
#define SA_NOCLDSTOP 0x001
|
||||||
|
#define SA_ONSTACK 0x002
|
||||||
|
#define SA_RESETHAND 0x004
|
||||||
|
#define SA_RESTART 0x008
|
||||||
|
#define SA_SIGINFO 0x010
|
||||||
|
#define SA_NOCLDWAIT 0x020
|
||||||
|
#define SA_NODEFER 0x040
|
||||||
|
#define SS_ONSTACK 0x080
|
||||||
|
#define SS_DISABLE 0x100
|
||||||
|
#define MINSIGSTKSZ 0x200
|
||||||
|
#define SIGSTKSZ 0x400
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void** ss_sp; /* Stack base or pointer. */
|
||||||
|
size_t ss_size; /* Stack size. */
|
||||||
|
int ss_flags; /* Flags. */
|
||||||
|
} stack_t;
|
||||||
|
|
||||||
|
typedef struct {} mcontext_t;
|
||||||
|
|
||||||
|
typedef struct __ucontext_t
|
||||||
|
{
|
||||||
|
struct __ucontext_t* uc_link; /* Pointer to the context that is resumed when this context returns. */
|
||||||
|
sigset_t uc_sigmask; /* The set of signals that are blocked when this context is active. */
|
||||||
|
stack_t uc_stack; /* The stack used by this context. */
|
||||||
|
mcontext_t uc_mcontext; /* A machine-specific representation of the saved context. */
|
||||||
|
} ucontext_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int si_signo; /* Signal number. */
|
||||||
|
int si_code; /* Signal code. */
|
||||||
|
int si_errno; /* If non-zero, an errno value associated with this signal, as described in <errno.h>. */
|
||||||
|
pid_t si_pid; /* Sending process ID. */
|
||||||
|
uid_t si_uid; /* Real user ID of sending process. */
|
||||||
|
void* si_addr; /* Address of faulting instruction. */
|
||||||
|
int si_status; /* Exit value or signal. */
|
||||||
|
long si_band; /* Band event for SIGPOLL. */
|
||||||
|
union sigval si_value; /* Signal value. */
|
||||||
|
} siginfo_t;
|
||||||
|
|
||||||
|
struct sigaction
|
||||||
|
{
|
||||||
|
void (*sa_handler)(int); /* Pointer to a signal-catching function or one of the SIG_IGN or SIG_DFL. */
|
||||||
|
sigset_t sa_mask; /* Set of signals to be blocked during execution of the signal handling function. */
|
||||||
|
int sa_flags; /* Special flags. */
|
||||||
|
void (*sa_sigaction)(int, siginfo_t*, void*); /* Pointer to a signal-catching function. */
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: The <signal.h> header shall define the symbolic constants in the
|
||||||
|
// Code column of the following table for use as values of si_code
|
||||||
|
// that are signal-specific or non-signal-specific reasons why the
|
||||||
|
// signal was generated.
|
||||||
|
|
||||||
|
int kill(pid_t pid, int sig);
|
||||||
|
int killpg(pid_t pgpr, int sig);
|
||||||
|
void psiginfo(const siginfo_t* pinfo, const char* message);
|
||||||
|
void psignal(int signum, const char* message);
|
||||||
|
int pthread_kill(pthread_t thread, int sig);
|
||||||
|
int pthread_sigmask(int how, const sigset_t* __restrict set, sigset_t* __restrict oset);
|
||||||
|
int raise(int sig);
|
||||||
|
int sigaction(int sig, const struct sigaction* __restrict act, struct sigaction* __restrict oact);
|
||||||
|
int sigaddset(sigset_t* set, int signo);
|
||||||
|
int sigaltstack(const stack_t* __restrict ss, stack_t* __restrict oss);
|
||||||
|
int sigdelset(sigset_t* set, int signo);
|
||||||
|
int sigemptyset(sigset_t* set);
|
||||||
|
int sigfillset(sigset_t* set);
|
||||||
|
int sighold(int sig);
|
||||||
|
int sigignore(int sig);
|
||||||
|
int siginterrupt(int sig, int flag);
|
||||||
|
int sigismember(const sigset_t* set, int signo);
|
||||||
|
void (*signal(int sig, void (*func)(int)))(int);
|
||||||
|
int sigpause(int sig);
|
||||||
|
int sigpending(sigset_t* set);
|
||||||
|
int sigprocmask(int how, const sigset_t* __restrict set, sigset_t* __restrict oset);
|
||||||
|
int sigqueue(pid_t pid, int signo, union sigval value);
|
||||||
|
int sigrelse(int sig);
|
||||||
|
void (*sigset(int sig, void (*disp)(int)))(int);
|
||||||
|
int sigsuspend(const sigset_t* sigmask);
|
||||||
|
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);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef _SPAWN_H
|
||||||
|
#define _SPAWN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/spawn.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <sched.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define __need_mode_t
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef int posix_spawnattr_t;
|
||||||
|
typedef int posix_spawn_file_actions_t;
|
||||||
|
|
||||||
|
#define POSIX_SPAWN_RESETIDS 0x01
|
||||||
|
#define POSIX_SPAWN_SETPGROUP 0x02
|
||||||
|
#define POSIX_SPAWN_SETSCHEDPARAM 0x04
|
||||||
|
#define POSIX_SPAWN_SETSCHEDULER 0x08
|
||||||
|
#define POSIX_SPAWN_SETSIGDEF 0x10
|
||||||
|
#define POSIX_SPAWN_SETSIGMASK 0x20
|
||||||
|
|
||||||
|
int posix_spawn(pid_t* __restrict pid, const char* __restrict path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* __restrict attrp, char* const argv[__restrict], char* const envp[__restrict]);
|
||||||
|
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* file_actions, int fildes);
|
||||||
|
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* file_actions, int fildes, int newfildes);
|
||||||
|
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_spawn_file_actions_destroy(posix_spawn_file_actions_t* file_actions);
|
||||||
|
int posix_spawn_file_actions_init(posix_spawn_file_actions_t* file_actions);
|
||||||
|
int posix_spawnattr_destroy(posix_spawnattr_t* attr);
|
||||||
|
int posix_spawnattr_getflags(const posix_spawnattr_t* __restrict attr, short* __restrict flags);
|
||||||
|
int posix_spawnattr_getpgroup(const posix_spawnattr_t* __restrict attr, pid_t* __restrict pgroup);
|
||||||
|
int posix_spawnattr_getschedparam(const posix_spawnattr_t* __restrict attr, struct sched_param* __restrict schedparam);
|
||||||
|
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* __restrict attr, int* __restrict schedpolicy);
|
||||||
|
int posix_spawnattr_getsigdefault(const posix_spawnattr_t* __restrict attr, sigset_t* __restrict sigdefault);
|
||||||
|
int posix_spawnattr_getsigmask(const posix_spawnattr_t* __restrict attr, sigset_t* __restrict sigmask);
|
||||||
|
int posix_spawnattr_init(posix_spawnattr_t* attr);
|
||||||
|
int posix_spawnattr_setflags(posix_spawnattr_t* attr, short flags);
|
||||||
|
int posix_spawnattr_setpgroup(posix_spawnattr_t* attr, pid_t pgroup);
|
||||||
|
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_setsigdefault(posix_spawnattr_t* __restrict attr, const sigset_t* __restrict sigdefault);
|
||||||
|
int posix_spawnattr_setsigmask(posix_spawnattr_t* __restrict attr, const sigset_t* __restrict sigmask);
|
||||||
|
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 argc[__restrict], char* const envp[__restrict]);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,117 @@
|
||||||
|
#ifndef _STDINT_H
|
||||||
|
#define _STDINT_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef __INT8_TYPE__ int8_t;
|
||||||
|
typedef __INT16_TYPE__ int16_t;
|
||||||
|
typedef __INT32_TYPE__ int32_t;
|
||||||
|
typedef __INT64_TYPE__ int64_t;
|
||||||
|
|
||||||
|
typedef __UINT8_TYPE__ uint8_t;
|
||||||
|
typedef __UINT16_TYPE__ uint16_t;
|
||||||
|
typedef __UINT32_TYPE__ uint32_t;
|
||||||
|
typedef __UINT64_TYPE__ uint64_t;
|
||||||
|
|
||||||
|
typedef __INT_LEAST8_TYPE__ int_least8_t;
|
||||||
|
typedef __INT_LEAST16_TYPE__ int_least16_t;
|
||||||
|
typedef __INT_LEAST32_TYPE__ int_least32_t;
|
||||||
|
typedef __INT_LEAST64_TYPE__ int_least64_t;
|
||||||
|
|
||||||
|
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
|
||||||
|
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
|
||||||
|
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
|
||||||
|
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
|
||||||
|
|
||||||
|
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
||||||
|
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
||||||
|
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
||||||
|
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
||||||
|
|
||||||
|
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
||||||
|
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
||||||
|
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
||||||
|
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
||||||
|
|
||||||
|
typedef __INTPTR_TYPE__ intptr_t;
|
||||||
|
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||||
|
|
||||||
|
// FIXME: is this the correct?
|
||||||
|
typedef int64_t intmax_t;
|
||||||
|
typedef uint64_t uintmax_t;
|
||||||
|
|
||||||
|
#define INT8_MIN (-INT8_MAX - 1)
|
||||||
|
#define INT16_MIN (-INT16_MAX - 1)
|
||||||
|
#define INT32_MIN (-INT32_MAX - 1)
|
||||||
|
#define INT64_MIN (-INT64_MAX - 1)
|
||||||
|
|
||||||
|
#define INT8_MAX __INT8_MAX__
|
||||||
|
#define INT16_MAX __INT16_MAX__
|
||||||
|
#define INT32_MAX __INT32_MAX__
|
||||||
|
#define INT64_MAX __INT64_MAX__
|
||||||
|
|
||||||
|
#define UINT8_MAX __UINT8_MAX__
|
||||||
|
#define UINT16_MAX __UINT16_MAX__
|
||||||
|
#define UINT32_MAX __UINT32_MAX__
|
||||||
|
#define UINT64_MAX __UINT64_MAX__
|
||||||
|
|
||||||
|
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
|
||||||
|
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
|
||||||
|
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
|
||||||
|
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
|
||||||
|
|
||||||
|
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
|
||||||
|
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
|
||||||
|
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
|
||||||
|
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
|
||||||
|
|
||||||
|
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
|
||||||
|
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
|
||||||
|
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
|
||||||
|
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
|
||||||
|
|
||||||
|
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
||||||
|
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
||||||
|
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
||||||
|
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
||||||
|
|
||||||
|
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
||||||
|
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
||||||
|
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
||||||
|
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
||||||
|
|
||||||
|
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
||||||
|
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
||||||
|
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
||||||
|
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
||||||
|
|
||||||
|
#define INTPTR_MIN (-INTPTR_MAX - 1)
|
||||||
|
#define INTPTR_MAX __INTPTR_MAX__
|
||||||
|
#define UINPTR_MAX __UINTPTR_MAX__
|
||||||
|
|
||||||
|
// FIXME: is this the correct?
|
||||||
|
#define INTMAX_MIN INT64_MIN
|
||||||
|
#define INTMAX_MAX INT64_MAX
|
||||||
|
#define UINTMAX_MAX UINT64_MAX
|
||||||
|
|
||||||
|
#define PTRDIFF_MIN -65535
|
||||||
|
#define PTRDIFF_MAX +65535
|
||||||
|
|
||||||
|
#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
|
||||||
|
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
|
||||||
|
|
||||||
|
#define SIZE_MAX __SIZE_MAX__
|
||||||
|
|
||||||
|
#define WCHAR_MIN __WCHAR_MIN__
|
||||||
|
#define WCHAR_MAX __WCHAR_MAX__
|
||||||
|
|
||||||
|
#define WINT_MIN __WINT_MIN__
|
||||||
|
#define WINT_MAX __WINT_MAX__
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,106 +1,128 @@
|
||||||
#pragma once
|
#ifndef _STDIO_H
|
||||||
|
#define _STDIO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_ssize_t
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define EOF (-1)
|
#ifndef __va_list_defined
|
||||||
|
#define __va_list_defined
|
||||||
|
#define __need___va_list
|
||||||
|
#include <stdarg.h>
|
||||||
|
typedef __gnuc_va_list va_list;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define stdin stdin
|
#define __need_size_t
|
||||||
#define stdout stdout
|
#define __need_NULL
|
||||||
#define stderr stderr
|
#include <stddef.h>
|
||||||
|
|
||||||
#define SEEK_CUR 1
|
#include <bits/types/FILE.h>
|
||||||
#define SEEK_END 2
|
|
||||||
#define SEEK_SET 3
|
typedef off_t fpos_t;
|
||||||
|
|
||||||
|
#define BUFSIZ 1024
|
||||||
|
#define L_ctermid 20
|
||||||
|
#define L_tmpnam 20
|
||||||
|
|
||||||
#define _IOFBF 1
|
#define _IOFBF 1
|
||||||
#define _IOLBF 2
|
#define _IOLBF 2
|
||||||
#define _IONBF 3
|
#define _IONBF 3
|
||||||
|
|
||||||
#define EXIT_FAILURE 1
|
// NOTE: also defined in fcntl.h
|
||||||
#define EXIT_SUCCESS 0
|
#define SEEK_SET 1
|
||||||
|
#define SEEK_CUR 2
|
||||||
#define L_ctermid 50
|
#define SEEK_END 3
|
||||||
|
|
||||||
#define BUFSIZ 128
|
|
||||||
|
|
||||||
|
#define FILENAME_MAX 256
|
||||||
#define FOPEN_MAX 16
|
#define FOPEN_MAX 16
|
||||||
|
#define TMP_MAX 10000
|
||||||
|
|
||||||
__BEGIN_DECLS
|
#define EOF (-1)
|
||||||
|
|
||||||
struct FILE;
|
#define P_tmpdir "/tmp"
|
||||||
typedef struct FILE FILE;
|
|
||||||
|
|
||||||
typedef uint64_t fpos_t;
|
extern FILE* __stdin;
|
||||||
|
#define stdin __stdin
|
||||||
|
extern FILE* __stdout;
|
||||||
|
#define stdout __stdout
|
||||||
|
extern FILE* __stderr;
|
||||||
|
#define stderr __stderr
|
||||||
|
|
||||||
extern FILE* stdin;
|
void clearerr(FILE* stream);
|
||||||
extern FILE* stdout;
|
char* ctermid(char* s);
|
||||||
extern FILE* stderr;
|
int dprintf(int fildes, const char* __restrict format, ...);
|
||||||
|
int fclose(FILE* stream);
|
||||||
|
FILE* fdopen(int fildes, const char* mode);
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
|
int feof(FILE* stream);
|
||||||
void clearerr(FILE*);
|
int ferror(FILE* stream);
|
||||||
char* ctermid(char*);
|
int fflush(FILE* stream);
|
||||||
int fclose(FILE*);
|
int fgetc(FILE* stream);
|
||||||
FILE* fdopen(int, const char*);
|
int fgetpos(FILE* __restrict stream, fpos_t* __restrict pos);
|
||||||
int feof(FILE*);
|
char* fgets(char* __restrict s, int n, FILE* __restrict stream);
|
||||||
int ferror(FILE*);
|
int fileno(FILE* stream);
|
||||||
int fflush(FILE*);
|
void flockfile(FILE* stream);
|
||||||
int fgetc(FILE*);
|
FILE* fmemopen(void* __restrict buf, size_t size, const char* __restrict mode);
|
||||||
int fgetpos(FILE*, fpos_t*);
|
FILE* fopen(const char* __restrict pathname, const char* __restrict mode);
|
||||||
char* fgets(char*, int, FILE*);
|
int fprintf(FILE* __restrict stream, const char* __restrict format, ...);
|
||||||
int fileno(FILE*);
|
int fputc(int c, FILE* stream);
|
||||||
void flockfile(FILE*);
|
int fputs(const char* __restrict s, FILE* __restrict stream);
|
||||||
FILE* fopen(const char*, const char*);
|
size_t fread(void* __restrict buf, size_t size, size_t nitems, FILE* __restrict stream);
|
||||||
int fprintf(FILE*, const char*, ...);
|
FILE* freopen(const char* __restrict pathname, const char* __restrict mode, FILE* __restrict stream);
|
||||||
int fputc(int, FILE*);
|
int fscanf(FILE* __restrict stream, const char* __restrict format, ...);
|
||||||
int fputs(const char*, FILE*);
|
int fseek(FILE* stream, long offset, int whence);
|
||||||
size_t fread(void*, size_t, size_t, FILE*);
|
int fseeko(FILE* stream, off_t offset, int whence);
|
||||||
FILE* freopen(const char*, const char*, FILE*);
|
int fsetpos(FILE* stream, const fpos_t* pos);
|
||||||
int fscanf(FILE*, const char*, ...);
|
long ftell(FILE* stream);
|
||||||
int fseek(FILE*, long, int);
|
off_t ftello(FILE* stream);
|
||||||
int fseeko(FILE*, off_t, int);
|
int ftrylockfile(FILE* stream);
|
||||||
int fsetpos(FILE*, const fpos_t*);
|
void funlockfile(FILE* stream);
|
||||||
long ftell(FILE*);
|
size_t fwrite(const void* __restrict ptr, size_t size, size_t nitems, FILE* __restrict stream);
|
||||||
off_t ftello(FILE*);
|
int getc(FILE* stream);
|
||||||
int ftrylockfile(FILE*);
|
|
||||||
void funlockfile(FILE*);
|
|
||||||
size_t fwrite(const void*, size_t, size_t, FILE*);
|
|
||||||
int getc(FILE*);
|
|
||||||
int getchar(void);
|
int getchar(void);
|
||||||
int getc_unlocked(FILE*);
|
int getc_unlocked(FILE* stream);
|
||||||
int getchar_unlocked(void);
|
int getchar_unlocked(void);
|
||||||
char* gets(char*);
|
ssize_t getdelim(char** __restrict lineptr, size_t* __restrict n, int delimeter, FILE* __restrict stream);
|
||||||
int pclose(FILE*);
|
ssize_t getline(char** __restrict lineptr, size_t* __restrict n, FILE* __restrict stream);
|
||||||
void perror(const char*);
|
char* gets(char* s);
|
||||||
FILE* popen(const char*, const char*);
|
FILE* open_memstream(char** bufp, size_t* sizep);
|
||||||
int printf(const char*, ...);
|
int pclose(FILE* stream);
|
||||||
int putc(int, FILE*);
|
void perror(const char* s);
|
||||||
int putchar(int);
|
FILE* popen(const char* command, const char* mode);
|
||||||
int putc_unlocked(int, FILE*);
|
int printf(const char* __restrict format, ...);
|
||||||
int putchar_unlocked(int);
|
int putc(int c, FILE* stream);
|
||||||
int puts(const char*);
|
int putchar(int c);
|
||||||
int remove(const char*);
|
int putc_unlocked(int c, FILE* stream);
|
||||||
int rename(const char*, const char*);
|
int putchar_unlocked(int c);
|
||||||
void rewind(FILE*);
|
int puts(const char* s);
|
||||||
int scanf(const char*, ...);
|
int remove(const char* path);
|
||||||
void setbuf(FILE*, char*);
|
int rename(const char* old, const char* _new);
|
||||||
int setvbuf(FILE*, char*, int, size_t);
|
int renameat(int oldfd, const char* old, int newfd, const char* _new);
|
||||||
int snprintf(char*, size_t, const char*, ...);
|
void rewind(FILE* stream);
|
||||||
int sprintf(char*, const char*, ...);
|
int scanf(const char* __restrict format, ...);
|
||||||
int sscanf(const char*, const char*, ...);
|
void setbuf(FILE* __restrict stream, char* __restrict buf);
|
||||||
char* tempnam(const char*, const char*);
|
int setvbuf(FILE* __restrict stream, char* __restrict buf, int type, size_t size);
|
||||||
|
int snprintf(char* __restrict s, size_t n, const char* __restrict format, ...);
|
||||||
|
int sprintf(char* __restrict s, const char* __restrict format, ...);
|
||||||
|
int sscanf(const char* __restrict s, const char* __restrict format, ...);
|
||||||
|
char* tempnam(const char* dir, const char* pfx);
|
||||||
FILE* tmpfile(void);
|
FILE* tmpfile(void);
|
||||||
char* tmpnam(char*);
|
char* tmpnam(char* s);
|
||||||
int ungetc(int, FILE*);
|
int ungetc(int c, FILE* stream);
|
||||||
int vfprintf(FILE*, const char*, va_list);
|
int vdprintf(int fildes, const char* __restrict format, va_list ap);
|
||||||
int vfscanf(FILE*, const char*, va_list);
|
int vfprintf(FILE* __restrict stream, const char* __restrict format, va_list ap);
|
||||||
int vprintf(const char*, va_list);
|
int vfscanf(FILE* __restrict stream, const char* __restrict format, va_list arg);
|
||||||
int vscanf(const char*, va_list);
|
int vprintf(const char* __restrict format, va_list ap);
|
||||||
int vsnprintf(char*, size_t, const char*, va_list);
|
int vscanf(const char* __restrict format, va_list arg);
|
||||||
int vsprintf(char*, const char*, va_list);
|
int vsnprintf(char* __restrict s, size_t n, const char* __restrict format, va_list ap);
|
||||||
int vsscanf(const char*, const char*, va_list);
|
int vsprintf(char* __restrict s, const char* __restrict format, va_list ap);
|
||||||
|
int vsscanf(const char* __restrict s, const char* __restrict format, va_list arg);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,93 +1,108 @@
|
||||||
#pragma once
|
#ifndef _STDLIB_H
|
||||||
|
#define _STDLIB_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#define EXIT_FAILURE 1
|
||||||
|
#define EXIT_SUCCESS 0
|
||||||
|
|
||||||
|
#define RAND_MAX INT32_MAX
|
||||||
|
|
||||||
|
#define MB_CUR_MAX ((size_t)4)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int quot;
|
int quot; /* quotient */
|
||||||
int rem;
|
int rem; /* remainder */
|
||||||
} div_t;
|
} div_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
long quot;
|
long quot; /* quotient */
|
||||||
long rem;
|
long rem; /* remainder */
|
||||||
} ldiv_t;
|
} ldiv_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
long long quot;
|
long long quot; /* quotient */
|
||||||
long long rem;
|
long long rem; /* remainder */
|
||||||
} lldiv_t;
|
} lldiv_t;
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
|
[[noreturn]] void _Exit(int status);
|
||||||
void _Exit(int);
|
long a64l(const char* s);
|
||||||
long a64l(const char*);
|
[[noreturn]] void abort(void);
|
||||||
void abort(void);
|
int abs(int i);
|
||||||
int abs(int);
|
int atexit(void (*func)(void));
|
||||||
int atexit(void (*)(void));
|
double atof(const char* str);
|
||||||
double atof(const char*);
|
int atoi(const char* str);
|
||||||
int atoi(const char*);
|
long atol(const char* str);
|
||||||
long atol(const char*);
|
long long atoll(const char* str);
|
||||||
long long atoll(const char*);
|
void* bsearch(const void* key, const void* base, size_t nel, size_t width, int (*compar)(const void*, const void*));
|
||||||
void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*));
|
void* calloc(size_t nelem, size_t elsize);
|
||||||
void* calloc(size_t, size_t);
|
div_t div(int numer, int denom);
|
||||||
div_t div(int, int);
|
double drand48(void);
|
||||||
double drand48(void);
|
double erand48(unsigned short xsubi[3]);
|
||||||
double erand48(unsigned short[3]);
|
void exit(int status);
|
||||||
void exit(int);
|
void free(void* ptr);
|
||||||
void free(void*);
|
char* getenv(const char* name);
|
||||||
char* getenv(const char*);
|
int getsubopt(char** optionp, char* const* keylistp, char** valuep);
|
||||||
int getsubopt(char**, char* const*, char**);
|
int grantpt(int fildes);
|
||||||
int grantpt(int);
|
char* initstate(unsigned seed, char* state, size_t size);
|
||||||
char* initstate(unsigned, char*, size_t);
|
long jrand48(unsigned short xsubi[3]);
|
||||||
long jrand48(unsigned short[3]);
|
char* l64a(long value);
|
||||||
char* l64a(long);
|
long labs(long i);
|
||||||
long labs(long);
|
void lcong48(unsigned short param[7]);
|
||||||
void lcong48(unsigned short[7]);
|
ldiv_t ldiv(long numer, long denom);
|
||||||
ldiv_t ldiv(long, long);
|
long long llabs(long long i);
|
||||||
long long llabs(long long);
|
lldiv_t lldiv(long long numer, long long denom);
|
||||||
lldiv_t lldiv(long long, long long);
|
long lrand48(void);
|
||||||
long lrand48(void);
|
void* malloc(size_t size);
|
||||||
void* malloc(size_t);
|
int mblen(const char* s, size_t n);
|
||||||
int mblen(const char*, size_t);
|
size_t mbstowcs(wchar_t* __restrict pwcs, const char* __restrict s, size_t n);
|
||||||
size_t mbstowcs(wchar_t*, const char*, size_t);
|
int mbtowc(wchar_t* __restrict pwc, const char* __restrict s, size_t n);
|
||||||
int mbtowc(wchar_t*, const char*, size_t);
|
char* mkdtemp(char* _template);
|
||||||
char* mkdtemp(char*);
|
int mkstemp(char* _template);
|
||||||
int mkstemp(char*);
|
long mrand48(void);
|
||||||
long mrand48(void);
|
long nrand48(unsigned short xsubi[3]);
|
||||||
long nrand48(unsigned short[3]);
|
int posix_memalign(void** memptr, size_t alignment, size_t size);
|
||||||
int posix_memalign(void**, size_t, size_t);
|
int posix_openpt(int oflag);
|
||||||
int posix_openpt(int);
|
char* ptsname(int fildes);
|
||||||
char* ptsname(int);
|
int putenv(char* string);
|
||||||
int putenv(char*);
|
void qsort(void* base, size_t nel, size_t width, int (*compar)(const void*, const void*));
|
||||||
void qsort(void*, size_t, size_t, int (*)(const void*, const void*));
|
int rand(void);
|
||||||
int rand(void);
|
int rand_r(unsigned* seed);
|
||||||
int rand_r(unsigned*);
|
long random(void);
|
||||||
long random(void);
|
void* realloc(void* ptr, size_t size);
|
||||||
void* realloc(void*, size_t);
|
char* realpath(const char* __restrict file_name, char* __restrict resolved_name);
|
||||||
char* realpath(const char*, char*);
|
unsigned short* seed48(unsigned short seed16v[3]);
|
||||||
unsigned short* seed48(unsigned short[3]);
|
int setenv(const char* envname, const char* envval, int overwrite);
|
||||||
int setenv(const char*, const char*, int);
|
void setkey(const char* key);
|
||||||
void setkey(const char*);
|
char* setstate(char* state);
|
||||||
char* setstate(char*);
|
void srand(unsigned seed);
|
||||||
void srand(unsigned);
|
void srand48(long seedval);
|
||||||
void srand48(long);
|
void srandom(unsigned seed);
|
||||||
void srandom(unsigned);
|
double strtod(const char* __restrict nptr, char** __restrict endptr);
|
||||||
double strtod(const char*, char**);
|
float strtof(const char* __restrict nptr, char** __restrict endptr);
|
||||||
float strtof(const char*, char**);
|
long strtol(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
long strtol(const char*, char**, int);
|
long double strtold(const char* __restrict nptr, char** __restrict endptr);
|
||||||
long double strtold(const char*, char**);
|
long long strtoll(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
long long strtoll(const char*, char**, int);
|
unsigned long strtoul(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
unsigned long strtoul(const char*, char**, int);
|
unsigned long long strtoull(const char* __restrict nptr, char** __restrict endptr, int base);
|
||||||
unsigned long long strtoull(const char*, char**, int);
|
int system(const char* command);
|
||||||
int system(const char*);
|
int unlockpt(int fildes);
|
||||||
int unlockpt(int);
|
int unsetenv(const char* name);
|
||||||
int unsetenv(const char*);
|
size_t wcstombs(char* __restrict s, const wchar_t* __restrict pwcs, size_t n);
|
||||||
size_t wcstombs(char*, const wchar_t*, size_t);
|
int wctomb(char* s, wchar_t wchar);
|
||||||
int wctomb(char*, wchar_t);
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,47 +1,54 @@
|
||||||
#pragma once
|
#ifndef _STRING_H
|
||||||
|
#define _STRING_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/string.h.html
|
||||||
|
|
||||||
#include <locale.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
void* memccpy(void*, const void*, int, size_t);
|
#include <stddef.h>
|
||||||
void* memchr(const void*, int, size_t);
|
#include <bits/types/locale_t.h>
|
||||||
int memcmp(const void*, const void*, size_t);
|
|
||||||
void* memcpy(void*, const void*, size_t);
|
|
||||||
void* memmove(void*, const void*, size_t);
|
|
||||||
void* memset(void*, int, size_t);
|
|
||||||
char* stpcpy(char*, const char*);
|
|
||||||
char* stpncpy(char*, const char*, size_t);
|
|
||||||
char* strcat(char*, const char*);
|
|
||||||
char* strchr(const char*, int);
|
|
||||||
int strcmp(const char*, const char*);
|
|
||||||
int strcoll(const char*, const char*);
|
|
||||||
int strcoll_l(const char*, const char*, locale_t);
|
|
||||||
char* strcpy(char*, const char*);
|
|
||||||
size_t strcspn(const char*, const char*);
|
|
||||||
char* strdup(const char*);
|
|
||||||
char* strerror(int);
|
|
||||||
char* strerror_l(int, locale_t);
|
|
||||||
int strerror_r(int, char*, size_t);
|
|
||||||
size_t strlen(const char*);
|
|
||||||
char* strncat(char*, const char*, size_t);
|
|
||||||
int strncmp(const char*, const char*, size_t);
|
|
||||||
char* strncpy(char*, const char*, size_t);
|
|
||||||
char* strndup(const char*, size_t);
|
|
||||||
size_t strnlen(const char*, size_t);
|
|
||||||
char* strpbrk(const char*, const char*);
|
|
||||||
char* strrchr(const char*, int);
|
|
||||||
char* strsignal(int);
|
|
||||||
size_t strspn(const char*, const char*);
|
|
||||||
char* strstr(const char*, const char*);
|
|
||||||
char* strtok(char*, const char*);
|
|
||||||
char* strtok_r(char*, const char*, char**);
|
|
||||||
size_t strxfrm(char*, const char*, size_t);
|
|
||||||
size_t strxfrm_l(char*, const char*, size_t, locale_t);
|
|
||||||
|
|
||||||
const char* strerrorname_np(int);
|
void* memccpy(void* __restrict s1, const void* __restrict s2, int c, size_t n);
|
||||||
const char* strerrordesc_np(int);
|
void* memchr(const void* s, int c, size_t n);
|
||||||
|
int memcmp(const void* s1, const void* s2, size_t n);
|
||||||
|
void* memcpy(void* __restrict s1, const void* __restrict s2, size_t n);
|
||||||
|
void* memmove(void* s1, const void* s2, size_t n);
|
||||||
|
void* memset(void* s, int c, size_t n);
|
||||||
|
char* stpcpy(char* __restrict s1, const char* __restrict s2);
|
||||||
|
char* stpncpy(char* __restrict s1, const char* __restrict s2, size_t n);
|
||||||
|
char* strcat(char* __restrict s1, const char* __restrict s2);
|
||||||
|
char* strchr(const char* s, int c);
|
||||||
|
int strcmp(const char* s1, const char* s2);
|
||||||
|
int strcoll(const char* s1, const char* s2);
|
||||||
|
int strcoll_l(const char* s1, const char* s2, locale_t locale);
|
||||||
|
char* strcpy(char* __restrict s1, const char* __restrict s2);
|
||||||
|
size_t strcspn(const char* , const char* );
|
||||||
|
char* strdup(const char* s);
|
||||||
|
char* strerror(int errnum);
|
||||||
|
char* strerror_l(int errnum, locale_t locale);
|
||||||
|
int strerror_r(int errnum, char* strerrbuf, size_t buflen);
|
||||||
|
size_t strlen(const char* s);
|
||||||
|
char* strncat(char* __restrict s1, const char* __restrict s2, size_t n);
|
||||||
|
int strncmp(const char* s1, const char* s2, size_t n);
|
||||||
|
char* strncpy(char* __restrict s1, const char* __restrict s2, size_t n);
|
||||||
|
char* strndup(const char* s, size_t n);
|
||||||
|
size_t strnlen(const char* s, size_t maxlen);
|
||||||
|
char* strpbrk(const char* s1, const char* s2);
|
||||||
|
char* strrchr(const char* s, int c);
|
||||||
|
char* strsignal(int signum);
|
||||||
|
size_t strspn(const char* s1, const char* s2);
|
||||||
|
char* strstr(const char* s1, const char* s2);
|
||||||
|
char* strtok(char* __restrict s, const char* __restrict sep);
|
||||||
|
char* strtok_r(char* __restrict s, const char* __restrict sep, char** __restrict state);
|
||||||
|
size_t strxfrm(char* __restrict s1, const char* __restrict s2, size_t n);
|
||||||
|
size_t strxfrm_l(char* __restrict s1, const char* __restrict s2, size_t n, locale_t locale);
|
||||||
|
|
||||||
__END_DECLS
|
const char* strerrorname_np(int error);
|
||||||
|
const char* strerrordesc_np(int error);
|
||||||
|
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _STRINGS_H
|
||||||
|
#define _STRINGS_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/strings.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
int ffs(int i);
|
||||||
|
int strcasecmp(const char* s1, const char* s2);
|
||||||
|
int strcasecmp_l(const char* s1, const char* s2, locale_t locale);
|
||||||
|
int strncasecmp(const char* s1, const char* s2, size_t n);
|
||||||
|
int strncasecmp_l(const char* s1, const char* s2, size_t n, locale_t locale);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,11 +1,14 @@
|
||||||
#pragma once
|
#ifndef _SYS_CDEFS_H
|
||||||
|
#define _SYS_CDEFS_H 1
|
||||||
|
|
||||||
#define __banan_libc 1
|
#define __banan_libc 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define __BEGIN_DECLS extern "C" {
|
#define __BEGIN_DECLS extern "C" {
|
||||||
#define __END_DECLS }
|
#define __END_DECLS }
|
||||||
#else
|
#else
|
||||||
#define __BEGIN_DECLS
|
#define __BEGIN_DECLS
|
||||||
#define __END_DECLS
|
#define __END_DECLS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef _SYS_IPC_H
|
||||||
|
#define _SYS_IPC_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_uid_t
|
||||||
|
#define __need_gid_t
|
||||||
|
#define __need_mode_t
|
||||||
|
#define __need_key_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct ipc_perm
|
||||||
|
{
|
||||||
|
uid_t uid; /* Owner's user ID. */
|
||||||
|
gid_t gid; /* Owner's group ID. */
|
||||||
|
uid_t cuid; /* Creator's user ID. */
|
||||||
|
gid_t cgid; /* Creator's group ID. */
|
||||||
|
mode_t mode; /* Read/write permission. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define IPC_CREAT 0x01
|
||||||
|
#define IPC_EXCL 0x02
|
||||||
|
#define IPC_NOWAIT 0x04
|
||||||
|
#define IPC_PRIVATE 0x08
|
||||||
|
#define IPC_RMID 0x10
|
||||||
|
#define IPC_SET 0x20
|
||||||
|
#define IPC_STAT 0x40
|
||||||
|
|
||||||
|
key_t ftok(const char* path, int id);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,65 @@
|
||||||
|
#ifndef _SYS_MMAN_H
|
||||||
|
#define _SYS_MMAN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_mman.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define PROT_EXEC 0x01
|
||||||
|
#define PROT_NONE 0x02
|
||||||
|
#define PROT_READ 0x04
|
||||||
|
#define PROT_WRITE 0x08
|
||||||
|
|
||||||
|
#define MAP_FIXED 0x01
|
||||||
|
#define MAP_PRIVATE 0x02
|
||||||
|
#define MAP_SHARED 0x04
|
||||||
|
|
||||||
|
#define MS_ASYNC 0x01
|
||||||
|
#define MS_INVALIDATE 0x02
|
||||||
|
#define MS_SYNC 0x04
|
||||||
|
|
||||||
|
#define MCL_CURRENT 0x01
|
||||||
|
#define MCL_FUTURE 0x01
|
||||||
|
|
||||||
|
#define MAP_FAILED ((void*)0)
|
||||||
|
|
||||||
|
#define POSIX_MADV_DONTNEED 1
|
||||||
|
#define POSIX_MADV_NORMAL 2
|
||||||
|
#define POSIX_MADV_RANDOM 3
|
||||||
|
#define POSIX_MADV_SEQUENTIAL 4
|
||||||
|
#define POSIX_MADV_WILLNEED 5
|
||||||
|
|
||||||
|
#define POSIX_TYPED_MEM_ALLOCATE 0x01
|
||||||
|
#define POSIX_TYPED_MEM_ALLOCATE_CONTIG 0x02
|
||||||
|
#define POSIX_TYPED_MEM_MAP_ALLOCATABLE 0x04
|
||||||
|
|
||||||
|
#define __need_mode_t
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_size_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct posix_typed_mem_info
|
||||||
|
{
|
||||||
|
size_t posix_tmi_length; /* Maximum length which may be allocated from a typed memory object. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int mlock(const void* addr, size_t len);
|
||||||
|
int mlockall(int flags);
|
||||||
|
void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off);
|
||||||
|
int mprotect(void* addr, size_t len, int prot);
|
||||||
|
int msync(void* addr, size_t len, int flags);
|
||||||
|
int munlock(const void* addr, size_t len);
|
||||||
|
int munlockall(void);
|
||||||
|
int munmap(void* addr, size_t len);
|
||||||
|
int posix_madvise(void* addr, size_t len, int advice);
|
||||||
|
int posix_mem_offset(const void* __restrict addr, size_t len, off_t* __restrict off, size_t* __restrict contig_len, int* __restrict fildes);
|
||||||
|
int posix_typed_mem_get_info(int fildes, struct posix_typed_mem_info* info);
|
||||||
|
int posix_typed_mem_open(const char* name, int oflag, int tflag);
|
||||||
|
int shm_open(const char* name, int oflag, mode_t mode);
|
||||||
|
int shm_unlink(const char* name);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef _SYS_MSG_H
|
||||||
|
#define _SYS_MSG_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_msg.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#define __need_time_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
|
||||||
|
typedef unsigned int msgqnum_t;
|
||||||
|
typedef unsigned int msglen_t;
|
||||||
|
|
||||||
|
#define MSG_NOERROR 0
|
||||||
|
|
||||||
|
struct msqid_ds
|
||||||
|
{
|
||||||
|
struct ipc_perm msg_perm; /* Operation permission structure. */
|
||||||
|
msgqnum_t msg_qnum; /* Number of messages currently on queue. */
|
||||||
|
msglen_t msg_qbytes; /* Maximum number of bytes allowed on queue. */
|
||||||
|
pid_t msg_lspid; /* Process ID of last msgsnd(). */
|
||||||
|
pid_t msg_lrpid; /* Process ID of last msgrcv(). */
|
||||||
|
time_t msg_stime; /* Time of last msgsnd(). */
|
||||||
|
time_t msg_rtime; /* Time of last msgrcv(). */
|
||||||
|
time_t msg_ctime; /* Time of last change. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int msgctl(int msqid, int cmd, struct msqid_ds* buf);
|
||||||
|
int msgget(key_t key, int msgflg);
|
||||||
|
ssize_t msgrcv(int msqid, void* msgp, size_t msgsz, long msgtyp, int msgflg);
|
||||||
|
int msgsnd(int msqid, const void* msgp, size_t msgsz, int msgflg);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#ifndef _SYS_RESOURCE_H
|
||||||
|
#define _SYS_RESOURCE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_id_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#define PRIO_PROCESS 0
|
||||||
|
#define PRIO_PGRP 1
|
||||||
|
#define PRIO_USER 2
|
||||||
|
|
||||||
|
typedef unsigned int rlim_t;
|
||||||
|
|
||||||
|
#define RLIM_INFINITY ((rlim_t)-1)
|
||||||
|
#define RLIM_SAVED_MAX RLIM_INFINITY
|
||||||
|
#define RLIM_SAVED_CUR RLIM_INFINITY
|
||||||
|
|
||||||
|
#define RUSAGE_SELF 0
|
||||||
|
#define RUSAGE_CHILDREN 1
|
||||||
|
|
||||||
|
struct rlimit
|
||||||
|
{
|
||||||
|
rlim_t rlim_cur; /* The current (soft) limit. */
|
||||||
|
rlim_t rlim_max; /* The hard limit. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rusage
|
||||||
|
{
|
||||||
|
struct timeval ru_utime; /* User time used. */
|
||||||
|
struct timeval ru_stime; /* System time used. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RLIMIT_CORE 0
|
||||||
|
#define RLIMIT_CPU 1
|
||||||
|
#define RLIMIT_DATA 2
|
||||||
|
#define RLIMIT_FSIZE 3
|
||||||
|
#define RLIMIT_NOFILE 4
|
||||||
|
#define RLIMIT_STACK 5
|
||||||
|
#define RLIMIT_AS 6
|
||||||
|
|
||||||
|
int getpriority(int which, id_t who);
|
||||||
|
int getrlimit(int resource, struct rlimit* rlp);
|
||||||
|
int getrusage(int who, struct rusage* r_usage);
|
||||||
|
int setpriority(int which, id_t who, int value);
|
||||||
|
int setrlimit(int resource, const struct rlimit* rlp);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,58 @@
|
||||||
|
#ifndef _SYS_SELECT_H
|
||||||
|
#define _SYS_SELECT_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_time_t
|
||||||
|
#define __need_suseconds_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define FD_SETSIZE 1024
|
||||||
|
|
||||||
|
typedef unsigned long __fd_mask;
|
||||||
|
#define __FD_MASK_SIZE (8 * sizeof(__fd_mask))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
__fd_mask __bits[FD_SETSIZE / __FD_MASK_SIZE];
|
||||||
|
} fd_set;
|
||||||
|
|
||||||
|
#define FD_CLR(fd, setp) \
|
||||||
|
do { \
|
||||||
|
__fd_mask off = (fd) / __FD_MASK_SIZE; \
|
||||||
|
__fd_mask bit = (fd) % __FD_MASK_SIZE; \
|
||||||
|
(setp)->__bits[off] &= ~((__fd_mask)1 << bit); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define FD_ISSET(fd, setp) \
|
||||||
|
({ \
|
||||||
|
__fd_mask off = (fd) / __FD_MASK_SIZE; \
|
||||||
|
__fd_mask bit = (fd) % __FD_MASK_SIZE; \
|
||||||
|
(setp)->__bits[off] & ((__fd_mask)1 << bit); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define FD_SET(fd, setp) \
|
||||||
|
do { \
|
||||||
|
__fd_mask off = (fd) / __FD_MASK_SIZE; \
|
||||||
|
__fd_mask bit = (fd) % __FD_MASK_SIZE; \
|
||||||
|
(setp)->__bits[off] |= ((__fd_mask)1 << bit); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define FD_ZERO(setp) \
|
||||||
|
do { \
|
||||||
|
for (int i = 0; i < FD_SETSIZE / __FD_MASK_SIZE; i++) \
|
||||||
|
(setp)->__bits[i] = (__fd_mask)0; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
int pselect(int nfds, fd_set* __restrict readfds, fd_set* __restrict writefds, fd_set* __restrict errorfds, const struct timespec* __restrict timeout, const sigset_t* __restrict sigmask);
|
||||||
|
int select(int nfds, fd_set* __restrict readfds, fd_set* __restrict writefds, fd_set* __restrict errorfds, struct timeval* __restrict timeout);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef _SYS_SEM_H
|
||||||
|
#define _SYS_SEM_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_sem.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_time_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
|
||||||
|
#define SEM_UNDO 1
|
||||||
|
|
||||||
|
#define GETNCNT 0
|
||||||
|
#define GETPID 1
|
||||||
|
#define GETVAL 2
|
||||||
|
#define GETALL 3
|
||||||
|
#define GETZCNT 4
|
||||||
|
#define SETVAL 5
|
||||||
|
#define SETALL 6
|
||||||
|
|
||||||
|
struct semid_ds
|
||||||
|
{
|
||||||
|
struct ipc_perm sem_perm; /* Operation permission structure. */
|
||||||
|
unsigned short sem_nsems; /* Number of semaphores in set. */
|
||||||
|
time_t sem_otime; /* Last semop() time. */
|
||||||
|
time_t sem_ctime; /* Last time changed by semctl(). */
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME: A semaphore shall be represented by an anonymous structure, which shall include the following members:
|
||||||
|
// unsigned short semval; /* Semaphore value. */
|
||||||
|
// pid_t sempid; /* Process ID of last operation. */
|
||||||
|
// unsigned short semncnt; /* Number of processes waiting for semval to become greater than current value. */
|
||||||
|
// unsigned short semzcnt; /* Number of processes waiting for semval to become 0. */
|
||||||
|
|
||||||
|
struct sembuf
|
||||||
|
{
|
||||||
|
unsigned short sem_num; /* Semaphore number. */
|
||||||
|
short sem_op; /* Semaphore operation. */
|
||||||
|
short sem_flg; /* Operation flags. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int semctl(int, int, int, ...);
|
||||||
|
int semget(key_t, int, int);
|
||||||
|
int semop(int, struct sembuf *, size_t);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,42 @@
|
||||||
|
#ifndef _SYS_SHM_H
|
||||||
|
#define _SYS_SHM_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_time_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
|
||||||
|
#define SHM_RDONLY 0x01
|
||||||
|
#define SHM_RDONLY 0x02
|
||||||
|
#define SHM_RDONLY 0x04
|
||||||
|
|
||||||
|
typedef unsigned int shmatt_t;
|
||||||
|
|
||||||
|
struct shmid_ds
|
||||||
|
{
|
||||||
|
struct ipc_perm shm_perm; /* Operation permission structure. */
|
||||||
|
size_t shm_segsz; /* Size of segment in bytes. */
|
||||||
|
pid_t shm_lpid; /* Process ID of last shared memory operation. */
|
||||||
|
pid_t shm_cpid; /* Process ID of creator. */
|
||||||
|
shmatt_t shm_nattch; /* Number of current attaches. */
|
||||||
|
time_t shm_atime; /* Time of last shmat(). */
|
||||||
|
time_t shm_dtime; /* Time of last shmdt(). */
|
||||||
|
time_t shm_ctime; /* Time of last change by shmctl().*/
|
||||||
|
};
|
||||||
|
|
||||||
|
void* shmat(int shmid, const void* shmaddr, int shmflg);
|
||||||
|
int shmctl(int shmid, int cmd, struct shmid_ds* buf);
|
||||||
|
int shmdt(const void* shmaddr);
|
||||||
|
int shmget(key_t key, size_t size, int shmflg);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,129 @@
|
||||||
|
#ifndef _SYS_SOCKET_H
|
||||||
|
#define _SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
#include <bits/types/sa_family_t.h>
|
||||||
|
typedef long socklen_t;
|
||||||
|
|
||||||
|
struct sockaddr
|
||||||
|
{
|
||||||
|
sa_family_t sa_family; /* Address family. */
|
||||||
|
char sa_data[]; /* Socket address (variable-length data). */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sockaddr_storage
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
sa_family_t ss_family;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct msghdr
|
||||||
|
{
|
||||||
|
void* msg_name; /* Optional address. */
|
||||||
|
socklen_t msg_namelen; /* Size of address. */
|
||||||
|
struct iovec* msg_iov; /* Scatter/gather array. */
|
||||||
|
int msg_iovlen; /* Members in msg_iov. */
|
||||||
|
void* msg_control; /* Ancillary data; see below. */
|
||||||
|
socklen_t msg_controllen; /* Ancillary data buffer len. */
|
||||||
|
int msg_flags; /* Flags on received message. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cmsghdr
|
||||||
|
{
|
||||||
|
socklen_t cmsg_len; /* Data byte count, including the cmsghdr. */
|
||||||
|
int cmsg_level; /* Originating protocol. */
|
||||||
|
int cmsg_type; /* Protocol-specific type. */
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
#if 0
|
||||||
|
#define SCM_RIGHTS
|
||||||
|
|
||||||
|
#define CMSG_DATA(cmsg)
|
||||||
|
#define CMSG_NXTHDR(mhdr, cmsg)
|
||||||
|
#define CMSG_FIRSTHDR(mhdr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct linger
|
||||||
|
{
|
||||||
|
int l_onoff; /* Indicates wheter linger option is enabled. */
|
||||||
|
int l_linger; /* Linger time, in seconds. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SOCK_DGRAM 0
|
||||||
|
#define SOCK_RAW 1
|
||||||
|
#define SOCK_SEQPACKET 2
|
||||||
|
#define SOCK_STREAM 3
|
||||||
|
|
||||||
|
#define SOL_SOCKET 1
|
||||||
|
|
||||||
|
#define SO_ACCEPTCONN 0
|
||||||
|
#define SO_BROADCAST 1
|
||||||
|
#define SO_DEBUG 2
|
||||||
|
#define SO_DONTROUTE 3
|
||||||
|
#define SO_ERROR 4
|
||||||
|
#define SO_KEEPALIVE 5
|
||||||
|
#define SO_LINGER 6
|
||||||
|
#define SO_OOBINLINE 7
|
||||||
|
#define SO_RCVBUF 8
|
||||||
|
#define SO_RCVLOWAT 9
|
||||||
|
#define SO_RCVTIMEO 10
|
||||||
|
#define SO_REUSEADDR 11
|
||||||
|
#define SO_SNDBUF 12
|
||||||
|
#define SO_SNDLOWAT 13
|
||||||
|
#define SO_SNDTIMEO 14
|
||||||
|
#define SO_TYPE 15
|
||||||
|
|
||||||
|
#define SOMAXCONN 4096
|
||||||
|
|
||||||
|
#define MSG_CTRUNC 0x01
|
||||||
|
#define MSG_DONTROUTE 0x02
|
||||||
|
#define MSG_EOR 0x04
|
||||||
|
#define MSG_OOB 0x08
|
||||||
|
#define MSG_NOSIGNAL 0x10
|
||||||
|
#define MSG_PEEK 0x20
|
||||||
|
#define MSG_TRUNC 0x40
|
||||||
|
#define MSG_WAITALL 0x80
|
||||||
|
|
||||||
|
#define AF_UNSPEC 0
|
||||||
|
#define AF_INET 1
|
||||||
|
#define AF_INET6 2
|
||||||
|
#define AF_UNIX 3
|
||||||
|
|
||||||
|
#define SHUT_RD 0x01
|
||||||
|
#define SHUT_WR 0x02
|
||||||
|
#define SHUT_RDWR (SHUT_RD | SHUT_WR)
|
||||||
|
|
||||||
|
int accept(int socket, struct sockaddr* __restrict address, socklen_t* __restrict address_len);
|
||||||
|
int bind(int socket, const struct sockaddr* address, socklen_t address_len);
|
||||||
|
int connect(int socket, const struct sockaddr* address, socklen_t address_len);
|
||||||
|
int getpeername(int socket, struct sockaddr* __restrict address, socklen_t* __restrict address_len);
|
||||||
|
int getsockname(int socket, struct sockaddr* __restrict address, socklen_t* __restrict address_len);
|
||||||
|
int getsockopt(int socket, int level, int option_name, void* __restrict option_value, socklen_t* __restrict option_len);
|
||||||
|
int listen(int socket, int backlog);
|
||||||
|
ssize_t recv(int socket, void* buffer, size_t length, int flags);
|
||||||
|
ssize_t recvfrom(int socket, void* __restrict buffer, size_t length, int flags, struct sockaddr* __restrict address, socklen_t* __restrict address_len);
|
||||||
|
ssize_t recvmsg(int socket, struct msghdr* message, int flags);
|
||||||
|
ssize_t send(int socket, const void* buffer, size_t length, int flags);
|
||||||
|
ssize_t sendmsg(int socket, const struct msghdr* message, int flags);
|
||||||
|
ssize_t sendto(int socket, const void* message, size_t length, int flags, const struct sockaddr* dest_addr, socklen_t dest_len);
|
||||||
|
int setsockopt(int socket, int level, int option_name, const void* option_value, socklen_t option_len);
|
||||||
|
int shutdown(int socket, int how);
|
||||||
|
int sockatmark(int s);
|
||||||
|
int socket(int domain, int type, int protocol);
|
||||||
|
int socketpair(int domain, int type, int protocol, int socket_vector[2]);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,46 +1,108 @@
|
||||||
#pragma once
|
#ifndef _SYS_STAT_H
|
||||||
|
#define _SYS_STAT_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_blkcnt_t
|
||||||
|
#define __need_blksize_t
|
||||||
|
#define __need_dev_t
|
||||||
|
#define __need_ino_t
|
||||||
|
#define __need_mode_t
|
||||||
|
#define __need_nlink_t
|
||||||
|
#define __need_uid_t
|
||||||
|
#define __need_gid_t
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_time_t
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
struct stat
|
||||||
|
{
|
||||||
|
dev_t st_dev; /* Device ID of device containing file. */
|
||||||
|
ino_t st_ino; /* File serial number. */
|
||||||
|
mode_t st_mode; /* Mode of file (see below). */
|
||||||
|
nlink_t st_nlink; /* Number of hard links to the file. */
|
||||||
|
uid_t st_uid; /* User ID of file. */
|
||||||
|
gid_t st_gid; /* Group ID of file. */
|
||||||
|
dev_t st_rdev; /* Device ID (if file is character or block special). */
|
||||||
|
off_t st_size; /* For regular files, the file size in bytes. For symbolic links, the length in bytes of the pathname contained in the symbolic link. For a shared memory object, the length in bytes. For a typed memory object, the length in bytes. For other file types, the use of this field is unspecified. */
|
||||||
|
struct timespec st_atim; /* Last data access timestamp. */
|
||||||
|
struct timespec st_mtim; /* Last data modification timestamp. */
|
||||||
|
struct timespec st_ctim; /* Last file status change timestamp. */
|
||||||
|
blksize_t st_blksize; /* A file system-specific preferred I/O block size for this object. In some file system types, this may vary from file to file. */
|
||||||
|
blkcnt_t st_blocks; /* Number of blocks allocated for this object. */
|
||||||
|
};
|
||||||
|
|
||||||
#define st_atime st_atim.tv_sec
|
#define st_atime st_atim.tv_sec
|
||||||
#define st_ctime st_ctim.tv_sec
|
#define st_ctime st_ctim.tv_sec
|
||||||
#define st_mtime st_mtim.tv_sec
|
#define st_mtime st_mtim.tv_sec
|
||||||
|
|
||||||
__BEGIN_DECLS
|
#define S_IRWXU ((mode_t)00700)
|
||||||
|
#define S_IRUSR ((mode_t)00400)
|
||||||
|
#define S_IWUSR ((mode_t)00200)
|
||||||
|
#define S_IXUSR ((mode_t)00100)
|
||||||
|
#define S_IRWXG ((mode_t)00070)
|
||||||
|
#define S_IRGRP ((mode_t)00040)
|
||||||
|
#define S_IWGRP ((mode_t)00020)
|
||||||
|
#define S_IXGRP ((mode_t)00010)
|
||||||
|
#define S_IRWXO ((mode_t)00007)
|
||||||
|
#define S_IROTH ((mode_t)00004)
|
||||||
|
#define S_IWOTH ((mode_t)00002)
|
||||||
|
#define S_IXOTH ((mode_t)00001)
|
||||||
|
#define S_ISUID ((mode_t)04000)
|
||||||
|
#define S_ISGID ((mode_t)02000)
|
||||||
|
#define S_ISVTX ((mode_t)01000)
|
||||||
|
|
||||||
struct stat
|
#define S_IFIFO ((mode_t)0010000)
|
||||||
{
|
#define S_IFCHR ((mode_t)0020000)
|
||||||
dev_t st_dev;
|
#define S_IFDIR ((mode_t)0040000)
|
||||||
ino_t st_ino;
|
#define S_IFBLK ((mode_t)0060000)
|
||||||
mode_t st_mode;
|
#define S_IFREG ((mode_t)0100000)
|
||||||
nlink_t st_nlink;
|
#define S_IFLNK ((mode_t)0120000)
|
||||||
uid_t st_uid;
|
#define S_IFSOCK ((mode_t)0140000)
|
||||||
gid_t st_gid;
|
|
||||||
dev_t st_rdev;
|
|
||||||
off_t st_size;
|
|
||||||
timespec st_atim;
|
|
||||||
timespec st_mtim;
|
|
||||||
timespec st_ctim;
|
|
||||||
blksize_t st_blksize;
|
|
||||||
blkcnt_t st_blocks;
|
|
||||||
};
|
|
||||||
|
|
||||||
int chmod(const char*, mode_t);
|
#define S_ISBLK(mode) (mode & S_IFBLK)
|
||||||
int fchmod(int, mode_t);
|
#define S_ISCHR(mode) (mode & S_IFCHR)
|
||||||
int fchmodat(int, const char*, mode_t, int);
|
#define S_ISDIR(mode) (mode & S_IFDIR)
|
||||||
int fstat(int, struct stat*);
|
#define S_ISFIFO(mode) (mode & S_IFIFO)
|
||||||
int fstatat(int, const char*, struct stat*, int);
|
#define S_ISREG(mode) (mode & S_IFREG)
|
||||||
int futimens(int, const struct timespec[2]);
|
#define S_ISLNK(mode) (mode & S_IFLNK)
|
||||||
int lstat(const char*, struct stat*);
|
#define S_ISSOCK(mode) (mode & S_IFSOCK)
|
||||||
int mkdir(const char*, mode_t);
|
|
||||||
int mkdirat(int, const char*, mode_t);
|
// FIXME
|
||||||
int mkfifo(const char*, mode_t);
|
#if 0
|
||||||
int mkfifoat(int, const char*, mode_t);
|
#define S_TYPEISMQ(buf)
|
||||||
int mknod(const char*, mode_t, dev_t);
|
#define S_TYPEISSEM(buf)
|
||||||
int mknodat(int, const char*, mode_t, dev_t);
|
#define S_TYPEISSHM(buf)
|
||||||
int stat(const char*, struct stat*);
|
#define S_TYPEISTMO(buf)
|
||||||
mode_t umask(mode_t);
|
#endif
|
||||||
int utimensat(int, const char*, const struct timespec[2], int);
|
|
||||||
|
#define UTIME_NOW 1000000001
|
||||||
|
#define UTIME_OMIT 1000000002
|
||||||
|
|
||||||
|
|
||||||
|
int chmod(const char* path, mode_t mode);
|
||||||
|
int fchmod(int fildes, mode_t mode);
|
||||||
|
int fchmodat(int fd, const char* path, mode_t mode, int flag);
|
||||||
|
int fstat(int fildes, struct stat* buf);
|
||||||
|
int fstatat(int fd, const char* __restrict path, struct stat* __restrict buf, int flag);
|
||||||
|
int futimens(int fd, const struct timespec times[2]);
|
||||||
|
int lstat(const char* __restrict path, struct stat* __restrict buf);
|
||||||
|
int mkdir(const char* path, mode_t mode);
|
||||||
|
int mkdirat(int fd, const char* path, mode_t mode);
|
||||||
|
int mkfifo(const char* path, mode_t mode);
|
||||||
|
int mkfifoat(int fd, const char* path, mode_t mode);
|
||||||
|
int mknod(const char* path, mode_t mode, dev_t dev);
|
||||||
|
int mknodat(int fd, const char* path, mode_t mode, dev_t dev);
|
||||||
|
int stat(const char* __restrict path, struct stat* __restrict buf);
|
||||||
|
mode_t umask(mode_t cmask);
|
||||||
|
int utimensat(int fd, const char* path, const struct timespec times[2], int flag);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef _SYS_STATVFS_H
|
||||||
|
#define _SYS_STATVFS_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_fsblkcnt_t
|
||||||
|
#define __need_fsfilcnt_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct statvfs
|
||||||
|
{
|
||||||
|
unsigned long f_bsize; /* File system block size. */
|
||||||
|
unsigned long f_frsize; /* Fundamental file system block size. */
|
||||||
|
fsblkcnt_t f_blocks; /* Total number of blocks on file system in units of f_frsize. */
|
||||||
|
fsblkcnt_t f_bfree; /* Total number of free blocks. */
|
||||||
|
fsblkcnt_t f_bavail; /* Number of free blocks available to non-privileged process. */
|
||||||
|
fsfilcnt_t f_files; /* Total number of file serial numbers. */
|
||||||
|
fsfilcnt_t f_ffree; /* Total number of free file serial numbers. */
|
||||||
|
fsfilcnt_t f_favail; /* Number of file serial numbers available to non-privileged process. */
|
||||||
|
unsigned long f_fsid; /* File system ID. */
|
||||||
|
unsigned long f_flag; /* Bit mask of f_flag values. */
|
||||||
|
unsigned long f_namemax; /* Maximum filename length. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ST_RDONLY 0x01
|
||||||
|
#define ST_NOSUID 0x02
|
||||||
|
|
||||||
|
int fstatvfs(int fildes, struct statvfs* buf);
|
||||||
|
int statvfs(const char* __restrict path, struct statvfs* __restrict buf);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,23 @@
|
||||||
#pragma once
|
#ifndef _SYS_SYSCALL_H
|
||||||
|
#define _SYS_SYSCALL_H 1
|
||||||
|
|
||||||
#include <kernel/Syscall.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define SYS_EXIT 1
|
||||||
|
#define SYS_READ 2
|
||||||
|
#define SYS_WRITE 3
|
||||||
|
#define SYS_TERMID 4
|
||||||
|
#define SYS_CLOSE 5
|
||||||
|
#define SYS_OPEN 6
|
||||||
|
#define SYS_ALLOC 7
|
||||||
|
#define SYS_FREE 8
|
||||||
|
#define SYS_SEEK 9
|
||||||
|
#define SYS_TELL 10
|
||||||
|
#define SYS_GET_TERMIOS 11
|
||||||
|
#define SYS_SET_TERMIOS 12
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
#pragma once
|
#ifndef _SYS_SYSMACROS_H
|
||||||
|
#define _SYS_SYSMACROS_H 1
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define makedev(maj, min) ((dev_t)(maj) << 32 | (dev_t)(min))
|
#define makedev(maj, min) ((dev_t)(maj) << 32 | (dev_t)(min))
|
||||||
|
|
||||||
#define major(dev) (((dev) >> 32) & 0xFFFFFFFF)
|
#define major(dev) (((dev) >> 32) & 0xFFFFFFFF)
|
||||||
#define minor(dev) ( (dev) & 0xFFFFFFFF)
|
#define minor(dev) ( (dev) & 0xFFFFFFFF)
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef _SYS_TIME_H
|
||||||
|
#define _SYS_TIME_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_time_t
|
||||||
|
#define __need_suseconds_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
|
struct timeval
|
||||||
|
{
|
||||||
|
time_t tv_sec; /* Seconds. */
|
||||||
|
suseconds_t tc_usec; /* Microseconds. */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct itimerval
|
||||||
|
{
|
||||||
|
struct timeval it_interval; /* Timer interval. */
|
||||||
|
struct timeval it_value; /* Current value. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ITIMER_REAL 0
|
||||||
|
#define ITIMER_VIRTUAL 1
|
||||||
|
#define ITIMER_PROF 2
|
||||||
|
|
||||||
|
int getitimer(int which, struct itimerval* value);
|
||||||
|
int gettimeofday(struct timeval* __restrict tp, void* __restrict tzp);
|
||||||
|
int setitimer(int which, const struct itimerval* __restrict value, struct itimerval* __restrict ovalue);
|
||||||
|
int select(int nfds, fd_set* __restrict readfds, fd_set* __restrict writefds, fd_set* __restrict errorfds, struct timeval* __restrict timeout);
|
||||||
|
int utimes(const char* path, const struct timeval times[2]);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef _SYS_TIMES_H
|
||||||
|
#define _SYS_TIMES_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_times.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_clock_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct tms
|
||||||
|
{
|
||||||
|
clock_t tms_utime; /* User CPU time. */
|
||||||
|
clock_t tms_stime; /* System CPU time. */
|
||||||
|
clock_t tms_cutime; /* User CPU time of terminated child processes. */
|
||||||
|
clock_t tms_cstime; /* System CPU time of terminated child processes. */
|
||||||
|
};
|
||||||
|
|
||||||
|
clock_t times(struct tms* buffer);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,26 +1,196 @@
|
||||||
#pragma once
|
#ifndef _SYS_TYPES_H
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef int32_t blkcnt_t;
|
#if !defined(__need_blkcnt_t) \
|
||||||
typedef int32_t blksize_t;
|
&& !defined(__need_blksize_t) \
|
||||||
typedef uint64_t clock_t;
|
&& !defined(__need_clock_t) \
|
||||||
typedef int32_t clockid_t;
|
&& !defined(__need_clockid_t) \
|
||||||
typedef uint64_t dev_t;
|
&& !defined(__need_dev_t) \
|
||||||
typedef uint32_t ino_t;
|
&& !defined(__need_fsblkcnt_t) \
|
||||||
typedef uint16_t mode_t;
|
&& !defined(__need_fsfilcnt_t) \
|
||||||
typedef uint32_t nlink_t;
|
&& !defined(__need_gid_t) \
|
||||||
typedef int64_t off_t;
|
&& !defined(__need_id_t) \
|
||||||
typedef uint64_t time_t;
|
&& !defined(__need_ino_t) \
|
||||||
typedef uint64_t timer_t;
|
&& !defined(__need_key_t) \
|
||||||
typedef int32_t id_t;
|
&& !defined(__need_mode_t) \
|
||||||
typedef id_t pid_t;
|
&& !defined(__need_nlink_t) \
|
||||||
typedef id_t uid_t;
|
&& !defined(__need_off_t) \
|
||||||
typedef id_t gid_t;
|
&& !defined(__need_pid_t) \
|
||||||
typedef int64_t ssize_t;
|
&& !defined(__need_pthread_attr_t) \
|
||||||
|
&& !defined(__need_pthread_barrier_t) \
|
||||||
|
&& !defined(__need_pthread_barrierattr_t) \
|
||||||
|
&& !defined(__need_pthread_cond_t) \
|
||||||
|
&& !defined(__need_pthread_condattr_t) \
|
||||||
|
&& !defined(__need_pthread_key_t) \
|
||||||
|
&& !defined(__need_pthread_mutex_t) \
|
||||||
|
&& !defined(__need_pthread_mutexattr_t) \
|
||||||
|
&& !defined(__need_pthread_once_t) \
|
||||||
|
&& !defined(__need_pthread_rwlock_t) \
|
||||||
|
&& !defined(__need_pthread_rwlockattr_t) \
|
||||||
|
&& !defined(__need_pthread_spinlock_t) \
|
||||||
|
&& !defined(__need_pthread_t) \
|
||||||
|
&& !defined(__need_size_t) \
|
||||||
|
&& !defined(__need_ssize_t) \
|
||||||
|
&& !defined(__need_suseconds_t) \
|
||||||
|
&& !defined(__need_time_t) \
|
||||||
|
&& !defined(__need_timer_t) \
|
||||||
|
&& !defined(__need_uid_t)
|
||||||
|
|
||||||
__END_DECLS
|
#define __need_all_types
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __need_all_types
|
||||||
|
#define _SYS_TYPES_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__blkcnt_t_defined) && (defined(__need_all_types) || defined(__need_blkcnt_t))
|
||||||
|
#define __blkcnt_defined 1
|
||||||
|
typedef long blkcnt_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_blkcnt_t
|
||||||
|
|
||||||
|
#if !defined(__blksize_t_defined) && (defined(__need_all_types) || defined(__need_blksize_t))
|
||||||
|
#define __blksize_t_defined 1
|
||||||
|
typedef long blksize_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_blksize_t
|
||||||
|
|
||||||
|
#if !defined(__clock_t_defined) && (defined(__need_all_types) || defined(__need_clock_t))
|
||||||
|
#define __clock_t_defined 1
|
||||||
|
typedef long clock_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_clock_t
|
||||||
|
|
||||||
|
#if !defined(__clockid_t_defined) && (defined(__need_all_types) || defined(__need_clockid_t))
|
||||||
|
#define __clockid_t_defined 1
|
||||||
|
typedef int clockid_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_clockid_t
|
||||||
|
|
||||||
|
#if !defined(__dev_t_defined) && (defined(__need_all_types) || defined(__need_dev_t))
|
||||||
|
#define __dev_t_defined 1
|
||||||
|
typedef unsigned long dev_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_dev_t
|
||||||
|
|
||||||
|
#if !defined(__fsblkcnt_t_defined) && (defined(__need_all_types) || defined(__need_fsblkcnt_t))
|
||||||
|
#define __fsblkcnt_t_defined 1
|
||||||
|
typedef unsigned long fsblkcnt_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_fsblkcnt_t
|
||||||
|
|
||||||
|
#if !defined(__fsfilcnt_t_defined) && (defined(__need_all_types) || defined(__need_fsfilcnt_t))
|
||||||
|
#define __fsfilcnt_t_defined 1
|
||||||
|
typedef unsigned long fsfilcnt_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_fsfilcnt_t
|
||||||
|
|
||||||
|
#if !defined(__gid_t_defined) && (defined(__need_all_types) || defined(__need_gid_t))
|
||||||
|
#define __gid_t_defined 1
|
||||||
|
typedef unsigned int gid_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_gid_t
|
||||||
|
|
||||||
|
#if !defined(__id_t_defined) && (defined(__need_all_types) || defined(__need_id_t))
|
||||||
|
#define __id_t_defined 1
|
||||||
|
typedef unsigned int id_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_id_t
|
||||||
|
|
||||||
|
#if !defined(__ino_t_defined) && (defined(__need_all_types) || defined(__need_ino_t))
|
||||||
|
#define __ino_t_defined 1
|
||||||
|
typedef unsigned long ino_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_ino_t
|
||||||
|
|
||||||
|
#if !defined(__key_t_defined) && (defined(__need_all_types) || defined(__need_key_t))
|
||||||
|
#define __key_t_defined 1
|
||||||
|
typedef int key_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_key_t
|
||||||
|
|
||||||
|
#if !defined(__mode_t_defined) && (defined(__need_all_types) || defined(__need_mode_t))
|
||||||
|
#define __mode_t_defined 1
|
||||||
|
typedef unsigned int mode_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_mode_t
|
||||||
|
|
||||||
|
#if !defined(__nlink_t_defined) && (defined(__need_all_types) || defined(__need_nlink_t))
|
||||||
|
#define __nlink_t_defined 1
|
||||||
|
typedef unsigned long nlink_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_nlink_t
|
||||||
|
|
||||||
|
#if !defined(__off_t_defined) && (defined(__need_all_types) || defined(__need_off_t))
|
||||||
|
#define __off_t_defined 1
|
||||||
|
typedef long off_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_off_t
|
||||||
|
|
||||||
|
#if !defined(__pid_t_defined) && (defined(__need_all_types) || defined(__need_pid_t))
|
||||||
|
#define __pid_t_defined 1
|
||||||
|
typedef int pid_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_pid_t
|
||||||
|
|
||||||
|
#include <bits/pthread_types.h>
|
||||||
|
|
||||||
|
#if !defined(__size_t_defined) && (defined(__need_all_types) || defined(__need_size_t))
|
||||||
|
#define __size_t_defined 1
|
||||||
|
#define __need_size_t
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
#undef __need_size_t
|
||||||
|
|
||||||
|
#if !defined(__ssize_t_defined) && (defined(__need_all_types) || defined(__need_ssize_t))
|
||||||
|
#define __ssize_t_defined 1
|
||||||
|
#if __SIZEOF_SIZE_T__ == __SIZEOF_INT__
|
||||||
|
typedef int ssize_t;
|
||||||
|
#elif __SIZEOF_SIZE_T__ == __SIZEOF_LONG__
|
||||||
|
typedef long ssize_t;
|
||||||
|
#elif __SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__
|
||||||
|
typedef long long ssize_t;
|
||||||
|
#else
|
||||||
|
#error "unsupported sizeof(size_t)"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#undef __need_ssize_t
|
||||||
|
|
||||||
|
#if !defined(__suseconds_t_defined) && (defined(__need_all_types) || defined(__need_suseconds_t))
|
||||||
|
#define __suseconds_t_defined 1
|
||||||
|
typedef long suseconds_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_suseconds_t
|
||||||
|
|
||||||
|
#if !defined(__time_t_defined) && (defined(__need_all_types) || defined(__need_time_t))
|
||||||
|
#define __time_t_defined 1
|
||||||
|
typedef unsigned long long time_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_time_t
|
||||||
|
|
||||||
|
#if !defined(__timer_t_defined) && (defined(__need_all_types) || defined(__need_timer_t))
|
||||||
|
#define __timer_t_defined 1
|
||||||
|
typedef void* timer_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_timer_t
|
||||||
|
|
||||||
|
#if !defined(__uid_t_defined) && (defined(__need_all_types) || defined(__need_uid_t))
|
||||||
|
#define __uid_t_defined 1
|
||||||
|
typedef int uid_t;
|
||||||
|
#endif
|
||||||
|
#undef __need_uid_t
|
||||||
|
|
||||||
|
#ifdef __need_all_types
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef __need_all_types
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef _SYS_UIO_H
|
||||||
|
#define _SYS_UIO_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct iovec
|
||||||
|
{
|
||||||
|
void* iov_base; /* Base address of a memory region for input or output. */
|
||||||
|
size_t iov_len; /* The size of the memory pointed to by iov_base. */
|
||||||
|
};
|
||||||
|
|
||||||
|
ssize_t readv(int fildes, const struct iovec* iov, int iovcnt);
|
||||||
|
ssize_t writev(int fildes, const struct iovec* iov, int iovcnt);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef _SYS_UN_H
|
||||||
|
#define _SYS_UN_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_un.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <bits/types/sa_family_t.h>
|
||||||
|
|
||||||
|
struct sockaddr_un
|
||||||
|
{
|
||||||
|
sa_family_t sun_family; /* Address family. */
|
||||||
|
char sun_path[]; /* Socket pathname. */
|
||||||
|
};
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _SYS_UTSNAME_H
|
||||||
|
#define _SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
struct utsname
|
||||||
|
{
|
||||||
|
char sysname[65]; /* Name of this implementation of the operating system. */
|
||||||
|
char nodename[65]; /* Name of this node within the communications network to which this node is attached, if any. */
|
||||||
|
char release[65]; /* Current release level of this implementation. */
|
||||||
|
char version[65]; /* Current version level of this release. */
|
||||||
|
char machine[65]; /* Name of the hardware type on which the system is running. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int uname(struct utsname* name);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef _SYS_WAIT_H
|
||||||
|
#define _SYS_WAIT_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_id_t
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define WCONTINUED 0x01
|
||||||
|
#define WNOHANG 0x02
|
||||||
|
#define WUNTRACED 0x04
|
||||||
|
#define WEXITED 0x08
|
||||||
|
#define WNOWAIT 0x10
|
||||||
|
#define WSTOPPED 0x20
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
#if 0
|
||||||
|
#define WEXITSTATUS
|
||||||
|
#define WIFCONTINUED
|
||||||
|
#define WIFEXITED
|
||||||
|
#define WIFSIGNALED
|
||||||
|
#define WIFSTOPPED
|
||||||
|
#define WSTOPSIG
|
||||||
|
#define WTERMSIG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
P_ALL,
|
||||||
|
P_PGID,
|
||||||
|
P_PID,
|
||||||
|
} idtype_t;
|
||||||
|
|
||||||
|
pid_t wait(int* stat_loc);
|
||||||
|
int waitid(idtype_t idtype, id_t id, siginfo_t* infop, int options);
|
||||||
|
pid_t waitpid(pid_t pid, int* stat_loc, int options);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,52 @@
|
||||||
|
#ifndef _SYSLOG_H
|
||||||
|
#define _SYSLOG_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/syslog.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define LOG_PID 0x01
|
||||||
|
#define LOG_CONS 0x02
|
||||||
|
#define LOG_NDELAY 0x04
|
||||||
|
#define LOG_ODELAY 0x08
|
||||||
|
#define LOG_NOWAIT 0x10
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
#define LOG_KERN ( 0 << 3)
|
||||||
|
#define LOG_USER ( 1 << 3)
|
||||||
|
#define LOG_MAIL ( 2 << 3)
|
||||||
|
#define LOG_NEWS ( 3 << 3)
|
||||||
|
#define LOG_UUCP ( 4 << 3)
|
||||||
|
#define LOG_DAEMON ( 5 << 3)
|
||||||
|
#define LOG_AUTH ( 6 << 3)
|
||||||
|
#define LOG_CRON ( 7 << 3)
|
||||||
|
#define LOG_LPR ( 8 << 3)
|
||||||
|
#define LOG_LOCAL0 ( 9 << 3)
|
||||||
|
#define LOG_LOCAL1 (10 << 3)
|
||||||
|
#define LOG_LOCAL2 (11 << 3)
|
||||||
|
#define LOG_LOCAL3 (12 << 3)
|
||||||
|
#define LOG_LOCAL4 (13 << 3)
|
||||||
|
#define LOG_LOCAL5 (14 << 3)
|
||||||
|
#define LOG_LOCAL6 (15 << 3)
|
||||||
|
#define LOG_LOCAL7 (16 << 3)
|
||||||
|
|
||||||
|
#define LOG_MASK(pri) (1 << (pri))
|
||||||
|
|
||||||
|
void closelog(void);
|
||||||
|
void openlog(const char* ident, int logopt, int facility);
|
||||||
|
int setlogmask(int maskpri);
|
||||||
|
void syslog(int priority, const char* message, ...);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef _TAR_H
|
||||||
|
#define _TAR_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tar.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define TMAGIC "ustar"
|
||||||
|
#define TMAGLEN 6
|
||||||
|
#define TVERSION "00"
|
||||||
|
#define TVERSLEN 2
|
||||||
|
|
||||||
|
#define REGTYPE '0'
|
||||||
|
#define AREGTYPE '\0'
|
||||||
|
#define LNKTYPE '1'
|
||||||
|
#define SYMTYPE '2'
|
||||||
|
#define CHRTYPE '3'
|
||||||
|
#define BLKTYPE '4'
|
||||||
|
#define DIRTYPE '5'
|
||||||
|
#define FIFOTYPE '6'
|
||||||
|
#define CONTTYPE '7'
|
||||||
|
|
||||||
|
#define TSUID 04000
|
||||||
|
#define TSGID 02000
|
||||||
|
#define TSVTX 01000
|
||||||
|
#define TUREAD 00400
|
||||||
|
#define TUWRITE 00200
|
||||||
|
#define TUEXEC 00100
|
||||||
|
#define TGREAD 00040
|
||||||
|
#define TGWRITE 00020
|
||||||
|
#define TGEXEC 00010
|
||||||
|
#define TOREAD 00004
|
||||||
|
#define TOWRITE 00002
|
||||||
|
#define TOEXEC 00001
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,11 +1,42 @@
|
||||||
#pragma once
|
#ifndef _TERMIOS_H
|
||||||
|
#define _TERMIOS_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define NCCS 0
|
typedef unsigned int cc_t;
|
||||||
|
typedef unsigned int speed_t;
|
||||||
|
typedef unsigned int tcflag_t;
|
||||||
|
|
||||||
|
#define VEOF 0
|
||||||
|
#define VEOL 1
|
||||||
|
#define VERASE 2
|
||||||
|
#define VINTR 3
|
||||||
|
#define VKILL 4
|
||||||
|
#define VMIN 5
|
||||||
|
#define VQUIT 6
|
||||||
|
#define VSTART 7
|
||||||
|
#define VSTOP 8
|
||||||
|
#define VSUSP 9
|
||||||
|
#define VTIME 10
|
||||||
|
|
||||||
|
#define NCCS 11
|
||||||
|
|
||||||
|
struct termios
|
||||||
|
{
|
||||||
|
tcflag_t c_iflag; /* Input modes. */
|
||||||
|
tcflag_t c_oflag; /* Output modes. */
|
||||||
|
tcflag_t c_cflag; /* Control modes. */
|
||||||
|
tcflag_t c_lflag; /* Local modes. */
|
||||||
|
cc_t c_cc[NCCS]; /* Control characters. */
|
||||||
|
};
|
||||||
|
|
||||||
// c_iflag
|
|
||||||
#define BRKINT 0x001
|
#define BRKINT 0x001
|
||||||
#define ICRNL 0x002
|
#define ICRNL 0x002
|
||||||
#define IGNBRK 0x004
|
#define IGNBRK 0x004
|
||||||
|
@ -19,51 +50,65 @@
|
||||||
#define IXON 0x400
|
#define IXON 0x400
|
||||||
#define PARMRK 0x800
|
#define PARMRK 0x800
|
||||||
|
|
||||||
// c_oflag
|
#define OPOST 0x0001
|
||||||
#define OPOST 0x0001
|
#define ONLCR 0x0002
|
||||||
#define ONLCR 0x0002
|
#define OCRNL 0x0004
|
||||||
#define OCRNL 0x0004
|
#define ONOCR 0x0008
|
||||||
#define ONOCR 0x0008
|
#define ONLRET 0x0010
|
||||||
#define ONLRET 0x0010
|
#define OFDEL 0x0020
|
||||||
#define OFDEL 0x0020
|
#define OFILL 0x0040
|
||||||
#define OFILL 0x0040
|
#define NLDLY 0x0080
|
||||||
#define NLDLY 0x0080
|
#define NL0 0x0000
|
||||||
#define NL0 0
|
#define NL1 0x0080
|
||||||
#define NL1 1
|
#define CRDLY 0x0300
|
||||||
#define CRDLY 0x0100
|
#define CR0 0x0000
|
||||||
#define CR0 0
|
#define CR1 0x0100
|
||||||
#define CR1 1
|
#define CR2 0x0200
|
||||||
#define CR2 2
|
#define CR3 0x0300
|
||||||
#define CR3 3
|
#define TABDLY 0x0C00
|
||||||
#define TABDLY 0x0200
|
#define TAB0 0x0000
|
||||||
#define TAB0 0
|
#define TAB1 0x0400
|
||||||
#define TAB1 1
|
#define TAB2 0x0800
|
||||||
#define TAB2 2
|
#define TAB3 0x0C00
|
||||||
#define TAB3 3
|
#define BSDLY 0x1000
|
||||||
#define BSDLY 0x0400
|
#define BS0 0x0000
|
||||||
#define BS0 0
|
#define BS1 0x1000
|
||||||
#define BS1 1
|
#define VTDLY 0x2000
|
||||||
#define VTDLY 0x0800
|
#define VT0 0x0000
|
||||||
#define VT0 0
|
#define VT1 0x2000
|
||||||
#define VT1 1
|
#define FFDLY 0x4000
|
||||||
#define FFDLY 0x1000
|
#define FF0 0x0000
|
||||||
#define FF0 0
|
#define FF1 0x4000
|
||||||
#define FF1 1
|
|
||||||
|
|
||||||
// c_cflag
|
#define B0 0
|
||||||
#define CSIZE 0x01
|
#define B50 1
|
||||||
#define CS5 5
|
#define B75 2
|
||||||
#define CS6 6
|
#define B110 3
|
||||||
#define CS7 7
|
#define B134 4
|
||||||
#define CS8 8
|
#define B150 5
|
||||||
#define CSTOPB 0x02
|
#define B200 6
|
||||||
#define CREAD 0x04
|
#define B300 7
|
||||||
#define PARENB 0x08
|
#define B600 8
|
||||||
#define PARODD 0x10
|
#define B1200 9
|
||||||
#define HUPCL 0x20
|
#define B1800 10
|
||||||
#define CLOCAL 0x40
|
#define B2400 11
|
||||||
|
#define B4800 12
|
||||||
|
#define B9600 13
|
||||||
|
#define B19200 14
|
||||||
|
#define B38400 15
|
||||||
|
|
||||||
|
#define CSIZE 0x03
|
||||||
|
#define CS5 0x00
|
||||||
|
#define CS6 0x01
|
||||||
|
#define CS7 0x02
|
||||||
|
#define CS8 0x03
|
||||||
|
#define CSTOPB 0x04
|
||||||
|
#define CREAD 0x08
|
||||||
|
#define PARENB 0x10
|
||||||
|
#define PARODD 0x20
|
||||||
|
#define HUPCL 0x40
|
||||||
|
#define CLOCAL 0x80
|
||||||
|
|
||||||
// c_lflag
|
|
||||||
#define ECHO 0x001
|
#define ECHO 0x001
|
||||||
#define ECHOE 0x002
|
#define ECHOE 0x002
|
||||||
#define ECHOK 0x004
|
#define ECHOK 0x004
|
||||||
|
@ -74,47 +119,31 @@
|
||||||
#define NOFLSH 0x080
|
#define NOFLSH 0x080
|
||||||
#define TOSTOP 0x100
|
#define TOSTOP 0x100
|
||||||
|
|
||||||
// for tcsetattr
|
#define TCSANOW 0
|
||||||
#define TCSANOW 1
|
#define TCSADRAIN 1
|
||||||
#define TCSADRAIN 2
|
#define TCSAFLUSH 2
|
||||||
#define TCSAFLUSH 3
|
|
||||||
|
|
||||||
// for tcflush
|
|
||||||
#define TCIFLUSH 0x01
|
#define TCIFLUSH 0x01
|
||||||
#define TCIOFLUSH (TCIFLUSH | TCOFLUSH)
|
|
||||||
#define TCOFLUSH 0x02
|
#define TCOFLUSH 0x02
|
||||||
|
#define TCIOFLUSH (TCIFLUSH | TCOFLUSH)
|
||||||
|
|
||||||
// for tcflow
|
#define TCIOFF 0
|
||||||
#define TCIOFF 1
|
#define TCION 1
|
||||||
#define TCION 2
|
#define TCOOFF 2
|
||||||
#define TCOOFF 3
|
#define TCOON 3
|
||||||
#define TCOON 4
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
speed_t cfgetispeed(const struct termios* termios_p);
|
||||||
|
speed_t cfgetospeed(const struct termios* termios_p);
|
||||||
typedef int cc_t;
|
int cfsetispeed(struct termios* termios_p, speed_t speed);
|
||||||
typedef int speed_t;
|
int cfsetospeed(struct termios* termios_p, speed_t speed);
|
||||||
typedef int tcflag_t;
|
int tcdrain(int fildes);
|
||||||
|
int tcflow(int fildes, int action);
|
||||||
struct termios
|
int tcflush(int fildes, int queue_selector);
|
||||||
{
|
int tcgetattr(int fildes, struct termios* termios_p);
|
||||||
tcflag_t c_iflag;
|
pid_t tcgetsid(int fildes);
|
||||||
tcflag_t c_oflag;
|
int tcsendbreak(int fildes, int duration);
|
||||||
tcflag_t c_cflag;
|
int tcsetattr(int fildes, int optional_actions, const struct termios* termios_p);
|
||||||
tcflag_t c_lflag;
|
|
||||||
cc_t c_cc[NCCS];
|
|
||||||
};
|
|
||||||
|
|
||||||
speed_t cfgetispeed(const struct termios*);
|
|
||||||
speed_t cfgetospeed(const struct termios*);
|
|
||||||
int cfsetispeed(struct termios*, speed_t);
|
|
||||||
int cfsetospeed(struct termios*, speed_t);
|
|
||||||
int tcdrain(int);
|
|
||||||
int tcflow(int, int);
|
|
||||||
int tcflush(int, int);
|
|
||||||
int tcgetattr(int, struct termios*);
|
|
||||||
pid_t tcgetsid(int);
|
|
||||||
int tcsendbreak(int, int);
|
|
||||||
int tcsetattr(int, int, const struct termios*);
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _TGMATH_H
|
||||||
|
#define _TGMATH_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <complex.h>
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,56 +1,97 @@
|
||||||
#pragma once
|
#ifndef _TIME_H
|
||||||
|
#define _TIME_H 1
|
||||||
|
|
||||||
#include <locale.h>
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
|
||||||
#include <sys/types.h>
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_clock_t
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_time_t
|
||||||
|
#define __need_clockid_t
|
||||||
|
#define __need_timer_t
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define __need_NULL
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
struct tm
|
struct tm
|
||||||
{
|
{
|
||||||
int tm_sec;
|
int tm_sec; /* Seconds [0,60]. */
|
||||||
int tm_min;
|
int tm_min; /* Minutes [0,59]. */
|
||||||
int tm_hour;
|
int tm_hour; /* Hour [0,23]. */
|
||||||
int tm_mday;
|
int tm_mday; /* Day of month [1,31]. */
|
||||||
int tm_mon;
|
int tm_mon; /* Month of year [0,11]. */
|
||||||
int tm_year;
|
int tm_year; /* Years since 1900. */
|
||||||
int tm_wday;
|
int tm_wday; /* Day of week [0,6] (Sunday =0). */
|
||||||
int tm_yday;
|
int tm_yday; /* Day of year [0,365]. */
|
||||||
int tm_isdst;
|
int tm_isdst; /* Daylight Savings flag. */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct timespec
|
struct timespec
|
||||||
{
|
{
|
||||||
time_t tv_sec;
|
time_t tv_sec; /* Seconds. */
|
||||||
long tv_nsec;
|
long tv_nsec; /* Nanoseconds. */
|
||||||
};
|
};
|
||||||
|
|
||||||
char* asctime(const struct tm*);
|
struct itimerspec
|
||||||
char* asctime_r(const struct tm*, char*);
|
{
|
||||||
|
struct timespec it_interval; /* Timer period. */
|
||||||
|
struct timespec it_value; /* Timer expiration. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define CLOCKS_PER_SEC ((clock_t)1000000)
|
||||||
|
|
||||||
|
#define CLOCK_MONOTONIC 0
|
||||||
|
#define CLOCK_PROCESS_CPUTIME_ID 1
|
||||||
|
#define CLOCK_REALTIME 2
|
||||||
|
#define CLOCK_THREAD_CPUTIME_ID 3
|
||||||
|
|
||||||
|
#define TIMER_ABSTIME 1
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
// #define getdate_err(int)
|
||||||
|
|
||||||
|
char* asctime(const struct tm* timeptr);
|
||||||
|
char* asctime_r(const struct tm* __restrict tm, char* __restrict buf);
|
||||||
clock_t clock(void);
|
clock_t clock(void);
|
||||||
int clock_getcpuclockid(pid_t, clockid_t*);
|
int clock_getcpuclockid(pid_t pid, clockid_t* clock_id);
|
||||||
int clock_getres(clockid_t, struct timespe*);
|
int clock_getres(clockid_t clock_id, struct timespec* res);
|
||||||
int clock_gettime(clockid_t, struct timespec*);
|
int clock_gettime(clockid_t clock_id, struct timespec* tp);
|
||||||
int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*);
|
int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec* rqtp, struct timespec* rmtp);
|
||||||
int clock_settime(clockid_t, const struct timespec*);
|
int clock_settime(clockid_t clock_id, const struct timespec* tp);
|
||||||
char* ctime(const time_t*);
|
char* ctime(const time_t* clock);
|
||||||
char* ctime_r(const time_t*, char*);
|
char* ctime_r(const time_t* clock, char* buf);
|
||||||
double difftime(time_t, time_t);
|
double difftime(time_t time1, time_t time0);
|
||||||
struct tm* getdate(const char*);
|
struct tm* getdate(const char* string);
|
||||||
struct tm* gmtime(const time_t*);
|
struct tm* gmtime(const time_t* timer);
|
||||||
struct tm* gmtime_r(const time_t*, struct tm*);
|
struct tm* gmtime_r(const time_t* __restrict timer, struct tm* __restrict result);
|
||||||
struct tm* localtime(const time_t*);
|
struct tm* localtime(const time_t* timer);
|
||||||
struct tm* localtime_r(const time_t*, struct tm*);
|
struct tm* localtime_r(const time_t* __restrict timer, struct tm* __restrict result);
|
||||||
time_t mktime(struct tm*);
|
time_t mktime(struct tm* timeptr);
|
||||||
int nanosleep(const struct timespec*, struct timespec*);
|
int nanosleep(const struct timespec* rqtp, struct timespec* rmtp);
|
||||||
size_t strftime(char*, size_t, const char*, const struct tm*);
|
size_t strftime(char* __restrict s, size_t maxsize, const char* __restrict format, const struct tm* __restrict timeptr);
|
||||||
size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t);
|
size_t strftime_l(char* __restrict s, size_t maxsize, const char* __restrict format, const struct tm* __restrict timeptr, locale_t locale);
|
||||||
char *strptime(const char*, const char*, struct tm*);
|
char* strptime(const char* __restrict buf, const char* __restrict format, struct tm* __restrict tm);
|
||||||
time_t time(time_t*);
|
time_t time(time_t* tloc);
|
||||||
int timer_create(clockid_t, struct sigevent*, timer_t*);
|
int timer_create(clockid_t clockid, struct sigevent* __restrict evp, timer_t* __restrict timerid);
|
||||||
int timer_delete(timer_t);
|
int timer_delete(timer_t timerid);
|
||||||
int timer_getoverrun(timer_t);
|
int timer_getoverrun(timer_t timerid);
|
||||||
int timer_gettime(timer_t, struct itimerspec*);
|
int timer_gettime(timer_t timerid, struct itimerspec* value);
|
||||||
int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*);
|
int timer_settime(timer_t timerid, int, const struct itimerspec* __restrict value, struct itimerspec* __restrict ovalue);
|
||||||
void tzset(void);
|
void tzset(void);
|
||||||
|
|
||||||
__END_DECLS
|
extern int daylight;
|
||||||
|
extern long timezone;
|
||||||
|
extern char* tzname[];
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _ULIMIT_H
|
||||||
|
#define _ULIMIT_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ulimit.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define UL_GETFSIZE 0
|
||||||
|
#define UL_SETFSIZE 1
|
||||||
|
|
||||||
|
long ulimit(int, ...);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,96 +1,216 @@
|
||||||
#pragma once
|
#ifndef _UNISTD_H
|
||||||
|
#define _UNISTD_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define _POSIX_VERSION 200809L
|
||||||
|
#define _POSIX2_VERSION -1
|
||||||
|
#define _XOPEN_VERSION 700
|
||||||
|
|
||||||
|
#define _POSIX_ADVISORY_INFO -1
|
||||||
|
#define _POSIX_ASYNCHRONOUS_IO -1
|
||||||
|
#define _POSIX_BARRIERS -1
|
||||||
|
#define _POSIX_CHOWN_RESTRICTED -1
|
||||||
|
#define _POSIX_CLOCK_SELECTION -1
|
||||||
|
#define _POSIX_CPUTIME -1
|
||||||
|
#define _POSIX_FSYNC -1
|
||||||
|
#define _POSIX_IPV6 -1
|
||||||
|
#define _POSIX_JOB_CONTROL -1
|
||||||
|
#define _POSIX_MAPPED_FILES -1
|
||||||
|
#define _POSIX_MEMLOCK -1
|
||||||
|
#define _POSIX_MEMLOCK_RANGE -1
|
||||||
|
#define _POSIX_MEMORY_PROTECTION -1
|
||||||
|
#define _POSIX_MESSAGE_PASSING -1
|
||||||
|
#define _POSIX_MONOTONIC_CLOCK -1
|
||||||
|
#define _POSIX_NO_TRUNC -1
|
||||||
|
#define _POSIX_PRIORITIZED_IO -1
|
||||||
|
#define _POSIX_PRIORITY_SCHEDULING -1
|
||||||
|
#define _POSIX_RAW_SOCKETS -1
|
||||||
|
#define _POSIX_READER_WRITER_LOCKS -1
|
||||||
|
#define _POSIX_REALTIME_SIGNALS -1
|
||||||
|
#define _POSIX_REGEXP -1
|
||||||
|
#define _POSIX_SAVED_IDS -1
|
||||||
|
#define _POSIX_SEMAPHORES -1
|
||||||
|
#define _POSIX_SHARED_MEMORY_OBJECTS -1
|
||||||
|
#define _POSIX_SHELL -1
|
||||||
|
#define _POSIX_SPAWN -1
|
||||||
|
#define _POSIX_SPIN_LOCKS -1
|
||||||
|
#define _POSIX_SPORADIC_SERVER -1
|
||||||
|
#define _POSIX_SYNCHRONIZED_IO xx
|
||||||
|
#define _POSIX_THREAD_ATTR_STACKADDR -1
|
||||||
|
#define _POSIX_THREAD_ATTR_STACKSIZE -1
|
||||||
|
#define _POSIX_THREAD_CPUTIME -1
|
||||||
|
#define _POSIX_THREAD_PRIO_INHERIT -1
|
||||||
|
#define _POSIX_THREAD_PRIO_PROTECT -1
|
||||||
|
#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
|
||||||
|
#define _POSIX_THREAD_PROCESS_SHARED -1
|
||||||
|
#define _POSIX_THREAD_ROBUST_PRIO_INHERIT -1
|
||||||
|
#define _POSIX_THREAD_ROBUST_PRIO_PROTECT -1
|
||||||
|
#define _POSIX_THREAD_SAFE_FUNCTIONS -1
|
||||||
|
#define _POSIX_THREAD_SPORADIC_SERVER -1
|
||||||
|
#define _POSIX_THREADS -1
|
||||||
|
#define _POSIX_TIMEOUTS -1
|
||||||
|
#define _POSIX_TIMERS -1
|
||||||
|
#define _POSIX_TRACE -1
|
||||||
|
#define _POSIX_TRACE_EVENT_FILTER -1
|
||||||
|
#define _POSIX_TRACE_INHERIT -1
|
||||||
|
#define _POSIX_TRACE_LOG -1
|
||||||
|
#define _POSIX_TYPED_MEMORY_OBJECTS -1
|
||||||
|
#define _POSIX_V6_ILP32_OFF32 -1
|
||||||
|
#define _POSIX_V6_ILP32_OFFBIG -1
|
||||||
|
#define _POSIX_V6_LP64_OFF64 -1
|
||||||
|
#define _POSIX_V6_LPBIG_OFFBIG -1
|
||||||
|
#define _POSIX_V7_ILP32_OFF32 -1
|
||||||
|
#define _POSIX_V7_ILP32_OFFBIG -1
|
||||||
|
#define _POSIX_V7_LP64_OFF64 -1
|
||||||
|
#define _POSIX_V7_LPBIG_OFFBIG -1
|
||||||
|
#define _POSIX2_C_BIND -1
|
||||||
|
#define _POSIX2_C_DEV -1
|
||||||
|
#define _POSIX2_CHAR_TERM -1
|
||||||
|
#define _POSIX2_FORT_DEV -1
|
||||||
|
#define _POSIX2_FORT_RUN -1
|
||||||
|
#define _POSIX2_LOCALEDEF -1
|
||||||
|
#define _POSIX2_PBS -1
|
||||||
|
#define _POSIX2_PBS_ACCOUNTING -1
|
||||||
|
#define _POSIX2_PBS_CHECKPOINT -1
|
||||||
|
#define _POSIX2_PBS_LOCATE -1
|
||||||
|
#define _POSIX2_PBS_MESSAGE -1
|
||||||
|
#define _POSIX2_PBS_TRACK -1
|
||||||
|
#define _POSIX2_SW_DEV -1
|
||||||
|
#define _POSIX2_UPE -1
|
||||||
|
#define _XOPEN_CRYPT -1
|
||||||
|
#define _XOPEN_ENH_I18N -1
|
||||||
|
#define _XOPEN_REALTIME -1
|
||||||
|
#define _XOPEN_REALTIME_THREADS -1
|
||||||
|
#define _XOPEN_SHM -1
|
||||||
|
#define _XOPEN_STREAMS -1
|
||||||
|
#define _XOPEN_UNIX -1
|
||||||
|
#define _XOPEN_UUCP -1
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#define __need_ssize_t
|
||||||
|
#define __need_uid_t
|
||||||
|
#define __need_gid_t
|
||||||
|
#define __need_off_t
|
||||||
|
#define __need_pid_t
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
// FIXME: _CS prefixed definitions
|
||||||
|
|
||||||
|
// FIXME: _PC prefixed definitions
|
||||||
|
|
||||||
|
#define F_OK 0x01
|
||||||
|
#define R_OK 0x02
|
||||||
|
#define W_OK 0x04
|
||||||
|
#define X_OK 0x08
|
||||||
|
|
||||||
|
#define F_LOCK 0
|
||||||
|
#define F_TEST 1
|
||||||
|
#define F_TLOCK 2
|
||||||
|
#define F_ULOCK 3
|
||||||
|
|
||||||
#define STDIN_FILENO 0
|
#define STDIN_FILENO 0
|
||||||
#define STDOUT_FILENO 1
|
#define STDOUT_FILENO 1
|
||||||
#define STDERR_FILENO 2
|
#define STDERR_FILENO 2
|
||||||
|
|
||||||
__BEGIN_DECLS
|
#define _POSIX_VDISABLE 0
|
||||||
|
|
||||||
int access(const char*, int);
|
int access(const char* path, int amode);
|
||||||
unsigned alarm(unsigned);
|
unsigned alarm(unsigned seconds);
|
||||||
int chdir(const char*);
|
int chdir(const char* path);
|
||||||
int chown(const char*, uid_t, gid_t);
|
int chown(const char* path, uid_t owner, gid_t group);
|
||||||
int close(int);
|
int close(int fildes);
|
||||||
size_t confstr(int, char*, size_t);
|
size_t confstr(int name, char* buf, size_t len);
|
||||||
char* crypt(const char*, const char*);
|
char* crypt(const char* key, const char* salt);
|
||||||
int dup(int);
|
int dup(int fildes);
|
||||||
int dup2(int, int);
|
int dup2(int fildes, int fildes2);
|
||||||
void _exit(int);
|
[[noreturn]] void _exit(int status);
|
||||||
void encrypt(char[64], int);
|
void encrypt(char block[64], int edflag);
|
||||||
int execl(const char*, const char*, ...);
|
int execl(const char* path, const char* arg0, ...);
|
||||||
int execle(const char*, const char*, ...);
|
int execle(const char* path, const char* arg0, ...);
|
||||||
int execlp(const char*, const char*, ...);
|
int execlp(const char* file, const char* arg0, ...);
|
||||||
int execv(const char*, char* const[]);
|
int execv(const char* path, char* const argv[]);
|
||||||
int execve(const char*, char* const[], char* const[]);
|
int execve(const char* path, char* const argv[], char* const envp[]);
|
||||||
int execvp(const char*, char* const[]);
|
int execvp(const char* file, char* const argv[]);
|
||||||
int faccessat(int, const char*, int, int);
|
int faccessat(int fd, const char* path, int amode, int flag);
|
||||||
int fchdir(int);
|
int fchdir(int fildes);
|
||||||
int fchown(int, uid_t, gid_t);
|
int fchown(int fildes, uid_t owner, gid_t group);
|
||||||
int fchownat(int, const char*, uid_t, gid_t, int);
|
int fchownat(int fd, const char* path, uid_t owner, gid_t group, int flag);
|
||||||
int fdatasync(int);
|
int fdatasync(int fildes);
|
||||||
int fexecve(int, char* const[], char* const[]);
|
int fexecve(int fd, char* const argv[], char* const envp[]);
|
||||||
pid_t fork(void);
|
pid_t fork(void);
|
||||||
long fpathconf(int, int);
|
long fpathconf(int fildes, int name);
|
||||||
int fsync(int);
|
int fsync(int fildes);
|
||||||
int ftruncate(int, off_t);
|
int ftruncate(int fildes, off_t length);
|
||||||
char* getcwd(char*, size_t);
|
char* getcwd(char* buf , size_t size);
|
||||||
gid_t getegid(void);
|
gid_t getegid(void);
|
||||||
uid_t geteuid(void);
|
uid_t geteuid(void);
|
||||||
gid_t getgid(void);
|
gid_t getgid(void);
|
||||||
int getgroups(int, gid_t[]);
|
int getgroups(int gidsetsize, gid_t grouplist[]);
|
||||||
long gethostid(void);
|
long gethostid(void);
|
||||||
int gethostname(char*, size_t);
|
int gethostname(char* name, size_t namelen);
|
||||||
char* getlogin(void);
|
char* getlogin(void);
|
||||||
int getlogin_r(char*, size_t);
|
int getlogin_r(char* name, size_t namesize);
|
||||||
int getopt(int, char* const[], const char*);
|
int getopt(int argc, char* const argv[], const char* optstring);
|
||||||
pid_t getpgid(pid_t);
|
pid_t getpgid(pid_t pid);
|
||||||
pid_t getpgrp(void);
|
pid_t getpgrp(void);
|
||||||
pid_t getpid(void);
|
pid_t getpid(void);
|
||||||
pid_t getppid(void);
|
pid_t getppid(void);
|
||||||
pid_t getsid(pid_t);
|
pid_t getsid(pid_t pid);
|
||||||
uid_t getuid(void);
|
uid_t getuid(void);
|
||||||
int isatty(int);
|
int isatty(int fildes);
|
||||||
int lchown(const char*, uid_t, gid_t);
|
int lchown(const char* path, uid_t owner, gid_t group);
|
||||||
int link(const char*, const char*);
|
int link(const char* path1, const char* path2);
|
||||||
int linkat(int, const char*, int, const char*, int);
|
int linkat(int fd1, const char* path1, int fd2, const char* path2, int flag);
|
||||||
int lockf(int, int, off_t);
|
int lockf(int fildes, int function, off_t size);
|
||||||
off_t lseek(int, off_t, int);
|
off_t lseek(int fildes, off_t offset, int whence);
|
||||||
int nice(int);
|
int nice(int incr);
|
||||||
long pathconf(const char*, int);
|
long pathconf(const char* path, int name);
|
||||||
int pause(void);
|
int pause(void);
|
||||||
int pipe(int[2]);
|
int pipe(int fildes[2]);
|
||||||
ssize_t pread(int, void*, size_t, off_t);
|
ssize_t pread(int fildes, void* buf, size_t nbyte, off_t offset);
|
||||||
ssize_t pwrite(int, const void*, size_t, off_t);
|
ssize_t pwrite(int fildes, const void* buf, size_t nbyte, off_t offset);
|
||||||
ssize_t read(int, void*, size_t);
|
ssize_t read(int fildes, void* buf, size_t nbyte);
|
||||||
ssize_t readlink(const char*, char*, size_t);
|
ssize_t readlink(const char* __restrict path, char* __restrict buf, size_t bufsize);
|
||||||
ssize_t readlinkat(int, const char*, char*, size_t);
|
ssize_t readlinkat(int fd, const char* __restrict path, char* __restrict buf, size_t bufsize);
|
||||||
int rmdir(const char*);
|
int rmdir(const char* path);
|
||||||
int setegid(gid_t);
|
int setegid(gid_t gid);
|
||||||
int seteuid(uid_t);
|
int seteuid(uid_t uid);
|
||||||
int setgid(gid_t);
|
int setgid(gid_t gid);
|
||||||
int setpgid(pid_t, pid_t);
|
int setpgid(pid_t pid, pid_t pgid);
|
||||||
pid_t setpgrp(void);
|
pid_t setpgrp(void);
|
||||||
int setregid(gid_t, gid_t);
|
int setregid(gid_t rgid, gid_t egid);
|
||||||
int setreuid(uid_t, uid_t);
|
int setreuid(uid_t ruid, uid_t euid);
|
||||||
pid_t setsid(void);
|
pid_t setsid(void);
|
||||||
int setuid(uid_t);
|
int setuid(uid_t uid);
|
||||||
unsigned sleep(unsigned);
|
unsigned sleep(unsigned seconds);
|
||||||
void swab(const void*, void*, ssize_t);
|
void swab(const void* __restrict src, void* __restrict dest, ssize_t nbytes);
|
||||||
int symlink(const char*, const char*);
|
int symlink(const char* path1, const char* path2);
|
||||||
int symlinkat(const char*, int, const char*);
|
int symlinkat(const char* path1, int fd, const char* path2);
|
||||||
void sync(void);
|
void sync(void);
|
||||||
long sysconf(int);
|
long sysconf(int name);
|
||||||
pid_t tcgetpgrp(int);
|
pid_t tcgetpgrp(int fildes);
|
||||||
int tcsetpgrp(int, pid_t);
|
int tcsetpgrp(int fildes, pid_t pgid_id);
|
||||||
int truncate(const char*, off_t);
|
int truncate(const char* path, off_t length);
|
||||||
char* ttyname(int);
|
char* ttyname(int fildes);
|
||||||
int ttyname_r(int, char*, size_t);
|
int ttyname_r(int fildes, char* name, size_t namesize);
|
||||||
int unlink(const char*);
|
int unlink(const char* path);
|
||||||
int unlinkat(int, const char*, int);
|
int unlinkat(int fd, const char* path, int flag);
|
||||||
ssize_t write(int, const void*, size_t);
|
ssize_t write(int fildes, const void* buf, size_t nbyte);
|
||||||
|
|
||||||
long syscall(long, ...);
|
extern char* optarg;
|
||||||
|
extern int opterr, optind, optopt;
|
||||||
|
|
||||||
__END_DECLS
|
long syscall(long syscall, ...);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _UTIME_H
|
||||||
|
#define _UTIME_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utime.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_time_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct utimbuf
|
||||||
|
{
|
||||||
|
time_t actime; /* Access time. */
|
||||||
|
time_t modtime; /* Modification time. */
|
||||||
|
};
|
||||||
|
|
||||||
|
int utime(const char* path, const struct utimbuf* times);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,43 @@
|
||||||
|
#ifndef _UTMPX_H
|
||||||
|
#define _UTMPX_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/utmpx.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_pid_t
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
struct utmpx
|
||||||
|
{
|
||||||
|
char ut_user[32]; /* User login name. */
|
||||||
|
char ut_id[4]; /* Unspecified initialization process identifier. */
|
||||||
|
char ut_line[32]; /* Device name. */
|
||||||
|
pid_t ut_pid; /* Process ID. */
|
||||||
|
short ut_type; /* Type of entry. */
|
||||||
|
struct timeval ut_tv; /* Time entry was made. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define EMPTY 0
|
||||||
|
#define BOOT_TIME 1
|
||||||
|
#define OLD_TIME 2
|
||||||
|
#define NEW_TIME 3
|
||||||
|
#define USER_PROCESS 4
|
||||||
|
#define INIT_PROCESS 5
|
||||||
|
#define LOGIN_PROCESS 6
|
||||||
|
#define DEAD_PROCESS 7
|
||||||
|
|
||||||
|
void endutxent(void);
|
||||||
|
struct utmpx* getutxent(void);
|
||||||
|
struct utmpx* getutxid(const struct utmpx* id);
|
||||||
|
struct utmpx* getutxline(const struct utmpx* line);
|
||||||
|
struct utmpx* pututxline(const struct utmpx* utmpx);
|
||||||
|
void setutxent(void);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,123 @@
|
||||||
|
#ifndef _WCHAR_H
|
||||||
|
#define _WCHAR_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
|
struct __mbstate_t;
|
||||||
|
typedef struct __mbstate_t mbstate_t;
|
||||||
|
|
||||||
|
typedef int wctype_t;
|
||||||
|
|
||||||
|
typedef __WINT_TYPE__ wint_t;
|
||||||
|
|
||||||
|
#define WCHAR_MIN __WCHAR_MIN__
|
||||||
|
#define WCHAR_MAX __WCHAR_MAX__
|
||||||
|
#define WEOF ((wchar_t)-1)
|
||||||
|
|
||||||
|
wint_t btowc(int c);
|
||||||
|
wint_t fgetwc(FILE* stream);
|
||||||
|
wchar_t* fgetws(wchar_t* __restrict ws, int n, FILE* __restrict stream);
|
||||||
|
wint_t fputwc(wchar_t c, FILE* stream);
|
||||||
|
int fputws(const wchar_t* __restrict ws, FILE* __restrict stream);
|
||||||
|
int fwide(FILE* stream, int mode);
|
||||||
|
int fwprintf(FILE* __restrict stream, const wchar_t* __restrict format, ...);
|
||||||
|
int fwscanf(FILE* __restrict stream, const wchar_t* __restrict format, ...);
|
||||||
|
wint_t getwc(FILE* stream);
|
||||||
|
wint_t getwchar(void);
|
||||||
|
int iswalnum(wint_t wc);
|
||||||
|
int iswalpha(wint_t wc);
|
||||||
|
int iswcntrl(wint_t wc);
|
||||||
|
int iswctype(wint_t wc, wctype_t charclass);
|
||||||
|
int iswdigit(wint_t wc);
|
||||||
|
int iswgraph(wint_t wc);
|
||||||
|
int iswlower(wint_t wc);
|
||||||
|
int iswprint(wint_t wc);
|
||||||
|
int iswpunct(wint_t wc);
|
||||||
|
int iswspace(wint_t wc);
|
||||||
|
int iswupper(wint_t wc);
|
||||||
|
int iswxdigit(wint_t wc);
|
||||||
|
size_t mbrlen(const char* __restrict s, size_t n, mbstate_t* __restrict ps);
|
||||||
|
size_t mbrtowc(wchar_t* __restrict pwc, const char* __restrict s, size_t n, mbstate_t* __restrict ps);
|
||||||
|
int mbsinit(const mbstate_t* ps);
|
||||||
|
size_t mbsnrtowcs(wchar_t* __restrict dst, const char** __restrict src, size_t nmc, size_t len, mbstate_t* __restrict ps);
|
||||||
|
size_t mbsrtowcs(wchar_t* __restrict dst, const char** __restrict src, size_t len, mbstate_t* __restrict ps);
|
||||||
|
FILE* open_wmemstream(wchar_t** bufp, size_t* sizep);
|
||||||
|
wint_t putwc(wchar_t wc, FILE* stream);
|
||||||
|
wint_t putwchar(wchar_t wc);
|
||||||
|
int swprintf(wchar_t* __restrict ws, size_t n, const wchar_t* __restrict format, ...);
|
||||||
|
int swscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, ...);
|
||||||
|
wint_t towlower(wint_t wc);
|
||||||
|
wint_t towupper(wint_t wc);
|
||||||
|
wint_t ungetwc(wint_t wc, FILE* stream);
|
||||||
|
int vfwprintf(FILE* __restrict stream, const wchar_t* __restrict format, va_list arg);
|
||||||
|
int vfwscanf(FILE* __restrict stream, const wchar_t* __restrict format, va_list arg);
|
||||||
|
int vswprintf(wchar_t* __restrict ws, size_t n, const wchar_t* __restrict format, va_list arg);
|
||||||
|
int vswscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, va_list arg);
|
||||||
|
int vwprintf(const wchar_t* __restrict format, va_list arg);
|
||||||
|
int vwscanf(const wchar_t* __restrict format, va_list arg);
|
||||||
|
wchar_t* wcpcpy(wchar_t* __restrict ws1, const wchar_t* __restrict ws2);
|
||||||
|
wchar_t* wcpncpy(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n);
|
||||||
|
size_t wcrtomb(char* __restrict s, wchar_t ws, mbstate_t* __restrict ps);
|
||||||
|
int wcscasecmp(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
int wcscasecmp_l(const wchar_t* ws1, const wchar_t* ws2, locale_t locale);
|
||||||
|
wchar_t* wcscat(wchar_t* __restrict ws1, const wchar_t* __restrict ws2);
|
||||||
|
wchar_t* wcschr(const wchar_t* ws, wchar_t wc);
|
||||||
|
int wcscmp(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
int wcscoll(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
int wcscoll_l(const wchar_t* ws1, const wchar_t* ws2, locale_t locale);
|
||||||
|
wchar_t* wcscpy(wchar_t* __restrict ws1, const wchar_t* __restrict ws2);
|
||||||
|
size_t wcscspn(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
wchar_t* wcsdup(const wchar_t* string);
|
||||||
|
size_t wcsftime(wchar_t* __restrict wcs, size_t maxsize, const wchar_t* __restrict format, const struct tm* __restrict timeptr);
|
||||||
|
size_t wcslen(const wchar_t* ws);
|
||||||
|
int wcsncasecmp(const wchar_t* ws1, const wchar_t* ws2, size_t n);
|
||||||
|
int wcsncasecmp_l(const wchar_t* ws1, const wchar_t* ws2, size_t n, locale_t locale);
|
||||||
|
wchar_t* wcsncat(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n);
|
||||||
|
int wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t n);
|
||||||
|
wchar_t* wcsncpy(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n);
|
||||||
|
size_t wcsnlen(const wchar_t* ws, size_t maxlen);
|
||||||
|
size_t wcsnrtombs(char* __restrict dst, const wchar_t** __restrict src, size_t nwc, size_t len, mbstate_t* __restrict ps);
|
||||||
|
wchar_t* wcspbrk(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
wchar_t* wcsrchr(const wchar_t* ws, wchar_t wc);
|
||||||
|
size_t wcsrtombs(char* __restrict dst, const wchar_t** __restrict src, size_t len, mbstate_t* __restrict ps);
|
||||||
|
size_t wcsspn(const wchar_t* ws1, const wchar_t* ws2);
|
||||||
|
wchar_t* wcsstr(const wchar_t* __restrict ws1, const wchar_t* __restrict ws2);
|
||||||
|
double wcstod(const wchar_t* __restrict nptr, wchar_t** __restrict endptr);
|
||||||
|
float wcstof(const wchar_t* __restrict nptr, wchar_t** __restrict endptr);
|
||||||
|
wchar_t* wcstok(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, wchar_t** __restrict ptr);
|
||||||
|
long wcstol(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
long double wcstold(const wchar_t* __restrict nptr, wchar_t** __restrict endptr);
|
||||||
|
long long wcstoll(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
unsigned long wcstoul(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
unsigned long long wcstoull(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base);
|
||||||
|
int wcswidth(const wchar_t* pwcs, size_t n);
|
||||||
|
size_t wcsxfrm(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n);
|
||||||
|
size_t wcsxfrm_l(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n, locale_t locale);
|
||||||
|
int wctob(wint_t c);
|
||||||
|
wctype_t wctype(const char* property);
|
||||||
|
int wcwidth(wchar_t wc);
|
||||||
|
wchar_t* wmemchr(const wchar_t* ws, wchar_t wc, size_t n);
|
||||||
|
int wmemcmp(const wchar_t* ws1, const wchar_t* ws2, size_t n);
|
||||||
|
wchar_t* wmemcpy(wchar_t* __restrict ws1, const wchar_t* __restrict ws2, size_t n);
|
||||||
|
wchar_t* wmemmove(wchar_t* ws1, const wchar_t* ws2, size_t n);
|
||||||
|
wchar_t* wmemset(wchar_t* ws, wchar_t wc, size_t n);
|
||||||
|
int wprintf(const wchar_t* __restrict format, ...);
|
||||||
|
int wscanf(const wchar_t* __restrict format, ...);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,62 @@
|
||||||
|
#ifndef _WCTYPE_H
|
||||||
|
#define _WCTYPE_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <bits/types/locale_t.h>
|
||||||
|
|
||||||
|
typedef int* wctrans_t;
|
||||||
|
|
||||||
|
int iswalnum(wint_t wc);
|
||||||
|
int iswalnum_l(wint_t wc, locale_t locale);
|
||||||
|
int iswalpha(wint_t wc);
|
||||||
|
int iswalpha_l(wint_t wc, locale_t locale);
|
||||||
|
int iswblank(wint_t wc);
|
||||||
|
int iswblank_l(wint_t wc, locale_t locale);
|
||||||
|
int iswcntrl(wint_t wc);
|
||||||
|
int iswcntrl_l(wint_t wc, locale_t locale);
|
||||||
|
int iswctype(wint_t wc, wctype_t);
|
||||||
|
int iswctype_l(wint_t wc, wctype_t, locale_t locale);
|
||||||
|
int iswdigit(wint_t wc);
|
||||||
|
int iswdigit_l(wint_t wc, locale_t locale);
|
||||||
|
int iswgraph(wint_t wc);
|
||||||
|
int iswgraph_l(wint_t wc, locale_t locale);
|
||||||
|
int iswlower(wint_t wc);
|
||||||
|
int iswlower_l(wint_t wc, locale_t locale);
|
||||||
|
int iswprint(wint_t wc);
|
||||||
|
int iswprint_l(wint_t wc, locale_t locale);
|
||||||
|
int iswpunct(wint_t wc);
|
||||||
|
int iswpunct_l(wint_t wc, locale_t locale);
|
||||||
|
int iswspace(wint_t wc);
|
||||||
|
int iswspace_l(wint_t wc, locale_t locale);
|
||||||
|
int iswupper(wint_t wc);
|
||||||
|
int iswupper_l(wint_t wc, locale_t locale);
|
||||||
|
int iswxdigit(wint_t wc);
|
||||||
|
int iswxdigit_l(wint_t wc, locale_t locale);
|
||||||
|
wint_t towctrans(wint_t wc, wctrans_t);
|
||||||
|
wint_t towctrans_l(wint_t wc, wctrans_t, locale_t locale);
|
||||||
|
wint_t towlower(wint_t wc);
|
||||||
|
wint_t towlower_l(wint_t wc, locale_t locale);
|
||||||
|
wint_t towupper(wint_t wc);
|
||||||
|
wint_t towupper_l(wint_t wc, locale_t locale);
|
||||||
|
wctrans_t wctrans(const char* charclass);
|
||||||
|
wctrans_t wctrans_l(const char* charclass, locale_t locale);
|
||||||
|
wctype_t wctype(const char* property);
|
||||||
|
wctype_t wctype_l(const char* property, locale_t locale);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef _WORDEXP_H
|
||||||
|
#define _WORDEXP_H 1
|
||||||
|
|
||||||
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wordexp.h.html
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define __need_size_t
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
size_t we_wordc; /* Count of words matched by words. */
|
||||||
|
char** we_wordv; /* Pointer to list of expanded words. */
|
||||||
|
size_t we_offs; /* Slots to reserve at the beginning of we_wordv. */
|
||||||
|
} wordexp_t;
|
||||||
|
|
||||||
|
#define WRDE_APPEND 0x01
|
||||||
|
#define WRDE_DOOFFS 0x02
|
||||||
|
#define WRDE_NOCMD 0x04
|
||||||
|
#define WRDE_REUSE 0x08
|
||||||
|
#define WRDE_SHOWERR 0x10
|
||||||
|
#define WRDE_UNDEF 0x20
|
||||||
|
|
||||||
|
#define WRDE_BADCHAR 1
|
||||||
|
#define WRDE_BADVAL 2
|
||||||
|
#define WRDE_CMDSUB 3
|
||||||
|
#define WRDE_NOSPACE 4
|
||||||
|
#define WRDE_SYNTAX 5
|
||||||
|
|
||||||
|
int wordexp(const char* __restrict words, wordexp_t* __restrict pwordexp, int flags);
|
||||||
|
void wordfree(wordexp_t* pwordexp);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,6 @@
|
||||||
#include <BAN/Traits.h>
|
#include <BAN/Traits.h>
|
||||||
#include <BAN/Math.h>
|
#include <BAN/Math.h>
|
||||||
|
#include <bits/printf.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
#include <bits/printf.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <printf_impl.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <BAN/Assert.h>
|
#include <BAN/Assert.h>
|
||||||
|
#include <kernel/Syscall.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
Loading…
Reference in New Issue