site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com 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) ; void my_handler (int sig, siginfo_t *siginfo, void* context) { struct aiocb *cb ; cb = siginfo->si_value.sival_ptr ; cb is always NULL. -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Oct 11, 2008, at 5:50 AM, Richard Schmitt <rschmitt@bluepeach.com> wrote: 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. 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: I'm running OSX 10.4.11 The aio implementation in 10.4 is not fully POSIX conformant. If your code needs full POSIX conformance, it should be including <unistd.h> and checking _POSIX_ASYNCHRONUS_IO has a value greater than or equal to 200112L before using the interface. There are a number of workaround that you could use if you wanted to run on something as old as 10.4, but you would need to explain the problem you are trying to solve for us to tell you which ones might be appropriate. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert