Make important improvements

- Fix preadv() and pwritev() for old distros
- Introduce _npassert() and _unassert() macros
- Prove that file locks work properly on Windows
- Support fcntl(F_DUPFD_CLOEXEC) on more systems
This commit is contained in:
Justine Tunney 2022-09-14 21:29:50 -07:00
parent 1ad2f530f9
commit 3f49889841
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
130 changed files with 1225 additions and 431 deletions

View file

@ -131,7 +131,7 @@
#define kNtErrorTooManyTcbs 155
#define kNtErrorSignalRefused 156
#define kNtErrorDiscarded 157
#define kNtErrorNotLocked 158
#define kNtErrorNotLocked 158 /* ENOLCK */
#define kNtErrorBadThreadidAddr 159
#define kNtErrorBadArguments 160
#define kNtErrorBadPathname 161
@ -1531,7 +1531,7 @@
#define kNtErrorLogSectorParityInvalid 6601
#define kNtErrorLogSectorRemapped 6602
#define kNtErrorLogBlockIncomplete 6603
#define kNtErrorLogInvalidRange 6604
#define kNtErrorLogInvalidRange 6604 /* ERANGE */
#define kNtErrorLogBlocksExhausted 6605
#define kNtErrorLogReadContextInvalid 6606
#define kNtErrorLogRestartInvalid 6607

View file

@ -116,13 +116,13 @@ bool32 DeviceIoControl(int64_t hDevice, uint32_t dwIoControlCode,
bool32 LockFile(int64_t hFile, uint32_t dwFileOffsetLow,
uint32_t dwFileOffsetHigh, uint32_t nNumberOfBytesToLockLow,
uint32_t nNumberOfBytesToLockHigh);
bool32 UnlockFile(int64_t hFile, uint32_t dwFileOffsetLow,
uint32_t dwFileOffsetHigh, uint32_t nNumberOfBytesToUnlockLow,
uint32_t nNumberOfBytesToUnlockHigh);
bool32 LockFileEx(int64_t hFile, uint32_t dwFlags, uint32_t dwReserved,
uint32_t nNumberOfBytesToLockLow,
uint32_t nNumberOfBytesToLockHigh,
struct NtOverlapped *lpOverlapped) paramsnonnull();
bool32 UnlockFile(int64_t hFile, uint32_t dwFileOffsetLow,
uint32_t dwFileOffsetHigh, uint32_t nNumberOfBytesToUnlockLow,
uint32_t nNumberOfBytesToUnlockHigh);
bool32 UnlockFileEx(int64_t hFile, uint32_t dwReserved,
uint32_t nNumberOfBytesToUnlockLow,
uint32_t nNumberOfBytesToUnlockHigh,

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_LockFileEx,LockFileEx,0
.text.windows
LockFileEx:
__LockFileEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_LockFileEx(%rip),%rax
jmp __sysv2nt6
.endfn LockFileEx,globl
.endfn __LockFileEx,globl
.previous

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_UnlockFileEx,UnlockFileEx,0
.text.windows
UnlockFileEx:
__UnlockFileEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_UnlockFileEx(%rip),%rax
jmp __sysv2nt6
.endfn UnlockFileEx,globl
.endfn __UnlockFileEx,globl
.previous

View file

@ -700,7 +700,6 @@ imp 'LocalUnlock' LocalUnlock kernel32 0
imp 'LocaleNameToLCID' LocaleNameToLCID kernel32 0
imp 'LocateXStateFeature' LocateXStateFeature kernel32 0
imp 'LockFile' LockFile kernel32 0 5
imp 'LockFileEx' LockFileEx kernel32 0 6
imp 'LockResource' LockResource kernel32 0 1
imp 'MapUserPhysicalPages' MapUserPhysicalPages kernel32 0
imp 'MapUserPhysicalPagesScatter' MapUserPhysicalPagesScatter kernel32 986
@ -1024,7 +1023,6 @@ imp 'UTUnRegister' UTUnRegister kernel32 1459
imp 'UmsThreadYield' UmsThreadYield kernel32 1460
imp 'UnhandledExceptionFilter' UnhandledExceptionFilter kernel32 0
imp 'UnlockFile' UnlockFile kernel32 0 5
imp 'UnlockFileEx' UnlockFileEx kernel32 0 5
imp 'UnmapViewOfFile2' UnmapViewOfFile2 kernel32 0 2
imp 'UnmapViewOfFileEx' UnmapViewOfFileEx kernel32 0 3
imp 'UnregisterApplicationRecoveryCallback' UnregisterApplicationRecoveryCallback kernel32 1466
@ -1120,6 +1118,7 @@ imp '__FlushViewOfFile' FlushViewOfFile kernel32 0 2
imp '__GenerateConsoleCtrlEvent' GenerateConsoleCtrlEvent kernel32 0 2
imp '__GetExitCodeProcess' GetExitCodeProcess kernel32 0 2
imp '__GetFileAttributes' GetFileAttributesW kernel32 0 1
imp '__LockFileEx' LockFileEx kernel32 0 6
imp '__MapViewOfFileEx' MapViewOfFileEx kernel32 0 6
imp '__MapViewOfFileExNuma' MapViewOfFileExNuma kernel32 0 7
imp '__MoveFileEx' MoveFileExW kernel32 0 3
@ -1128,6 +1127,7 @@ imp '__ReOpenFile' ReOpenFile kernel32 0 4 # TODO(jart): 6.2 and highe
imp '__RemoveDirectory' RemoveDirectoryW kernel32 0 1
imp '__SetCurrentDirectory' SetCurrentDirectoryW kernel32 0 1
imp '__TerminateProcess' TerminateProcess kernel32 0 2
imp '__UnlockFileEx' UnlockFileEx kernel32 0 5
imp '__UnmapViewOfFile' UnmapViewOfFile kernel32 0 1
imp '__VirtualProtect' VirtualProtect kernel32 0 4
imp '__WaitForMultipleObjects' WaitForMultipleObjects kernel32 0 4