* inet/herrno.c (__h_errno_location): Remove.
	* inet/Makefile (routines): Add herrno-loc.
	* resolv/res_libc.c (__res_state): Remove.
	* resolv/Makefile (routines): Add res-state.
	* sysdeps/generic/herrno-loc.c: New file.
	* sysdeps/generic/res-state.c: New file.

2002-12-27  Jakub Jelinek  <jakub@redhat.com>
This commit is contained in:
Ulrich Drepper 2002-12-28 10:24:40 +00:00
parent afb2e95400
commit 270d9d4729
26 changed files with 371 additions and 151 deletions

View File

@ -1,3 +1,12 @@
2002-12-27 Jakub Jelinek <jakub@redhat.com>
* inet/herrno.c (__h_errno_location): Remove.
* inet/Makefile (routines): Add herrno-loc.
* resolv/res_libc.c (__res_state): Remove.
* resolv/Makefile (routines): Add res-state.
* sysdeps/generic/herrno-loc.c: New file.
* sysdeps/generic/res-state.c: New file.
2002-12-27 Jakub Jelinek <jakub@redhat.com> 2002-12-27 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER): * sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER):

View File

@ -30,7 +30,7 @@ distribute := netgroup.h
routines := htonl htons \ routines := htonl htons \
inet_lnaof inet_mkadr \ inet_lnaof inet_mkadr \
inet_netof inet_ntoa inet_net herrno \ inet_netof inet_ntoa inet_net herrno herrno-loc \
gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \ gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
gethstbynm_r gethstent gethstent_r \ gethstbynm_r gethstent gethstent_r \
getnetbyad getnetbyad_r getnetbynm getnetent getnetent_r \ getnetbyad getnetbyad_r getnetbynm getnetent getnetent_r \

View File

@ -42,11 +42,3 @@ compat_symbol (libc, h_errno, h_errno, GLIBC_2_0);
compat_symbol (libc, _h_errno, _h_errno, GLIBC_2_0); compat_symbol (libc, _h_errno, _h_errno, GLIBC_2_0);
# endif # endif
#endif #endif
/* When threaded, h_errno may be a per-thread variable. */
int *
weak_const_function
__h_errno_location (void)
{
return &h_errno;
}

View File

