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 ─╬─│┼
|
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
2022-07-10 04:01:17 -07:00
|
|
|
typedef long jmp_buf[8];
|
2022-10-10 17:52:41 -07:00
|
|
|
typedef long sigjmp_buf[12];
|
2020-06-15 07:18:57 -07:00
|
|
|
|
2022-10-01 23:11:56 -07:00
|
|
|
extern char **environ; /* CRT */
|
|
|
|
extern int __argc; /* CRT */
|
|
|
|
extern char **__argv; /* CRT */
|
|
|
|
extern char **__envp; /* CRT */
|
|
|
|
extern unsigned long *__auxv; /* CRT */
|
|
|
|
extern intptr_t __oldstack; /* CRT */
|
|
|
|
extern uint64_t __nosync; /* SYS */
|
2022-11-01 22:36:03 -07:00
|
|
|
extern int __strace; /* SYS */
|
|
|
|
extern int __ftrace; /* SYS */
|
2022-10-01 23:11:56 -07:00
|
|
|
extern char *program_invocation_name; /* RII */
|
|
|
|
extern char *program_invocation_short_name; /* RII */
|
|
|
|
extern uint64_t __syscount; /* RII */
|
|
|
|
extern uint64_t kStartTsc; /* RII */
|
|
|
|
extern char kTmpPath[]; /* RII */
|
|
|
|
extern const char kNtSystemDirectory[]; /* RII */
|
|
|
|
extern const char kNtWindowsDirectory[]; /* RII */
|
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);
|
2022-10-10 17:52:41 -07:00
|
|
|
int daemon(int, int);
|
2022-07-10 04:01:17 -07:00
|
|
|
int _freestack(void *);
|
2022-09-16 14:02:06 -07:00
|
|
|
void _bt(const char *, ...);
|
2022-10-12 10:44:54 -07:00
|
|
|
int _cocmd(int, char **, char **);
|
2020-06-15 07:18:57 -07:00
|
|
|
unsigned long getauxval(unsigned long);
|
2022-07-10 04:01:17 -07:00
|
|
|
void *_mapanon(size_t) attributeallocsize((1)) mallocesque;
|
2022-07-24 23:40:49 -07:00
|
|
|
void *_mapshared(size_t) attributeallocsize((1)) mallocesque;
|
2022-07-10 04:01:17 -07:00
|
|
|
void *_mapstack(void) returnsaligned((FRAMESIZE)) mallocesque;
|
2023-01-18 00:56:09 -08:00
|
|
|
int setjmp(jmp_buf)
|
|
|
|
libcesque returnstwice paramsnonnull();
|
2020-12-05 12:20:41 -08:00
|
|
|
void longjmp(jmp_buf, int) libcesque wontreturn paramsnonnull();
|
2023-01-18 00:56:09 -08:00
|
|
|
axdx_t setlongerjmp(jmp_buf)
|
|
|
|
libcesque returnstwice paramsnonnull();
|
2022-05-27 13:25:46 -07:00
|
|
|
void longerjmp(jmp_buf, intptr_t) libcesque wontreturn paramsnonnull();
|
2023-01-18 00:56:09 -08:00
|
|
|
int _setjmp(jmp_buf)
|
|
|
|
libcesque returnstwice paramsnonnull();
|
2022-10-10 17:52:41 -07:00
|
|
|
int sigsetjmp(sigjmp_buf, int) libcesque returnstwice paramsnonnull();
|
|
|
|
void siglongjmp(sigjmp_buf, int) libcesque wontreturn paramsnonnull();
|
2021-03-02 03:27:55 -08:00
|
|
|
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-09-12 23:10:38 -07:00
|
|
|
void _Exitr(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;
|
2022-09-03 18:12:01 -07:00
|
|
|
void abort(void) wontreturn;
|
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;
|
2022-08-06 09:56:17 -07:00
|
|
|
char *getenv(const char *) nosideeffect libcesque;
|
2020-06-15 07:18:57 -07:00
|
|
|
int putenv(char *) paramsnonnull();
|
2022-10-17 11:02:04 -07:00
|
|
|
int setenv(const char *, const char *, int);
|
2020-06-15 07:18:57 -07:00
|
|
|
int unsetenv(const char *);
|
|
|
|
int clearenv(void);
|
|
|
|
void fpreset(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);
|
2023-04-27 10:42:52 -07:00
|
|
|
int mlock(const void *, size_t);
|
|
|
|
int munlock(const void *, size_t);
|
2021-01-27 19:34:02 -08:00
|
|
|
void *sbrk(intptr_t);
|
|
|
|
int brk(void *);
|
2021-04-01 19:36:37 -07:00
|
|
|
long gethostid(void);
|
|
|
|
int sethostid(long);
|
|
|
|
char *getlogin(void);
|
|
|
|
int getlogin_r(char *, size_t);
|
2022-09-13 20:11:09 -07:00
|
|
|
int login_tty(int);
|
2021-04-01 19:36:37 -07:00
|
|
|
int getpagesize(void);
|
|
|
|
int syncfs(int);
|
|
|
|
int vhangup(void);
|
|
|
|
int getdtablesize(void);
|
|
|
|
int sethostname(const char *, size_t);
|
|
|
|
int acct(const char *);
|
2022-09-13 20:11:09 -07:00
|
|
|
void _intsort(int *, size_t);
|
2022-09-12 23:10:38 -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;
|
2022-10-11 21:06:27 -07:00
|
|
|
unsigned _getcpucount(void) pureconst;
|
2022-09-12 23:10:38 -07: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;
|
2023-03-05 23:52:17 -08:00
|
|
|
int _OpenExecutable(void);
|
2022-04-22 18:55:28 -07:00
|
|
|
int ftrace_install(void);
|
2022-11-01 22:36:03 -07:00
|
|
|
int ftrace_enabled(int);
|
|
|
|
int strace_enabled(int);
|
2023-03-05 23:52:17 -08: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-19 16:57:49 -07:00
|
|
|
void __print_maps(void);
|
2022-06-10 20:51:36 -07:00
|
|
|
void __warn_if_powersave(void);
|
2022-07-08 06:29:24 -07:00
|
|
|
const char *__describe_os(void);
|
2023-03-05 23:52:17 -08:00
|
|
|
bool _IsDynamicExecutable(const char *);
|
2022-09-12 23:10:38 -07:00
|
|
|
void _restorewintty(void);
|
2023-01-18 00:56:09 -08:00
|
|
|
const char *GetCpuidOs(void);
|
|
|
|
const char *GetCpuidEmulator(void);
|
|
|
|
void GetCpuidBrand(char[13], uint32_t);
|
|
|
|
bool IsGenuineBlink(void);
|
|
|
|
bool IsCygwin(void);
|
2020-06-15 07:18:57 -07:00
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_RUNTIME_RUNTIME_H_ */
|