Make improvements

- Introduce ualarm() function
- Make rename() report EISEMPTY on Windows
- Always raise EINVAL upon open(O_RDONLY|O_TRUNC)
- Add macro so ./configure will detect SOCK_CLOEXEC
- Fix O_TRUNC without O_CREAT not working on Windows
- Let fcntl(F_SETFL) change O_APPEND status on Windows
- Make sure pwrite() / pread() report ESPIPE on sockets
- Raise ESPIPE on Windows when pwrite() is used on pipe
- Properly compute O_APPEND CreateFile() flags on Windows
- Don't require O_DIRECTORY to open directories on Windows
- Fix more instances of Windows reporting EISDIR and ENOTDIR
- Normalize EFTYPE and EMLINK to ELOOP on NetBSD and FreeBSD
- Make unlink() / rmdir() work on read-only files on Windows
- Validate UTF-8 on Windows paths to fix bug with overlong NUL
- Always print signal name to stderr when crashing due to SIG_DFL
- Fix Windows bug where denormalized paths >260 chars didn't work
- Block signals on BSDs when thread exits before trashing its own stack
This commit is contained in:
Justine Tunney 2023-08-21 02:28:24 -07:00
parent ec957491ea
commit ebf784d4f5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
76 changed files with 1019 additions and 568 deletions

View file

@ -596,68 +596,68 @@ static int ioctl_siocgifflags(int fd, void *arg) {
/**
* Performs special i/o operation on file descriptor.
*
* @param request can be any of:
* The following i/o requests are available.
*
* - `FIONREAD` takes an `int *` and returns how many bytes of input
* are available on a terminal or socket, waiting to be read.
* - `FIONREAD` takes an `int *` and returns how many bytes of input are
* available on a terminal/socket/pipe, waiting to be read. Be sure to
* only use it on the reading end of a pipe.
*
* - `TIOCGWINSZ` populates `struct winsize *` with the dimensions
* of your teletypewriter. It's an alias for tcgetwinsize().
* - `TIOCGWINSZ` populates `struct winsize *` with the dimensions of
* your teletypewriter. It's an alias for tcgetwinsize().
*
* - `TIOCSWINSZ` with the dimensions of your teletypewriter to
* `struct winsize *`. It's an alias for tcsetwinsize().
* - `TIOCSWINSZ` with the dimensions of your teletypewriter to `struct
* winsize *`. It's an alias for tcsetwinsize().
*
* - `TIOCOUTQ` takes an `int *` and returns the number of bytes in
* the terminal's output buffer. Only available on UNIX.
* - `TIOCOUTQ` takes an `int *` and returns the number of bytes in the
* terminal's output buffer. Only available on UNIX.
*
* - `TIOCSTI` takes a `const char *` and may be used to fake input
* to a tty. This API isn't available on OpenBSD. Only available
* on UNIX.
* - `TIOCSTI` takes a `const char *` and may be used to fake input to a
* tty. This API isn't available on OpenBSD. Only available on UNIX.
*
* - `TIOCNOTTY` takes an `int tty_fd` arg and makes it the
* controlling terminal of the calling process, which should have
* called setsid() beforehand.
* - `TIOCNOTTY` takes an `int tty_fd` arg and makes it the controlling
* terminal of the calling process, which should have called setsid()
* beforehand.
*
* - `TIOCNOTTY` to give up the controlling terminal. Only available
* on UNIX.
* - `TIOCNOTTY` to give up the controlling terminal. Only available on
* UNIX.
*
* - `TIOCNXCL` to give up exclusive mode on terminal. Only
* available on UNIX.
* - `TIOCNXCL` to give up exclusive mode on terminal. Only available on
* UNIX.
*
* - `SIOCGIFCONF` takes an struct ifconf object of a given size,
* whose arg is `struct ifconf *`. It implements the Linux style
* and modifies the following:
* - ifc_len: set it to the number of valid ifreq structures
* representingthe interfaces
* - ifc_ifcu.ifcu_req: sets the name of the interface for each
* interface
* The ifc_len is an input/output parameter: set it to the total
* size of the ifcu_buf (ifcu_req) buffer on input.
* - `SIOCGIFCONF` takes an struct ifconf object of a given size,
* whose arg is `struct ifconf *`. It implements the Linux style
* and modifies the following:
* - ifc_len: set it to the number of valid ifreq structures
* representingthe interfaces
* - ifc_ifcu.ifcu_req: sets the name of the interface for each
* interface
* The ifc_len is an input/output parameter: set it to the total
* size of the ifcu_buf (ifcu_req) buffer on input.
*
* - `SIOCGIFNETMASK` populates a `struct ifconf *` record with the
* network interface mask. This data structure should be obtained
* by calling `SIOCGIFCONF`.
* - `SIOCGIFNETMASK` populates a `struct ifconf *` record with the
* network interface mask. This data structure should be obtained by
* calling `SIOCGIFCONF`.
*
* - `SIOCGIFBRDADDR` populates a `struct ifconf *` record with the
* network broadcast addr. This data structure should be obtained
* by calling `SIOCGIFCONF`.
* - `SIOCGIFBRDADDR` populates a `struct ifconf *` record with the
* network broadcast addr. This data structure should be obtained by
* calling `SIOCGIFCONF`.
*
* - `FIONBIO` isn't polyfilled; use `fcntl(F_SETFL, O_NONBLOCK)`
* - `FIOCLEX` isn't polyfilled; use `fcntl(F_SETFD, FD_CLOEXEC)`
* - `FIONCLEX` isn't polyfilled; use `fcntl(F_SETFD, 0)`
* - `TCGETS` isn't polyfilled; use tcgetattr()
* - `TCSETS` isn't polyfilled; use tcsetattr()
* - `TCSETSW` isn't polyfilled; use tcsetattr()
* - `TCSETSF` isn't polyfilled; use tcsetattr()
* - `TCXONC` isn't polyfilled; use tcflow()
* - `TCSBRK` isn't polyfilled; use tcdrain()
* - `TCFLSH` isn't polyfilled; use tcflush()
* - `TIOCGPTN` isn't polyfilled; use ptsname()
* - `TIOCGSID` isn't polyfilled; use tcgetsid()
* - `TCSBRK` isn't polyfilled; use tcsendbreak()
* - `TCSBRK` isn't polyfilled; use tcsendbreak()
* - `TIOCSPGRP` isn't polyfilled; use tcsetpgrp()
* - `TIOCSPTLCK` isn't polyfilled; use unlockpt()
* - `FIONBIO` isn't polyfilled; use `fcntl(F_SETFL, O_NONBLOCK)`
* - `FIOCLEX` isn't polyfilled; use `fcntl(F_SETFD, FD_CLOEXEC)`
* - `FIONCLEX` isn't polyfilled; use `fcntl(F_SETFD, 0)`
* - `TCGETS` isn't polyfilled; use tcgetattr()
* - `TCSETS` isn't polyfilled; use tcsetattr()
* - `TCSETSW` isn't polyfilled; use tcsetattr()
* - `TCSETSF` isn't polyfilled; use tcsetattr()
* - `TCXONC` isn't polyfilled; use tcflow()
* - `TCSBRK` isn't polyfilled; use tcdrain()
* - `TCFLSH` isn't polyfilled; use tcflush()
* - `TIOCGPTN` isn't polyfilled; use ptsname()
* - `TIOCGSID` isn't polyfilled; use tcgetsid()
* - `TCSBRK` isn't polyfilled; use tcsendbreak()
* - `TCSBRK` isn't polyfilled; use tcsendbreak()
* - `TIOCSPGRP` isn't polyfilled; use tcsetpgrp()
* - `TIOCSPTLCK` isn't polyfilled; use unlockpt()
*
* @restartable
* @vforksafe