mirror of https://github.com/mkerrisk/man-pages
aio.7: Improve example
When aio_sigevent.sigev_notify is set to SIGEV_SIGNAL, signal handlers called for asynchronous I/O operations will have si->si_code set to SI_ASYNCIO. Check to make sure that si->si_value.sival_ptr is defined. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
555c23c278
commit
148c6e74c0
12
man7/aio.7
12
man7/aio.7
|
@ -282,12 +282,14 @@ quitHandler(int sig)
|
|||
static void /* Handler for I/O completion signal */
|
||||
aioSigHandler(int sig, siginfo_t *si, void *ucontext)
|
||||
{
|
||||
write(STDOUT_FILENO, "I/O completion signal received\\n", 31);
|
||||
if (si->si_code == SI_ASYNCIO) {
|
||||
write(STDOUT_FILENO, "I/O completion signal received\\n", 31);
|
||||
|
||||
/* The corresponding ioRequest structure would be available as
|
||||
struct ioRequest *ioReq = si\->si_value.sival_ptr;
|
||||
and the file descriptor would then be available via
|
||||
ioReq\->aiocbp\->aio_fildes */
|
||||
/* The corresponding ioRequest structure would be available as
|
||||
struct ioRequest *ioReq = si\->si_value.sival_ptr;
|
||||
and the file descriptor would then be available via
|
||||
ioReq\->aiocbp\->aio_fildes */
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue