mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-02 10:59:15 +00:00
userspace: Rewrite everything
Everything. Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
@ -1,4 +1,43 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _ASSERT_H
|
||||
#define _ASSERT_H
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
void __assert_fail(const char *file, int line, const char *func) __attribute__((noreturn));
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define assert(e) ((void)0)
|
||||
#else // NDEBUG
|
||||
#define assert(e) \
|
||||
do \
|
||||
{ \
|
||||
if (__builtin_expect(!!(!(e)), 0)) \
|
||||
__assert_fail(__FILE__, __LINE__, __func__); \
|
||||
} while (0)
|
||||
#endif // NDEBUG
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_ASSERT_H
|
||||
|
@ -1,69 +0,0 @@
|
||||
#ifndef __FENNIX_LIBC_AUX_H__
|
||||
#define __FENNIX_LIBC_AUX_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define AT_NULL 0
|
||||
#define AT_IGNORE 1
|
||||
#define AT_EXECFD 2
|
||||
#define AT_PHDR 3
|
||||
#define AT_PHENT 4
|
||||
#define AT_PHNUM 5
|
||||
#define AT_PAGESZ 6
|
||||
#define AT_BASE 7
|
||||
#define AT_FLAGS 8
|
||||
#define AT_ENTRY 9
|
||||
#define AT_NOTELF 10
|
||||
#define AT_UID 11
|
||||
#define AT_EUID 12
|
||||
#define AT_GID 13
|
||||
#define AT_EGID 14
|
||||
#define AT_PLATFORM 15
|
||||
#define AT_HWCAP 16
|
||||
#define AT_CLKTCK 17
|
||||
#define AT_SECURE 23
|
||||
#define AT_BASE_PLATFORM 24
|
||||
#define AT_RANDOM 25
|
||||
#define AT_HWCAP2 26
|
||||
#define AT_EXECFN 31
|
||||
#define AT_SYSINFO 32
|
||||
#define AT_SYSINFO_EHDR 33
|
||||
#define AT_L1I_CACHESHAPE 34
|
||||
#define AT_L1D_CACHESHAPE 35
|
||||
#define AT_L2_CACHESHAPE 36
|
||||
#define AT_L3_CACHESHAPE 37
|
||||
#define AT_L1I_CACHESIZE 40
|
||||
#define AT_L1I_CACHEGEOMETRY 41
|
||||
#define AT_L1D_CACHESIZE 42
|
||||
#define AT_L1D_CACHEGEOMETRY 43
|
||||
#define AT_L2_CACHESIZE 44
|
||||
#define AT_L2_CACHEGEOMETRY 45
|
||||
#define AT_L3_CACHESIZE 46
|
||||
#define AT_L3_CACHEGEOMETRY 47
|
||||
#define AT_MINSIGSTKSZ 51
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t a_type;
|
||||
union
|
||||
{
|
||||
uint32_t a_val;
|
||||
} a_un;
|
||||
} Elf32_auxv_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t a_type;
|
||||
union
|
||||
{
|
||||
uint64_t a_val;
|
||||
} a_un;
|
||||
} Elf64_auxv_t;
|
||||
|
||||
#ifdef __LP64__
|
||||
#define Elf_auxv_t Elf64_auxv_t
|
||||
#else
|
||||
#define Elf_auxv_t Elf32_auxv_t
|
||||
#endif
|
||||
|
||||
#endif // !__FENNIX_LIBC_AUX_H__
|
@ -1,6 +0,0 @@
|
||||
#ifndef _BITS_TYPES_SIGSET_T_H
|
||||
#define _BITS_TYPES_SIGSET_T_H
|
||||
|
||||
typedef unsigned long sigset_t;
|
||||
|
||||
#endif // !_BITS_TYPES_SIGSET_T_H
|
@ -1,9 +0,0 @@
|
||||
#ifndef _BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
||||
#define _BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
||||
|
||||
struct sched_param
|
||||
{
|
||||
int sched_priority;
|
||||
};
|
||||
|
||||
#endif // !_BITS_TYPES_STRUCT_SCHED_PARAM_T_H
|
38
Userspace/libc/include/bits/types/timespec.h
Normal file
38
Userspace/libc/include/bits/types/timespec.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TIMESPEC_DEFINED
|
||||
#define _TIMESPEC_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct timespec
|
||||
{
|
||||
time_t tv_sec; /* Whole seconds. */
|
||||
long tv_nsec; /* Nanoseconds [0, 999999999]. */
|
||||
} timespec;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_TIMESPEC_DEFINED
|
@ -1,14 +0,0 @@
|
||||
#ifndef _BITS_WAITSTATUS_H
|
||||
#define _BITS_WAITSTATUS_H
|
||||
|
||||
#define __W_CONTINUED 0xFFFF
|
||||
|
||||
#define __WEXITSTATUS(status) (((status)&0xFF00) >> 8)
|
||||
#define __WTERMSIG(status) ((status)&0x7F)
|
||||
#define __WSTOPSIG(status) __WEXITSTATUS(status)
|
||||
#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
|
||||
#define __WIFSIGNALED(status) (((signed char)(((status)&0x7F) + 1) >> 1) > 0)
|
||||
#define __WIFSTOPPED(status) (((status)&0xFF) == 0x7F)
|
||||
#define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
|
||||
|
||||
#endif
|
@ -1,8 +0,0 @@
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H
|
||||
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
int isspace(int c);
|
||||
|
||||
#endif // !_CTYPE_H
|
78
Userspace/libc/include/dirent.h
Normal file
78
Userspace/libc/include/dirent.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT_H
|
||||
#define _DIRENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct dirent
|
||||
{
|
||||
ino_t d_ino; /* File serial number. */
|
||||
char d_name[]; /* Filename string of entry. */
|
||||
} dirent;
|
||||
|
||||
typedef struct posix_dent
|
||||
{
|
||||
ino_t d_ino; /* File serial number. */
|
||||
reclen_t d_reclen; /* Length of this entry, including trailing padding if necessary. See posix_getdents(). */
|
||||
unsigned char d_type; /* File type or unknown-file-type indication. */
|
||||
char d_name[]; /* Filename string of this entry. */
|
||||
} posix_dent;
|
||||
|
||||
typedef struct DIR
|
||||
{
|
||||
int __fd;
|
||||
} DIR;
|
||||
|
||||
#define DT_BLK
|
||||
#define DT_CHR
|
||||
#define DT_DIR
|
||||
#define DT_FIFO
|
||||
#define DT_LNK
|
||||
#define DT_REG
|
||||
#define DT_SOCK
|
||||
#define DT_UNKNOWN
|
||||
|
||||
#define DT_MQ
|
||||
#define DT_SEM
|
||||
#define DT_SHM
|
||||
#define DT_TMO
|
||||
|
||||
int alphasort(const struct dirent **, const struct dirent **);
|
||||
int closedir(DIR *);
|
||||
int dirfd(DIR *);
|
||||
DIR *fdopendir(int);
|
||||
DIR *opendir(const char *);
|
||||
ssize_t posix_getdents(int, void *, size_t, int);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *restrict, struct dirent *restrict, struct dirent **restrict);
|
||||
void rewinddir(DIR *);
|
||||
int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **));
|
||||
void seekdir(DIR *, long);
|
||||
long telldir(DIR *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_DIRENT_H
|
@ -1,11 +0,0 @@
|
||||
#ifndef __FENNIX_LIBC_DLFCN_H__
|
||||
#define __FENNIX_LIBC_DLFCN_H__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
void *dlopen(const char *filename, int flags);
|
||||
void *dlsym(void *handle, const char *symbol);
|
||||
int dlclose(void *handle);
|
||||
char *dlerror(void);
|
||||
|
||||
#endif // !__FENNIX_LIBC_DLFCN_H__
|
@ -1,137 +1,605 @@
|
||||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
#define EPERM 1 /* Operation not permitted */
|
||||
#define ENOENT 2 /* No such file or directory */
|
||||
#define ESRCH 3 /* No such process */
|
||||
#define EINTR 4 /* Interrupted system call */
|
||||
#define EIO 5 /* I/O error */
|
||||
#define ENXIO 6 /* No such device or address */
|
||||
#define E2BIG 7 /* Argument list too long */
|
||||
#define ENOEXEC 8 /* Exec format error */
|
||||
#define EBADF 9 /* Bad file number */
|
||||
#define ECHILD 10 /* No child processes */
|
||||
#define EAGAIN 11 /* Try again */
|
||||
#define ENOMEM 12 /* Out of memory */
|
||||
#define EACCES 13 /* Permission denied */
|
||||
#define EFAULT 14 /* Bad address */
|
||||
#define ENOTBLK 15 /* Block device required */
|
||||
#define EBUSY 16 /* Device or resource busy */
|
||||
#define EEXIST 17 /* File exists */
|
||||
#define EXDEV 18 /* Cross-device link */
|
||||
#define ENODEV 19 /* No such device */
|
||||
#define ENOTDIR 20 /* Not a directory */
|
||||
#define EISDIR 21 /* Is a directory */
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
#define ENFILE 23 /* File table overflow */
|
||||
#define EMFILE 24 /* Too many open files */
|
||||
#define ENOTTY 25 /* Not a typewriter */
|
||||
#define ETXTBSY 26 /* Text file busy */
|
||||
#define EFBIG 27 /* File too large */
|
||||
#define ENOSPC 28 /* No space left on device */
|
||||
#define ESPIPE 29 /* Illegal seek */
|
||||
#define EROFS 30 /* Read-only file system */
|
||||
#define EMLINK 31 /* Too many links */
|
||||
#define EPIPE 32 /* Broken pipe */
|
||||
#define EDOM 33 /* Math argument out of domain of func */
|
||||
#define ERANGE 34 /* Math result not representable */
|
||||
#define EDEADLK 35 /* Resource deadlock would occur */
|
||||
#define ENAMETOOLONG 36 /* File name too long */
|
||||
#define ENOLCK 37 /* No record locks available */
|
||||
#define ENOSYS 38 /* Function not implemented */
|
||||
#define ENOTEMPTY 39 /* Directory not empty */
|
||||
#define ELOOP 40 /* Too many symbolic links encountered */
|
||||
#define ENOMSG 42 /* No message of desired type */
|
||||
#define EIDRM 43 /* Identifier removed */
|
||||
#define ECHRNG 44 /* Channel number out of range */
|
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */
|
||||
#define EL3HLT 46 /* Level 3 halted */
|
||||
#define EL3RST 47 /* Level 3 reset */
|
||||
#define ELNRNG 48 /* Link number out of range */
|
||||
#define EUNATCH 49 /* Protocol driver not attached */
|
||||
#define ENOCSI 50 /* No CSI structure available */
|
||||
#define EL2HLT 51 /* Level 2 halted */
|
||||
#define EBADE 52 /* Invalid exchange */
|
||||
#define EBADR 53 /* Invalid request descriptor */
|
||||
#define EXFULL 54 /* Exchange full */
|
||||
#define ENOANO 55 /* No anode */
|
||||
#define EBADRQC 56 /* Invalid request code */
|
||||
#define EBADSLT 57 /* Invalid slot */
|
||||
#define EBFONT 59 /* Bad font file format */
|
||||
#define ENOSTR 60 /* Device not a stream */
|
||||
#define ENODATA 61 /* No data available */
|
||||
#define ETIME 62 /* Timer expired */
|
||||
#define ENOSR 63 /* Out of streams resources */
|
||||
#define ENONET 64 /* Machine is not on the network */
|
||||
#define ENOPKG 65 /* Package not installed */
|
||||
#define EREMOTE 66 /* Object is remote */
|
||||
#define ENOLINK 67 /* Link has been severed */
|
||||
#define EADV 68 /* Advertise error */
|
||||
#define ESRMNT 69 /* Srmount error */
|
||||
#define ECOMM 70 /* Communication error on send */
|
||||
#define EPROTO 71 /* Protocol error */
|
||||
#define EMULTIHOP 72 /* Multihop attempted */
|
||||
#define EDOTDOT 73 /* RFS specific error */
|
||||
#define EBADMSG 74 /* Not a data message */
|
||||
#define EOVERFLOW 75 /* Value too large for defined data type */
|
||||
#define ENOTUNIQ 76 /* Name not unique on network */
|
||||
#define EBADFD 77 /* File descriptor in bad state */
|
||||
#define EREMCHG 78 /* Remote address changed */
|
||||
#define ELIBACC 79 /* Can not access a needed shared library */
|
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */
|
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */
|
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
|
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
|
||||
#define EILSEQ 84 /* Illegal byte sequence */
|
||||
#define ERESTART 85 /* Interrupted system call should be restarted */
|
||||
#define ESTRPIPE 86 /* Streams pipe error */
|
||||
#define EUSERS 87 /* Too many users */
|
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */
|
||||
#define EDESTADDRREQ 89 /* Destination address required */
|
||||
#define EMSGSIZE 90 /* Message too long */
|
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
|
||||
#define ENOPROTOOPT 92 /* Protocol not available */
|
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */
|
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
|
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#define ENETDOWN 100 /* Network is down */
|
||||
#define ENETUNREACH 101 /* Network is unreachable */
|
||||
#define ENETRESET 102 /* Network dropped connection because of reset */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
#define ECONNRESET 104 /* Connection reset by peer */
|
||||
#define ENOBUFS 105 /* No buffer space available */
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
|
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
|
||||
#define ETIMEDOUT 110 /* Connection timed out */
|
||||
#define ECONNREFUSED 111 /* Connection refused */
|
||||
#define EHOSTDOWN 112 /* Host is down */
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define ESTALE 116 /* Stale NFS file handle */
|
||||
#define EUCLEAN 117 /* Structure needs cleaning */
|
||||
#define ENOTNAM 118 /* Not a XENIX named type file */
|
||||
#define ENAVAIL 119 /* No XENIX semaphores available */
|
||||
#define EISNAM 120 /* Is a named type file */
|
||||
#define EREMOTEIO 121 /* Remote I/O error */
|
||||
#define EDQUOT 122 /* Quota exceeded */
|
||||
#define ENOMEDIUM 123 /* No medium found */
|
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */
|
||||
#define ECANCELED 125 /* Operation Canceled */
|
||||
#define ENOKEY 126 /* Required key not available */
|
||||
#define EKEYEXPIRED 127 /* Key has expired */
|
||||
#define EKEYREVOKED 128 /* Key has been revoked */
|
||||
#define EKEYREJECTED 129 /* Key was rejected by service */
|
||||
#define EOWNERDEAD 130 /* Owner died */
|
||||
#define ENOTRECOVERABLE 131 /* State not recoverable */
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_API_ERRNO_H__
|
||||
#define __FENNIX_API_ERRNO_H__
|
||||
|
||||
/**
|
||||
* The documentation for these error codes are from:
|
||||
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
|
||||
*
|
||||
* Full list:
|
||||
* https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/errno.h.html
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/**
|
||||
* No Error
|
||||
*/
|
||||
EOK = 0,
|
||||
|
||||
/**
|
||||
* Argument list too long. The sum of the number of bytes used by the
|
||||
* new process image's argument list and environment list is greater
|
||||
* than the system-imposed limit of {ARG_MAX} bytes.
|
||||
* or:
|
||||
* Lack of space in an output buffer.
|
||||
* or:
|
||||
* Argument is greater than the system-imposed maximum.
|
||||
*/
|
||||
E2BIG = 1,
|
||||
|
||||
/**
|
||||
* Permission denied. An attempt was made to access a file in a way
|
||||
* forbidden by its file access permissions.
|
||||
*/
|
||||
EACCES = 2,
|
||||
|
||||
/**
|
||||
* Address in use. The specified address is in use.
|
||||
*/
|
||||
EADDRINUSE = 3,
|
||||
|
||||
/**
|
||||
* Address not available. The specified address is not available from
|
||||
* the local system.
|
||||
*/
|
||||
EADDRNOTAVAIL = 4,
|
||||
|
||||
/**
|
||||
* Address family not supported. The implementation does not support
|
||||
* the specified address family, or the specified address is not a
|
||||
* valid address for the address family of the specified socket.
|
||||
*/
|
||||
EAFNOSUPPORT = 5,
|
||||
|
||||
/**
|
||||
* Resource temporarily unavailable. This is a temporary condition
|
||||
* and later calls to the same routine may complete normally.
|
||||
*/
|
||||
EAGAIN = 6,
|
||||
|
||||
/**
|
||||
* Connection already in progress. A connection request is already in
|
||||
* progress for the specified socket.
|
||||
*/
|
||||
EALREADY = 7,
|
||||
|
||||
/**
|
||||
* Bad file descriptor. A file descriptor argument is out of range,
|
||||
* refers to no open file, or a read (write) request is made to a
|
||||
* file that is only open for writing (reading).
|
||||
*/
|
||||
EBADF = 8,
|
||||
|
||||
/**
|
||||
* Bad message. During a read(), getmsg(), getpmsg(), or ioctl()
|
||||
* I_RECVFD request to a STREAMS device, a message arrived at the
|
||||
* head of the STREAM that is inappropriate for the function
|
||||
* receiving the message.
|
||||
* read()
|
||||
* Message waiting to be read on a STREAM is not a data message.
|
||||
* getmsg() or getpmsg()
|
||||
* A file descriptor was received instead of a control message.
|
||||
* ioctl()
|
||||
* Control or data information was received instead of a file
|
||||
* descriptor when I_RECVFD was specified.
|
||||
*/
|
||||
EBADMSG = 9,
|
||||
|
||||
/**
|
||||
* Resource busy. An attempt was made to make use of a system
|
||||
* resource that is not currently available, as it is being
|
||||
* used by another process in a manner that would have
|
||||
* conflicted with the request being made by this process.
|
||||
*/
|
||||
EBUSY = 10,
|
||||
|
||||
/**
|
||||
* Operation canceled. The associated asynchronous operation was
|
||||
* canceled before completion.
|
||||
*/
|
||||
ECANCELED = 11,
|
||||
|
||||
/**
|
||||
* No child process. A wait(), waitid(), or waitpid() function was
|
||||
* executed by a process that had no existing or unwaited-for
|
||||
* child process.
|
||||
*/
|
||||
ECHILD = 12,
|
||||
|
||||
/**
|
||||
* Connection aborted. The connection has been aborted.
|
||||
*/
|
||||
ECONNABORTED = 13,
|
||||
|
||||
/**
|
||||
* Connection refused. An attempt to connect to a socket was refused
|
||||
* because there was no process listening or because the queue of
|
||||
* connection requests was full and the underlying protocol does not
|
||||
* support retransmissions.
|
||||
*/
|
||||
ECONNREFUSED = 14,
|
||||
|
||||
/**
|
||||
* Connection reset. The connection was forcibly closed by the peer.
|
||||
*/
|
||||
ECONNRESET = 15,
|
||||
|
||||
/**
|
||||
* Resource deadlock would occur. An attempt was made to lock a system
|
||||
* resource that would have resulted in a deadlock situation.
|
||||
*/
|
||||
EDEADLK = 16,
|
||||
|
||||
/**
|
||||
* Destination address required. No bind address was established.
|
||||
*/
|
||||
EDESTADDRREQ = 17,
|
||||
|
||||
/**
|
||||
* Domain error. An input argument is outside the defined domain of the
|
||||
* mathematical function (defined in the ISO C standard).
|
||||
*/
|
||||
EDOM = 18,
|
||||
|
||||
/**
|
||||
* Reserved.
|
||||
*/
|
||||
EDQUOT = 19,
|
||||
|
||||
/**
|
||||
* File exists. An existing file was mentioned in an inappropriate
|
||||
* context; for example, as a new link name in the link() function.
|
||||
*/
|
||||
EEXIST = 20,
|
||||
|
||||
/**
|
||||
* Bad address. The system detected an invalid address in attempting
|
||||
* to use an argument of a call. The reliable detection of this error
|
||||
* cannot be guaranteed, and when not detected may result in the
|
||||
* generation of a signal, indicating an address violation, which is
|
||||
* sent to the process.
|
||||
*/
|
||||
EFAULT = 21,
|
||||
|
||||
/**
|
||||
* File too large. The size of a file would exceed the maximum file
|
||||
* size of an implementation or offset maximum established in the
|
||||
* corresponding file description.
|
||||
*/
|
||||
EFBIG = 22,
|
||||
|
||||
/**
|
||||
* Host is unreachable. The destination host cannot be reached
|
||||
* (probably because the host is down or a remote router cannot
|
||||
* reach it).
|
||||
*/
|
||||
EHOSTUNREACH = 23,
|
||||
|
||||
/**
|
||||
* Identifier removed. Returned during XSI interprocess communication
|
||||
* if an identifier has been removed from the system.
|
||||
*/
|
||||
EIDRM = 24,
|
||||
|
||||
/**
|
||||
* Illegal byte sequence. A wide-character code has been detected that
|
||||
* does not correspond to a valid character, or a byte sequence does
|
||||
* not form a valid wide-character code (defined in the ISO C standard).
|
||||
*/
|
||||
EILSEQ = 25,
|
||||
|
||||
/**
|
||||
* Operation in progress. This code is used to indicate that an
|
||||
* asynchronous operation has not yet completed.
|
||||
* or:
|
||||
* O_NONBLOCK is set for the socket file descriptor and the connection
|
||||
* cannot be immediately established.
|
||||
*/
|
||||
EINPROGRESS = 26,
|
||||
|
||||
/**
|
||||
* Interrupted function call. An asynchronous signal was caught by the
|
||||
* process during the execution of an interruptible function. If the
|
||||
* signal handler performs a normal return, the interrupted function
|
||||
* call may return this condition (see the Base Definitions volume
|
||||
* of POSIX.1-2017, <signal.h>).
|
||||
*/
|
||||
EINTR = 27,
|
||||
|
||||
/**
|
||||
* Invalid argument. Some invalid argument was supplied; for example,
|
||||
* specifying an undefined signal in a signal() function or a
|
||||
* kill() function.
|
||||
*/
|
||||
EINVAL = 28,
|
||||
|
||||
/**
|
||||
* Input/output error. Some physical input or output error has occurred.
|
||||
* This error may be reported on a subsequent operation on the same
|
||||
* file descriptor. Any other error-causing operation on the same file
|
||||
* descriptor may cause the [EIO] error indication to be lost.
|
||||
*/
|
||||
EIO = 29,
|
||||
|
||||
/**
|
||||
* Socket is connected. The specified socket is already connected.
|
||||
*/
|
||||
EISCONN = 30,
|
||||
|
||||
/**
|
||||
* Is a directory. An attempt was made to open a directory with write
|
||||
* mode specified.
|
||||
*/
|
||||
EISDIR = 31,
|
||||
|
||||
/**
|
||||
* Symbolic link loop. A loop exists in symbolic links encountered
|
||||
* during pathname resolution. This error may also be returned if
|
||||
* more than {SYMLOOP_MAX} symbolic links are encountered during
|
||||
* pathname resolution.
|
||||
*/
|
||||
ELOOP = 32,
|
||||
|
||||
/**
|
||||
* File descriptor value too large or too many open streams. An
|
||||
* attempt was made to open a file descriptor with a value greater
|
||||
* than or equal to {OPEN_MAX}, or an attempt was made to open more
|
||||
* than the maximum number of streams allowed in the process.
|
||||
*/
|
||||
EMFILE = 33,
|
||||
|
||||
/**
|
||||
* Too many links. An attempt was made to have the link count of a
|
||||
* single file exceed {LINK_MAX}.
|
||||
*/
|
||||
EMLINK = 34,
|
||||
|
||||
/**
|
||||
* Message too large. A message sent on a transport provider was
|
||||
* larger than an internal message buffer or some other network limit.
|
||||
* or:
|
||||
* Inappropriate message buffer length.
|
||||
*/
|
||||
EMSGSIZE = 35,
|
||||
|
||||
/**
|
||||
* Reserved.
|
||||
*/
|
||||
EMULTIHOP = 36,
|
||||
|
||||
/**
|
||||
* Filename too long. The length of a pathname exceeds {PATH_MAX} and
|
||||
* the implementation considers this to be an error, or a pathname
|
||||
* component is longer than {NAME_MAX}. This error may also occur
|
||||
* when pathname substitution, as a result of encountering a
|
||||
* symbolic link during pathname resolution, results in a pathname
|
||||
* string the size of which exceeds {PATH_MAX}.
|
||||
*/
|
||||
ENAMETOOLONG = 37,
|
||||
|
||||
/**
|
||||
* Network is down. The local network interface used to reach the
|
||||
* destination is down.
|
||||
*/
|
||||
ENETDOWN = 38,
|
||||
|
||||
/**
|
||||
* The connection was aborted by the network.
|
||||
*/
|
||||
ENETRESET = 39,
|
||||
|
||||
/**
|
||||
* Network unreachable. No route to the network is present.
|
||||
*/
|
||||
ENETUNREACH = 40,
|
||||
|
||||
/**
|
||||
* Too many files open in system. Too many files are currently open
|
||||
* in the system. The system has reached its predefined limit for
|
||||
* simultaneously open files and temporarily cannot accept requests
|
||||
* to open another one.
|
||||
*/
|
||||
ENFILE = 41,
|
||||
|
||||
/**
|
||||
* No buffer space available. Insufficient buffer resources were
|
||||
* available in the system to perform the socket operation.
|
||||
*/
|
||||
ENOBUFS = 42,
|
||||
|
||||
/**
|
||||
* No message available. No message is available on the STREAM head
|
||||
* read queue.
|
||||
*/
|
||||
ENODATA = 43,
|
||||
|
||||
/**
|
||||
* No such device. An attempt was made to apply an inappropriate
|
||||
* function to a device; for example, trying to read a write-only
|
||||
* device such as a printer.
|
||||
*/
|
||||
ENODEV = 44,
|
||||
|
||||
/**
|
||||
* No such file or directory. A component of a specified pathname
|
||||
* does not exist, or the pathname is an empty string.
|
||||
*/
|
||||
ENOENT = 45,
|
||||
|
||||
/**
|
||||
* Executable file format error. A request is made to execute a file
|
||||
* that, although it has appropriate privileges, is not in the
|
||||
* format required by the implementation for executable files.
|
||||
*/
|
||||
ENOEXEC = 46,
|
||||
|
||||
/**
|
||||
* No locks available. A system-imposed limit on the number of
|
||||
* simultaneous file and record locks has been reached and no more
|
||||
* are currently available.
|
||||
*/
|
||||
ENOLCK = 47,
|
||||
|
||||
/**
|
||||
* Reserved.
|
||||
*/
|
||||
ENOLINK = 48,
|
||||
|
||||
/**
|
||||
* Not enough space. The new process image requires more memory than
|
||||
* is allowed by the hardware or system-imposed memory management
|
||||
* constraints.
|
||||
*/
|
||||
ENOMEM = 49,
|
||||
|
||||
/**
|
||||
* No message of the desired type. The message queue does not contain
|
||||
* a message of the required type during XSI interprocess communication.
|
||||
*/
|
||||
ENOMSG = 50,
|
||||
|
||||
/**
|
||||
* Protocol not available. The protocol option specified to
|
||||
* setsockopt() is not supported by the implementation.
|
||||
*/
|
||||
ENOPROTOOPT = 51,
|
||||
|
||||
/**
|
||||
* No space left on a device. During the write() function on a
|
||||
* regular file or when extending a directory, there is no free
|
||||
* space left on the device.
|
||||
*/
|
||||
ENOSPC = 52,
|
||||
|
||||
/**
|
||||
* No STREAM resources. Insufficient STREAMS memory resources are
|
||||
* available to perform a STREAMS-related function. This is a
|
||||
* temporary condition; it may be recovered from if other
|
||||
* processes release resources.
|
||||
*/
|
||||
ENOSR = 53,
|
||||
|
||||
/**
|
||||
* Not a STREAM. A STREAM function was attempted on a file descriptor
|
||||
* that was not associated with a STREAMS device.
|
||||
*/
|
||||
ENOSTR = 54,
|
||||
|
||||
/**
|
||||
* Functionality not supported. An attempt was made to use optional
|
||||
* functionality that is not supported in this implementation.
|
||||
*/
|
||||
ENOSYS = 55,
|
||||
|
||||
/**
|
||||
* Socket not connected. The socket is not connected.
|
||||
*/
|
||||
ENOTCONN = 56,
|
||||
|
||||
/**
|
||||
* Not a directory. A component of the specified pathname exists, but
|
||||
* it is not a directory, when a directory was expected; or an
|
||||
* attempt was made to create a non-directory file, and the specified
|
||||
* pathname contains at least one non- \<slash\> character and ends
|
||||
* with one or more trailing \<slash\> characters.
|
||||
*/
|
||||
ENOTDIR = 57,
|
||||
|
||||
/**
|
||||
* Directory not empty. A directory other than an empty directory
|
||||
* was supplied when an empty directory was expected.
|
||||
*/
|
||||
ENOTEMPTY = 58,
|
||||
|
||||
/**
|
||||
* State not recoverable. The state protected by a robust mutex
|
||||
* is not recoverable.
|
||||
*/
|
||||
ENOTRECOVERABLE = 59,
|
||||
|
||||
/**
|
||||
* Not a socket. The file descriptor does not refer to a socket.
|
||||
*/
|
||||
ENOTSOCK = 60,
|
||||
|
||||
/**
|
||||
* Not supported. The implementation does not support the requested
|
||||
* feature or value.
|
||||
*/
|
||||
ENOTSUP = 61,
|
||||
|
||||
/**
|
||||
* Inappropriate I/O control operation. A control function has been
|
||||
* attempted for a file or special file for which the operation
|
||||
* is inappropriate.
|
||||
*/
|
||||
ENOTTY = 62,
|
||||
|
||||
/**
|
||||
* No such device or address. Input or output on a special file
|
||||
* refers to a device that does not exist, or makes a request
|
||||
* beyond the capabilities of the device. It may also occur when,
|
||||
* for example, a tape drive is not on-line.
|
||||
*/
|
||||
ENXIO = 63,
|
||||
|
||||
/**
|
||||
* Operation not supported on socket. The type of socket (address
|
||||
* family or protocol) does not support the requested operation.
|
||||
*/
|
||||
EOPNOTSUPP = 64,
|
||||
|
||||
/**
|
||||
* Value too large to be stored in data type. An operation was
|
||||
* attempted which would generate a value that is outside the
|
||||
* range of values that can be represented in the relevant data
|
||||
* type or that are allowed for a given data item.
|
||||
*/
|
||||
EOVERFLOW = 65,
|
||||
|
||||
/**
|
||||
* Previous owner died. The owner of a robust mutex terminated
|
||||
* while holding the mutex lock.
|
||||
*/
|
||||
EOWNERDEAD = 66,
|
||||
|
||||
/**
|
||||
* Operation not permitted. An attempt was made to perform an
|
||||
* operation limited to processes with appropriate privileges or
|
||||
* to the owner of a file or other resource.
|
||||
*/
|
||||
EPERM = 67,
|
||||
|
||||
/**
|
||||
* Broken pipe. A write was attempted on a socket, pipe, or FIFO
|
||||
* for which there is no process to read the data.
|
||||
*/
|
||||
EPIPE = 68,
|
||||
|
||||
/**
|
||||
* Protocol error. Some protocol error occurred. This error is
|
||||
* device-specific, but is generally not related to a
|
||||
* hardware failure.
|
||||
*/
|
||||
EPROTO = 69,
|
||||
|
||||
/**
|
||||
* Protocol not supported. The protocol is not supported by the
|
||||
* address family, or the protocol is not supported by
|
||||
* the implementation.
|
||||
*/
|
||||
EPROTONOSUPPORT = 70,
|
||||
|
||||
/**
|
||||
* Protocol wrong type for socket. The socket type is not
|
||||
* supported by the protocol.
|
||||
*/
|
||||
EPROTOTYPE = 71,
|
||||
|
||||
/**
|
||||
* Result too large or too small. The result of the function
|
||||
* is too large (overflow) or too small (underflow) to be
|
||||
* represented in the available space.
|
||||
*/
|
||||
ERANGE = 72,
|
||||
|
||||
/**
|
||||
* Read-only file system. An attempt was made to modify a file
|
||||
* or directory on a file system that is read-only.
|
||||
*/
|
||||
EROFS = 73,
|
||||
|
||||
/**
|
||||
* Invalid seek. An attempt was made to access the file offset
|
||||
* associated with a pipe or FIFO.
|
||||
*/
|
||||
ESPIPE = 74,
|
||||
|
||||
/**
|
||||
* No such process. No process can be found corresponding to that
|
||||
* specified by the given process ID.
|
||||
*/
|
||||
ESRCH = 75,
|
||||
|
||||
/**
|
||||
* Reserved.
|
||||
*/
|
||||
ESTALE = 76,
|
||||
|
||||
/**
|
||||
* STREAM ioctl() timeout. The timer set for a STREAMS ioctl() call
|
||||
* has expired. The cause of this error is device-specific and could
|
||||
* indicate either a hardware or software failure, or a timeout
|
||||
* value that is too short for the specific operation. The status
|
||||
* of the ioctl() operation is unspecified.
|
||||
*/
|
||||
ETIME = 77,
|
||||
|
||||
/**
|
||||
* Connection timed out. The connection to a remote machine has
|
||||
* timed out.
|
||||
* If the connection timed out during execution of the function that
|
||||
* reported this error (as opposed to timing out prior to the
|
||||
* function being called), it is unspecified whether the function
|
||||
* has completed some or all of the documented behavior associated
|
||||
* with a successful completion of the function.
|
||||
* or:
|
||||
* Operation timed out. The time limit associated with the operation
|
||||
* was exceeded before the operation completed.
|
||||
*/
|
||||
ETIMEDOUT = 78,
|
||||
|
||||
/**
|
||||
* Text file busy. An attempt was made to execute a pure-procedure
|
||||
* program that is currently open for writing, or an attempt has
|
||||
* been made to open for writing a pure-procedure program that
|
||||
* is being executed.
|
||||
*/
|
||||
ETXTBSY = 79,
|
||||
|
||||
/**
|
||||
* Operation would block. An operation on a socket marked as
|
||||
* non-blocking has encountered a situation such as no data available
|
||||
* that otherwise would have caused the function to suspend execution.
|
||||
*/
|
||||
EWOULDBLOCK = 80,
|
||||
|
||||
/**
|
||||
* Improper link. A link to a file on another file system was attempted.
|
||||
*/
|
||||
EXDEV = 81,
|
||||
|
||||
__ERRNO_MAX
|
||||
} KernelErrors;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int *__errno_location(void) __attribute__((const));
|
||||
char *strerror(int errnum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int *__errno_location(void) __attribute__((const)) __attribute__ ((__nothrow__));
|
||||
#define errno (*__errno_location())
|
||||
|
||||
#endif
|
||||
#endif // !__FENNIX_API_ERRNO_H__
|
||||
|
@ -1,4 +1,108 @@
|
||||
#ifndef _FNCTL_H
|
||||
#define _FNCTL_H
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
#endif // !_FNCTL_H
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FCNTL_H
|
||||
#define _FCNTL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct f_owner_ex
|
||||
{
|
||||
int type; /* Discriminator for pid. */
|
||||
pid_t pid; /* Process ID or process group ID. */
|
||||
} f_owner_ex;
|
||||
|
||||
typedef 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; /* For a process-owned file lock, ignored on input or the process ID of the owning process on output; for an OFD-owned file lock, zero on input or (pid_t)-1 on output. */
|
||||
} flock;
|
||||
|
||||
#define F_DUPFD
|
||||
#define F_DUPFD_CLOEXEC
|
||||
#define F_DUPFD_CLOFORK
|
||||
#define F_GETFD
|
||||
#define F_SETFD
|
||||
#define F_GETFL
|
||||
#define F_SETFL
|
||||
#define F_GETLK
|
||||
#define F_SETLK
|
||||
#define F_SETLKW
|
||||
#define F_OFD_GETLK
|
||||
#define F_OFD_SETLK
|
||||
#define F_OFD_SETLKW
|
||||
#define F_GETOWN
|
||||
#define F_GETOWN_EX
|
||||
#define F_SETOWN
|
||||
#define F_SETOWN_EX
|
||||
#define FD_CLOEXEC
|
||||
#define FD_CLOFORK
|
||||
#define F_RDLCK
|
||||
#define F_UNLCK
|
||||
#define F_WRLCK
|
||||
#define F_OWNER_PID
|
||||
#define F_OWNER_PGRP
|
||||
#define O_CLOEXEC 02000000
|
||||
#define O_CLOFORK
|
||||
#define O_CREAT 0100
|
||||
#define O_DIRECTORY
|
||||
#define O_EXCL 0200
|
||||
#define O_NOCTTY
|
||||
#define O_NOFOLLOW 0400000
|
||||
#define O_TRUNC 01000
|
||||
#define O_TTY_INIT
|
||||
#define O_APPEND 02000
|
||||
#define O_DSYNC
|
||||
#define O_NONBLOCK
|
||||
#define O_RSYNC
|
||||
#define O_SYNC
|
||||
#define O_ACCMODE
|
||||
#define O_EXEC
|
||||
#define O_RDONLY 00
|
||||
#define O_RDWR 02
|
||||
#define O_SEARCH
|
||||
#define O_WRONLY 01
|
||||
#define AT_FDCWD
|
||||
#define AT_EACCESS
|
||||
#define AT_SYMLINK_NOFOLLOW
|
||||
#define AT_SYMLINK_FOLLOW
|
||||
#define AT_REMOVEDIR
|
||||
#define POSIX_FADV_DONTNEED
|
||||
#define POSIX_FADV_NOREUSE
|
||||
#define POSIX_FADV_NORMAL
|
||||
#define POSIX_FADV_RANDOM
|
||||
#define POSIX_FADV_SEQUENTIAL
|
||||
#define POSIX_FADV_WILLNEED
|
||||
|
||||
int creat(const char *, mode_t);
|
||||
int fcntl(int, int, ...);
|
||||
int open(const char *, int, ...);
|
||||
int openat(int, const char *, int, ...);
|
||||
int posix_fadvise(int, off_t, off_t, int);
|
||||
int posix_fallocate(int, off_t, off_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_FCNTL_H
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef _FEATURES_H
|
||||
#define _FEATURES_H
|
||||
|
||||
#define __FENNIX_LIBC__ 1
|
||||
|
||||
#endif
|
1572
Userspace/libc/include/fennix/syscalls.h
Normal file
1572
Userspace/libc/include/fennix/syscalls.h
Normal file
File diff suppressed because it is too large
Load Diff
87
Userspace/libc/include/float.h
Normal file
87
Userspace/libc/include/float.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _FLOAT_H
|
||||
#define _FLOAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define INFINITY (__builtin_inff())
|
||||
#define NAN (__builtin_nanf(""))
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
|
||||
#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
|
||||
#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
|
||||
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
|
||||
|
||||
#define FLT_RADIX __FLT_RADIX__
|
||||
|
||||
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
||||
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
||||
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
||||
|
||||
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
||||
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
||||
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
|
||||
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
|
||||
#define FLT_DIG __FLT_DIG__
|
||||
#define DBL_DIG __DBL_DIG__
|
||||
#define LDBL_DIG __LDBL_DIG__
|
||||
|
||||
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
||||
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
||||
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
||||
|
||||
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
||||
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
||||
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
||||
|
||||
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
||||
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
||||
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
||||
|
||||
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
||||
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
||||
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
||||
|
||||
#define FLT_MAX __FLT_MAX__
|
||||
#define DBL_MAX __DBL_MAX__
|
||||
#define LDBL_MAX __LDBL_MAX__
|
||||
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#define DBL_EPSILON __DBL_EPSILON__
|
||||
#define LDBL_EPSILON __LDBL_EPSILON__
|
||||
|
||||
#define FLT_MIN __FLT_MIN__
|
||||
#define DBL_MIN __DBL_MIN__
|
||||
#define LDBL_MIN __LDBL_MIN__
|
||||
|
||||
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
||||
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
||||
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_FLOAT_H
|
@ -1,40 +1,69 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _INTTYPES_H
|
||||
#define _INTTYPES_H
|
||||
|
||||
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;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
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 __INT8_TYPE__ int8_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
typedef __INT64_TYPE__ int64_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 __UINT8_TYPE__ uint8_t;
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_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 __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __SIZE_TYPE__ size_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;
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_INTTYPES_H
|
||||
|
@ -1,119 +1,117 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _LIMITS_H
|
||||
#define _LIMITS_H
|
||||
|
||||
#undef CHAR_BIT
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define _POSIX_ARG_MAX 4096
|
||||
#define _POSIX_CHILD_MAX 25
|
||||
#define _POSIX_OPEN_MAX 20
|
||||
#define _POSIX_LINK_MAX 8
|
||||
#define _POSIX_MAX_CANON 255
|
||||
#define _POSIX_MAX_INPUT 255
|
||||
#define _POSIX_NAME_MAX 255
|
||||
#define _POSIX_PATH_MAX 4096
|
||||
#define _POSIX_PIPE_BUF 512
|
||||
#define _POSIX_SYMLOOP_MAX 8
|
||||
#define _POSIX_HOST_NAME_MAX 255
|
||||
#define _POSIX_LOGIN_NAME_MAX 9
|
||||
#define _POSIX_TTY_NAME_MAX 255
|
||||
#define _POSIX_TZNAME_MAX 6
|
||||
|
||||
#define _XOPEN_SHM_MAX 255
|
||||
#define _XOPEN_IOV_MAX 1024
|
||||
#define _XOPEN_SSTREAM_MAX 8
|
||||
#define _XOPEN_NAME_MAX 255
|
||||
#define _XOPEN_PATH_MAX 4096
|
||||
#define _XOPEN_SYMLOOP_MAX 8
|
||||
#define _XOPEN_LOGIN_NAME_MAX 9
|
||||
|
||||
#define _POSIX2_BC_BASE_MAX 99
|
||||
#define _POSIX2_BC_DIM_MAX 2048
|
||||
#define _POSIX2_BC_SCALE_MAX 99
|
||||
#define _POSIX2_BC_STRING_MAX 1000
|
||||
#define _POSIX2_COLL_WEIGHTS_MAX 255
|
||||
#define _POSIX2_EXPR_NEST_MAX 32
|
||||
#define _POSIX2_LINE_MAX 2048
|
||||
#define _POSIX2_RE_DUP_MAX 255
|
||||
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
|
||||
#ifndef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#endif
|
||||
|
||||
#undef SCHAR_MIN
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
|
||||
#undef UCHAR_MAX
|
||||
#if __SCHAR_MAX__ == __INT_MAX__
|
||||
#define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
|
||||
#else
|
||||
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#undef CHAR_MIN
|
||||
#if __SCHAR_MAX__ == __INT_MAX__
|
||||
#define CHAR_MIN 0U
|
||||
#else
|
||||
#define CHAR_MIN 0
|
||||
#endif
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX UCHAR_MAX
|
||||
#else
|
||||
#undef CHAR_MIN
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#endif
|
||||
|
||||
#undef SHRT_MIN
|
||||
#define MB_LEN_MAX 1
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#undef SHRT_MAX
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
|
||||
#undef USHRT_MAX
|
||||
#if __SHRT_MAX__ == __INT_MAX__
|
||||
#define USHRT_MAX (SHRT_MAX * 2U + 1U)
|
||||
#else
|
||||
#define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
#endif
|
||||
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
#undef UINT_MAX
|
||||
#define UINT_MAX (INT_MAX * 2U + 1U)
|
||||
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
#undef LONG_MAX
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
#undef ULONG_MAX
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#undef LLONG_MIN
|
||||
#define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
#undef LLONG_MAX
|
||||
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1LL)
|
||||
#define LLONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
#undef ULLONG_MAX
|
||||
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
|
||||
#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)
|
||||
#undef LONG_LONG_MIN
|
||||
#define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
|
||||
#undef LONG_LONG_MAX
|
||||
#define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
#define ARG_MAX 4096
|
||||
#define CHILD_MAX 25
|
||||
#define OPEN_MAX 20
|
||||
#define LINK_MAX 8
|
||||
#define MAX_CANON 255
|
||||
#define MAX_INPUT 255
|
||||
#define NAME_MAX 255
|
||||
#define PATH_MAX 4096
|
||||
#define PIPE_BUF 512
|
||||
#define SYMLOOP_MAX 8
|
||||
#define HOST_NAME_MAX 255
|
||||
#define LOGIN_NAME_MAX 9
|
||||
#define TTY_NAME_MAX 255
|
||||
#define TZNAME_MAX 6
|
||||
|
||||
#undef ULONG_LONG_MAX
|
||||
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
|
||||
#endif
|
||||
#define SSIZE_MAX ((size_t)(-1) / 2)
|
||||
|
||||
#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ || (defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L))
|
||||
#undef CHAR_WIDTH
|
||||
#define CHAR_WIDTH __SCHAR_WIDTH__
|
||||
#undef SCHAR_WIDTH
|
||||
#define SCHAR_WIDTH __SCHAR_WIDTH__
|
||||
#undef UCHAR_WIDTH
|
||||
#define UCHAR_WIDTH __SCHAR_WIDTH__
|
||||
#undef SHRT_WIDTH
|
||||
#define SHRT_WIDTH __SHRT_WIDTH__
|
||||
#undef USHRT_WIDTH
|
||||
#define USHRT_WIDTH __SHRT_WIDTH__
|
||||
#undef INT_WIDTH
|
||||
#define INT_WIDTH __INT_WIDTH__
|
||||
#undef UINT_WIDTH
|
||||
#define UINT_WIDTH __INT_WIDTH__
|
||||
#undef LONG_WIDTH
|
||||
#define LONG_WIDTH __LONG_WIDTH__
|
||||
#undef ULONG_WIDTH
|
||||
#define ULONG_WIDTH __LONG_WIDTH__
|
||||
#undef LLONG_WIDTH
|
||||
#define LLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
#undef ULLONG_WIDTH
|
||||
#define ULLONG_WIDTH __LONG_LONG_WIDTH__
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
|
||||
#undef BOOL_MAX
|
||||
#define BOOL_MAX 1
|
||||
#undef BOOL_WIDTH
|
||||
#define BOOL_WIDTH 1
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_LIMITS_H
|
||||
|
79
Userspace/libc/include/locale.h
Normal file
79
Userspace/libc/include/locale.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _LOCALE_H
|
||||
#define _LOCALE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct lconv
|
||||
{
|
||||
char *currency_symbol;
|
||||
char *decimal_point;
|
||||
char frac_digits;
|
||||
char *grouping;
|
||||
char *int_curr_symbol;
|
||||
char int_frac_digits;
|
||||
char int_n_cs_precedes;
|
||||
char int_n_sep_by_space;
|
||||
char int_n_sign_posn;
|
||||
char int_p_cs_precedes;
|
||||
char int_p_sep_by_space;
|
||||
char int_p_sign_posn;
|
||||
char *mon_decimal_point;
|
||||
char *mon_grouping;
|
||||
char *mon_thousands_sep;
|
||||
char *negative_sign;
|
||||
char n_cs_precedes;
|
||||
char n_sep_by_space;
|
||||
char n_sign_posn;
|
||||
char *positive_sign;
|
||||
char p_cs_precedes;
|
||||
char p_sep_by_space;
|
||||
char p_sign_posn;
|
||||
char *thousands_sep;
|
||||
} lconv;
|
||||
|
||||
typedef struct locale_t
|
||||
{
|
||||
char data[1]; /* FIXME: implement locale_t */
|
||||
} locale_t;
|
||||
|
||||
#define LC_ALL
|
||||
#define LC_COLLATE
|
||||
#define LC_CTYPE
|
||||
#define LC_MESSAGES
|
||||
#define LC_MONETARY
|
||||
#define LC_NUMERIC
|
||||
#define LC_TIME
|
||||
|
||||
locale_t duplocale(locale_t);
|
||||
void freelocale(locale_t);
|
||||
const char *getlocalename_l(int, locale_t);
|
||||
struct lconv *localeconv(void);
|
||||
locale_t newlocale(int, const char *, locale_t);
|
||||
char *setlocale(int, const char *);
|
||||
locale_t uselocale(locale_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_LOCALE_H
|
@ -1,4 +1,226 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_H
|
||||
#define _MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#if FLT_EVAL_METHOD == 0
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
#elif FLT_EVAL_METHOD == 1
|
||||
typedef float float_t;
|
||||
typedef float double_t;
|
||||
#elif FLT_EVAL_METHOD == 2
|
||||
typedef long double float_t;
|
||||
typedef long double double_t;
|
||||
#else
|
||||
#error "Unsupported FLT_EVAL_METHOD"
|
||||
#endif
|
||||
|
||||
double acos(double);
|
||||
float acosf(float);
|
||||
double acosh(double);
|
||||
float acoshf(float);
|
||||
long double acoshl(long double);
|
||||
long double acosl(long double);
|
||||
double asin(double);
|
||||
float asinf(float);
|
||||
double asinh(double);
|
||||
float asinhf(float);
|
||||
long double asinhl(long double);
|
||||
long double asinl(long double);
|
||||
double atan(double);
|
||||
double atan2(double, double);
|
||||
float atan2f(float, float);
|
||||
long double atan2l(long double, long double);
|
||||
float atanf(float);
|
||||
double atanh(double);
|
||||
float atanhf(float);
|
||||
long double atanhl(long double);
|
||||
long double atanl(long double);
|
||||
double cbrt(double);
|
||||
float cbrtf(float);
|
||||
long double cbrtl(long double);
|
||||
double ceil(double);
|
||||
float ceilf(float);
|
||||
long double ceill(long double);
|
||||
double copysign(double, double);
|
||||
float copysignf(float, float);
|
||||
long double copysignl(long double, long double);
|
||||
double cos(double);
|
||||
float cosf(float);
|
||||
double cosh(double);
|
||||
float coshf(float);
|
||||
long double coshl(long double);
|
||||
long double cosl(long double);
|
||||
double erf(double);
|
||||
double erfc(double);
|
||||
float erfcf(float);
|
||||
long double erfcl(long double);
|
||||
float erff(float);
|
||||
long double erfl(long double);
|
||||
double exp(double);
|
||||
double exp2(double);
|
||||
float exp2f(float);
|
||||
long double exp2l(long double);
|
||||
float expf(float);
|
||||
long double expl(long double);
|
||||
double expm1(double);
|
||||
float expm1f(float);
|
||||
long double expm1l(long double);
|
||||
double fabs(double);
|
||||
float fabsf(float);
|
||||
long double fabsl(long double);
|
||||
double fdim(double, double);
|
||||
float fdimf(float, float);
|
||||
long double fdiml(long double, long double);
|
||||
double floor(double);
|
||||
float floorf(float);
|
||||
long double floorl(long double);
|
||||
double fma(double, double, double);
|
||||
float fmaf(float, float, float);
|
||||
long double fmal(long double, long double, long double);
|
||||
double fmax(double, double);
|
||||
float fmaxf(float, float);
|
||||
long double fmaxl(long double, long double);
|
||||
double fmin(double, double);
|
||||
float fminf(float, float);
|
||||
long double fminl(long double, long double);
|
||||
double fmod(double, double);
|
||||
float fmodf(float, float);
|
||||
long double fmodl(long double, long double);
|
||||
double frexp(double, int *);
|
||||
float frexpf(float value, int *);
|
||||
long double frexpl(long double value, int *);
|
||||
double hypot(double, double);
|
||||
float hypotf(float, float);
|
||||
long double hypotl(long double, long double);
|
||||
int ilogb(double);
|
||||
int ilogbf(float);
|
||||
int ilogbl(long double);
|
||||
double j0(double);
|
||||
double j1(double);
|
||||
double jn(int, double);
|
||||
double ldexp(double, int);
|
||||
float ldexpf(float, int);
|
||||
long double ldexpl(long double, int);
|
||||
double lgamma(double);
|
||||
float lgammaf(float);
|
||||
long double lgammal(long double);
|
||||
long long llrint(double);
|
||||
long long llrintf(float);
|
||||
long long llrintl(long double);
|
||||
long long llround(double);
|
||||
long long llroundf(float);
|
||||
long long llroundl(long double);
|
||||
double log(double);
|
||||
double log10(double);
|
||||
float log10f(float);
|
||||
long double log10l(long double);
|
||||
double log1p(double);
|
||||
float log1pf(float);
|
||||
long double log1pl(long double);
|
||||
double log2(double);
|
||||
float log2f(float);
|
||||
long double log2l(long double);
|
||||
double logb(double);
|
||||
float logbf(float);
|
||||
long double logbl(long double);
|
||||
float logf(float);
|
||||
long double logl(long double);
|
||||
long lrint(double);
|
||||
long lrintf(float);
|
||||
long lrintl(long double);
|
||||
long lround(double);
|
||||
long lroundf(float);
|
||||
long lroundl(long double);
|
||||
double modf(double, double *);
|
||||
float modff(float, float *);
|
||||
long double modfl(long double, long double *);
|
||||
double nan(const char *);
|
||||
float nanf(const char *);
|
||||
long double nanl(const char *);
|
||||
double nearbyint(double);
|
||||
float nearbyintf(float);
|
||||
long double nearbyintl(long double);
|
||||
double nextafter(double, double);
|
||||
float nextafterf(float, float);
|
||||
long double nextafterl(long double, long double);
|
||||
double nexttoward(double, long double);
|
||||
float nexttowardf(float, long double);
|
||||
long double nexttowardl(long double, long double);
|
||||
double pow(double, double);
|
||||
float powf(float, float);
|
||||
long double powl(long double, long double);
|
||||
double remainder(double, double);
|
||||
float remainderf(float, float);
|
||||
long double remainderl(long double, long double);
|
||||
double remquo(double, double, int *);
|
||||
float remquof(float, float, int *);
|
||||
long double remquol(long double, long double, int *);
|
||||
double rint(double);
|
||||
float rintf(float);
|
||||
long double rintl(long double);
|
||||
double round(double);
|
||||
float roundf(float);
|
||||
long double roundl(long double);
|
||||
double scalb(double, double);
|
||||
double scalbln(double, long);
|
||||
float scalblnf(float, long);
|
||||
long double scalblnl(long double, long);
|
||||
double scalbn(double, int);
|
||||
float scalbnf(float, int);
|
||||
long double scalbnl(long double, int);
|
||||
double sin(double);
|
||||
float sinf(float);
|
||||
double sinh(double);
|
||||
float sinhf(float);
|
||||
long double sinhl(long double);
|
||||
long double sinl(long double);
|
||||
double sqrt(double);
|
||||
float sqrtf(float);
|
||||
long double sqrtl(long double);
|
||||
double tan(double);
|
||||
float tanf(float);
|
||||
double tanh(double);
|
||||
float tanhf(float);
|
||||
long double tanhl(long double);
|
||||
long double tanl(long double);
|
||||
double tgamma(double);
|
||||
float tgammaf(float);
|
||||
long double tgammal(long double);
|
||||
double trunc(double);
|
||||
float truncf(float);
|
||||
long double truncl(long double);
|
||||
double y0(double);
|
||||
double y1(double);
|
||||
double yn(int, double);
|
||||
|
||||
extern int signgam;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_MATH_H
|
||||
|
137
Userspace/libc/include/pthread.h
Normal file
137
Userspace/libc/include/pthread.h
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_H
|
||||
#define _PTHREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <sched.h>
|
||||
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS {0}
|
||||
#define PTHREAD_CANCEL_ENABLE {0}
|
||||
#define PTHREAD_CANCEL_DEFERRED {0}
|
||||
#define PTHREAD_CANCEL_DISABLE {0}
|
||||
#define PTHREAD_CANCELED {0}
|
||||
#define PTHREAD_COND_INITIALIZER {0}
|
||||
#define PTHREAD_CREATE_DETACHED {0}
|
||||
#define PTHREAD_CREATE_JOINABLE {0}
|
||||
#define PTHREAD_EXPLICIT_SCHED {0}
|
||||
#define PTHREAD_INHERIT_SCHED {0}
|
||||
#define PTHREAD_MUTEX_DEFAULT {0}
|
||||
#define PTHREAD_MUTEX_ERRORCHECK {0}
|
||||
#define PTHREAD_MUTEX_NORMAL {0}
|
||||
#define PTHREAD_MUTEX_INITIALIZER {0}
|
||||
#define PTHREAD_MUTEX_RECURSIVE {0}
|
||||
#define PTHREAD_ONCE_INIT {0}
|
||||
#define PTHREAD_PRIO_INHERIT {0}
|
||||
#define PTHREAD_PRIO_NONE {0}
|
||||
#define PTHREAD_PRIO_PROTECT {0}
|
||||
#define PTHREAD_PROCESS_SHARED {0}
|
||||
#define PTHREAD_PROCESS_PRIVATE {0}
|
||||
#define PTHREAD_RWLOCK_INITIALIZER {0}
|
||||
#define PTHREAD_SCOPE_PROCESS {0}
|
||||
#define PTHREAD_SCOPE_SYSTEM {0}
|
||||
|
||||
int pthread_attr_destroy(pthread_attr_t *);
|
||||
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
|
||||
int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *);
|
||||
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getscope(const pthread_attr_t *, int *);
|
||||
int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
|
||||
int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
|
||||
int pthread_attr_init(pthread_attr_t *);
|
||||
int pthread_attr_setdetachstate(pthread_attr_t *, int);
|
||||
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
|
||||
int pthread_attr_setinheritsched(pthread_attr_t *, int);
|
||||
int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *);
|
||||
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
|
||||
int pthread_attr_setscope(pthread_attr_t *, int);
|
||||
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
|
||||
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
|
||||
int pthread_cancel(pthread_t);
|
||||
void pthread_cleanup_push(void (*)(void *), void *);
|
||||
void pthread_cleanup_pop(int);
|
||||
int pthread_cond_broadcast(pthread_cond_t *);
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
|
||||
int pthread_cond_signal(pthread_cond_t *);
|
||||
int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *);
|
||||
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
|
||||
int pthread_condattr_destroy(pthread_condattr_t *);
|
||||
int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
|
||||
int pthread_condattr_init(pthread_condattr_t *);
|
||||
int pthread_condattr_setpshared(pthread_condattr_t *, int);
|
||||
int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *);
|
||||
int pthread_detach(pthread_t);
|
||||
int pthread_equal(pthread_t, pthread_t);
|
||||
void pthread_exit(void *);
|
||||
int pthread_getconcurrency(void);
|
||||
int pthread_getschedparam(pthread_t, int *, struct sched_param *);
|
||||
void *pthread_getspecific(pthread_key_t);
|
||||
int pthread_join(pthread_t, void **);
|
||||
int pthread_key_create(pthread_key_t *, void (*)(void *));
|
||||
int pthread_key_delete(pthread_key_t);
|
||||
int pthread_mutex_destroy(pthread_mutex_t *);
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
|
||||
int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
|
||||
int pthread_mutex_lock(pthread_mutex_t *mutex);
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
|
||||
int pthread_mutex_trylock(pthread_mutex_t *);
|
||||
int pthread_mutex_unlock(pthread_mutex_t *mutex);
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
||||
int pthread_once(pthread_once_t *, void (*)(void));
|
||||
int pthread_rwlock_destroy(pthread_rwlock_t *);
|
||||
int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
|
||||
int pthread_rwlock_rdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *);
|
||||
int pthread_rwlock_wrlock(pthread_rwlock_t *);
|
||||
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *);
|
||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
|
||||
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
|
||||
pthread_t pthread_self(void);
|
||||
int pthread_setcancelstate(int, int *);
|
||||
int pthread_setcanceltype(int, int *);
|
||||
int pthread_setconcurrency(int);
|
||||
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
|
||||
int pthread_setspecific(pthread_key_t, const void *);
|
||||
void pthread_testcancel(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_PTHREAD_H
|
49
Userspace/libc/include/pwd.h
Normal file
49
Userspace/libc/include/pwd.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PWD_H
|
||||
#define _PWD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#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 *);
|
||||
int getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **);
|
||||
struct passwd *getpwuid(uid_t);
|
||||
int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
|
||||
void setpwent(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_PWD_H
|
41
Userspace/libc/include/sched.h
Normal file
41
Userspace/libc/include/sched.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SCHED_H
|
||||
#define _SCHED_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <time.h>
|
||||
|
||||
typedef 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. */
|
||||
} sched_param_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_SCHED_H
|
@ -1,34 +0,0 @@
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t r15;
|
||||
uint64_t r14;
|
||||
uint64_t r13;
|
||||
uint64_t r12;
|
||||
uint64_t r11;
|
||||
uint64_t r10;
|
||||
uint64_t r9;
|
||||
uint64_t r8;
|
||||
uint64_t rbp;
|
||||
uint64_t rsp;
|
||||
uint64_t rdi;
|
||||
uint64_t rsi;
|
||||
uint64_t rdx;
|
||||
uint64_t rcx;
|
||||
uint64_t rbx;
|
||||
uint64_t rax;
|
||||
uint64_t rip;
|
||||
uint64_t rflags;
|
||||
uint64_t cs;
|
||||
uint64_t fs;
|
||||
uint64_t gs;
|
||||
} jmp_buf[1];
|
||||
|
||||
int setjmp(jmp_buf env);
|
||||
__attribute__((noreturn)) void longjmp(jmp_buf env, int value);
|
||||
|
||||
#endif // !_SETJMP_H
|
@ -1,102 +1,221 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SIGNAL_H
|
||||
#define _SIGNAL_H
|
||||
|
||||
#include <bits/types/sigset_t.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/* https://www-uxsup.csx.cam.ac.uk/courses/moved.Building/signals.pdf */
|
||||
/* https://man7.org/linux/man-pages/man7/signal.7.html */
|
||||
#include <sys/types.h>
|
||||
#include <fennix/syscalls.h>
|
||||
#include <bits/types/timespec.h>
|
||||
|
||||
/** @brief Hangup detected on controlling or death of controlling process */
|
||||
#define SIGHUP 1
|
||||
#define SIGNULL __SYS_SIGNULL
|
||||
#define SIGABRT __SYS_SIGABRT
|
||||
#define SIGALRM __SYS_SIGALRM
|
||||
#define SIGBUS __SYS_SIGBUS
|
||||
#define SIGCHLD __SYS_SIGCHLD
|
||||
#define SIGCONT __SYS_SIGCONT
|
||||
#define SIGFPE __SYS_SIGFPE
|
||||
#define SIGHUP __SYS_SIGHUP
|
||||
#define SIGILL __SYS_SIGILL
|
||||
#define SIGINT __SYS_SIGINT
|
||||
#define SIGKILL __SYS_SIGKILL
|
||||
#define SIGPIPE __SYS_SIGPIPE
|
||||
#define SIGQUIT __SYS_SIGQUIT
|
||||
#define SIGSEGV __SYS_SIGSEGV
|
||||
#define SIGSTOP __SYS_SIGSTOP
|
||||
#define SIGTERM __SYS_SIGTERM
|
||||
#define SIGTSTP __SYS_SIGTSTP
|
||||
#define SIGTTIN __SYS_SIGTTIN
|
||||
#define SIGTTOU __SYS_SIGTTOU
|
||||
#define SIGUSR1 __SYS_SIGUSR1
|
||||
#define SIGUSR2 __SYS_SIGUSR2
|
||||
#define SIGPOLL __SYS_SIGPOLL
|
||||
#define SIGPROF __SYS_SIGPROF
|
||||
#define SIGSYS __SYS_SIGSYS
|
||||
#define SIGTRAP __SYS_SIGTRAP
|
||||
#define SIGURG __SYS_SIGURG
|
||||
#define SIGVTALRM __SYS_SIGVTALRM
|
||||
#define SIGXCPU __SYS_SIGXCPU
|
||||
#define SIGXFSZ __SYS_SIGXFSZ
|
||||
#define SIGCOMP1 __SYS_SIGCOMP1
|
||||
#define SIGCOMP2 __SYS_SIGCOMP2
|
||||
#define SIGCOMP3 __SYS_SIGCOMP3
|
||||
#define SIGRTMIN __SYS_SIGRTMIN
|
||||
#define SIGRT_1 __SYS_SIGRT_1
|
||||
#define SIGRT_2 __SYS_SIGRT_2
|
||||
#define SIGRT_3 __SYS_SIGRT_3
|
||||
#define SIGRT_4 __SYS_SIGRT_4
|
||||
#define SIGRT_5 __SYS_SIGRT_5
|
||||
#define SIGRT_6 __SYS_SIGRT_6
|
||||
#define SIGRT_7 __SYS_SIGRT_7
|
||||
#define SIGRT_8 __SYS_SIGRT_8
|
||||
#define SIGRT_9 __SYS_SIGRT_9
|
||||
#define SIGRT_10 __SYS_SIGRT_10
|
||||
#define SIGRT_11 __SYS_SIGRT_11
|
||||
#define SIGRT_12 __SYS_SIGRT_12
|
||||
#define SIGRT_13 __SYS_SIGRT_13
|
||||
#define SIGRT_14 __SYS_SIGRT_14
|
||||
#define SIGRT_15 __SYS_SIGRT_15
|
||||
#define SIGRT_16 __SYS_SIGRT_16
|
||||
#define SIGRT_17 __SYS_SIGRT_17
|
||||
#define SIGRT_18 __SYS_SIGRT_18
|
||||
#define SIGRT_19 __SYS_SIGRT_19
|
||||
#define SIGRT_20 __SYS_SIGRT_20
|
||||
#define SIGRT_21 __SYS_SIGRT_21
|
||||
#define SIGRT_22 __SYS_SIGRT_22
|
||||
#define SIGRT_23 __SYS_SIGRT_23
|
||||
#define SIGRT_24 __SYS_SIGRT_24
|
||||
#define SIGRT_25 __SYS_SIGRT_25
|
||||
#define SIGRT_26 __SYS_SIGRT_26
|
||||
#define SIGRT_27 __SYS_SIGRT_27
|
||||
#define SIGRT_28 __SYS_SIGRT_28
|
||||
#define SIGRT_29 __SYS_SIGRT_29
|
||||
#define SIGRT_30 __SYS_SIGRT_30
|
||||
#define SIGRT_31 __SYS_SIGRT_31
|
||||
#define SIGRTMAX __SYS_SIGRTMAX
|
||||
#define SIGNAL_MAX __SYS_SIGNAL_MAX
|
||||
|
||||
/** @brief Interrupt from keyboard */
|
||||
#define SIGINT 2
|
||||
#define SIG_TERM __SYS_SIG_TERM
|
||||
// #define SIG_IGN __SYS_SIG_IGN
|
||||
#define SIG_CORE __SYS_SIG_CORE
|
||||
#define SIG_STOP __SYS_SIG_STOP
|
||||
#define SIG_CONT __SYS_SIG_CONT
|
||||
|
||||
/** @brief Quit from keyboard */
|
||||
#define SIGQUIT 3
|
||||
#define SIG_BLOCK __SYS_SIG_BLOCK
|
||||
#define SIG_UNBLOCK __SYS_SIG_UNBLOCK
|
||||
#define SIG_SETMASK __SYS_SIG_SETMASK
|
||||
|
||||
/** @brief Illegal Instruction */
|
||||
#define SIGILL 4
|
||||
#define SA_NOCLDSTOP __SYS_SA_NOCLDSTOP
|
||||
#define SA_ONSTACK __SYS_SA_ONSTACK
|
||||
#define SA_RESETHAND __SYS_SA_RESETHAND
|
||||
#define SA_RESTART __SYS_SA_RESTART
|
||||
#define SA_SIGINFO __SYS_SA_SIGINFO
|
||||
#define SA_NOCLDWAIT __SYS_SA_NOCLDWAIT
|
||||
#define SA_NODEFER __SYS_SA_NODEFER
|
||||
|
||||
/** @brief Trace/breakpoint trap */
|
||||
#define SIGTRAP 5
|
||||
#define SS_ONSTACK
|
||||
#define SS_DISABLE
|
||||
|
||||
/** @brief Abort signal from abort(3) */
|
||||
#define SIGABRT 6
|
||||
#define MINSIGSTKSZ
|
||||
#define SIGSTKSZ
|
||||
|
||||
/** @brief Bus error (bad memory access) */
|
||||
#define SIGBUS 7
|
||||
#define SIG_ERR ((void (*)(int))__SYS_SIG_ERR)
|
||||
#define SIG_DFL ((void (*)(int))__SYS_SIG_DFL)
|
||||
#define SIG_IGN ((void (*)(int))__SYS_SIG_IGN)
|
||||
|
||||
/** @brief Floating point exception */
|
||||
#define SIGFPE 8
|
||||
#define SIGEV_NONE
|
||||
#define SIGEV_SIGNAL
|
||||
#define SIGEV_THREAD
|
||||
|
||||
/** @brief Kill signal */
|
||||
#define SIGKILL 9
|
||||
typedef unsigned long sigset_t;
|
||||
|
||||
/** @brief User-defined signal 1 */
|
||||
#define SIGUSR1 10
|
||||
union sigval
|
||||
{
|
||||
int sival_int; /* Integer signal value. */
|
||||
void *sival_ptr; /* Pointer signal value. */
|
||||
};
|
||||
|
||||
/** @brief Invalid memory reference */
|
||||
#define SIGSEGV 11
|
||||
typedef struct siginfo_t
|
||||
{
|
||||
int si_signo; /* Signal number. */
|
||||
int si_code; /* Signal code. */
|
||||
|
||||
/** @brief User-defined signal 2 */
|
||||
#define SIGUSR2 12
|
||||
int si_errno; /* If non-zero, an errno value associated with */
|
||||
/* this signal, as described in <errno.h>. */
|
||||
|
||||
/** @brief Broken pipe: write to pipe with no readers */
|
||||
#define SIGPIPE 13
|
||||
pid_t si_pid; /* Sending process ID. */
|
||||
uid_t si_uid; /* Real user ID of sending process. */
|
||||
void *si_addr; /* Address that caused fault. */
|
||||
int si_status; /* Exit value or signal. */
|
||||
union sigval si_value; /* Signal value. */
|
||||
} siginfo_t;
|
||||
|
||||
/** @brief Timer signal from alarm(2) */
|
||||
#define SIGALRM 14
|
||||
typedef 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. */
|
||||
} sigevent;
|
||||
|
||||
/** @brief Termination signal */
|
||||
#define SIGTERM 15
|
||||
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. */
|
||||
};
|
||||
|
||||
/** @brief Stack fault on coprocessor (unused) */
|
||||
#define SIGSTKFLT 16
|
||||
typedef struct stack_t
|
||||
{
|
||||
void *ss_sp; /* Stack base or pointer. */
|
||||
size_t ss_size; /* Stack size. */
|
||||
int ss_flags; /* Flags. */
|
||||
} stack_t;
|
||||
|
||||
/** @brief Child stopped or terminated */
|
||||
#define SIGCHLD 17
|
||||
typedef struct mcontext_t
|
||||
{
|
||||
__UINTPTR_TYPE__ gregs[32]; /* General-purpose registers. */
|
||||
__UINTPTR_TYPE__ sp; /* Stack pointer. */
|
||||
__UINTPTR_TYPE__ pc; /* Program counter. */
|
||||
__UINTPTR_TYPE__ pstate; /* Processor state. */
|
||||
} mcontext_t;
|
||||
|
||||
/** @brief Continue if stopped */
|
||||
#define SIGCONT 18
|
||||
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;
|
||||
|
||||
/** @brief Stop process */
|
||||
#define SIGSTOP 19
|
||||
int kill(pid_t pid, int sig);
|
||||
int killpg(pid_t, int);
|
||||
void psiginfo(const siginfo_t *, const char *);
|
||||
void psignal(int, const char *);
|
||||
int pthread_kill(pthread_t, int);
|
||||
int pthread_sigmask(int, const sigset_t *restrict, sigset_t *restrict);
|
||||
int raise(int);
|
||||
int sig2str(int, char *);
|
||||
int sigaction(int, const struct sigaction *restrict, struct sigaction *restrict);
|
||||
int sigaddset(sigset_t *, int);
|
||||
int sigaltstack(const stack_t *restrict, stack_t *restrict);
|
||||
int sigdelset(sigset_t *, int);
|
||||
int sigemptyset(sigset_t *);
|
||||
int sigfillset(sigset_t *);
|
||||
int sigismember(const sigset_t *, int);
|
||||
void (*signal(int, void (*)(int)))(int);
|
||||
int sigpending(sigset_t *);
|
||||
int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);
|
||||
int sigqueue(pid_t, int, union sigval);
|
||||
int sigsuspend(const sigset_t *);
|
||||
int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, const struct timespec *restrict);
|
||||
int sigwait(const sigset_t *restrict, int *restrict);
|
||||
int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);
|
||||
int str2sig(const char *restrict, int *restrict);
|
||||
|
||||
/** @brief Stop typed at terminal */
|
||||
#define SIGTSTP 20
|
||||
|
||||
/** @brief Terminal input for background process */
|
||||
#define SIGTTIN 21
|
||||
|
||||
/** @brief Terminal output for background process */
|
||||
#define SIGTTOU 22
|
||||
|
||||
/** @brief Urgent condition on socket */
|
||||
#define SIGURG 23
|
||||
|
||||
/** @brief CPU time limit exceeded */
|
||||
#define SIGXCPU 24
|
||||
|
||||
/** @brief File size limit exceeded */
|
||||
#define SIGXFSZ 25
|
||||
|
||||
/** @brief Virtual timer expired */
|
||||
#define SIGVTALRM 26
|
||||
|
||||
/** @brief Profiling timer expired */
|
||||
#define SIGPROF 27
|
||||
|
||||
/** @brief Window resize signal */
|
||||
#define SIGWINCH 28
|
||||
|
||||
/** @brief I/O now possible */
|
||||
#define SIGIO 29
|
||||
|
||||
/** @brief Power failure */
|
||||
#define SIGPWR 30
|
||||
|
||||
/** @brief Bad system call */
|
||||
#define SIGSYS 31
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_SIGNAL_H
|
||||
|
@ -1,45 +0,0 @@
|
||||
#ifndef _SPAWN_H
|
||||
#define _SPAWN_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <bits/types/struct_sched_param.h>
|
||||
#include <bits/types/sigset_t.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
struct __spawn_action
|
||||
{
|
||||
int __stub;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short int __flags;
|
||||
pid_t __pgrp;
|
||||
sigset_t __sd;
|
||||
sigset_t __ss;
|
||||
struct sched_param __sp;
|
||||
int __policy;
|
||||
int __pad[16];
|
||||
} posix_spawnattr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int __allocated;
|
||||
int __used;
|
||||
struct __spawn_action *__actions;
|
||||
int __pad[16];
|
||||
} posix_spawn_file_actions_t;
|
||||
|
||||
int posix_spawn(pid_t *pid, const char *path,
|
||||
const posix_spawn_file_actions_t *file_actions,
|
||||
const posix_spawnattr_t *attrp,
|
||||
char *const argv[],
|
||||
char *const envp[]);
|
||||
|
||||
int posix_spawnp(pid_t *pid, const char *file,
|
||||
const posix_spawn_file_actions_t *file_actions,
|
||||
const posix_spawnattr_t *attrp,
|
||||
char *const argv[],
|
||||
char *const envp[]);
|
||||
|
||||
#endif // !_SPAWN_H
|
@ -1,13 +1,37 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
#ifndef __va_list__
|
||||
typedef __builtin_va_list va_list;
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define va_start(ap, last) __builtin_va_start(ap, last)
|
||||
#define va_end(ap) __builtin_va_end(ap)
|
||||
#define va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
typedef __builtin_va_list va_list;
|
||||
|
||||
#define va_start(ap, param) __builtin_va_start(ap, param)
|
||||
#define va_copy(dest, src) __builtin_va_copy(dest, src)
|
||||
#define va_arg(ap, type) __builtin_va_arg(ap, type)
|
||||
#define va_end(ap) __builtin_va_end(ap)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_STDARG_H
|
||||
|
36
Userspace/libc/include/stdbool.h
Normal file
36
Userspace/libc/include/stdbool.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDBOOL_H
|
||||
#define _STDBOOL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_STDBOOL_H
|
@ -1,47 +1,44 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDDEF_H
|
||||
#define _STDDEF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#define bool _Bool
|
||||
#endif
|
||||
|
||||
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 struct
|
||||
{
|
||||
long long __a;
|
||||
long double __b;
|
||||
} max_align_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 __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
typedef __SIZE_TYPE__ size_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;
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_STDDEF_H
|
||||
|
@ -1,6 +1,32 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
#include <types.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_STDINT_H
|
||||
|
@ -1,87 +1,156 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDIO_H
|
||||
#define _STDIO_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
/**
|
||||
* @brief EOF - End of file
|
||||
*
|
||||
* The value returned by several functions to indicate the end of file.
|
||||
*/
|
||||
#define EOF (-1)
|
||||
|
||||
struct _IO_marker
|
||||
{
|
||||
struct _IO_marker *_next;
|
||||
struct _IO_FILE *_sbuf;
|
||||
int _pos;
|
||||
};
|
||||
|
||||
struct _IO_FILE
|
||||
{
|
||||
int _flags;
|
||||
|
||||
char *_IO_read_ptr;
|
||||
char *_IO_read_end;
|
||||
char *_IO_read_base;
|
||||
char *_IO_write_base;
|
||||
char *_IO_write_ptr;
|
||||
char *_IO_write_end;
|
||||
char *_IO_buf_base;
|
||||
char *_IO_buf_end;
|
||||
|
||||
__off_t _offset;
|
||||
|
||||
struct _IO_marker *_markers;
|
||||
struct _IO_FILE *_chain;
|
||||
int _fileno;
|
||||
};
|
||||
|
||||
typedef struct _IO_FILE FILE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BUFSIZ 512
|
||||
#define FILENAME_MAX 255
|
||||
#define FOPEN_MAX 8
|
||||
#define _IOFBF 0
|
||||
#define _IOLBF 1
|
||||
#define _IONBF 2
|
||||
#define L_ctermid 20
|
||||
#define L_cuserid 20
|
||||
#define L_tmpnam 255
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#define SEEK_SET 0
|
||||
#define TMP_MAX 10000
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#define P_tmpdir "/tmp/"
|
||||
|
||||
typedef long fpos_t;
|
||||
typedef unsigned long size_t;
|
||||
|
||||
struct _IO_FILE
|
||||
{
|
||||
int fd;
|
||||
char *buffer;
|
||||
size_t buffer_size;
|
||||
size_t buffer_pos;
|
||||
int flags;
|
||||
int error;
|
||||
int eof;
|
||||
};
|
||||
|
||||
#define _i_READ 1
|
||||
#define _i_WRITE 2
|
||||
extern struct _IO_FILE *_i_open_files[256];
|
||||
|
||||
typedef struct _IO_FILE FILE;
|
||||
|
||||
extern char *optarg;
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
#define stdin stdin
|
||||
#define stdout stdout
|
||||
#define stderr stderr
|
||||
|
||||
FILE *freopen(const char *filename, const char *mode, FILE *stream);
|
||||
FILE *fopen(const char *filename, const char *mode);
|
||||
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
off_t fseek(FILE *stream, long offset, int whence);
|
||||
long ftell(FILE *stream);
|
||||
int fclose(FILE *fp);
|
||||
void clearerr(FILE *);
|
||||
char *ctermid(char *);
|
||||
int dprintf(int, const char *restrict, ...);
|
||||
int fclose(FILE *stream);
|
||||
FILE *fdopen(int, const char *);
|
||||
int feof(FILE *);
|
||||
int ferror(FILE *);
|
||||
int fflush(FILE *stream);
|
||||
int fprintf(FILE *stream, const char *format, ...);
|
||||
int printf(const char *format, ...);
|
||||
void setbuf(FILE *stream, char *buf);
|
||||
int vfprintf(FILE *stream, const char *format, va_list arg);
|
||||
int vsscanf(const char *s, const char *format, va_list arg);
|
||||
int sscanf(const char *s, const char *format, ...);
|
||||
|
||||
int fgetc(FILE *);
|
||||
int fgetpos(FILE *restrict, fpos_t *restrict);
|
||||
char *fgets(char *restrict, int, FILE *restrict);
|
||||
int fileno(FILE *);
|
||||
void flockfile(FILE *);
|
||||
FILE *fmemopen(void *restrict, size_t, const char *restrict);
|
||||
FILE *fopen(const char *restrict pathname, const char *restrict mode);
|
||||
int fprintf(FILE *restrict, const char *restrict, ...);
|
||||
int fputc(int c, FILE *stream);
|
||||
int fputs(const char *restrict s, FILE *restrict stream);
|
||||
size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
|
||||
FILE *freopen(const char *restrict, const char *restrict, FILE *restrict);
|
||||
int fscanf(FILE *restrict, const char *restrict, ...);
|
||||
int fseek(FILE *stream, long offset, int whence);
|
||||
int fseeko(FILE *, off_t, int);
|
||||
int fsetpos(FILE *, const fpos_t *);
|
||||
long ftell(FILE *);
|
||||
off_t ftello(FILE *);
|
||||
int ftrylockfile(FILE *);
|
||||
void funlockfile(FILE *);
|
||||
size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
|
||||
int getc(FILE *);
|
||||
int getchar(void);
|
||||
int getc_unlocked(FILE *);
|
||||
int getchar_unlocked(void);
|
||||
ssize_t getdelim(char **restrict, size_t *restrict, int, FILE *restrict);
|
||||
ssize_t getline(char **restrict, size_t *restrict, FILE *restrict);
|
||||
FILE *open_memstream(char **, size_t *);
|
||||
int pclose(FILE *);
|
||||
void perror(const char *);
|
||||
FILE *popen(const char *, const char *);
|
||||
int printf(const char *restrict format, ...);
|
||||
int putc(int c, FILE *stream);
|
||||
int fputs(const char *s, FILE *stream);
|
||||
int puts(const char *s);
|
||||
int putchar(int c);
|
||||
|
||||
int fgetc(FILE *stream);
|
||||
int putc_unlocked(int c, FILE *stream);
|
||||
int putchar_unlocked(int c);
|
||||
int puts(const char *s);
|
||||
int remove(const char *);
|
||||
int rename(const char *, const char *);
|
||||
int renameat(int, const char *, int, const char *);
|
||||
void rewind(FILE *);
|
||||
int scanf(const char *restrict, ...);
|
||||
void setbuf(FILE *restrict, char *restrict);
|
||||
int setvbuf(FILE *restrict, char *restrict, int, size_t);
|
||||
int snprintf(char *restrict, size_t, const char *restrict, ...);
|
||||
int sprintf(char *restrict, const char *restrict, ...);
|
||||
int sscanf(const char *restrict, const char *restrict, ...);
|
||||
FILE *tmpfile(void);
|
||||
char *tmpnam(char *);
|
||||
int ungetc(int, FILE *);
|
||||
int vdprintf(int, const char *restrict, va_list);
|
||||
int vfprintf(FILE *restrict, const char *restrict, va_list);
|
||||
int vfscanf(FILE *restrict, const char *restrict, va_list);
|
||||
int vprintf(const char *restrict, va_list);
|
||||
int vscanf(const char *restrict, va_list);
|
||||
int vsnprintf(char *restrict, size_t, const char *restrict, va_list);
|
||||
int vsprintf(char *restrict, const char *restrict, va_list);
|
||||
int vsscanf(const char *restrict, const char *restrict, va_list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif // !_STDIO_H
|
||||
|
@ -1,34 +1,115 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
#define NULL ((void *)0)
|
||||
#define RAND_MAX 32767
|
||||
|
||||
#define MB_CUR_MAX 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
typedef struct
|
||||
{
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
typedef unsigned long size_t;
|
||||
// typedef __WCHAR_TYPE__ wchar_t;
|
||||
|
||||
long a64l(const char *);
|
||||
void abort(void);
|
||||
int atexit(void (*function)(void));
|
||||
int abs(int);
|
||||
int atexit(void (*func)(void));
|
||||
double atof(const char *);
|
||||
int atoi(const char *);
|
||||
long int atol(const char *);
|
||||
void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
|
||||
void *calloc(size_t, size_t);
|
||||
div_t div(int, int);
|
||||
double drand48(void);
|
||||
char *ecvt(double, int, int *, int *);
|
||||
double erand48(unsigned short int[3]);
|
||||
void exit(int status);
|
||||
int atoi(const char *nptr);
|
||||
char *getenv(const char *name);
|
||||
|
||||
void *malloc(size_t Size);
|
||||
void *realloc(void *Address, size_t Size);
|
||||
void *calloc(size_t Count, size_t Size);
|
||||
void free(void *Address);
|
||||
int system(const char *command);
|
||||
|
||||
double atof(const char *nptr);
|
||||
|
||||
extern void perror(const char *s);
|
||||
char *fcvt(double, int, int *, int *);
|
||||
void free(void *ptr);
|
||||
char *gcvt(double, int, char *);
|
||||
char *getenv(const char *);
|
||||
int getsubopt(char **, char *const *, char **);
|
||||
int grantpt(int);
|
||||
char *initstate(unsigned int, char *, size_t);
|
||||
long int jrand48(unsigned short int[3]);
|
||||
char *l64a(long);
|
||||
long int labs(long int);
|
||||
void lcong48(unsigned short int[7]);
|
||||
ldiv_t ldiv(long int, long int);
|
||||
long int lrand48(void);
|
||||
void *malloc(size_t size);
|
||||
int mblen(const char *, size_t);
|
||||
size_t mbstowcs(wchar_t *, const char *, size_t);
|
||||
int mbtowc(wchar_t *, const char *, size_t);
|
||||
char *mktemp(char *);
|
||||
int mkstemp(char *);
|
||||
long int mrand48(void);
|
||||
long int nrand48(unsigned short int[3]);
|
||||
char *ptsname(int);
|
||||
int putenv(char *);
|
||||
void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
|
||||
int rand(void);
|
||||
int rand_r(unsigned int *);
|
||||
long random(void);
|
||||
void *realloc(void *, size_t);
|
||||
char *realpath(const char *, char *);
|
||||
unsigned short int seed48(unsigned short int[3]);
|
||||
void setkey(const char *);
|
||||
char *setstate(const char *);
|
||||
void srand(unsigned int);
|
||||
void srand48(long int);
|
||||
void srandom(unsigned);
|
||||
double strtod(const char *, char **);
|
||||
long int strtol(const char *, char **, int);
|
||||
unsigned long int strtoul(const char *, char **, int);
|
||||
int system(const char *);
|
||||
int ttyslot(void);
|
||||
int unlockpt(int);
|
||||
void *valloc(size_t);
|
||||
size_t wcstombs(char *, const wchar_t *, size_t);
|
||||
int wctomb(char *, wchar_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif // !_STDLIB_H
|
||||
|
@ -1,30 +1,71 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _STRING_H
|
||||
#define _STRING_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
size_t strlen(const char *str);
|
||||
int strcmp(const char *l, const char *r);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
int strcasecmp(const char *s1, const char *s2);
|
||||
int strncasecmp(const char *string1, const char *string2, size_t count);
|
||||
char *strstr(const char *haystack, const char *needle);
|
||||
char *strncpy(char *destination, const char *source, unsigned long num);
|
||||
char *strdup(const char *s);
|
||||
char *strchr(char const *s, int c);
|
||||
char *strrchr(char const *s, int c);
|
||||
#include <stddef.h>
|
||||
#include <locale.h>
|
||||
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
void *memset(void *dest, int c, size_t n);
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
void *memccpy(void *restrict, const void *restrict, int, size_t);
|
||||
void *memchr(const void *, int, size_t);
|
||||
int memcmp(const void *, const void *, size_t);
|
||||
void *memcpy(void *restrict s1, const void *restrict s2, size_t n);
|
||||
void *memmem(const void *, size_t, const void *, size_t);
|
||||
void *memmove(void *, const void *, size_t);
|
||||
void *memset(void *, int, size_t);
|
||||
char *stpcpy(char *restrict, const char *restrict);
|
||||
char *stpncpy(char *restrict, const char *restrict, size_t);
|
||||
char *strcat(char *restrict, const char *restrict);
|
||||
char *strchr(const char *, int);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strcoll(const char *, const char *);
|
||||
int strcoll_l(const char *, const char *, locale_t);
|
||||
char *strcpy(char *restrict, const char *restrict);
|
||||
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 strlcat(char *restrict, const char *restrict, size_t);
|
||||
size_t strlcpy(char *restrict, const char *restrict, size_t);
|
||||
size_t strlen(const char *);
|
||||
char *strncat(char *restrict, const char *restrict, size_t);
|
||||
int strncmp(const char *, const char *, size_t);
|
||||
char *strncpy(char *restrict, const char *restrict, 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 *restrict, const char *restrict);
|
||||
char *strtok_r(char *restrict, const char *restrict, char **restrict);
|
||||
size_t strxfrm(char *restrict, const char *restrict, size_t);
|
||||
size_t strxfrm_l(char *restrict, const char *restrict, size_t, locale_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
#endif // !_STRING_H
|
||||
|
@ -1,4 +0,0 @@
|
||||
#ifndef _STRINGS_H
|
||||
#define _STRINGS_H
|
||||
|
||||
#endif // !_STRINGS_H
|
73
Userspace/libc/include/sys/mman.h
Normal file
73
Userspace/libc/include/sys/mman.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MMAN_H
|
||||
#define _SYS_MMAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define PROT_READ 0x1
|
||||
#define PROT_WRITE 0x2
|
||||
#define PROT_EXEC 0x4
|
||||
#define PROT_NONE 0x0
|
||||
|
||||
#define MAP_SHARED 0x01
|
||||
#define MAP_PRIVATE 0x02
|
||||
#define MAP_FIXED 0x4
|
||||
#define MAP_ANONYMOUS 0x8
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
|
||||
#define MS_ASYNC 0x01
|
||||
#define MS_SYNC 0x02
|
||||
#define MS_INVALIDATE 0x04
|
||||
|
||||
#define MCL_CURRENT 0x01
|
||||
#define MCL_FUTURE 0x02
|
||||
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
typedef struct posix_typed_mem_info
|
||||
{
|
||||
/* Maximum length which may be allocated from a typed memory object. */
|
||||
size_t posix_tmi_length;
|
||||
} posix_typed_mem_info;
|
||||
|
||||
int mlock(const void *, size_t);
|
||||
int mlockall(int);
|
||||
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 *, size_t, int);
|
||||
int munlock(const void *, size_t);
|
||||
int munlockall(void);
|
||||
int munmap(void *addr, size_t len);
|
||||
int posix_madvise(void *, size_t, int);
|
||||
int posix_mem_offset(const void *restrict, size_t, off_t *restrict, size_t *restrict, int *restrict);
|
||||
int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
|
||||
int posix_typed_mem_open(const char *, int, int);
|
||||
int shm_open(const char *, int, mode_t);
|
||||
int shm_unlink(const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_SYS_MMAN_H
|
@ -1,18 +1,108 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_STAT_H
|
||||
#define _SYS_STAT_H
|
||||
|
||||
typedef unsigned int __dev_t;
|
||||
typedef unsigned short __ino_t;
|
||||
typedef unsigned short __mode_t;
|
||||
typedef long __off_t;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#define dev_t __dev_t
|
||||
#define ino_t __ino_t
|
||||
#define mode_t __mode_t
|
||||
#define off_t __off_t
|
||||
#include <time.h>
|
||||
|
||||
int mkdir(const char *path, mode_t mode);
|
||||
int remove(const char *pathname);
|
||||
int rename(const char *oldpath, const char *newpath);
|
||||
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. */
|
||||
};
|
||||
|
||||
#endif
|
||||
#define S_IFMT
|
||||
#define S_IFBLK
|
||||
#define S_IFCHR
|
||||
#define S_IFIFO
|
||||
#define S_IFREG
|
||||
#define S_IFDIR
|
||||
#define S_IFLNK
|
||||
#define S_IFSOCK
|
||||
|
||||
#define S_IRWXU 0700
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#define S_IXUSR 0100
|
||||
#define S_IRWXG 070
|
||||
#define S_IRGRP 040
|
||||
#define S_IWGRP 020
|
||||
#define S_IXGRP 010
|
||||
#define S_IRWXO 07
|
||||
#define S_IROTH 04
|
||||
#define S_IWOTH 02
|
||||
#define S_IXOTH 01
|
||||
|
||||
#define S_ISUID 04000
|
||||
#define S_ISGID 02000
|
||||
#define S_ISVTX 01000
|
||||
|
||||
#define S_ISBLK(m)
|
||||
#define S_ISCHR(m)
|
||||
#define S_ISDIR(m)
|
||||
#define S_ISFIFO(m)
|
||||
#define S_ISREG(m)
|
||||
#define S_ISLNK(m)
|
||||
#define S_ISSOCK(m)
|
||||
|
||||
#define S_TYPEISMQ(buf)
|
||||
#define S_TYPEISSEM(buf)
|
||||
#define S_TYPEISSHM(buf)
|
||||
#define S_TYPEISTMO(buf)
|
||||
|
||||
#define UTIME_NOW
|
||||
#define UTIME_OMIT
|
||||
|
||||
int chmod(const char *, mode_t);
|
||||
int fchmod(int, mode_t);
|
||||
int fchmodat(int, const char *, mode_t, int);
|
||||
int fstat(int, struct stat *);
|
||||
int fstatat(int, const char *restrict, struct stat *restrict, int);
|
||||
int futimens(int, const struct timespec[2]);
|
||||
int lstat(const char *restrict, struct stat *restrict);
|
||||
int mkdir(const char *, mode_t);
|
||||
int mkdirat(int, const char *, mode_t);
|
||||
int mkfifo(const char *, mode_t);
|
||||
int mkfifoat(int, const char *, mode_t);
|
||||
int mknod(const char *, mode_t, dev_t);
|
||||
int mknodat(int, const char *, mode_t, dev_t);
|
||||
int stat(const char *restrict, struct stat *restrict);
|
||||
mode_t umask(mode_t);
|
||||
int utimensat(int, const char *, const struct timespec[2], int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_SYS_STAT_H
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef _SYS_TIME_H
|
||||
#define _SYS_TIME_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
@ -1,37 +1,141 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H
|
||||
|
||||
#ifndef PUBLIC
|
||||
#define PUBLIC __attribute__((visibility("default")))
|
||||
#endif // !PUBLIC
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef PRIVATE
|
||||
#define PRIVATE __attribute__((visibility("hidden")))
|
||||
#endif // !PRIVATE
|
||||
#define __iptr __INTPTR_TYPE__
|
||||
__iptr __check_errno(__iptr status, __iptr err);
|
||||
|
||||
typedef int __pid_t;
|
||||
typedef int __ssize_t;
|
||||
typedef unsigned int __id_t;
|
||||
typedef unsigned int __useconds_t;
|
||||
#ifndef restrict
|
||||
#define restrict __restrict__
|
||||
#endif // restrict
|
||||
|
||||
#ifndef __pid_t_defined
|
||||
typedef __pid_t pid_t;
|
||||
#define __pid_t_defined
|
||||
#ifndef export
|
||||
#define export __attribute__((__visibility__("default")))
|
||||
#endif // export
|
||||
|
||||
typedef long blkcnt_t;
|
||||
|
||||
typedef long blksize_t;
|
||||
|
||||
typedef long clock_t;
|
||||
typedef int clockid_t;
|
||||
|
||||
typedef unsigned long dev_t;
|
||||
|
||||
typedef unsigned long fsblkcnt_t;
|
||||
typedef unsigned long fsfilcnt_t;
|
||||
|
||||
typedef unsigned int gid_t;
|
||||
typedef unsigned int id_t;
|
||||
typedef unsigned long ino_t;
|
||||
typedef unsigned short reclen_t;
|
||||
|
||||
typedef int key_t;
|
||||
|
||||
typedef unsigned int mode_t;
|
||||
typedef unsigned int nlink_t;
|
||||
|
||||
typedef long off_t;
|
||||
|
||||
typedef int pid_t;
|
||||
|
||||
typedef struct pthread_attr_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_attr_t;
|
||||
|
||||
typedef struct pthread_cond_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_cond_t;
|
||||
|
||||
typedef struct pthread_condattr_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_condattr_t;
|
||||
|
||||
typedef unsigned int pthread_key_t;
|
||||
|
||||
typedef struct pthread_mutex_t
|
||||
{
|
||||
short locked;
|
||||
char __data;
|
||||
} pthread_mutex_t;
|
||||
|
||||
typedef struct pthread_mutexattr_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_mutexattr_t;
|
||||
|
||||
typedef struct pthread_once_t
|
||||
{
|
||||
int __initialized;
|
||||
} pthread_once_t;
|
||||
|
||||
typedef struct pthread_rwlock_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_rwlock_t;
|
||||
|
||||
typedef struct pthread_rwlockattr_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_rwlockattr_t;
|
||||
|
||||
typedef struct pthread_barrier_t
|
||||
{
|
||||
char __data;
|
||||
} pthread_barrier_t;
|
||||
|
||||
typedef unsigned long size_t;
|
||||
typedef long ssize_t;
|
||||
|
||||
typedef long suseconds_t;
|
||||
typedef long time_t;
|
||||
|
||||
typedef int timer_t;
|
||||
|
||||
typedef unsigned int uid_t;
|
||||
typedef unsigned int useconds_t;
|
||||
|
||||
typedef struct __pthread
|
||||
{
|
||||
struct __pthread *Self;
|
||||
/* For __tls_get_addr */
|
||||
__UINTPTR_TYPE__ *Storage;
|
||||
|
||||
int CurrentError;
|
||||
} __pthread;
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef unsigned long pthread_t;
|
||||
#else
|
||||
typedef struct __pthread *pthread_t;
|
||||
#endif
|
||||
|
||||
#ifndef __id_t_defined
|
||||
typedef __id_t id_t;
|
||||
#define __id_t_defined
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __useconds_t_defined
|
||||
typedef __useconds_t useconds_t;
|
||||
#define __useconds_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __ssize_t_defined
|
||||
typedef __ssize_t ssize_t;
|
||||
#define __ssize_t_defined
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // !_SYS_TYPES_H
|
||||
|
@ -1,108 +1,65 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_WAIT_H
|
||||
#define _SYS_WAIT_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef enum
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
P_ALL, /* Wait for any child. */
|
||||
P_PID, /* Wait for specified process. */
|
||||
P_PGID /* Wait for members of process group. */
|
||||
} idtype_t;
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int stub;
|
||||
} siginfo_t;
|
||||
#include <signal.h>
|
||||
|
||||
#include <bits/waitstatus.h>
|
||||
/* waitpid() */
|
||||
#define WCONTINUED 0x00000008
|
||||
#define WNOHANG 0x00000001
|
||||
#define WUNTRACED 0x00000002
|
||||
|
||||
#define WCONTINUED 1
|
||||
#define WNOHANG 2
|
||||
#define WUNTRACED 4
|
||||
#define WEXITED 8
|
||||
#define WNOWAIT 16
|
||||
#define WSTOPPED 32
|
||||
/* waitid() */
|
||||
#define WEXITED 0x00000004
|
||||
#define WNOWAIT 0x00000020
|
||||
#define WSTOPPED 0x00000002
|
||||
|
||||
/**
|
||||
* @brief Macro for extracting the exit status from a status value.
|
||||
*
|
||||
* If the child process terminated normally by calling exit(3) or _exit(2),
|
||||
* the macro WEXITSTATUS() returns the low-order 8 bits of the status value.
|
||||
*
|
||||
* @param status The status value to extract the exit status from.
|
||||
* @return The exit status of the child process.
|
||||
*/
|
||||
#define WEXITSTATUS(status) __WEXITSTATUS(status)
|
||||
#define WCOREDUMP(status) ((status) & 0x80)
|
||||
#define WEXITSTATUS(status) (((status) >> 8) & 0xFF)
|
||||
#define WIFCONTINUED(status) ((status) == 0xFFFF)
|
||||
#define WIFEXITED(status) (((status) & 0x7F) == 0)
|
||||
#define WIFSIGNALED(status) (((status) & 0x7F) > 0 && (((status) & 0x7F) != 0x7F))
|
||||
#define WIFSTOPPED(status) (((status) & 0xFF) == 0x7F)
|
||||
#define WSTOPSIG(status) WEXITSTATUS(status)
|
||||
#define WTERMSIG(status) ((status) & 0x7F)
|
||||
|
||||
/**
|
||||
* @brief Macro for extracting the termination signal from a status value.
|
||||
*
|
||||
* If the child process was terminated by a signal, the macro WTERMSIG()
|
||||
* returns the signal number of the terminating signal.
|
||||
*
|
||||
* @param status The status value to extract the termination signal from.
|
||||
* @return The termination signal of the child process.
|
||||
*/
|
||||
#define WTERMSIG(status) __WTERMSIG(status)
|
||||
typedef enum
|
||||
{
|
||||
P_ALL,
|
||||
P_PGID,
|
||||
P_PID
|
||||
} idtype_t;
|
||||
|
||||
/**
|
||||
* @brief Macro for extracting the stop signal from a status value.
|
||||
*
|
||||
* If the child process was stopped by a signal, the macro WSTOPSIG()
|
||||
* returns the signal number of the stop signal.
|
||||
*
|
||||
* @param status The status value to extract the stop signal from.
|
||||
* @return The stop signal of the child process.
|
||||
*/
|
||||
#define WSTOPSIG(status) __WSTOPSIG(status)
|
||||
typedef unsigned int id_t;
|
||||
typedef int pid_t;
|
||||
|
||||
/**
|
||||
* @brief Macro for testing whether a process exited normally.
|
||||
*
|
||||
* If the child process terminated normally by calling exit(3) or _exit(2),
|
||||
* the macro WIFEXITED() returns a nonzero value. Otherwise, it returns 0.
|
||||
*
|
||||
* @param status The status value to test.
|
||||
* @return A nonzero value if the child process exited normally, 0 otherwise.
|
||||
*/
|
||||
#define WIFEXITED(status) __WIFEXITED(status)
|
||||
pid_t wait(int *);
|
||||
int waitid(idtype_t, id_t, siginfo_t *, int);
|
||||
pid_t waitpid(pid_t, int *, int);
|
||||
|
||||
/**
|
||||
* @brief Macro for testing whether a process was terminated by a signal.
|
||||
*
|
||||
* If the child process was terminated by a signal, the macro WIFSIGNALED()
|
||||
* returns a nonzero value. Otherwise, it returns 0.
|
||||
*
|
||||
* @param status The status value to test.
|
||||
* @return A nonzero value if the child process was terminated by a signal, 0 otherwise.
|
||||
*/
|
||||
#define WIFSIGNALED(status) __WIFSIGNALED(status)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* @brief Macro for testing whether a process was stopped by a signal.
|
||||
*
|
||||
* If the child process was stopped by a signal, the macro WIFSTOPPED()
|
||||
* returns a nonzero value. Otherwise, it returns 0.
|
||||
*
|
||||
* @param status The status value to test.
|
||||
* @return A nonzero value if the child process was stopped by a signal, 0 otherwise.
|
||||
*/
|
||||
#define WIFSTOPPED(status) __WIFSTOPPED(status)
|
||||
|
||||
/**
|
||||
* @brief Macro for testing whether a stopped process was continued.
|
||||
*
|
||||
* If the child process was stopped and has been resumed by delivery of SIGCONT,
|
||||
* the macro WIFCONTINUED() returns a nonzero value. Otherwise, it returns 0.
|
||||
*
|
||||
* @param status The status value to test.
|
||||
* @return A nonzero value if the child process was continued, 0 otherwise.
|
||||
*/
|
||||
#define WIFCONTINUED(status) __WIFCONTINUED(status)
|
||||
|
||||
pid_t wait(int *wstatus);
|
||||
pid_t waitpid(pid_t pid, int *wstatus, int options);
|
||||
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
|
||||
|
||||
#endif
|
||||
#endif // !_SYS_WAIT_H
|
||||
|
@ -1,4 +1,96 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <bits/types/timespec.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <locale.h>
|
||||
|
||||
typedef struct tm
|
||||
{
|
||||
int tm_sec; /* Seconds [0,60]. */
|
||||
int tm_min; /* Minutes [0,59]. */
|
||||
int tm_hour; /* Hour [0,23]. */
|
||||
int tm_mday; /* Day of month [1,31]. */
|
||||
int tm_mon; /* Month of year [0,11]. */
|
||||
int tm_year; /* Years since 1900. */
|
||||
int tm_wday; /* Day of week [0,6] (Sunday =0). */
|
||||
int tm_yday; /* Day of year [0,365]. */
|
||||
int tm_isdst; /* Daylight Saving flag. */
|
||||
long tm_gmtoff; /* Seconds east of UTC. */
|
||||
const char *tm_zone; /* Timezone abbreviation. */
|
||||
} tm;
|
||||
|
||||
typedef struct itimerspec
|
||||
{
|
||||
struct timespec it_interval; /* Timer period. */
|
||||
struct timespec it_value; /* Timer expiration. */
|
||||
} itimerspec;
|
||||
|
||||
#define CLOCKS_PER_SEC
|
||||
#define TIME_UTC
|
||||
#define CLOCK_MONOTONIC __SYS_CLOCK_MONOTONIC
|
||||
#define CLOCK_PROCESS_CPUTIME_ID __SYS_CLOCK_PROCESS_CPUTIME_ID
|
||||
#define CLOCK_REALTIME __SYS_CLOCK_REALTIME
|
||||
#define CLOCK_THREAD_CPUTIME_ID __SYS_CLOCK_THREAD_CPUTIME_ID
|
||||
#define TIMER_ABSTIME
|
||||
|
||||
extern int daylight;
|
||||
extern long timezone;
|
||||
extern char *tzname[];
|
||||
|
||||
char *asctime(const struct tm *);
|
||||
clock_t clock(void);
|
||||
int clock_getcpuclockid(pid_t, clockid_t *);
|
||||
int clock_getres(clockid_t, struct timespec *);
|
||||
int clock_gettime(clockid_t, struct timespec *);
|
||||
int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
|
||||
int clock_settime(clockid_t, const struct timespec *);
|
||||
char *ctime(const time_t *);
|
||||
double difftime(time_t, time_t);
|
||||
struct tm *getdate(const char *);
|
||||
struct tm *gmtime(const time_t *);
|
||||
struct tm *gmtime_r(const time_t *restrict, struct tm *restrict);
|
||||
struct tm *localtime(const time_t *);
|
||||
struct tm *localtime_r(const time_t *restrict, struct tm *restrict);
|
||||
time_t mktime(struct tm *);
|
||||
int nanosleep(const struct timespec *, struct timespec *);
|
||||
size_t strftime(char *restrict, size_t, const char *restrict, const struct tm *restrict);
|
||||
size_t strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
|
||||
char *strptime(const char *restrict, const char *restrict, struct tm *restrict);
|
||||
time_t time(time_t *);
|
||||
int timer_create(clockid_t, struct sigevent *restrict, timer_t *restrict);
|
||||
int timer_delete(timer_t);
|
||||
int timer_getoverrun(timer_t);
|
||||
int timer_gettime(timer_t, struct itimerspec *);
|
||||
int timer_settime(timer_t, int, const struct itimerspec *restrict, struct itimerspec *restrict);
|
||||
int timespec_get(struct timespec *, int);
|
||||
void tzset(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_TIME_H
|
||||
|
@ -1,206 +0,0 @@
|
||||
#ifndef __FENNIX_LIBC_TYPES_H__
|
||||
#define __FENNIX_LIBC_TYPES_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERNC extern "C"
|
||||
#define START_EXTERNC \
|
||||
EXTERNC \
|
||||
{
|
||||
#define END_EXTERNC \
|
||||
}
|
||||
#else
|
||||
#define EXTERNC
|
||||
#define START_EXTERNC
|
||||
#define END_EXTERNC
|
||||
#endif
|
||||
|
||||
#define asm __asm__
|
||||
#define asmv __asm__ volatile
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define foreach for
|
||||
#define in :
|
||||
#endif
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
#define CONCAT(x, y) x##y
|
||||
|
||||
#define toupper(c) ((c)-0x20 * (((c) >= 'a') && ((c) <= 'z')))
|
||||
#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z')))
|
||||
|
||||
#define ALIGN_UP(x, align) ((__typeof__(x))(((uint64_t)(x) + ((align)-1)) & (~((align)-1))))
|
||||
#define ALIGN_DOWN(x, align) ((__typeof__(x))((x) & (~((align)-1))))
|
||||
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define VPOKE(type, address) (*((volatile type *)(address)))
|
||||
#define POKE(type, address) (*((type *)(address)))
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#ifdef __STDC__
|
||||
#ifdef __STDC_VERSION__
|
||||
#if (__STDC_VERSION__ >= 201710L)
|
||||
#define C_LANGUAGE_STANDARD 2018
|
||||
#elif (__STDC_VERSION__ >= 201112L)
|
||||
#define C_LANGUAGE_STANDARD 2011
|
||||
#elif (__STDC_VERSION__ >= 199901L)
|
||||
#define C_LANGUAGE_STANDARD 1999
|
||||
#elif (__STDC_VERSION__ >= 199409L)
|
||||
#define C_LANGUAGE_STANDARD 1995
|
||||
#endif
|
||||
#else
|
||||
#define C_LANGUAGE_STANDARD 1990
|
||||
#endif
|
||||
#else
|
||||
#define C_LANGUAGE_STANDARD 1972
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __STDC__
|
||||
#ifdef __cplusplus
|
||||
#if (__cplusplus >= 202100L)
|
||||
#define CPP_LANGUAGE_STANDARD 2023
|
||||
#elif (__cplusplus >= 202002L)
|
||||
#define CPP_LANGUAGE_STANDARD 2020
|
||||
#elif (__cplusplus >= 201703L)
|
||||
#define CPP_LANGUAGE_STANDARD 2017
|
||||
#elif (__cplusplus >= 201402L)
|
||||
#define CPP_LANGUAGE_STANDARD 2014
|
||||
#elif (__cplusplus >= 201103L)
|
||||
#define CPP_LANGUAGE_STANDARD 2011
|
||||
#elif (__cplusplus >= 199711L)
|
||||
#define CPP_LANGUAGE_STANDARD 1998
|
||||
#endif
|
||||
#else
|
||||
#define CPP_LANGUAGE_STANDARD __cplusplus
|
||||
#endif
|
||||
#else
|
||||
#define CPP_LANGUAGE_STANDARD __cplusplus
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
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;
|
||||
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
#define INT8_MAX __INT8_MAX__
|
||||
#define INT8_MIN (-INT8_MAX - 1)
|
||||
#define UINT8_MAX __UINT8_MAX__
|
||||
#define INT16_MAX __INT16_MAX__
|
||||
#define INT16_MIN (-INT16_MAX - 1)
|
||||
#define UINT16_MAX __UINT16_MAX__
|
||||
#define INT32_MAX __INT32_MAX__
|
||||
#define INT32_MIN (-INT32_MAX - 1)
|
||||
#define UINT32_MAX __UINT32_MAX__
|
||||
#define INT64_MAX __INT64_MAX__
|
||||
#define INT64_MIN (-INT64_MAX - 1)
|
||||
#define UINT64_MAX __UINT64_MAX__
|
||||
|
||||
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
|
||||
#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
|
||||
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
|
||||
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
|
||||
#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
|
||||
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
|
||||
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
|
||||
#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
|
||||
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
|
||||
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
|
||||
#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
|
||||
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
|
||||
|
||||
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
||||
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
||||
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
||||
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
||||
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
||||
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
||||
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
||||
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
||||
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
||||
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
||||
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
||||
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
||||
|
||||
#define INTPTR_MAX __INTPTR_MAX__
|
||||
#define INTPTR_MIN (-INTPTR_MAX - 1)
|
||||
#define UINTPTR_MAX __UINTPTR_MAX__
|
||||
|
||||
#define INTMAX_MAX __INTMAX_MAX__
|
||||
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
||||
#define UINTMAX_MAX __UINTMAX_MAX__
|
||||
|
||||
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
||||
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
||||
|
||||
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
|
||||
#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
|
||||
|
||||
#define SIZE_MAX __SIZE_MAX__
|
||||
|
||||
#define WCHAR_MAX __WCHAR_MAX__
|
||||
#define WCHAR_MIN __WCHAR_MIN__
|
||||
|
||||
#define WINT_MAX __WINT_MAX__
|
||||
#define WINT_MIN __WINT_MIN__
|
||||
|
||||
#define b4(x) ((x & 0x0F) << 4 | (x & 0xF0) >> 4)
|
||||
#define b8(x) ((x)&0xFF)
|
||||
#define b16(x) __builtin_bswap16(x)
|
||||
#define b32(x) __builtin_bswap32(x)
|
||||
#define b48(x) (((((x)&0x0000000000ff) << 40) | (((x)&0x00000000ff00) << 24) | (((x)&0x000000ff0000) << 8) | (((x)&0x0000ff000000) >> 8) | (((x)&0x00ff00000000) >> 24) | (((x)&0xff0000000000) >> 40)))
|
||||
#define b64(x) __builtin_bswap64(x)
|
||||
|
||||
#ifndef PUBLIC
|
||||
#define PUBLIC __attribute__((visibility("default")))
|
||||
#endif // !PUBLIC
|
||||
|
||||
#ifndef PRIVATE
|
||||
#define PRIVATE __attribute__((visibility("hidden")))
|
||||
#endif // !PRIVATE
|
||||
|
||||
#endif // !__FENNIX_LIBC_TYPES_H__
|
@ -1,29 +1,151 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define _POSIX_VERSION 200809L
|
||||
#define _POSIX2_VERSION 200809L
|
||||
#define _XOPEN_VERSION 700
|
||||
|
||||
#define F_OK 0
|
||||
#define R_OK 1
|
||||
#define W_OK 2
|
||||
#define X_OK 3
|
||||
|
||||
#define SEEK_SET 0
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
#define _POSIX_JOB_CONTROL 1
|
||||
#define _POSIX_SAVED_IDS 1
|
||||
#define _POSIX_NO_TRUNC 1
|
||||
#define _POSIX_VDISABLE '\0'
|
||||
|
||||
int execl(const char *pathname, const char *arg, ...);
|
||||
int execlp(const char *file, const char *arg, ...);
|
||||
int execle(const char *pathname, const char *arg, ...);
|
||||
int execv(const char *pathname, char *const argv[]);
|
||||
int execvp(const char *file, char *const argv[]);
|
||||
int execvpe(const char *file, char *const argv[], char *const envp[]);
|
||||
int execve(const char *pathname, char *const argv[], char *const envp[]);
|
||||
#define ARG_MAX 4096
|
||||
#define CHILD_MAX 25
|
||||
#define CLK_TCK 100
|
||||
|
||||
#define _SC_PAGESIZE 4096
|
||||
#define _SC_OPEN_MAX 256
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
int access(const char *, int);
|
||||
unsigned int alarm(unsigned int);
|
||||
int brk(void *);
|
||||
int chdir(const char *);
|
||||
int chroot(const char *);
|
||||
int chown(const char *, uid_t, gid_t);
|
||||
int close(int);
|
||||
size_t confstr(int, char *, size_t);
|
||||
char *crypt(const char *, const char *);
|
||||
char *ctermid(char *);
|
||||
char *cuserid(char *s);
|
||||
int dup(int);
|
||||
int dup2(int, int);
|
||||
void encrypt(char[64], int);
|
||||
int execl(const char *, const char *, ...);
|
||||
int execle(const char *, const char *, ...);
|
||||
int execlp(const char *, const char *, ...);
|
||||
int execv(const char *, char *const[]);
|
||||
int execve(const char *, char *const[], char *const[]);
|
||||
int execvp(const char *, char *const[]);
|
||||
void _exit(int);
|
||||
int fchown(int, uid_t, gid_t);
|
||||
int fchdir(int);
|
||||
int fdatasync(int);
|
||||
pid_t fork(void);
|
||||
|
||||
unsigned int sleep(unsigned int seconds);
|
||||
int usleep(useconds_t usec);
|
||||
long int fpathconf(int, int);
|
||||
int fsync(int);
|
||||
int ftruncate(int, off_t);
|
||||
char *getcwd(char *, size_t);
|
||||
int getdtablesize(void);
|
||||
gid_t getegid(void);
|
||||
uid_t geteuid(void);
|
||||
gid_t getgid(void);
|
||||
int getgroups(int, gid_t[]);
|
||||
long gethostid(void);
|
||||
char *getlogin(void);
|
||||
int getlogin_r(char *, size_t);
|
||||
int getopt(int, char *const[], const char *);
|
||||
int getpagesize(void);
|
||||
char *getpass(const char *);
|
||||
pid_t getpgid(pid_t);
|
||||
pid_t getpgrp(void);
|
||||
pid_t getpid(void);
|
||||
pid_t getppid(void);
|
||||
pid_t getsid(pid_t);
|
||||
uid_t getuid(void);
|
||||
char *getwd(char *);
|
||||
int isatty(int);
|
||||
int lchown(const char *, uid_t, gid_t);
|
||||
int link(const char *, const char *);
|
||||
int lockf(int, int, off_t);
|
||||
off_t lseek(int, off_t, int);
|
||||
int nice(int);
|
||||
long int pathconf(const char *, int);
|
||||
int pause(void);
|
||||
int pipe(int[2]);
|
||||
ssize_t pread(int, void *, size_t, off_t);
|
||||
int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
|
||||
ssize_t pwrite(int, const void *, size_t, off_t);
|
||||
ssize_t read(int, void *, size_t);
|
||||
int readlink(const char *, char *, size_t);
|
||||
int rmdir(const char *);
|
||||
void *sbrk(intptr_t);
|
||||
int setgid(gid_t);
|
||||
int setpgid(pid_t, pid_t);
|
||||
pid_t setpgrp(void);
|
||||
int setregid(gid_t, gid_t);
|
||||
int setreuid(uid_t, uid_t);
|
||||
pid_t setsid(void);
|
||||
int setuid(uid_t);
|
||||
unsigned int sleep(unsigned int);
|
||||
void swab(const void *, void *, ssize_t);
|
||||
int symlink(const char *, const char *);
|
||||
void sync(void);
|
||||
long int sysconf(int);
|
||||
pid_t tcgetpgrp(int);
|
||||
int tcsetpgrp(int, pid_t);
|
||||
int truncate(const char *, off_t);
|
||||
char *ttyname(int);
|
||||
int ttyname_r(int, char *, size_t);
|
||||
useconds_t ualarm(useconds_t, useconds_t);
|
||||
int unlink(const char *);
|
||||
int usleep(useconds_t);
|
||||
pid_t vfork(void);
|
||||
ssize_t write(int, const void *, size_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // !_UNISTD_H
|
||||
|
Reference in New Issue
Block a user