mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
This commit is contained in:
parent
c11351ac50
commit
0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Retainable.h>
|
||||
|
||||
class SharedBuffer : public Retainable<SharedBuffer> {
|
||||
public:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define alloca __builtin_alloca
|
||||
|
||||
|
|
|
@ -33,4 +33,3 @@ static inline uint32_t ntohl(uint32_t ns)
|
|||
}
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -6,16 +6,18 @@ __BEGIN_DECLS
|
|||
|
||||
#ifdef DEBUG
|
||||
__attribute__((noreturn)) void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func);
|
||||
#define assert(expr) ((expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
||||
#define ASSERT_NOT_REACHED() assert(false)
|
||||
# define assert(expr) ((expr) ? (void)0 : __assertion_failed(# expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
||||
# define ASSERT_NOT_REACHED() assert(false)
|
||||
#else
|
||||
#define assert(expr)
|
||||
#define ASSERT_NOT_REACHED() CRASH()
|
||||
# define assert(expr)
|
||||
# define ASSERT_NOT_REACHED() CRASH()
|
||||
#endif
|
||||
|
||||
#define CRASH() do { asm volatile("ud2"); } while(0)
|
||||
#define CRASH() \
|
||||
do { \
|
||||
asm volatile("ud2"); \
|
||||
} while (0)
|
||||
#define ASSERT assert
|
||||
#define RELEASE_ASSERT assert
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <string.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -38,12 +38,12 @@ int isupper(int);
|
|||
#define isxdigit(c) (_ctype_[(int)(c)] & (_N | _X))
|
||||
#define isspace(c) (_ctype_[(int)(c)] & (_S))
|
||||
#define ispunct(c) (_ctype_[(int)(c)] & (_P))
|
||||
#define isprint(c) (_ctype_[(int)(c)] & (_P|_U|_L|_N|_B))
|
||||
#define isgraph(c) (_ctype_[(int)(c)] & (_P|_U|_L|_N))
|
||||
#define isprint(c) (_ctype_[(int)(c)] & (_P | _U | _L | _N | _B))
|
||||
#define isgraph(c) (_ctype_[(int)(c)] & (_P | _U | _L | _N))
|
||||
#define islower(c) ((_ctype_[(int)(c)] & (_U | _L)) == _L)
|
||||
#define isupper(c) ((_ctype_[(int)(c)] & (_U | _L)) == _U)
|
||||
|
||||
#define isascii(c) ((unsigned)c <= 127)
|
||||
#define toascii(c) ((c) & 127)
|
||||
#define toascii(c) ((c)&127)
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -27,4 +27,3 @@ int closedir(DIR*);
|
|||
struct dirent* readdir(DIR*);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ __BEGIN_DECLS
|
|||
#define RTLD_LOCAL 4
|
||||
|
||||
int dlclose(void*);
|
||||
char *dlerror();
|
||||
void *dlopen(const char*, int);
|
||||
void *dlsym(void*, const char*);
|
||||
char* dlerror();
|
||||
void* dlopen(const char*, int);
|
||||
void* dlsym(void*, const char*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
20
LibC/errno.h
20
LibC/errno.h
|
@ -1,18 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <errno_numbers.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define __RETURN_WITH_ERRNO(rc, good_ret, bad_ret) \
|
||||
do { \
|
||||
if (rc < 0) { \
|
||||
errno = -rc; \
|
||||
return (bad_ret); \
|
||||
} else { \
|
||||
errno = 0; \
|
||||
return (good_ret); \
|
||||
} \
|
||||
} while(0)
|
||||
do { \
|
||||
if (rc < 0) { \
|
||||
errno = -rc; \
|
||||
return (bad_ret); \
|
||||
} else { \
|
||||
errno = 0; \
|
||||
return (good_ret); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -1,74 +1,74 @@
|
|||
#pragma once
|
||||
|
||||
#define ESUCCESS 0
|
||||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define ENOTBLK 15
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define EINVAL 22
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define ETXTBSY 26
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
#define ERANGE 33
|
||||
#define ENAMETOOLONG 34
|
||||
#define ELOOP 35
|
||||
#define EOVERFLOW 36
|
||||
#define EOPNOTSUPP 37
|
||||
#define ENOSYS 38
|
||||
#define ENOTIMPL 39
|
||||
#define EAFNOSUPPORT 40
|
||||
#define ENOTSOCK 41
|
||||
#define EADDRINUSE 42
|
||||
#define EWHYTHO 43
|
||||
#define ENOTEMPTY 44
|
||||
#define EDOM 45
|
||||
#define ECONNREFUSED 46
|
||||
#define EADDRNOTAVAIL 47
|
||||
#define EISCONN 48
|
||||
#define ECONNABORTED 49
|
||||
#define EALREADY 50
|
||||
#define ECONNRESET 51
|
||||
#define EDESTADDRREQ 52
|
||||
#define EHOSTUNREACH 53
|
||||
#define EILSEQ 54
|
||||
#define EMSGSIZE 55
|
||||
#define ENETDOWN 56
|
||||
#define ENETUNREACH 57
|
||||
#define ENETRESET 58
|
||||
#define ENOBUFS 59
|
||||
#define ENOLCK 60
|
||||
#define ENOMSG 61
|
||||
#define ENOPROTOOPT 62
|
||||
#define ENOTCONN 63
|
||||
#define EWOULDBLOCK 64
|
||||
#define ESUCCESS 0
|
||||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define ENOTBLK 15
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define EINVAL 22
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define ETXTBSY 26
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
#define ERANGE 33
|
||||
#define ENAMETOOLONG 34
|
||||
#define ELOOP 35
|
||||
#define EOVERFLOW 36
|
||||
#define EOPNOTSUPP 37
|
||||
#define ENOSYS 38
|
||||
#define ENOTIMPL 39
|
||||
#define EAFNOSUPPORT 40
|
||||
#define ENOTSOCK 41
|
||||
#define EADDRINUSE 42
|
||||
#define EWHYTHO 43
|
||||
#define ENOTEMPTY 44
|
||||
#define EDOM 45
|
||||
#define ECONNREFUSED 46
|
||||
#define EADDRNOTAVAIL 47
|
||||
#define EISCONN 48
|
||||
#define ECONNABORTED 49
|
||||
#define EALREADY 50
|
||||
#define ECONNRESET 51
|
||||
#define EDESTADDRREQ 52
|
||||
#define EHOSTUNREACH 53
|
||||
#define EILSEQ 54
|
||||
#define EMSGSIZE 55
|
||||
#define ENETDOWN 56
|
||||
#define ENETUNREACH 57
|
||||
#define ENETRESET 58
|
||||
#define ENOBUFS 59
|
||||
#define ENOLCK 60
|
||||
#define ENOMSG 61
|
||||
#define ENOPROTOOPT 62
|
||||
#define ENOTCONN 63
|
||||
#define EWOULDBLOCK 64
|
||||
#define EPROTONOSUPPORT 65
|
||||
#define EDEADLK 66
|
||||
#define ETIMEDOUT 67
|
||||
#define EPROTOTYPE 68
|
||||
#define EINPROGRESS 69
|
||||
#define ENOTHREAD 70
|
||||
#define EMAXERRNO 71
|
||||
#define EDEADLK 66
|
||||
#define ETIMEDOUT 67
|
||||
#define EPROTOTYPE 68
|
||||
#define EINPROGRESS 69
|
||||
#define ENOTHREAD 70
|
||||
#define EMAXERRNO 71
|
||||
|
|
16
LibC/fcntl.h
16
LibC/fcntl.h
|
@ -26,14 +26,14 @@ __BEGIN_DECLS
|
|||
#define O_NOFOLLOW 00400000
|
||||
#define O_CLOEXEC 02000000
|
||||
|
||||
#define S_IFMT 0170000
|
||||
#define S_IFDIR 0040000
|
||||
#define S_IFCHR 0020000
|
||||
#define S_IFBLK 0060000
|
||||
#define S_IFREG 0100000
|
||||
#define S_IFIFO 0010000
|
||||
#define S_IFLNK 0120000
|
||||
#define S_IFSOCK 0140000
|
||||
#define S_IFMT 0170000
|
||||
#define S_IFDIR 0040000
|
||||
#define S_IFCHR 0020000
|
||||
#define S_IFBLK 0060000
|
||||
#define S_IFREG 0100000
|
||||
#define S_IFIFO 0010000
|
||||
#define S_IFLNK 0120000
|
||||
#define S_IFSOCK 0140000
|
||||
|
||||
#define S_ISUID 04000
|
||||
#define S_ISGID 02000
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef void * iconv_t;
|
||||
typedef void* iconv_t;
|
||||
|
||||
extern iconv_t iconv_open(const char* tocode, const char* fromcode);
|
||||
extern size_t iconv(iconv_t, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft);
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
LC_ALL,
|
||||
LC_NUMERIC,
|
||||
LC_CTYPE,
|
||||
|
@ -23,4 +24,3 @@ struct lconv* localeconv();
|
|||
char* setlocale(int category, const char* locale);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -26,4 +26,3 @@ int shm_open(const char* name, int flags, mode_t);
|
|||
int shm_unlink(const char* name);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -20,4 +20,3 @@ struct mntent {
|
|||
struct mntent* getmntent(FILE* stream);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ struct hostent {
|
|||
#define h_addr h_addr_list[0]
|
||||
};
|
||||
|
||||
struct hostent *gethostbyname(const char*);
|
||||
struct hostent* gethostbyname(const char*);
|
||||
|
||||
struct servent {
|
||||
char* s_name;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -19,4 +19,3 @@ struct icmphdr {
|
|||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
13
LibC/poll.h
13
LibC/poll.h
|
@ -4,15 +4,15 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define POLLIN (1u << 0)
|
||||
#define POLLPRI (1u << 2)
|
||||
#define POLLOUT (1u << 3)
|
||||
#define POLLERR (1u << 4)
|
||||
#define POLLHUP (1u << 5)
|
||||
#define POLLIN (1u << 0)
|
||||
#define POLLPRI (1u << 2)
|
||||
#define POLLOUT (1u << 3)
|
||||
#define POLLERR (1u << 4)
|
||||
#define POLLHUP (1u << 5)
|
||||
#define POLLNVAL (1u << 6)
|
||||
|
||||
struct pollfd {
|
||||
int fd;
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
@ -20,4 +20,3 @@ struct pollfd {
|
|||
int poll(struct pollfd* fds, int nfds, int timeout);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sched.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -15,61 +15,61 @@ typedef void* pthread_cond_t;
|
|||
typedef void* pthread_spinlock_t;
|
||||
typedef void* pthread_condattr_t;
|
||||
|
||||
int pthread_create(pthread_t, pthread_attr_t*, void*(*)(void*), void*);
|
||||
int pthread_create(pthread_t, pthread_attr_t*, void* (*)(void*), void*);
|
||||
void pthread_exit(void*);
|
||||
int pthread_kill(pthread_t, int);
|
||||
void pthread_cleanup_push(void(*)(void*), void*);
|
||||
void pthread_cleanup_push(void (*)(void*), void*);
|
||||
void pthread_cleanup_pop(int);
|
||||
int pthread_join(pthread_t, void**);
|
||||
int pthread_mutex_lock(pthread_mutex_t*);
|
||||
int pthread_mutex_trylock(pthread_mutex_t*mutex);
|
||||
int pthread_mutex_trylock(pthread_mutex_t* mutex);
|
||||
int pthread_mutex_unlock(pthread_mutex_t*);
|
||||
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
|
||||
int pthread_mutex_destroy(pthread_mutex_t*);
|
||||
int pthread_attr_init(pthread_attr_t*);
|
||||
int pthread_attr_destroy(pthread_attr_t*);
|
||||
|
||||
int pthread_once(pthread_once_t*, void(*)(void));
|
||||
int pthread_once(pthread_once_t*, void (*)(void));
|
||||
#define PTHREAD_ONCE_INIT 0
|
||||
pthread_once_t once_control = PTHREAD_ONCE_INIT;
|
||||
void *pthread_getspecific(pthread_key_t key);
|
||||
int pthread_setspecific(pthread_key_t key, const void *value);
|
||||
void* pthread_getspecific(pthread_key_t key);
|
||||
int pthread_setspecific(pthread_key_t key, const void* value);
|
||||
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
#define PTHREAD_MUTEX_RECURSIVE 1
|
||||
#define PTHREAD_MUTEX_INITIALIZER 0
|
||||
#define PTHREAD_COND_INITIALIZER 0
|
||||
|
||||
int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
|
||||
int pthread_key_create(pthread_key_t* key, void (*destructor)(void*));
|
||||
int pthread_key_delete(pthread_key_t key);
|
||||
int pthread_cond_broadcast(pthread_cond_t *);
|
||||
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
|
||||
int pthread_cond_signal(pthread_cond_t *);
|
||||
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
|
||||
int pthread_condattr_destroy(pthread_condattr_t *);
|
||||
int pthread_cond_broadcast(pthread_cond_t*);
|
||||
int pthread_cond_init(pthread_cond_t*, const pthread_condattr_t*);
|
||||
int pthread_cond_signal(pthread_cond_t*);
|
||||
int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*);
|
||||
int pthread_condattr_destroy(pthread_condattr_t*);
|
||||
int pthread_cancel(pthread_t);
|
||||
void pthread_cleanup_push(void (*)(void *), void *);
|
||||
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_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_cond_broadcast(pthread_cond_t*);
|
||||
int pthread_cond_destroy(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*);
|
||||
|
||||
void pthread_testcancel(void);
|
||||
|
||||
int pthread_spin_destroy(pthread_spinlock_t *);
|
||||
int pthread_spin_init(pthread_spinlock_t *, int);
|
||||
int pthread_spin_lock(pthread_spinlock_t *);
|
||||
int pthread_spin_trylock(pthread_spinlock_t *);
|
||||
int pthread_spin_unlock(pthread_spinlock_t *);
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
int pthread_spin_destroy(pthread_spinlock_t*);
|
||||
int pthread_spin_init(pthread_spinlock_t*, int);
|
||||
int pthread_spin_lock(pthread_spinlock_t*);
|
||||
int pthread_spin_trylock(pthread_spinlock_t*);
|
||||
int pthread_spin_unlock(pthread_spinlock_t*);
|
||||
int pthread_cond_destroy(pthread_cond_t*);
|
||||
pthread_t pthread_self(void);
|
||||
int pthread_detach(pthread_t);
|
||||
int pthread_equal(pthread_t, pthread_t);
|
||||
void pthread_exit(void *);
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *);
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
|
||||
void pthread_exit(void*);
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t*);
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
struct Stopwatch {
|
||||
union SplitQword {
|
||||
struct {
|
||||
|
@ -14,6 +13,7 @@ struct Stopwatch {
|
|||
};
|
||||
uint64_t qw { 0 };
|
||||
};
|
||||
|
||||
public:
|
||||
Stopwatch(const char* name)
|
||||
: m_name(name)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal_numbers.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -50,4 +50,3 @@ extern const char* sys_siglist[NSIG];
|
|||
#define SIG_SETMASK 2
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#define SIGINVAL 0
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define NSIG 32
|
||||
#define SIGINVAL 0
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGBUS 7
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGUSR1 10
|
||||
#define SIGSEGV 11
|
||||
#define SIGUSR2 12
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGSTKFLT 16
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGTTIN 21
|
||||
#define SIGTTOU 22
|
||||
#define SIGURG 23
|
||||
#define SIGXCPU 24
|
||||
#define SIGXFSZ 25
|
||||
#define SIGVTALRM 26
|
||||
#define SIGPROF 27
|
||||
#define SIGWINCH 28
|
||||
#define SIGIO 29
|
||||
#define SIGPWR 30
|
||||
#define SIGSYS 31
|
||||
#define NSIG 32
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef KERNEL
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
# define __BEGIN_DECLS
|
||||
# define __END_DECLS
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
# include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@ -16,4 +16,3 @@ typedef __builtin_va_list va_list;
|
|||
#define va_arg(v, l) __builtin_va_arg(v, l)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
# include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define __bool_true_false_are_Defined 1
|
||||
# define bool _Bool
|
||||
# define true 1
|
||||
# define false 0
|
||||
# define __bool_true_false_are_Defined 1
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL nullptr
|
||||
# define NULL nullptr
|
||||
#else
|
||||
#define NULL ((void*)0)
|
||||
# define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
|
|
|
@ -55,9 +55,9 @@ typedef __INTMAX_TYPE__ intmax_t;
|
|||
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
||||
|
||||
#define INT8_MIN (-128)
|
||||
#define INT16_MIN (-32767-1)
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#define INT64_MIN (-9223372036854775807LL-1LL)
|
||||
#define INT16_MIN (-32767 - 1)
|
||||
#define INT32_MIN (-2147483647 - 1)
|
||||
#define INT64_MIN (-9223372036854775807LL - 1LL)
|
||||
#define INT8_MAX (127)
|
||||
#define INT16_MAX (32767)
|
||||
#define INT32_MAX (2147483647)
|
||||
|
@ -101,8 +101,7 @@ typedef __INTMAX_TYPE__ intmax_t;
|
|||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
#define INT64_C(x) x##LL
|
||||
#define INT64_C(x) x##LL
|
||||
#define UINT64_C(x) x##ULL
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
14
LibC/stdio.h
14
LibC/stdio.h
|
@ -2,16 +2,16 @@
|
|||
|
||||
#define _STDIO_H // Make GMP believe we exist.
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define BUFSIZ 1024
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#ifndef EOF
|
||||
# define EOF (-1)
|
||||
#endif
|
||||
|
||||
#define SEEK_SET 0
|
||||
|
@ -57,7 +57,8 @@ int getchar();
|
|||
int ungetc(int c, FILE*);
|
||||
int remove(const char* pathname);
|
||||
FILE* fdopen(int fd, const char* mode);
|
||||
FILE* fopen(const char* pathname, const char* mode); FILE* freopen(const char* pathname, const char* mode, FILE*);
|
||||
FILE* fopen(const char* pathname, const char* mode);
|
||||
FILE* freopen(const char* pathname, const char* mode, FILE*);
|
||||
int fclose(FILE*);
|
||||
void rewind(FILE*);
|
||||
void clearerr(FILE*);
|
||||
|
@ -81,7 +82,7 @@ int puts(const char*);
|
|||
int fputs(const char*, FILE*);
|
||||
void perror(const char*);
|
||||
int scanf(const char* fmt, ...);
|
||||
int sscanf (const char* str, const char* fmt, ...);
|
||||
int sscanf(const char* str, const char* fmt, ...);
|
||||
int fscanf(FILE*, const char* fmt, ...);
|
||||
int vfscanf(FILE*, const char*, va_list);
|
||||
int vsscanf(const char*, const char*, va_list);
|
||||
|
@ -95,4 +96,3 @@ FILE* popen(const char* command, const char* type);
|
|||
int pclose(FILE*);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -13,7 +13,7 @@ __BEGIN_DECLS
|
|||
__attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t);
|
||||
__attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t);
|
||||
void free(void*);
|
||||
void* realloc(void *ptr, size_t);
|
||||
void* realloc(void* ptr, size_t);
|
||||
char* getenv(const char* name);
|
||||
int putenv(char*);
|
||||
int unsetenv(const char*);
|
||||
|
@ -36,7 +36,7 @@ long labs(long);
|
|||
double atof(const char*);
|
||||
int system(const char* command);
|
||||
char* mktemp(char*);
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||
|
||||
#define RAND_MAX 32767
|
||||
int rand();
|
||||
|
@ -45,10 +45,15 @@ void srand(unsigned seed);
|
|||
long int random();
|
||||
void srandom(unsigned seed);
|
||||
|
||||
typedef struct { int quot; int rem; } div_t;
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
div_t div(int, int);
|
||||
typedef struct { long quot; long rem; } ldiv_t;
|
||||
typedef struct {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
ldiv_t ldiv(long, long);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -24,16 +24,15 @@ char* strncpy(char* dest, const char* src, size_t);
|
|||
char* strchr(const char*, int c);
|
||||
char* strstr(const char* haystack, const char* needle);
|
||||
char* strrchr(const char*, int c);
|
||||
char* strcat(char *dest, const char *src);
|
||||
char* strncat(char *dest, const char *src, size_t);
|
||||
char* strcat(char* dest, const char* src);
|
||||
char* strncat(char* dest, const char* src, size_t);
|
||||
size_t strspn(const char*, const char* accept);
|
||||
size_t strcspn(const char*, const char* reject);
|
||||
char* strerror(int errnum);
|
||||
char* strsignal(int signum);
|
||||
char* strpbrk(const char*, const char* accept);
|
||||
char *strtok(char* str, const char* delim);
|
||||
int strcoll(const char *s1, const char *s2);
|
||||
size_t strxfrm(char *dest, const char *src, size_t n);
|
||||
char* strtok(char* str, const char* delim);
|
||||
int strcoll(const char* s1, const char* s2);
|
||||
size_t strxfrm(char* dest, const char* src, size_t n);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#define ALWAYS_INLINE inline __attribute__((always_inline))
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
# define __BEGIN_DECLS
|
||||
# define __END_DECLS
|
||||
#endif
|
||||
|
||||
#undef __P
|
||||
|
@ -20,4 +20,3 @@
|
|||
#ifdef __cplusplus
|
||||
//extern "C" int main(int, char**);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
enum IOCtlNumber {
|
||||
enum IOCtlNumber
|
||||
{
|
||||
TIOCGPGRP,
|
||||
TIOCSPGRP,
|
||||
TCGETS,
|
||||
|
@ -12,4 +13,3 @@ enum IOCtlNumber {
|
|||
TIOCNOTTY,
|
||||
TIOCSWINSZ,
|
||||
};
|
||||
|
||||
|
|
|
@ -27,6 +27,6 @@ struct rusage {
|
|||
#define RUSAGE_SELF 1
|
||||
#define RUSAGE_CHILDREN 2
|
||||
|
||||
int getrusage(int who, struct rusage *usage);
|
||||
int getrusage(int who, struct rusage* usage);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <fd_set.h>
|
||||
#include <string.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <fd_set.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@ -68,4 +68,3 @@ int getsockname(int sockfd, struct sockaddr*, socklen_t*);
|
|||
int getpeername(int sockfd, struct sockaddr*, socklen_t*);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR)
|
||||
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK)
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
|
||||
#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO)
|
||||
#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK)
|
||||
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK)
|
||||
|
||||
mode_t umask(mode_t);
|
||||
int chmod(const char* pathname, mode_t);
|
||||
|
|
|
@ -15,6 +15,6 @@ struct timezone {
|
|||
int tz_dsttime;
|
||||
};
|
||||
|
||||
int gettimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
|
||||
int gettimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -38,19 +38,19 @@ typedef uint32_t clock_t;
|
|||
typedef __socklen_t socklen_t;
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev; /* ID of device containing file */
|
||||
ino_t st_ino; /* inode number */
|
||||
mode_t st_mode; /* protection */
|
||||
nlink_t st_nlink; /* number of hard links */
|
||||
uid_t st_uid; /* user ID of owner */
|
||||
gid_t st_gid; /* group ID of owner */
|
||||
dev_t st_rdev; /* device ID (if special file) */
|
||||
off_t st_size; /* total size, in bytes */
|
||||
dev_t st_dev; /* ID of device containing file */
|
||||
ino_t st_ino; /* inode number */
|
||||
mode_t st_mode; /* protection */
|
||||
nlink_t st_nlink; /* number of hard links */
|
||||
uid_t st_uid; /* user ID of owner */
|
||||
gid_t st_gid; /* group ID of owner */
|
||||
dev_t st_rdev; /* device ID (if special file) */
|
||||
off_t st_size; /* total size, in bytes */
|
||||
blksize_t st_blksize; /* blocksize for file system I/O */
|
||||
blkcnt_t st_blocks; /* number of 512B blocks allocated */
|
||||
time_t st_atime; /* time of last access */
|
||||
time_t st_mtime; /* time of last modification */
|
||||
time_t st_ctime; /* time of last status change */
|
||||
blkcnt_t st_blocks; /* number of 512B blocks allocated */
|
||||
time_t st_atime; /* time of last access */
|
||||
time_t st_mtime; /* time of last modification */
|
||||
time_t st_ctime; /* time of last status change */
|
||||
};
|
||||
|
||||
struct utimbuf {
|
||||
|
@ -59,4 +59,3 @@ struct utimbuf {
|
|||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -17,4 +17,3 @@ struct utsname {
|
|||
int uname(struct utsname*);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -16,4 +16,3 @@ char* tgoto(const char* cap, int col, int row);
|
|||
int tputs(const char* str, int affcnt, int (*putc)(int));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
249
LibC/termios.h
249
LibC/termios.h
|
@ -16,9 +16,9 @@ struct termios {
|
|||
tcflag_t c_oflag;
|
||||
tcflag_t c_cflag;
|
||||
tcflag_t c_lflag;
|
||||
cc_t c_cc[NCCS];
|
||||
speed_t c_ispeed;
|
||||
speed_t c_ospeed;
|
||||
cc_t c_cc[NCCS];
|
||||
speed_t c_ispeed;
|
||||
speed_t c_ospeed;
|
||||
};
|
||||
|
||||
int tcgetattr(int fd, struct termios*);
|
||||
|
@ -46,160 +46,159 @@ int tcflush(int fd, int queue_selector);
|
|||
#define VEOL2 16
|
||||
|
||||
/* c_iflag bits */
|
||||
#define IGNBRK 0000001
|
||||
#define BRKINT 0000002
|
||||
#define IGNPAR 0000004
|
||||
#define PARMRK 0000010
|
||||
#define INPCK 0000020
|
||||
#define ISTRIP 0000040
|
||||
#define INLCR 0000100
|
||||
#define IGNCR 0000200
|
||||
#define ICRNL 0000400
|
||||
#define IUCLC 0001000
|
||||
#define IXON 0002000
|
||||
#define IXANY 0004000
|
||||
#define IXOFF 0010000
|
||||
#define IMAXBEL 0020000
|
||||
#define IUTF8 0040000
|
||||
#define IGNBRK 0000001
|
||||
#define BRKINT 0000002
|
||||
#define IGNPAR 0000004
|
||||
#define PARMRK 0000010
|
||||
#define INPCK 0000020
|
||||
#define ISTRIP 0000040
|
||||
#define INLCR 0000100
|
||||
#define IGNCR 0000200
|
||||
#define ICRNL 0000400
|
||||
#define IUCLC 0001000
|
||||
#define IXON 0002000
|
||||
#define IXANY 0004000
|
||||
#define IXOFF 0010000
|
||||
#define IMAXBEL 0020000
|
||||
#define IUTF8 0040000
|
||||
|
||||
/* c_oflag bits */
|
||||
#define OPOST 0000001
|
||||
#define OLCUC 0000002
|
||||
#define ONLCR 0000004
|
||||
#define OCRNL 0000010
|
||||
#define ONOCR 0000020
|
||||
#define ONLRET 0000040
|
||||
#define OFILL 0000100
|
||||
#define OFDEL 0000200
|
||||
#define OPOST 0000001
|
||||
#define OLCUC 0000002
|
||||
#define ONLCR 0000004
|
||||
#define OCRNL 0000010
|
||||
#define ONOCR 0000020
|
||||
#define ONLRET 0000040
|
||||
#define OFILL 0000100
|
||||
#define OFDEL 0000200
|
||||
#if defined __USE_MISC || defined __USE_XOPEN
|
||||
# define NLDLY 0000400
|
||||
# define NL0 0000000
|
||||
# define NL1 0000400
|
||||
# define CRDLY 0003000
|
||||
# define CR0 0000000
|
||||
# define CR1 0001000
|
||||
# define CR2 0002000
|
||||
# define CR3 0003000
|
||||
# define TABDLY 0014000
|
||||
# define TAB0 0000000
|
||||
# define TAB1 0004000
|
||||
# define TAB2 0010000
|
||||
# define TAB3 0014000
|
||||
# define BSDLY 0020000
|
||||
# define BS0 0000000
|
||||
# define BS1 0020000
|
||||
# define FFDLY 0100000
|
||||
# define FF0 0000000
|
||||
# define FF1 0100000
|
||||
# define NLDLY 0000400
|
||||
# define NL0 0000000
|
||||
# define NL1 0000400
|
||||
# define CRDLY 0003000
|
||||
# define CR0 0000000
|
||||
# define CR1 0001000
|
||||
# define CR2 0002000
|
||||
# define CR3 0003000
|
||||
# define TABDLY 0014000
|
||||
# define TAB0 0000000
|
||||
# define TAB1 0004000
|
||||
# define TAB2 0010000
|
||||
# define TAB3 0014000
|
||||
# define BSDLY 0020000
|
||||
# define BS0 0000000
|
||||
# define BS1 0020000
|
||||
# define FFDLY 0100000
|
||||
# define FF0 0000000
|
||||
# define FF1 0100000
|
||||
#endif
|
||||
|
||||
#define VTDLY 0040000
|
||||
#define VT0 0000000
|
||||
#define VT1 0040000
|
||||
#define VTDLY 0040000
|
||||
#define VT0 0000000
|
||||
#define VT1 0040000
|
||||
|
||||
#ifdef __USE_MISC
|
||||
# define XTABS 0014000
|
||||
# define XTABS 0014000
|
||||
#endif
|
||||
|
||||
/* c_cflag bit meaning */
|
||||
#ifdef __USE_MISC
|
||||
# define CBAUD 0010017
|
||||
# define CBAUD 0010017
|
||||
#endif
|
||||
#define B0 0000000 /* hang up */
|
||||
#define B50 0000001
|
||||
#define B75 0000002
|
||||
#define B110 0000003
|
||||
#define B134 0000004
|
||||
#define B150 0000005
|
||||
#define B200 0000006
|
||||
#define B300 0000007
|
||||
#define B600 0000010
|
||||
#define B1200 0000011
|
||||
#define B1800 0000012
|
||||
#define B2400 0000013
|
||||
#define B4800 0000014
|
||||
#define B9600 0000015
|
||||
#define B19200 0000016
|
||||
#define B38400 0000017
|
||||
#define B0 0000000 /* hang up */
|
||||
#define B50 0000001
|
||||
#define B75 0000002
|
||||
#define B110 0000003
|
||||
#define B134 0000004
|
||||
#define B150 0000005
|
||||
#define B200 0000006
|
||||
#define B300 0000007
|
||||
#define B600 0000010
|
||||
#define B1200 0000011
|
||||
#define B1800 0000012
|
||||
#define B2400 0000013
|
||||
#define B4800 0000014
|
||||
#define B9600 0000015
|
||||
#define B19200 0000016
|
||||
#define B38400 0000017
|
||||
#ifdef __USE_MISC
|
||||
# define EXTA B19200
|
||||
# define EXTB B38400
|
||||
# define EXTA B19200
|
||||
# define EXTB B38400
|
||||
#endif
|
||||
#define CSIZE 0000060
|
||||
#define CS5 0000000
|
||||
#define CS6 0000020
|
||||
#define CS7 0000040
|
||||
#define CS8 0000060
|
||||
#define CSTOPB 0000100
|
||||
#define CREAD 0000200
|
||||
#define PARENB 0000400
|
||||
#define PARODD 0001000
|
||||
#define HUPCL 0002000
|
||||
#define CLOCAL 0004000
|
||||
#define CSIZE 0000060
|
||||
#define CS5 0000000
|
||||
#define CS6 0000020
|
||||
#define CS7 0000040
|
||||
#define CS8 0000060
|
||||
#define CSTOPB 0000100
|
||||
#define CREAD 0000200
|
||||
#define PARENB 0000400
|
||||
#define PARODD 0001000
|
||||
#define HUPCL 0002000
|
||||
#define CLOCAL 0004000
|
||||
#ifdef __USE_MISC
|
||||
# define CBAUDEX 0010000
|
||||
# define CBAUDEX 0010000
|
||||
#endif
|
||||
#define B57600 0010001
|
||||
#define B115200 0010002
|
||||
#define B230400 0010003
|
||||
#define B460800 0010004
|
||||
#define B500000 0010005
|
||||
#define B576000 0010006
|
||||
#define B921600 0010007
|
||||
#define B1000000 0010010
|
||||
#define B1152000 0010011
|
||||
#define B1500000 0010012
|
||||
#define B2000000 0010013
|
||||
#define B2500000 0010014
|
||||
#define B3000000 0010015
|
||||
#define B3500000 0010016
|
||||
#define B4000000 0010017
|
||||
#define B57600 0010001
|
||||
#define B115200 0010002
|
||||
#define B230400 0010003
|
||||
#define B460800 0010004
|
||||
#define B500000 0010005
|
||||
#define B576000 0010006
|
||||
#define B921600 0010007
|
||||
#define B1000000 0010010
|
||||
#define B1152000 0010011
|
||||
#define B1500000 0010012
|
||||
#define B2000000 0010013
|
||||
#define B2500000 0010014
|
||||
#define B3000000 0010015
|
||||
#define B3500000 0010016
|
||||
#define B4000000 0010017
|
||||
#define __MAX_BAUD B4000000
|
||||
#ifdef __USE_MISC
|
||||
# define CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
# define CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
# define CRTSCTS 020000000000 /* flow control */
|
||||
# define CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
# define CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
# define CRTSCTS 020000000000 /* flow control */
|
||||
#endif
|
||||
|
||||
/* c_lflag bits */
|
||||
#define ISIG 0000001
|
||||
#define ICANON 0000002
|
||||
#define ISIG 0000001
|
||||
#define ICANON 0000002
|
||||
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
|
||||
# define XCASE 0000004
|
||||
# define XCASE 0000004
|
||||
#endif
|
||||
#define ECHO 0000010
|
||||
#define ECHOE 0000020
|
||||
#define ECHOK 0000040
|
||||
#define ECHONL 0000100
|
||||
#define NOFLSH 0000200
|
||||
#define TOSTOP 0000400
|
||||
#define ECHO 0000010
|
||||
#define ECHOE 0000020
|
||||
#define ECHOK 0000040
|
||||
#define ECHONL 0000100
|
||||
#define NOFLSH 0000200
|
||||
#define TOSTOP 0000400
|
||||
#ifdef __USE_MISC
|
||||
# define ECHOCTL 0001000
|
||||
# define ECHOPRT 0002000
|
||||
# define ECHOKE 0004000
|
||||
# define FLUSHO 0010000
|
||||
# define PENDIN 0040000
|
||||
# define ECHOCTL 0001000
|
||||
# define ECHOPRT 0002000
|
||||
# define ECHOKE 0004000
|
||||
# define FLUSHO 0010000
|
||||
# define PENDIN 0040000
|
||||
#endif
|
||||
#define IEXTEN 0100000
|
||||
#define IEXTEN 0100000
|
||||
#ifdef __USE_MISC
|
||||
# define EXTPROC 0200000
|
||||
# define EXTPROC 0200000
|
||||
#endif
|
||||
|
||||
/* tcflow() and TCXONC use these */
|
||||
#define TCOOFF 0
|
||||
#define TCOON 1
|
||||
#define TCIOFF 2
|
||||
#define TCION 3
|
||||
#define TCOOFF 0
|
||||
#define TCOON 1
|
||||
#define TCIOFF 2
|
||||
#define TCION 3
|
||||
|
||||
/* tcflush() and TCFLSH use these */
|
||||
#define TCIFLUSH 0
|
||||
#define TCOFLUSH 1
|
||||
#define TCIOFLUSH 2
|
||||
#define TCIFLUSH 0
|
||||
#define TCOFLUSH 1
|
||||
#define TCIOFLUSH 2
|
||||
|
||||
/* tcsetattr uses these */
|
||||
#define TCSANOW 0
|
||||
#define TCSADRAIN 1
|
||||
#define TCSAFLUSH 2
|
||||
#define TCSANOW 0
|
||||
#define TCSADRAIN 1
|
||||
#define TCSAFLUSH 2
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
25
LibC/time.h
25
LibC/time.h
|
@ -6,15 +6,15 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
struct tm {
|
||||
int tm_sec; /* Seconds (0-60) */
|
||||
int tm_min; /* Minutes (0-59) */
|
||||
int tm_hour; /* Hours (0-23) */
|
||||
int tm_mday; /* Day of the month (1-31) */
|
||||
int tm_mon; /* Month (0-11) */
|
||||
int tm_year; /* Year - 1900 */
|
||||
int tm_wday; /* Day of the week (0-6, Sunday = 0) */
|
||||
int tm_yday; /* Day in the year (0-365, 1 Jan = 0) */
|
||||
int tm_isdst; /* Daylight saving time */
|
||||
int tm_sec; /* Seconds (0-60) */
|
||||
int tm_min; /* Minutes (0-59) */
|
||||
int tm_hour; /* Hours (0-23) */
|
||||
int tm_mday; /* Day of the month (1-31) */
|
||||
int tm_mon; /* Month (0-11) */
|
||||
int tm_year; /* Year - 1900 */
|
||||
int tm_wday; /* Day of the week (0-6, Sunday = 0) */
|
||||
int tm_yday; /* Day in the year (0-365, 1 Jan = 0) */
|
||||
int tm_isdst; /* Daylight saving time */
|
||||
};
|
||||
|
||||
extern long timezone;
|
||||
|
@ -26,12 +26,12 @@ typedef uint32_t clock_t;
|
|||
typedef uint32_t time_t;
|
||||
|
||||
struct tm* localtime(const time_t*);
|
||||
struct tm *gmtime(const time_t*);
|
||||
struct tm* gmtime(const time_t*);
|
||||
time_t mktime(struct tm*);
|
||||
time_t time(time_t*);
|
||||
char* ctime(const time_t*);
|
||||
void tzset();
|
||||
char *asctime(const struct tm*);
|
||||
char* asctime(const struct tm*);
|
||||
|
||||
#define CLOCKS_PER_SEC 1000
|
||||
clock_t clock();
|
||||
|
@ -39,7 +39,7 @@ clock_t clock();
|
|||
double difftime(time_t, time_t);
|
||||
size_t strftime(char* s, size_t max, const char* format, const struct tm*);
|
||||
|
||||
#define difftime(t1,t0) (double)(t1 - t0)
|
||||
#define difftime(t1, t0) (double)(t1 - t0)
|
||||
|
||||
// This is c++11+, but we have no macro for that now.
|
||||
struct timespec {
|
||||
|
@ -48,4 +48,3 @@ struct timespec {
|
|||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -7,4 +7,3 @@ __BEGIN_DECLS
|
|||
long ulimit(int cmd, long newlimit);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -19,7 +19,7 @@ void sysbeep();
|
|||
int systrace(pid_t);
|
||||
int gettid();
|
||||
int donate(int tid);
|
||||
int create_thread(int(*)(void*), void*);
|
||||
int create_thread(int (*)(void*), void*);
|
||||
void exit_thread(int);
|
||||
int create_shared_buffer(pid_t peer_pid, int, void** buffer);
|
||||
void* get_shared_buffer(int shared_buffer_id);
|
||||
|
@ -85,19 +85,20 @@ int access(const char* pathname, int mode);
|
|||
int isatty(int fd);
|
||||
int mknod(const char* pathname, mode_t, dev_t);
|
||||
long fpathconf(int fd, int name);
|
||||
long pathconf(const char *path, int name);
|
||||
long pathconf(const char* path, int name);
|
||||
char* getlogin();
|
||||
int chown(const char* pathname, uid_t, gid_t);
|
||||
int ftruncate(int fd, off_t length);
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
_PC_NAME_MAX,
|
||||
};
|
||||
|
||||
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
|
||||
#define WTERMSIG(status) ((status) & 0x7f)
|
||||
#define WEXITSTATUS(status) (((status)&0xff00) >> 8)
|
||||
#define WTERMSIG(status) ((status)&0x7f)
|
||||
#define WIFEXITED(status) (WTERMSIG(status) == 0)
|
||||
#define WIFSIGNALED(status) (((char) (((status) & 0x7f) + 1) >> 1) > 0)
|
||||
#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0)
|
||||
|
||||
#define HOST_NAME_MAX 64
|
||||
|
||||
|
@ -107,4 +108,3 @@ enum {
|
|||
#define F_OK 0
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -7,4 +7,3 @@ __BEGIN_DECLS
|
|||
int utime(const char* pathname, const struct utimbuf*);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
28
LibC/utmp.h
28
LibC/utmp.h
|
@ -4,9 +4,9 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct exit_status { /* Type for ut_exit, below */
|
||||
short int e_termination; /* Process termination status */
|
||||
short int e_exit; /* Process exit status */
|
||||
struct exit_status { /* Type for ut_exit, below */
|
||||
short int e_termination; /* Process termination status */
|
||||
short int e_exit; /* Process exit status */
|
||||
};
|
||||
|
||||
#define UT_NAMESIZE 32
|
||||
|
@ -14,27 +14,27 @@ struct exit_status { /* Type for ut_exit, below */
|
|||
#define UT_HOSTSIZE 256
|
||||
|
||||
struct utmp {
|
||||
short ut_type; /* Type of record */
|
||||
pid_t ut_pid; /* PID of login process */
|
||||
char ut_line[UT_LINESIZE]; /* Device name of tty - "/dev/" */
|
||||
char ut_id[4]; /* Terminal name suffix,
|
||||
short ut_type; /* Type of record */
|
||||
pid_t ut_pid; /* PID of login process */
|
||||
char ut_line[UT_LINESIZE]; /* Device name of tty - "/dev/" */
|
||||
char ut_id[4]; /* Terminal name suffix,
|
||||
or inittab(5) ID */
|
||||
char ut_user[UT_NAMESIZE]; /* Username */
|
||||
char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or
|
||||
char ut_user[UT_NAMESIZE]; /* Username */
|
||||
char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or
|
||||
kernel version for run-level
|
||||
messages */
|
||||
struct exit_status ut_exit; /* Exit status of a process
|
||||
struct exit_status ut_exit; /* Exit status of a process
|
||||
marked as DEAD_PROCESS; not
|
||||
used by Linux init (1 */
|
||||
|
||||
long ut_session; /* Session ID */
|
||||
struct timeval ut_tv; /* Time entry was made */
|
||||
long ut_session; /* Session ID */
|
||||
struct timeval ut_tv; /* Time entry was made */
|
||||
|
||||
int32_t ut_addr_v6[4]; /* Internet address of remote
|
||||
int32_t ut_addr_v6[4]; /* Internet address of remote
|
||||
host; IPv4 address uses
|
||||
just ut_addr_v6[0] */
|
||||
|
||||
char __unused[20]; /* Reserved for future use */
|
||||
char __unused[20]; /* Reserved for future use */
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#ifndef WEOF
|
||||
#define WEOF (0xffffffffu)
|
||||
# define WEOF (0xffffffffu)
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue