mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
49b0eaa69f
- 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.
77 lines
5.4 KiB
C
77 lines
5.4 KiB
C
#ifndef COSMOPOLITAN_LIBC_NT_IOCP_H_
|
|
#define COSMOPOLITAN_LIBC_NT_IOCP_H_
|
|
#include "libc/nt/struct/overlapped.h"
|
|
#include "libc/nt/struct/overlappedentry.h"
|
|
/* ░░░░
|
|
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
|
|
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
|
|
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
|
|
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
|
|
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
|
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
|
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
|
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
|
|
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
|
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
|
|
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
|
|
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
|
|
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
|
|
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
|
|
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
|
|
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
|
|
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
|
|
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
|
|
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
|
|
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
|
|
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
|
|
│ cosmopolitan § new technology » i/o completion ports ─╬─│┼
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
#define kNtFileSkipCompletionPortOnSuccess 1
|
|
#define kNtFileSkipSetEventOnHandle 2
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
typedef void (*NtOverlappedCompletionRoutine)(
|
|
uint32_t dwErrorCode, uint32_t dwNumberOfBytesTransfered,
|
|
struct NtOverlapped *inout_lpOverlapped);
|
|
|
|
int64_t CreateIoCompletionPort(int64_t FileHandleOrNeg1,
|
|
int64_t opt_ExistingCompletionPortOrZero,
|
|
uint64_t CompletionKey,
|
|
uint32_t NumberOfConcurrentThreads);
|
|
|
|
bool32 GetQueuedCompletionStatus(int64_t CompletionPort,
|
|
uint32_t *lpNumberOfBytesTransferred,
|
|
uint64_t *out_lpCompletionKey,
|
|
struct NtOverlapped **out_lpOverlapped,
|
|
uint32_t dwMilliseconds);
|
|
|
|
bool32 GetQueuedCompletionStatusEx(
|
|
int64_t CompletionPort,
|
|
struct NtOverlappedEntry *out_lpCompletionPortEntries, uint32_t ulCount,
|
|
uint32_t *out_ulNumEntriesRemoved, uint32_t dwMilliseconds,
|
|
bool32 fAlertable);
|
|
|
|
bool32 PostQueuedCompletionStatus(int64_t CompletionPort,
|
|
uint32_t dwNumberOfBytesTransferred,
|
|
uint64_t dwCompletionKey,
|
|
struct NtOverlapped *opt_lpOverlapped);
|
|
|
|
bool32 SetFileCompletionNotificationModes(int64_t FileHandle,
|
|
unsigned char Flags);
|
|
|
|
bool32 ReadFileEx(int64_t hFile, void *lpBuffer, uint32_t nNumberOfBytesToRead,
|
|
uint32_t *lpNumberOfBytesRead,
|
|
struct NtOverlapped *opt_lpOverlapped,
|
|
NtOverlappedCompletionRoutine lpCompletionRoutine);
|
|
|
|
bool32 WriteFileEx(int64_t hFile, const void *lpBuffer,
|
|
uint32_t nNumberOfBytesToWrite,
|
|
struct NtOverlapped *lpOverlapped,
|
|
NtOverlappedCompletionRoutine lpCompletionRoutine);
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_NT_IOCP_H_ */
|