mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-11 21:49:12 +00:00
Improve Windows Console I/O
- Blocking read operations on the Windows Console can now EINTR - Blocking read operations on Windows pipes now EINTR more reliably - setitimer() will no longer be inherited across fork() on Windows - It's now possible to use ECHO when the console is in raw mode - The ECHOCTL flag now works correctly on the Windows Console - The ICRNL flag now works correctly on the Windows Console - pread() and pwrite() will now raise ESPIPE on Windows - Opening /dev/tty on Windows is improved (untested) - Overlapped I/O is now implemented in a better way
This commit is contained in:
parent
decf216655
commit
33d280c8ba
34 changed files with 580 additions and 376 deletions
|
@ -1,7 +1,8 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_WAIT_H_
|
||||
#define COSMOPOLITAN_LIBC_NT_ENUM_WAIT_H_
|
||||
|
||||
#define kNtWaitFailed 0xffffffffu
|
||||
#define kNtWaitTimeout 0x00000102u
|
||||
#define kNtWaitFailed 0xffffffffu
|
||||
#define kNtWaitTimeout 0x00000102u
|
||||
#define kNtWaitAbandoned 0x00000080u
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_WAIT_H_ */
|
||||
|
|
|
@ -55,13 +55,17 @@ int64_t RegisterEventSource(const char16_t *lpUNCServerName,
|
|||
const char16_t *lpSourceName);
|
||||
int32_t DeregisterEventSource(uint64_t handle);
|
||||
|
||||
int64_t CreateEvent(struct NtSecurityAttributes *lpEventAttributes,
|
||||
int64_t CreateEvent(struct NtSecurityAttributes *opt_lpEventAttributes,
|
||||
bool32 bManualReset, bool32 bInitialState,
|
||||
const char16_t *lpName);
|
||||
const char16_t *opt_lpName);
|
||||
int64_t CreateEventEx(struct NtSecurityAttributes *lpEventAttributes,
|
||||
const char16_t *lpName, uint32_t dwFlags,
|
||||
uint32_t dwDesiredAccess);
|
||||
|
||||
int32_t SetEvent(int64_t hEvent);
|
||||
int32_t ResetEvent(int64_t hEvent);
|
||||
int32_t PulseEvent(int64_t hEvent);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_NT_EVENTS_H_ */
|
||||
|
|
|
@ -1,2 +1,18 @@
|
|||
#include "libc/nt/codegen.h"
|
||||
.imp kernel32,__imp_CancelIoEx,CancelIoEx
|
||||
|
||||
.text.windows
|
||||
.ftrace1
|
||||
CancelIoEx:
|
||||
.ftrace2
|
||||
#ifdef __x86_64__
|
||||
push %rbp
|
||||
mov %rsp,%rbp
|
||||
mov __imp_CancelIoEx(%rip),%rax
|
||||
jmp __sysv2nt
|
||||
#elif defined(__aarch64__)
|
||||
mov x0,#0
|
||||
ret
|
||||
#endif
|
||||
.endfn CancelIoEx,globl
|
||||
.previous
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
# KERNEL32.DLL
|
||||
#
|
||||
# Name Actual DLL Arity
|
||||
imp '' CancelIoEx kernel32 2
|
||||
imp '' CloseHandle kernel32 1
|
||||
imp '' CreateDirectoryW kernel32 2
|
||||
imp '' CreateFileMappingNumaW kernel32 7
|
||||
|
@ -53,6 +52,7 @@ imp 'AttachConsole' AttachConsole kernel32 1
|
|||
imp 'CallNamedPipe' CallNamedPipeW kernel32 7
|
||||
imp 'CallNamedPipeA' CallNamedPipeA kernel32 7
|
||||
imp 'CancelIo' CancelIo kernel32 1
|
||||
imp 'CancelIoEx' CancelIoEx kernel32 2
|
||||
imp 'CancelSynchronousIo' CancelSynchronousIo kernel32 1
|
||||
imp 'CheckRemoteDebuggerPresent' CheckRemoteDebuggerPresent kernel32 2
|
||||
imp 'ClearCommBreak' ClearCommBreak kernel32 1
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#define kNtCpUtf8 65001
|
||||
#define kNtInvalidHandleValue -1L
|
||||
#define kNtStdInputHandle -10L
|
||||
#define kNtStdOutputHandle -11L
|
||||
#define kNtStdErrorHandle -12L
|
||||
#define kNtStdInputHandle -10u
|
||||
#define kNtStdOutputHandle -11u
|
||||
#define kNtStdErrorHandle -12u
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
@ -36,8 +36,8 @@ int64_t GetCurrentProcess(void) pureconst;
|
|||
void ExitProcess(uint32_t uExitCode) wontreturn;
|
||||
uint32_t GetLastError(void) nosideeffect;
|
||||
bool32 CloseHandle(int64_t hObject) dontthrow nocallback;
|
||||
intptr_t GetStdHandle(int64_t nStdHandle) nosideeffect;
|
||||
bool32 SetStdHandle(int64_t nStdHandle, int64_t hHandle);
|
||||
intptr_t GetStdHandle(uint32_t nStdHandle) nosideeffect;
|
||||
bool32 SetStdHandle(uint32_t nStdHandle, int64_t hHandle);
|
||||
bool32 SetDefaultDllDirectories(unsigned dirflags);
|
||||
bool32 RtlGenRandom(void *RandomBuffer, uint32_t RandomBufferLength);
|
||||
uint32_t GetModuleFileName(int64_t hModule, char16_t *lpFilename,
|
||||
|
|
|
@ -85,10 +85,6 @@ int64_t CreateSemaphore(struct NtSecurityAttributes *opt_lpSemaphoreAttributes,
|
|||
uint32_t lInitialCount, uint32_t lMaximumCount,
|
||||
const char16_t *opt_lpName);
|
||||
|
||||
int32_t SetEvent(int64_t hEvent);
|
||||
int32_t ResetEvent(int64_t hEvent);
|
||||
int32_t PulseEvent(int64_t hEvent);
|
||||
|
||||
int32_t ReleaseMutex(int64_t hMutex);
|
||||
int32_t ReleaseSemaphore(int64_t hSemaphore, int32_t lReleaseCount,
|
||||
int *lpPreviousCount);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
bool IsAtLeastWindows10(void) pureconst;
|
||||
bool32 GetVersionEx(struct NtOsVersionInfo *lpVersionInformation);
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && defined(__x86_64__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue