feat(libkernel_sys): implement POSIX AIO #9391
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9391"
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 GitamarT045T3R on 2026-10-21T20:18:29Z.
What
The eight POSIX AIO calls of libkernel_sys were
NotImplementedstubs. They now follow FreeBSD 11'svfs_aio.con the LP64struct aiocb(160 bytes,_aiocb_privateat 56,aio_sigeventat 80):aio_read,aio_write,aio_fsyncaio_aqueuestatus-1,error0 andkernelinfo-1 first;EAGAIN(stored) past 256 requests per process;EFAULTfor a nullaiocb;EINVAL(not stored) foraio_nbytesoverSSIZE_MAXor a signal number outside 1-128;EINVAL(stored) for asigev_notifyother thanNONE,SIGNAL,KEVENTorTHREAD_ID;EBADF(stored) for a closed descriptor or the wrong access mode;EINVALforaio_offset-1 (read, write) or a descriptor without a vnode (fsync); then a job id inkernelinfoandEINPROGRESSinerror;aio_lio_opcodeis ignoredaio_queue_filewithvfs.aio.enable_unsafe0EOPNOTSUPP(stored)aio_process_rw,aio_process_syncsceKernelPread,sceKernelPwriteorsceKernelFsyncataio_offset; a zero-byte read does no I/Oaio_fsynckern_aio_fsyncEINVALunlessopisO_SYNC(0x80)aio_errorkern_aio_errorEINVALbefore any request; the job's error orEINPROGRESS; for an unknownaiocb, its storederrorwhenstatusis -1, elseEINVAL(returned, not througherrno)aio_returnkern_aio_returnerrorandstatusback;-1with the job's error aserrno;EINVALotherwiseaio_suspendsys_aio_suspend,kern_aio_suspendEINVALfornentoutside 0-16 or a badtimespec;EAGAINbefore any request; returns once a listed job is finished or none is known;EAGAINon timeoutaio_cancelsys_aio_cancelEBADFfor a closed descriptor;AIO_NOTCANCELEDwhile a matching job is still running, elseAIO_ALLDONEaio_waitcompletekern_aio_waitcomplete{0, 0}polls, others are validated; takes finished jobs in completion order, waking when another thread completes oneA request runs to completion on the calling thread before
aio_read,aio_writeoraio_fsyncreturns. FreeBSD handles the same case, a queue callback that completes synchronously, inaio_aqueue. libkernel'ssceKernelAio*also completes on submission.SIGEV_SIGNAL, andSIGEV_THREAD_IDnaming the caller, raise the signal after completion through libkernel'sraise.SIGEV_KEVENT(libkernel has noEVFILT_AIO), requests on a socket, andSIGEV_THREAD_IDnaming another thread throw after the argument checks.The implementation is in a new
libkernel_sys/Aio.cpp, with the eight stubs removed fromExport.Discovery.cpp. The gaps are in a new libkernel_sys debt entry.Tested
Windows 10 Pro 22H2 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release,
BUILD_TESTING=ON, onmaincecb540a6:guest_kernel_sys_aiocovers:aio_returnand byaio_waitcomplete, with the stored fields checked after each;EOPNOTSUPP, andEINVALfromaio_fsync);SIGEV_KEVENTflag check;aio_fsyncon a read-only file and a directory;aio_suspendandaio_waitcompletetimeouts and validation, andaio_waitcompletewoken by a request from another thread;SIGEV_SIGNALandSIGEV_THREAD_IDdelivery to a guest handler.mainthe first call throwsaio_error_nid_postfix not implemented.guest_kernel_sysstill passes.python tools/check_conventions.py --base origin/mainpasses.fcntl,sceKernelFstat,sceKernelPread,sceKernelPwriteandsceKernelFsync.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 github-actions[bot] on 2026-10-21T20:19:24Z.
Progress report (
0c6a5bd→f1f90b2)📈 System libraries: 42.18% (+0.08%, +8 implemented functions)
✅ 8 implemented
aio_cancel_nid_postfixaio_error_nid_postfixaio_fsync_nid_postfixaio_read_nid_postfixaio_return_nid_postfixaio_suspend_nid_postfixaio_waitcomplete_nid_postfixaio_write_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T20:39:17Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel_sys/CMakeLists.txtL2core/libs/prx/libkernel_sys/CMakeLists.txtL2core/libs/prx/libkernel_sys/Aio.cppcore/libs/tests/GuestKernelSysAio.cppaio_cancelaio_erroraio_fsyncaio_readaio_returnaio_suspendaio_waitcompleteaio_writecore/libs/prx/libkernel_sys/Aio.cppcore/libs/tests/GuestKernelSysAio.cppSome comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel_sys.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtPull request closed