* mutex.c (__pthread_mutex_unlock): For PTHREAD_MUTEX_RECURSIVE_NP
	test for owner first.
	Patch by Kaz Kylheku <kaz@ashi.footprints.net>.
This commit is contained in:
Ulrich Drepper 2000-09-28 23:11:33 +00:00
parent 8cab1d380a
commit c0ac34e447
18 changed files with 105 additions and 30 deletions

View File

@ -3,6 +3,10 @@
the `.ctors' and `.dtors' sections so the lists are terminated, and
calling those lists of functions. */
# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
# include <gccframe.h>
# endif
static void (*const __CTOR_LIST__[1]) (void)
__attribute__ ((section (".ctors")))
= { (void (*) (void)) -1 };
@ -22,16 +26,6 @@ static char __EH_FRAME_BEGIN__[]
__attribute__ ((section (".eh_frame")))
= { };
# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
/* This must match what's in frame.h in gcc. How can one do that? */
struct object
{
void *pc_begin;
void *pc_end;
void *fde_begin;
void *fde_array;
__SIZE_TYPE__ count;
struct object *next;
};
extern void __register_frame_info (const void *, struct object *);
extern void __deregister_frame_info (const void *);
# else

View File

@ -1,5 +1,9 @@
2000-09-28 Ulrich Drepper <drepper@redhat.com>
* mutex.c (__pthread_mutex_unlock): For PTHREAD_MUTEX_RECURSIVE_NP
test for owner first.
Patch by Kaz Kylheku <kaz@ashi.footprints.net>.
* cancel.c (pthread_cancel): Don't do anything if cancelation is
disabled.

View File

@ -163,6 +163,8 @@ int __pthread_mutex_unlock(pthread_mutex_t * mutex)
__pthread_unlock(&mutex->__m_lock);
return 0;
case PTHREAD_MUTEX_RECURSIVE_NP:
if (mutex->__m_owner != thread_self())
return EPERM;
if (mutex->__m_count > 0) {
mutex->__m_count--;
return 0;

View File

@ -162,7 +162,7 @@ Input/output error; usually used for physical read or write errors.
@end deftypevr
@comment errno.h
@comment POSIX.1: Device not configured
@comment POSIX.1: No such device or address
@deftypevr Macro int ENXIO
@comment errno 6 @c DO NOT REMOVE
No such device or address. The system tried to use the device

View File

@ -83,6 +83,7 @@ tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \
# We do the `long double' tests only if this data type is available and
# distinct from `double'.
test-longdouble-yes = test-ldouble test-ildoubl
distribute += $(test-longdouble-yes:=.c)
ifneq (no,$(PERL))
libm-tests = test-float test-double $(test-longdouble-$(long-double-fcts)) \

View File

@ -400,6 +400,7 @@ static void
feexcp_mask_test (const char *flag_name, int fe_exc)
{
int status;
int exception;
pid_t pid;
printf ("Test: after fedisable (%s) processes will not abort\n", flag_name);
@ -415,7 +416,22 @@ feexcp_mask_test (const char *flag_name, int fe_exc)
setrlimit (RLIMIT_CORE, &core_limit);
#endif
feenableexcept (FE_ALL_EXCEPT);
fedisableexcept (fe_exc);
exception = fe_exc;
#ifdef FE_INEXACT
/* The standard allows the inexact exception to be set together with the
underflow and overflow exceptions. So add FE_INEXACT to the set of
exceptions to be disabled if we will be raising underflow or
overflow. */
# ifdef FE_OVERFLOW
if (fe_exc & FE_OVERFLOW)
exception |= FE_INEXACT;
# endif
# ifdef FE_UNDERFLOW
if (fe_exc & FE_UNDERFLOW)
exception |= FE_INEXACT;
# endif
#endif
fedisableexcept (exception);
feraiseexcept (fe_exc);
exit (2);
}

View File

@ -22,7 +22,7 @@
# error "Never use <bits/string2.h> directly; include <string.h> instead."
#endif
#if !defined __NO_STRING_INLINES && !__BOUNDED_POINTERS__
#if !defined __NO_STRING_INLINES && !defined __BOUNDED_POINTERS__
/* Unlike the definitions in the header <bits/string.h> the
definitions contained here are not optimized down to assembler

View File

@ -0,0 +1,30 @@
/* Definition of object in frame unwind info. Generic version.
Copyright (C) 2000 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 Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library 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. */
/* This must match what's in frame.h in gcc. */
struct object
{
void *pc_begin;
void *pc_end;
void *fde_begin;
void *fde_array;
__SIZE_TYPE__ count;
struct object *next;
};

View File

@ -59,7 +59,7 @@ TRANS represented by a file you specified, and it couldn't find the device.
TRANS This can mean that the device file was installed incorrectly, or that
TRANS the physical device is missing or not correctly attached to the
TRANS computer. */
[ERR_REMAP (ENXIO)] = N_("Device not configured"),
[ERR_REMAP (ENXIO)] = N_("No such device or address"),
#endif
#ifdef E2BIG
/*

View File

@ -67,10 +67,10 @@ enum
/* Type representing exception flags. */
typedef unsigned long fexcept_t;
typedef unsigned long int fexcept_t;
/* Type representing floating-point environment. */
typedef unsigned long fenv_t;
typedef unsigned long int fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((__const fenv_t *) 0xc009804c0270033fUL)

View File

@ -30,7 +30,7 @@ feclearexcept (int excepts)
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
/* Clear the relevant bits. */
fpsr &= ~(((unsigned long int) ((excepts & FE_ALL_EXCEPT) << 13)));
fpsr &= ~(((fenv_t) ((excepts & FE_ALL_EXCEPT) << 13)));
/* Put the new state in effect. */
__asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr) : "memory");

View File

@ -29,7 +29,7 @@ fedisableexcept (int excepts)
/* Get the current fpsr. */
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (old_fpsr));
new_fpsr = old_fpsr |= FE_ALL_EXCEPT;
new_fpsr = old_fpsr | ((fenv_t) excepts & FE_ALL_EXCEPT);
__asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (new_fpsr) : "memory");

View File

@ -29,8 +29,7 @@ feenableexcept (int excepts)
/* Get the current fpsr. */
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r " (old_fpsr));
new_fpsr = ((old_fpsr & FE_ALL_EXCEPT)
| (old_fpsr & ((unsigned long int) excepts ^ FE_ALL_EXCEPT)));
new_fpsr = old_fpsr & ~((fenv_t) excepts & FE_ALL_EXCEPT);
__asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (new_fpsr) : "memory");

View File

@ -30,8 +30,8 @@ fesetenv (const fenv_t *envp)
Magic encoding of default values: bit 62+63 set (which will never
happen for a user-space address) means it's not indirect.
*/
if (((unsigned long int) envp >> 62) == 0x03)
env = (unsigned long int) envp & 0x3fffffffffffffff;
if (((fenv_t) envp >> 62) == 0x03)
env = (fenv_t) envp & 0x3fffffffffffffff;
else
env = *envp;

View File

@ -23,7 +23,7 @@
int
fesetround (int round)
{
unsigned long int fpsr;
fenv_t fpsr;
if (round & ~3)
return 0;
@ -32,7 +32,7 @@ fesetround (int round)
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
/* Set the relevant bits. */
fpsr = (fpsr & ~(3UL << 10)) | ((unsigned long int) round << 10);
fpsr = (fpsr & ~(3UL << 10)) | ((fenv_t) round << 10);
/* Put the new state in effect. */
__asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr) : "memory");

View File

@ -28,7 +28,7 @@ fegetexceptflag (fexcept_t *flagp, int excepts)
/* Get the current exceptions. */
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
*flagp = (fpsr ^ FE_ALL_EXCEPT) & excepts & FE_ALL_EXCEPT;
*flagp = (fexcept_t) ((fpsr >> 13) & excepts & FE_ALL_EXCEPT);
/* Success. */
return 0;

View File

@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */
#include <fenv.h>
#include <math.h>
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
@ -29,12 +28,10 @@ fesetexceptflag (const fexcept_t *flagp, int excepts)
/* Get the current exception state. */
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
/* Get the reverse bits so we can enable the exceptions flagged
rather than disable them. */
excepts ^= FE_ALL_EXCEPT;
fpsr &= ~(((fenv_t) excepts & FE_ALL_EXCEPT) << 13);
/* Set all the bits that were called for. */
fpsr = (fpsr & ~FE_ALL_EXCEPT) | (*flagp & excepts & FE_ALL_EXCEPT);
fpsr |= ((*flagp & excepts & FE_ALL_EXCEPT) << 13);
/* And store it back. */
__asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr) : "memory");

32
sysdeps/ia64/gccframe.h Normal file
View File

@ -0,0 +1,32 @@
/* Definition of object in frame unwind info. ia64 version.
Copyright (C) 2000 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 Library General Public License as
published by the Free Software Foundation; either version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library 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. */
/* This must match what's in frame.h in gcc. */
struct object
{
void *pc_base; /* This field will be set by find_fde. */
void *pc_begin;
void *pc_end;
void *fde_begin;
void *fde_end;
void *fde_array;
__SIZE_TYPE__ count;
struct object *next;
};