Improve system call wrappers

This change improves copy_file_range(), sendfile(), splice(), openpty(),
closefrom(), close_range(), fadvise() and posix_fadvise() in addition to
writing tests that confirm things like errno and seeking behavior across
platforms. We now less aggressively polyfill behavior with some of these
functions when the platform support isn't available. Please see:

https://justine.lol/cosmopolitan/functions.html
This commit is contained in:
Justine Tunney 2022-09-19 15:01:48 -07:00
parent 224c12f54d
commit c7a8cd21e9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
89 changed files with 1151 additions and 414 deletions

View file

@ -6,29 +6,25 @@ COSMOPOLITAN_C_START_
extern const int POSIX_FADV_DONTNEED;
extern const int POSIX_FADV_NOREUSE;
extern const int POSIX_FADV_NORMAL;
extern const int POSIX_FADV_RANDOM;
extern const int POSIX_FADV_SEQUENTIAL;
extern const int POSIX_FADV_WILLNEED;
extern const int POSIX_MADV_DONTNEED;
extern const int POSIX_MADV_NORMAL;
extern const int POSIX_MADV_RANDOM;
extern const int POSIX_MADV_SEQUENTIAL;
extern const int POSIX_MADV_WILLNEED;
extern const int POSIX_MADV_DONTNEED;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define POSIX_FADV_DONTNEED SYMBOLIC(POSIX_FADV_DONTNEED)
#define POSIX_FADV_NOREUSE SYMBOLIC(POSIX_FADV_NOREUSE)
#define POSIX_FADV_NORMAL SYMBOLIC(POSIX_FADV_NORMAL)
#define POSIX_FADV_RANDOM SYMBOLIC(POSIX_FADV_RANDOM)
#define POSIX_FADV_SEQUENTIAL SYMBOLIC(POSIX_FADV_SEQUENTIAL)
#define POSIX_FADV_WILLNEED SYMBOLIC(POSIX_FADV_WILLNEED)
#define POSIX_MADV_DONTNEED SYMBOLIC(POSIX_MADV_DONTNEED)
#define POSIX_MADV_NORMAL SYMBOLIC(POSIX_MADV_NORMAL)
#define POSIX_MADV_RANDOM SYMBOLIC(POSIX_MADV_RANDOM)
#define POSIX_MADV_SEQUENTIAL SYMBOLIC(POSIX_MADV_SEQUENTIAL)
#define POSIX_MADV_WILLNEED SYMBOLIC(POSIX_MADV_WILLNEED)
#define POSIX_FADV_NORMAL LITERALLY(0)
#define POSIX_FADV_RANDOM LITERALLY(1)
#define POSIX_FADV_SEQUENTIAL LITERALLY(2)
#define POSIX_FADV_WILLNEED LITERALLY(3)
#define POSIX_FADV_DONTNEED SYMBOLIC(POSIX_FADV_DONTNEED)
#define POSIX_FADV_NOREUSE SYMBOLIC(POSIX_FADV_NOREUSE)
#define POSIX_MADV_NORMAL LITERALLY(0)
#define POSIX_MADV_RANDOM LITERALLY(1)
#define POSIX_MADV_SEQUENTIAL LITERALLY(2)
#define POSIX_MADV_WILLNEED LITERALLY(3)
#define POSIX_MADV_DONTNEED SYMBOLIC(POSIX_MADV_DONTNEED)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_POSIX_H_ */