summaryrefslogtreecommitdiff
path: root/rt/lio_listio.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-15 18:14:36 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-15 18:14:36 +0000
commit3a9eb648bb714d69623bf0344ae3e6c69b6237f1 (patch)
treee0eef1f13257d67e2402a228f6f5cae0a773bbd2 /rt/lio_listio.c
parent0cc70fcf82fefca2d186af4de0b6625a62dd31a0 (diff)
downloadglibc-3a9eb648bb714d69623bf0344ae3e6c69b6237f1.tar.gz
Update.
1999-08-15 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/aio_sigqueue.c: Take extra parameter and initialize si_pid from it. * sysdeps/generic/aio_sigqueue.c (__aio_sigqueue): Take extra parameter. * rt/aio_misc.c (__aio_enqueue_request): Initialize caller_pid. * rt/aio_misc.h (struct waitlist): Add caller_pid element. (struct requestlist): Likewise. Adjust prototypes of __aio_notify_only and __aio_sigqueue. * rt/notify.c (__aio_notify_only): Take extra parameter. Pass it to __aio_sigqueue. (__aio_notify): Pass caller PID to __aio_notify_only. * rt/aio_suspend.c: Initialize caller_pid. * rt/lio_listio.c: Likewise. * rt/lio_listio64.c: Likewise. * rt/lio_listio.c: If nothing has to be done free mutex before signalling. * rt/lio_listio64.c: Likewise.
Diffstat (limited to 'rt/lio_listio.c')
-rw-r--r--rt/lio_listio.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/rt/lio_listio.c b/rt/lio_listio.c
index 03c3bf2f6b..13d1b79a58 100644
--- a/rt/lio_listio.c
+++ b/rt/lio_listio.c
@@ -1,5 +1,5 @@
/* Enqueue and list of read or write requests.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -21,6 +21,7 @@
#include <aio.h>
#include <errno.h>
#include <stdlib.h>
+#include <unistd.h>
#include "aio_misc.h"
@@ -77,8 +78,17 @@ lio_listio (mode, list, nent, sig)
{
/* We don't have anything to do except signalling if we work
asynchronously. */
+
+ /* Release the mutex. We do this before raising a signal since the
+ signal handler might do a `siglongjmp' and then the mutex is
+ locked forever. */
+ pthread_mutex_unlock (&__aio_requests_mutex);
+
if (mode == LIO_NOWAIT)
- __aio_notify_only (sig);
+ __aio_notify_only (sig,
+ sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0);
+
+ return result;
}
else if (mode == LIO_WAIT)
{
@@ -95,6 +105,7 @@ lio_listio (mode, list, nent, sig)
waitlist[cnt].next = requests[cnt]->waiting;
waitlist[cnt].counterp = &total;
waitlist[cnt].sigevp = NULL;
+ waitlist[cnt].caller_pid = 0; /* Not needed. */
requests[cnt]->waiting = &waitlist[cnt];
++total;
}
@@ -130,6 +141,7 @@ lio_listio (mode, list, nent, sig)
}
else
{
+ pid_t caller_pid = sig->sigev_notify == SIGEV_SIGNAL ? getpid () : 0;
total = 0;
for (cnt = 0; cnt < nent; ++cnt)
@@ -140,6 +152,7 @@ lio_listio (mode, list, nent, sig)
waitlist->list[cnt].next = requests[cnt]->waiting;
waitlist->list[cnt].counterp = &waitlist->counter;
waitlist->list[cnt].sigevp = &waitlist->sigev;
+ waitlist->list[cnt].caller_pid = caller_pid;
requests[cnt]->waiting = &waitlist->list[cnt];
++total;
}