I trussed a process, and they are lines as below. And I want to know the definition of kaio, but there is no manual entry for kaio, so whether can I get the definition?
/1: kaio(AIOWRITE, 259, 0x3805B2A00, 8704, 0x099C9E000755D3C0) = 0 /1: kaio(AIOWRITE, 259, 0x380CF9200, 14336, 0x099CC0000755D5B8) = 0 /1: kaio(AIOWRITE, 259, 0x381573600, 8704, 0x099CF8000755D7B0) = 0 /1: kaio(AIOWRITE, 259, 0x381ACA600, 8192, 0x099D1A000755D9A8) = 0 /1: kaio(AIOWAIT, 0xFFFFFFFF7FFFD620) = 4418032576 /1: timeout: 600.000000 sec /1: kaio(AIOWAIT, 0xFFFFFFFF7FFFD620) = 4418033080开发者_StackOverflow社区 /1: timeout: 600.000000 sec /1: kaio(AIOWAIT, 0xFFFFFFFF7FFFD620) = 4418033584 /1: timeout: 600.000000 sec
From an article about it:
What kaio does, as the name implies, is implement async I/O inside the kernel rather than in user-land via user threads. The I/O queue is created and managed in the operating system. The basic sequence of events is as follows: When an application calls aioread(3) or aiowrite(3), the corresponding library routine is entered. Once entered, the library first tries to process the request via kaio. A kaio initialization routine is executed, which creates a "cleanup" thread, which is intended to ensure that there are no remaining memory segments that have been allocated but not freed during the async I/O process. Once that's complete, kaio is called, at which point a test is made to determine if kaio is supported for the requested I/O.
Kaio is implemented as a loadable kernel module, /kernel/sys/kaio, and is loaded the first time an async I/O is called. You can determine if the module is loaded or not with modinfo(1M):
fawlty> modinfo | grep kaio
105 608c4000 2efd 178 1 kaio (kernel Async I/O)
fawlty>
I get the answer:
it's defined in file /usr/include/sys/syscall.h
#define SYS_kaio 178 /* * subcodes: * aioread(...) :: kaio(AIOREAD, ...) * aiowrite(...) :: kaio(AIOWRITE, ...) * aiowait(...) :: kaio(AIOWAIT, ...) * aiocancel(...) :: kaio(AIOCANCEL, ...) * aionotify() :: kaio(AIONOTIFY) * aioinit() :: kaio(AIOINIT) * aiostart() :: kaio(AIOSTART) * see */
精彩评论