fix(libkernel): inherit listener mode on accepted sockets #3958

Merged
MarcZX10 merged 1 commit from upstream-pr/3958 into main 2026-10-13 02:36:27 +00:00
MarcZX10 commented 2026-10-11 19:54:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T19:54:44Z.


What

Carries Hussein Kadhim's fix for #3938, preserving the original commit author. Accepted sockets now inherit the listener's tracked non-blocking mode, keeping fcntl(F_GETFL) and the actual socket behavior consistent. The new test covers blocking and non-blocking listeners, accepted socket flags, and non-blocking receive behavior.

Tested

  • Linux x86-64, GCC 12.2.0, Release, BUILD_TESTING=ON, on current main 4be9c255: built guest_tcp_tests; guest_tcp passed 1/1.
  • The issue author reports the new case fails on the unmodified Windows branch and passes with the fix, with checks through fcntl, FIONBIO, descriptor duplication, recv, and poll.
  • tools/check_conventions.py --base upstream/main and git diff --check passed.
  • No title run reported.

Checklist

  • Based on current main; no other open PR implements this behavior
  • One topic per PR; follow-ups go in a new PR
  • No source comments added
  • Unsupported paths retain explicit errors
  • No investigation notes added
  • No new third-party code
  • Generic behavior, not title-specific
  • Depends on: none
  • AI-assisted: yes; original contributor's commit and attribution preserved
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821885160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3958). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T19:54:44Z. --- ### What Carries Hussein Kadhim's fix for #3938, preserving the original commit author. Accepted sockets now inherit the listener's tracked non-blocking mode, keeping `fcntl(F_GETFL)` and the actual socket behavior consistent. The new test covers blocking and non-blocking listeners, accepted socket flags, and non-blocking receive behavior. ### Tested - Linux x86-64, GCC 12.2.0, Release, `BUILD_TESTING=ON`, on current `main` `4be9c255`: built `guest_tcp_tests`; `guest_tcp` passed 1/1. - The issue author reports the new case fails on the unmodified Windows branch and passes with the fix, with checks through `fcntl`, `FIONBIO`, descriptor duplication, `recv`, and `poll`. - `tools/check_conventions.py --base upstream/main` and `git diff --check` passed. - No title run reported. ### Checklist - [x] Based on current `main`; no other open PR implements this behavior - [x] One topic per PR; follow-ups go in a new PR - [x] No source comments added - [x] Unsupported paths retain explicit errors - [x] No investigation notes added - [x] No new third-party code - [x] Generic behavior, not title-specific - [x] Depends on: none - [x] AI-assisted: yes; original contributor's commit and attribution preserved
LeandroLP23 commented 2026-10-11 20:43:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-11T20:43:55Z.


Windows run of this head (e887133ed, on main 12c226628): Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, full build.

  • guest_tcp, guest_udp, guest_socket_read_write, guest_poll, guest_socket_pair, guest_dup and guest_socket_events: 7/7 pass in 3 runs.
  • With Udp.cpp reverted to main, guest_tcp aborts (0xc0000409) in the new AcceptedSocketsFollowListenerBlocking test, so on Windows the test catches the bug and the fix is what makes it pass.
  • Merge note: this PR, #3947 and #3957 each add their test call at the top of main() in GuestTcp.cpp, so any two of them conflict there (Udp.cpp merges cleanly). The second and third to land will need a small rebase.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113549153 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3958#issuecomment-6113549153). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-11T20:43:55Z. --- Windows run of this head (`e887133ed`, on `main` `12c226628`): Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release, full build. - `guest_tcp`, `guest_udp`, `guest_socket_read_write`, `guest_poll`, `guest_socket_pair`, `guest_dup` and `guest_socket_events`: 7/7 pass in 3 runs. - With `Udp.cpp` reverted to `main`, `guest_tcp` aborts (`0xc0000409`) in the new `AcceptedSocketsFollowListenerBlocking` test, so on Windows the test catches the bug and the fix is what makes it pass. - Merge note: this PR, #3947 and #3957 each add their test call at the top of `main()` in `GuestTcp.cpp`, so any two of them conflict there (`Udp.cpp` merges cleanly). The second and third to land will need a small rebase.
oneandonlydean commented 2026-10-12 08:24:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:24:41Z.


Same as #3947: core/libs/tests/GuestTcp.cpp conflicts with main after #3957; please rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120528003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3958#issuecomment-6120528003). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T08:24:41Z. --- Same as #3947: `core/libs/tests/GuestTcp.cpp` conflicts with main after #3957; please rebase.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3958
No description provided.