fix(libkernel): map EPIPE on Linux and test send with MSG_NOSIGNAL on a closed peer

Case and test by hikazey in the PR thread.

Co-authored-by: hikazey <hikazey@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Adrià Franch
2026-10-08 12:36:58 +02:00
parent a2f9a50985
commit 065280d58d
2 changed files with 6 additions and 0 deletions
@@ -82,6 +82,7 @@ int NativeError() {
case ETIMEDOUT: return 60;
case EINTR: return 4;
case EINVAL: return 22;
case EPIPE: return 32;
default: return 5;
}
#endif
+5
View File
@@ -55,6 +55,11 @@ int main() {
Require(std::strcmp(request, received) == 0);
Require(close_nid_postfix(accepted) == 0);
#ifndef _WIN32
std::int64_t sent = 0;
for (int i = 0; i < 100 && sent >= 0; ++i) sent = send_nid_postfix(client, request, sizeof(request), 0x20000);
Require(sent == -1 && *__error_nid_postfix() == 32);
#endif
Require(close_nid_postfix(client) == 0);
Require(close_nid_postfix(listener) == 0);
Require(close_nid_postfix(listener) == -1 && *__error_nid_postfix() == 9);