Skip to content

Commit 3370889

Browse files
committed
Export the four names openkal.exec calls, and refuse for one reason
Two failures, both from the conformance run this change made selective. ⚠️ `VirtualAlloc', `VirtualProtect', `VirtualFree' and `FlushInstructionCache' were declared in src/win32.h and exported by no `.def'. This package's own check says so in as many words --- "declared in src/win32.h and exported by no .def" --- and it is the check that exists because an import library here is a list of names rather than code, so a name absent from the list is a link that finds nothing on a machine without a vendor SDK. ⚠️⚠️ AND `kal_timeout_read' UPON THE STANDARD INPUT HAD TWO REFUSALS WHERE THE INTERFACE HAS ONE. An earlier form answered a null or invalid handle with `kal_err_invalid' and a valid non-socket with `kal_err_not_supported'; a run whose standard input is not attached has a handle of zero, so both bounded reads in the suite were reported as not holding. ⭐ The early return was answering a DIFFERENT QUESTION. "Is this handle valid" is what the unbounded operation answers. What this interface answers is whether this implementation can bound an operation upon this resource, and timeout.h sanctions exactly one refusal for that: "AN IMPLEMENTATION MAY PROVIDE THIS FOR SOME OF ITS RESOURCES AND NOT OTHERS, and reports kal_err_not_supported for the rest." A handle that is not a socket is one of the rest, and zero is not a socket. The name/export reading is also performed here before pushing, so that a round is not spent discovering a fifth name: 49 declared, 55 exported, none missing.
1 parent 1f6fcae commit 3370889

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

port/kernel32.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CreatePipe
1010
CreateProcessW
1111
CreateThread
1212
FlushFileBuffers
13+
FlushInstructionCache
1314
FreeEnvironmentStringsW
1415
GetCommandLineW
1516
GetConsoleMode
@@ -41,6 +42,9 @@ SetHandleInformation
4142
Sleep
4243
SwitchToThread
4344
TerminateProcess
45+
VirtualAlloc
46+
VirtualFree
47+
VirtualProtect
4448
WaitForSingleObject
4549
WideCharToMultiByte
4650
WriteFile

src/timeout.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,21 @@ int await(SOCKET s, short events, kal_u64 ns) {
7070
}
7171

7272
int await_stream(kal_stream s, short events, kal_u64 ns) {
73+
// ⚠️ ONE REASON TO REFUSE, AND NOT TWO. An earlier form answered a null or
74+
// invalid handle with `kal_err_invalid' and a valid non-socket with
75+
// `kal_err_not_supported', and the conformance suite reported both bounded
76+
// reads of the standard input as not holding: a run whose standard input is
77+
// not attached has a handle of zero, and the suite's list of admissible
78+
// answers is the interface's --- success, an expiry, or a refusal.
79+
//
80+
// ⭐ The early return was answering a DIFFERENT QUESTION. "Is this handle
81+
// valid" is what the unbounded operation answers; what this interface
82+
// answers is whether this implementation can bound an operation upon this
83+
// resource, and the header sanctions exactly one refusal for that: "AN
84+
// IMPLEMENTATION MAY PROVIDE THIS FOR SOME OF ITS RESOURCES AND NOT OTHERS,
85+
// and reports kal_err_not_supported for the rest." A handle that is not a
86+
// socket is one of the rest, and zero is not a socket.
7387
const SOCKET raw = static_cast<SOCKET>(s.h);
74-
if (raw == 0 || raw == INVALID_SOCKET) return kal_err_invalid;
7588
if (!is_socket(raw)) return kal_err_not_supported;
7689
return await(raw, events, ns);
7790
}

0 commit comments

Comments
 (0)