Updated to fedora-glibc-20051115T0809

This commit is contained in:
Jakub Jelinek 2005-11-15 08:22:03 +00:00
parent 1beea155ae
commit 22d7fbdbae
175 changed files with 4388 additions and 2734 deletions

291
ChangeLog
View File

@ -1,5 +1,296 @@
2005-11-14 Ulrich Drepper <drepper@redhat.com>
* elf/dl-open.c [!SHARED]: Remove _dl_tls_static_size definition.
* sysdeps/generic/libc-tls.c: Initialize _dl_tls_static_size here.
2005-11-11 Ulrich Drepper <drepper@redhat.com>
* io/Makefile (routines): Add fstatat, fstatat64, fxstatat, fxstatat64,
fchownat, and unlinkat.
(static-only-routines): Add fstatat and fstatat64.
(tests): Add tst-unlinkat, tst-fstatat, tst-futimesat, tst-renameat,
and tst-fchownat.
* io/Versions [GLIBC_2.4]: Add fchownat, __fxstatat, __fxstatat64,
and unlinkat.
* io/fcntl.h: Define AT_FDCWD, AT_SYMLINK_NOFOLLOW, and AT_REMOVEDIR.
* io/fstatat.c: New file.
* io/fstatat64.c: New file.
* io/sys/stat.h: Declare fstatat, fstatat64, __fxstatat, __fxstatat64
and define fstatat and fstatat64 inline functions.
* libio/stdio.h: Declare renameat.
* misc/Makefile (routines): Add futimesat.
* misc/Versions [GLIBC_2.4]: Add futimesat.
* posix/unistd.h: Declare fchownat and unlinkat.
* stdio-common/Makefile (routines): Add renameat.
* stdio-common/Versions [GLIBC_2.4]: Add renameat.
* sysdeps/generic/fchownat.c: New file.
* sysdeps/generic/futimesat.c: New file.
* sysdeps/generic/fxstatat.c: New file.
* sysdeps/generic/fxstatat64.c: New file.
* sysdeps/generic/renameat.c: New file.
* sysdeps/generic/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/fchownat.c: New file.
* sysdeps/unix/sysv/linux/futimesat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/fxstatat64.c: New file.
* sysdeps/unix/sysv/linux/renameat.c: New file.
* sysdeps/unix/sysv/linux/unlinkat.c: New file.
* sysdeps/unix/sysv/linux/alpha/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/i386/fchownat.c: New file.
* sysdeps/unix/sysv/linux/i386/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fchownat.c: New file.
* sysdeps/unix/sysv/linux/m68k/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/fchownat.c: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sh/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sh/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c: New file.
* time/sys/time.h: Declare futimesat.
* include/fcntl.h: Declare __atfct_seterrno.
* sysdeps/unix/sysv/linux/openat.c (__atfct_seterrno): New function.
Split out from openat code and called.
(do_test): Allow openat to fail with ENOSYS. Handle AT_FDCWD.
* sysdeps/generic/openat.c: Handle AT_FDCWD.
* sysdeps/generic/openat64.c: Likewise.
* io/tst-unlinkat.c: New file.
* io/tst-fstatat.c: New file.
* io/tst-futimesat.c: New file.
* io/tst-renameat.c: New file.
* io/tst-fchownat.c: New file.
* io/tst-openat.c: Don't fail if openat is not implemented.
* sysdeps/unix/sysv/linux/powerpc/chown.c: Don't provide backward
compatibility code if new kernel is guaranteed.
* time/sys/time.h: Add a few nonnull attributes.
2005-11-09 Ulrich Drepper <drepper@redhat.com>
* io/fcntl.h: Declare openat and openat64.
* io/Makefile (routines): Add openat and openat64.
(tests): Add tst-openat.
* io/Versions: Add openat and openat64 for GLIBC_2.4.
* sysdeps/generic/openat.c: New file.
* sysdeps/generic/openat64.c: New file.
* sysdeps/unix/sysv/linux/openat.c: New file.
* sysdeps/unix/sysv/linux/openat64.c: New file.
* io/tst-openat.c: New file.
* sysdeps/generic/check_fds.c (check_one_fd): For writable
descriptors, use /dev/full.
(__libc_check_standard_fds): Reverse modes so that common operations on
the descriptors fail.
* sysdeps/unix/sysv/linux/device-nrs.h: Add info for /dev/full.
2005-11-07 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* elf/elf.h (R_M32R_REL32): New macro.
2005-11-05 Marcus Brinkmann <marcus@gnu.org>
* sysdeps/mach/hurd/bits/stat.h (S_IMMAP0): New macro.
(S_ISPARE): Unset the S_IMMAP0 flag.
2005-11-07 Roland McGrath <roland@redhat.com>
* configure.in: Grok --with-cpu=CPU option. If given, search for
sysdeps/.../machine/CPU subdirs, and give error if none are found.
* configure: Regenerated.
* config.make.in (with-cpu): New substituted variable.
* Makeconfig (+cflags): Add -mcpu=$(with-cpu) if set.
* malloc/malloc.c (munmap_chunk): Suppress warnings from last change.
* sysdeps/unix/bsd/sun: Directory and all subdirectories removed,
saved in ports repository.
* sysdeps/unix/sysv/linux/tcflush.c: Rewritten.
* sysdeps/unix/sysv/linux/tcflow.c: Rewritten.
2005-11-06 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (munmap_chunk): Add sanity checks.
* sysdeps/pthread/configure: Fix comment.
2005-11-05 Ulrich Drepper <drepper@redhat.com>
* configure.in: Remove gnu_as definition and everything using it.
* config.make.in: Remove gnu-as.
* config.h.in: Remove HAVE_GNU_AS.
* configure.in: Remove gnu_ld definition and everything using it.
* config.h.in: Remove HAVE_GNU_LD.
* config.make.in: Remove gnu-ld.
* csu/Makefile: Remove use of gnu-ld.
* csu/munch.awk: Removed.
* csu/munch-tmpl.c: Removed.
* include/libc-symbols.h: Remove use of HAVE_GNU_LD.
* posix/execl.c: Likewise.
* posix/execv.c: Likewise.
* stdio-common/psignal.c: Likewise.
* stdlib/exit.c: Likewise.
* string/strsignal.c: Likewise.
* string/tester.c: Likewise.
* sysdeps/generic/errlist.c: Likewise.
* sysdeps/generic/getenv.c: Likewise.
* sysdeps/generic/getgroups.c: Likewise.
* sysdeps/generic/init-posix.c: Likewise.
* sysdeps/posix/gettimeofday.c: Likewise.
* sysdeps/posix/system.c: Likewise.
* sysdeps/unix/bsd/init-posix.c: Likewise.
* sysdeps/unix/bsd/ulimit.c: Likewise.
* sysdeps/unix/bsd/sun/m68k/brk.S: Likewise.
* sysdeps/unix/bsd/sun/m68k/sethostid.S: Likewise.
* sysdeps/unix/bsd/sun/sparc/sethostid.S: Likewise.
* sysdeps/unix/i386/brk.S: Likewise.
* sysdeps/unix/sparc/brk.S: Likewise.
* configure.in: Remove test for support for subtracting local labels.
* config.h.in: Remove HAVE_SUBTRACT_LOCAL_LABELS.
* stdio-common/vfprintf.c: Remove test of
HAVE_SUBTRACT_LOCAL_LABELS.
* configure.in: If init_array/fini_array support is not available,
bail out.
* config.h.in: Remove trace of optional init_array/fini_array support.
* config.make.in: Likewise.
* csu/elf-init.c: Likewise.
* dlfcn/dlfcn.c: Likewise.
* elf/soinit.c: Likewise.
* sysdeps/ia64/elf/initfinit.c: Likewise.
2005-11-04 Roland McGrath <roland@redhat.com>
* sysdeps/i386/configure.in (libc_mtune_example): Variable removed.
* sysdeps/i386/configure: Regenerated.
[BZ #1089]
* configure.in: Change order of add-on sysdeps directories,
so they are interleaved with main sysdeps directories.
* configure: Regenerated.
2005-11-03 Roland McGrath <roland@redhat.com>
* NEWS: Synch with 2.3 branch updates.
2005-11-03 Ulrich Drepper <drepper@redhat.com>
* sunrpc/svc.c (svc_getreq_poll): Fix inefficient loop test.
2005-11-03 Roland McGrath <roland@redhat.com>
[BZ #1548]
* sunrpc/svc.c (svc_getreqset): Use ffsl instead of ffs on fd_mask,
make sure constant is long.
From Jay Lan <jlan@engr.sgi.com>.
2005-11-03 Ulrich Drepper <drepper@redhat.com>
[BZ #1774]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use simple
gethostbyname2 lookup if AI_V4MAPPED|AI_ALL is set.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Avoid alloca when possible
while looking for scope delimiter.
Some pretty printing.
2005-10-31 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/powerpc64/Makefile
(sysdep_routines, elide-routines.os): Add hp-timing.
* sysdeps/powerpc/powerpc64/hp-timing.c: New file.
* sysdeps/powerpc/powerpc64/hp-timing.h: New file.
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: New file.
2005-10-31 Ulrich Drepper <drepper@redhat.com>
* resolv/res_init.c (__res_iclose): New function. Broken out of
res_nclose. Take addition parameter which determines whether
addresses should be freed.
(res_nclose): Call __res_iclose.
(res_thread_freeres): Likewise.
* resolv/res_data.c (res_close): Call __res_iclose.
* resolv/res_libc.c (res_init): No need to separately free the
addresses.
(__res_maybe_init): Likewise.
* resolv/res_send.c: Use __res_iclose instead of res_nclose.
* resolv/Versions [GLIBC_PRIVATE]: Add __res_iclose.
* include/resolv.h: Declare __res_iclose.
Add libc_hidden_proto for __res_iclose.
* hesiod/hesiod.c (__hesiod_res_set): No need to free name server
addresses here again.
[BZ #1579]
* debug/execinfo.h: Change backtrace_symbols_fd comment.
2005-10-24 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/ia64/fpu/libm-symbols.h (WEAK_LIBM_ENTRY): Add "__"
prefix to LOCAL_LIBM_ENTRY.
(WEAK_LIBM_END): Add "__" prefix to LOCAL_LIBM_END.
2005-10-26 Jakub Jelinek <jakub@redhat.com>
* elf/dl-conflict.c (_dl_resolve_conflicts): Use _dl_debug_printf
instead of _dl_printf to print conflict processing debug message.
Reported by John Reiser <jreiser@BitWagon.com>.
2005-10-30 Ulrich Drepper <drepper@redhat.com>
* misc/hsearch_r.c (hsearch_r): Remove duplicate test.
Patch by Chris Caputo <ccaputo@alt.net>.
2005-10-28 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sh/sysdep.S: Remove unnecessary weak_alias.
* sysdeps/unix/sysv/linux/sh/socket.S: Honor NO_WEAK_ALIAS.
2005-10-28 Thorsten Kukuk <kukuk@suse.de>
* nis/nss_nis/nis-publickey.c (_nss_nis_getpublickey): Fix off
by one error.
2005-10-24 Roland McGrath <roland@redhat.com>
[BZ #1534]
* include/string.h: Use libc_hidden_proto for strnlen,
not libc_hidden_builtin_proto.
2005-10-23 Ulrich Drepper <drepper@redhat.com>
* rt/mqueue.h: Cleanups.
2005-10-22 Roland McGrath <roland@redhat.com>
[BZ #1254]
* sysdeps/mach/hurd/getpeername.c (__getpeername): Fix last change.
From Samuel Thibault <samuel.thibault@ens-lyon.org>.
2005-10-17 Thomas Schwinge <tschwinge@gnu.org>
[BZ #1252]
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Don't use ?: as lvalue.
* sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
2005-10-20 Ulrich Drepper <drepper@redhat.com>
* iconvdata/ibm1364.h (__ucs4_to_ibm1364sb): Fix one mapping.
* iconvdata/ibm1388.h (__ucs4_to_ibm1388sb): Likewise.
* iconvdata/testdata/IBM1364: Add missing valid input.
* iconvdata/testdata/IBM1388: Likewise.
* iconvdata/testdata/IBM1364..UTF8: Adjust appropriately.
* iconvdata/testdata/IBM1388..UTF8: Likewise.
Patch by Masahide Washizawa <washi@jp.ibm.com>.
2005-08-23 GOTO Masanori <gotom@debian.or.jp>
[BZ #1498]
* sysdeps/alpha/remqu.S: Return the correct result when the same
dividend and divisor are provided, and they're negative numbers.
* sysdeps/alpha/divqu.S: Likewise.

View File

@ -611,7 +611,7 @@ ifeq "$(strip $(+cflags))" ""
+cflags := $(default_cflags)
endif # $(+cflags) == ""
+cflags := $(+cflags) $(+gccwarn)
+cflags := $(+cflags) $(addprefix -mcpu=,$(with-cpu)) $(+gccwarn)
+gcc-nowarn := -w
# Don't duplicate options if we inherited variables from the parent.

32
NEWS
View File

@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2005-4-5
GNU C Library NEWS -- history of user-visible changes. 2005-11-11
Copyright (C) 1992-2002,2003,2004,2005 Free Software Foundation, Inc.
See the end for copying conditions.
@ -12,6 +12,13 @@ Version 2.4
* New iconv converters for IBM1025, IBM1122, IBM1137, IBM1153,
IBM1154, IBM1155, IBM1156, IBM1157, and IBM1158 contributed by Jiro Sekiba.
More converters for IBM803, IBM901, IBM902, IBM921, IBM1008, IBM1097,
IBM1112, IBM1123, IBM1130, IBM1140, IBM1141, IBM1142, IBM1143, IBM1144,
IBM1145, IBM1146, IBM1147, IBM1148, IBM1149, IBM1166, IBM1167, IBM4517,
IBM4899, IBM4909, IBM4971, IBM5347, IBM9030, IBM9066, IBM9448, IBM12712,
IBM16804, IBM1364, IBM1371, IBM1388, IBM1390, and IBM1399 contributed
by Masahide Washizawa.
* It is now possible to install audit libraries for the dynamic linker using
LD_AUDIT. Implemented by Ulrich Drepper.
@ -19,6 +26,26 @@ Version 2.4
longer supported. The new NPTL implementation requires Linux 2.6 kernels.
For a libc and libpthread that works well on Linux 2.4 kernels, we
recommend using the stable 2.3 branch.
* New interfaces: fdopendir, openat, fstatat, fchownat, futimesat, renameat,
unlinkat.
Version 2.3.6
* The following bugs are resolved with this release:
38, 253, 549, 622, 653, 721, 758, 851, 877, 915, 934, 955, 961,
1016, 1037, 1076, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
1087, 1088, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098,
1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109,
1110, 1111, 1112, 1113, 1125, 1137, 1138, 1249, 1250, 1251, 1252,
1253, 1254, 1350, 1358, 1394, 1438, 1498, 1534
Visit <http://sources.redhat.com/bugzilla/> for the details of each bug.
* As of this release, GCC 4 can be used to compile the C Library.
* Timezone data updated to 2005m version.
Version 2.3.5
@ -1510,7 +1537,8 @@ Version 1.04
----------------------------------------------------------------------
Copyright information:
Copyright (C) 1992-1999,2000,2001,2002 Free Software Foundation, Inc.
Copyright (C) 1992-1999,2000,2001,2002,2003,2004,2005
Free Software Foundation, Inc.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the

View File

@ -8,11 +8,6 @@
# error "glibc must not be compiled with -ffast-math"
#endif
/* Define if using GNU ld, with support for weak symbols in a.out,
and for symbol set and warning messages extensions in a.out and ELF.
This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld. */
#undef HAVE_GNU_LD
/* Define if using ELF, which supports weak symbols.
This implies HAVE_ASM_WEAK_DIRECTIVE and NO_UNDERSCORES; set by
--with-elf. */
@ -50,9 +45,6 @@
/* Define if __attribute__((section("foo"))) puts quotes around foo. */
#undef HAVE_SECTION_QUOTES
/* Define if using the GNU assembler, gas. */
#undef HAVE_GNU_AS
/* Define if the assembler supports the `.set' directive. */
#undef HAVE_ASM_SET_DIRECTIVE
@ -158,10 +150,6 @@
/* Define if binutils support TLS handling. */
#undef HAVE_TLS_SUPPORT
/* Define if the linker supports .preinit_array/.init_array/.fini_array
sections. */
#undef HAVE_INITFINI_ARRAY
/* Define if the compiler's exception support is based on libunwind. */
#undef HAVE_CC_WITH_LIBUNWIND
@ -186,10 +174,6 @@
/* Override abi-tags ABI version if necessary. */
#undef __ABI_TAG_VERSION
/* An extension in gcc 2.96 and up allows the subtraction of two
local labels. */
#undef HAVE_SUBTRACT_LOCAL_LABELS
/* bash 2.0 introduced the _XXX_GNU_nonoption_argv_flags_ variable to help
getopt determine whether a parameter is a flag or not. This features
was disabled later since it caused trouble. We are by default therefore

View File

@ -31,6 +31,7 @@ base-machine = @base_machine@
config-vendor = @host_vendor@
config-os = @host_os@
config-sysdirs = @sysnames@
with-cpu = @submachine@
defines = @DEFINES@
sysincludes = @SYSINCLUDES@
@ -53,7 +54,6 @@ with-fp = @with_fp@
with-cvs = @with_cvs@
old-glibc-headers = @old_glibc_headers@
unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
have-initfini-array = @libc_cv_initfinit_array@
have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@
enable-check-abi = @enable_check_abi@
have-forced-unwind = @libc_cv_forced_unwind@
@ -80,8 +80,6 @@ have-ksh = @libc_cv_have_ksh@
sizeof-long-double = @sizeof_long_double@
# Configuration options.
gnu-as = @gnu_as@
gnu-ld = @gnu_ld@
build-static = @static@
build-shared = @shared@
build-pic-default= @pic_default@

162
configure vendored
View File

@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine submachine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -906,6 +906,7 @@ Optional Packages:
default]
--with-tls enable support for TLS
--without-__thread do not use TLS features even when supporting them
--with-cpu=CPU select code for CPU variant
Some influential environment variables:
CC C compiler command
@ -1793,11 +1794,6 @@ config_os="`echo $config_os | sed 's/^unknown-//'`"
# Some configurations imply other options.
case "$host_os" in
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
# These systems always use GNU tools.
gnu_ld=yes gnu_as=yes ;;
esac
case "$host_os" in
# i586-linuxaout is mangled into i586-pc-linux-gnuaout
linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
;;
@ -1832,6 +1828,21 @@ case "$machine-$host_os" in
;;
esac
submachine=
# Check whether --with-cpu or --without-cpu was given.
if test "${with_cpu+set}" = set; then
withval="$with_cpu"
case "$withval" in
yes|'') { { echo "$as_me:$LINENO: error: --with-cpu requires an argument" >&5
echo "$as_me: error: --with-cpu requires an argument" >&2;}
{ (exit 1); exit 1; }; } ;;
no) ;;
*) submachine="$withval" ;;
esac
fi;
# An add-on can set this when it the tuple to disable the sanity check below.
libc_config_ok=no
@ -2066,7 +2077,7 @@ done
# For sparc/sparc32, try sparc/sparc32 and then sparc.
mach=
tail=$machine
tail=$machine${submachine:+/$submachine}
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless --without-fp.
@ -2083,23 +2094,26 @@ done
# Find what sysdep directories exist.
sysnames=
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for d in $add_ons_pfx ''; do
for b in $base ''; do
for m0 in $mach ''; do
for v in /$vendor ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
for m in $mach ''; do
for b in $base ''; do
for m0 in $mach ''; do
for v in /$vendor ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
for m in $mach ''; do
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
if test "$m0$b$v$o$m"; then
try="${d}sysdeps$m0$b$v$o$m$a"
if test "$m0$m0sub$b$v$o$m$msub"; then
try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
{ test -n "$o" || test -n "$b"; } && os_used=t
{ test -n "$m" || test -n "$m0"; } && machine_used=t
case x${m0:-$m} in
x*/$submachine) submachine_used=t ;;
esac
fi
fi
done
@ -2108,14 +2122,18 @@ for d in $add_ons_pfx ''; do
done
done
done
if test -n "$d"; then
try="${d}sysdeps/generic"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
done
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
if test -n "$d" && test "$d" != "$a"; then
try="${d}sysdeps/generic${a}"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
fi
fi
fi
done
done
IFS="$ac_save_ifs"
@ -2129,6 +2147,12 @@ if test -z "$machine_used" && test "$machine" != none; then
echo "$as_me: error: The $machine is not supported." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "$submachine_used" && test -n "$submachine"; then
{ { echo "$as_me:$LINENO: error: The $submachine subspecies of $host_cpu is not supported." >&5
echo "$as_me: error: The $submachine subspecies of $host_cpu is not supported." >&2;}
{ (exit 1); exit 1; }; }
fi
# We have now validated the configuration.
@ -5353,7 +5377,7 @@ _ACEOF
fi
if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
if test $libc_cv_visibility_attribute = yes; then
echo "$as_me:$LINENO: checking whether to put _rtld_local into .sdata section" >&5
echo $ECHO_N "checking whether to put _rtld_local into .sdata section... $ECHO_C" >&6
if test "${libc_cv_have_sdata_section+set}" = set; then
@ -5380,7 +5404,7 @@ _ACEOF
echo "$as_me:$LINENO: checking for .preinit_array/.init_array/.fini_array support" >&5
echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $ECHO_C" >&6
if test "${libc_cv_initfinit_array+set}" = set; then
if test "${libc_cv_initfini_array+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat > conftest.c <<EOF
@ -5398,23 +5422,21 @@ EOF
(exit $ac_status); }; }
then
if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
libc_cv_initfinit_array=yes
libc_cv_initfini_array=yes
else
libc_cv_initfinit_array=no
libc_cv_initfini_array=no
fi
else
libc_cv_initfinit_array=no
libc_cv_initfini_array=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_initfinit_array" >&5
echo "${ECHO_T}$libc_cv_initfinit_array" >&6
if test $libc_cv_initfinit_array = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_INITFINI_ARRAY 1
_ACEOF
echo "$as_me:$LINENO: result: $libc_cv_initfini_array" >&5
echo "${ECHO_T}$libc_cv_initfini_array" >&6
if test $libc_cv_initfini_array != yes; then
{ { echo "$as_me:$LINENO: error: Need linker with .init_array/.fini_array support." >&5
echo "$as_me: error: Need linker with .init_array/.fini_array support." >&2;}
{ (exit 1); exit 1; }; }
fi
echo "$as_me:$LINENO: checking for libunwind-support in compiler" >&5
@ -5890,7 +5912,7 @@ _ACEOF
fi
fi
if test $elf = yes -a $gnu_ld = yes; then
if test $elf = yes; then
echo "$as_me:$LINENO: checking whether cc puts quotes around section names" >&5
echo $ECHO_N "checking whether cc puts quotes around section names... $ECHO_C" >&6
if test "${libc_cv_have_section_quotes+set}" = set; then
@ -6457,46 +6479,6 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for local label subtraction" >&5
echo $ECHO_N "checking for local label subtraction... $ECHO_C" >&6
if test "${libc_cv_gcc_subtract_local_labels+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat > conftest.c <<EOF
#line $LINENO "configure"
int foo (int a)
{
static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
void *p = &&l1 + ar[a];
goto *p;
l1:
return 1;
l2:
return 2;
}
EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
-o conftest conftest.c -lgcc >&5'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
libc_cv_gcc_subtract_local_labels=yes
else
libc_cv_gcc_subtract_local_labels=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_gcc_subtract_local_labels" >&5
echo "${ECHO_T}$libc_cv_gcc_subtract_local_labels" >&6
if test "$libc_cv_gcc_subtract_local_labels" = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_SUBTRACT_LOCAL_LABELS 1
_ACEOF
fi
if test "x$use__thread" != xno; then
echo "$as_me:$LINENO: checking for __thread" >&5
echo $ECHO_N "checking for __thread... $ECHO_C" >&6
@ -7673,18 +7655,6 @@ fi
if test $gnu_ld = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GNU_LD 1
_ACEOF
fi
if test $gnu_as = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GNU_AS 1
_ACEOF
fi
if test $elf = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_ELF 1
@ -7701,13 +7671,7 @@ fi
if test $shared = default; then
if test $gnu_ld = yes; then
shared=$elf
else
# For now we do not assume shared libs are available. In future more
# tests might become available.
shared=no
fi
shared=$elf
fi
if test x"$libc_cv_idn" = xyes; then
@ -8405,6 +8369,7 @@ s,@host_os@,$host_os,;t t
s,@subdirs@,$subdirs,;t t
s,@add_ons@,$add_ons,;t t
s,@base_machine@,$base_machine,;t t
s,@submachine@,$submachine,;t t
s,@sysnames@,$sysnames,;t t
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
@ -8447,7 +8412,6 @@ s,@INSTALL_INFO@,$INSTALL_INFO,;t t
s,@BISON@,$BISON,;t t
s,@VERSIONING@,$VERSIONING,;t t
s,@libc_cv_asm_protected_directive@,$libc_cv_asm_protected_directive,;t t
s,@libc_cv_initfinit_array@,$libc_cv_initfinit_array,;t t
s,@libc_cv_cc_with_libunwind@,$libc_cv_cc_with_libunwind,;t t
s,@libc_cv_z_nodelete@,$libc_cv_z_nodelete,;t t
s,@libc_cv_z_nodlopen@,$libc_cv_z_nodlopen,;t t
@ -8482,8 +8446,6 @@ s,@libc_cv_rootsbindir@,$libc_cv_rootsbindir,;t t
s,@libc_cv_forced_unwind@,$libc_cv_forced_unwind,;t t
s,@use_ldconfig@,$use_ldconfig,;t t
s,@ldd_rewrite_script@,$ldd_rewrite_script,;t t
s,@gnu_ld@,$gnu_ld,;t t
s,@gnu_as@,$gnu_as,;t t
s,@elf@,$elf,;t t
s,@xcoff@,$xcoff,;t t
s,@static@,$static,;t t

View File

@ -298,11 +298,6 @@ config_os="`echo $config_os | sed 's/^unknown-//'`"
# Some configurations imply other options.
case "$host_os" in
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
# These systems always use GNU tools.
gnu_ld=yes gnu_as=yes ;;
esac
case "$host_os" in
# i586-linuxaout is mangled into i586-pc-linux-gnuaout
linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
;;
@ -337,6 +332,17 @@ case "$machine-$host_os" in
;;
esac
submachine=
AC_ARG_WITH([cpu],
AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
[dnl
case "$withval" in
yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
no) ;;
*) submachine="$withval" ;;
esac
])
# An add-on can set this when it the tuple to disable the sanity check below.
libc_config_ok=no
@ -556,7 +562,7 @@ done
# For sparc/sparc32, try sparc/sparc32 and then sparc.
mach=
tail=$machine
tail=$machine${submachine:+/$submachine}
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless --without-fp.
@ -575,23 +581,26 @@ changequote([,])dnl
# Find what sysdep directories exist.
sysnames=
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for d in $add_ons_pfx ''; do
for b in $base ''; do
for m0 in $mach ''; do
for v in /$vendor ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
for m in $mach ''; do
for b in $base ''; do
for m0 in $mach ''; do
for v in /$vendor ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
for m in $mach ''; do
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
if test "$m0$b$v$o$m"; then
try="${d}sysdeps$m0$b$v$o$m$a"
if test "$m0$m0sub$b$v$o$m$msub"; then
try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
test -n "$enable_debug_configure" &&
echo "$0 [DEBUG]: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
{ test -n "$o" || test -n "$b"; } && os_used=t
{ test -n "$m" || test -n "$m0"; } && machine_used=t
case x${m0:-$m} in
x*/$submachine) submachine_used=t ;;
esac
fi
fi
done
@ -600,14 +609,18 @@ for d in $add_ons_pfx ''; do
done
done
done
if test -n "$d"; then
try="${d}sysdeps/generic"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
done
for d in $add_ons_pfx ''; do
for a in $add_ons_sfx ''; do
if test -n "$d" && test "$d" != "$a"; then
try="${d}sysdeps/generic${a}"
test -n "$enable_debug_configure" &&
echo "$0 DEBUG: try $try" >&2
if test -d $srcdir/$try; then
sysnames="$sysnames $try"
fi
fi
fi
done
done
IFS="$ac_save_ifs"
@ -617,6 +630,10 @@ fi
if test -z "$machine_used" && test "$machine" != none; then
AC_MSG_ERROR(The $machine is not supported.)
fi
if test -z "$submachine_used" && test -n "$submachine"; then
AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
fi
AC_SUBST(submachine)
# We have now validated the configuration.
@ -1233,7 +1250,7 @@ EOF
AC_DEFINE(HAVE_BROKEN_ALIAS_ATTRIBUTE)
fi
if test $libc_cv_visibility_attribute = yes -a $gnu_ld = yes; then
if test $libc_cv_visibility_attribute = yes; then
AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
libc_cv_have_sdata_section,
[echo "int i;" > conftest.c
@ -1250,7 +1267,7 @@ EOF
fi
AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
libc_cv_initfinit_array, [dnl
libc_cv_initfini_array, [dnl
cat > conftest.c <<EOF
int _start (void) { return 0; }
int __start (void) { return 0; }
@ -1261,17 +1278,16 @@ EOF
-static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
then
if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
libc_cv_initfinit_array=yes
libc_cv_initfini_array=yes
else
libc_cv_initfinit_array=no
libc_cv_initfini_array=no
fi
else
libc_cv_initfinit_array=no
libc_cv_initfini_array=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_initfinit_array)
if test $libc_cv_initfinit_array = yes; then
AC_DEFINE(HAVE_INITFINI_ARRAY)
if test $libc_cv_initfini_array != yes; then
AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
fi
AC_CACHE_CHECK(for libunwind-support in compiler,
@ -1536,7 +1552,7 @@ if test $elf != yes; then
fi
fi
if test $elf = yes -a $gnu_ld = yes; then
if test $elf = yes; then
AC_CACHE_CHECK(whether cc puts quotes around section names,
libc_cv_have_section_quotes,
[cat > conftest.c <<EOF
@ -1849,35 +1865,6 @@ if test "$libc_cv_gcc_builtin_redirection" = yes ; then
AC_DEFINE(HAVE_BUILTIN_REDIRECTION)
fi
dnl Check whether the compiler supports subtraction of local labels.
AC_CACHE_CHECK(for local label subtraction, libc_cv_gcc_subtract_local_labels,
[cat > conftest.c <<EOF
changequote(,)dnl
#line $LINENO "configure"
int foo (int a)
{
static const int ar[] = { &&l1 - &&l1, &&l2 - &&l1 };
void *p = &&l1 + ar[a];
goto *p;
l1:
return 1;
l2:
return 2;
}
changequote([,])dnl
EOF
dnl No \ in command here because it ends up inside ''.
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
-o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
libc_cv_gcc_subtract_local_labels=yes
else
libc_cv_gcc_subtract_local_labels=no
fi
rm -f conftest*])
if test "$libc_cv_gcc_subtract_local_labels" = yes; then
AC_DEFINE(HAVE_SUBTRACT_LOCAL_LABELS)
fi
dnl Check whether the compiler supports the __thread keyword.
if test "x$use__thread" != xno; then
AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
@ -2103,13 +2090,7 @@ AC_SUBST(libc_cv_forced_unwind)
AC_SUBST(use_ldconfig)
AC_SUBST(ldd_rewrite_script)
AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(xcoff)
if test $gnu_ld = yes; then
AC_DEFINE(HAVE_GNU_LD)
fi
if test $gnu_as = yes; then
AC_DEFINE(HAVE_GNU_AS)
fi
AC_SUBST(elf) AC_SUBST(xcoff)
if test $elf = yes; then
AC_DEFINE(HAVE_ELF)
fi
@ -2120,13 +2101,7 @@ fi
AC_SUBST(static)
AC_SUBST(shared)
if test $shared = default; then
if test $gnu_ld = yes; then
shared=$elf
else
# For now we do not assume shared libs are available. In future more
# tests might become available.
shared=no
fi
shared=$elf
fi
if test x"$libc_cv_idn" = xyes; then

View File

@ -39,8 +39,8 @@ omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
b$(start-installed-name) $(csu-dummies) \
S$(start-installed-name))
install-lib = $(start-installed-name) g$(start-installed-name) $(csu-dummies)
distribute = initfini.c gmon-start.c start.c defs.awk munch.awk \
abi-note.S init.c munch-tmpl.c not-cancel.h
distribute = initfini.c gmon-start.c start.c defs.awk \
abi-note.S init.c c not-cancel.h
generated = version-info.h
before-compile = $(objpfx)version-info.h
@ -75,19 +75,6 @@ before-compile += $(objpfx)abi-tag.h
generated += abi-tag.h
endif
ifneq (yes,$(gnu-ld))
libc-init = munch-init
$(objpfx)munch-init.c: munch.awk munch-tmpl.c $(+subdir_inits)
$(AWK) -f $< subdirs='$(+init_subdirs)' $(word 2,$^) > $@-t
mv -f $@-t $@
generated += munch-init.c
# All initialization source files.
+subdir_inits := $(wildcard $(foreach dir,$(subdirs),$(dir)/init-$(dir).c))
# All subdirectories containing initialization source files.
+init_subdirs := $(patsubst %/,%,$(dir $(+subdir_inits)))
endif
ifeq ($(have-initfini),yes)
CPPFLAGS += -DHAVE_INITFINI

View File

@ -36,7 +36,7 @@
#include <stddef.h>
#ifdef HAVE_INITFINI_ARRAY
/* These magic symbols are provided by the linker. */
extern void (*__preinit_array_start []) (int, char **, char **)
attribute_hidden;
@ -81,11 +81,10 @@ extern void _fini (void);
void
__libc_csu_init (int argc, char **argv, char **envp)
{
#ifdef HAVE_INITFINI_ARRAY
/* For dynamically linked executables the preinit array is executed by
the dynamic linker (before initializing any shared object. */
# ifndef LIBC_NONSHARED
#ifndef LIBC_NONSHARED
/* For static executables, preinit happens rights before init. */
{
const size_t size = __preinit_array_end - __preinit_array_start;
@ -93,19 +92,13 @@ __libc_csu_init (int argc, char **argv, char **envp)
for (i = 0; i < size; i++)
(*__preinit_array_start [i]) (argc, argv, envp);
}
# endif
#endif
_init ();
#ifdef HAVE_INITFINI_ARRAY
{
const size_t size = __init_array_end - __init_array_start;
size_t i;
for (i = 0; i < size; i++)
const size_t size = __init_array_end - __init_array_start;
for (size_t i = 0; i < size; i++)
(*__init_array_start [i]) (argc, argv, envp);
}
#endif
}
/* This function should not be used anymore. We run the executable's
@ -115,11 +108,9 @@ void
__libc_csu_fini (void)
{
#ifndef LIBC_NONSHARED
# ifdef HAVE_INITFINI_ARRAY
size_t i = __fini_array_end - __fini_array_start;
while (i-- > 0)
(*__fini_array_start [i]) ();
# endif
_fini ();
#endif

View File

@ -1,38 +0,0 @@
/* Copyright (C) 1991, 1995, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU 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 <stdlib.h>
EXTERNS
void
__libc_init (int argc, char **argv, char **envp)
{
CALLS
#ifdef HAVE_INITFINI
{
/* These functions are defined in crti.o to run the .init and .fini
sections, which are used for initializers and finalizers. */
extern void _init (void), _fini (void);
atexit (&_fini); /* Arrange for _fini to run at exit. */
_init ();
}
#endif
}

View File

@ -1,11 +0,0 @@
BEGIN { special = 0 }
/EXTERNS/ { ndirs = split(subdirs, dirs)
for (i = 1; i <= ndirs; ++i)
printf "extern void __init_%s (int argc, char **argv, char **envp);\n", dirs[i]
special = 1 }
/CALLS/ { ndirs = split(subdirs, dirs)
for (i = 1; i <= ndirs; ++i) printf " __init_%s (argc, argv, envp);\n", dirs[i]
special = 1 }
{ if (special == 0) print $0; special = 0 }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999, 2004, 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
@ -35,8 +35,7 @@ extern char **backtrace_symbols (void *__const *__array, int __size)
/* This function is similar to backtrace_symbols() but it writes the result
immediately to a file and can therefore also be used in situations where
malloc() is not usable anymore. */
immediately to a file. */
extern void backtrace_symbols_fd (void *__const *__array, int __size, int __fd)
__THROW __nonnull ((1));

View File

@ -23,7 +23,7 @@
int __dlfcn_argc attribute_hidden;
char **__dlfcn_argv attribute_hidden;
#ifdef HAVE_INITFINI_ARRAY
static void
init (int argc, char *argv[])
{
@ -33,7 +33,7 @@ init (int argc, char *argv[])
static void (*const init_array []) (int argc, char *argv[])
__attribute__ ((section (".init_array"), aligned (sizeof (void *))))
__attribute_used__ = { init };
#else
# error "Need linker with .init_array support."
#endif
__attribute_used__ =
{
init
};

View File

@ -1,5 +1,5 @@
/* Resolve conflicts against already prelinked libraries.
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
@ -34,8 +34,8 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
{
#if ! ELF_MACHINE_NO_RELA
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
_dl_printf ("\nconflict processing: %s\n",
l->l_name[0] ? l->l_name : rtld_progname);
_dl_debug_printf ("\nconflict processing: %s\n",
l->l_name[0] ? l->l_name : rtld_progname);
{
/* Do the conflict relocation of the object and library GOT and other

View File

@ -35,12 +35,6 @@
#include <dl-dst.h>
#ifndef SHARED
/* Giving this initialized value preallocates some surplus bytes in the
static TLS area, see __libc_setup_tls (libc-tls.c). */
size_t _dl_tls_static_size = 2048;
#endif
extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
void (*dl_main) (const ElfW(Phdr) *phdr,
ElfW(Word) phnum,

View File

@ -2569,6 +2569,7 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */
#define R_M32R_RELA_GNU_VTINHERIT 43
#define R_M32R_RELA_GNU_VTENTRY 44
#define R_M32R_REL32 45 /* PC relative 32 bit. */
#define R_M32R_GOT24 48 /* 24 bit GOT entry */
#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */

View File

@ -78,14 +78,8 @@ __libc_global_ctors (void)
/* This function becomes the DT_FINI termination function
for the C library. */
#ifndef HAVE_INITFINI_ARRAY
void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */
void
_fini (void)
#else
void
__libc_fini (void)
#endif
{
/* Call destructor functions. */
run_hooks (__DTOR_LIST__);
@ -101,7 +95,6 @@ __libc_fini (void)
# endif
#endif
}
#ifdef HAVE_INITFINI_ARRAY
void (*_fini_ptr) (void) __attribute__ ((section (".fini_array")))
= &__libc_fini;
#endif

View File

@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-fc4
fedora-sync-date := 2005-10-20 06:51 UTC
fedora-sync-tag := fedora-glibc-20051020T0651
fedora-sync-date := 2005-11-15 08:09 UTC
fedora-sync-tag := fedora-glibc-20051115T0809

View File

@ -487,12 +487,6 @@ __hesiod_res_set(void *context, struct __res_state *res,
if (ctx->res && ctx->free_res) {
res_nclose(ctx->res);
if ((ctx->res->options & RES_INIT) && ctx->res->nscount > 0) {
for (int ns = 0; ns < MAXNS; ns++) {
free (ctx->res->_u._ext.nsaddrs[ns]);
ctx->res->_u._ext.nsaddrs[ns] = NULL;
}
}
(*ctx->free_res)(ctx->res);
}

View File

@ -1,5 +1,6 @@
/* Replacement for mach_msg used in interruptible Hurd RPCs.
Copyright (C) 1995,96,97,98,99,2000,01,02 Free Software Foundation, Inc.
Copyright (C) 1995,96,97,98,99,2000,2001,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
@ -201,9 +202,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
case MACH_MSG_TYPE_MOVE_SEND:
for (i = 0; i < number; i++)
__mach_port_deallocate (__mach_task_self (), *ports++);
(ty->msgtl_header.msgt_longform
? ty->msgtl_name : ty->msgtl_header.msgt_name)
= MACH_MSG_TYPE_COPY_SEND;
if (ty->msgtl_header.msgt_longform)
ty->msgtl_name = MACH_MSG_TYPE_COPY_SEND;
else
ty->msgtl_header.msgt_name = MACH_MSG_TYPE_COPY_SEND;
break;
case MACH_MSG_TYPE_COPY_SEND:
case MACH_MSG_TYPE_MOVE_RECEIVE:
@ -223,29 +225,29 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
name = ty->msgtl_name;
size = ty->msgtl_size;
number = ty->msgtl_number;
(char *) ty += sizeof (mach_msg_type_long_t);
ty = (void *) ty + sizeof (mach_msg_type_long_t);
}
else
{
name = ty->msgtl_header.msgt_name;
size = ty->msgtl_header.msgt_size;
number = ty->msgtl_header.msgt_number;
(char *) ty += sizeof (mach_msg_type_t);
ty = (void *) ty + sizeof (mach_msg_type_t);
}
if (ty->msgtl_header.msgt_inline)
{
clean_ports ((void *) ty, 0);
/* calculate length of data in bytes, rounding up */
(char *) ty += (((((number * size) + 7) >> 3)
+ sizeof (mach_msg_type_t) - 1)
&~ (sizeof (mach_msg_type_t) - 1));
ty = (void *) ty + (((((number * size) + 7) >> 3)
+ sizeof (mach_msg_type_t) - 1)
&~ (sizeof (mach_msg_type_t) - 1));
}
else
{
clean_ports (*(void **) ty,
ty->msgtl_header.msgt_deallocate);
++(void **) ty;
ty = (void *) ty + sizeof (void *);
}
}
#else /* Untyped Mach IPC flavor. */

View File

@ -8014,7 +8014,7 @@ static const char __ucs4_to_ibm1364sb[][1] =
"\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7",
"\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6",
"\xd7", "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6",
"\xe7", "\xe8", "\xe9", "\x70", "\x5b", "\x80", "\xb0", "\x6d",
"\xe7", "\xe8", "\xe9", "\x70", "\xb2", "\x80", "\xb0", "\x6d",
"\x79", "\x81", "\x82", "\x83", "\x84", "\x85", "\x86", "\x87",
"\x88", "\x89", "\x91", "\x92", "\x93", "\x94", "\x95", "\x96",
"\x97", "\x98", "\x99", "\xa2", "\xa3", "\xa4", "\xa5", "\xa6",

View File

@ -11316,11 +11316,11 @@ static const char __ucs4_to_ibm1388sb[][1] =
"\x7c", "\xc1", "\xc2", "\xc3", "\xc4", "\xc5", "\xc6", "\xc7",
"\xc8", "\xc9", "\xd1", "\xd2", "\xd3", "\xd4", "\xd5", "\xd6",
"\xd7", "\xd8", "\xd9", "\xe2", "\xe3", "\xe4", "\xe5", "\xe6",
"\xe7", "\xe8", "\xe9", "\xba", "\x5b", "\xbb", "\xb0", "\x6d",
"\xe7", "\xe8", "\xe9", "\xba", "\xb2", "\xbb", "\xb0", "\x6d",
"\x79", "\x81", "\x82", "\x83", "\x84", "\x85", "\x86", "\x87",
"\x88", "\x89", "\x91", "\x92", "\x93", "\x94", "\x95", "\x96",
"\x97", "\x98", "\x99", "\xa2", "\xa3", "\xa4", "\xa5", "\xa6",
"\xa7", "\xa8", "\xa9", "\xc0", "\x4f", "\xd0", "\xa1", "\x07",
"\xa7", "\xa8", "\xa9", "\xc0", "\x4f", "\xd0", "\xa0", "\x07",
"\x20", "\x21", "\x22", "\x23", "\x24", "\x15", "\x06", "\x17",
"\x28", "\x29", "\x2a", "\x2b", "\x2c", "\x09", "\x0a", "\x1b",
"\x30", "\x31", "\x1a", "\x33", "\x34", "\x35", "\x36", "\x08",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -18,4 +18,8 @@ libc_hidden_proto (__open)
extern int __fcntl (int __fd, int __cmd, ...);
libc_hidden_proto (__fcntl)
/* Helper functions for the various *at functions. For Linux. */
extern void __atfct_seterrno (int errval, int fd, const char *buf)
attribute_hidden;
#endif

View File

@ -31,8 +31,6 @@
* ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
* ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type,
or leave it undefined if there is no .type directive.
* HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
and for symbol set and warning messages extensions in a.out and ELF.
* HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
* HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
* HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
@ -56,7 +54,7 @@
#include <config.h>
/* The symbols in all the user (non-_) macros are C symbols.
HAVE_GNU_LD without HAVE_ELF implies a.out. */
NO HAVE_ELF implies a.out. */
#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE
# define HAVE_WEAK_SYMBOLS
@ -220,55 +218,48 @@
/* When a reference to SYMBOL is encountered, the linker will emit a
warning message MSG. */
#ifdef HAVE_GNU_LD
# ifdef HAVE_ELF
#ifdef HAVE_ELF
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
# define __make_section_unallocated(section_string) \
# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
# define __make_section_unallocated(section_string) \
asm (".section " section_string "\n\t.previous");
# elif defined HAVE_ASM_POPSECTION_DIRECTIVE
# define __make_section_unallocated(section_string) \
# elif defined HAVE_ASM_POPSECTION_DIRECTIVE
# define __make_section_unallocated(section_string) \
asm (".pushsection " section_string "\n\t.popsection");
# else
# define __make_section_unallocated(section_string)
# endif
# else
# define __make_section_unallocated(section_string)
# endif
/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
section attributes on what looks like a comment to the assembler. */
# ifdef HAVE_SECTION_QUOTES
# define __sec_comment "\"\n\t#\""
# else
# define __sec_comment "\n\t#"
# endif
# define link_warning(symbol, msg) \
# ifdef HAVE_SECTION_QUOTES
# define __sec_comment "\"\n\t#\""
# else
# define __sec_comment "\n\t#"
# endif
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
= msg;
# define libc_freeres_ptr(decl) \
# define libc_freeres_ptr(decl) \
__make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
# define __libc_freeres_fn_section \
# define __libc_freeres_fn_section \
__attribute__ ((section ("__libc_freeres_fn")))
# else /* Not ELF: a.out */
# ifdef HAVE_XCOFF
#else /* Not ELF: a.out */
# ifdef HAVE_XCOFF
/* XCOFF does not support .stabs.
The native aix linker will remove the .stab and .stabstr sections
The gnu linker will have a fatal error if there is a relocation for
symbol in the .stab section. Silently disable this macro. */
# define link_warning(symbol, msg)
# else
# define link_warning(symbol, msg) \
# define link_warning(symbol, msg)
# else
# define link_warning(symbol, msg) \
asm (".stabs \"" msg "\",30,0,0,0\n\t" \
".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
# endif /* XCOFF */
# define libc_freeres_ptr(decl) decl
# define __libc_freeres_fn_section
# endif
#else
/* We will never be heard; they will all die horribly. */
# define link_warning(symbol, msg)
# endif /* XCOFF */
# define libc_freeres_ptr(decl) decl
# define __libc_freeres_fn_section
#endif
@ -325,92 +316,79 @@ for linking")
*/
#ifdef HAVE_GNU_LD
/* Symbol set support macros. */
# ifdef HAVE_ELF
#ifdef HAVE_ELF
/* Make SYMBOL, which is in the text segment, an element of SET. */
# define text_set_element(set, symbol) _elf_set_element(set, symbol)
# define text_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the data segment, an element of SET. */
# define data_set_element(set, symbol) _elf_set_element(set, symbol)
# define data_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the bss segment, an element of SET. */
# define bss_set_element(set, symbol) _elf_set_element(set, symbol)
# define bss_set_element(set, symbol) _elf_set_element(set, symbol)
/* These are all done the same way in ELF.
There is a new section created for each set. */
# ifdef SHARED
# ifdef SHARED
/* When building a shared library, make the set section writable,
because it will need to be relocated at run time anyway. */
# define _elf_set_element(set, symbol) \
# define _elf_set_element(set, symbol) \
static const void *__elf_set_##set##_element_##symbol##__ \
__attribute__ ((used, section (#set))) = &(symbol)
# else
# define _elf_set_element(set, symbol) \
# else
# define _elf_set_element(set, symbol) \
static const void *const __elf_set_##set##_element_##symbol##__ \
__attribute__ ((used, section (#set))) = &(symbol)
# endif
# endif
/* Define SET as a symbol set. This may be required (it is in a.out) to
be able to use the set's contents. */
# define symbol_set_define(set) symbol_set_declare(set)
# define symbol_set_define(set) symbol_set_declare(set)
/* Declare SET for use in this module, if defined in another module.
In a shared library, this is always local to that shared object.
For static linking, the set might be wholly absent and so we use
weak references. */
# define symbol_set_declare(set) \
# define symbol_set_declare(set) \
extern char const __start_##set[] __symbol_set_attribute; \
extern char const __stop_##set[] __symbol_set_attribute;
# ifdef SHARED
# define __symbol_set_attribute attribute_hidden
# else
# define __symbol_set_attribute __attribute__ ((weak))
# endif
# ifdef SHARED
# define __symbol_set_attribute attribute_hidden
# else
# define __symbol_set_attribute __attribute__ ((weak))
# endif
/* Return a pointer (void *const *) to the first element of SET. */
# define symbol_set_first_element(set) ((void *const *) (&__start_##set))
# define symbol_set_first_element(set) ((void *const *) (&__start_##set))
/* Return true iff PTR (a void *const *) has been incremented
past the last element in SET. */
# define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
# define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
# else /* Not ELF: a.out. */
#else /* Not ELF: a.out. */
# ifdef HAVE_XCOFF
# ifdef HAVE_XCOFF
/* XCOFF does not support .stabs.
The native aix linker will remove the .stab and .stabstr sections
The gnu linker will have a fatal error if there is a relocation for
symbol in the .stab section. Silently disable these macros. */
# define text_set_element(set, symbol)
# define data_set_element(set, symbol)
# define bss_set_element(set, symbol)
# else
# define text_set_element(set, symbol) \
# define text_set_element(set, symbol)
# define data_set_element(set, symbol)
# define bss_set_element(set, symbol)
# else
# define text_set_element(set, symbol) \
asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol)
# define data_set_element(set, symbol) \
# define data_set_element(set, symbol) \
asm (".stabs \"" __SYMBOL_PREFIX #set "\",25,0,0," __SYMBOL_PREFIX #symbol)
# define bss_set_element(set, symbol) ?error Must use initialized data.
# endif /* XCOFF */
# define symbol_set_define(set) void *const (set)[1];
# define symbol_set_declare(set) extern void *const (set)[1];
# define symbol_set_first_element(set) &(set)[1]
# define symbol_set_end_p(set, ptr) (*(ptr) == 0)
# endif /* ELF. */
#else
/* We cannot do anything in generial. */
# define text_set_element(set, symbol) asm ("")
# define data_set_element(set, symbol) asm ("")
# define bss_set_element(set, symbol) asm ("")
# define symbol_set_define(set) void *const (set)[1];
# define bss_set_element(set, symbol) ?error Must use initialized data.
# endif /* XCOFF */
# define symbol_set_define(set) void *const (set)[1];
# define symbol_set_declare(set) extern void *const (set)[1];
# define symbol_set_first_element(set) &(set)[1]
# define symbol_set_end_p(set, ptr) (*(ptr) == 0)
#endif /* Have GNU ld. */
#endif /* ELF. */
#if DO_VERSIONING
# define symbol_version(real, name, version) \

View File

@ -46,9 +46,11 @@ extern void res_send_setqhook (res_send_qhook __hook);
extern void res_send_setrhook (res_send_rhook __hook);
extern int res_ourserver_p (const res_state __statp,
const struct sockaddr_in6 *__inp);
extern void __res_iclose(res_state statp, bool free_addr);
libc_hidden_proto (__res_ninit)
libc_hidden_proto (__res_maybe_init)
libc_hidden_proto (__res_nclose)
libc_hidden_proto (__res_iclose)
libc_hidden_proto (__res_randomid)
libc_hidden_proto (__res_state)

View File

@ -83,6 +83,7 @@ libc_hidden_proto (__strxfrm_l)
libc_hidden_proto (__strtok_r)
extern char *__strsep_g (char **__stringp, __const char *__delim);
libc_hidden_proto (__strsep_g)
libc_hidden_proto (strnlen)
libc_hidden_builtin_proto (memchr)
libc_hidden_builtin_proto (memcpy)
@ -96,7 +97,6 @@ libc_hidden_builtin_proto (strcmp)
libc_hidden_builtin_proto (strcpy)
libc_hidden_builtin_proto (strcspn)
libc_hidden_builtin_proto (strlen)
libc_hidden_builtin_proto (strnlen)
libc_hidden_builtin_proto (strncmp)
libc_hidden_builtin_proto (strncpy)
libc_hidden_builtin_proto (strpbrk)

View File

@ -1,4 +1,4 @@
# Copyright (C) 1992-2002, 2003 Free Software Foundation, Inc.
# Copyright (C) 1992-2002, 2003, 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
@ -26,38 +26,43 @@ headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
poll.h sys/poll.h bits/poll.h \
utime.h ftw.h fts.h sys/sendfile.h
routines := \
utime \
mkfifo \
stat fstat lstat mknod stat64 fstat64 lstat64 \
xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \
statfs fstatfs statfs64 fstatfs64 \
statvfs fstatvfs statvfs64 fstatvfs64 \
umask chmod fchmod lchmod mkdir \
open open64 close read write lseek lseek64 access euidaccess \
fcntl flock lockf lockf64 \
dup dup2 pipe \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
chown fchown lchown \
ttyname ttyname_r isatty \
link symlink readlink \
unlink rmdir \
ftw ftw64 fts poll \
posix_fadvise posix_fadvise64 \
posix_fallocate posix_fallocate64 \
routines := \
utime \
mkfifo \
stat fstat lstat mknod stat64 fstat64 lstat64 fstatat fstatat64 \
xstat fxstat lxstat xmknod xstat64 fxstat64 lxstat64 \
fxstatat fxstatat64 \
statfs fstatfs statfs64 fstatfs64 \
statvfs fstatvfs statvfs64 fstatvfs64 \
umask chmod fchmod lchmod mkdir \
open open64 openat openat64 close \
read write lseek lseek64 access euidaccess \
fcntl flock lockf lockf64 \
dup dup2 pipe \
creat creat64 \
chdir fchdir \
getcwd getwd getdirname \
chown fchown lchown fchownat \
ttyname ttyname_r isatty \
link symlink readlink \
unlink unlinkat rmdir \
ftw ftw64 fts poll \
posix_fadvise posix_fadvise64 \
posix_fallocate posix_fallocate64 \
sendfile sendfile64
# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
# linked against when the shared library will be used.
static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64
static-only-routines = stat fstat lstat mknod stat64 fstat64 lstat64 \
fstatat fstatat64
others := pwd
test-srcs := ftwtest
tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
tst-renameat tst-fchownat
distribute := ftwtest-sh

View File

@ -97,4 +97,10 @@ libc {
# n*
nftw; nftw64;
}
GLIBC_2.4 {
fchownat;
__fxstatat; __fxstatat64;
openat; openat64;
unlinkat;
}
}

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1991,1992,1994-2001,2003,2004 Free Software Foundation, Inc.
/* Copyright (C) 1991,1992,1994-2001,2003,2004,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
@ -55,6 +56,15 @@ __BEGIN_DECLS
# define SEEK_END 2 /* Seek from end of file. */
#endif /* XPG */
#ifdef __USE_GNU
# define AT_FDCWD -100 /* Special value used to indicate
openat should use the current
working directory. */
# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
# define AT_REMOVEDIR 0x200 /* Remove directory instead of
unlinking file. */
#endif
/* Do the file control operation described by CMD on FD.
The remaining arguments are interpreted depending on CMD.
@ -82,6 +92,32 @@ extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64)
extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1));
#endif
#ifdef __USE_GNU
/* Similar to OPEN but a relative path name is interpreted relative to
the directory for which FD is a descriptor.
NOTE: some other OPENAT implementation support additional functionality
through this interface, especially using the O_XATTR flag. This is not
yet supported here.
This function is a cancellation point and therefore not marked with
__THROW. */
# ifndef __USE_FILE_OFFSET64
extern int openat (int __fd, __const char *__file, int __oflag, ...)
__nonnull ((2));
# else
# ifdef __REDIRECT
extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag,
...), openat64) __nonnull ((2));
# else
# define openat openat64
# endif
# endif
extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
__nonnull ((2));
#endif
/* Create and open FILE, with mode MODE. This takes an `int' MODE
argument because that is what `mode_t' will be widened to.

58
io/fstatat.c Normal file
View File

@ -0,0 +1,58 @@
/* Copyright (C) 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstatat
int
fstatat (int fd, const char *file, struct stat *buf, int flag)
{
return __fxstatat (_STAT_VER, fd, file, buf, flag);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat");
#endif

58
io/fstatat64.c Normal file
View File

@ -0,0 +1,58 @@
/* Copyright (C) 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstatat64
int
fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat64");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,1992,1995-2002,2003,2004 Free Software Foundation, Inc.
/* Copyright (C) 1991,1992,1995-2004,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
@ -228,6 +228,23 @@ extern int stat64 (__const char *__restrict __file,
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
#endif
#ifdef __USE_GNU
/* Similar to stat, get the attributes for FILE and put them in BUF.
Relative path names are interpreted relative to FD unless FD is
AT_FDCWD. */
# ifndef __USE_FILE_OFFSET64
extern int fstatat (int __fd, const char *__file, struct stat *__buf,
int __flag) __THROW __nonnull ((2, 3));
# else
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__file,
struct stat *__buf, int __flag),
fstatat64) __THROW __nonnull ((2, 3));
# endif
extern int fstatat64 (int __fd, const char *__file, struct stat64 *__buf,
int __flag) __THROW __nonnull ((2, 3));
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
# ifndef __USE_FILE_OFFSET64
/* Get file attributes about FILE and put them in BUF.
@ -327,6 +344,9 @@ extern int __xstat (int __ver, __const char *__filename,
struct stat *__stat_buf) __THROW __nonnull ((2, 3));
extern int __lxstat (int __ver, __const char *__filename,
struct stat *__stat_buf) __THROW __nonnull ((2, 3));
extern int __fxstatat (int __ver, int __fildes, __const char *__filename,
struct stat *__stat_buf, int __flag)
__THROW __nonnull ((3, 4));
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
@ -338,6 +358,10 @@ extern int __REDIRECT_NTH (__xstat, (int __ver, __const char *__filename,
extern int __REDIRECT_NTH (__lxstat, (int __ver, __const char *__filename,
struct stat *__stat_buf), __lxstat64)
__nonnull ((2, 3));
extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
__const char *__filename,
struct stat *__stat_buf, int __flag),
__fxstatat64) __nonnull ((3, 4));
# else
# define __fxstat __fxstat64
@ -353,6 +377,9 @@ extern int __xstat64 (int __ver, __const char *__filename,
struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
extern int __lxstat64 (int __ver, __const char *__filename,
struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
extern int __fxstatat64 (int __ver, int __fildes, __const char *__filename,
struct stat64 *__stat_buf, int __flag)
__THROW __nonnull ((3, 4));
#endif
extern int __xmknod (int __ver, __const char *__path, __mode_t __mode,
__dev_t *__dev) __THROW __nonnull ((2, 4));
@ -380,6 +407,15 @@ __NTH (fstat (int __fd, struct stat *__statbuf))
return __fxstat (_STAT_VER, __fd, __statbuf);
}
# ifdef __USE_GNU
extern __inline__ int
__NTH (fstatat (int __fd, __const char *__filename, struct stat *__statbuf,
int __flag))
{
return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag);
}
# endif
# if defined __USE_MISC || defined __USE_BSD
extern __inline__ int
__NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev))
@ -412,6 +448,15 @@ __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
}
# endif
# ifdef __USE_GNU
extern __inline__ int
__NTH (fstatat64 (int __fd, __const char *__filename, struct stat64 *__statbuf,
int __flag))
{
return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag);
}
# endif
#endif
__END_DECLS

145
io/tst-fchownat.c Normal file
View File

@ -0,0 +1,145 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
#if _POSIX_CHOWN_RESTRICTED > 0
uid_t uid = getuid ();
if (uid != 0)
{
puts ("need root privileges");
exit (0);
}
#endif
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-fchownat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
{
puts ("fstat64 failed");
return 1;
}
close (fd);
if (fchownat (dir_fd, "some-file", st1.st_uid + 1, st1.st_gid + 1, 0) != 0)
{
puts ("fchownat failed");
return 1;
}
struct stat64 st2;
if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
{
puts ("fstatat64 failed");
return 1;
}
if (st1.st_uid + 1 != st2.st_uid || st1.st_gid + 1 != st2.st_gid)
{
puts ("owner change failed");
return 1;
}
if (unlinkat (dir_fd, "some-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
close (dir_fd);
return 0;
}

143
io/tst-fstatat.c Normal file
View File

@ -0,0 +1,143 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-fstatat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
{
puts ("fstat64 failed");
return 1;
}
close (fd);
struct stat64 st2;
if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
{
puts ("fstatat64 failed");
return 1;
}
if (st1.st_dev != st2.st_dev
|| st1.st_ino != st2.st_ino
|| st1.st_size != st2.st_size)
{
puts ("stat results do not match");
return 1;
}
if (unlinkat (dir_fd, "some-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
if (fstatat64 (dir_fd, "some-file", &st2, 0) == 0)
{
puts ("second fstatat64 succeeded");
return 1;
}
if (errno != ENOENT)
{
puts ("second fstatat64 did not fail with ENOENT");
return 1;
}
close (dir_fd);
return 0;
}

147
io/tst-futimesat.c Normal file
View File

@ -0,0 +1,147 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-futimesat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
{
puts ("fstat64 failed");
return 1;
}
close (fd);
struct timeval tv[2];
tv[0].tv_sec = st1.st_atime + 1;
tv[0].tv_usec = 0;
tv[1].tv_sec = st1.st_mtime + 1;
tv[1].tv_usec = 0;
if (futimesat (dir_fd, "some-file", tv) != 0)
{
puts ("futimesat failed");
return 1;
}
struct stat64 st2;
if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
{
puts ("fstatat64 failed");
return 1;
}
if (st2.st_mtime != tv[1].tv_sec
#ifdef _STATBUF_ST_NSEC
|| st2.st_mtim.tv_nsec != 0
#endif
)
{
puts ("stat shows different mtime");
return 1;
}
if (unlinkat (dir_fd, "some-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
close (dir_fd);
return 0;
}

169
io/tst-openat.c Normal file
View File

@ -0,0 +1,169 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-openat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
close (fd);
puts ("file created");
/* fdopendir takes over the descriptor, make a copy. */
dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("2nd lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
bool seen_file = false;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
if (strcmp (d->d_name, "some-file") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
seen_file = true;
}
closedir (dir);
if (!seen_file)
{
puts ("file not created in correct directory");
return 1;
}
int cwdfd = open (".", O_RDONLY | O_DIRECTORY);
if (cwdfd == -1)
{
puts ("cannot get descriptor for cwd");
return 1;
}
if (fchdir (dir_fd) != 0)
{
puts ("1st fchdir failed");
return 1;
}
if (unlink ("some-file") != 0)
{
puts ("unlink failed");
return 1;
}
if (fchdir (cwdfd) != 0)
{
puts ("2nd fchdir failed");
return 1;
}
close (dir_fd);
close (cwdfd);
return 0;
}

149
io/tst-renameat.c Normal file
View File

@ -0,0 +1,149 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-renameat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
puts ("file created");
struct stat64 st1;
if (fstat64 (fd, &st1) != 0)
{
puts ("fstat64 failed");
return 1;
}
close (fd);
if (renameat (dir_fd, "some-file", dir_fd, "another-file") != 0)
{
puts ("renameat failed");
return 1;
}
struct stat64 st2;
if (fstatat64 (dir_fd, "some-file", &st2, 0) == 0)
{
puts ("fstatat64 succeeded");
return 1;
}
if (errno != ENOENT)
{
puts ("fstatat64 did not fail with ENOENT");
return 1;
}
if (fstatat64 (dir_fd, "another-file", &st2, 0) != 0)
{
puts ("2nd fstatat64 failed");
return 1;
}
if (st1.st_dev != st2.st_dev
|| st1.st_ino != st2.st_ino
|| st1.st_size != st2.st_size)
{
puts ("stat results do not match");
return 1;
}
if (unlinkat (dir_fd, "another-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
close (dir_fd);
return 0;
}

178
io/tst-unlinkat.c Normal file
View File

@ -0,0 +1,178 @@
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void prepare (void);
#define PREPARE(argc, argv) prepare ()
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int dir_fd;
static void
prepare (void)
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-unlinkat.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name);
char *dirbuf = malloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL)
{
puts ("cannot create temporary directory");
exit (1);
}
add_temp_file (dirbuf);
dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
if (dir_fd == -1)
{
puts ("cannot open directory");
exit (1);
}
}
static int
do_test (void)
{
/* fdopendir takes over the descriptor, make a copy. */
int dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("1st lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
DIR *dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("fdopendir failed");
return 1;
}
struct dirent64 *d;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
closedir (dir);
/* Try to create a file. */
int fd = openat (dir_fd, "some-file", O_CREAT|O_RDWR|O_EXCL, 0666);
if (fd == -1)
{
if (errno == ENOSYS)
{
puts ("*at functions not supported");
return 0;
}
puts ("file creation failed");
return 1;
}
write (fd, "hello", 5);
close (fd);
puts ("file created");
/* fdopendir takes over the descriptor, make a copy. */
dupfd = dup (dir_fd);
if (dupfd == -1)
{
puts ("2nd dup failed");
return 1;
}
if (lseek (dupfd, 0, SEEK_SET) != 0)
{
puts ("2nd lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
dir = fdopendir (dupfd);
if (dir == NULL)
{
puts ("2nd fdopendir failed");
return 1;
}
bool seen_file = false;
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
if (strcmp (d->d_name, "some-file") != 0)
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
seen_file = true;
}
closedir (dir);
if (!seen_file)
{
puts ("file not created in correct directory");
return 1;
}
/* Remove the file now. */
if (unlinkat (dir_fd, "some-file", 0) != 0)
{
puts ("unlinkat failed");
return 1;
}
/* We won't need dir_fd anymore after this, so use it. */
if (lseek (dir_fd, 0, SEEK_SET) != 0)
{
puts ("3rd lseek failed");
return 1;
}
/* The directory should be empty safe the . and .. files. */
dir = fdopendir (dir_fd);
if (dir == NULL)
{
puts ("3rd fdopendir failed");
return 1;
}
while ((d = readdir64 (dir)) != NULL)
if (strcmp (d->d_name, ".") != 0 && strcmp (d->d_name, "..") != 0)
{
if (strcmp (d->d_name, "some-file") == 0)
{
puts ("some-file not removed");
return 1;
}
else
{
printf ("temp directory contains file \"%s\"\n", d->d_name);
return 1;
}
}
closedir (dir);
return 0;
}

View File

@ -156,6 +156,11 @@ extern int remove (__const char *__filename) __THROW;
extern int rename (__const char *__old, __const char *__new) __THROW;
__END_NAMESPACE_STD
#ifdef __USE_GNU
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
extern int renameat (int __oldfd, __const char *__old, int __newfd,
__const char *__new) __THROW;
#endif
__BEGIN_NAMESPACE_STD
/* Create a temporary file and open it read/write.

View File

@ -1,3 +1,12 @@
2005-11-11 Ulrich Drepper <drepper@redhat.com>
[BZ #1294]
* locales/pt_BR: Set p_cs_precedes and n_cs_precedes to 1.
2005-11-05 Ulrich Drepper <drepper@redhat.com>
* SUPPORTED (SUPPORTED-LOCALES): Fix typo in si_LK line.
2005-10-15 Ulrich Drepper <drepper@redhat.com>
[BZ #119]

View File

@ -291,7 +291,7 @@ ru_UA.UTF-8/UTF-8 \
ru_UA/KOI8-U \
rw_RW/UTF-8 \
se_NO/UTF-8 \
si_LK/ITF-8 \
si_LK/UTF-8 \
sid_ET/UTF-8 \
sk_SK.UTF-8/UTF-8 \
sk_SK/ISO-8859-2 \

View File

@ -65,9 +65,9 @@ positive_sign ""
negative_sign "<U002D>"
int_frac_digits 2
frac_digits 2
p_cs_precedes 0
p_cs_precedes 1
p_sep_by_space 1
n_cs_precedes 0
n_cs_precedes 1
n_sep_by_space 1
p_sign_posn 1
n_sign_posn 1

View File

@ -3268,19 +3268,31 @@ munmap_chunk(p) mchunkptr p;
#endif
{
INTERNAL_SIZE_T size = chunksize(p);
int ret;
assert (chunk_is_mmapped(p));
#if 0
assert(! ((char*)p >= mp_.sbrk_base && (char*)p < mp_.sbrk_base + mp_.sbrked_mem));
assert((mp_.n_mmaps > 0));
#endif
assert(((p->prev_size + size) & (mp_.pagesize-1)) == 0);
uintptr_t block = (uintptr_t) p - p->prev_size;
size_t total_size = p->prev_size + size;
/* Unfortunately we have to do the compilers job by hand here. Normally
we would test BLOCK and TOTAL-SIZE separately for compliance with the
page size. But gcc does not recognize the optimization possibility
(in the moment at least) so we combine the two values into one before
the bit test. */
if (__builtin_expect (((block | total_size) & (mp_.pagesize - 1)) != 0, 0))
{
malloc_printerr (check_action, "munmap_chunk(): invalid pointer",
chunk2mem (p));
return;
}
mp_.n_mmaps--;
mp_.mmapped_mem -= (size + p->prev_size);
mp_.mmapped_mem -= total_size;
ret = munmap((char *)p - p->prev_size, size + p->prev_size);
int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
/* munmap returns non-zero on failure */
assert(ret == 0);

View File

@ -47,7 +47,7 @@ routines := brk sbrk sstk ioctl \
gtty stty \
ptrace \
fstab mntent mntent_r \
utimes lutimes futimes \
utimes lutimes futimes futimesat \
truncate ftruncate truncate64 ftruncate64 \
chflags fchflags \
insremque getttyent getusershell getpass ttyslot \

View File

@ -131,6 +131,7 @@ libc {
remap_file_pages;
}
GLIBC_2.4 {
futimesat;
__syslog_chk; __vsyslog_chk;
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
@ -206,7 +206,7 @@ hsearch_r (item, action, retval, htab)
{
/* If table is full and another entry should be entered return
with error. */
if (action == ENTER && htab->filled == htab->size)
if (htab->filled == htab->size)
{
__set_errno (ENOMEM);
*retval = NULL;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996,1997,1998,1999,2001,2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-1999,2001,2002,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@ -120,7 +120,7 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
++p;
strncpy (buf, p, 2 * (HEXKEYBYTES + 1));
buf[2 * (HEXKEYBYTES + 1)] = '\0';
buf[2 * HEXKEYBYTES + 1] = '\0';
if (!xdecrypt (buf, passwd))
return NSS_STATUS_SUCCESS;

View File

@ -1,3 +1,17 @@
2005-11-06 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/configure: Removed.
2005-11-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/ia64/pt-initfini.c: Remove trace of
optional init_array/fini_array support.
2005-10-24 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Remove unnecessary
versioned_symbol use.
2005-10-16 Roland McGrath <roland@redhat.com>
* init.c (__pthread_initialize_minimal_internal): Even when using a
@ -323,6 +337,7 @@
2005-02-14 Alan Modra <amodra@bigpond.net.au>
[BZ #721]
* sysdeps/powerpc/tcb-offsets.sym (thread_offsetof): Redefine to suit
gcc4.

View File

@ -1,3 +0,0 @@
# Local configure fragment for sysdeps/unix/sysv/linux.
DEFINES="$DEFINES -D_LIBC_REENTRANT"

View File

@ -1,5 +1,5 @@
/* Special .init and .fini section support for ia64. NPTL version.
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2000, 2001, 2002, 2003, 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
@ -38,7 +38,6 @@
#include <stddef.h>
#ifdef HAVE_INITFINI_ARRAY
__asm__ ("\n\
#include \"defs.h\"\n\
@ -49,95 +48,3 @@ __asm__ ("\n\
.xdata8 \".init_array\",@fptr(__pthread_initialize_minimal_internal)\n\
/*@_init_PROLOG_ENDS*/\n\
");
#else
__asm__ ("\n\
\n\
#include \"defs.h\"\n\
\n\
/*@HEADER_ENDS*/\n\
\n\
/*@_init_PROLOG_BEGINS*/\n\
.section .init\n\
.align 16\n\
.global _init#\n\
.proc _init#\n\
_init:\n\
.prologue\n\
.save ar.pfs, r34\n\
alloc r34 = ar.pfs, 0, 3, 0, 0\n\
.vframe r32\n\
mov r32 = r12\n\
.save rp, r33\n\
mov r33 = b0\n\
.body\n\
adds r12 = -16, r12\n\
;;\n\
st8 [r12] = gp, -16\n\
br.call.sptk.many b0 = __pthread_initialize_minimal_internal# ;;\n\
;;\n\
adds r12 = 16, r12\n\
;;\n\
ld8 gp = [r12]\n\
;;\n\
.endp _init#\n\
\n\
/*@_init_PROLOG_ENDS*/\n\
\n\
/*@_init_EPILOG_BEGINS*/\n\
.section .init\n\
.proc _init#\n\
.prologue\n\
.save ar.pfs, r34\n\
.vframe r32\n\
.save rp, r33\n\
.body\n\
mov r12 = r32\n\
mov ar.pfs = r34\n\
mov b0 = r33\n\
br.ret.sptk.many b0\n\
.endp _init#\n\
/*@_init_EPILOG_ENDS*/\n\
\n\
/*@_fini_PROLOG_BEGINS*/\n\
.section .fini\n\
.align 16\n\
.global _fini#\n\
.proc _fini#\n\
_fini:\n\
.prologue\n\
.save ar.pfs, r34\n\
alloc r34 = ar.pfs, 0, 3, 0, 0\n\
.vframe r32\n\
mov r32 = r12\n\
.save rp, r33\n\
mov r33 = b0\n\
.body\n\
adds r12 = -16, r12\n\
;;\n\
.endp _fini#\n\
\n\
/*@_fini_PROLOG_ENDS*/\n\
\n\
/*@_fini_EPILOG_BEGINS*/\n\
.section .fini\n\
.proc _fini#\n\
.prologue\n\
.save ar.pfs, r34\n\
.vframe r32\n\
.save rp, r33\n\
.body\n\
mov r12 = r32\n\
mov ar.pfs = r34\n\
mov b0 = r33\n\
br.ret.sptk.many b0\n\
.endp _fini#\n\
\n\
/*@_fini_EPILOG_ENDS*/\n\
\n\
/*@TRAILER_BEGINS*/\n\
.weak __gmon_start__#\n\
");
#endif

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.
@ -56,4 +56,3 @@ sem_trywait:
orl $-1, %eax
retq
.size sem_trywait,.-sem_trywait
versioned_symbol(libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1)

View File

@ -1656,7 +1656,7 @@ main_loop_epoll (int efd)
/* Remove the descriptor from the epoll descriptor. */
(void) epoll_ctl (efd, EPOLL_CTL_DEL, revs[cnt].data.fd, NULL);
/* Get a worked to handle the request. */
/* Get a worker to handle the request. */
fd_ready (revs[cnt].data.fd);
/* Reset the time. */

View File

@ -24,9 +24,6 @@
#include <stackinfo.h>
#ifndef HAVE_GNU_LD
# define __environ environ
#endif
/* Execute PATH with all arguments after PATH until
a NULL pointer and environment from `environ'. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1997, 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
@ -18,9 +18,6 @@
#include <unistd.h>
#ifndef HAVE_GNU_LD
# define __environ environ
#endif
/* Execute PATH with arguments ARGV and environment from `environ'. */
int

View File

@ -431,6 +431,14 @@ extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
#endif /* Use BSD || X/Open Unix. */
#ifdef __USE_GNU
/* Change the owner and group of FILE relative to the directory FD is open
on. */
extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
__gid_t __group, int __flag)
__THROW __nonnull ((2)) __wur;
#endif /* Use GNU. */
/* Change the process's working directory to PATH. */
extern int chdir (__const char *__path) __THROW __nonnull ((1)) __wur;
@ -749,6 +757,12 @@ extern int readlink (__const char *__restrict __path, char *__restrict __buf,
/* Remove the link NAME. */
extern int unlink (__const char *__name) __THROW __nonnull ((1));
#ifdef __USE_GNU
/* Remove the link NAME relative to FD. */
extern int unlinkat (int __fd, __const char *__name, int __flag)
__THROW __nonnull ((2));
#endif
/* Remove the directory PATH. */
extern int rmdir (__const char *__path) __THROW __nonnull ((1));

View File

@ -39,7 +39,7 @@ libc {
h_errno; __resp;
%endif
__res_maybe_init;
__res_maybe_init; __res_iclose;
}
}

View File

@ -246,7 +246,9 @@ res_close(void) {
if ((_res.options & RES_INIT) == 0)
return;
#endif
res_nclose(&_res);
/* We don't free the name server addresses because we never
did it and it would be done implicitly on shutdown. */
__res_iclose(&_res, false);
}
#ifdef BIND_UPDATE

View File

@ -555,7 +555,7 @@ libc_hidden_def (__res_randomid)
* This routine is not expected to be user visible.
*/
void
res_nclose(res_state statp) {
__res_iclose(res_state statp, bool free_addr) {
int ns;
if (statp->_vcsock >= 0) {
@ -568,13 +568,25 @@ res_nclose(res_state statp) {
#else
for (ns = 0; ns < statp->_u._ext.nscount; ns++)
#endif
if (statp->_u._ext.nsaddrs[ns]
&& statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
if (statp->_u._ext.nsaddrs[ns]) {
if (statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
statp->_u._ext.nssocks[ns] = -1;
}
if (free_addr) {
free (statp->_u._ext.nsaddrs[ns]);
statp->_u._ext.nsaddrs[ns] = NULL;
}
}
statp->_u._ext.nsinit = 0;
}
libc_hidden_def (__res_iclose)
void
res_nclose(res_state statp)
{
__res_iclose (statp, true);
}
#ifdef _LIBC
libc_hidden_def (__res_nclose)
#endif
@ -589,14 +601,7 @@ res_thread_freeres (void)
/* Never called res_ninit. */
return;
__res_nclose (&_res); /* Close any VC sockets. */
for (int ns = 0; ns < MAXNS; ns++)
if (_res._u._ext.nsaddrs[ns] != NULL)
{
free (_res._u._ext.nsaddrs[ns]);
_res._u._ext.nsaddrs[ns] = NULL;
}
__res_iclose (&_res, true); /* Close any VC sockets. */
/* Make sure we do a full re-initialization the next time. */
_res.options = 0;

View File

@ -70,14 +70,8 @@ res_init(void) {
_res.retry = 4;
if (!(_res.options & RES_INIT))
_res.options = RES_DEFAULT;
else if (_res.nscount > 0) {
__res_nclose (&_res); /* Close any VC sockets. */
for (int ns = 0; ns < MAXNS; ns++) {
free (_res._u._ext.nsaddrs[ns]);
_res._u._ext.nsaddrs[ns] = NULL;
}
}
else if (_res.nscount > 0)
__res_iclose (&_res, true); /* Close any VC sockets. */
/*
* This one used to initialize implicitly to zero, so unless the app
@ -103,11 +97,7 @@ __res_maybe_init (res_state resp, int preinit)
if (resp->options & RES_INIT) {
if (__res_initstamp != resp->_u._ext.initstamp) {
if (resp->nscount > 0) {
__res_nclose (resp);
for (int ns = 0; ns < MAXNS; ns++) {
free (resp->_u._ext.nsaddrs[ns]);
resp->_u._ext.nsaddrs[ns] = NULL;
}
__res_iclose (resp, true);
return __res_vinit (resp, 1);
}
}

View File

@ -381,7 +381,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
}
}
if (needclose)
res_nclose(statp);
__res_iclose(statp, false);
}
/*
@ -488,7 +488,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
done = 1;
break;
case res_nextns:
res_nclose(statp);
__res_iclose(statp, false);
goto next_ns;
case res_done:
return (resplen);
@ -553,7 +553,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
*/
if ((v_circuit && (statp->options & RES_USEVC) == 0) ||
(statp->options & RES_STAYOPEN) == 0) {
res_nclose(statp);
__res_iclose(statp, false);
}
if (statp->rhook) {
int done = 0, loops = 0;
@ -570,7 +570,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
done = 1;
break;
case res_nextns:
res_nclose(statp);
__res_iclose(statp, false);
goto next_ns;
case res_modified:
/* give the hook another try */
@ -589,7 +589,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
next_ns: ;
} /*foreach ns*/
} /*foreach retry*/
res_nclose(statp);
__res_iclose(statp, false);
if (!v_circuit) {
if (!gotsomewhere)
__set_errno (ECONNREFUSED); /* no nameservers found */
@ -637,14 +637,14 @@ send_vc(res_state statp,
if (getpeername(statp->_vcsock,
(struct sockaddr *)&peer, &size) < 0 ||
!sock_eq(&peer, nsap)) {
res_nclose(statp);
__res_iclose(statp, false);
statp->_flags &= ~RES_F_VC;
}
}
if (statp->_vcsock < 0 || (statp->_flags & RES_F_VC) == 0) {
if (statp->_vcsock >= 0)
res_nclose(statp);
__res_iclose(statp, false);
statp->_vcsock = socket(nsap->sin6_family, SOCK_STREAM, 0);
if (statp->_vcsock < 0) {
@ -660,7 +660,7 @@ send_vc(res_state statp,
*terrno = errno;
Aerror(statp, stderr, "connect/vc", errno,
(struct sockaddr *) nsap);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
statp->_flags |= RES_F_VC;
@ -676,7 +676,7 @@ send_vc(res_state statp,
!= (INT16SZ + buflen)) {
*terrno = errno;
Perror(statp, stderr, "write failed", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
/*
@ -694,7 +694,7 @@ send_vc(res_state statp,
if (n <= 0) {
*terrno = errno;
Perror(statp, stderr, "read failed", errno);
res_nclose(statp);
__res_iclose(statp, false);
/*
* A long running process might get its TCP
* connection reset if the remote server was
@ -706,10 +706,8 @@ send_vc(res_state statp,
*/
if (*terrno == ECONNRESET && !connreset) {
connreset = 1;
res_nclose(statp);
goto same_ns;
}
res_nclose(statp);
return (0);
}
resplen = ns_get16(ans);
@ -718,7 +716,7 @@ send_vc(res_state statp,
ans = malloc (MAXPACKET);
if (ans == NULL) {
*terrno = ENOMEM;
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
anssiz = MAXPACKET;
@ -743,7 +741,7 @@ send_vc(res_state statp,
Dprint(statp->options & RES_DEBUG,
(stdout, ";; undersized: %d\n", len));
*terrno = EMSGSIZE;
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
cp = ans;
@ -754,7 +752,7 @@ send_vc(res_state statp,
if (n <= 0) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
if (truncating) {
@ -847,7 +845,7 @@ send_dg(res_state statp,
sizeof *nsap) < 0) {
Aerror(statp, stderr, "connect(dg)", errno,
(struct sockaddr *) nsap);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
/* Make socket non-blocking. */
@ -879,7 +877,7 @@ send_dg(res_state statp,
evNowTime(&now);
if (evCmpTime(finish, now) <= 0) {
Perror(statp, stderr, "select", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
evSubTime(&timeout, &finish, &now);
@ -910,7 +908,7 @@ send_dg(res_state statp,
}
}
Perror(statp, stderr, "poll", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
__set_errno (0);
@ -919,7 +917,7 @@ send_dg(res_state statp,
if (errno == EINTR || errno == EAGAIN)
goto recompute_resend;
Perror(statp, stderr, "send", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
pfd[0].events = POLLIN;
@ -950,7 +948,7 @@ send_dg(res_state statp,
goto wait;
}
Perror(statp, stderr, "recvfrom", errno);
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
*gotsomewhere = 1;
@ -962,7 +960,7 @@ send_dg(res_state statp,
(stdout, ";; undersized: %d\n",
resplen));
*terrno = EMSGSIZE;
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
if (hp->id != anhp->id) {
@ -1011,7 +1009,7 @@ send_dg(res_state statp,
(stdout, "server rejected query:\n"),
ans, (resplen > anssiz) ? anssiz : resplen);
next_ns:
res_nclose(statp);
__res_iclose(statp, false);
/* don't retry if called from dig */
if (!statp->pfcode)
return (0);
@ -1031,7 +1029,7 @@ send_dg(res_state statp,
Dprint(statp->options & RES_DEBUG,
(stdout, ";; truncated answer\n"));
*v_circuit = 1;
res_nclose(statp);
__res_iclose(statp, false);
return (1);
}
/*
@ -1041,7 +1039,7 @@ send_dg(res_state statp,
return (resplen);
} else if (pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
/* Something went wrong. We can stop trying. */
res_nclose(statp);
__res_iclose(statp, false);
return (0);
}
else {

View File

@ -1,6 +1,5 @@
/* Copyright (C) 2004 Free Software Foundation, Inc.
/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -57,8 +56,8 @@ extern int mq_setattr (mqd_t __mqdes,
/* Remove message queue named NAME. */
extern int mq_unlink (const char *__name) __THROW;
/* Register notification upon message arrival to an empty message queue
MQDES. */
/* Register notification issued upon message arrival to an empty
message queue MQDES. */
extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
__THROW;
@ -86,6 +85,6 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
const struct timespec *__abs_timeout);
#endif
__END_DECLS
__END_DECLS
#endif /* mqueue.h */

View File

@ -33,7 +33,7 @@ routines := \
perror psignal \
tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
getline getw putw \
remove rename \
remove rename renameat \
flockfile ftrylockfile funlockfile
install-others = $(inst_includedir)/bits/stdio_lim.h

View File

@ -37,7 +37,7 @@ libc {
tempnam; tmpfile; tmpnam; tmpnam_r;
# v*
vfprintf; vfscanf; vprintf;
vfprintf; vfscanf; vprintf;
}
GLIBC_2.1 {
# p*
@ -46,6 +46,9 @@ libc {
# t*
tmpfile; tmpfile64;
}
GLIBC_2.4 {
renameat;
}
GLIBC_PRIVATE {
# global variables
_itoa_lower_digits;

View File

@ -24,10 +24,6 @@
#include <wchar.h>
#ifndef HAVE_GNU_LD
#define _sys_siglist sys_siglist
#endif
/* Defined in sys_siglist.c. */
extern const char *const _sys_siglist[];
extern const char *const _sys_siglist_internal[] attribute_hidden;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 1991-2002, 2003, 2004, 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
@ -257,7 +257,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
#define NOT_IN_JUMP_RANGE(Ch) ((Ch) < L_(' ') || (Ch) > L_('z'))
#define CHAR_CLASS(Ch) (jump_table[(INT_T) (Ch) - L_(' ')])
#if defined HAVE_SUBTRACT_LOCAL_LABELS && defined SHARED
#ifdef SHARED
/* 'int' is enough and it saves some space on 64 bit systems. */
# define JUMP_TABLE_TYPE const int
# define JUMP(ChExpr, table) \
@ -1283,7 +1283,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
/* Process whole format string. */
do
{
#if defined HAVE_SUBTRACT_LOCAL_LABELS && defined SHARED
#ifdef SHARED
# define REF(Name) &&do_##Name - &&do_form_unknown
#else
# define REF(Name) &&do_##Name
@ -1726,7 +1726,7 @@ do_positional:
for (; (size_t) nspecs_done < nspecs; ++nspecs_done)
{
#undef REF
#if defined HAVE_SUBTRACT_LOCAL_LABELS && defined SHARED
#ifdef SHARED
# define REF(Name) &&do2_##Name - &&do_form_unknown
#else
# define REF(Name) &&do2_##Name

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,95,96,97,99,2001,02 Free Software Foundation, Inc.
/* Copyright (C) 1991,95,96,97,99,2001,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
@ -21,10 +21,8 @@
#include <unistd.h>
#include "exit.h"
#ifdef HAVE_GNU_LD
#include "set-hooks.h"
DEFINE_HOOK (__libc_atexit, (void))
#endif
/* Call all functions registered with `atexit' and `on_exit',
@ -70,14 +68,7 @@ exit (int status)
free (old);
}
#ifdef HAVE_GNU_LD
RUN_HOOK (__libc_atexit, ());
#else
{
extern void _cleanup (void);
_cleanup ();
}
#endif
_exit (status);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994-2000, 2001, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994-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,10 +24,6 @@
#include <bits/libc-lock.h>
#ifndef HAVE_GNU_LD
#define _sys_siglist sys_siglist
#endif
/* Defined in siglist.c. */
extern const char *const _sys_siglist[];
extern const char *const _sys_siglist_internal[] attribute_hidden;

View File

@ -1,5 +1,5 @@
/* Tester for string functions.
Copyright (C) 1995-2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1995-2001, 2003, 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
@ -34,10 +34,6 @@
#include <strings.h>
#include <fcntl.h>
#ifndef HAVE_GNU_LD
#define _sys_nerr sys_nerr
#define _sys_errlist sys_errlist
#endif
#define STREQ(a, b) (strcmp((a), (b)) == 0)

View File

@ -372,7 +372,7 @@ svc_getreqset (fd_set *readfds)
setsize = FD_SETSIZE;
maskp = readfds->fds_bits;
for (sock = 0; sock < setsize; sock += NFDBITS)
for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1)))
for (mask = *maskp++; (bit = ffsl (mask)); mask ^= (1L << (bit - 1)))
INTUSE(svc_getreq_common) (sock + bit - 1);
}
INTDEF (svc_getreqset)
@ -380,22 +380,24 @@ INTDEF (svc_getreqset)
void
svc_getreq_poll (struct pollfd *pfdp, int pollretval)
{
register int i;
register int fds_found;
if (pollretval == 0)
return;
for (i = fds_found = 0; i < svc_max_pollfd && fds_found < pollretval; ++i)
register int fds_found;
for (int i = fds_found = 0; i < svc_max_pollfd; ++i)
{
register struct pollfd *p = &pfdp[i];
if (p->fd != -1 && p->revents)
{
/* fd has input waiting */
++fds_found;
if (p->revents & POLLNVAL)
xprt_unregister (xports[p->fd]);
else
INTUSE(svc_getreq_common) (p->fd);
if (++fds_found >= pollretval)
break;
}
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2000, 2002, 2003, 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
@ -44,12 +44,26 @@ check_one_fd (int fd, int mode)
if (__builtin_expect (__libc_fcntl (fd, F_GETFD), 0) == -1
&& errno == EBADF)
{
struct stat64 st;
const char *name;
dev_t dev;
/* For writable descriptors we use /dev/full. */
if ((mode & O_ACCMODE) == O_WRONLY)
{
name = _PATH_DEV "full";
dev = makedev (DEV_FULL_MAJOR, DEV_FULL_MINOR);
}
else
{
name = _PATH_DEVNULL;
dev = makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR);
}
/* Something is wrong with this descriptor, it's probably not
opened. Open /dev/null so that the SUID program we are
about to start does not accidently use this descriptor. */
int nullfd = open_not_cancel (_PATH_DEVNULL, mode, 0);
int nullfd = open_not_cancel (name, mode, 0);
/* We are very paranoid here. With all means we try to ensure
that we are actually opening the /dev/null device and nothing
else.
@ -57,13 +71,11 @@ check_one_fd (int fd, int mode)
Note that the following code assumes that STDIN_FILENO,
STDOUT_FILENO, STDERR_FILENO are the three lowest file
decsriptor numbers, in this order. */
struct stat64 st;
if (__builtin_expect (nullfd != fd, 0)
|| __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0
|| __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
|| st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
#endif
)
|| st.st_rdev != dev)
/* We cannot even give an error message here since it would
run into the same problems. */
while (1)
@ -84,7 +96,7 @@ __libc_check_standard_fds (void)
# define O_NOFOLLOW 0
#endif
/* Check all three standard file descriptors. */
check_one_fd (STDIN_FILENO, O_RDONLY | O_NOFOLLOW);
check_one_fd (STDOUT_FILENO, O_RDWR | O_NOFOLLOW);
check_one_fd (STDERR_FILENO, O_RDWR | O_NOFOLLOW);
check_one_fd (STDIN_FILENO, O_WRONLY | O_NOFOLLOW);
check_one_fd (STDOUT_FILENO, O_RDONLY | O_NOFOLLOW);
check_one_fd (STDERR_FILENO, O_RDONLY | O_NOFOLLOW);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1997, 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
@ -18,10 +18,6 @@
#include <stddef.h>
#ifndef HAVE_GNU_LD
#define _sys_errlist sys_errlist
#define _sys_nerr sys_nerr
#endif
const char *const _sys_errlist[] =
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1996, 1997, 2002 Free Software Foundation, Inc.
/* Copyright (C) 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,34 +17,35 @@
02111-1307 USA. */
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stddef.h>
#include <unistd.h>
#include <sys/types.h>
/* Set the state of FD to *TERMIOS_P. */
/* Change the owner and group of FILE. */
int
tcsetattr (fd, optional_actions, termios_p)
fchownat (fd, file, owner, group, flag)
int fd;
int optional_actions;
const struct termios *termios_p;
const char *file;
uid_t owner;
gid_t group;
int flag;
{
unsigned long cmd;
switch (optional_actions)
if (file == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
{
case TCSANOW:
cmd = TCSETS;
break;
case TCSADRAIN:
cmd = TCSETSW;
break;
case TCSAFLUSH:
cmd = TCSETSF;
break;
default:
__set_errno (EINVAL);
return -1;
}
return __ioctl (fd, cmd, termios_p);
if (fd < 0 && fd != AT_FDCWD)
{
__set_errno (EBADF);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
libc_hidden_def (tcsetattr)
stub_warning (fchownat)
#include <stub-tag.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
/* Copyright (C) 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,14 +17,36 @@
02111-1307 USA. */
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/time.h>
/* Flush pending data on FD. */
/* Change the access time of FILE relative to FD to TVP[0] and
the modification time of FILE to TVP[1]. */
int
tcflush (fd, queue_selector)
futimesat (fd, file, tvp)
int fd;
int queue_selector;
const char *file;
const struct timeval tvp[2];
{
return __ioctl (fd, TCFLSH, queue_selector);
if (fd < 0 && fd != AT_FDCWD)
{
__set_errno (EBADF);
return -1;
}
if (file == NULL)
{
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
weak_alias (__utimes, utimes)
stub_warning (utimes)
#include <stub-tag.h>

View File

@ -0,0 +1,49 @@
/* Copyright (C) 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
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 <fcntl.h>
#include <stddef.h>
#include <sys/stat.h>
/* Get information about the file descriptor FD in BUF. */
int
__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
{
if (vers != _STAT_VER)
{
__set_errno (EINVAL);
return -1;
}
if (fd < 0 && fd != AT_FDCWD)
{
__set_errno (EBADF);
return -1;
}
if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
{
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (fstatat)
#include <stub-tag.h>

View File

@ -0,0 +1,50 @@
/* Copyright (C) 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
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 <fcntl.h>
#include <stddef.h>
#include <sys/stat.h>
/* Get information about the file descriptor FD in BUF. */
int
__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
int flag)
{
if (vers != _STAT_VER)
{
__set_errno (EINVAL);
return -1;
}
if (fd < 0 && fd != AT_FDCWD)
{
__set_errno (EBADF);
return -1;
}
if (buf == NULL || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
{
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (fstatat64)
#include <stub-tag.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991,92,94,96,98,99,2002 Free Software Foundation, Inc.
/* Copyright (C) 1991,92,94,96,98,99,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,9 +23,6 @@
#include <string.h>
#include <unistd.h>
#ifndef HAVE_GNU_LD
#define __environ environ
#endif
/* Return the value of the environment variable NAME. This implementation
is tuned a bit in that it assumes no environment variable has an empty

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991,1992,1995,1996,1997,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
@ -40,7 +40,7 @@ __getgroups (size, list)
return -1;
}
#if defined (HAVE_GNU_LD) && !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
#if !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
stub_warning (getgroups);
#endif

View File

@ -1,27 +1 @@
/* Copyright (C) 1991, 1995, 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 HAVE_GNU_LD
void
__init_posix (void)
{
return;
}
#endif
/* Nothing to do. */

View File

@ -60,8 +60,9 @@ bool _dl_tls_dtv_gaps;
struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list;
/* Number of modules in the static TLS block. */
size_t _dl_tls_static_nelem;
/* Size of the static TLS block. */
size_t _dl_tls_static_size;
/* Size of the static TLS block. Giving this initialized value
preallocates some surplus bytes in the static TLS area. */
size_t _dl_tls_static_size = 2048;
/* Size actually allocated in the static TLS block. */
size_t _dl_tls_static_used;
/* Alignment requirement of the static TLS block. */

69
sysdeps/generic/openat.c Normal file
View File

@ -0,0 +1,69 @@
/* Copyright (C) 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
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 <fcntl.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/stat.h>
/* Open FILE with access OFLAG. Interpret relative paths relative to
the directory associated with FD. If OFLAG includes O_CREAT, a
third argument is the file protection. */
int
openat (fd, file, oflag)
int fd;
const char *file;
int oflag;
{
int mode;
if (file == NULL)
{
__set_errno (EINVAL);
return -1;
}
if (fd != AT_FDCWD && file[0] != '/')
{
/* Check FD is associated with a directory. */
struct stat64 st;
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
{
__set_errno (ENOTDIR);
return -1;
}
}
if (oflag & O_CREAT)
{
va_list arg;
va_start (arg, oflag);
mode = va_arg (arg, int);
va_end (arg);
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (openat)
#include <stub-tag.h>

View File

@ -0,0 +1,69 @@
/* Copyright (C) 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
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 <fcntl.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/stat.h>
/* Open FILE with access OFLAG. Interpret relative paths relative to
the directory associated with FD. If OFLAG includes O_CREAT, a
third argument is the file protection. */
int
openat64 (fd, file, oflag)
int fd;
const char *file;
int oflag;
{
int mode;
if (file == NULL)
{
__set_errno (EINVAL);
return -1;
}
if (fd != AT_FDCWD && file[0] != '/')
{
/* Check FD is associated with a directory. */
struct stat64 st;
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
return -1;
if (!S_ISDIR (st.st_mode))
{
__set_errno (ENOTDIR);
return -1;
}
}
if (oflag & O_CREAT)
{
va_list arg;
va_start (arg, oflag);
mode = va_arg (arg, int);
va_end (arg);
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (openat64)
#include <stub-tag.h>

View File

@ -0,0 +1,50 @@
/* Copyright (C) 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
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 <fcntl.h>
#include <stdio.h>
/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD. */
int
renameat (oldfd, old, newfd, new)
int oldfd;
const char *old;
int newfd;
const char *new;
{
if ((oldfd < 0 & oldfd !_ AT_FDCWD) || (newfd < 0 && newfd != AT_FDCWD))
{
__set_errno (EBADF);
return -1;
}
if (old == NULL || new == NULL)
{
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (renameat)
#include <stub-tag.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 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,17 +17,33 @@
02111-1307 USA. */
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
/* Put the state of FD into *TERMIOS_P. */
/* Remove the link named NAME. */
int
__tcgetattr (fd, termios_p)
unlinkat (fd, name, flag)
int fd;
struct termios *termios_p;
const char *name;
int flag;
{
return __ioctl (fd, TCGETS, termios_p);
}
if (name == NULL || (flag & AT_REMOVEDIR) != 0)
{
__set_errno (EINVAL);
return -1;
}
weak_alias (__tcgetattr, tcgetattr)
if (fd < 0 && fd != AT_FDCWD)
{
__set_errno (EBADF);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning (unlinkat)
#include <stub-tag.h>

View File

@ -52,6 +52,3 @@ if test $libc_cv_cpp_asm_debuginfo = yes; then
_ACEOF
fi
# Tell top-level configure to try -mtune=i386.
libc_mtune_example=i386

View File

@ -33,6 +33,3 @@ rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo)
if test $libc_cv_cpp_asm_debuginfo = yes; then
AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO)
fi
# Tell top-level configure to try -mtune=i386.
libc_mtune_example=i386

View File

@ -1,5 +1,5 @@
/* Special .init and .fini section support for ia64.
Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 2000, 2002, 2003, 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
@ -51,7 +51,6 @@ __asm__ ("\n\n"
"\n"
"/*@_init_PROLOG_BEGINS*/\n");
#ifdef HAVE_INITFINI_ARRAY
/* If we have working .init_array support, we want to keep the .init
section empty (apart from the mandatory prologue/epilogue. This
@ -75,7 +74,6 @@ gmon_initializer (void)
__asm__ (".section .init_array, \"aw\"\n"
"\tdata8 @fptr(gmon_initializer)\n");
#endif
__asm__ (".section .init\n"
" .global _init#\n"
@ -90,27 +88,7 @@ __asm__ (".section .init\n"
" mov r33 = b0\n"
" .body\n"
" adds r12 = -16, r12\n"
#ifdef HAVE_INITFINI_ARRAY
" ;;\n" /* see gmon_initializer() above */
#else
" .weak __gmon_start__#\n"
" addl r14 = @ltoff(@fptr(__gmon_start__#)), gp\n"
" ;;\n"
" ld8 r15 = [r14]\n"
" ;;\n"
" cmp.eq p6, p7 = 0, r15\n"
" (p6) br.cond.dptk .L5\n"
"\n"
"/* we could use r35 to save gp, but we use the stack since that's what\n"
" * all the other init routines will do --davidm 00/04/05 */\n"
" st8 [r12] = gp, -16\n"
" br.call.sptk.many b0 = __gmon_start__# ;;\n"
" adds r12 = 16, r12\n"
" ;;\n"
" ld8 gp = [r12]\n"
" ;;\n"
".L5:\n"
#endif
" .endp _init#\n"
"\n"
"/*@_init_PROLOG_ENDS*/\n"

View File

@ -39,13 +39,13 @@
#define WEAK_LIBM_ENTRY(name) \
.align 32; \
LOCAL_LIBM_ENTRY(name); \
LOCAL_LIBM_ENTRY(__##name); \
.global __##name; \
__##name:
#define WEAK_LIBM_END(name) \
weak_alias (__##name, name); \
.hidden __##name; \
LOCAL_LIBM_END(name); \
LOCAL_LIBM_END(__##name); \
ASM_SIZE_DIRECTIVE(__##name); \
ASM_TYPE_DIRECTIVE(__##name, @function)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 93, 94, 96, 97, 99, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1992,93,94,96,97,99,2000,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
@ -182,8 +182,11 @@ struct stat64
/* All the bits relevant to translators */
#define S_ITRANS 000070000000
/* Definitely no mmaps to this. */
#define S_IMMAP0 000100000000
/* ALL the unused bits. */
#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE| \
#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0| \
S_IUSEUNK|S_IUNKNOWN|07777))
#endif

View File

@ -55,11 +55,14 @@ __getpeername (int fd, __SOCKADDR_ARG addrarg, socklen_t *len)
}
const sa_family_t family = type;
if (*len < (char *) (&addr->sa_family + 1) - (char *) addr)
memcpy (&addr->sa_family, &family,
*len - offsetof (struct sockaddr, sa_family));
else
addr->sa_family = family;
if (*len > offsetof (struct sockaddr, sa_family))
{
if (*len < (char *) (&addr->sa_family + 1) - (char *) addr)
memcpy (&addr->sa_family, &family,
*len - offsetof (struct sockaddr, sa_family));
else
addr->sa_family = family;
}
return 0;
}

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1992,93,94,95,96,97,99,2000,02 Free Software Foundation, Inc.
/* Copyright (C) 1992,93,94,95,96,97,99,2000,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
@ -136,9 +137,11 @@ __ioctl (int fd, unsigned long int request, ...)
Rather than pointing to the value, ARG is the value itself. */
#ifdef MACH_MSG_TYPE_BIT
*t++ = io2mach_type (1, _IOTS (integer_t));
*((integer_t *) t)++ = (integer_t) arg;
*(integer_t *) t = (integer_t) arg;
t = (void *) t + sizeof (integer_t);
#else
*((integer_t *) p)++ = (integer_t) arg;
*(integer_t *) p = (integer_t) arg;
p = (void *) p + sizeof (integer_t);
#endif
}

View File

@ -568,12 +568,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (at->family == AF_UNSPEC)
{
char *namebuf = strdupa (name);
char *scope_delim;
char *namebuf = (char *) name;
char *scope_delim = strchr (name, SCOPE_DELIMITER);
scope_delim = strchr (namebuf, SCOPE_DELIMITER);
if (scope_delim != NULL)
*scope_delim = '\0';
if (__builtin_expect (scope_delim != NULL, 0))
{
namebuf = alloca (scope_delim - name + 1);
*((char *) __mempcpy (namebuf, name, scope_delim - name)) = '\0';
}
if (inet_pton (AF_INET6, namebuf, at->addr) > 0)
{
@ -629,7 +631,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
/* If we do not have to look for IPv4 and IPv6 together, use
the simple, old functions. */
if (req->ai_family == AF_INET || req->ai_family == AF_INET6)
if (req->ai_family == AF_INET
|| (req->ai_family == AF_INET6
&& ((req->ai_flags & AI_V4MAPPED) == 0
|| (req->ai_flags & AI_ALL) == 0)))
{
int family = req->ai_family;
size_t tmpbuflen = 512;
@ -888,8 +893,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
AF_INET6. Try to find a useful one for both. */
if (inet6_status == NSS_STATUS_TRYAGAIN)
status = NSS_STATUS_TRYAGAIN;
else if (status == NSS_STATUS_UNAVAIL &&
inet6_status != NSS_STATUS_UNAVAIL)
else if (status == NSS_STATUS_UNAVAIL
&& inet6_status != NSS_STATUS_UNAVAIL)
status = inet6_status;
}
@ -1039,9 +1044,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
}
if (at2->family == AF_INET6)
family = at2->family;
if (family == AF_INET6)
{
family = AF_INET6;
socklen = sizeof (struct sockaddr_in6);
/* If we looked up IPv4 mapped address discard them here if
@ -1053,10 +1058,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
goto ignore;
}
else
{
family = AF_INET;
socklen = sizeof (struct sockaddr_in);
}
socklen = sizeof (struct sockaddr_in);
for (st2 = st; st2 != NULL; st2 = st2->next)
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 94, 95, 96, 97, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1991,1992,1994-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
@ -20,12 +20,6 @@
#include <time.h>
#include <sys/time.h>
#ifndef HAVE_GNU_LD
#define __daylight daylight
#define __timezone timezone
#define __tzname tzname
#endif
#undef __gettimeofday
/* Get the current time of day and timezone information,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2000, 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 1991-2000, 2002, 2003, 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
@ -27,10 +27,6 @@
#include <sysdep-cancel.h>
#ifndef HAVE_GNU_LD
#define __environ environ
#endif
#define SHELL_PATH "/bin/sh" /* Path of the shell. */
#define SHELL_NAME "sh" /* Name to give it. */

View File

@ -11,6 +11,8 @@ pic-ccflag = -fpic
endif
ifeq ($(subdir),csu)
sysdep_routines += hp-timing
elide-routines.os += hp-timing
ifneq ($(elf),no)
# The initfini generation code doesn't work in the presence of -fPIC, so
# we use -fpic instead which is much better.

View File

@ -1,5 +1,8 @@
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
/* Support for high precision, low overhead timing functions.
powerpc64 version.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
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,15 +19,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <hp-timing.h>
/* Suspend or restart transmission on FD. */
int
tcflow (fd, action)
int fd;
int action;
{
return __ioctl (fd, TCXONC, action);
}
/* We have to define the variable for the overhead. */
hp_timing_t _dl_hp_timing_overhead;

View File

@ -0,0 +1,136 @@
/* High precision, low overhead timing functions. powerpc64 version.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
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 _HP_TIMING_H
#define _HP_TIMING_H 1
#include <string.h>
#include <sys/param.h>
#include <stdio-common/_itoa.h>
#include <atomic.h>
/* The macros defined here use the powerpc 64-bit time base register.
The time base is nominally clocked at 1/8th the CPU clock, but this
can vary.
The list of macros we need includes the following:
- HP_TIMING_AVAIL: test for availability.
- HP_TIMING_INLINE: this macro is non-zero if the functionality is not
implemented using function calls but instead uses some inlined code
which might simply consist of a few assembler instructions. We have to
know this since we might want to use the macros here in places where we
cannot make function calls.
- hp_timing_t: This is the type for variables used to store the time
values.
- HP_TIMING_ZERO: clear `hp_timing_t' object.
- HP_TIMING_NOW: place timestamp for current time in variable given as
parameter.
- HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the
HP_TIMING_DIFF macro.
- HP_TIMING_DIFF: compute difference between two times and store it
in a third. Source and destination might overlap.
- HP_TIMING_ACCUM: add time difference to another variable. This might
be a bit more complicated to implement for some platforms as the
operation should be thread-safe and 64bit arithmetic on 32bit platforms
is not.
- HP_TIMING_ACCUM_NT: this is the variant for situations where we know
there are no threads involved.
- HP_TIMING_PRINT: write decimal representation of the timing value into
the given string. This operation need not be inline even though
HP_TIMING_INLINE is specified.
*/
/* We always assume having the timestamp register. */
#define HP_TIMING_AVAIL (1)
/* We indeed have inlined functions. */
#define HP_TIMING_INLINE (1)
/* We use 64bit values for the times. */
typedef unsigned long long int hp_timing_t;
/* Set timestamp value to zero. */
#define HP_TIMING_ZERO(Var) (Var) = (0)
/* That's quite simple. Use the `mftb' instruction. Note that the value
might not be 100% accurate since there might be some more instructions
running in this moment. This could be changed by using a barrier like
'lwsync' right before the `mftb' instruciton. But we are not interested
in accurate clock cycles here so we don't do this. */
#define HP_TIMING_NOW(Var) __asm__ __volatile__ ("mftb %0" : "=r" (Var))
/* Use two 'mftb' instructions in a row to find out how long it takes.
On current POWER4, POWER5, and 970 processors mftb take ~10 cycles. */
#define HP_TIMING_DIFF_INIT() \
do { \
if (GLRO(dl_hp_timing_overhead) == 0) \
{ \
int __cnt = 5; \
GLRO(dl_hp_timing_overhead) = ~0ull; \
do \
{ \
hp_timing_t __t1, __t2; \
HP_TIMING_NOW (__t1); \
HP_TIMING_NOW (__t2); \
if (__t2 - __t1 < GLRO(dl_hp_timing_overhead)) \
GLRO(dl_hp_timing_overhead) = __t2 - __t1; \
} \
while (--__cnt > 0); \
} \
} while (0)
/* It's simple arithmetic in 64-bit. */
#define HP_TIMING_DIFF(Diff, Start, End) (Diff) = ((End) - (Start))
/* We need to insure that this add is atomic in threaded environments. We use
__arch_atomic_exchange_and_add_64 from atomic.h to get thread safety. */
#define HP_TIMING_ACCUM(Sum, Diff) \
do { \
hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \
__arch_atomic_exchange_and_add_64 (&(Sum), __diff); \
} while (0)
/* No threads, no extra work. */
#define HP_TIMING_ACCUM_NT(Sum, Diff) (Sum) += (Diff)
/* Print the time value. */
#define HP_TIMING_PRINT(Buf, Len, Val) \
do { \
char __buf[20]; \
char *__cp = _itoa (Val, __buf + sizeof (__buf), 10, 0); \
size_t __len = (Len); \
char *__dest = (Buf); \
while (__len-- > 0 && __cp < __buf + sizeof (__buf)) \
*__dest++ = *__cp++; \
memcpy (__dest, " ticks", MIN (__len, sizeof (" ticks"))); \
} while (0)
#endif /* hp-timing.h */

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