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