mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
lio_listio should emit an event for each individual request in
addition to the global event. * sysdeps/pthread/lio_listio.c (lio_listio): Renamed to lio_listio_internal. Remove mode parameter check. Only set sigevent type ti SIGEV_NONE if LIO_NO_INDIVIDUAL_EVENT is set. (__lio_listio_21): New function. Compatiblity version which sets LIO_NO_INDIVIDUAL_EVENT before calling lio_listio_internal. (__lio_listio_item_notify): New function. * sysdeps/pthread/lio_listio64.c: Define __lio_listio_21 and __lio_listio_item_notify macros. * sysdeps/pthread/Versions: New file. * rt/tst-aio2.c: Adjust test for new semantics of lio_listio. * include/aio.h: Define LIO_NO_INDIVIDUAL_EVENT. * Versions.def: Add GLIBC_2.4 for librt. * rt/Versions: Whitespace fix. * sysdeps/pthread/aio_misc.c: Likewise.
This commit is contained in:
18
ChangeLog
18
ChangeLog
@ -1,5 +1,23 @@
|
|||||||
2006-01-03 Ulrich Drepper <drepper@redhat.com>
|
2006-01-03 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
lio_listio should emit an event for each individual request in
|
||||||
|
addition to the global event.
|
||||||
|
* sysdeps/pthread/lio_listio.c (lio_listio): Renamed to
|
||||||
|
lio_listio_internal. Remove mode parameter check. Only set sigevent
|
||||||
|
type ti SIGEV_NONE if LIO_NO_INDIVIDUAL_EVENT is set.
|
||||||
|
(__lio_listio_21): New function. Compatiblity version which sets
|
||||||
|
LIO_NO_INDIVIDUAL_EVENT before calling lio_listio_internal.
|
||||||
|
(__lio_listio_item_notify): New function.
|
||||||
|
* sysdeps/pthread/lio_listio64.c: Define __lio_listio_21 and
|
||||||
|
__lio_listio_item_notify macros.
|
||||||
|
* sysdeps/pthread/Versions: New file.
|
||||||
|
* rt/tst-aio2.c: Adjust test for new semantics of lio_listio.
|
||||||
|
* include/aio.h: Define LIO_NO_INDIVIDUAL_EVENT.
|
||||||
|
* Versions.def: Add GLIBC_2.4 for librt.
|
||||||
|
|
||||||
|
* rt/Versions: Whitespace fix.
|
||||||
|
* sysdeps/pthread/aio_misc.c: Likewise.
|
||||||
|
|
||||||
* nscd/connections.c (nscd_init): Remove if block which should
|
* nscd/connections.c (nscd_init): Remove if block which should
|
||||||
have been removed as part of the -S option removal.
|
have been removed as part of the -S option removal.
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ librt {
|
|||||||
GLIBC_2.3
|
GLIBC_2.3
|
||||||
GLIBC_2.3.3
|
GLIBC_2.3.3
|
||||||
GLIBC_2.3.4
|
GLIBC_2.3.4
|
||||||
|
GLIBC_2.4
|
||||||
}
|
}
|
||||||
libutil {
|
libutil {
|
||||||
GLIBC_2.0
|
GLIBC_2.0
|
||||||
|
@ -3,4 +3,10 @@
|
|||||||
|
|
||||||
/* Now define the internal interfaces. */
|
/* Now define the internal interfaces. */
|
||||||
extern void __aio_init (__const struct aioinit *__init);
|
extern void __aio_init (__const struct aioinit *__init);
|
||||||
|
|
||||||
|
/* Flag to signal we need to be copmatible with glibc < 2.4 in
|
||||||
|
lio_listio and we do not issue events for each individual list
|
||||||
|
element. */
|
||||||
|
#define LIO_NO_INDIVIDUAL_EVENT 128
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Test for notification mechanism in lio_listio.
|
/* Test for notification mechanism in lio_listio.
|
||||||
Copyright (C) 2000,02 Free Software Foundation, Inc.
|
Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
|
||||||
|
|
||||||
@ -25,13 +25,19 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
int flag;
|
|
||||||
|
static pthread_barrier_t b;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
thrfct (sigval_t arg)
|
thrfct (sigval_t arg)
|
||||||
{
|
{
|
||||||
flag = 1;
|
int e = pthread_barrier_wait (&b);
|
||||||
|
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
|
||||||
|
{
|
||||||
|
puts ("thread: barrier_wait failed");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +59,12 @@ do_test (int argc, char *argv[])
|
|||||||
|
|
||||||
unlink (name);
|
unlink (name);
|
||||||
|
|
||||||
|
if (pthread_barrier_init (&b, NULL, 2) != 0)
|
||||||
|
{
|
||||||
|
puts ("barrier_init failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
arr[0] = &cb;
|
arr[0] = &cb;
|
||||||
|
|
||||||
cb.aio_fildes = fd;
|
cb.aio_fildes = fd;
|
||||||
@ -77,9 +89,12 @@ do_test (int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag != 0)
|
puts ("lio_listio returned");
|
||||||
|
|
||||||
|
int e = pthread_barrier_wait (&b);
|
||||||
|
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
|
||||||
{
|
{
|
||||||
puts ("thread created, should not have happened");
|
puts ("barrier_wait failed");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
sysdeps/pthread/Versions
Normal file
5
sysdeps/pthread/Versions
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
librt {
|
||||||
|
GLIBC_2.4 {
|
||||||
|
lio_listio; lio_listio64;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/* Handle general operations.
|
/* Handle general operations.
|
||||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
|
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
@ -47,7 +47,6 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
|
|||||||
(void) pthread_attr_destroy (&attr);
|
(void) pthread_attr_destroy (&attr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void add_request_to_runlist (struct requestlist *newrequest);
|
static void add_request_to_runlist (struct requestlist *newrequest);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Enqueue and list of read or write requests.
|
/* Enqueue and list of read or write requests.
|
||||||
Copyright (C) 1997,1998,1999,2000,2001,2003,2005
|
Copyright (C) 1997,1998,1999,2000,2001,2003,2005,2006
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
@ -31,6 +31,9 @@
|
|||||||
#define LIO_OPCODE_BASE 0
|
#define LIO_OPCODE_BASE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
|
|
||||||
/* We need this special structure to handle asynchronous I/O. */
|
/* We need this special structure to handle asynchronous I/O. */
|
||||||
struct async_waitlist
|
struct async_waitlist
|
||||||
{
|
{
|
||||||
@ -40,12 +43,22 @@ struct async_waitlist
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int
|
/* The code in glibc 2.1 to glibc 2.4 issued only one event when all
|
||||||
lio_listio (mode, list, nent, sig)
|
requests submitted with lio_listio finished. The existing practice
|
||||||
int mode;
|
is to issue events for the individual requests as well. This is
|
||||||
struct aiocb *const list[];
|
what the new code does. */
|
||||||
int nent;
|
#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
|
||||||
struct sigevent *sig;
|
# define LIO_MODE(mode) ((mode) & 127)
|
||||||
|
# define NO_INDIVIDUAL_EVENT_P(mode) ((mode) & 128)
|
||||||
|
#else
|
||||||
|
# define LIO_MODE(mode) mode
|
||||||
|
# define NO_INDIVIDUAL_EVENT_P(mode) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
lio_listio_internal (int mode, struct aiocb *const list[], int nent,
|
||||||
|
struct sigevent *sig)
|
||||||
{
|
{
|
||||||
struct sigevent defsigev;
|
struct sigevent defsigev;
|
||||||
struct requestlist *requests[nent];
|
struct requestlist *requests[nent];
|
||||||
@ -53,13 +66,6 @@ lio_listio (mode, list, nent, sig)
|
|||||||
volatile int total = 0;
|
volatile int total = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
/* Check arguments. */
|
|
||||||
if (mode != LIO_WAIT && mode != LIO_NOWAIT)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sig == NULL)
|
if (sig == NULL)
|
||||||
{
|
{
|
||||||
defsigev.sigev_notify = SIGEV_NONE;
|
defsigev.sigev_notify = SIGEV_NONE;
|
||||||
@ -74,7 +80,9 @@ lio_listio (mode, list, nent, sig)
|
|||||||
for (cnt = 0; cnt < nent; ++cnt)
|
for (cnt = 0; cnt < nent; ++cnt)
|
||||||
if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
|
if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
|
||||||
{
|
{
|
||||||
|
if (NO_INDIVIDUAL_EVENT_P (mode))
|
||||||
list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
|
list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
|
||||||
|
|
||||||
requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
|
requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
|
||||||
(list[cnt]->aio_lio_opcode
|
(list[cnt]->aio_lio_opcode
|
||||||
| LIO_OPCODE_BASE));
|
| LIO_OPCODE_BASE));
|
||||||
@ -100,7 +108,7 @@ lio_listio (mode, list, nent, sig)
|
|||||||
locked forever. */
|
locked forever. */
|
||||||
pthread_mutex_unlock (&__aio_requests_mutex);
|
pthread_mutex_unlock (&__aio_requests_mutex);
|
||||||
|
|
||||||
if (mode == LIO_NOWAIT)
|
if (LIO_MODE (mode) == LIO_NOWAIT)
|
||||||
{
|
{
|
||||||
#ifdef BROKEN_THREAD_SIGNALS
|
#ifdef BROKEN_THREAD_SIGNALS
|
||||||
__aio_notify_only (sig,
|
__aio_notify_only (sig,
|
||||||
@ -112,7 +120,7 @@ lio_listio (mode, list, nent, sig)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else if (mode == LIO_WAIT)
|
else if (LIO_MODE (mode) == LIO_WAIT)
|
||||||
{
|
{
|
||||||
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
||||||
struct waitlist waitlist[nent];
|
struct waitlist waitlist[nent];
|
||||||
@ -202,3 +210,38 @@ lio_listio (mode, list, nent, sig)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
|
||||||
|
int
|
||||||
|
attribute_compat_text_section
|
||||||
|
__lio_listio_21 (int mode, struct aiocb *const list[], int nent,
|
||||||
|
struct sigevent *sig)
|
||||||
|
{
|
||||||
|
/* Check arguments. */
|
||||||
|
if (mode != LIO_WAIT && mode != LIO_NOWAIT)
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lio_listio_internal (mode | LIO_NO_INDIVIDUAL_EVENT, list, nent, sig);
|
||||||
|
}
|
||||||
|
compat_symbol (librt, __lio_listio_21, lio_listio, GLIBC_2_1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
__lio_listio_item_notify (int mode, struct aiocb *const list[], int nent,
|
||||||
|
struct sigevent *sig)
|
||||||
|
{
|
||||||
|
/* Check arguments. */
|
||||||
|
if (mode != LIO_WAIT && mode != LIO_NOWAIT)
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lio_listio_internal (mode, list, nent, sig);
|
||||||
|
}
|
||||||
|
versioned_symbol (librt, __lio_listio_item_notify, lio_listio, GLIBC_2_4);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Enqueue and list of read or write requests, 64bit offset version.
|
/* Enqueue and list of read or write requests, 64bit offset version.
|
||||||
Copyright (C) 1997, 1998, 1999, 2003, 2005 Free Software Foundation, Inc.
|
Copyright (C) 1997,1998,1999,2003,2005,2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
@ -27,6 +27,8 @@
|
|||||||
#include <aio_misc.h>
|
#include <aio_misc.h>
|
||||||
|
|
||||||
#define lio_listio lio_listio64
|
#define lio_listio lio_listio64
|
||||||
|
#define __lio_listio_21 __lio_listio64_21
|
||||||
|
#define __lio_listio_item_notify __lio_listio64_item_notify
|
||||||
#define aiocb aiocb64
|
#define aiocb aiocb64
|
||||||
#define LIO_OPCODE_BASE 128
|
#define LIO_OPCODE_BASE 128
|
||||||
#include <lio_listio.c>
|
#include <lio_listio.c>
|
||||||
|
Reference in New Issue
Block a user