Make important improvements

- Fix preadv() and pwritev() for old distros
- Introduce _npassert() and _unassert() macros
- Prove that file locks work properly on Windows
- Support fcntl(F_DUPFD_CLOEXEC) on more systems
This commit is contained in:
Justine Tunney 2022-09-14 21:29:50 -07:00
parent 1ad2f530f9
commit 3f49889841
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
130 changed files with 1225 additions and 431 deletions

View file

@ -24,16 +24,18 @@
#include "libc/sysv/errfuns.h"
int32_t sys_pipe2(int pipefd[hasatleast 2], unsigned flags) {
int rc, olderr;
int e, rc;
if (!flags) goto OldSkool;
olderr = errno;
e = errno;
rc = __sys_pipe2(pipefd, flags);
if (rc == -1 && errno == ENOSYS) {
errno = olderr;
errno = e;
OldSkool:
if ((rc = sys_pipe(pipefd)) != -1) {
__fixupnewfd(pipefd[0], flags);
__fixupnewfd(pipefd[1], flags);
if (flags) {
__fixupnewfd(pipefd[0], flags);
__fixupnewfd(pipefd[1], flags);
}
}
}
return rc;