Improve docs of more system calls

This change also found a few POSIX compliance bugs with errnos. Another
bug was discovered where, on Windows, pread() and pwrite() could modify
the file position in cases where ReadFile() returned an error e.g. when
seeking past the end of file. We also have more tests!
This commit is contained in:
Justine Tunney 2022-10-02 22:14:33 -07:00
parent af24c19db3
commit ccbae7799e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
39 changed files with 589 additions and 175 deletions

View file

@ -31,6 +31,9 @@
/**
* Writes data to file descriptor.
*
* This function changes the current file position. For documentation
* on file position behaviors and gotchas, see the lseek() function.
*
* @param fd is something open()'d earlier
* @param buf is copied from, cf. copy_file_range(), sendfile(), etc.
* @param size in range [1..0x7ffff000] is reasonable
@ -39,6 +42,7 @@
* @see read(), pwrite(), writev(), SIGPIPE
* @asyncsignalsafe
* @restartable
* @vforksafe
*/
ssize_t write(int fd, const void *buf, size_t size) {
ssize_t rc;