summaryrefslogtreecommitdiffstats
path: root/source3/smbd/aio.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-25 05:26:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:10 -0500
commitbd9b6a249a6d58f37d2536de998c5b5719c3a85f (patch)
tree851a6cd77d319064d75bc8a9a917292d5afee563 /source3/smbd/aio.c
parent844290e9a02c4eb6013002c8d9e26356530b0f40 (diff)
downloadsamba-bd9b6a249a6d58f37d2536de998c5b5719c3a85f.tar.gz
samba-bd9b6a249a6d58f37d2536de998c5b5719c3a85f.tar.xz
samba-bd9b6a249a6d58f37d2536de998c5b5719c3a85f.zip
r11283: Move to using sival_int from sival_ptr. Part of bug #2922.
Jeremy. (This used to be commit f68ff32630ee3b06b69bac59674ecc1496880a47)
Diffstat (limited to 'source3/smbd/aio.c')
-rw-r--r--source3/smbd/aio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index af1f172b924..c71c3740433 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -155,7 +155,7 @@ static uint16 aio_pending_array[AIO_PENDING_SIZE];
static void signal_handler(int sig, siginfo_t *info, void *unused)
{
if (signals_received < AIO_PENDING_SIZE - 1) {
- aio_pending_array[signals_received] = *(uint16 *)(info->si_value.sival_ptr);
+ aio_pending_array[signals_received] = info->si_value.sival_int;
signals_received++;
} /* Else signal is lost. */
sys_select_signal(RT_SIGNAL_AIO);
@@ -248,7 +248,7 @@ BOOL schedule_aio_read_and_X(connection_struct *conn,
a->aio_offset = startpos;
a->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
- a->aio_sigevent.sigev_value.sival_ptr = (void *)&aio_ex->mid;
+ a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
if (SMB_VFS_AIO_READ(fsp,a) == -1) {
DEBUG(0,("schedule_aio_read_and_X: aio_read failed. Error %s\n",
@@ -327,7 +327,7 @@ BOOL schedule_aio_write_and_X(connection_struct *conn,
a->aio_offset = startpos;
a->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
a->aio_sigevent.sigev_signo = RT_SIGNAL_AIO;
- a->aio_sigevent.sigev_value.sival_ptr = (void *)&aio_ex->mid;
+ a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
if (SMB_VFS_AIO_WRITE(fsp,a) == -1) {
DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. Error %s\n",
@@ -642,10 +642,16 @@ BOOL wait_for_aio_completion(files_struct *fsp)
/* One or more events might have completed - process them if so. */
for( i = 0; i < aio_completion_count; i++) {
- uint16 mid = *(uint16 *)aiocb_list[i]->aio_sigevent.sigev_value.sival_ptr;
+ uint16 mid = aiocb_list[i]->aio_sigevent.sigev_value.sival_int;
aio_ex = find_aio_ex(mid);
+ if (!aio_ex) {
+ DEBUG(0, ("wait_for_aio_completion: mid %u doesn't match an aio record\n",
+ (unsigned int)mid ));
+ continue;
+ }
+
if (!handle_aio_completed(aio_ex, &err)) {
continue;
}