@ -1,5 +1,48 @@
2002-12-27 Jakub Jelinek <jakub@redhat.com> 2002-12-27 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/bits/libc-tsd.h: Include linuxthreads/descr.h
and bits/libc-lock.h.
(__libc_internal_tsd_get, __libc_internal_tsd_set,
__libc_internal_tsd_address): Remove.
(__pthread_internal_tsd_address, __pthread_internal_tsd_get,
__pthread_internal_tsd_set): New weak_externs.
(__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Define
using __libc_maybe_call2.
(__libc_tsd_key_t): Move to ...
* descr.h (__libc_tsd_key_t): ...here.
Remove bits/libc-tsd.h include.
* sysdeps/pthread/errno-loc.c: New file.
* sysdeps/pthread/herrno-loc.c: New file.
* sysdeps/pthread/res-state.c: New file.
* libc-cancellation.c (THREAD_GETMEM, THREAD_SETMEM): Remove.
(__libc_enable_asynccancel, __libc_disable_asynccancel): Use
thread_self unconditionally. Use LIBC_THREAD_[SG]ETMEM instead
of THREAD_[SG]ETMEM.
* specific.c (libc_internal_tsd_set): Renamed to...
__pthread_internal_tsd_set. Remove static.
(libc_internal_tsd_get): Renamed to...
__pthread_internal_tsd_get. Remove static.
(libc_internal_tsd_address): Renamed to...
__pthread_internal_tsd_address. Remove static.
(__libc_internal_tsd_set, __libc_internal_tsd_get,
__libc_internal_tsd_address, __libc_alloca_cutoff): Remove.
* internals.h [!NOT_IN_libc] (LIBC_THREAD_GETMEM, LIBC_THREAD_SETMEM):
Define.
(__pthread_internal_tsd_set, __pthread_internal_tsd_get,
__pthread_internal_tsd_address): New prototypes.
(struct pthread_functions): Add
ptr_pthread_internal_tsd_([sg]et|address) fields.
[!NOT_IN_libc && !FLOATING_STACKS] (thread_self): Define.
* pthread.c (pthread_functions) [!USE_TLS && !HAVE___THREAD]:
Initialize ptr_pthread_internal_tsd_([sg]et|address) fields.
* Versions (libpthread): Remove __libc_alloca_cutoff@GLIBC_PRIVATE.
* alloca_cutoff.c: New file.
* no-tsd.c: Removed.
* Makefile (routines): Remove no-tsd. Add alloca_cutoff.
* pt-system.c (system): Remove cancellation handling.
* tst-cancel-wrappers.sh: Allow pt-system.o* to not use the
cancellation routines.
* sysdeps/i386/tls.h: Include dl-sysdep.h and stdint.h. * sysdeps/i386/tls.h: Include dl-sysdep.h and stdint.h.
(tcbhead_t): Add sysinfo field. (tcbhead_t): Add sysinfo field.
(SYSINFO_OFFSET, INIT_SYSINFO): Define. (SYSINFO_OFFSET, INIT_SYSINFO): Define.

View File

@ -28,7 +28,7 @@ headers := pthread.h semaphore.h
distribute := internals.h queue.h restart.h spinlock.h smp.h tst-signal.sh \ distribute := internals.h queue.h restart.h spinlock.h smp.h tst-signal.sh \
tst-cancel-wrappers.sh libc-tsd.c tst-cancel-wrappers.sh libc-tsd.c
routines := forward no-tsd libc-cancellation libc_pthread_init routines := forward alloca_cutoff libc-cancellation libc_pthread_init
shared-only-routines = forward shared-only-routines = forward
extra-libs := libpthread extra-libs := libpthread

View File

@ -161,7 +161,7 @@ libpthread {
GLIBC_PRIVATE { GLIBC_PRIVATE {
# Internal libc interface to libpthread # Internal libc interface to libpthread
__libc_internal_tsd_get; __libc_internal_tsd_set; __libc_internal_tsd_get; __libc_internal_tsd_set;
__libc_internal_tsd_address; __libc_alloca_cutoff; __libc_internal_tsd_address;
__pthread_kill_other_threads_np; __pthread_kill_other_threads_np;
} }
} }

View File

@ -0,0 +1,35 @@
/* Determine whether block of given size can be allocated on the stack or not.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <alloca.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sysdep-cancel.h>
int
__libc_alloca_cutoff (size_t size)
{
if (! SINGLE_THREAD_P)
{
pthread_descr self = thread_self ();
return size <= LIBC_THREAD_GETMEM (self, p_alloca_cutoff);
}
return size <= __MAX_ALLOCA_CUTOFF;
}

View File

@ -23,8 +23,16 @@
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.h>
#include <hp-timing.h> #include <hp-timing.h>
#include <bits/libc-tsd.h> /* for _LIBC_TSD_KEY_N */
/* Fast thread-specific data internal to libc. */
enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
_LIBC_TSD_KEY_DL_ERROR,
_LIBC_TSD_KEY_RPC_VARS,
_LIBC_TSD_KEY_LOCALE,
_LIBC_TSD_KEY_CTYPE_B,
_LIBC_TSD_KEY_CTYPE_TOLOWER,
_LIBC_TSD_KEY_CTYPE_TOUPPER,
_LIBC_TSD_KEY_N };
/* The type of thread descriptors */ /* The type of thread descriptors */
typedef struct _pthread_descr_struct *pthread_descr; typedef struct _pthread_descr_struct *pthread_descr;

View File

@ -43,6 +43,17 @@
# define THREAD_SETMEM_NC(descr, member, value) descr->member = (value) # define THREAD_SETMEM_NC(descr, member, value) descr->member = (value)
#endif #endif
#ifndef NOT_IN_libc
# ifdef FLOATING_STACKS
# define LIBC_THREAD_GETMEM(descr, member) THREAD_GETMEM (descr, member)
# define LIBC_THREAD_SETMEM(descr, member, value) \
THREAD_SETMEM (descr, member, value)
# else
# define LIBC_THREAD_GETMEM(descr, member) descr->member
# define LIBC_THREAD_SETMEM(descr, member, value) descr->member = (value)
# endif
#endif
typedef void (*destr_function)(void *); typedef void (*destr_function)(void *);
struct pthread_key_struct { struct pthread_key_struct {
@ -430,6 +441,11 @@ extern void __linuxthreads_reap_event (void);
/* This function is called to initialize the pthread library. */ /* This function is called to initialize the pthread library. */
extern void __pthread_initialize (void); extern void __pthread_initialize (void);
/* TSD. */
extern int __pthread_internal_tsd_set (int key, const void * pointer);
extern void * __pthread_internal_tsd_get (int key);
extern void ** __attribute__ ((__const__))
__pthread_internal_tsd_address (int key);
/* Sighandler wrappers. */ /* Sighandler wrappers. */
extern void __pthread_sighandler(int signo, SIGCONTEXT ctx); extern void __pthread_sighandler(int signo, SIGCONTEXT ctx);
@ -504,10 +520,24 @@ struct pthread_functions
int (*ptr_pthread_setcanceltype) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *);
void (*ptr_pthread_do_exit) (void *retval, char *currentframe); void (*ptr_pthread_do_exit) (void *retval, char *currentframe);
pthread_descr (*ptr_pthread_thread_self) (void); pthread_descr (*ptr_pthread_thread_self) (void);
int (*ptr_pthread_internal_tsd_set) (int key, const void * pointer);
void * (*ptr_pthread_internal_tsd_get) (int key);
void ** __attribute__ ((__const__))
(*ptr_pthread_internal_tsd_address) (int key);
}; };
/* Variable in libc.so. */ /* Variable in libc.so. */
extern struct pthread_functions __libc_pthread_functions attribute_hidden; extern struct pthread_functions __libc_pthread_functions attribute_hidden;
extern int * __libc_pthread_init (const struct pthread_functions *functions); extern int * __libc_pthread_init (const struct pthread_functions *functions);
#if !defined NOT_IN_libc && !defined FLOATING_STACKS
# ifdef SHARED
# define thread_self() \
(*__libc_pthread_functions.ptr_pthread_thread_self) ()
# else
weak_extern (__pthread_thread_self)
# define thread_self() __pthread_thread_self ()
# endif
#endif
#endif /* internals.h */ #endif /* internals.h */

View File

@ -34,13 +34,6 @@ weak_extern (__pthread_thread_self)
int __libc_multiple_threads attribute_hidden; int __libc_multiple_threads attribute_hidden;
# ifndef FLOATING_STACKS
# undef THREAD_GETMEM
# undef THREAD_SETMEM
# define THREAD_GETMEM(descr, member) descr->member
# define THREAD_SETMEM(descr, member, value) descr->member = (value)
# endif
/* The next two functions are similar to pthread_setcanceltype() but /* The next two functions are similar to pthread_setcanceltype() but
more specialized for the use in the cancelable functions like write(). more specialized for the use in the cancelable functions like write().
They do not need to check parameters etc. */ They do not need to check parameters etc. */
@ -48,18 +41,11 @@ int
attribute_hidden attribute_hidden
__libc_enable_asynccancel (void) __libc_enable_asynccancel (void)
{ {
#ifdef FLOATING_STACKS
pthread_descr self = thread_self(); pthread_descr self = thread_self();
#else int oldtype = LIBC_THREAD_GETMEM(self, p_canceltype);
pthread_descr self = __libc_maybe_call2 (pthread_thread_self, (), NULL); LIBC_THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_ASYNCHRONOUS);
if (__builtin_expect (LIBC_THREAD_GETMEM(self, p_canceled), 0) &&
if (self == NULL) LIBC_THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)
return PTHREAD_CANCEL_DEFERRED;
#endif
int oldtype = THREAD_GETMEM(self, p_canceltype);
THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_ASYNCHRONOUS);
if (__builtin_expect (THREAD_GETMEM(self, p_canceled), 0) &&
THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)
__libc_maybe_call2 (pthread_do_exit, __libc_maybe_call2 (pthread_do_exit,
(PTHREAD_CANCELED, CURRENT_STACK_FRAME), 0); (PTHREAD_CANCELED, CURRENT_STACK_FRAME), 0);
return oldtype; return oldtype;
@ -69,14 +55,8 @@ void
internal_function attribute_hidden internal_function attribute_hidden
__libc_disable_asynccancel (int oldtype) __libc_disable_asynccancel (int oldtype)
{ {
#ifdef FLOATING_STACKS
pthread_descr self = thread_self(); pthread_descr self = thread_self();
#else LIBC_THREAD_SETMEM(self, p_canceltype, oldtype);
pthread_descr self = __libc_maybe_call2 (pthread_thread_self, (), NULL);
if (self != NULL)
#endif
THREAD_SETMEM(self, p_canceltype, oldtype);
} }
#endif #endif

