2020-06-15 07:18:57 -07:00
|
|
|
|
#ifndef COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_
|
|
|
|
|
#define COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_
|
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
|
|
|
│ cosmopolitan § runtime ─╬─│┼
|
|
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
|
2020-12-05 12:20:41 -08:00
|
|
|
|
typedef long jmp_buf[8] forcealign(CACHELINE);
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
2020-12-05 12:20:41 -08:00
|
|
|
|
extern char **environ; /* CRT */
|
2022-03-23 06:31:55 -07:00
|
|
|
|
extern int __argc; /* CRT */
|
|
|
|
|
extern char **__argv; /* CRT */
|
|
|
|
|
extern char **__envp; /* CRT */
|
|
|
|
|
extern unsigned long *__auxv; /* CRT */
|
2021-10-14 19:36:49 -07:00
|
|
|
|
extern intptr_t __oldstack; /* CRT */
|
2022-05-18 16:41:29 -07:00
|
|
|
|
extern uint64_t __nosync; /* SYS */
|
|
|
|
|
extern _Atomic(int) __ftrace; /* SYS */
|
|
|
|
|
extern _Atomic(int) __strace; /* SYS */
|
2020-12-05 12:20:41 -08:00
|
|
|
|
extern char *program_invocation_name; /* RII */
|
|
|
|
|
extern char *program_invocation_short_name; /* RII */
|
2022-05-18 16:41:29 -07:00
|
|
|
|
extern uint64_t __syscount; /* RII */
|
2022-06-12 09:37:17 -07:00
|
|
|
|
extern uint64_t kStartTsc; /* RII */
|
2020-12-05 12:20:41 -08:00
|
|
|
|
extern const char kTmpPath[]; /* RII */
|
|
|
|
|
extern const char kNtSystemDirectory[]; /* RII */
|
|
|
|
|
extern const char kNtWindowsDirectory[]; /* RII */
|
|
|
|
|
extern unsigned char _base[] forcealign(PAGESIZE); /* αpε */
|
|
|
|
|
extern unsigned char _ehead[] forcealign(PAGESIZE); /* αpε */
|
|
|
|
|
extern unsigned char _etext[] forcealign(PAGESIZE); /* αpε */
|
|
|
|
|
extern unsigned char _edata[] forcealign(PAGESIZE); /* αpε */
|
2022-03-20 08:01:14 -07:00
|
|
|
|
extern unsigned char _ezip[]; /* αpε */
|
2021-01-27 19:34:02 -08:00
|
|
|
|
extern unsigned char _end[] forcealign(FRAMESIZE); /* αpε */
|
2022-05-16 13:20:08 -07:00
|
|
|
|
extern unsigned char _ereal[]; /* αpε */
|
|
|
|
|
extern unsigned char __privileged_start[]; /* αpε */
|
|
|
|
|
extern unsigned char __privileged_addr[]; /* αpε */
|
|
|
|
|
extern unsigned char __privileged_size[]; /* αpε */
|
|
|
|
|
extern unsigned char __test_start[]; /* αpε */
|
|
|
|
|
extern unsigned char __ro[]; /* αpε */
|
2020-12-05 12:20:41 -08:00
|
|
|
|
extern unsigned char *__relo_start[]; /* αpε */
|
|
|
|
|
extern unsigned char *__relo_end[]; /* αpε */
|
|
|
|
|
extern uint8_t __zip_start[]; /* αpε */
|
|
|
|
|
extern uint8_t __zip_end[]; /* αpε */
|
2022-04-18 00:01:26 -07:00
|
|
|
|
extern size_t __virtualmax;
|
2022-04-18 08:54:42 -07:00
|
|
|
|
extern bool __isworker;
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
|
|
void mcount(void);
|
|
|
|
|
unsigned long getauxval(unsigned long);
|
2021-04-20 19:14:21 -07:00
|
|
|
|
void *mapanon(size_t) attributeallocsize((1));
|
2020-06-15 07:18:57 -07:00
|
|
|
|
int setjmp(jmp_buf) libcesque returnstwice paramsnonnull();
|
2020-12-05 12:20:41 -08:00
|
|
|
|
void longjmp(jmp_buf, int) libcesque wontreturn paramsnonnull();
|
2022-05-27 13:25:46 -07:00
|
|
|
|
axdx_t setlongerjmp(jmp_buf) libcesque returnstwice paramsnonnull();
|
|
|
|
|
void longerjmp(jmp_buf, intptr_t) libcesque wontreturn paramsnonnull();
|
2021-03-02 03:27:55 -08:00
|
|
|
|
int _setjmp(jmp_buf) libcesque returnstwice paramsnonnull();
|
|
|
|
|
void _longjmp(jmp_buf, int) libcesque wontreturn paramsnonnull();
|
2020-12-05 12:20:41 -08:00
|
|
|
|
void exit(int) wontreturn;
|
|
|
|
|
void _exit(int) libcesque wontreturn;
|
|
|
|
|
void _Exit(int) libcesque wontreturn;
|
2022-04-18 00:01:26 -07:00
|
|
|
|
void _Exit1(int) libcesque wontreturn;
|
2021-10-13 17:27:13 -07:00
|
|
|
|
void quick_exit(int) wontreturn;
|
2020-12-05 12:20:41 -08:00
|
|
|
|
void abort(void) wontreturn noinstrument;
|
2020-06-15 07:18:57 -07:00
|
|
|
|
int __cxa_atexit(void *, void *, void *) libcesque;
|
|
|
|
|
int atfork(void *, void *) libcesque;
|
|
|
|
|
int atexit(void (*)(void)) libcesque;
|
|
|
|
|
char *getenv(const char *) paramsnonnull() nosideeffect libcesque;
|
|
|
|
|
int putenv(char *) paramsnonnull();
|
|
|
|
|
int setenv(const char *, const char *, int) paramsnonnull();
|
|
|
|
|
int unsetenv(const char *);
|
|
|
|
|
int clearenv(void);
|
|
|
|
|
void fpreset(void);
|
|
|
|
|
int issetugid(void);
|
2020-09-03 05:44:37 -07:00
|
|
|
|
void *mmap(void *, uint64_t, int32_t, int32_t, int32_t, int64_t);
|
2021-04-18 11:34:59 -07:00
|
|
|
|
void *mremap(void *, size_t, size_t, int, ...);
|
2020-09-03 05:44:37 -07:00
|
|
|
|
int munmap(void *, uint64_t);
|
|
|
|
|
int mprotect(void *, uint64_t, int) privileged;
|
|
|
|
|
int msync(void *, size_t, int);
|
2021-01-27 19:34:02 -08:00
|
|
|
|
void *sbrk(intptr_t);
|
|
|
|
|
int brk(void *);
|
2021-04-01 19:36:37 -07:00
|
|
|
|
long fpathconf(int, int);
|
|
|
|
|
long pathconf(const char *, int);
|
|
|
|
|
int getgroups(int, uint32_t[]);
|
|
|
|
|
long gethostid(void);
|
|
|
|
|
int sethostid(long);
|
|
|
|
|
char *getlogin(void);
|
|
|
|
|
int getlogin_r(char *, size_t);
|
|
|
|
|
int lchown(const char *, uint32_t, uint32_t);
|
|
|
|
|
int getpagesize(void);
|
|
|
|
|
int syncfs(int);
|
|
|
|
|
int vhangup(void);
|
|
|
|
|
int getdtablesize(void);
|
|
|
|
|
int sethostname(const char *, size_t);
|
|
|
|
|
int acct(const char *);
|
2021-10-04 03:23:31 -07:00
|
|
|
|
void longsort(long *, size_t);
|
2021-03-08 10:56:09 -08:00
|
|
|
|
|
|
|
|
|
bool _isheap(void *);
|
2021-10-13 17:27:13 -07:00
|
|
|
|
int NtGetVersion(void) pureconst;
|
2021-03-08 10:56:09 -08:00
|
|
|
|
long missingno();
|
2021-09-27 22:58:51 -07:00
|
|
|
|
void __oom_hook(size_t);
|
2021-03-08 10:56:09 -08:00
|
|
|
|
void _loadxmm(void *);
|
|
|
|
|
void _peekall(void);
|
|
|
|
|
void _savexmm(void *);
|
|
|
|
|
void _weakfree(void *);
|
|
|
|
|
void free_s(void *) paramsnonnull() libcesque;
|
|
|
|
|
int close_s(int *) paramsnonnull() libcesque;
|
2021-04-18 11:34:59 -07:00
|
|
|
|
int OpenExecutable(void);
|
2022-04-22 18:55:28 -07:00
|
|
|
|
int ftrace_install(void);
|
2021-08-18 14:21:30 -07:00
|
|
|
|
long GetResourceLimit(int);
|
|
|
|
|
long GetMaxFd(void);
|
2022-03-23 06:31:55 -07:00
|
|
|
|
char *GetProgramExecutableName(void);
|
2022-03-16 13:33:13 -07:00
|
|
|
|
char *GetInterpreterExecutableName(char *, size_t);
|
2022-04-16 10:40:23 -07:00
|
|
|
|
void __printargs(const char *);
|
2022-04-24 09:59:22 -07:00
|
|
|
|
void __paginate(int, const char *);
|
2022-04-28 09:42:36 -07:00
|
|
|
|
int __arg_max(void);
|
2022-05-16 13:20:08 -07:00
|
|
|
|
void __morph_begin(void);
|
|
|
|
|
void __morph_end(void);
|
|
|
|
|
unsigned char *GetFirstInstruction(void);
|
|
|
|
|
unsigned char *GetInstructionLengths(void);
|
2022-05-19 16:57:49 -07:00
|
|
|
|
void __print_maps(void);
|
2022-06-10 20:51:36 -07:00
|
|
|
|
void __warn_if_powersave(void);
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_ */
|