fix(libkernel): set O_ASYNC through ioctl FIOASYNC on files, directories and the random device, as FreeBSD 11.4 does #22295
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22295"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by brajankw on 2026-11-17T11:20:21Z.
What
ioctl(fd, FIOASYNC, &on)threw on files, directories, pipes and devices, because the request had no case in the descriptor ioctl; a kqueue already failed it withENOTTY. FreeBSD 11.4'skern_ioctlsets or clearsFASYNCin the file's flags from the argument (sys/kern/sys_generic.c:828-834). It then asks the file's own handler, and herevn_ioctlreturns 0 forVREGandVDIR(sys/kern/vfs_vnops.c), and so doesrandomdev_ioctlfor the random device (sys/dev/random/randomdev.c:306-310).F_GETFLthen reportsO_ASYNC. The request now goes through the same status change asF_SETFLwithO_ASYNC:it is recorded on files (app0.zar files included), directories and the random device;
setting it still throws on a pipe, a host socket or another character device, as
O_ASYNCalready does there, sinceSIGIOis not delivered; clearing a flag that is not set succeeds.GuestKernelFcntl.cpp:FIOASYNCon a file, a directory and/dev/urandomsets and clearsO_ASYNCinF_GETFL. A flag set through adupshows on the original and the reverse, as the status flags are shared. A null argument fails withEFAULT. On a pipe, clearing succeeds and setting still throws. The unknown-request throw check now usesFIODTYPE(0x4004667a) instead ofFIOASYNC.Debt fragment: a new
ioctl FIOASYNCentry under Functional, with the pipe and device gap first. Adding this to theioctl, _ioctlentry would have taken it past 1000 characters.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
main47b33132f9.ctest -R '^(guest_kernel_fcntl.*|guest_kernel_ioctl.*|guest_kernel_app_archive.*)$': 6 passed.main, the new test aborts withioctl: request 0x8004667D on a file is not implemented.ctest(6000 tests,-j 12) on this branch and my other five branches of this round, merged ontomain47b33132f9: 5985 passed. All 15 failures also fail onmainin the same environment:.gitdirectory, network access or a passwd entry for the user:conventions_git_errors,test_script_registration,web_library_assets,title_run,title_run_identity,guest_kernel_sys_login,guest_net_ctl,guest_getloginandguest_getlogin_no_session;agc_drivercases (agc_driver_image_table_packed_guardspasses when run on its own).python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch:DescriptorControl.cpp, and #18457 adds a call next to mine inmain()ofGuestKernelFcntl.cpp. Neither handlesFIOASYNC, so both conflicts are only textual.main; none handlesFIOASYNC.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T11:30:52Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
4b9393b5e0:tools/check_conventions.pypassed.guest_kernel_fcntl_testsbuilt cleanly.guest_kernel_fcntl):core/libs/prx/libkernel/File/src/DescriptorControl.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me