Make more fixups and quality assurance

This commit is contained in:
Justine Tunney 2024-10-07 15:29:01 -07:00
parent 85c58be942
commit dcf9596620
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
17 changed files with 80 additions and 78 deletions

View file

@ -2,6 +2,7 @@
#define COSMOPOLITAN_LIBC_SOCK_INTERNAL_H_
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/timespec.h"
#include "libc/nt/struct/overlapped.h"
#include "libc/nt/thunk/msabi.h"
#include "libc/nt/winsock.h"
@ -60,7 +61,7 @@ int sys_socketpair_nt_stream(int, int, int, int[2]) ;
int sys_socketpair_nt_dgram(int, int, int, int[2]) ;
*/
int sys_socketpair_nt(int, int, int, int[2]);
int sys_select_nt(int, fd_set *, fd_set *, fd_set *, struct timeval *,
int sys_select_nt(int, fd_set *, fd_set *, fd_set *, const struct timespec *,
const sigset_t *);
size_t __iovec2nt(struct NtIovec[hasatleast 16], const struct iovec *, size_t);

View file

@ -66,8 +66,9 @@ textwindows ssize_t sys_send_nt(int fd, const struct iovec *iov, size_t iovlen,
__sig_unblock(waitmask);
if (rc == -1 && errno == WSAESHUTDOWN) { // ESHUTDOWN
errno = kNtErrorBrokenPipe; // EPIPE
if (rc == -1 && (errno == WSAESHUTDOWN || // ESHUTDOWN
errno == WSAECONNABORTED)) { // ECONNABORTED
errno = kNtErrorBrokenPipe; // EPIPE
if (!(flags & _MSG_NOSIGNAL))
__sig_raise(SIGPIPE, SI_KERNEL);
}

View file

@ -71,8 +71,9 @@ textwindows ssize_t sys_sendto_nt(int fd, const struct iovec *iov,
__sig_unblock(waitmask);
if (rc == -1 && errno == WSAESHUTDOWN) { // ESHUTDOWN
errno = kNtErrorBrokenPipe; // EPIPE
if (rc == -1 && (errno == WSAESHUTDOWN || // ESHUTDOWN
errno == WSAECONNABORTED)) { // ECONNABORTED
errno = kNtErrorBrokenPipe; // EPIPE
if (!(flags & _MSG_NOSIGNAL))
__sig_raise(SIGPIPE, SI_KERNEL);
}

View file

@ -11,7 +11,8 @@ int32_t __sys_poll(struct pollfd *, uint64_t, signed);
int sys_ppoll(struct pollfd *, size_t, const struct timespec *,
const sigset_t *, size_t);
int sys_poll_metal(struct pollfd *, size_t, unsigned);
int sys_poll_nt(struct pollfd *, uint64_t, uint32_t *, const sigset_t *);
int sys_poll_nt(struct pollfd *, uint64_t, const struct timespec *,
const sigset_t *);
const char *_DescribePollFds(char[300], ssize_t, struct pollfd *, size_t);
#define DescribePollFds(x, y, z) _DescribePollFds(alloca(300), x, y, z)