Problems with aio_read
Problems with aio_read
- Subject: Problems with aio_read
- From: Richard Schmitt <email@hidden>
- Date: Sat, 11 Oct 2008 05:50:42 -0700 (PDT)
I'm trying to use aio_read in an application and am having problems with the completion notifications.
When I use signals, I'll get a signal for the completion, but the siginfo structure does not have the si_value filled in.
When I use notify functions, the aio_read call fails with invalid argument.
Here's some sample code:
my_action.sa_sigaction = my_handler ;
my_action.sa_flags = SA_SIGINFO ;
sigaction (SIGIO, &my_action, NULL) ;
cb = malloc (sizeof (struct aiocb)) ;
memset (cb, '\0', sizeof (struct aiocb)) ;
cb->aio_fildes = open ("sigtest.c", O_NONBLOCK) ;
cb->aio_buf = malloc (1001) ;
cb->aio_nbytes = 1001 ;
cb->aio_offset = 0 ;
cb->aio_sigevent.sigev_value.sival_ptr = cb ;
cb->aio_sigevent.sigev_signo = SIGIO ;
cb->aio_sigevent.sigev_notify = SIGEV_SIGNAL ;
ret = aio_read (cb) ;
When the IO completes, I expect a SIGIO signal and the siginfo structure passed to my_handler will have the si_value set to the cb. The example handler is below:
void my_handler (int sig, siginfo_t *siginfo, void* context)
{
struct aiocb *cb ;
cb = siginfo->si_value.sival_ptr ;
cb is always NULL.
I'm running OSX 10.4.11
Thanks,
Rich
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden