2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_
|
2022-08-13 20:11:56 +00:00
|
|
|
#include "libc/calls/struct/fd.internal.h"
|
2021-04-18 18:34:59 +00:00
|
|
|
#include "libc/calls/struct/sigval.h"
|
2020-06-15 14:18:57 +00:00
|
|
|
#include "libc/dce.h"
|
2021-03-01 07:42:35 +00:00
|
|
|
#include "libc/macros.internal.h"
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
#define kSigactionMinRva 8 /* >SIG_{ERR,DFL,IGN,...} */
|
|
|
|
|
2023-07-30 15:55:01 +00:00
|
|
|
#define kSigOpRestartable 1
|
|
|
|
#define kSigOpNochld 2
|
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
#define kIoMotion ((const int8_t[3]){1, 0, 0})
|
|
|
|
|
2023-07-24 15:31:54 +00:00
|
|
|
extern struct Fds g_fds;
|
|
|
|
extern const struct Fd kEmptyFd;
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-07-24 15:31:54 +00:00
|
|
|
int __reservefd(int);
|
|
|
|
int __reservefd_unlocked(int);
|
|
|
|
void __releasefd(int);
|
|
|
|
int __ensurefds(int);
|
|
|
|
int __ensurefds_unlocked(int);
|
|
|
|
void __printfds(void);
|
2021-01-28 03:34:02 +00:00
|
|
|
|
2022-05-18 23:41:29 +00:00
|
|
|
forceinline int64_t __getfdhandleactual(int fd) {
|
|
|
|
return g_fds.p[fd].handle;
|
|
|
|
}
|
|
|
|
|
2021-01-28 03:34:02 +00:00
|
|
|
forceinline bool __isfdopen(int fd) {
|
|
|
|
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind != kFdEmpty;
|
|
|
|
}
|
|
|
|
|
2021-02-02 16:14:45 +00:00
|
|
|
forceinline bool __isfdkind(int fd, int kind) {
|
2021-01-28 03:34:02 +00:00
|
|
|
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind == kind;
|
|
|
|
}
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-07-24 15:31:54 +00:00
|
|
|
int sys_close_nt(struct Fd *, int);
|
2023-07-30 15:55:01 +00:00
|
|
|
int _check_interrupts(int, struct Fd *);
|
2021-02-26 02:30:17 +00:00
|
|
|
int sys_openat_metal(int, const char *, int, unsigned);
|
2020-11-28 20:01:51 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_INTERNAL_H_ */
|