View File

@ -1,46 +0,0 @@
/* libc-internal interface for thread-specific data.
Copyright (C) 1998,99,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <sys/cdefs.h> /* for __const */
#include <stdlib.h>
#include <bits/libc-tsd.h>
#if !(USE_TLS && HAVE___THREAD)
/* This file provides uinitialized (common) definitions for the
hooks used internally by libc to access thread-specific data.
When -lpthread is used, it provides initialized definitions for these
variables (in specific.c), which override these uninitialized definitions.
If -lpthread is not used, these uninitialized variables default to zero,
which the __libc_tsd_* macros check for. */
void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t);
int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
__const void *);
void **(*__libc_internal_tsd_address) (enum __libc_tsd_key_t)
__THROW __attribute__ ((__const__));
#endif /* !(USE_TLS && HAVE___THREAD) */
int __libc_alloca_cutoff (size_t size)
{
return size <= __MAX_ALLOCA_CUTOFF;
}

View File

@ -25,8 +25,5 @@
int int
system (const char *line) system (const char *line)
{ {
int oldtype = LIBC_CANCEL_ASYNC (); return __libc_system (line);
int result = __libc_system (line);
LIBC_CANCEL_RESET (oldtype);
return result;
} }

View File

@ -233,6 +233,11 @@ extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
#ifdef SHARED #ifdef SHARED
static struct pthread_functions pthread_functions = static struct pthread_functions pthread_functions =
{ {
#if !(USE_TLS && HAVE___THREAD)
.ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
.ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
.ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
#endif
.ptr_pthread_attr_destroy = __pthread_attr_destroy, .ptr_pthread_attr_destroy = __pthread_attr_destroy,
#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
.ptr_pthread_attr_init_2_0 = __pthread_attr_init_2_0, .ptr_pthread_attr_init_2_0 = __pthread_attr_init_2_0,

View File

@ -208,40 +208,28 @@ void __pthread_destroy_specifics()
/* Thread-specific data for libc. */ /* Thread-specific data for libc. */
static int int
libc_internal_tsd_set(enum __libc_tsd_key_t key, const void * pointer) __pthread_internal_tsd_set (int key, const void * pointer)
{ {
pthread_descr self = thread_self(); pthread_descr self = thread_self();
THREAD_SETMEM_NC(self, p_libc_specific[key], (void *) pointer); THREAD_SETMEM_NC(self, p_libc_specific[key], (void *) pointer);
return 0; return 0;
} }
int (*__libc_internal_tsd_set)(enum __libc_tsd_key_t key, const void * pointer)
= libc_internal_tsd_set;
static void * void *
libc_internal_tsd_get(enum __libc_tsd_key_t key) __pthread_internal_tsd_get (int key)
{ {
pthread_descr self = thread_self(); pthread_descr self = thread_self();
return THREAD_GETMEM_NC(self, p_libc_specific[key]); return THREAD_GETMEM_NC(self, p_libc_specific[key]);
} }
void * (*__libc_internal_tsd_get)(enum __libc_tsd_key_t key)
= libc_internal_tsd_get;
static void ** __attribute__ ((__const__)) void ** __attribute__ ((__const__))
libc_internal_tsd_address (enum __libc_tsd_key_t key) __pthread_internal_tsd_address (int key)
{ {
pthread_descr self = thread_self(); pthread_descr self = thread_self();
return &self->p_libc_specific[key]; return &self->p_libc_specific[key];
} }
void **(*const __libc_internal_tsd_address) (enum __libc_tsd_key_t key)
__THROW __attribute__ ((__const__)) = libc_internal_tsd_address;
#endif #endif
int __libc_alloca_cutoff (size_t size)
{
pthread_descr self = thread_self();
return size <= THREAD_GETMEM_NC(self, p_alloca_cutoff);
}

View File

@ -20,16 +20,7 @@
#ifndef _BITS_LIBC_TSD_H #ifndef _BITS_LIBC_TSD_H
#define _BITS_LIBC_TSD_H 1 #define _BITS_LIBC_TSD_H 1
/* Fast thread-specific data internal to libc. */ #include <linuxthreads/descr.h>
enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
_LIBC_TSD_KEY_DL_ERROR,
_LIBC_TSD_KEY_RPC_VARS,
_LIBC_TSD_KEY_LOCALE,
_LIBC_TSD_KEY_CTYPE_B,
_LIBC_TSD_KEY_CTYPE_TOLOWER,
_LIBC_TSD_KEY_CTYPE_TOUPPER,
_LIBC_TSD_KEY_N };
#include <tls.h> #include <tls.h>
#if USE_TLS && HAVE___THREAD #if USE_TLS && HAVE___THREAD
@ -39,26 +30,25 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
#else #else
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW; # include <bits/libc-lock.h>
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
__const void *) __THROW;
extern void **(*const __libc_internal_tsd_address) (enum __libc_tsd_key_t)
__THROW __attribute__ ((__const__));
#define __libc_tsd_address(KEY) \ # ifndef SHARED
(__libc_internal_tsd_address != NULL \ weak_extern (__pthread_internal_tsd_address)
? __libc_internal_tsd_address (_LIBC_TSD_KEY_##KEY) \ weak_extern (__pthread_internal_tsd_get)
: &__libc_tsd_##KEY##_data) weak_extern (__pthread_internal_tsd_set)
# endif
#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data; #define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
#define __libc_tsd_address(KEY) \
__libc_maybe_call2 (pthread_internal_tsd_address, \
(_LIBC_TSD_KEY_##KEY), &__libc_tsd_##KEY##_data)
#define __libc_tsd_get(KEY) \ #define __libc_tsd_get(KEY) \
(__libc_internal_tsd_get != NULL \ __libc_maybe_call2 (pthread_internal_tsd_get, \
? __libc_internal_tsd_get (_LIBC_TSD_KEY_##KEY) \ (_LIBC_TSD_KEY_##KEY), __libc_tsd_##KEY##_data)
: __libc_tsd_##KEY##_data)
#define __libc_tsd_set(KEY, VALUE) \ #define __libc_tsd_set(KEY, VALUE) \
(__libc_internal_tsd_set != NULL \ __libc_maybe_call2 (pthread_internal_tsd_set, \
? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \ (_LIBC_TSD_KEY_##KEY, (VALUE)), \
: ((__libc_tsd_##KEY##_data = (VALUE)), 0)) (__libc_tsd_##KEY##_data = (VALUE), 0))
#endif #endif

View File

@ -0,0 +1,44 @@
/* MT support function to get address of `errno' variable, linuxthreads
version.
Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <tls.h>
#include <sysdep-cancel.h>
#if ! USE___THREAD
#undef errno
extern int errno;
#endif
int *
#if ! USE___THREAD
weak_const_function
#endif
__errno_location (void)
{
#if ! USE___THREAD && !defined NOT_IN_libc
if (! SINGLE_THREAD_P)
{
pthread_descr self = thread_self();
return LIBC_THREAD_GETMEM (self, p_errnop);
}
#endif
return &errno;
}

View File

@ -0,0 +1,41 @@
/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <netdb.h>
#include <tls.h>
#include <sysdep-cancel.h>
#if ! USE___THREAD
# undef h_errno
extern int h_errno;
#endif
/* When threaded, h_errno may be a per-thread variable. */
int *
weak_const_function
__h_errno_location (void)
{
#if ! USE___THREAD
if (! SINGLE_THREAD_P)
{
pthread_descr self = thread_self();
return LIBC_THREAD_GETMEM (self, p_h_errnop);
}
#endif
return &h_errno;
}

View File

@ -0,0 +1,43 @@
/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <resolv.h>
#include <tls.h>
#include <sysdep-cancel.h>
#if ! USE___THREAD
# undef _res
extern struct __res_state _res;
#endif
/* When threaded, _res may be a per-thread variable. */
struct __res_state *
#if ! USE___THREAD
weak_const_function
#endif
__res_state (void)
{
#if ! USE___THREAD
if (! SINGLE_THREAD_P)
{
pthread_descr self = thread_self();
return LIBC_THREAD_GETMEM (self, p_resp);
}
#endif
return &_res;
}

View File

@ -69,7 +69,10 @@ C["__xpg_sigpause"]=1
{ {
# signals.c in linuxthreads does the cancellation checks not using # signals.c in linuxthreads does the cancellation checks not using
# *_{enable,disable}_asynccancel. # *_{enable,disable}_asynccancel.
if ((!seen_enable || !seen_disable) && !(object ~ /^signals.o/)) # Similarly pt-system.o* is allowed to call __libc_system directly.
if ((!seen_enable || !seen_disable)
&& !(object ~ /^signals.o/)
&& !(object ~ /^pt-system.o/))
{ {
printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen
ret = 1 ret = 1

View File

@ -1,3 +1,9 @@
2002-12-27 Jakub Jelinek <jakub@redhat.com>
* pt-system.c (system): Remove cancellation handling.
* tst-cancel-wrappers.sh: Allow pt-system.o* to not use the
cancellation routines.
2002-12-28 Ulrich Drepper <drepper@redhat.com> 2002-12-28 Ulrich Drepper <drepper@redhat.com>
* descr.h: Include <dl-sysdep.h>. * descr.h: Include <dl-sysdep.h>.

View File

@ -26,11 +26,5 @@
int int
system (const char *line) system (const char *line)
{ {
int oldtype = CANCEL_ASYNC (); return __libc_system (line);
int result = __libc_system (line);
CANCEL_RESET (oldtype);
return result;
} }

View File

@ -67,7 +67,8 @@ C["__xpg_sigpause"]=1
/:$/ { /:$/ {
if (seen) if (seen)
{ {
if (!seen_enable || !seen_disable) # pt-system.o* in NPTL calls __libc_system directly.
if ((!seen_enable || !seen_disable) && !(object ~ /^pt-system.o/))
{ {
printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen
ret = 1 ret = 1

View File

@ -29,7 +29,7 @@ distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \
Banner res_hconf.h res_debug.h README gai_misc.h ga_test.c Banner res_hconf.h res_debug.h README gai_misc.h ga_test.c
routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \ routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
res_hconf res_libc res_hconf res_libc res-state
tests = tst-aton tests = tst-aton

View File

@ -41,17 +41,6 @@ struct __res_state _res;
compat_symbol (libc, _res, _res, GLIBC_2_0); compat_symbol (libc, _res, _res, GLIBC_2_0);
# endif # endif
#endif #endif
/* This function is used to access the resolver state in
single-threaded programs. */
struct __res_state *
#if ! USE___THREAD
weak_const_function
#endif
__res_state (void)
{
return &_res;
}
/* The following bit is copied from res_data.c (where it is #ifdef'ed /* The following bit is copied from res_data.c (where it is #ifdef'ed

View File

@ -0,0 +1,33 @@
/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <netdb.h>
#include <tls.h>
#if ! USE___THREAD
# undef h_errno
extern int h_errno;
#endif
/* When threaded, h_errno may be a per-thread variable. */
int *
weak_const_function
__h_errno_location (void)
{
return &h_errno;
}

View File

@ -0,0 +1,35 @@
/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <resolv.h>
#include <tls.h>
#if ! USE___THREAD
# undef _res
extern struct __res_state _res;
#endif
/* When threaded, _res may be a per-thread variable. */
struct __res_state *
#if ! USE___THREAD
weak_const_function
#endif
__res_state (void)
{
return &_res;
}