mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Improve threading and i/o routines
- On Windows connect() can now be interrupted by a signal; connect() w/ O_NONBLOCK will now raise EINPROGRESS; and connect() with SO_SNDTIMEO will raise ETIMEDOUT after the interval has elapsed. - We now get the AcceptEx(), ConnectEx(), and TransmitFile() functions from the WIN32 API the officially blessed way, using WSAIoctl(). - Do nothing on Windows when fsync() is called on a directory handle. This was raising EACCES earlier becaues GENERIC_WRITE is required on the handle. It's possible to FlushFileBuffers() a directory handle if it's opened with write access but MSDN doesn't document what it does. If you have any idea, please let us know! - Prefer manual reset event objects for read() and write() on Windows. - Do some code cleanup on our dlmalloc customizations. - Fix errno type error in Windows blocking routines. - Make the futex polyfill simpler and faster.
This commit is contained in:
parent
f7343319cc
commit
49b0eaa69f
43 changed files with 528 additions and 425 deletions
|
@ -297,6 +297,7 @@ int WSACleanup(void);
|
|||
int WSAGetLastError(void) nosideeffect;
|
||||
void WSASetLastError(int);
|
||||
|
||||
int64_t __sys_socket_nt(int, int, int);
|
||||
int __sys_bind_nt(uint64_t, const void *, int);
|
||||
int __sys_closesocket_nt(uint64_t);
|
||||
int __sys_getpeername_nt(uint64_t, void *, uint32_t *);
|
||||
|
@ -342,12 +343,6 @@ int64_t WSAAccept(uint64_t s, struct sockaddr *out_addr,
|
|||
const NtConditionProc opt_lpfnCondition,
|
||||
const uint32_t *opt_dwCallbackData) paramsnonnull((2)) __wur;
|
||||
|
||||
bool32 AcceptEx(int64_t sListenSocket, int64_t sAcceptSocket,
|
||||
void *out_lpOutputBuffer /*[recvlen+local+remoteaddrlen]*/,
|
||||
uint32_t dwReceiveDataLength, uint32_t dwLocalAddressLength,
|
||||
uint32_t dwRemoteAddressLength, uint32_t *out_lpdwBytesReceived,
|
||||
struct NtOverlapped *inout_lpOverlapped);
|
||||
|
||||
int WSASend(uint64_t s, const struct NtIovec *lpBuffers, uint32_t dwBufferCount,
|
||||
uint32_t *opt_out_lpNumberOfBytesSent, uint32_t dwFlags,
|
||||
struct NtOverlapped *opt_inout_lpOverlapped,
|
||||
|
@ -494,19 +489,6 @@ int /* success==0 */ WSAGetServiceClassNameByClassId(
|
|||
const struct NtGuid *lpServiceClassId, char16_t *out_lpszServiceClassName,
|
||||
uint32_t *inout_lpdwBufferLength) paramsnonnull();
|
||||
|
||||
bool32 TransmitFile(int64_t hSocket, int64_t hFile,
|
||||
uint32_t opt_nNumberOfBytesToWrite,
|
||||
uint32_t opt_nNumberOfBytesPerSend,
|
||||
struct NtOverlapped *opt_inout_lpOverlapped,
|
||||
const struct NtTransmitFileBuffers *opt_lpTransmitBuffers,
|
||||
uint32_t dwReserved);
|
||||
|
||||
bool32 AcceptEx(int64_t sListenSocket, int64_t sAcceptSocket,
|
||||
void *out_lpOutputBuffer /*[recvlen+local+remoteaddrlen]*/,
|
||||
uint32_t dwReceiveDataLength, uint32_t dwLocalAddressLength,
|
||||
uint32_t dwRemoteAddressLength, uint32_t *out_lpdwBytesReceived,
|
||||
struct NtOverlapped *inout_lpOverlapped);
|
||||
|
||||
void GetAcceptExSockaddrs(
|
||||
const void *lpOutputBuffer /*[recvsize+addrsize+addrlen]*/,
|
||||
uint32_t dwReceiveDataLength, uint32_t dwLocalAddressLength,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue