mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Add dontthrow
attribute to most libc functions
This will help C++ code that uses exceptions to be tinier. For example, this change shaves away 1000 lines of assembly code from LLVM's libcxx, which is 0.7% of all assembly instructions in the entire library.
This commit is contained in:
parent
cb19e172da
commit
eeb20775d2
103 changed files with 1455 additions and 1456 deletions
|
@ -72,184 +72,184 @@ COSMOPOLITAN_C_START_
|
|||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
bool32 isatty(int);
|
||||
char *getcwd(char *, size_t);
|
||||
char *realpath(const char *, char *) __wur;
|
||||
char *ttyname(int);
|
||||
int access(const char *, int) dontthrow;
|
||||
int chdir(const char *);
|
||||
int chmod(const char *, unsigned);
|
||||
int chown(const char *, unsigned, unsigned);
|
||||
int chroot(const char *);
|
||||
int close(int);
|
||||
int close_range(unsigned, unsigned, unsigned);
|
||||
int closefrom(int);
|
||||
int creat(const char *, unsigned);
|
||||
int dup(int);
|
||||
int dup2(int, int);
|
||||
int dup3(int, int, int);
|
||||
int execl(const char *, const char *, ...) nullterminated();
|
||||
int execle(const char *, const char *, ...) nullterminated((1));
|
||||
int execlp(const char *, const char *, ...) nullterminated();
|
||||
int execv(const char *, char *const[]);
|
||||
int execve(const char *, char *const[], char *const[]);
|
||||
int execvp(const char *, char *const[]);
|
||||
int faccessat(int, const char *, int, int);
|
||||
int fchdir(int);
|
||||
int fchmod(int, unsigned) dontthrow;
|
||||
int fchmodat(int, const char *, unsigned, int);
|
||||
int fchown(int, unsigned, unsigned);
|
||||
int fchownat(int, const char *, unsigned, unsigned, int);
|
||||
int fcntl(int, int, ...);
|
||||
int fdatasync(int);
|
||||
int fexecve(int, char *const[], char *const[]);
|
||||
int flock(int, int);
|
||||
int fork(void);
|
||||
int fsync(int);
|
||||
int ftruncate(int, int64_t);
|
||||
int getdomainname(char *, size_t);
|
||||
int getgroups(int, unsigned[]);
|
||||
int gethostname(char *, size_t);
|
||||
int getloadavg(double *, int);
|
||||
bool32 isatty(int) libcesque;
|
||||
char *getcwd(char *, size_t) dontthrow;
|
||||
char *realpath(const char *, char *) libcesque __wur;
|
||||
char *ttyname(int) libcesque;
|
||||
int access(const char *, int) libcesque;
|
||||
int chdir(const char *) libcesque;
|
||||
int chmod(const char *, unsigned) libcesque;
|
||||
int chown(const char *, unsigned, unsigned) libcesque;
|
||||
int chroot(const char *) libcesque;
|
||||
int close(int) libcesque;
|
||||
int close_range(unsigned, unsigned, unsigned) libcesque;
|
||||
int closefrom(int) libcesque;
|
||||
int creat(const char *, unsigned) libcesque;
|
||||
int dup(int) libcesque;
|
||||
int dup2(int, int) libcesque;
|
||||
int dup3(int, int, int) libcesque;
|
||||
int execl(const char *, const char *, ...) nullterminated() libcesque;
|
||||
int execle(const char *, const char *, ...) nullterminated((1)) libcesque;
|
||||
int execlp(const char *, const char *, ...) nullterminated() libcesque;
|
||||
int execv(const char *, char *const[]) libcesque;
|
||||
int execve(const char *, char *const[], char *const[]) libcesque;
|
||||
int execvp(const char *, char *const[]) libcesque;
|
||||
int faccessat(int, const char *, int, int) libcesque;
|
||||
int fchdir(int) libcesque;
|
||||
int fchmod(int, unsigned) libcesque;
|
||||
int fchmodat(int, const char *, unsigned, int) libcesque;
|
||||
int fchown(int, unsigned, unsigned) libcesque;
|
||||
int fchownat(int, const char *, unsigned, unsigned, int) libcesque;
|
||||
int fcntl(int, int, ...) libcesque;
|
||||
int fdatasync(int) libcesque;
|
||||
int fexecve(int, char *const[], char *const[]) libcesque;
|
||||
int flock(int, int) libcesque;
|
||||
int fork(void) libcesque;
|
||||
int fsync(int) libcesque;
|
||||
int ftruncate(int, int64_t) libcesque;
|
||||
int getdomainname(char *, size_t) libcesque;
|
||||
int getgroups(int, unsigned[]) libcesque;
|
||||
int gethostname(char *, size_t) libcesque;
|
||||
int getloadavg(double *, int) libcesque;
|
||||
int getpgid(int) libcesque;
|
||||
int getpgrp(void) nosideeffect;
|
||||
int getpid(void) nosideeffect libcesque;
|
||||
int getppid(void);
|
||||
int getpriority(int, unsigned);
|
||||
int getpgrp(void) libcesque nosideeffect;
|
||||
int getpid(void) libcesque nosideeffect;
|
||||
int getppid(void) libcesque;
|
||||
int getpriority(int, unsigned) libcesque;
|
||||
int getsid(int) nosideeffect libcesque;
|
||||
int ioctl(int, unsigned long, ...);
|
||||
int issetugid(void);
|
||||
int kill(int, int);
|
||||
int killpg(int, int);
|
||||
int lchmod(const char *, unsigned);
|
||||
int lchown(const char *, unsigned, unsigned);
|
||||
int link(const char *, const char *) dontthrow;
|
||||
int linkat(int, const char *, int, const char *, int);
|
||||
int mincore(void *, size_t, unsigned char *);
|
||||
int mkdir(const char *, unsigned);
|
||||
int mkdirat(int, const char *, unsigned);
|
||||
int mknod(const char *, unsigned, uint64_t);
|
||||
int nice(int);
|
||||
int open(const char *, int, ...);
|
||||
int openat(int, const char *, int, ...);
|
||||
int pause(void);
|
||||
int pipe(int[hasatleast 2]);
|
||||
int pipe2(int[hasatleast 2], int);
|
||||
int posix_fadvise(int, int64_t, int64_t, int);
|
||||
int posix_madvise(void *, uint64_t, int);
|
||||
int raise(int);
|
||||
int reboot(int);
|
||||
int remove(const char *);
|
||||
int rename(const char *, const char *);
|
||||
int renameat(int, const char *, int, const char *);
|
||||
int rmdir(const char *);
|
||||
int sched_yield(void);
|
||||
int setegid(unsigned);
|
||||
int seteuid(unsigned);
|
||||
int setfsgid(unsigned);
|
||||
int setfsuid(unsigned);
|
||||
int setgid(unsigned);
|
||||
int setgroups(size_t, const unsigned[]);
|
||||
int setpgid(int, int);
|
||||
int setpgrp(void);
|
||||
int setpriority(int, unsigned, int);
|
||||
int setregid(unsigned, unsigned);
|
||||
int setreuid(unsigned, unsigned);
|
||||
int setsid(void);
|
||||
int setuid(unsigned);
|
||||
int shm_open(const char *, int, unsigned);
|
||||
int shm_unlink(const char *);
|
||||
int sigignore(int);
|
||||
int siginterrupt(int, int);
|
||||
int symlink(const char *, const char *);
|
||||
int symlinkat(const char *, int, const char *);
|
||||
int tcgetpgrp(int);
|
||||
int tcsetpgrp(int, int);
|
||||
int truncate(const char *, int64_t);
|
||||
int ttyname_r(int, char *, size_t);
|
||||
int unlink(const char *);
|
||||
int unlinkat(int, const char *, int);
|
||||
int usleep(uint64_t);
|
||||
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);
|
||||
ssize_t pwrite(int, const void *, size_t, int64_t);
|
||||
ssize_t read(int, void *, size_t);
|
||||
ssize_t readlink(const char *, char *, size_t);
|
||||
ssize_t readlinkat(int, const char *, char *, size_t);
|
||||
ssize_t write(int, const void *, size_t);
|
||||
unsigned alarm(unsigned);
|
||||
unsigned getegid(void) nosideeffect;
|
||||
unsigned geteuid(void) nosideeffect;
|
||||
unsigned getgid(void) nosideeffect;
|
||||
int ioctl(int, unsigned long, ...) libcesque;
|
||||
int issetugid(void) libcesque;
|
||||
int kill(int, int) libcesque;
|
||||
int killpg(int, int) libcesque;
|
||||
int lchmod(const char *, unsigned) libcesque;
|
||||
int lchown(const char *, unsigned, unsigned) libcesque;
|
||||
int link(const char *, const char *) libcesque;
|
||||
int linkat(int, const char *, int, const char *, int) libcesque;
|
||||
int mincore(void *, size_t, unsigned char *) libcesque;
|
||||
int mkdir(const char *, unsigned) libcesque;
|
||||
int mkdirat(int, const char *, unsigned) libcesque;
|
||||
int mknod(const char *, unsigned, uint64_t) libcesque;
|
||||
int nice(int) libcesque;
|
||||
int open(const char *, int, ...) libcesque;
|
||||
int openat(int, const char *, int, ...) libcesque;
|
||||
int pause(void) libcesque;
|
||||
int pipe(int[hasatleast 2]) libcesque;
|
||||
int pipe2(int[hasatleast 2], int) libcesque;
|
||||
int posix_fadvise(int, int64_t, int64_t, int) libcesque;
|
||||
int posix_madvise(void *, uint64_t, int) libcesque;
|
||||
int raise(int) libcesque;
|
||||
int reboot(int) libcesque;
|
||||
int remove(const char *) libcesque;
|
||||
int rename(const char *, const char *) libcesque;
|
||||
int renameat(int, const char *, int, const char *) libcesque;
|
||||
int rmdir(const char *) libcesque;
|
||||
int sched_yield(void) libcesque;
|
||||
int setegid(unsigned) libcesque;
|
||||
int seteuid(unsigned) libcesque;
|
||||
int setfsgid(unsigned) libcesque;
|
||||
int setfsuid(unsigned) libcesque;
|
||||
int setgid(unsigned) libcesque;
|
||||
int setgroups(size_t, const unsigned[]) libcesque;
|
||||
int setpgid(int, int) libcesque;
|
||||
int setpgrp(void) libcesque;
|
||||
int setpriority(int, unsigned, int) libcesque;
|
||||
int setregid(unsigned, unsigned) libcesque;
|
||||
int setreuid(unsigned, unsigned) libcesque;
|
||||
int setsid(void) libcesque;
|
||||
int setuid(unsigned) libcesque;
|
||||
int shm_open(const char *, int, unsigned) libcesque;
|
||||
int shm_unlink(const char *) libcesque;
|
||||
int sigignore(int) libcesque;
|
||||
int siginterrupt(int, int) libcesque;
|
||||
int symlink(const char *, const char *) libcesque;
|
||||
int symlinkat(const char *, int, const char *) libcesque;
|
||||
int tcgetpgrp(int) libcesque;
|
||||
int tcsetpgrp(int, int) libcesque;
|
||||
int truncate(const char *, int64_t) libcesque;
|
||||
int ttyname_r(int, char *, size_t) libcesque;
|
||||
int unlink(const char *) libcesque;
|
||||
int unlinkat(int, const char *, int) libcesque;
|
||||
int usleep(uint64_t) libcesque;
|
||||
int vfork(void) libcesque returnstwice;
|
||||
int wait(int *) libcesque;
|
||||
int waitpid(int, int *, int) libcesque;
|
||||
int64_t clock(void) libcesque;
|
||||
int64_t time(int64_t *) libcesque;
|
||||
ssize_t copy_file_range(int, long *, int, long *, size_t, unsigned) libcesque;
|
||||
ssize_t lseek(int, int64_t, int) libcesque;
|
||||
ssize_t pread(int, void *, size_t, int64_t) libcesque;
|
||||
ssize_t pwrite(int, const void *, size_t, int64_t) libcesque;
|
||||
ssize_t read(int, void *, size_t) libcesque;
|
||||
ssize_t readlink(const char *, char *, size_t) libcesque;
|
||||
ssize_t readlinkat(int, const char *, char *, size_t) libcesque;
|
||||
ssize_t write(int, const void *, size_t) libcesque;
|
||||
unsigned alarm(unsigned) libcesque;
|
||||
unsigned getegid(void) libcesque nosideeffect;
|
||||
unsigned geteuid(void) libcesque nosideeffect;
|
||||
unsigned getgid(void) libcesque nosideeffect;
|
||||
unsigned getuid(void) libcesque;
|
||||
unsigned sleep(unsigned);
|
||||
unsigned ualarm(unsigned, unsigned);
|
||||
unsigned umask(unsigned);
|
||||
void sync(void);
|
||||
unsigned sleep(unsigned) libcesque;
|
||||
unsigned ualarm(unsigned, unsigned) libcesque;
|
||||
unsigned umask(unsigned) libcesque;
|
||||
void sync(void) libcesque;
|
||||
|
||||
#if defined(_COSMO_SOURCE) || defined(_GNU_SOURCE)
|
||||
int syncfs(int);
|
||||
int prctl(int, ...);
|
||||
int syncfs(int) libcesque;
|
||||
int prctl(int, ...) libcesque;
|
||||
int gettid(void) libcesque;
|
||||
int setresgid(unsigned, unsigned, unsigned);
|
||||
int setresuid(unsigned, unsigned, unsigned);
|
||||
int getresgid(unsigned *, unsigned *, unsigned *);
|
||||
int getresuid(unsigned *, unsigned *, unsigned *);
|
||||
char *get_current_dir_name(void) __wur;
|
||||
ssize_t splice(int, int64_t *, int, int64_t *, size_t, unsigned);
|
||||
int memfd_create(const char *, unsigned int);
|
||||
int execvpe(const char *, char *const[], char *const[]);
|
||||
int euidaccess(const char *, int);
|
||||
int eaccess(const char *, int);
|
||||
int madvise(void *, uint64_t, int);
|
||||
int setresgid(unsigned, unsigned, unsigned) libcesque;
|
||||
int setresuid(unsigned, unsigned, unsigned) libcesque;
|
||||
int getresgid(unsigned *, unsigned *, unsigned *) libcesque;
|
||||
int getresuid(unsigned *, unsigned *, unsigned *) libcesque;
|
||||
char *get_current_dir_name(void) libcesque __wur;
|
||||
ssize_t splice(int, int64_t *, int, int64_t *, size_t, unsigned) libcesque;
|
||||
int memfd_create(const char *, unsigned int) libcesque;
|
||||
int execvpe(const char *, char *const[], char *const[]) libcesque;
|
||||
int euidaccess(const char *, int) libcesque;
|
||||
int eaccess(const char *, int) libcesque;
|
||||
int madvise(void *, uint64_t, int) libcesque;
|
||||
#endif
|
||||
|
||||
#ifdef _COSMO_SOURCE
|
||||
bool32 fdexists(int);
|
||||
bool32 fileexists(const char *);
|
||||
bool32 ischardev(int);
|
||||
bool32 isdirectory(const char *);
|
||||
bool32 isexecutable(const char *);
|
||||
bool32 isregularfile(const char *);
|
||||
bool32 issymlink(const char *);
|
||||
char *commandv(const char *, char *, size_t);
|
||||
int __getcwd(char *, size_t);
|
||||
bool32 fdexists(int) libcesque;
|
||||
bool32 fileexists(const char *) libcesque;
|
||||
bool32 ischardev(int) libcesque;
|
||||
bool32 isdirectory(const char *) libcesque;
|
||||
bool32 isexecutable(const char *) libcesque;
|
||||
bool32 isregularfile(const char *) libcesque;
|
||||
bool32 issymlink(const char *) libcesque;
|
||||
char *commandv(const char *, char *, size_t) libcesque;
|
||||
int __getcwd(char *, size_t) libcesque;
|
||||
int clone(void *, void *, size_t, int, void *, void *, void *, void *);
|
||||
int fadvise(int, uint64_t, uint64_t, int);
|
||||
int makedirs(const char *, unsigned);
|
||||
int pivot_root(const char *, const char *);
|
||||
int pledge(const char *, const char *);
|
||||
int seccomp(unsigned, unsigned, void *);
|
||||
int sys_iopl(int);
|
||||
int sys_ioprio_get(int, int);
|
||||
int sys_ioprio_set(int, int, int);
|
||||
int sys_mlock(const void *, size_t);
|
||||
int sys_mlock2(const void *, size_t, int);
|
||||
int sys_mlockall(int);
|
||||
int sys_munlock(const void *, size_t);
|
||||
int sys_munlockall(void);
|
||||
int sys_personality(uint64_t);
|
||||
int sys_ptrace(int, ...);
|
||||
int fadvise(int, uint64_t, uint64_t, int) libcesque;
|
||||
int makedirs(const char *, unsigned) libcesque;
|
||||
int pivot_root(const char *, const char *) libcesque;
|
||||
int pledge(const char *, const char *) libcesque;
|
||||
int seccomp(unsigned, unsigned, void *) libcesque;
|
||||
int sys_iopl(int) libcesque;
|
||||
int sys_ioprio_get(int, int) libcesque;
|
||||
int sys_ioprio_set(int, int, int) libcesque;
|
||||
int sys_mlock(const void *, size_t) libcesque;
|
||||
int sys_mlock2(const void *, size_t, int) libcesque;
|
||||
int sys_mlockall(int) libcesque;
|
||||
int sys_munlock(const void *, size_t) libcesque;
|
||||
int sys_munlockall(void) libcesque;
|
||||
int sys_personality(uint64_t) libcesque;
|
||||
int sys_ptrace(int, ...) libcesque;
|
||||
int sys_sysctl(const int *, unsigned, void *, size_t *, void *, size_t);
|
||||
int tmpfd(void);
|
||||
int touch(const char *, unsigned);
|
||||
int unveil(const char *, const char *);
|
||||
long ptrace(int, ...);
|
||||
ssize_t copyfd(int, int, size_t);
|
||||
ssize_t readansi(int, char *, size_t);
|
||||
ssize_t tinyprint(int, const char *, ...) nullterminated();
|
||||
void shm_path_np(const char *, char[hasatleast 78]);
|
||||
int tmpfd(void) libcesque;
|
||||
int touch(const char *, unsigned) libcesque;
|
||||
int unveil(const char *, const char *) libcesque;
|
||||
long ptrace(int, ...) libcesque;
|
||||
ssize_t copyfd(int, int, size_t) libcesque;
|
||||
ssize_t readansi(int, char *, size_t) libcesque;
|
||||
ssize_t tinyprint(int, const char *, ...) libcesque nullterminated();
|
||||
void shm_path_np(const char *, char[hasatleast 78]) libcesque;
|
||||
#endif /* _COSMO_SOURCE */
|
||||
|
||||
int __wifstopped(int) pureconst;
|
||||
int __wifcontinued(int) pureconst;
|
||||
int __wifsignaled(int) pureconst;
|
||||
int __wifstopped(int) libcesque pureconst;
|
||||
int __wifcontinued(int) libcesque pureconst;
|
||||
int __wifsignaled(int) libcesque pureconst;
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define lseek64 lseek
|
||||
|
|
|
@ -66,4 +66,4 @@ int fadvise(int fd, uint64_t offset, uint64_t len, int advice) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(fadvise, fadvise64);
|
||||
__weak_reference(fadvise, fadvise64);
|
||||
|
|
|
@ -60,4 +60,4 @@ int fstat(int fd, struct stat *st) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(fstat, fstat64);
|
||||
__weak_reference(fstat, fstat64);
|
||||
|
|
|
@ -102,4 +102,4 @@ int fstatat(int dirfd, const char *path, struct stat *st, int flags) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(fstatat, fstatat64);
|
||||
__weak_reference(fstatat, fstatat64);
|
||||
|
|
|
@ -87,4 +87,4 @@ int ftruncate(int fd, int64_t length) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(ftruncate, ftruncate64);
|
||||
__weak_reference(ftruncate, ftruncate64);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int ftok(const char *, int);
|
||||
int ftok(const char *, int) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_IPC_H_ */
|
||||
|
|
|
@ -93,4 +93,4 @@ int64_t lseek(int fd, int64_t offset, int whence) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(lseek, lseek64);
|
||||
__weak_reference(lseek, lseek64);
|
||||
|
|
|
@ -27,4 +27,4 @@ int lstat(const char *pathname, struct stat *st) {
|
|||
return fstatat(AT_FDCWD, pathname, st, AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
||||
__strong_reference(lstat, lstat64);
|
||||
__weak_reference(lstat, lstat64);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_CALLS_MAKEDEV_H_
|
||||
#define COSMOPOLITAN_LIBC_CALLS_MAKEDEV_H_
|
||||
|
||||
uint64_t makedev(uint32_t, uint32_t);
|
||||
uint32_t major(uint64_t);
|
||||
uint32_t minor(uint64_t);
|
||||
uint64_t makedev(uint32_t, uint32_t) libcesque;
|
||||
uint32_t major(uint64_t) libcesque;
|
||||
uint32_t minor(uint64_t) libcesque;
|
||||
|
||||
#define major(x) major(x)
|
||||
#define minor(x) minor(x)
|
||||
|
|
|
@ -40,4 +40,4 @@ int mkostemp(char *template, unsigned flags) {
|
|||
return openatemp(AT_FDCWD, template, 0, flags, 0);
|
||||
}
|
||||
|
||||
__strong_reference(mkostemp, mkostemp64);
|
||||
__weak_reference(mkostemp, mkostemp64);
|
||||
|
|
|
@ -41,4 +41,4 @@ int mkostemps(char *template, int suffixlen, unsigned flags) {
|
|||
return openatemp(AT_FDCWD, template, suffixlen, flags, 0);
|
||||
}
|
||||
|
||||
__strong_reference(mkostemps, mkostemps64);
|
||||
__weak_reference(mkostemps, mkostemps64);
|
||||
|
|
|
@ -40,4 +40,4 @@ int mkstemp(char *template) {
|
|||
return openatemp(AT_FDCWD, template, 0, 0, 0);
|
||||
}
|
||||
|
||||
__strong_reference(mkstemp, mkstemp64);
|
||||
__weak_reference(mkstemp, mkstemp64);
|
||||
|
|
|
@ -42,4 +42,4 @@ int mkstemps(char *template, int suffixlen) {
|
|||
return openatemp(AT_FDCWD, template, suffixlen, 0, 0);
|
||||
}
|
||||
|
||||
__strong_reference(mkstemps, mkstemps64);
|
||||
__weak_reference(mkstemps, mkstemps64);
|
||||
|
|
|
@ -43,4 +43,4 @@ int open(const char *file, int flags, ...) {
|
|||
return openat(AT_FDCWD, file, flags, mode);
|
||||
}
|
||||
|
||||
__strong_reference(open, open64);
|
||||
__weak_reference(open, open64);
|
||||
|
|
|
@ -241,4 +241,4 @@ int openat(int dirfd, const char *path, int flags, ...) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(openat, openat64);
|
||||
__weak_reference(openat, openat64);
|
||||
|
|
|
@ -85,4 +85,4 @@ ssize_t pread(int fd, void *buf, size_t size, int64_t offset) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(pread, pread64);
|
||||
__weak_reference(pread, pread64);
|
||||
|
|
|
@ -85,4 +85,4 @@ ssize_t pwrite(int fd, const void *buf, size_t size, int64_t offset) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
__strong_reference(pwrite, pwrite64);
|
||||
__weak_reference(pwrite, pwrite64);
|
||||
|
|
|
@ -34,4 +34,4 @@ int stat(const char *path, struct stat *st) {
|
|||
return fstatat(AT_FDCWD, path, st, 0);
|
||||
}
|
||||
|
||||
__strong_reference(stat, stat64);
|
||||
__weak_reference(stat, stat64);
|
||||
|
|
|
@ -36,4 +36,4 @@ int statvfs(const char *path, struct statvfs *sv) {
|
|||
}
|
||||
}
|
||||
|
||||
__strong_reference(statvfs, statvfs64);
|
||||
__weak_reference(statvfs, statvfs64);
|
||||
|
|
|
@ -9,33 +9,33 @@ typedef struct cpu_set_t {
|
|||
uint64_t __bits[16];
|
||||
} cpu_set_t;
|
||||
|
||||
int sched_getcpu(void);
|
||||
int sched_getaffinity(int, size_t, cpu_set_t *);
|
||||
int sched_setaffinity(int, size_t, const cpu_set_t *);
|
||||
int sched_getcpu(void) libcesque;
|
||||
int sched_getaffinity(int, size_t, cpu_set_t *) libcesque;
|
||||
int sched_setaffinity(int, size_t, const cpu_set_t *) libcesque;
|
||||
|
||||
#define CPU_SET(i, s) ((s)->__bits[(i) / 64] |= 1ull << ((i) % 64))
|
||||
#define CPU_CLR(i, s) ((s)->__bits[(i) / 64] &= ~(1ull << ((i) % 64)))
|
||||
#define CPU_ISSET(i, s) (!!((s)->__bits[(i) / 64] & (1ull << ((i) % 64))))
|
||||
|
||||
void CPU_ZERO(cpu_set_t *);
|
||||
void CPU_ZERO(cpu_set_t *) libcesque;
|
||||
#define CPU_ZERO(x) CPU_ZERO(x)
|
||||
|
||||
int CPU_COUNT(cpu_set_t *);
|
||||
int CPU_COUNT(cpu_set_t *) libcesque;
|
||||
#define CPU_COUNT(x) CPU_COUNT(x)
|
||||
|
||||
int CPU_EQUAL(cpu_set_t *, cpu_set_t *);
|
||||
int CPU_EQUAL(cpu_set_t *, cpu_set_t *) libcesque;
|
||||
#define CPU_EQUAL(x, y) CPU_EQUAL(x, y)
|
||||
|
||||
void CPU_AND(cpu_set_t *, cpu_set_t *, cpu_set_t *);
|
||||
void CPU_AND(cpu_set_t *, cpu_set_t *, cpu_set_t *) libcesque;
|
||||
#define CPU_AND(x, y, z) CPU_AND(x, y, z)
|
||||
|
||||
void CPU_OR(cpu_set_t *, cpu_set_t *, cpu_set_t *);
|
||||
void CPU_OR(cpu_set_t *, cpu_set_t *, cpu_set_t *) libcesque;
|
||||
#define CPU_OR(x, y, z) CPU_OR(x, y, z)
|
||||
|
||||
void CPU_XOR(cpu_set_t *, cpu_set_t *, cpu_set_t *);
|
||||
void CPU_XOR(cpu_set_t *, cpu_set_t *, cpu_set_t *) libcesque;
|
||||
#define CPU_XOR(x, y, z) CPU_XOR(x, y, z)
|
||||
|
||||
int CPU_COUNT_S(size_t, const cpu_set_t *);
|
||||
int CPU_COUNT_S(size_t, const cpu_set_t *) libcesque;
|
||||
#define CPU_COUNT_S(x, y) CPU_COUNT_S(x, y)
|
||||
|
||||
#define CPU_ALLOC_SIZE(n) \
|
||||
|
|
|
@ -13,19 +13,19 @@ struct dirent { /* linux getdents64 abi */
|
|||
struct dirstream;
|
||||
typedef struct dirstream DIR;
|
||||
|
||||
DIR *fdopendir(int) __wur;
|
||||
DIR *opendir(const char *) __wur;
|
||||
int closedir(DIR *);
|
||||
int dirfd(DIR *);
|
||||
long telldir(DIR *);
|
||||
struct dirent *readdir(DIR *);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **);
|
||||
void rewinddir(DIR *);
|
||||
void seekdir(DIR *, long);
|
||||
int alphasort(const struct dirent **, const struct dirent **);
|
||||
int versionsort(const struct dirent **, const struct dirent **);
|
||||
DIR *fdopendir(int) libcesque __wur;
|
||||
DIR *opendir(const char *) libcesque __wur;
|
||||
int closedir(DIR *) libcesque;
|
||||
int dirfd(DIR *) libcesque;
|
||||
long telldir(DIR *) libcesque;
|
||||
struct dirent *readdir(DIR *) libcesque;
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **) libcesque;
|
||||
void rewinddir(DIR *) libcesque;
|
||||
void seekdir(DIR *, long) libcesque;
|
||||
int alphasort(const struct dirent **, const struct dirent **) libcesque;
|
||||
int versionsort(const struct dirent **, const struct dirent **) libcesque;
|
||||
int scandir(const char *, struct dirent ***, int (*)(const struct dirent *),
|
||||
int (*)(const struct dirent **, const struct dirent **));
|
||||
int (*)(const struct dirent **, const struct dirent **)) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_DIRENT_H_ */
|
||||
|
|
|
@ -7,11 +7,11 @@ struct iovec {
|
|||
size_t iov_len;
|
||||
};
|
||||
|
||||
ssize_t preadv(int, struct iovec *, int, int64_t);
|
||||
ssize_t pwritev(int, const struct iovec *, int, int64_t);
|
||||
ssize_t readv(int, const struct iovec *, int);
|
||||
ssize_t vmsplice(int, const struct iovec *, int64_t, uint32_t);
|
||||
ssize_t writev(int, const struct iovec *, int);
|
||||
ssize_t preadv(int, struct iovec *, int, int64_t) libcesque;
|
||||
ssize_t pwritev(int, const struct iovec *, int, int64_t) libcesque;
|
||||
ssize_t readv(int, const struct iovec *, int) libcesque;
|
||||
ssize_t vmsplice(int, const struct iovec *, int64_t, uint32_t) libcesque;
|
||||
ssize_t writev(int, const struct iovec *, int) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_IOVEC_H_ */
|
||||
|
|
|
@ -7,8 +7,8 @@ struct rlimit {
|
|||
uint64_t rlim_max; /* maximum limit in bytes */
|
||||
};
|
||||
|
||||
int getrlimit(int, struct rlimit *);
|
||||
int setrlimit(int, const struct rlimit *);
|
||||
int getrlimit(int, struct rlimit *) libcesque;
|
||||
int setrlimit(int, const struct rlimit *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_RLIMIT_H_ */
|
||||
|
|
|
@ -22,10 +22,10 @@ struct rusage {
|
|||
int64_t ru_nivcsw; /* involuntary context switches */
|
||||
};
|
||||
|
||||
int getrusage(int, struct rusage *);
|
||||
int wait3(int *, int, struct rusage *);
|
||||
int wait4(int, int *, int, struct rusage *);
|
||||
void rusage_add(struct rusage *, const struct rusage *);
|
||||
int getrusage(int, struct rusage *) libcesque;
|
||||
int wait3(int *, int, struct rusage *) libcesque;
|
||||
int wait4(int, int *, int, struct rusage *) libcesque;
|
||||
void rusage_add(struct rusage *, const struct rusage *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_RUSAGE_H_ */
|
||||
|
|
|
@ -7,13 +7,13 @@ struct sched_param {
|
|||
int32_t sched_priority;
|
||||
};
|
||||
|
||||
int sched_get_priority_max(int);
|
||||
int sched_get_priority_min(int);
|
||||
int sched_getparam(int, struct sched_param *);
|
||||
int sched_getscheduler(int);
|
||||
int sched_rr_get_interval(int, struct timespec *);
|
||||
int sched_setparam(int, const struct sched_param *);
|
||||
int sched_setscheduler(int, int, const struct sched_param *);
|
||||
int sched_get_priority_max(int) libcesque;
|
||||
int sched_get_priority_min(int) libcesque;
|
||||
int sched_getparam(int, struct sched_param *) libcesque;
|
||||
int sched_getscheduler(int) libcesque;
|
||||
int sched_rr_get_interval(int, struct timespec *) libcesque;
|
||||
int sched_setparam(int, const struct sched_param *) libcesque;
|
||||
int sched_setscheduler(int, int, const struct sched_param *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SCHED_PARAM_H_ */
|
||||
|
|
|
@ -17,8 +17,8 @@ struct sigaction {
|
|||
sigset_t sa_mask;
|
||||
};
|
||||
|
||||
sighandler_t signal(int, sighandler_t);
|
||||
int sigaction(int, const struct sigaction *, struct sigaction *);
|
||||
sighandler_t signal(int, sighandler_t) libcesque;
|
||||
int sigaction(int, const struct sigaction *, struct sigaction *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGACTION_H_ */
|
||||
|
|
|
@ -10,7 +10,7 @@ struct sigaltstack {
|
|||
|
||||
typedef struct sigaltstack stack_t;
|
||||
|
||||
int sigaltstack(const struct sigaltstack *, struct sigaltstack *);
|
||||
int sigaltstack(const struct sigaltstack *, struct sigaltstack *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SIGALTSTACK_H_ */
|
||||
|
|
|
@ -57,8 +57,8 @@ struct siginfo {
|
|||
typedef struct siginfo siginfo_t;
|
||||
|
||||
#ifdef _COSMO_SOURCE
|
||||
void __minicrash(int, siginfo_t *, void *);
|
||||
char __is_stack_overflow(siginfo_t *, void *);
|
||||
void __minicrash(int, siginfo_t *, void *) libcesque;
|
||||
char __is_stack_overflow(siginfo_t *, void *) libcesque;
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
|
@ -20,8 +20,8 @@ struct statfs { /* cosmo abi */
|
|||
char f_fstypename[16];
|
||||
};
|
||||
|
||||
int statfs(const char *, struct statfs *);
|
||||
int fstatfs(int, struct statfs *);
|
||||
int statfs(const char *, struct statfs *) libcesque;
|
||||
int fstatfs(int, struct statfs *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_STATFS_H_ */
|
||||
|
|
|
@ -19,7 +19,7 @@ struct sysinfo {
|
|||
uint32_t mem_unit; /* ram stuff above is multiples of this */
|
||||
};
|
||||
|
||||
int sysinfo(struct sysinfo *);
|
||||
int sysinfo(struct sysinfo *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_SYSINFO_H_ */
|
||||
|
|
|
@ -8,35 +8,38 @@ struct timespec {
|
|||
int64_t tv_nsec; /* nanoseconds */
|
||||
};
|
||||
|
||||
int clock_getres(int, struct timespec *);
|
||||
int clock_gettime(int, struct timespec *);
|
||||
int clock_settime(int, const struct timespec *);
|
||||
int clock_getres(int, struct timespec *) libcesque;
|
||||
int clock_gettime(int, struct timespec *) libcesque;
|
||||
int clock_settime(int, const struct timespec *) libcesque;
|
||||
int clock_nanosleep(int, int, const struct timespec *, struct timespec *);
|
||||
int futimens(int, const struct timespec[2]);
|
||||
int nanosleep(const struct timespec *, struct timespec *);
|
||||
int utimensat(int, const char *, const struct timespec[2], int);
|
||||
int timespec_getres(struct timespec *, int);
|
||||
int timespec_get(struct timespec *, int);
|
||||
int futimens(int, const struct timespec[2]) libcesque;
|
||||
int nanosleep(const struct timespec *, struct timespec *) libcesque;
|
||||
int utimensat(int, const char *, const struct timespec[2], int) libcesque;
|
||||
int timespec_getres(struct timespec *, int) libcesque;
|
||||
int timespec_get(struct timespec *, int) libcesque;
|
||||
|
||||
#ifdef _COSMO_SOURCE
|
||||
/* cosmopolitan libc's non-posix timespec library
|
||||
removed by default due to emacs codebase clash */
|
||||
#define timespec_zero ((struct timespec){0})
|
||||
#define timespec_max ((struct timespec){0x7fffffffffffffff, 999999999})
|
||||
int timespec_cmp(struct timespec, struct timespec) pureconst;
|
||||
int64_t timespec_tomicros(struct timespec) pureconst;
|
||||
int64_t timespec_tomillis(struct timespec) pureconst;
|
||||
int64_t timespec_tonanos(struct timespec) pureconst;
|
||||
struct timespec timespec_add(struct timespec, struct timespec) pureconst;
|
||||
struct timespec timespec_fromnanos(int64_t) pureconst;
|
||||
struct timespec timespec_frommicros(int64_t) pureconst;
|
||||
struct timespec timespec_frommillis(int64_t) pureconst;
|
||||
struct timespec timespec_real(void);
|
||||
struct timespec timespec_mono(void);
|
||||
struct timespec timespec_sleep(struct timespec);
|
||||
int timespec_sleep_until(struct timespec);
|
||||
struct timespec timespec_sub(struct timespec, struct timespec) pureconst;
|
||||
struct timespec timespec_subz(struct timespec, struct timespec) pureconst;
|
||||
libcesque int timespec_cmp(struct timespec, struct timespec) pureconst;
|
||||
libcesque int64_t timespec_tomicros(struct timespec) pureconst;
|
||||
libcesque int64_t timespec_tomillis(struct timespec) pureconst;
|
||||
libcesque int64_t timespec_tonanos(struct timespec) pureconst;
|
||||
libcesque struct timespec timespec_add(struct timespec,
|
||||
struct timespec) pureconst;
|
||||
libcesque struct timespec timespec_fromnanos(int64_t) pureconst;
|
||||
libcesque struct timespec timespec_frommicros(int64_t) pureconst;
|
||||
libcesque struct timespec timespec_frommillis(int64_t) pureconst;
|
||||
libcesque struct timespec timespec_real(void) libcesque;
|
||||
libcesque struct timespec timespec_mono(void) libcesque;
|
||||
libcesque struct timespec timespec_sleep(struct timespec) libcesque;
|
||||
libcesque int timespec_sleep_until(struct timespec) libcesque;
|
||||
libcesque struct timespec timespec_sub(struct timespec,
|
||||
struct timespec) pureconst;
|
||||
libcesque struct timespec timespec_subz(struct timespec,
|
||||
struct timespec) pureconst;
|
||||
int sys_futex(int *, int, int, const struct timespec *, int *);
|
||||
static inline struct timespec timespec_fromseconds(int64_t __x) {
|
||||
return (struct timespec){__x};
|
||||
|
|
|
@ -9,7 +9,7 @@ struct tms {
|
|||
int64_t tms_cstime; /* children kernelspace time */
|
||||
};
|
||||
|
||||
long times(struct tms *);
|
||||
long times(struct tms *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_TMS_H_ */
|
||||
|
|
|
@ -14,7 +14,7 @@ struct utsname { /* cosmo abi */
|
|||
char domainname[SYS_NMLN]; /* domain name */
|
||||
};
|
||||
|
||||
int uname(struct utsname *);
|
||||
int uname(struct utsname *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_UTSNAME_H_ */
|
||||
|
|
|
@ -8,34 +8,34 @@ COSMOPOLITAN_C_START_
|
|||
│ cosmopolitan § teletypewriter control ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
int tcgetattr(int, struct termios *);
|
||||
int tcsetattr(int, int, const struct termios *);
|
||||
int tcgetattr(int, struct termios *) libcesque;
|
||||
int tcsetattr(int, int, const struct termios *) libcesque;
|
||||
|
||||
int openpty(int *, int *, char *, const struct termios *,
|
||||
const struct winsize *) paramsnonnull((1, 2));
|
||||
int forkpty(int *, char *, const struct termios *, const struct winsize *)
|
||||
paramsnonnull((1, 2)) __wur;
|
||||
char *ptsname(int);
|
||||
errno_t ptsname_r(int, char *, size_t);
|
||||
const struct winsize *) libcesque paramsnonnull((1, 2));
|
||||
int forkpty(int *, char *, const struct termios *,
|
||||
const struct winsize *) libcesque paramsnonnull((1, 2)) __wur;
|
||||
char *ptsname(int) libcesque;
|
||||
errno_t ptsname_r(int, char *, size_t) libcesque;
|
||||
|
||||
int grantpt(int);
|
||||
int unlockpt(int);
|
||||
int posix_openpt(int) __wur;
|
||||
int grantpt(int) libcesque;
|
||||
int unlockpt(int) libcesque;
|
||||
int posix_openpt(int) libcesque __wur;
|
||||
|
||||
int tcdrain(int);
|
||||
int tcgetsid(int);
|
||||
int tcflow(int, int);
|
||||
int tcflush(int, int);
|
||||
int tcsetsid(int, int);
|
||||
int tcsendbreak(int, int);
|
||||
void cfmakeraw(struct termios *);
|
||||
int cfsetspeed(struct termios *, uint32_t);
|
||||
int cfsetospeed(struct termios *, uint32_t);
|
||||
int cfsetispeed(struct termios *, uint32_t);
|
||||
uint32_t cfgetospeed(const struct termios *);
|
||||
uint32_t cfgetispeed(const struct termios *);
|
||||
int tcsetwinsize(int, const struct winsize *);
|
||||
int tcgetwinsize(int, struct winsize *);
|
||||
int tcdrain(int) libcesque;
|
||||
int tcgetsid(int) libcesque;
|
||||
int tcflow(int, int) libcesque;
|
||||
int tcflush(int, int) libcesque;
|
||||
int tcsetsid(int, int) libcesque;
|
||||
int tcsendbreak(int, int) libcesque;
|
||||
void cfmakeraw(struct termios *) libcesque;
|
||||
int cfsetspeed(struct termios *, uint32_t) libcesque;
|
||||
int cfsetospeed(struct termios *, uint32_t) libcesque;
|
||||
int cfsetispeed(struct termios *, uint32_t) libcesque;
|
||||
uint32_t cfgetospeed(const struct termios *) libcesque;
|
||||
uint32_t cfgetispeed(const struct termios *) libcesque;
|
||||
int tcsetwinsize(int, const struct winsize *) libcesque;
|
||||
int tcgetwinsize(int, struct winsize *) libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue