Updated to fedora-glibc-20051227T1426

This commit is contained in:
Jakub Jelinek 2005-12-27 14:48:14 +00:00
parent e3173d2c99
commit 64cd3e83c9
199 changed files with 1984 additions and 4405 deletions

157
ChangeLog
View File

@ -1,3 +1,160 @@
2005-12-26 Ulrich Drepper <drepper@redhat.com>
* Versions.def: Add GLIBC_2.4 for libpthread.
2005-12-25 Ulrich Drepper <drepper@redhat.com>
* stdlib/Makefile ($(objpfx)isomac.out): Move -I.. to the end so
that $(..)/bits is not found early.
2005-12-24 Ulrich Drepper <drepper@redhat.com>
* manual/errno.texi: Add new Linux errno codes.
* sysdeps/unix/sysv/linux/Versions: Add new errlist-compat entry
for up to 132 errnos.
* sysdeps/unix/sysv/linux/bits/errno.h: Define EOWNERDEAD and
ENOTRECOVERABLE if not already defined.
2005-12-23 Ulrich Drepper <drepper@redhat.com>
[BZ #1566]
* sysdeps/i386/i586/memusage.h: New file.
* sysdeps/i386/memusage.h: Don't define GETTIME.
2005-12-22 Ulrich Drepper <drepper@redhat.com>
[BZ #1499]
* misc/syslog.c (SyslogAddr): Use sockaddr_un instead of sockaddr.
(openlog_internal): Adjust for this change.
* Makeconfig: Define CXXFLAGS. Split out warnings from +gccwarn which
are not understood by the C++ compiler.
* Makerules: Add rules to build C++ code for test cases.
* include/stdlib.h: Protect for inclusion in C++ code.
* include/time.h: Likewise.
2005-12-22 Roland McGrath <roland@redhat.com>
* Makerules [gen-as-const-headers] (tests): Add one test per .sym
file, not just one.
($(objpfx)test-as-const.c): Target replaced with ...
($(objpfx)test-as-const-%.c): ... this pattern rule.
(generated): Add those files.
2005-12-22 Ulrich Drepper <drepper@redhat.com>
* test-skeleton.c (timeout_handler): Rewrite ts initialization for
C++ compatibility.
* sysdeps/x86_64/__longjmp.S: Also protect SP and BP.
* sysdeps/x86_64/setjmp.S: Likewise.
2005-12-21 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/i386/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/i386/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/s390/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.h: File removed.
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: New file.
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = stdlib]:
(gen-as-const-headers): Add it.
* sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
* sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
* sysdeps/unix/sysv/linux/s390/Makefile: Likewise.
* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
* stdlib/tst-ucontext-off.c: File removed.
* stdlib/Makefile (tests): Remove it.
* scripts/gen-as-const.awk: Support generating a test program.
* Makerules [gen-as-const-headers] (tests): Add test-as-const.
[gen-as-const-headers] ($(objpfx)test-as-const.c): New target.
* sysdeps/generic/bits: Subdirectory and all files moved to ...
* bits: ... here, new subdirectory.
* Makeconfig (+includes): Reordered includes to put build and sysdeps
dirs first after $(..)include, $(sysincludes) last.
[BZ #2066]
* intl/l10nflist.c (_nl_make_l10nflist): Free ABS_FILENAME when later
malloc fails.
2005-12-21 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/fpu/libm-test-ulps: Update for GCC 4.1 prerelease.
2005-12-21 Roland McGrath <roland@redhat.com>
* sysdeps/mach/hurd/ifreq.c: Add missing #includes.
* elf/cache.c: Use <> rather than "" #includes.
* elf/chroot_canon.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/ldconfig.c: Likewise.
* elf/readlib.c: Likewise.
* elf/rtld.c: Likewise.
* gmon/mcount.c: Likewise.
* hurd/hurdfault.c: Likewise.
* hurd/hurdsig.c: Likewise.
* hurd/report-wait.c: Likewise.
* hurd/sigunwind.c: Likewise.
* mach/setup-thread.c: Likewise.
* rt/aio_read64.c: Likewise.
* rt/aio_sigqueue.c: Likewise.
* rt/aio_write64.c: Likewise.
* soft-fp/soft-fp.h: Likewise.
* stdio-common/tmpfile64.c: Likewise.
* sysdeps/mach/hurd/fork.c: Likewise.
* sysdeps/mach/hurd/hppa/trampoline.c: Likewise.
* sysdeps/mach/hurd/i386/trampoline.c: Likewise.
* sysdeps/mach/hurd/mips/trampoline.c: Likewise.
* sysdeps/mach/hurd/powerpc/trampoline.c: Likewise.
* sysdeps/posix/sprofil.c: Likewise.
* sysdeps/pthread/aio_cancel.c: Likewise.
* sysdeps/pthread/aio_fsync.c: Likewise.
* sysdeps/pthread/aio_read64.c: Likewise.
* sysdeps/pthread/aio_read.c: Likewise.
* sysdeps/pthread/aio_suspend.c: Likewise.
* sysdeps/pthread/aio_write64.c: Likewise.
* sysdeps/pthread/aio_write.c: Likewise.
* sysdeps/pthread/lio_listio64.c: Likewise.
* sysdeps/pthread/lio_listio.c: Likewise.
* sysdeps/unix/sysv/linux/aio_sigqueue.c: Likewise.
* sysdeps/unix/sysv/tcflow.c: Likewise.
* sysdeps/generic/unwind-dw2.c (extract_cie_info): Add a cast.
* elf/dl-error.c (_dl_signal_error): Use .__jmpbuf in __longjmp call.
* csu/dso_handle.c (__dso_handle): Add const to pointer type too.
2005-12-21 Ulrich Drepper <drepper@redhat.com>
* iconv/gconv_conf.c: Initialize empty_path_elem.
* sysdeps/ieee754/dbl-64/halfulp.c: Mark tab54 as static and const.
* sysdeps/i386/fpu/e_expl.c: Mark c0 and c1 as const.
* sysdeps/ieee754/flt-32/s_expm1f.c: Make sure huge and tiny end
up in .rodata.
* sysdeps/ieee754/flt-32/e_exp2f.c: Make sure TWO127 and TWOM100
end up in .rodata.
* sysdeps/ieee754/flt-32/e_expf.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c: Make sure TWO1023 and TWOM1000
end up in .rodata.
2005-12-21 Thorsten Kukuk <kukuk@suse.de>
* elf/readlib.c: Fix include of readelflib.c.
2005-12-21 Ulrich Drepper <drepper@redhat.com>
[BZ #1962]

View File

@ -552,10 +552,11 @@ endif
# Extra flags to pass to GCC.
ifeq ($(all-warnings),yes)
+gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
+gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
else
+gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes
+gccwarn := -Wall -Wwrite-strings -Winline
endif
+gccwarn-c = -Wstrict-prototypes
# We do not depend on the address of constants in different files to be
# actually different, so allow the compiler to merge them all.
@ -627,10 +628,10 @@ endif # $(+cflags) == ""
# library source directory, in the include directory, and in the
# current directory.
# `+sysdep-includes' will be defined by Makerules.
+includes = -I$(..)include $(patsubst %/,-I%,$(..)) \
$(libio-include) $(includes) \
$(+sysdep-includes) $(sysincludes) -I. \
$(patsubst %/,-I%,$(objpfx))
+includes = -I$(..)include \
$(patsubst %/,-I%,$(objpfx)) $(+sysdep-includes) \
$(patsubst %/,-I%,$(..)) $(libio-include) $(includes) -I. \
$(sysincludes)
# Since libio has several internal header files, we use a -I instead
# of many little headers in the include directory.
@ -647,8 +648,11 @@ CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
$(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
$(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
override CFLAGS = -std=gnu99 \
$(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
$(CFLAGS-$(@F))
override CXXFLAGS = $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
# If everything is compiled with -fPIC (implicitly) we must tell this by
# defining the PIC symbol.

View File

@ -183,6 +183,7 @@ sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \
endif
ifdef gen-as-const-headers
# Generating headers for assembly constants.
# We need this defined early to get into before-compile before
# it's used in sysd-rules, below.
@ -201,6 +202,16 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
vpath %.sym $(sysdirs)
before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
tests += $(gen-as-const-headers:%.sym=test-as-const-%)
generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
$(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
%.sym $(common-objpfx)%.h
($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
$(AWK) -v test=1 -f $< $(filter %.sym,$^); \
echo '#include "$(..)test-skeleton.c"') > $@T
mv -f $@T $@
endif
# Generate an ordered list of implicit rules which find the source files in
# each sysdep directory. The old method was to use vpath to search all the
@ -295,6 +306,12 @@ endef
object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
define o-iterator-doit
$(objpfx)%$o: %.cc $(before-compile); $$(compile-command.cc)
endef
object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
# Omit the objpfx rules when building in the source tree, because
# objpfx is empty and so these rules just override the ones above.
ifdef objpfx
@ -370,9 +387,11 @@ compile-mkdep-flags = -MD -MP -MF $@.dt -MT $@
compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
# GCC can grok options after the file name, and it looks nicer that way.
compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
compile.cc = $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS)
compile.S = $(CC) $< -c $(CPPFLAGS) $(S-CPPFLAGS) \
$(ASFLAGS) $(ASFLAGS-$(suffix $@))
COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
@ -1169,9 +1188,9 @@ xcheck: xtests
all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
ifneq (,$(all-nonlib))
cpp-srcs-left = $(all-nonlib:=.c)
cpp-srcs-left = $(all-nonlib:=.c) $(all-nonlib:=.cc)
lib := nonlib
include $(patsubst %,$(..)cppflags-iterator.mk,$(all-nonlib))
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
endif
# The include magic above causes those files to use this variable for flags.

View File

@ -80,6 +80,7 @@ libpthread {
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_PRIVATE
}
libresolv {

View File

@ -18,5 +18,5 @@
/* We have to define __dso_handle ourselves since we do not use gcc's
crtbegin files. */
void *const __dso_handle __attribute__ ((__visibility__ ("hidden")))
const void *const __dso_handle __attribute__ ((__visibility__ ("hidden")))
= &__dso_handle;

View File

@ -30,8 +30,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "ldconfig.h"
#include "dl-cache.h"
#include <ldconfig.h>
#include <dl-cache.h>
struct cache_entry
{

View File

@ -1,6 +1,6 @@
/* Return the canonical absolute name of a given file inside chroot.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1996,1997,1998,1999,2000,2001,2004,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@ -26,7 +26,7 @@
#include <stddef.h>
#include <stdint.h>
#include "ldconfig.h"
#include <ldconfig.h>
#ifndef PATH_MAX
#define PATH_MAX 1024

View File

@ -113,7 +113,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
lcatch->malloced = false;
}
/* We do not restore the signal mask because none was saved. */
__longjmp (lcatch->env, errcode ?: -1);
__longjmp (lcatch->env[0].__jmpbuf, errcode ?: -1);
}
else
{

View File

@ -23,7 +23,7 @@
#include <string.h>
#include <unistd.h>
#include <ldsodefs.h>
#include "dl-hash.h"
#include <dl-hash.h>
#include <dl-machine.h>
#include <bits/libc-lock.h>
#include <tls.h>

View File

@ -37,10 +37,10 @@
#include <glob.h>
#include <libgen.h>
#include "ldconfig.h"
#include "dl-cache.h"
#include <ldconfig.h>
#include <dl-cache.h>
#include "dl-procinfo.h"
#include <dl-procinfo.h>
#ifdef _DL_FIRST_PLATFORM
# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)

View File

@ -34,7 +34,7 @@
#include <sys/stat.h>
#include <gnu/lib-names.h>
#include "ldconfig.h"
#include <ldconfig.h>
#define Elf32_CLASS ELFCLASS32
#define Elf64_CLASS ELFCLASS64
@ -178,4 +178,4 @@ process_file (const char *real_file_name, const char *file_name,
}
/* Get architecture specific version of process_elf_file. */
#include "readelflib.c"
#include <readelflib.c>

View File

@ -34,7 +34,7 @@
#include <hp-timing.h>
#include <bits/libc-lock.h>
#include "dynamic-link.h"
#include "dl-librecon.h"
#include <dl-librecon.h>
#include <unsecvars.h>
#include <dl-cache.h>
#include <dl-osinfo.h>

View File

@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
fedora-sync-date := 2005-12-21 09:31 UTC
fedora-sync-tag := fedora-glibc-20051221T0931
fedora-sync-date := 2005-12-27 14:26 UTC
fedora-sync-tag := fedora-glibc-20051227T1426

View File

@ -1,4 +1,4 @@
%define glibcrelease 22
%define glibcrelease 23
%define auxarches i586 i686 athlon sparcv9 alphaev6
%define prelinkarches noarch
%define xenarches i686 athlon
@ -390,7 +390,7 @@ cat > asm/unistd.h <<EOF
#define __NR_waitid 281
#endif
%endif
%ifarch sparc sparc64
%ifarch sparc sparcv9 sparc64
#ifndef __NR_mq_open
#define __NR_mq_open 273
#define __NR_mq_unlink 274
@ -418,6 +418,47 @@ cat > asm/unistd.h <<EOF
%endif
#endif
EOF
cat > asm/errno.h <<EOF
#ifndef _HACK_ASM_ERRNO_H
#include_next <asm/errno.h>
%ifarch alpha
#ifndef ENOKEY
#define ENOKEY 132
#define EKEYEXPIRED 133
#define EKEYREVOKED 134
#define EKEYREJECTED 135
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 136
#define ENOTRECOVERABLE 137
#endif
%endif
%ifarch %{ix86} ia64 ppc ppc64 s390 s390x x86_64
#ifndef ENOKEY
#define ENOKEY 126
#define EKEYEXPIRED 127
#define EKEYREVOKED 128
#define EKEYREJECTED 129
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#endif
%endif
%ifarch sparc sparcv9 sparc64
#ifndef ENOKEY
#define ENOKEY 128
#define EKEYEXPIRED 129
#define EKEYREVOKED 130
#define EKEYREJECTED 131
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 132
#define ENOTRECOVERABLE 133
#endif
%endif
#endif
EOF
# A lot of programs still misuse memcpy when they have to use
# memmove. The memcpy implementation below is not tolerant at
@ -1074,6 +1115,12 @@ rm -f *.filelist*
%endif
%changelog
* Tue Dec 27 2005 Jakub Jelinek <jakub@redhat.com> 2.3.90-23
- update from CVS
- robust mutexes
- fix transliteration segfaults (#176573, #176583)
- ignore prelink temporaries in ldconfig (#176570)
* Wed Dec 21 2005 Jakub Jelinek <jakub@redhat.com> 2.3.90-22
- update from CVS
- minor fts fixes

View File

@ -37,7 +37,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
/* This file provides the machine-dependent definitions of the _MCOUNT_DECL
and MCOUNT macros. */
#include "machine-gmon.h"
#include <machine-gmon.h>
#include <atomic.h>

View File

@ -1,5 +1,6 @@
/* Handle faults in the signal thread.
Copyright (C) 1994,95,96,97,2002 Free Software Foundation, Inc.
Copyright (C) 1994,1995,1996,1997,2002,2005
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
@ -24,7 +25,7 @@
#include <string.h>
#include <setjmp.h>
#include <stdio.h>
#include "thread_state.h"
#include <thread_state.h>
#include "faultexc_server.h" /* mig-generated header for our exc server. */
#include <assert.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01,2002
/* Copyright (C) 1991,92,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -132,7 +132,7 @@ _hurd_thread_sigstate (thread_t thread)
#include <setjmp.h>
#include <fcntl.h>
#include <sys/wait.h>
#include "thread_state.h"
#include <thread_state.h>
#include <hurd/msg_server.h>
#include <hurd/msg_reply.h> /* For __msg_sig_post_reply. */
#include <hurd/interrupt.h>
@ -256,7 +256,7 @@ interrupted_reply_port_location (struct machine_thread_all_state *thread_state,
}
#include <hurd/sigpreempt.h>
#include "intr-msg.h"
#include <intr-msg.h>
/* Timeout on interrupt_operation calls. */
mach_msg_timeout_t _hurdsig_interrupt_timeout = 1000;

View File

@ -1,5 +1,5 @@
/* Report on what a thread in our task is waiting for.
Copyright (C) 1996,97,99,2002 Free Software Foundation, Inc.
Copyright (C) 1996,1997,1999,2002,2005 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
@ -23,8 +23,8 @@
#include <string.h>
#include <assert.h>
#include <hurd/msg_server.h>
#include "thread_state.h"
#include "intr-msg.h"
#include <thread_state.h>
#include <intr-msg.h>
static char *
describe_number (string_t description, const char *flavor, long int i)

View File

@ -18,7 +18,7 @@
02111-1307 USA. */
#include <hurd.h>
#include "thread_state.h"
#include <thread_state.h>
#include <setjmp.h>
#include <assert.h>

View File

@ -46,7 +46,7 @@ struct path_elem *__gconv_path_elem;
size_t __gconv_max_path_elem_len;
/* We use the following struct if we couldn't allocate memory. */
static const struct path_elem empty_path_elem;
static const struct path_elem empty_path_elem = { NULL, 0 };
/* Name of the file containing the module information in the directories
along the path. */

View File

@ -10,6 +10,8 @@
/* Now define the internal interfaces. */
#ifndef __Need_M_And_C
__BEGIN_DECLS
extern __typeof (strtol_l) __strtol_l;
extern __typeof (strtoul_l) __strtoul_l;
extern __typeof (strtoll_l) __strtoll_l;
@ -197,6 +199,8 @@ __strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr,
extern void * __default_morecore (ptrdiff_t);
libc_hidden_proto (__default_morecore)
__END_DECLS
#undef __Need_M_And_C
#endif /* include/stdlib.h */

View File

@ -5,6 +5,8 @@
# include <time/time.h>
# include <xlocale.h>
__BEGIN_DECLS
extern __typeof (strftime_l) __strftime_l;
libc_hidden_proto (__strftime_l)
extern __typeof (strptime_l) __strptime_l;
@ -89,6 +91,8 @@ extern int __getclktck (void);
/* strptime support. */
/* Status of lookup: do we use the locale data or the raw data? */
#ifndef __cplusplus
// C++ cannot deal with using 'not'.
enum ptime_locale_status { not, loc, raw };
extern char * __strptime_internal (const char *rp, const char *fmt,
@ -96,6 +100,7 @@ extern char * __strptime_internal (const char *rp, const char *fmt,
enum ptime_locale_status *decided,
int era_cnt, __locale_t locparam)
internal_function;
#endif
extern double __difftime (time_t time1, time_t time0);
@ -105,5 +110,8 @@ extern double __difftime (time_t time1, time_t time0);
#ifndef _ISOMAC
# define CLOCK_IDFIELD_SIZE 3
#endif
__END_DECLS
#endif
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995-2002, 2004 Free Software Foundation, Inc.
/* Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -270,7 +270,10 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
* (1 << pop (mask))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
return NULL;
{
free (abs_filename);
return NULL;
}
retval->filename = abs_filename;
/* If more than one directory is in the list this is a pseudo-entry

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,94,95,97,2002 Free Software Foundation, Inc.
/* Copyright (C) 1991,94,1995,1997,2002,2005 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
@ -17,7 +17,7 @@
02111-1307 USA. */
#include <mach.h>
#include "thread_state.h"
#include <thread_state.h>
#include <string.h>
#include <mach/machine/vm_param.h>
#include "sysdep.h" /* Defines stack direction. */

View File

@ -1229,6 +1229,42 @@ They are not yet documented.}
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: Required key not available
@deftypevr Macro int ENOKEY
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: Key has expired
@deftypevr Macro int EKEYEXPIRED
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: Key has been revoked
@deftypevr Macro int EKEYREVOKED
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: Key was rejected by service
@deftypevr Macro int EKEYREJECTED
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: Owner died
@deftypevr Macro int EOWNERDEAD
@comment errno ???/???
@end deftypevr
@comment errno.h
@comment Linux: State not recoverable
@deftypevr Macro int ENOTRECOVERABLE
@comment errno ???/???
@end deftypevr
@node Error Messages, , Error Codes, Error Reporting
@section Error Messages

View File

@ -35,6 +35,7 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <netdb.h>
#include <errno.h>
@ -326,7 +327,7 @@ vsyslog(pri, fmt, ap)
}
libc_hidden_def (vsyslog)
static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
static struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
static void
@ -342,9 +343,9 @@ openlog_internal(const char *ident, int logstat, int logfac)
int retry = 0;
while (retry < 2) {
if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX;
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data));
SyslogAddr.sun_family = AF_UNIX;
(void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof(SyslogAddr.sun_path));
if (LogStat & LOG_NDELAY) {
if ((LogFile = __socket(AF_UNIX, LogType, 0))
== -1)

View File

@ -1,3 +1,98 @@
2005-12-26 Ulrich Drepper <drepper@redhat.com>
* pthreadP.h: Define PTHREAD_MUTEX_ROBUST_PRIVATE_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP,
PTHREAD_MUTEXATTR_FLAG_ROBUST, PTHREAD_MUTEXATTR_FLAG_PSHARED,
and PTHREAD_MUTEXATTR_FLAG_BITS.
* descr.h (struct pthread): Add robust_list field and define
ENQUEUE_MUTEX and DEQUEUE_MUTEX macros.
* pthread_mutexattr_getrobust.c: New file.
* pthread_mutexattr_setrobust.c: New file.
* pthread_mutex_consistent.c: New file.
* sysdeps/pthread/pthread.h: Declare pthread_mutexattr_getrobust,
pthread_mutexattr_setrobust, and pthread_mutex_consistent.
Define PTHREAD_MUTEX_STALLED_NP and PTHREAD_MUTEX_ROBUST_NP.
Adjust pthread_mutex_t initializers.
* nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Add __next
field to pthread_mutex_t.
* nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Add __next
and __prev field to pthread_mutex_t.
* Versions [GLIBC_2.4]: Export pthread_mutexattr_getrobust_np,
pthread_mutexattr_setrobust_np, and pthread_mutex_consistent_np.
* pthread_mutexattr_getpshared.c: Use PTHREAD_MUTEXATTR_FLAG_PSHARED
and PTHREAD_MUTEXATTR_FLAG_BITS macros instead of magic numbers.
* pthread_mutexattr_gettype.c: Likewise.
* pthread_mutexattr_setpshared.c: Likewise.
* pthread_mutexattr_settype.c: Likewise.
* pthread_mutex_init.c: Reject robust+pshared attribute for now.
Initialize mutex kind according to robust flag.
* pthread_mutex_lock.c: Implement local robust mutex.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
* pthread_create.c (start_thread): Mark robust mutexes which remained
locked as dead.
* tst-robust1.c: New file.
* tst-robust2.c: New file.
* tst-robust3.c: New file.
* tst-robust4.c: New file.
* tst-robust5.c: New file.
* tst-robust6.c: New file.
* tst-robust7.c: New file.
* Makefile (libpthread-routines): Add pthread_mutexattr_getrobust,
pthread_mutexattr_setrobust, and pthread_mutex_consistent.
(tests): Add tst-robust1, tst-robust2, tst-robust3, tst-robust4,
tst-robust5, tst-robust6, and tst-robust7.
* tst-typesizes.c: New file.
* Makefile (tests): Add tst-typesizes.
* tst-once3.c: More debug output.
2005-12-24 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Add break
missing after last change.
* version.c: Update cpoyright year.
2005-12-23 Ulrich Drepper <drepper@redhat.com>
* pthread_mutex_destroy.c: Set mutex type to an invalid value.
* pthread_mutex_lock.c: Return EINVAL for invalid mutex type.
* pthread_mutex_trylock.c: Likewise.
* pthread_mutex_timedlock.c: Likewise.
* pthread_mutex_unlock.c: Likewise.
2005-12-22 Roland McGrath <roland@redhat.com>
* sysdeps/pthread/sigaction.c: Use "" instead of <> to include self,
so that #include_next's search location is not reset to the -I..
directory where <nptl/...> can be found.
2005-12-22 Ulrich Drepper <drepper@redhat.com>
[BZ #1913]
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S (__new_sem_wait):
Fix unwind info. Remove useless branch prediction prefix.
* tst-cancel24.cc: New file.
* Makefile: Add rules to build and run tst-cancel24.
2005-12-21 Roland McGrath <roland@redhat.com>
* libc-cancellation.c: Use <> rather than "" #includes.
* pt-cleanup.c: Likewise.
* pthread_create.c: Likewise.
* pthread_join.c: Likewise.
* pthread_timedjoin.c: Likewise.
* pthread_tryjoin.c: Likewise.
* sysdeps/unix/sysv/linux/libc_pthread_init.c: Likewise.
* sysdeps/unix/sysv/linux/register-atfork.c: Likewise.
* sysdeps/unix/sysv/linux/unregister-atfork.c: Likewise.
* unwind.c: Likewise.
2005-12-19 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/sh/tcb-offsets.sym: Add POINTER_GUARD.

View File

@ -116,6 +116,8 @@ libpthread-routines = init vars events version \
pthread_kill_other_threads \
pthread_getaffinity pthread_setaffinity \
pthread_attr_getaffinity pthread_attr_setaffinity \
pthread_mutexattr_getrobust pthread_mutexattr_setrobust \
pthread_mutex_consistent \
cleanup_routine unwind-forcedunwind
# pthread_setuid pthread_seteuid pthread_setreuid \
# pthread_setresuid \
@ -189,7 +191,8 @@ CFLAGS-pt-system.c = -fexceptions
omit-deps = $(unix-syscalls:%=ptw-%)
tests = tst-attr1 tst-attr2 tst-attr3 \
tests = tst-typesizes \
tst-attr1 tst-attr2 tst-attr3 \
tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \
tst-spin1 tst-spin2 tst-spin3 \
@ -197,6 +200,8 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
tst-cond20 tst-cond21 \
tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
tst-robust6 tst-robust7 \
tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
@ -220,7 +225,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
tst-cancel21 tst-cancel22 tst-cancel23 \
tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 \
tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
tst-flock1 tst-flock2 \
tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
@ -479,6 +484,8 @@ $(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
endif
LDFLAGS-tst-cancel24 = -lstdc++
extra-B-pthread.so = -B$(common-objpfx)nptl/
$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))

View File

@ -232,6 +232,11 @@ libpthread {
pthread_setschedprio;
}
GLIBC_2.4 {
pthread_mutexattr_getrobust_np; pthread_mutexattr_setrobust_np;
pthread_mutex_consistent_np;
};
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;

View File

@ -134,6 +134,51 @@ struct pthread
/* Process ID - thread group ID in kernel speak. */
pid_t pid;
/* List of robust mutexes the thread is holding. */
pthread_mutex_t *robust_list;
#ifdef __PTHREAD_MUTEX_HAVE_PREV
# define ENQUEUE_MUTEX(mutex) \
do { \
mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list); \
THREAD_SETMEM (THREAD_SELF, robust_list, mutex); \
if (mutex->__data.__next != NULL) \
mutex->__data.__next->__data.__prev = mutex; \
mutex->__data.__prev = NULL; \
} while (0)
# define DEQUEUE_MUTEX(mutex) \
do { \
if (mutex->__data.__prev == NULL) \
THREAD_SETMEM (THREAD_SELF, robust_list, mutex->__data.__next); \
else \
mutex->__data.__prev->__data.__next = mutex->__data.__next; \
if (mutex->__data.__next != NULL) \
mutex->__data.__next->__data.__prev = mutex->__data.__prev; \
mutex->__data.__prev = NULL; \
mutex->__data.__next = NULL; \
} while (0)
#else
# define ENQUEUE_MUTEX(mutex) \
do { \
mutex->__data.__next = THREAD_GETMEM (THREAD_SELF, robust_list); \
THREAD_SETMEM (THREAD_SELF, robust_list, mutex); \
} while (0)
# define DEQUEUE_MUTEX(mutex) \
do { \
pthread_mutex_t *runp = THREAD_GETMEM (THREAD_SELF, robust_list); \
if (runp == mutex) \
THREAD_SETMEM (THREAD_SELF, robust_list, runp->__data.__next); \
else \
{ \
while (runp->__data.__next != mutex) \
runp = runp->__data.__next; \
\
runp->__data.__next = runp->__data.__next->__data.__next; \
mutex->__data.__next = NULL; \
} \
} while (0)
#endif
/* List of cleanup buffers. */
struct _pthread_cleanup_buffer *cleanup;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -20,7 +20,7 @@
#include <setjmp.h>
#include <stdlib.h>
#include "pthreadP.h"
#include "atomic.h"
#include <atomic.h>
#include <bits/libc-lock.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -20,7 +20,7 @@
#include <setjmp.h>
#include <stdlib.h>
#include "pthreadP.h"
#include "jmpbuf-unwind.h"
#include <jmpbuf-unwind.h>
void
__pthread_cleanup_upto (__jmp_buf target, char *targetframe)
@ -61,4 +61,3 @@ __pthread_cleanup_upto (__jmp_buf target, char *targetframe)
THREAD_SETMEM (self, cleanup, cbuf);
}
hidden_def (__pthread_cleanup_upto)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -51,6 +51,32 @@
#endif
/* Magic cookie representing robust mutex with dead owner. */
#define PTHREAD_MUTEX_OWNERDEAD INT_MAX
/* Magic cookie representing not recoverable robust mutex. */
#define PTHREAD_MUTEX_NOTRECOVERABLE (INT_MAX - 1)
/* Internal mutex type value. */
enum
{
PTHREAD_MUTEX_ROBUST_PRIVATE_NP = 256,
PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP
= PTHREAD_MUTEX_ROBUST_PRIVATE_NP | PTHREAD_MUTEX_ADAPTIVE_NP
};
/* Flags in mutex attr. */
#define PTHREAD_MUTEXATTR_FLAG_ROBUST 0x40000000
#define PTHREAD_MUTEXATTR_FLAG_PSHARED 0x80000000
#define PTHREAD_MUTEXATTR_FLAG_BITS \
(PTHREAD_MUTEXATTR_FLAG_ROBUST | PTHREAD_MUTEXATTR_FLAG_PSHARED)
/* Internal variables. */

View File

@ -52,7 +52,7 @@ unsigned int __nptl_nthreads = 1;
#include "allocatestack.c"
/* Code to create the thread. */
#include "createthread.c"
#include <createthread.c>
struct pthread *
@ -310,6 +310,33 @@ start_thread (void *arg)
the breakpoint reports TD_THR_RUN state rather than TD_THR_ZOMBIE. */
atomic_bit_set (&pd->cancelhandling, EXITING_BIT);
/* If this thread has any robust mutexes locked, handle them now. */
pthread_mutex_t *robust = THREAD_GETMEM (pd, robust_list);
if (__builtin_expect (robust != NULL, 0))
{
do
{
pthread_mutex_t *this = robust;
robust = robust->__data.__next;
assert (lll_mutex_islocked (this->__data.__lock));
this->__data.__count = 0;
--this->__data.__nusers;
assert (this->__data.__owner != PTHREAD_MUTEX_NOTRECOVERABLE);
this->__data.__owner = PTHREAD_MUTEX_OWNERDEAD;
this->__data.__next = NULL;
#ifdef __PTHREAD_MUTEX_HAVE_PREV
this->__data.__prev = NULL;
#endif
lll_mutex_unlock (this->__data.__lock);
}
while (robust != NULL);
/* Clean up so that the thread descriptor can be reused. */
THREAD_SETMEM (pd, robust_list, NULL);
}
/* If the thread is detached free the TCB. */
if (IS_DETACHED (pd))
/* Free the TCB. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -20,7 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "atomic.h"
#include <atomic.h>
#include "pthreadP.h"

View File

@ -1,5 +1,6 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -16,17 +17,20 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SYS_UIO_H
# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
#endif
#include <errno.h>
#include <pthreadP.h>
/* `struct iovec' -- Structure describing a section of memory. */
struct iovec
int
pthread_mutex_consistent_np (mutex)
pthread_mutex_t *mutex;
{
/* Starting address. */
__ptr_t iov_base;
/* Length in bytes. */
size_t iov_len;
};
/* Test whether this is a robust mutex with a dead owner. */
if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_PRIVATE_NP) == 0
|| mutex->__data.__owner != -THREAD_GETMEM (THREAD_SELF, tid))
return EINVAL;
mutex->__data.__owner = -mutex->__data.__owner;
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -28,6 +28,9 @@ __pthread_mutex_destroy (mutex)
if (mutex->__data.__nusers != 0)
return EBUSY;
/* Set to an invalid value. */
mutex->__data.__kind = -1;
return 0;
}
strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -18,6 +18,7 @@
02111-1307 USA. */
#include <assert.h>
#include <errno.h>
#include <string.h>
#include "pthreadP.h"
@ -40,17 +41,26 @@ __pthread_mutex_init (mutex, mutexattr)
imutexattr = (const struct pthread_mutexattr *) mutexattr ?: &default_attr;
/* Sanity checks. */
// XXX For now we cannot implement robust mutexes if they are shared.
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0
&& (imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0)
return ENOTSUP;
/* Clear the whole variable. */
memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T);
/* Copy the values from the attribute. */
mutex->__data.__kind = imutexattr->mutexkind & ~0x80000000;
mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0)
mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_PRIVATE_NP;
/* Default values: mutex not used yet. */
// mutex->__count = 0; already done by memset
// mutex->__owner = 0; already done by memset
// mutex->__nusers = 0; already done by memset
// mutex->__spins = 0; already done by memset
// mutex->__next = NULL; already done by memset
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -19,6 +19,7 @@
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <lowlevellock.h>
@ -37,6 +38,7 @@ __pthread_mutex_lock (mutex)
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
int retval = 0;
switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
{
/* Recursive mutex. */
@ -57,23 +59,23 @@ __pthread_mutex_lock (mutex)
/* We have to get the mutex. */
LLL_MUTEX_LOCK (mutex->__data.__lock);
assert (mutex->__data.__owner == 0);
mutex->__data.__count = 1;
break;
/* Error checking mutex. */
case PTHREAD_MUTEX_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
if (mutex->__data.__owner == id)
if (__builtin_expect (mutex->__data.__owner == id, 0))
return EDEADLK;
/* FALLTHROUGH */
default:
/* Correct code cannot set any other type. */
case PTHREAD_MUTEX_TIMED_NP:
simple:
/* Normal mutex. */
LLL_MUTEX_LOCK (mutex->__data.__lock);
assert (mutex->__data.__owner == 0);
break;
case PTHREAD_MUTEX_ADAPTIVE_NP:
@ -101,17 +103,79 @@ __pthread_mutex_lock (mutex)
mutex->__data.__spins += (cnt - mutex->__data.__spins) / 8;
}
assert (mutex->__data.__owner == 0);
break;
case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
/* Check whether we already hold the mutex. */
if (abs (mutex->__data.__owner) == id)
{
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
return EAGAIN;
++mutex->__data.__count;
return 0;
}
/* We have to get the mutex. */
LLL_MUTEX_LOCK (mutex->__data.__lock);
mutex->__data.__count = 1;
goto robust;
case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
if (__builtin_expect (abs (mutex->__data.__owner) == id, 0))
return EDEADLK;
/* FALLTHROUGH */
case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
LLL_MUTEX_LOCK (mutex->__data.__lock);
robust:
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_NOTRECOVERABLE, 0))
{
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
lll_mutex_unlock (mutex->__data.__lock);
return ENOTRECOVERABLE;
}
/* This mutex is either healthy or we can try to recover it. */
assert (mutex->__data.__owner == 0
|| mutex->__data.__owner == PTHREAD_MUTEX_OWNERDEAD);
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_OWNERDEAD, 0))
{
retval = EOWNERDEAD;
/* We signal ownership of a not yet recovered robust mutex
by storing the negative thread ID. */
id = -id;
}
ENQUEUE_MUTEX (mutex);
break;
default:
/* Correct code cannot set any other type. */
return EINVAL;
}
/* Record the ownership. */
assert (mutex->__data.__owner == 0);
mutex->__data.__owner = id;
#ifndef NO_INCR
++mutex->__data.__nusers;
#endif
return 0;
return retval;
}
#ifndef __pthread_mutex_lock
strong_alias (__pthread_mutex_lock, pthread_mutex_lock)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <assert.h>
#include <errno.h>
#include "pthreadP.h"
#include <lowlevellock.h>
@ -49,17 +50,15 @@ pthread_mutex_timedlock (mutex, abstime)
goto out;
}
else
{
/* We have to get the mutex. */
result = lll_mutex_timedlock (mutex->__data.__lock, abstime);
if (result != 0)
goto out;
/* We have to get the mutex. */
result = lll_mutex_timedlock (mutex->__data.__lock, abstime);
/* Only locked once so far. */
mutex->__data.__count = 1;
}
if (result != 0)
goto out;
/* Only locked once so far. */
mutex->__data.__count = 1;
break;
/* Error checking mutex. */
@ -70,8 +69,6 @@ pthread_mutex_timedlock (mutex, abstime)
/* FALLTHROUGH */
default:
/* Correct code cannot set any other type. */
case PTHREAD_MUTEX_TIMED_NP:
simple:
/* Normal mutex. */
@ -104,6 +101,75 @@ pthread_mutex_timedlock (mutex, abstime)
mutex->__data.__spins += (cnt - mutex->__data.__spins) / 8;
}
break;
case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
/* Check whether we already hold the mutex. */
if (abs (mutex->__data.__owner) == id)
{
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
return EAGAIN;
++mutex->__data.__count;
goto out;
}
/* We have to get the mutex. */
result = lll_mutex_timedlock (mutex->__data.__lock, abstime);
if (result != 0)
goto out;
/* Only locked once so far. */
mutex->__data.__count = 1;
goto robust;
case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
if (__builtin_expect (abs (mutex->__data.__owner) == id, 0))
return EDEADLK;
/* FALLTHROUGH */
case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
result = lll_mutex_timedlock (mutex->__data.__lock, abstime);
if (result != 0)
goto out;
robust:
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_NOTRECOVERABLE, 0))
{
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
lll_mutex_unlock (mutex->__data.__lock);
return ENOTRECOVERABLE;
}
/* This mutex is either healthy or we can try to recover it. */
assert (mutex->__data.__owner == 0
|| mutex->__data.__owner == PTHREAD_MUTEX_OWNERDEAD);
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_OWNERDEAD, 0))
{
result = EOWNERDEAD;
/* We signal ownership of a not yet recovered robust mutex
by storing the negative thread ID. */
mutex->__data.__owner = -id;
++mutex->__data.__nusers;
}
ENQUEUE_MUTEX (mutex);
break;
default:
/* Correct code cannot set any other type. */
return EINVAL;
}
if (result == 0)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -17,7 +17,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <lowlevellock.h>
@ -26,13 +28,12 @@ int
__pthread_mutex_trylock (mutex)
pthread_mutex_t *mutex;
{
pid_t id;
pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
{
/* Recursive mutex. */
case PTHREAD_MUTEX_RECURSIVE_NP:
id = THREAD_GETMEM (THREAD_SELF, tid);
/* Check whether we already hold the mutex. */
if (mutex->__data.__owner == id)
{
@ -56,20 +57,96 @@ __pthread_mutex_trylock (mutex)
break;
case PTHREAD_MUTEX_ERRORCHECK_NP:
/* Error checking mutex. We do not check for deadlocks. */
default:
/* Correct code cannot set any other type. */
/* Check whether we already hold the mutex. */
if (__builtin_expect (mutex->__data.__owner == id, 0))
return EDEADLK;
/* FALLTHROUGH */
case PTHREAD_MUTEX_TIMED_NP:
case PTHREAD_MUTEX_ADAPTIVE_NP:
/* Normal mutex. */
if (lll_mutex_trylock (mutex->__data.__lock) == 0)
if (lll_mutex_trylock (mutex->__data.__lock) != 0)
break;
/* Record the ownership. */
mutex->__data.__owner = id;
++mutex->__data.__nusers;
return 0;
case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
/* Check whether we already hold the mutex. */
if (abs (mutex->__data.__owner) == id)
{
/* Record the ownership. */
mutex->__data.__owner = THREAD_GETMEM (THREAD_SELF, tid);
++mutex->__data.__nusers;
/* Just bump the counter. */
if (__builtin_expect (mutex->__data.__count + 1 == 0, 0))
/* Overflow of the counter. */
return EAGAIN;
++mutex->__data.__count;
return 0;
}
/* We have to get the mutex. */
if (lll_mutex_trylock (mutex->__data.__lock) == 0)
{
mutex->__data.__count = 1;
goto robust;
}
break;
case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
/* Check whether we already hold the mutex. */
if (__builtin_expect (abs (mutex->__data.__owner) == id, 0))
return EDEADLK;
/* FALLTHROUGH */
case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
if (lll_mutex_trylock (mutex->__data.__lock) != 0)
break;
robust:
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_NOTRECOVERABLE, 0))
{
/* This mutex is now not recoverable. */
mutex->__data.__count = 0;
lll_mutex_unlock (mutex->__data.__lock);
return ENOTRECOVERABLE;
}
/* This mutex is either healthy or we can try to recover it. */
assert (mutex->__data.__owner == 0
|| mutex->__data.__owner == PTHREAD_MUTEX_OWNERDEAD);
/* Record the ownership. */
int retval = 0;
if (__builtin_expect (mutex->__data.__owner
== PTHREAD_MUTEX_OWNERDEAD, 0))
{
retval = EOWNERDEAD;
/* We signal ownership of a not yet recovered robust
mutex by storing the negative thread ID. */
id = -id;
}
ENQUEUE_MUTEX (mutex);
mutex->__data.__owner = id;
++mutex->__data.__nusers;
return retval
;
default:
/* Correct code cannot set any other type. */
return EINVAL;
}
return EBUSY;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -18,6 +18,7 @@
02111-1307 USA. */
#include <errno.h>
#include <stdlib.h>
#include "pthreadP.h"
#include <lowlevellock.h>
@ -28,6 +29,8 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
pthread_mutex_t *mutex;
int decr;
{
int newowner = 0;
switch (__builtin_expect (mutex->__data.__kind, PTHREAD_MUTEX_TIMED_NP))
{
case PTHREAD_MUTEX_RECURSIVE_NP:
@ -47,16 +50,63 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
return EPERM;
break;
default:
/* Correct code cannot set any other type. */
case PTHREAD_MUTEX_TIMED_NP:
case PTHREAD_MUTEX_ADAPTIVE_NP:
/* Normal mutex. Nothing special to do. */
break;
case PTHREAD_MUTEX_ROBUST_PRIVATE_RECURSIVE_NP:
/* Recursive mutex. */
if (mutex->__data.__owner == -THREAD_GETMEM (THREAD_SELF, tid))
{
if (--mutex->__data.__count != 0)
/* We still hold the mutex. */
return ENOTRECOVERABLE;
goto notrecoverable;
}
if (mutex->__data.__owner != THREAD_GETMEM (THREAD_SELF, tid))
return EPERM;
if (--mutex->__data.__count != 0)
/* We still hold the mutex. */
return 0;
goto robust;
case PTHREAD_MUTEX_ROBUST_PRIVATE_ERRORCHECK_NP:
/* Error checking mutex. */
if (abs (mutex->__data.__owner) != THREAD_GETMEM (THREAD_SELF, tid)
|| ! lll_mutex_islocked (mutex->__data.__lock))
return EPERM;
/* FALLTHROUGH */
case PTHREAD_MUTEX_ROBUST_PRIVATE_NP:
case PTHREAD_MUTEX_ROBUST_PRIVATE_ADAPTIVE_NP:
/* If the previous owner died and the caller did not succeed in
making the state consistent, mark the mutex as unrecoverable
and make all waiters. */
if (__builtin_expect (mutex->__data.__owner
== -THREAD_GETMEM (THREAD_SELF, tid)
|| (mutex->__data.__owner
== PTHREAD_MUTEX_NOTRECOVERABLE), 0))
notrecoverable:
newowner = PTHREAD_MUTEX_NOTRECOVERABLE;
robust:
/* Remove mutex from the list. */
DEQUEUE_MUTEX (mutex);
break;
default:
/* Correct code cannot set any other type. */
return EINVAL;
}
/* Always reset the owner field. */
mutex->__data.__owner = 0;
mutex->__data.__owner = newowner;
if (decr)
/* One less user. */
--mutex->__data.__nusers;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -29,9 +29,7 @@ pthread_mutexattr_getpshared (attr, pshared)
iattr = (const struct pthread_mutexattr *) attr;
/* We use bit 31 to signal whether the mutex is going to be
process-shared or not. */
*pshared = ((iattr->mutexkind & 0x80000000) != 0
*pshared = ((iattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_PSHARED) != 0
? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE);
return 0;

View File

@ -1,6 +1,6 @@
/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Generic.
Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -17,21 +17,20 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* Never include <bits/ipctypes.h> directly.
*/
#ifndef _BITS_IPCTYPES_H
#define _BITS_IPCTYPES_H 1
#include <bits/types.h>
/* Used in `struct shmid_ds'. */
# if __WORDSIZE == 32
typedef unsigned short int __ipc_pid_t;
# else
typedef int __ipc_pid_t;
# endif
#include <pthreadP.h>
#endif /* bits/ipctypes.h */
int
pthread_mutexattr_getrobust_np (attr, robustness)
const pthread_mutexattr_t *attr;
int *robustness;
{
const struct pthread_mutexattr *iattr;
iattr = (const struct pthread_mutexattr *) attr;
*robustness = ((iattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0
? PTHREAD_MUTEX_ROBUST_NP : PTHREAD_MUTEX_STALLED_NP);
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -29,9 +29,7 @@ pthread_mutexattr_gettype (attr, kind)
iattr = (const struct pthread_mutexattr *) attr;
/* We use bit 31 to signal whether the mutex is going to be
process-shared or not. */
*kind = iattr->mutexkind & ~0x80000000;
*kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -34,12 +34,10 @@ pthread_mutexattr_setpshared (attr, pshared)
iattr = (struct pthread_mutexattr *) attr;
/* We use bit 31 to signal whether the mutex is going to be
process-shared or not. */
if (pshared == PTHREAD_PROCESS_PRIVATE)
iattr->mutexkind &= ~0x80000000;
iattr->mutexkind &= ~PTHREAD_MUTEXATTR_FLAG_PSHARED;
else
iattr->mutexkind |= 0x80000000;
iattr->mutexkind |= PTHREAD_MUTEXATTR_FLAG_PSHARED;
return 0;
}

View File

@ -1,6 +1,6 @@
/* The `struct utmp' type, describing entries in the utmp file. Generic/BSDish
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -17,34 +17,27 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _UTMP_H
# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
#endif
#include <paths.h>
#include <time.h>
#include <errno.h>
#include <pthreadP.h>
#define UT_NAMESIZE 8
#define UT_LINESIZE 8
#define UT_HOSTSIZE 16
int
pthread_mutexattr_setrobust_np (attr, robustness)
pthread_mutexattr_t *attr;
int robustness;
{
if (robustness != PTHREAD_MUTEX_STALLED_NP
&& __builtin_expect (robustness != PTHREAD_MUTEX_ROBUST_NP, 0))
return EINVAL;
struct pthread_mutexattr *iattr = (struct pthread_mutexattr *) attr;
struct lastlog
{
time_t ll_time;
char ll_line[UT_LINESIZE];
char ll_host[UT_HOSTSIZE];
};
/* We use bit 30 to signal whether the mutex is going to be
robust or not. */
if (robustness == PTHREAD_MUTEX_STALLED_NP)
iattr->mutexkind &= ~PTHREAD_MUTEXATTR_FLAG_ROBUST;
else
iattr->mutexkind |= PTHREAD_MUTEXATTR_FLAG_ROBUST;
struct utmp
{
char ut_line[UT_LINESIZE];
char ut_user[UT_NAMESIZE];
#define ut_name ut_user
char ut_host[UT_HOSTSIZE];
long int ut_time;
};
#define _HAVE_UT_HOST 1 /* We have the ut_host field. */
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -33,9 +33,7 @@ __pthread_mutexattr_settype (attr, kind)
iattr = (struct pthread_mutexattr *) attr;
/* We use bit 31 to signal whether the mutex is going to be
process-shared or not. */
iattr->mutexkind = (iattr->mutexkind & 0x80000000) | kind;
iattr->mutexkind = (iattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_BITS) | kind;
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -19,7 +19,7 @@
#include <errno.h>
#include <stdlib.h>
#include "atomic.h"
#include <atomic.h>
#include "pthreadP.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -20,7 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include "atomic.h"
#include <atomic.h>
#include "pthreadP.h"

View File

@ -60,24 +60,39 @@ enum
#endif
};
/* Mutex initializers. */
#define PTHREAD_MUTEX_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0 } }
#ifdef __USE_GNU
# if __WORDSIZE == 64
/* Robust mutex or not flags. */
enum
{
PTHREAD_MUTEX_STALLED_NP,
PTHREAD_MUTEX_ROBUST_NP
};
#endif
/* Mutex initializers. */
#if __WORDSIZE == 64
# define PTHREAD_MUTEX_INITIALIZER \
{ { 0, 0, 0, 0, 0, 0, (void *) 0, (void *) 0 } }
# ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0 } }
{ { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, (void *) 0, (void *) 0 } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0 } }
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, (void *) 0, (void *) 0 } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0 } }
# else
{ { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, (void *) 0, (void *) 0 } }
# endif
#else
# define PTHREAD_MUTEX_INITIALIZER \
{ { 0, 0, 0, 0, 0, { 0 } } }
# ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, 0 } }
{ { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { 0 } } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, 0 } }
{ { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { 0 } } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
{ { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, 0 } }
{ { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { 0 } } }
# endif
#endif
@ -696,6 +711,12 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
#ifdef __USE_GNU
/* Declare the state protected by MUTEX as consistent. */
extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) __THROW;
#endif
/* Functions for handling mutex attributes. */
/* Initialize mutex attribute object ATTR with default attributes
@ -726,6 +747,16 @@ extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
__THROW;
#endif
#ifdef __USE_GNU
/* Get the robustness flag of the mutex attribute ATTR. */
extern int pthread_mutexattr_getrobust_np (__const pthread_mutexattr_t *__attr,
int *__robustness) __THROW;
/* Set the robustness flag of the mutex attribute ATTR. */
extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
int __robustness) __THROW;
#endif
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Functions for handling read-write locks. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -28,7 +28,11 @@
SIGCANCEL or SIGTIMER to be handled. */
# define LIBC_SIGACTION 1
# include <nptl/sysdeps/pthread/sigaction.c>
/* Note this include must be one that isn't found using a -I directory such
as -I. or -I.. for using an explicit <sysdeps/...> path, because that
would reset the search path starting position for the #include_next
below, to after that -I directory, and skip the search we want to do. */
# include "sigaction.c"
int
__sigaction (sig, act, oact)

View File

@ -45,7 +45,7 @@ typedef union
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
typedef union
typedef union __pthread_mutex_u
{
struct
{
@ -56,7 +56,11 @@ typedef union
binary compatibility. */
int __kind;
unsigned int __nusers;
int __spins;
union
{
int __spins;
union __pthread_mutex_u *__next;
};
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;

View File

@ -57,7 +57,7 @@ __new_sem_wait:
cfi_offset(6, -12) /* %esi */
3: movl (%ebx), %eax
2: testl %eax, %eax
je,pn 1f
je 1f
leal -1(%eax), %edx
LOCK
@ -73,7 +73,7 @@ __new_sem_wait:
cfi_adjust_cfa_offset(-12)
ret
cfi_adjust_cfa_offset(8)
cfi_adjust_cfa_offset(12)
cfi_offset(3, -8) /* %ebx */
cfi_offset(6, -12) /* %esi */
1: call __pthread_enable_asynccancel

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -19,7 +19,7 @@
#include <unistd.h>
#include <list.h>
#include "fork.h"
#include <fork.h>
#include <dl-sysdep.h>
#include <tls.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -20,7 +20,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "fork.h"
#include <fork.h>
/* Lock to protect allocation and deallocation of fork handlers. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -19,7 +19,7 @@
#include <errno.h>
#include <stdlib.h>
#include "fork.h"
#include <fork.h>
#include <atomic.h>

View File

@ -59,7 +59,7 @@ typedef union
/* Data structures for mutex handling. The structure of the attribute
type is not exposed on purpose. */
typedef union
typedef union __pthread_mutex_u
{
struct
{
@ -72,10 +72,19 @@ typedef union
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
#if __WORDSIZE != 64
unsigned int __nusers;
#endif
#if __WORDSIZE == 64
int __spins;
union __pthread_mutex_u *__next;
union __pthread_mutex_u *__prev;
# define __PTHREAD_MUTEX_HAVE_PREV 1
#else
unsigned int __nusers;
union
{
int __spins;
union __pthread_mutex_u *__next;
};
#endif
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;

113
nptl/tst-cancel24.cc Normal file
View File

@ -0,0 +1,113 @@
#include <cstdlib>
#include <cstdio>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static volatile bool destr_called;
static volatile bool except_caught;
static pthread_barrier_t b;
struct monitor
{
// gcc is broken and would generate a warning without this dummy
// constructor.
monitor () { }
~monitor() { destr_called = true; }
};
static void *
tf (void *arg)
{
sem_t *s = static_cast<sem_t *> (arg);
try
{
monitor m;
pthread_barrier_wait (&b);
while (1)
sem_wait (s);
}
catch (...)
{
except_caught = true;
throw;
}
return NULL;
}
static int
do_test ()
{
if (pthread_barrier_init (&b, NULL, 2) != 0)
{
puts ("barrier_init failed");
return 1;
}
sem_t s;
if (sem_init (&s, 0, 0) != 0)
{
puts ("sem_init failed");
return 1;
}
pthread_t th;
if (pthread_create (&th, NULL, tf, &s) != 0)
{
puts ("pthread_create failed");
return 1;
}
pthread_barrier_wait (&b);
/* There is unfortunately no better method to try to assure the
child thread reached the sem_wait call and is actually waiting
than to sleep here. */
sleep (1);
if (pthread_cancel (th) != 0)
{
puts ("cancel failed");
return 1;
}
void *res;
if (pthread_join (th, &res) != 0)
{
puts ("join failed");
return 1;
}
if (res != PTHREAD_CANCELED)
{
puts ("thread was not canceled");
return 1;
}
if (! except_caught)
{
puts ("exception not caught");
return 1;
}
if (! destr_called)
{
puts ("destructor not called");
return 1;
}
return 0;
}
#define TEST_FUNCTION do_test ()
#define TIMEOUT 3
#include "../test-skeleton.c"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -52,6 +52,8 @@ once_handler1 (void)
exit (1);
}
puts ("once_handler1: going to wait on cond");
pthread_cond_wait (&cond, &mut);
/* We should never get here. */
@ -139,6 +141,9 @@ do_test (void)
puts ("join didn't return PTHREAD_CANCELED");
return 1;
}
puts ("joined successfully");
printf ("once = %d\n", *(int *) &once);
if (cl_called != 1)
{

245
nptl/tst-robust1.c Normal file
View File

@ -0,0 +1,245 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
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 <pthread.h>
#include <stdio.h>
#include <stdlib.h>
static pthread_mutex_t m;
static pthread_barrier_t b;
#ifndef LOCK
# define LOCK(m) pthread_mutex_lock (m)
#endif
static void *
tf (void *arg)
{
long int round = (long int) arg;
if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0)
{
printf ("%ld: setcancelstate failed\n", round);
exit (1);
}
int e = LOCK (&m);
if (e != 0)
{
printf ("%ld: child: mutex_lock failed with error %d\n", round, e);
exit (1);
}
e = pthread_barrier_wait (&b);
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%ld: child: 1st barrier_wait failed\n", round);
exit (1);
}
e = pthread_barrier_wait (&b);
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%ld: child: 2nd barrier_wait failed\n", round);
exit (1);
}
pthread_testcancel ();
printf ("%ld: testcancel returned\n", round);
exit (1);
}
static int
do_test (void)
{
#ifdef PREPARE_TMO
PREPARE_TMO;
#endif
pthread_mutexattr_t a;
if (pthread_mutexattr_init (&a) != 0)
{
puts ("mutexattr_init failed");
return 1;
}
if (pthread_mutexattr_setrobust_np (&a, PTHREAD_MUTEX_ROBUST_NP) != 0)
{
puts ("mutexattr_setrobust failed");
return 1;
}
#ifndef NOT_CONSISTENT
if (pthread_mutex_init (&m, &a) != 0)
{
puts ("mutex_init failed");
return 1;
}
#endif
if (pthread_barrier_init (&b, NULL, 2) != 0)
{
puts ("barrier_init failed");
return 1;
}
for (long int round = 1; round < 5; ++round)
{
#ifdef NOT_CONSISTENT
if (pthread_mutex_init (&m, &a) != 0)
{
puts ("mutex_init failed");
return 1;
}
#endif
pthread_t th;
if (pthread_create (&th, NULL, tf, (void *) round) != 0)
{
printf ("%ld: create failed\n", round);
return 1;
}
int e = pthread_barrier_wait (&b);
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%ld: parent: 1st barrier_wait failed\n", round);
return 1;
}
if (pthread_cancel (th) != 0)
{
printf ("%ld: cancel failed\n", round);
return 1;
}
e = pthread_barrier_wait (&b);
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%ld: parent: 2nd barrier_wait failed\n", round);
return 1;
}
#ifndef AFTER_JOIN
if (round & 1)
#endif
{
void *res;
if (pthread_join (th, &res) != 0)
{
printf ("%ld: join failed\n", round);
return 1;
}
if (res != PTHREAD_CANCELED)
{
printf ("%ld: thread not canceled\n", round);
return 1;
}
}
e = LOCK (&m);
if (e == 0)
{
printf ("%ld: parent: mutex_lock succeeded\n", round);
return 1;
}
if (e != EOWNERDEAD)
{
printf ("%ld: parent: mutex_lock returned wrong code\n", round);
return 1;
}
#ifndef AFTER_JOIN
if ((round & 1) == 0)
{
void *res;
if (pthread_join (th, &res) != 0)
{
printf ("%ld: join failed\n", round);
return 1;
}
if (res != PTHREAD_CANCELED)
{
printf ("%ld: thread not canceled\n", round);
return 1;
}
}
#endif
#ifndef NOT_CONSISTENT
e = pthread_mutex_consistent_np (&m);
if (e != 0)
{
printf ("%ld: mutex_consistent failed with error %d\n", round, e);
return 1;
}
#endif
e = pthread_mutex_unlock (&m);
if (e != 0)
{
printf ("%ld: mutex_unlocked failed\n", round);
return 1;
}
#ifdef NOT_CONSISTENT
e = LOCK (&m);
if (e == 0)
{
printf ("%ld: locking inconsistent mutex succeeded\n", round);
return 1;
}
if (e != ENOTRECOVERABLE)
{
printf ("%ld: locking inconsistent mutex failed with error %d\n",
round, e);
return 1;
}
if (pthread_mutex_destroy (&m) != 0)
{
puts ("mutex_destroy failed");
return 1;
}
#endif
}
#ifndef NOT_CONSISTENT
if (pthread_mutex_destroy (&m) != 0)
{
puts ("mutex_destroy failed");
return 1;
}
#endif
if (pthread_mutexattr_destroy (&a) != 0)
{
puts ("mutexattr_destroy failed");
return 1;
}
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

3
nptl/tst-robust2.c Normal file
View File

@ -0,0 +1,3 @@
#define AFTER_JOIN 1
#define LOCK(m) pthread_mutex_trylock (m)
#include "tst-robust1.c"

20
nptl/tst-robust3.c Normal file
View File

@ -0,0 +1,20 @@
#include <time.h>
#include <sys/time.h>
static struct timespec tmo;
#define PREPARE_TMO \
do { \
struct timeval tv; \
gettimeofday (&tv, NULL); \
\
/* Define the timeout as one hour in the future. */ \
tmo.tv_sec = tv.tv_sec + 3600; \
tmo.tv_nsec = 0; \
} while (0)
#define LOCK(m) pthread_mutex_timedlock (m, &tmo)
#include "tst-robust1.c"

2
nptl/tst-robust4.c Normal file
View File

@ -0,0 +1,2 @@
#define NOT_CONSISTENT 1
#include "tst-robust1.c"

2
nptl/tst-robust5.c Normal file
View File

@ -0,0 +1,2 @@
#define NOT_CONSISTENT 1
#include "tst-robust2.c"

2
nptl/tst-robust6.c Normal file
View File

@ -0,0 +1,2 @@
#define NOT_CONSISTENT 1
#include "tst-robust3.c"

68
nptl/tst-typesizes.c Normal file
View File

@ -0,0 +1,68 @@
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
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 <stdio.h>
#include <pthreadP.h>
#include <semaphore.h>
static int
do_test (void)
{
int result = 0;
#define TEST_TYPE(name) \
printf ("%s: ", #name); \
if (sizeof (name) != sizeof (((name *) 0)->__size)) \
{ \
printf ("expected %zu, is %zu\n", \
sizeof (((name *) 0)->__size), sizeof (name)); \
result = 1; \
} \
else \
puts ("OK")
TEST_TYPE (pthread_mutex_t);
TEST_TYPE (pthread_cond_t);
TEST_TYPE (pthread_rwlock_t);
#define TEST_TYPE2(name, internal) \
printf ("%s: ", #name); \
if (sizeof (((name *) 0)->__size) < sizeof (internal)) \
{ \
printf ("expected %zu, is %zu\n", \
sizeof (((name *) 0)->__size), sizeof (internal)); \
result = 1; \
} \
else \
puts ("OK")
TEST_TYPE2 (pthread_attr_t, struct pthread_attr);
TEST_TYPE2 (pthread_mutexattr_t, struct pthread_mutexattr);
TEST_TYPE2 (pthread_condattr_t, struct pthread_condattr);
TEST_TYPE2 (pthread_rwlockattr_t, struct pthread_rwlockattr);
TEST_TYPE2 (pthread_barrier_t, struct pthread_barrier);
TEST_TYPE2 (pthread_barrierattr_t, struct pthread_barrierattr);
TEST_TYPE2 (sem_t, struct sem);
return result;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>
and Richard Henderson <rth@redhat.com>, 2003.
@ -23,7 +23,7 @@
#include <string.h>
#include <unistd.h>
#include "pthreadP.h"
#include "jmpbuf-unwind.h"
#include <jmpbuf-unwind.h>
#ifdef HAVE_FORCED_UNWIND

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -23,7 +23,7 @@
static const char banner[] =
#include "banner.h"
"Copyright (C) 2003 Free Software Foundation, Inc.\n\
"Copyright (C) 2005 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n"

View File

@ -1,2 +1,2 @@
#define BE_AIO64
#include "aio_read.c"
#include <aio_read.c>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1999, 2005 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
@ -20,7 +20,7 @@
#include <errno.h>
#include <signal.h>
#include "aio_misc.h"
#include <aio_misc.h>
int
__aio_sigqueue (sig, val, caller_pid)

View File

@ -1,2 +1,2 @@
#define BE_AIO64
#include "aio_write.c"
#include <aio_write.c>

View File

@ -13,7 +13,17 @@ BEGIN { started = 0 }
/^#/ { print; next }
NF >= 1 && !started {
print "void dummy(void) {";
if (test) {
print "\n#include <stdio.h>";
print "\nstatic int do_test (void)\n{\n int bad = 0, good = 0;\n";
print "#define TEST(name, source, expr) \\\n" \
" if (asconst_##name != (expr)) { ++bad;" \
" fprintf (stderr, \"%s: %s is %ld but %s is %ld\\n\"," \
" source, #name, (long int) asconst_##name, #expr, (long int) (expr));" \
" } else ++good;\n";
}
else
print "void dummy(void) {";
started = 1;
}
@ -25,8 +35,18 @@ NF == 1 { sub(/^.*$/, "& &"); }
NF > 1 {
name = $1;
sub(/^[^ ]+[ ]+/, "");
printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
name, $0;
if (test)
print " TEST (" name ", \"" FILENAME ":" FNR "\", " $0 ")";
else
printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
name, $0;
}
END { if (started) print "}" }
END {
if (test) {
print " printf (\"%d errors in %d tests\\n\", bad, good + bad);"
print " return bad != 0 || good == 0;\n}\n";
print "#define TEST_FUNCTION do_test ()";
}
else if (started) print "}";
}

View File

@ -1,5 +1,6 @@
/* Software floating-point emulation.
Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
Copyright (C) 1997,1998,1999,2000,2002,2003,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
@ -24,7 +25,7 @@
#ifndef SOFT_FP_H
#define SOFT_FP_H
#include "sfp-machine.h"
#include <sfp-machine.h>
/* Allow sfp-machine to have its own byte order definitions. */
#ifndef __BYTE_ORDER

View File

@ -1,3 +1,3 @@
#define GEN_THIS __GT_BIGFILE
#define tmpfile tmpfile64
#include "tmpfile.c"
#include <tmpfile.c>

View File

@ -63,8 +63,7 @@ tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon2 tst-strtoll tst-environ \
tst-xpg-basename tst-random tst-random2 tst-bsearch \
tst-limits tst-rand48 bug-strtod tst-setcontext \
test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
tst-ucontext-off
test-a64l tst-qsort tst-system testmb2 bug-strtod2
include ../Makeconfig
@ -125,7 +124,7 @@ endif
$(objpfx)isomac.out: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' \
'-I../include -I.. $(+sysdep-includes) $(sysincludes)' > $<.out
'-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out
isomac-CFLAGS = -O
$(objpfx)isomac: isomac.c

View File

@ -1,35 +0,0 @@
#include <stddef.h>
#include <stdio.h>
#include <sys/ucontext.h>
#include <ucontext_i.h>
static int
do_test (void)
{
int nerrors = 0;
int ntests = 0;
#define TEST(member, val) \
do { \
if (offsetof (struct ucontext, member) != val) \
{ \
printf ("offsetof(%s) = %zu, %s = %zu\n", \
#member, offsetof (struct ucontext, member), \
#val, (size_t) val); \
++nerrors; \
} \
++ntests; \
} while (0)
#ifdef TESTS
TESTS
#endif
printf ("%d errors in %d tests\n", nerrors, ntests);
return nerrors != 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

View File

@ -1,43 +0,0 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
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. */
#ifndef _BITS_ATOMIC_H
#define _BITS_ATOMIC_H 1
/* We have by default no support for atomic operations. So define
them non-atomic. If this is a problem somebody will have to come
up with real definitions. */
/* The only basic operation needed is compare and exchange. */
#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
({ __typeof (mem) __gmemp = (mem); \
__typeof (*mem) __gret = *__gmemp; \
__typeof (*mem) __gnewval = (newval); \
\
if (__gret == (oldval)) \
*__gmemp = __gnewval; \
__gret; })
#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ __typeof (mem) __gmemp = (mem); \
__typeof (*mem) __gnewval = (newval); \
\
*__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
#endif /* bits/atomic.h */

View File

@ -1,37 +0,0 @@
/* Directory entry structure `struct dirent'. Stub version.
Copyright (C) 1996, 1997 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. */
#ifndef _DIRENT_H
# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
#endif
struct dirent
{
char d_name[1]; /* Variable length. */
int d_fileno;
};
#ifdef __USE_LARGEFILE64
struct dirent64
{
char d_name[1]; /* Variable length. */
int d_fileno;
};
#endif

View File

@ -1,14 +0,0 @@
/* This file specifies the native word size of the machine, which indicates
the ELF file class used for executables and shared objects on this
machine. */
#ifndef _LINK_H
# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
#endif
#include <bits/wordsize.h>
#define __ELF_NATIVE_CLASS __WORDSIZE
/* The entries in the .hash table always have a size of 32 bits. */
typedef uint32_t Elf_Symndx;

View File

@ -1,13 +0,0 @@
/* This file should define __BYTE_ORDER as appropriate for the machine
in question. See string/endian.h for how to define it.
If only the stub bits/endian.h applies to a particular configuration,
bytesex.h is generated by running a program on the host machine.
So if cross-compiling to a machine with a different byte order,
the bits/endian.h file for that machine must exist. */
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#error Machine byte order unknown.

View File

@ -1,35 +0,0 @@
/* Copyright (C) 1991, 1994, 1996, 1997 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. */
/* This file defines the `errno' constants. */
#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
#undef __need_Emath
#define __Emath_defined 1
# define EDOM XXX <--- fill in what is actually needed
# define EILSEQ XXX <--- fill in what is actually needed
# define ERANGE XXX <--- fill in what is actually needed
#endif
#ifdef _ERRNO_H
# error "Define here all the missing error messages for the port. These"
# error "must match the numbers of the kernel."
# define Exxxx XXX
...
#endif

View File

@ -1,95 +0,0 @@
/* O_*, F_*, FD_* bit values for stub configuration.
Copyright (C) 1991, 1992, 1997, 2000, 2004 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. */
/* These values should be changed as appropriate for your system. */
#ifndef _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
/* File access modes for `open' and `fcntl'. */
#define O_RDONLY 0 /* Open read-only. */
#define O_WRONLY 1 /* Open write-only. */
#define O_RDWR 2 /* Open read/write. */
/* Bits OR'd into the second argument to open. */
#define O_CREAT 0x0200 /* Create file if it doesn't exist. */
#define O_EXCL 0x0800 /* Fail if file already exists. */
#define O_TRUNC 0x0400 /* Truncate file to zero length. */
#define O_NOCTTY 0x0100 /* Don't assign a controlling terminal. */
/* File status flags for `open' and `fcntl'. */
#define O_APPEND 0x0008 /* Writes append to the file. */
#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */
#ifdef __USE_BSD
# define O_NDELAY O_NONBLOCK
#endif
/* Mask for file access modes. This is system-dependent in case
some system ever wants to define some other flavor of access. */
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
/* Values for the second argument to `fcntl'. */
#define F_DUPFD 0 /* Duplicate file descriptor. */
#define F_GETFD 1 /* Get file descriptor flags. */
#define F_SETFD 2 /* Set file descriptor flags. */
#define F_GETFL 3 /* Get file status flags. */
#define F_SETFL 4 /* Set file status flags. */
#if defined __USE_BSD || defined __USE_UNIX98
# define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
# define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
#endif
#define F_GETLK 7 /* Get record locking info. */
#define F_SETLK 8 /* Set record locking info. */
#define F_SETLKW 9 /* Set record locking info, wait. */
/* File descriptor flags used with F_GETFD and F_SETFD. */
#define FD_CLOEXEC 1 /* Close on exec. */
#include <bits/types.h>
/* The structure describing an advisory lock. This is the type of the third
argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
/* Values for the `l_type' field of a `struct flock'. */
#define F_RDLCK 1 /* Read lock. */
#define F_WRLCK 2 /* Write lock. */
#define F_UNLCK 3 /* Remove lock. */
/* Advise to `posix_fadvise'. */
#ifdef __USE_XOPEN2K
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif

View File

@ -1,56 +0,0 @@
/* Copyright (C) 1997, 1998, 1999, 2000, 2001 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. */
#ifndef _FENV_H
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
/* Here should be the exception be defined:
FE_INVALID
FE_DIVBYZERO
FE_OVERFLOW
FE_UNDERFLOW
FE_INEXACT
We define no macro which signals no exception is supported. */
#define FE_ALL_EXCEPT 0
/* Here should the rounding modes be defined:
FE_TONEAREST
FE_DOWNWARD
FE_UPWARD
FE_TOWARDZERO
We define no macro which signals no rounding mode is selectable. */
/* Type representing exception flags. */
typedef unsigned int fexcept_t;
/* Type representing floating-point environment. */
typedef struct
{
fexcept_t __excepts;
/* XXX I don't know what else we should save. */
}
fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((__const fenv_t *) -1l)

View File

@ -1,8 +0,0 @@
/* This file provides inline versions of floating-pint environment
handling functions. If there were any. */
#ifndef __NO_MATH_INLINES
/* Here is where the code would go. */
#endif

View File

@ -1,29 +0,0 @@
/* Stub `HUGE_VAL' constant.
Used by <stdlib.h> and <math.h> functions for overflow.
Copyright (C) 1992, 1996, 1997, 2004 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. */
#ifndef _MATH_H
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
#endif
#if __GNUC_PREREQ(3,3)
# define HUGE_VAL (__builtin_huge_val())
#else
# define HUGE_VAL 1e37
#endif

View File

@ -1,29 +0,0 @@
/* Stub `HUGE_VALF' constant.
Used by <stdlib.h> and <math.h> functions for overflow.
Copyright (C) 1992, 1996, 1997, 2004 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. */
#ifndef _MATH_H
# error "Never use <bits/huge_valf.h> directly; include <math.h> instead."
#endif
#if __GNUC_PREREQ(3,3)
# define HUGE_VALF (__builtin_huge_valf())
#else
# define HUGE_VALF 1e37f
#endif

View File

@ -1,29 +0,0 @@
/* Default `HUGE_VALL' constant.
Used by <stdlib.h> and <math.h> functions for overflow.
Copyright (C) 1992, 1996, 1997, 2004 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. */
#ifndef _MATH_H
# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
#endif
#if __GNUC_PREREQ(3,3)
# define HUGE_VALL (__builtin_huge_vall())
#else
# define HUGE_VALL ((long double) HUGE_VAL)
#endif

View File

@ -1,82 +0,0 @@
/* Copyright (C) 1997, 2000, 2004 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. */
/* Generic version. */
#ifndef _NETINET_IN_H
# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
#endif
/* Options for use with `getsockopt' and `setsockopt' at the IP level.
The first word in the comment at the right is the data type used;
"bool" means a boolean value stored in an `int'. */
#define IP_OPTIONS 1 /* ip_opts; IP per-packet options. */
#define IP_HDRINCL 2 /* int; Header is included with data. */
#define IP_TOS 3 /* int; IP type of service and precedence. */
#define IP_TTL 4 /* int; IP time to live. */
#define IP_RECVOPTS 5 /* bool; Receive all IP options w/datagram. */
#define IP_RECVRETOPTS 6 /* bool; Receive IP options for response. */
#define IP_RECVDSTADDR 7 /* bool; Receive IP dst addr w/datagram. */
#define IP_RETOPTS 8 /* ip_opts; Set/get IP per-packet options. */
#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* i_char; set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
The `ip_dst' field is used for the first-hop gateway when using a
source route (this gets put into the header proper). */
struct ip_opts
{
struct in_addr ip_dst; /* First hop; zero without source route. */
char ip_opts[40]; /* Actually variable in size. */
};
/* IPV6 socket options. */
#define IPV6_ADDRFORM 1
#define IPV6_RXINFO 2
#define IPV6_HOPOPTS 3
#define IPV6_DSTOPTS 4
#define IPV6_RTHDR 5
#define IPV6_PKTOPTIONS 6
#define IPV6_CHECKSUM 7
#define IPV6_HOPLIMIT 8
#define IPV6_TXINFO IPV6_RXINFO
#define SCM_SRCINFO IPV6_TXINFO
#define SCM_SRCRT IPV6_RXSRCRT
#define IPV6_UNICAST_HOPS 16
#define IPV6_MULTICAST_IF 17
#define IPV6_MULTICAST_HOPS 18
#define IPV6_MULTICAST_LOOP 19
#define IPV6_JOIN_GROUP 20
#define IPV6_LEAVE_GROUP 21
/* Obsolete synonyms for the above. */
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
#define IPV6_RXHOPOPTS IPV6_HOPOPTS
#define IPV6_RXDSTOPTS IPV6_DSTOPTS
/* Routing header options for IPv6. */
#define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
#define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */

View File

@ -1,33 +0,0 @@
/* Default `INFINITY' constant.
Copyright (C) 2004 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. */
#ifndef _MATH_H
# error "Never use <bits/inf.h> directly; include <math.h> instead."
#endif
/* If we don't have real infinity, then we're supposed to produce a float
value that overflows at translation time, which is required to produce
a diagnostic. GCC's __builtin_inff produces a quite nice diagnostic
that tells the user that the target doesn't support infinities. */
#if __GNUC_PREREQ(3,3)
# define INFINITY (__builtin_inff())
#else
# define INFINITY (1e9999f)
#endif

View File

@ -1,114 +0,0 @@
/* Structure types for pre-termios terminal ioctls. Generic Unix version.
Copyright (C) 1996, 1997 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. */
#ifndef _SYS_IOCTL_H
# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
#endif
#if defined TIOCGETC || defined TIOCSETC
/* Type of ARG for TIOCGETC and TIOCSETC requests. */
struct tchars
{
char t_intrc; /* Interrupt character. */
char t_quitc; /* Quit character. */
char t_startc; /* Start-output character. */
char t_stopc; /* Stop-output character. */
char t_eofc; /* End-of-file character. */
char t_brkc; /* Input delimiter character. */
};
#define _IOT_tchars /* Hurd ioctl type field. */ \
_IOT (_IOTS (char), 6, 0, 0, 0, 0)
#endif
#if defined TIOCGLTC || defined TIOCSLTC
/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
struct ltchars
{
char t_suspc; /* Suspend character. */
char t_dsuspc; /* Delayed suspend character. */
char t_rprntc; /* Reprint-line character. */
char t_flushc; /* Flush-output character. */
char t_werasc; /* Word-erase character. */
char t_lnextc; /* Literal-next character. */
};
#define _IOT_ltchars /* Hurd ioctl type field. */ \
_IOT (_IOTS (char), 6, 0, 0, 0, 0)
#endif
/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
struct sgttyb
{
char sg_ispeed; /* Input speed. */
char sg_ospeed; /* Output speed. */
char sg_erase; /* Erase character. */
char sg_kill; /* Kill character. */
short int sg_flags; /* Mode flags. */
};
#define _IOT_sgttyb /* Hurd ioctl type field. */ \
_IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
#if defined TIOCGWINSZ || defined TIOCSWINSZ
/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */
struct winsize
{
unsigned short int ws_row; /* Rows, in characters. */
unsigned short int ws_col; /* Columns, in characters. */
/* These are not actually used. */
unsigned short int ws_xpixel; /* Horizontal pixels. */
unsigned short int ws_ypixel; /* Vertical pixels. */
};
#define _IOT_winsize /* Hurd ioctl type field. */ \
_IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
#endif
#if defined TIOCGSIZE || defined TIOCSSIZE
/* The BSD-style ioctl constructor macros use `sizeof', which can't be used
in a preprocessor conditional. Since the commands are always unique
regardless of the size bits, we can safely define away `sizeof' for the
purpose of the conditional. */
# define sizeof(type) 0
# if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
compatibility with Sun; they define `struct ttysize' to have identical
layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
(likewise TIOCSSIZE and TIOCSWINSZ). */
struct ttysize
{
unsigned short int ts_lines;
unsigned short int ts_cols;
unsigned short int ts_xxx;
unsigned short int ts_yyy;
};
#define _IOT_ttysize _IOT_winsize
# else
/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
TIOCGWINSZ are separate commands that do the same thing with different
structures (likewise TIOCSSIZE and TIOCSWINSZ). */
struct ttysize
{
int ts_lines, ts_cols; /* Lines and columns, in characters. */
};
# endif
# undef sizeof /* See above. */
#endif

Some files were not shown because too many files have changed in this diff Show More