mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-18 14:40:06 +00:00
[BZ #5208]
2007-10-23 Andreas Jaeger <aj@suse.de> [BZ #5208] * sysdeps/unix/sysv/linux/readahead.c (__readahead): Use __LONG_LONG_PAIR to handle little endian byte order. Suggested by abhishekrai@google.com
This commit is contained in:
parent
666aa0201b
commit
ad3371fbac
@ -1,3 +1,10 @@
|
|||||||
|
2007-10-23 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
|
[BZ #5208]
|
||||||
|
* sysdeps/unix/sysv/linux/readahead.c (__readahead): Use
|
||||||
|
__LONG_LONG_PAIR to handle little endian byte order.
|
||||||
|
Suggested by abhishekrai@google.com
|
||||||
|
|
||||||
2007-10-27 Ulrich Drepper <drepper@redhat.com>
|
2007-10-27 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* malloc/arena.c [!NO_THREADS]: Use ATFORK_MEM if defined.
|
* malloc/arena.c [!NO_THREADS]: Use ATFORK_MEM if defined.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Basic platform-independent macro definitions for mutexes,
|
/* Basic platform-independent macro definitions for mutexes,
|
||||||
thread-specific data and parameters for malloc.
|
thread-specific data and parameters for malloc.
|
||||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
Copyright (C) 2003, 2007 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -38,13 +38,24 @@ extern void *__dso_handle __attribute__ ((__weak__));
|
|||||||
|
|
||||||
#include <fork.h>
|
#include <fork.h>
|
||||||
|
|
||||||
|
#define ATFORK_MEM static struct fork_handler atfork_mem
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
# define thread_atfork(prepare, parent, child) \
|
# define thread_atfork(prepare, parent, child) \
|
||||||
__register_atfork (prepare, parent, child, __dso_handle)
|
atfork_mem.prepare_handler = prepare; \
|
||||||
|
atfork_mem.parent_handler = parent; \
|
||||||
|
atfork_mem.child_handler = child; \
|
||||||
|
atfork_mem.dso_handle = __dso_handle; \
|
||||||
|
atfork_mem.refcntr = 1; \
|
||||||
|
__linkin_atfork (&atfork_mem)
|
||||||
#else
|
#else
|
||||||
# define thread_atfork(prepare, parent, child) \
|
# define thread_atfork(prepare, parent, child) \
|
||||||
__register_atfork (prepare, parent, child, \
|
atfork_mem.prepare_handler = prepare; \
|
||||||
&__dso_handle == NULL ? NULL : __dso_handle)
|
atfork_mem.parent_handler = parent; \
|
||||||
|
atfork_mem.child_handler = child; \
|
||||||
|
atfork_mem.dso_handle = &__dso_handle == NULL ? NULL : __dso_handle; \
|
||||||
|
atfork_mem.refcntr = 1; \
|
||||||
|
__linkin_atfork (&atfork_mem)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* thread specific data for glibc */
|
/* thread specific data for glibc */
|
||||||
|
@ -55,3 +55,6 @@ extern int __register_atfork (void (*__prepare) (void),
|
|||||||
void (*__child) (void),
|
void (*__child) (void),
|
||||||
void *dso_handle);
|
void *dso_handle);
|
||||||
libc_hidden_proto (__register_atfork)
|
libc_hidden_proto (__register_atfork)
|
||||||
|
|
||||||
|
/* Add a new element to the fork list. */
|
||||||
|
extern void __linkin_atfork (struct fork_handler *newp) attribute_hidden;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fork.h>
|
#include <fork.h>
|
||||||
|
#include <atomic.h>
|
||||||
|
|
||||||
|
|
||||||
/* Lock to protect allocation and deallocation of fork handlers. */
|
/* Lock to protect allocation and deallocation of fork handlers. */
|
||||||
@ -109,6 +110,17 @@ __register_atfork (prepare, parent, child, dso_handle)
|
|||||||
libc_hidden_def (__register_atfork)
|
libc_hidden_def (__register_atfork)
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
attribute_hidden
|
||||||
|
__linkin_atfork (struct fork_handler *newp)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
newp->next = __fork_handlers;
|
||||||
|
while (catomic_compare_and_exchange_bool_acq (&__fork_handlers,
|
||||||
|
newp, newp->next) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
libc_freeres_fn (free_mem)
|
libc_freeres_fn (free_mem)
|
||||||
{
|
{
|
||||||
/* Get the lock to not conflict with running forks. */
|
/* Get the lock to not conflict with running forks. */
|
||||||
|
@ -67,10 +67,21 @@ __unregister_atfork (dso_handle)
|
|||||||
It's a single linked list so readers are. */
|
It's a single linked list so readers are. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
again:
|
||||||
if (runp->dso_handle == dso_handle)
|
if (runp->dso_handle == dso_handle)
|
||||||
{
|
{
|
||||||
if (lastp == NULL)
|
if (lastp == NULL)
|
||||||
__fork_handlers = runp->next;
|
{
|
||||||
|
/* We have to use an atomic operation here because
|
||||||
|
__linkin_atfork also uses one. */
|
||||||
|
if (catomic_compare_and_exchange_bool_acq (&__fork_handlers,
|
||||||
|
runp->next, runp)
|
||||||
|
!= 0)
|
||||||
|
{
|
||||||
|
runp = __fork_handlers;
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
lastp->next = runp->next;
|
lastp->next = runp->next;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Provide kernel hint to read ahead.
|
/* Provide kernel hint to read ahead.
|
||||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -30,8 +30,10 @@
|
|||||||
ssize_t
|
ssize_t
|
||||||
__readahead (int fd, off64_t offset, size_t count)
|
__readahead (int fd, off64_t offset, size_t count)
|
||||||
{
|
{
|
||||||
return INLINE_SYSCALL (readahead, 4, fd, (off_t) (offset >> 32),
|
return INLINE_SYSCALL (readahead, 4, fd,
|
||||||
(off_t) (offset & 0xffffffff), count);
|
__LONG_LONG_PAIR ((off_t) (offset >> 32),
|
||||||
|
(off_t) (offset & 0xffffffff)),
|
||||||
|
count);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ssize_t
|
ssize_t
|
||||||
|
Loading…
Reference in New Issue
Block a user