mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Polish recent changes and make improvements
- Simulate SIGPIPE on Windows NT - Fix commandv() regression on Windows NT - Fix sigprocmask() strace bug on OpenBSD - Add many more system calls to --strace logging - Make errno state more pristine in redbean strace
This commit is contained in:
parent
10a766ebd0
commit
39688a73e4
69 changed files with 460 additions and 1976 deletions
|
@ -28,30 +28,23 @@
|
|||
#define HANDLE ((struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle)
|
||||
|
||||
int __zipos_fcntl(int fd, int cmd, uintptr_t arg) {
|
||||
int rc;
|
||||
if (cmd == F_GETFD) {
|
||||
ZTRACE("__zipos_fcntl(%.*s, %s)",
|
||||
ZIP_CFILE_NAMESIZE(ZIPOS->map + HANDLE->cfile),
|
||||
ZIP_CFILE_NAME(ZIPOS->map + HANDLE->cfile), "F_GETFD");
|
||||
if (g_fds.p[fd].flags & O_CLOEXEC) {
|
||||
return FD_CLOEXEC;
|
||||
rc = FD_CLOEXEC;
|
||||
} else {
|
||||
return 0;
|
||||
rc = 0;
|
||||
}
|
||||
} else if (cmd == F_SETFD) {
|
||||
ZTRACE("__zipos_fcntl(%.*s, %s, 0x%x)",
|
||||
ZIP_CFILE_NAMESIZE(ZIPOS->map + HANDLE->cfile),
|
||||
ZIP_CFILE_NAME(ZIPOS->map + HANDLE->cfile), "F_SETFD", arg);
|
||||
if (arg & FD_CLOEXEC) {
|
||||
g_fds.p[fd].flags |= O_CLOEXEC;
|
||||
return FD_CLOEXEC;
|
||||
rc = FD_CLOEXEC;
|
||||
} else {
|
||||
g_fds.p[fd].flags &= ~O_CLOEXEC;
|
||||
return 0;
|
||||
rc = 0;
|
||||
}
|
||||
} else {
|
||||
ZTRACE("__zipos_fcntl(%.*s, %d, 0x%x) → EINVAL",
|
||||
ZIP_CFILE_NAMESIZE(ZIPOS->map + HANDLE->cfile),
|
||||
ZIP_CFILE_NAME(ZIPOS->map + HANDLE->cfile), cmd, arg);
|
||||
return einval();
|
||||
rc = einval();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue