mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Clean up more code
- Found some bugs in LLVM compiler-rt library - The useless LIBC_STUBS package is now deleted - Improve the overflow checking story even further - Get chibicc tests working in MODE=dbg mode again - The libc/isystem/ headers now have correctly named guards
This commit is contained in:
parent
afc58a8b41
commit
d7c79f43ef
294 changed files with 912 additions and 1208 deletions
|
@ -40,6 +40,8 @@
|
|||
#define SIG_DFL ((void (*)(int))0)
|
||||
#define SIG_IGN ((void (*)(int))1)
|
||||
|
||||
#define CLOCKS_PER_SEC 1000000L
|
||||
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
#define WCOREDUMP(s) (128 & (s))
|
||||
|
@ -174,6 +176,8 @@ int usleep(unsigned);
|
|||
int vfork(void) returnstwice;
|
||||
int wait(int *);
|
||||
int waitpid(int, int *, int);
|
||||
int64_t clock(void);
|
||||
int64_t time(int64_t *);
|
||||
ssize_t copy_file_range(int, long *, int, long *, size_t, unsigned);
|
||||
ssize_t lseek(int, int64_t, int);
|
||||
ssize_t pread(int, void *, size_t, int64_t);
|
||||
|
@ -183,10 +187,12 @@ ssize_t readlink(const char *, char *, size_t);
|
|||
ssize_t readlinkat(int, const char *, char *, size_t);
|
||||
ssize_t splice(int, int64_t *, int, int64_t *, size_t, unsigned);
|
||||
ssize_t write(int, const void *, size_t);
|
||||
unsigned alarm(unsigned);
|
||||
unsigned getegid(void) nosideeffect;
|
||||
unsigned geteuid(void) nosideeffect;
|
||||
unsigned getgid(void) nosideeffect;
|
||||
unsigned getuid(void) libcesque;
|
||||
unsigned sleep(unsigned);
|
||||
unsigned umask(unsigned);
|
||||
void sync(void);
|
||||
|
||||
|
|
|
@ -45,13 +45,12 @@ LIBC_CALLS_A_DIRECTDEPS = \
|
|||
LIBC_NT_KERNEL32 \
|
||||
LIBC_NT_NTDLL \
|
||||
LIBC_NT_PDH \
|
||||
LIBC_NT_PSAPI \
|
||||
LIBC_NT_POWRPROF \
|
||||
LIBC_NT_PSAPI \
|
||||
LIBC_NT_WS2_32 \
|
||||
LIBC_STR \
|
||||
LIBC_STUBS \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
THIRD_PARTY_COMPILER_RT
|
||||
|
||||
LIBC_CALLS_A_DEPS := \
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
/**
|
||||
* Copies data between file descriptors the old fashioned way.
|
||||
|
@ -43,7 +44,7 @@ ssize_t copyfd(int in, int out, size_t n) {
|
|||
if (dw != dr) {
|
||||
// POSIX requires atomic IO up to PIPE_BUF
|
||||
// The minimum permissible PIPE_BUF is 512
|
||||
__builtin_trap();
|
||||
abort();
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "libc/thread/tls.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
// TODO(jart): DELETE
|
||||
|
||||
static clock_gettime_f *__gettime;
|
||||
|
||||
static struct Now {
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "libc/thread/tls.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
// TODO(jart): DELETE
|
||||
|
||||
static struct Now {
|
||||
bool once;
|
||||
uint64_t k0;
|
||||
|
|
|
@ -6,44 +6,44 @@
|
|||
* @fileoverview Types we'd prefer hadn't been invented.
|
||||
*/
|
||||
|
||||
#define blkcnt_t int64_t
|
||||
#define cc_t uint8_t
|
||||
#define clock_t int64_t /* uint64_t on xnu */
|
||||
#define dev_t uint64_t /* int32_t on xnu */
|
||||
#define fsblkcnt_t uint64_t
|
||||
#define fsfilcnt_t int64_t /* uint32_t on xnu */
|
||||
#define gid_t uint32_t
|
||||
#define id_t uint32_t /* int32_t on linux/freebsd/etc. */
|
||||
#define in_addr_t uint32_t
|
||||
#define in_addr_t uint32_t
|
||||
#define in_port_t uint16_t
|
||||
#define ino_t uint64_t
|
||||
#define key_t int32_t
|
||||
#define loff_t int64_t
|
||||
#define mode_t uint32_t /* uint16_t on xnu */
|
||||
#define nfds_t uint64_t
|
||||
#define off_t int64_t
|
||||
#define pid_t int32_t
|
||||
#define register_t int64_t
|
||||
#define sa_family_t uint16_t /* bsd:uint8_t */
|
||||
#define socklen_t uint32_t
|
||||
#define speed_t uint32_t
|
||||
#define suseconds_t int64_t /* int32_t on xnu */
|
||||
#define useconds_t uint64_t /* uint32_t on xnu */
|
||||
#define syscall_arg_t int64_t /* uint64_t on xnu */
|
||||
#define tcflag_t uint32_t
|
||||
#define time_t int64_t
|
||||
#define timer_t void*
|
||||
#define uid_t uint32_t
|
||||
#define rlim_t uint64_t /* int64_t on bsd */
|
||||
#define clockid_t int32_t
|
||||
typedef int64_t blkcnt_t;
|
||||
typedef uint8_t cc_t;
|
||||
typedef int64_t clock_t; /* uint64_t on xnu */
|
||||
typedef uint64_t dev_t; /* int32_t on xnu */
|
||||
typedef uint64_t fsblkcnt_t;
|
||||
typedef int64_t fsfilcnt_t; /* uint32_t on xnu */
|
||||
typedef uint32_t gid_t;
|
||||
typedef uint32_t id_t; /* int32_t on linux/freebsd/etc. */
|
||||
typedef uint32_t in_addr_t;
|
||||
typedef uint32_t in_addr_t;
|
||||
typedef uint16_t in_port_t;
|
||||
typedef uint64_t ino_t;
|
||||
typedef int32_t key_t;
|
||||
typedef int64_t loff_t;
|
||||
typedef uint32_t mode_t; /* uint16_t on xnu */
|
||||
typedef uint64_t nfds_t;
|
||||
typedef int64_t off_t;
|
||||
typedef int32_t pid_t;
|
||||
typedef int64_t register_t;
|
||||
typedef uint16_t sa_family_t; /* bsd:uint8_t */
|
||||
typedef uint32_t socklen_t;
|
||||
typedef uint32_t speed_t;
|
||||
typedef int64_t suseconds_t; /* int32_t on xnu */
|
||||
typedef uint64_t useconds_t; /* uint32_t on xnu */
|
||||
typedef int64_t syscall_arg_t; /* uint64_t on xnu */
|
||||
typedef uint32_t tcflag_t;
|
||||
typedef int64_t time_t;
|
||||
typedef void *timer_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uint64_t rlim_t; /* int64_t on bsd */
|
||||
typedef int32_t clockid_t;
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define blksize_t int64_t /* int32_t on xnu */
|
||||
#define nlink_t uint64_t
|
||||
typedef int64_t blksize_t; /* int32_t on xnu */
|
||||
typedef uint64_t nlink_t;
|
||||
#elif defined(__aarch64__)
|
||||
#define blksize_t int32_t
|
||||
#define nlink_t uint32_t /* uint16_t on xnu */
|
||||
typedef int32_t blksize_t;
|
||||
typedef uint32_t nlink_t; /* uint16_t on xnu */
|
||||
#endif
|
||||
|
||||
#define TIME_T_MAX __INT64_MAX__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue