+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.
+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.
-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.
* 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.
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.
+\f
+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.
\f
Version 2.3.5
----------------------------------------------------------------------
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
# 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. */
/* 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
/* 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
/* 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
config-vendor = @host_vendor@
config-os = @host_os@
config-sysdirs = @sysnames@
+with-cpu = @submachine@
defines = @DEFINES@
sysincludes = @SYSINCLUDES@
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@
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@
# 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.
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
# 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*)
;;
;;
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
# 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.
# 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
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"
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.
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
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
(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
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
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
-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
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
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
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
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
# 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*)
;;
;;
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
# 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.
# 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
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"
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.
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
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; }
-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,
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
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,
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
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
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
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
#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;
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;
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
__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
+++ /dev/null
-/* 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
-}
+++ /dev/null
-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 }
-/* 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
/* 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));
int __dlfcn_argc attribute_hidden;
char **__dlfcn_argv attribute_hidden;
-#ifdef HAVE_INITFINI_ARRAY
+
static void
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
+};
/* 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.
{
#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
#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,
#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 */
/* 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__);
# endif
#endif
}
-#ifdef HAVE_INITFINI_ARRAY
+
void (*_fini_ptr) (void) __attribute__ ((section (".fini_array")))
= &__libc_fini;
-#endif
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
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);
}
/* 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
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:
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. */
"\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",
"\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",
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
* 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'.
#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
/* 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
\f
*/
-#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) \
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)
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)
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)
-# 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
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
# n*
nftw; nftw64;
}
+ GLIBC_2.4 {
+ fchownat;
+ __fxstatat; __fxstatat64;
+ openat; openat64;
+ unlinkat;
+ }
}
-/* 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
# 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.
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.
--- /dev/null
+/* 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
--- /dev/null
+/* 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
-/* 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
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.
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,
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
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));
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))
}
# 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
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
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.
+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]
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 \
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
#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);
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 \
remap_file_pages;
}
GLIBC_2.4 {
+ futimesat;
__syslog_chk; __vsyslog_chk;
}
}
-/* 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.
{
/* 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;
-/* 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.
++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;
+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
2005-02-14 Alan Modra <amodra@bigpond.net.au>
+ [BZ #721]
* sysdeps/powerpc/tcb-offsets.sym (thread_offsetof): Redefine to suit
gcc4.
+++ /dev/null
-# Local configure fragment for sysdeps/unix/sysv/linux.
-
-DEFINES="$DEFINES -D_LIBC_REENTRANT"
/* 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
#include <stddef.h>
-#ifdef HAVE_INITFINI_ARRAY
__asm__ ("\n\
#include \"defs.h\"\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
-/* 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.
orl $-1, %eax
retq
.size sem_trywait,.-sem_trywait
- versioned_symbol(libpthread, __new_sem_trywait, sem_trywait, GLIBC_2_1)
/* 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. */
#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'. */
-/* 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
#include <unistd.h>
-#ifndef HAVE_GNU_LD
-# define __environ environ
-#endif
/* Execute PATH with arguments ARGV and environment from `environ'. */
int
#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;
/* 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));
h_errno; __resp;
%endif
- __res_maybe_init;
+ __res_maybe_init; __res_iclose;
}
}
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
* 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) {
#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
/* 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;
_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
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);
}
}
}
}
if (needclose)
- res_nclose(statp);
+ __res_iclose(statp, false);
}
/*
done = 1;
break;
case res_nextns:
- res_nclose(statp);
+ __res_iclose(statp, false);
goto next_ns;
case res_done:
return (resplen);
*/
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;
done = 1;
break;
case res_nextns:
- res_nclose(statp);
+ __res_iclose(statp, false);
goto next_ns;
case res_modified:
/* give the hook another try */
next_ns: ;
} /*foreach ns*/
} /*foreach retry*/
- res_nclose(statp);
+ __res_iclose(statp, false);
if (!v_circuit) {
if (!gotsomewhere)
__set_errno (ECONNREFUSED); /* no nameservers found */
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) {
*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;
!= (INT16SZ + buflen)) {
*terrno = errno;
Perror(statp, stderr, "write failed", errno);
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
/*
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
*/
if (*terrno == ECONNRESET && !connreset) {
connreset = 1;
- res_nclose(statp);
goto same_ns;
}
- res_nclose(statp);
return (0);
}
resplen = ns_get16(ans);
ans = malloc (MAXPACKET);
if (ans == NULL) {
*terrno = ENOMEM;
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
anssiz = MAXPACKET;
Dprint(statp->options & RES_DEBUG,
(stdout, ";; undersized: %d\n", len));
*terrno = EMSGSIZE;
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
cp = ans;
if (n <= 0) {
*terrno = errno;
Perror(statp, stderr, "read(vc)", errno);
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
if (truncating) {
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. */
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);
}
}
Perror(statp, stderr, "poll", errno);
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
__set_errno (0);
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;
goto wait;
}
Perror(statp, stderr, "recvfrom", errno);
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
*gotsomewhere = 1;
(stdout, ";; undersized: %d\n",
resplen));
*terrno = EMSGSIZE;
- res_nclose(statp);
+ __res_iclose(statp, false);
return (0);
}
if (hp->id != anhp->id) {
(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);
Dprint(statp->options & RES_DEBUG,
(stdout, ";; truncated answer\n"));
*v_circuit = 1;
- res_nclose(statp);
+ __res_iclose(statp, false);
return (1);
}
/*
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 {
-/* 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
/* 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;
const struct timespec *__abs_timeout);
#endif
-__END_DECLS
+__END_DECLS
#endif /* mqueue.h */
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
tempnam; tmpfile; tmpnam; tmpnam_r;
# v*
- vfprintf; vfscanf; vprintf;
+ vfprintf; vfscanf; vprintf;
}
GLIBC_2.1 {
# p*
# t*
tmpfile; tmpfile64;
}
+ GLIBC_2.4 {
+ renameat;
+ }
GLIBC_PRIVATE {
# global variables
_itoa_lower_digits;
#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;
-/* 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
#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) \
/* 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
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
-/* 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
#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',
free (old);
}
-#ifdef HAVE_GNU_LD
RUN_HOOK (__libc_atexit, ());
-#else
- {
- extern void _cleanup (void);
- _cleanup ();
- }
-#endif
_exit (status);
}
-/* 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
#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;
/* 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
#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)
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)
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;
}
}
}
-/* 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
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.
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)
# 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);
}
-/* 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
#include <stddef.h>
-#ifndef HAVE_GNU_LD
-#define _sys_errlist sys_errlist
-#define _sys_nerr sys_nerr
-#endif
const char *const _sys_errlist[] =
{
-/* 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
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>
-/* 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
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>
--- /dev/null
+/* 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>
--- /dev/null
+/* 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>
-/* 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
#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
-/* 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
return -1;
}
-#if defined (HAVE_GNU_LD) && !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
+#if !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
stub_warning (getgroups);
#endif
-/* 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. */
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. */
--- /dev/null
+/* 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>
--- /dev/null
+/* 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>
--- /dev/null
+/* 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>
-/* 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
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;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
}
+stub_warning (unlinkat)
-weak_alias (__tcgetattr, tcgetattr)
+#include <stub-tag.h>
_ACEOF
fi
-
-# Tell top-level configure to try -mtune=i386.
-libc_mtune_example=i386
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
/* 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
"\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
__asm__ (".section .init_array, \"aw\"\n"
"\tdata8 @fptr(gmon_initializer)\n");
-#endif
__asm__ (".section .init\n"
" .global _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"
#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)
-/* 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
/* 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
}
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;
}
-/* 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
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
}
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)
{
/* 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;
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;
}
}
}
- 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
goto ignore;
}
else
- {
- family = AF_INET;
- socklen = sizeof (struct sockaddr_in);
- }
+ socklen = sizeof (struct sockaddr_in);
for (st2 = st; st2 != NULL; st2 = st2->next)
{
-/* 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
#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,
-/* 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
#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. */
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.
-/* 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
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;
--- /dev/null
+/* 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 */
-# Local configure fragment for sysdeps/unix/sysv/linux.
+# Local configure fragment for sysdeps/pthread.
DEFINES="$DEFINES -D_LIBC_REENTRANT"
-/* Copyright (C) 1991, 94, 95, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 97, 98, 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
_posix_start_time = time ((time_t *) NULL);
}
-#ifdef HAVE_GNU_LD
text_set_element(__libc_subinit, __init_posix);
-#endif
+++ /dev/null
-m68k/dl-brk.S
+++ /dev/null
-/* Signal number definitions. SunOS version.
- Copyright (C) 1994, 1996 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. */
-
-#ifdef _SIGNAL_H
-
-/* This file defines the fake signal functions and signal
- number constants for SunOS 3 and 4 Unix systems. */
-
-/* Fake signal functions. */
-#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
-#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
-#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
-
-
-/* Signals. */
-#define SIGHUP 1 /* Hangup (POSIX). */
-#define SIGINT 2 /* Interrupt (ANSI). */
-#define SIGQUIT 3 /* Quit (POSIX). */
-#define SIGILL 4 /* Illegal instruction (ANSI). */
-#define SIGABRT SIGIOT /* Abort (ANSI). */
-#define SIGTRAP 5 /* Trace trap (POSIX). */
-#define SIGIOT 6 /* IOT trap (4.2 BSD). */
-#define SIGEMT 7 /* EMT trap (4.2 BSD). */
-#define SIGFPE 8 /* Floating-point exception (ANSI). */
-#define SIGKILL 9 /* Kill, unblockable (POSIX). */
-#define SIGBUS 10 /* Bus error (4.2 BSD). */
-#define SIGSEGV 11 /* Segmentation violation (ANSI). */
-#define SIGSYS 12 /* Bad argument to system call (4.2 BSD). */
-#define SIGPIPE 13 /* Broken pipe (POSIX). */
-#define SIGALRM 14 /* Alarm clock (POSIX). */
-#define SIGTERM 15 /* Termination (ANSI). */
-#define SIGURG 16 /* Urgent condition on socket (4.2 BSD). */
-#define SIGSTOP 17 /* Stop, unblockable (POSIX). */
-#define SIGTSTP 18 /* Keyboard stop (POSIX). */
-#define SIGCONT 19 /* Continue (POSIX). */
-#define SIGCHLD 20 /* Child status has changed (POSIX). */
-#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
-#define SIGTTIN 21 /* Background read from tty (POSIX). */
-#define SIGTTOU 22 /* Background write to tty (POSIX). */
-#define SIGIO 23 /* I/O now possible (4.2 BSD). */
-#define SIGPOLL SIGIO /* Same as SIGIO? (SVID). */
-#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */
-#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */
-#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */
-#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */
-#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
-#define SIGLOST 29 /* Resource lost (Sun). */
-#define SIGUSR1 30 /* User-defined signal 1 (POSIX). */
-#define SIGUSR2 31 /* User-defined signal 2 (POSIX). */
-
-#endif /* <signal.h> included. */
-
-#define _NSIG 32 /* Biggest signal number + 1. */
+++ /dev/null
-sigtramp.c
+++ /dev/null
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
+++ /dev/null
-/* Structure describing state saved while handling a signal. Sun 3 version.
- Copyright (C) 1993, 1994, 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 _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
- {
- int sc_onstack;
- __sigset_t sc_mask;
-
- int sc_sp, sc_pc, sc_ps;
- };
+++ /dev/null
-/* Copyright (C) 1991, 1992, 1994, 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. */
-
-#include <sysdep.h>
-
-#ifndef SYS_brk
-#define SYS_brk 17
-#endif
-
-#ifndef HAVE_GNU_LD
-#define __end _end
-#endif
-
-.data
-.globl ___curbrk
-___curbrk:
- .long __end
-
-.text
-ENTRY (__brk)
- movel #__end, d0
- cmpl sp@(4), d0
- ble 0f
- movel d0, sp@(4)
-0: pea SYS_brk
- trap #0
- bcs 1f
- movel sp@(4), ___curbrk
- clrl d0
- rts
-1:
- jmp syscall_error
-
-weak_alias (__brk, brk)
+++ /dev/null
-#include <brk.S>
+++ /dev/null
-/* Copyright (C) 1991, 1992, 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. */
-
-#include <sysdep.h>
-
-#ifdef SYS_sethostid
-
-SYSCALL (sethostid, 1)
- ret
-
-#else
-
-#include <bits/errno.h>
-
-.globl _sethostid
-.even
-_sethostid:
- movel #ENOSYS, _errno
- moveq #-1, d0
- rts
-
-#ifdef HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
-
-#endif
+++ /dev/null
-/* Copyright (C) 1993, 1996, 1997, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef __GNUC__
- #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'. */
-#define KERNEL
-#define sigvec sun_sigvec
-#define sigstack sun_sigstack
-#define sigcontext sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef sigvec
-#undef sigstack
-#undef sigcontext
-#undef NSIG
-#undef SIGABRT
-#undef SIGCLD
-#undef SV_ONSTACK
-#undef SV_RESETHAND
-#undef SV_INTERRUPT
-#undef SA_ONSTACK
-#undef SA_NOCLDSTOP
-#undef SIG_ERR
-#undef SIG_DFL
-#undef SIG_IGN
-#undef sigmask
-#undef SIG_BLOCK
-#undef SIG_UNBLOCK
-#undef SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S. */
-extern int __raw_sigvec (int sig, const struct sigvec *vec,
- struct sigvec *ovec);
-
-/* User-specified signal handlers. */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
- Saves and restores the general regs %g2-%g7, the %y register, and
- all the FPU regs (including %fsr), around calling the user's handler. */
-static void
-trampoline (sig, code, context, addr)
- int sig;
- int code;
- struct sigcontext *context;
- void *addr;
-{
- int save[4];
-
- /* Save the call-clobbered registers. */
- asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0]));
-
- /* XXX should save/restore FP regs */
-
- /* Call the user's handler. */
- (*((void (*) (int sig, int code, struct sigcontext *context,
- PTR addr)) handlers[sig]))
- (sig, code, context, addr);
-
- /* Restore the call-clobbered registers. */
- asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) :
- "d0", "d1", "a0", "a1");
-
- __sigreturn (context);
-}
-
-#endif
-
-int
-__sigvec (sig, vec, ovec)
- int sig;
- const struct sigvec *vec;
- struct sigvec *ovec;
-{
-#ifndef mytramp
- extern void _sigtramp (int);
-#define trampoline _sigtramp
-#endif
- struct sigvec myvec;
- int mask;
- __sighandler_t ohandler;
-
- if (sig <= 0 || sig >= NSIG)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- mask = __sigblock(sigmask(sig));
-
- ohandler = handlers[sig];
-
- if (vec != NULL &&
- vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
- {
- handlers[sig] = vec->sv_handler;
- myvec = *vec;
- myvec.sv_handler = trampoline;
- vec = &myvec;
- }
-
- if (__raw_sigvec(sig, vec, ovec) < 0)
- {
- int save = errno;
- (void) __sigsetmask(mask);
- errno = save;
- return -1;
- }
-
- if (ovec != NULL && ovec->sv_handler == trampoline)
- ovec->sv_handler = ohandler;
-
- (void) __sigsetmask(mask);
-
- return 0;
-}
+++ /dev/null
-/* Copyright (C) 1993, 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. */
-
-#include <sysdep.h>
-
-ENTRY (syscall)
- movel sp@, d0 /* Save return address in D0. */
- movel sp@(4), sp@ /* Put syscall number at top of stack. */
- movel d0, sp@(4) /* Put return address under it. */
- trap #0 /* Do syscall; pops number from stack. */
- jcs error
- ret
-error: jmp syscall_error
+++ /dev/null
-/* Copyright (C) 1991, 1992, 1994, 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. */
-
-#include <sysdeps/unix/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-#define POUND #
-
-#ifdef __STDC__
-#define ENTRY(name) \
- .globl _##name; \
- .even; \
- _##name##:
-#else
-#define ENTRY(name) \
- .globl _/**/name; \
- .even; \
- _/**/name/**/:
-#endif
-
-#ifdef __STDC__
-#define PSEUDO(name, syscall_name, args) \
- .even; \
- .globl syscall_error; \
- error: jmp syscall_error; \
- ENTRY (name) \
- pea SYS_##syscall_name; \
- trap POUND 0; \
- bcs error
-#else
-#define PSEUDO(name, syscall_name, args) \
- .even; \
- .globl syscall_error; \
- error: jmp syscall_error; \
- ENTRY (name) \
- pea SYS_/**/syscall_name; \
- trap POUND 0; \
- bcs error
-#endif
-
-#define ret rts
-#define r0 d0
-#define r1 d1
-#define MOVE(x,y) movel x , y
-
-#endif /* __ASSEMBLER__ */
+++ /dev/null
-/* Copyright (C) 1991, 92, 93, 94, 95, 97, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <sysdep.h>
-
-#ifndef SYS_vfork
-#define SYS_vfork 66
-#endif
-
-/* Clone the calling process, but without copying the whole address space.
- The calling process is suspended until the new process exits or is
- replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
- and the process ID of the new process to the old process. */
-.globl ___vfork
-___vfork:
- /* Pop the return PC value into A0. */
- movel sp@+, a0
-
- /* Push the syscall number and trap into the kernel. */
- movel #SYS_vfork, sp@-
- trap #0
- bcs error /* Branch forward if it failed. */
-
- /* It succeeded. See which fork we're in. D1 is now 0 for the
- parent and 1 for the child. Decrement it to make it -1 (all
- bits set) for the parent, and 0 (no bits set) for the child.
- Then AND it with D0, so the parent gets D0&-1==R0, and the child
- gets D0&0==0. */
- subql #1, d1
- andl d1, d0
-
- /* Jump to the return PC. */
- jmp a0@
-
-error:
- movel d0, _errno
- moveq #-1, d0
- jmp a0@
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
+++ /dev/null
-#include <sysdeps/generic/sethostid.c>
+++ /dev/null
-/* Copyright (C) 1993, 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. */
-
-#include <sysdep.h>
-
-#ifndef SYS_sigreturn
-#define SYS_sigreturn 139
-#endif
-
-SYSCALL__ (sigreturn, 1)
- /* Does not return. */
-
-weak_alias (__sigreturn, sigreturn)
+++ /dev/null
-sigtramp.c
+++ /dev/null
-# Basically `-e start' is magical to the Sun linker. You would think that
-# having start.o first would be enough, but you would be wrong.
-LDFLAGS := $(LDFLAGS) -Xlinker -e -Xlinker start
-
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
+++ /dev/null
-/* Structure describing state saved while handling a signal. Sparc version.
- Copyright (C) 1992, 1994, 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 _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
- {
- int sc_onstack;
- __sigset_t sc_mask;
-
-#define SPARC_MAXREGWINDOW 31 /* Maximum usable register windows. */
- int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0;
- int sc_wbcnt; /* Number of outstanding windows. */
- __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window. */
- int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows. */
- };
+++ /dev/null
-/* Copyright (C) 1991, 1992, 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. */
-
-#include <sysdep.h>
-
-#ifdef SYS_sethostid
-
-SYSCALL (sethostid, 1)
- ret
-
-#else
-
-/* <bits/errno.h> only defines E* #ifdef _ERRNO_H. */
-#define _ERRNO_H
-#include <bits/errno.h>
-
-ENTRY (sethostid)
- mov ENOSYS, %o0
- sethi %hi(_errno), %g1
- st %o0, [%g1 + %lo(_errno)]
- retl
- sub %g0, 1, %o0
-
-#ifdef HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
-
-#endif
+++ /dev/null
-/* Copyright (C) 1991,1992,1994,1996,1997,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef __GNUC__
- #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'. */
-#define KERNEL
-#define sigvec sun_sigvec
-#define sigstack sun_sigstack
-#define sigcontext sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef sigvec
-#undef sigstack
-#undef sigcontext
-#undef NSIG
-#undef SIGABRT
-#undef SIGCLD
-#undef SV_ONSTACK
-#undef SV_RESETHAND
-#undef SV_INTERRUPT
-#undef SA_ONSTACK
-#undef SA_NOCLDSTOP
-#undef SIG_ERR
-#undef SIG_DFL
-#undef SIG_IGN
-#undef sigmask
-#undef SIG_BLOCK
-#undef SIG_UNBLOCK
-#undef SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S. */
-extern int __raw_sigvec (int sig, CONST struct sigvec *vec,
- struct sigvec *ovec);
-
-/* User-specified signal handlers. */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
- Saves and restores the general regs %g2-%g7, the %y register, and
- all the FPU regs (including %fsr), around calling the user's handler. */
-static void
-trampoline (sig)
- int sig;
-{
- /* We use `double' and `long long int' so `std' (store doubleword) insns,
- which might be faster than single-word stores, will be generated. */
- register double f0 asm("%f0");
- register double f2 asm("%f2");
- register double f4 asm("%f4");
- register double f6 asm("%f6");
- register double f8 asm("%f8");
- register double f10 asm("%f10");
- register double f12 asm("%f12");
- register double f14 asm("%f14");
- register double f16 asm("%f16");
- register double f18 asm("%f18");
- register double f20 asm("%f20");
- register double f22 asm("%f22");
- register double f24 asm("%f24");
- register double f26 asm("%f26");
- register double f28 asm("%f28");
- register double f30 asm("%f30");
- register long long int g2 asm("%g2");
- register long long int g4 asm("%g4");
- register long long int g6 asm("%g6");
- register int *fp asm("%fp");
-
- int code;
- register struct sigcontext *context asm("%i0"); /* See end of fn. */
- void *addr;
- int y;
- double fpsave[16];
- int fsr;
- int savefpu;
- long long int glsave[3];
-
- /* SIG isn't really passed as an arg.
- The args to the signal handler are at fp[16..19]. */
- sig = fp[16];
- code = fp[17];
- context = (struct sigcontext *) fp[18];
- addr = (PTR) fp[19];
-
- /* Save the Y register. */
- asm("rd %%y, %0" : "=r" (y));
-
- /* Save the FPU regs if the FPU enable bit is set in the PSR,
- and the signal isn't an FP exception. */
- savefpu = (context->sc_psr & 0x1000) && sig != SIGFPE;
- if (savefpu)
- {
- fpsave[0] = f0;
- fpsave[1] = f2;
- fpsave[2] = f4;
- fpsave[3] = f6;
- fpsave[4] = f8;
- fpsave[5] = f10;
- fpsave[6] = f12;
- fpsave[7] = f14;
- fpsave[8] = f16;
- fpsave[9] = f18;
- fpsave[10] = f20;
- fpsave[11] = f22;
- fpsave[12] = f24;
- fpsave[13] = f26;
- fpsave[14] = f28;
- fpsave[15] = f30;
-
- /* Force it into a stack slot so the asm won't barf. Sigh. */
- (void) &fsr;
- asm("st %%fsr, %0" : "=m" (fsr));
- }
-
- /* Save the global registers (except for %g1, which is a scratch reg). */
- glsave[0] = g2;
- glsave[1] = g4;
- glsave[2] = g6;
-
- /* Call the user's handler. */
- (*((void (*) (int sig, int code, struct sigcontext *context,
- void *addr)) handlers[sig]))
- (sig, code, context, addr);
-
- /* Restore the Y register. */
- asm("mov %0, %%y" : : "r" (y));
-
- if (savefpu)
- {
- /* Restore the FPU regs. */
- f0 = fpsave[0];
- f2 = fpsave[1];
- f4 = fpsave[2];
- f6 = fpsave[3];
- f8 = fpsave[4];
- f10 = fpsave[5];
- f12 = fpsave[6];
- f14 = fpsave[7];
- f16 = fpsave[8];
- f18 = fpsave[9];
- f20 = fpsave[10];
- f22 = fpsave[11];
- f24 = fpsave[12];
- f26 = fpsave[13];
- f28 = fpsave[14];
- f30 = fpsave[15];
-
- asm("ld %0, %%fsr" : : "m" (fsr));
- }
-
- /* Restore the globals. */
- g2 = glsave[0];
- g4 = glsave[1];
- g6 = glsave[2];
-
- /* Unwind a frame, and do a "sigcleanup" system call.
- The system call apparently does a return.
- I don't know what it's for. Ask Sun. */
- asm("restore %%g0, 139, %%g1\n"
- "ta 0\n"
- "! this should be i0: %0" /* Useless insn that will never be executed, */
- /* here to make the compiler happy. */
- : /* No outputs. */ :
- /* CONTEXT is bound to %i0. We reference it as an input here to make
- sure the compiler considers it live at this point, and preserves
- the value in that register. The restore makes %i0 become %o0, the
- argument to the system call. */
- "r" (context));
-}
-#endif
-
-int
-__sigvec (sig, vec, ovec)
- int sig;
- const struct sigvec *vec;
- struct sigvec *ovec;
-{
-#ifndef mytramp
- extern void _sigtramp (int);
-#define trampoline _sigtramp
-#endif
- struct sigvec myvec;
- int mask;
- __sighandler_t ohandler;
-
- if (sig <= 0 || sig >= NSIG)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- mask = __sigblock (sigmask(sig));
-
- ohandler = handlers[sig];
-
- if (vec != NULL &&
- vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
- {
- handlers[sig] = vec->sv_handler;
- myvec = *vec;
- myvec.sv_handler = trampoline;
- vec = &myvec;
- }
-
- if (__raw_sigvec(sig, vec, ovec) < 0)
- {
- int save = errno;
- (void) __sigsetmask(mask);
- errno = save;
- return -1;
- }
-
- if (ovec != NULL && ovec->sv_handler == trampoline)
- ovec->sv_handler = ohandler;
-
- (void) __sigsetmask (mask);
-
- return 0;
-}
+++ /dev/null
-*.gz *.Z *.tar *.tgz
-=*
-TODO COPYING* AUTHORS copyr-* copying.*
-glibc-*
+++ /dev/null
-# SunOS 4 has the canonical set of <sys/mman.h> system calls.
-unix/mman
+++ /dev/null
-ifeq ($(subdir),posix)
-sysdep_routines := $(sysdep_routines) sys_wait4
-endif
-
-ifeq ($(subdir),misc)
-sysdep_routines := $(sysdep_routines) sys_mmap
-endif
+++ /dev/null
-/* O_*, F_*, FD_* bit values for SunOS 4.
- Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'. */
-#define O_RDONLY 0 /* Open read-only. */
-#define O_WRONLY 1 /* Open write-only. */
-#define O_RDWR 2 /* Open read/write. */
-
-
-/* Bits OR'd into the second argument to open. */
-#define O_CREAT 0x0200 /* Create file if it doesn't exist. */
-#define O_EXCL 0x0800 /* Fail if file already exists. */
-#define O_TRUNC 0x0400 /* Truncate file to zero length. */
-#define O_NOCTTY 0x8000 /* Don't assign a controlling terminal. */
-#if defined __USE_BSD || defined __USE_SVID
-#define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
-#define O_FSYNC 0x2000 /* Synchronous writes. */
-#define O_SYNC O_FSYNC
-#endif
-
-/* File status flags for `open' and `fcntl'. */
-#define O_APPEND 0x0008 /* Writes append to the file. */
-#define O_NONBLOCK 0x4000 /* Non-blocking I/O. */
-
-/* Sun defines O_NDELAY one way for BSD behavior and another for System V
- behavior. In the GNU C library, you get the BSD behavior unless you
- define _USG_SOURCE without also defining _BSD_SOURCE or _GNU_SOURCE. */
-#ifdef __USE_BSD
-#define O_NDELAY 0x0004
-#endif
-#if !defined (O_NDELAY) && defined (__USE_SVID)
-#define O_NDELAY 0x1000
-#endif
-
-#ifdef __USE_BSD
-/* Bits in the file status flags returned by F_GETFL.
- These are all the O_* flags, plus FREAD and FWRITE, which are
- independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
- given to `open'. */
-#define FREAD 1
-#define FWRITE 2
-
-/* Traditional Unix names the O_* bits. */
-#define FASYNC O_ASYNC
-#define FCREAT O_CREAT
-#define FEXCL O_EXCL
-#define FTRUNC O_TRUNC
-#define FNOCTTY O_NOCTTY
-#define FFSYNC O_FSYNC
-#define FSYNC O_SYNC
-#define FAPPEND O_APPEND
-#define FNONBLOCK O_NONBLOCK
-#define FNONBIO O_NONBLOCK
-#define FNDELAY 0x0004 /* BSD O_NDELAY. */
-#define FNBIO 0x1000 /* System V O_NDELAY. */
-#endif
-
-/* Mask for file access modes. This is system-dependent in case
- some system ever wants to define some other flavor of access. */
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#if defined __USE_BSD || defined __USE_UNIX98
-#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
-#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
-#endif
-#define F_GETLK 7 /* Get record locking info. */
-#define F_SETLK 8 /* Set record locking info (non-blocking). */
-#define F_SETLKW 9 /* Set record locking info (blocking). */
-#ifdef __USE_BSD
-#define F_RGETLK 10 /* Get remote record locking info. */
-#define F_RSETLK 11 /* Set remote locking info (non-blocking). */
-#define F_CNVT 12 /* Convert a fhandle to an open fd. */
-#define F_RSETLKW 13 /* Set remote locking info (blocking). */
-#endif
-
-/* File descriptor flags used with F_GETFD and F_SETFD. */
-#define FD_CLOEXEC 1 /* Close on exec. */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock. This is the type of the third
- argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
-struct flock
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
- __off_t l_start; /* Offset where the lock begins. */
- __off_t l_len; /* Size of the locked area; zero means until EOF. */
- short int l_pid; /* Process holding the lock. */
- short int l_xxx; /* Reserved for future use. */
- };
-
-#ifdef __USE_BSD
-/* The structure describing a remote advisory lock. This is the type of the
- third arg to `fcntl' for the F_RGETLK, F_RSETLK, and F_RSETLKW requests. */
-struct eflock
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
- __off_t l_start; /* Offset where the lock begins. */
- __off_t l_len; /* Size of the locked area; zero means until EOF. */
- short int l_pid; /* Process holding the lock. */
- short int l_xxx; /* Reserved for future use. */
- long int l_rpid; /* Remote process ID wanting this lock. */
- long int l_rsys; /* Remote system ID wanting this lock. */
- };
-
-#endif
-
-
-/* Values for the `l_type' field of a `struct flock'. */
-#define F_RDLCK 1 /* Read lock. */
-#define F_WRLCK 2 /* Write lock. */
-#define F_UNLCK 3 /* Remove lock. */
+++ /dev/null
-/* Definitions for BSD-style memory management. SunOS 4 version.
- Copyright (C) 1994, 1995, 1996, 1997, 1998 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 _BITS_MMAN_H
-#define _BITS_MMAN_H 1
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_NONE 0x00 /* No access. */
-#define PROT_READ 0x01 /* Pages can be read. */
-#define PROT_WRITE 0x02 /* Pages can be written. */
-#define PROT_EXEC 0x04 /* Pages can be executed. */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes private; copy pages on write. */
-#ifdef __USE_BSD
-# define MAP_TYPE 0x0f /* Mask for sharing type. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Map address must be exactly as requested. */
-/* The following three flags are not actually implemented in SunOS 4.1. */
-#ifdef __USE_BSD
-# define MAP_RENAME 0x20 /* Rename private pages to file. */
-# define MAP_NORESERVE 0x40 /* Don't reserve needed swap area. */
-# define MAP_INHERIT 0x80 /* Region is retained after exec. */
-#endif
-
-/* This is an internal flag that is always set in `mmap' system calls. In
- older versions of SunOS 4 `mmap' did not return the actual mapping
- address, but always returned zero. This flag says to return the
- address; the `mmap' C library function always sets it. */
-#define _MAP_NEW 0x80000000
-
-/* Advice to `madvise'. */
-#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-#endif
-
-/* Flags to `msync'. */
-#define MS_ASYNC 0x1 /* Return immediately, don't fsync. */
-#define MS_INVALIDATE 0x2 /* Invalidate caches. */
-
-#endif /* bits/mman.h */
+++ /dev/null
-/* Bit values for resource limits. SunOS 4 version.
- Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-/* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a
- subset of these kinds of resource limit. In systems where `getrlimit'
- and `setrlimit' are not system calls, these are the values used by the C
- library to emulate them. */
-
-#include <bits/types.h>
-
-/* Kinds of resource limit. */
-enum __rlimit_resource
- {
- /* Per-process CPU limit, in seconds. */
- RLIMIT_CPU,
-#define RLIMIT_CPU RLIMIT_CPU
- /* Largest file that can be created, in bytes. */
- RLIMIT_FSIZE,
-#define RLIMIT_FSIZE RLIMIT_FSIZE
- /* Maximum size of data segment, in bytes. */
- RLIMIT_DATA,
-#define RLIMIT_DATA RLIMIT_DATA
- /* Maximum size of stack segment, in bytes. */
- RLIMIT_STACK,
-#define RLIMIT_STACK RLIMIT_STACK
- /* Largest core file that can be created, in bytes. */
- RLIMIT_CORE,
-#define RLIMIT_CORE RLIMIT_CORE
- /* Largest resident set size, in bytes.
- This affects swapping; processes that are exceeding their
- resident set size will be more likely to have physical memory
- taken from them. */
- RLIMIT_RSS,
-#define RLIMIT_RSS RLIMIT_RSS
- /* Number of open files. */
- RLIMIT_NOFILE,
- RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
-#define RLIMIT_NOFILE RLIMIT_NOFILE
-#define RLIMIT_OFILE RLIMIT_OFILE
-
- RLIM_NLIMITS
- };
-
-/* Value to indicate that there is no limit. */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY 0x7fffffff
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-
-/* Type to represent quantities in resource limits. */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-
-struct rlimit
- {
- /* The current (soft) limit. */
- rlim_t rlim_cur;
- /* The hard limit. */
- rlim_t rlim_max;
- };
-
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-
-struct rlimit64
- {
- /* The current (soft) limit. */
- rlim64_t rlim_cur;
- /* The hard limit. */
- rlim64_t rlim_max;
- };
-#endif
-
-/* Whose usage statistics do you want? */
-enum __rusage_who
-/* The macro definitions are necessary because some programs want
- to test for operating system features with #ifdef RUSAGE_SELF.
- In ISO C the reflexive definition is a no-op. */
- {
- /* The calling process. */
- RUSAGE_SELF = 0,
-#define RUSAGE_SELF RUSAGE_SELF
- /* All of its terminated child processes. */
- RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
- };
-
-#define __need_timeval
-#include <bits/time.h> /* For `struct timeval'. */
-
-/* Structure which says how much of each resource has been used. */
-struct rusage
- {
- /* Total amount of user time used. */
- struct timeval ru_utime;
- /* Total amount of system time used. */
- struct timeval ru_stime;
- /* Maximum resident set size (in kilobytes). */
- long int ru_maxrss;
- /* Amount of sharing of text segment memory
- with other processes (kilobyte-seconds). */
- long int ru_ixrss;
- /* Amount of data segment memory used (kilobyte-seconds). */
- long int ru_idrss;
- /* Amount of stack memory used (kilobyte-seconds). */
- long int ru_isrss;
- /* Number of soft page faults (i.e. those serviced by reclaiming
- a page from the list of pages awaiting reallocation. */
- long int ru_minflt;
- /* Number of hard page faults (i.e. those that required I/O). */
- long int ru_majflt;
- /* Number of times a process was swapped out of physical memory. */
- long int ru_nswap;
- /* Number of input operations via the file system. Note: This
- and `ru_oublock' do not include operations with the cache. */
- long int ru_inblock;
- /* Number of output operations via the file system. */
- long int ru_oublock;
- /* Number of IPC messages sent. */
- long int ru_msgsnd;
- /* Number of IPC messages received. */
- long int ru_msgrcv;
- /* Number of signals delivered. */
- long int ru_nsignals;
- /* Number of voluntary context switches, i.e. because the process
- gave up the process before it had to (usually to wait for some
- resource to be available). */
- long int ru_nvcsw;
- /* Number of involuntary context switches, i.e. a higher priority process
- became runnable or the current process used up its time slice. */
- long int ru_nivcsw;
- };
-
-/* Priority limits. */
-#define PRIO_MIN -20 /* Minimum priority a process can have. */
-#define PRIO_MAX 20 /* Maximum priority a process can have. */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
- indicating what flavor of entity the WHO argument specifies. */
-enum __priority_which
- {
- PRIO_PROCESS = 0, /* WHO is a process ID. */
- PRIO_PGRP = 1, /* WHO is a process group ID. */
- PRIO_USER = 2 /* WHO is a user ID. */
- };
+++ /dev/null
-/* termios type and macro definitions. SunOS 4 version.
- Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-/* Type of terminal control flag masks. */
-typedef unsigned long int tcflag_t;
-
-/* Type of control characters. */
-typedef unsigned char cc_t;
-
-/* Type of baud rate specifiers. */
-typedef unsigned int speed_t;
-
-/* Terminal control structure. */
-struct termios
-{
- /* Input modes. */
- tcflag_t c_iflag;
-#define IGNBRK 0x0001 /* Ignore break condition. */
-#define BRKINT 0x0002 /* Signal interrupt on break. */
-#define IGNPAR 0x0004 /* Ignore characters with parity errors. */
-#define PARMRK 0x0008 /* Mark parity and framing errors. */
-#define INPCK 0x0010 /* Enable input parity check. */
-#define ISTRIP 0x0020 /* Strip 8th bit off characters. */
-#define INLCR 0x0040 /* Map NL to CR on input. */
-#define IGNCR 0x0080 /* Ignore CR. */
-#define ICRNL 0x0100 /* Map CR to NL on input. */
-#ifdef __USE_BSD
-# define IUCLC 0x0200 /* Map upper case to lower case on input. */
-#endif
-#define IXON 0x0400 /* Enable start/stop output control. */
-#define IXOFF 0x1000 /* Enable start/stop input control. */
-#ifdef __USE_BSD
-# define IXANY 0x0800 /* Any character will restart after stop. */
-# define IMAXBEL 0x2000 /* Ring bell when input queue is full. */
-#endif
-
- /* Output modes. */
- tcflag_t c_oflag;
-#define OPOST 0x0001 /* Perform output processing. */
-#ifdef __USE_BSD
-# define OLCUC 0x00000002 /* Map lower case to upper case on output. */
-# define ONLCR 0x00000004 /* Map NL to CR-NL on output. */
-# define OCRNL 0x00000008
-# define ONOCR 0x00000010
-# define ONLRET 0x00000020
-# define OFILL 0x00000040
-# define OFDEL 0x00000080
-# define NLDLY 0x00000100
-# define NL0 0
-# define NL1 0x00000100
-# define CRDLY 0x00000600
-# define CR0 0
-# define CR1 0x00000200
-# define CR2 0x00000400
-# define CR3 0x00000600
-# define TABDLY 0x00001800
-# define TAB0 0
-# define TAB1 0x00000800
-# define TAB2 0x00001000
-# define XTABS 0x00001800
-# define TAB3 XTABS
-# define BSDLY 0x00002000
-# define BS0 0
-# define BS1 0x00002000
-# define VTDLY 0x00004000
-# define VT0 0
-# define VT1 0x00004000
-# define FFDLY 0x00008000
-# define FF0 0
-# define FF1 0x00008000
-# define PAGEOUT 0x00010000
-# define WRAP 0x00020000
-#endif
-
- /* Control modes. */
- tcflag_t c_cflag;
-#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */
-#define CS5 0 /* 5 bits per byte. */
-#define CS6 0x00000010 /* 6 bits per byte. */
-#define CS7 0x00000020 /* 7 bits per byte. */
-#define CS8 0x00000030 /* 8 bits per byte. */
-#define CSTOPB 0x00000040 /* Two stop bits instead of one. */
-#define CREAD 0x00000080 /* Enable receiver. */
-#define PARENB 0x00000100 /* Parity enable. */
-#define PARODD 0x00000200 /* Odd parity instead of even. */
-#define HUPCL 0x00000400 /* Hang up on last close. */
-#define CLOCAL 0x00000800 /* Ignore modem status lines. */
-#ifdef __USE_BSD
-# define LOBLK 0x00001000
-# define CRTSCTS 0x80000000
-# define CIBAUD 0x000f0000 /* Mask for input speed from c_cflag. */
-# define CBAUD 0x0000000f /* Mask for output speed from c_cflag. */
-# define IBSHIFT 16 /* Bits to shift for input speed. */
-#endif
-
- /* Input and output baud rates. These are encoded in c_cflag. */
-#define B0 0
-#define B50 1
-#define B75 2
-#define B110 3
-#define B134 4
-#define B150 5
-#define B200 6
-#define B300 7
-#define B600 8
-#define B1200 9
-#define B1800 10
-#define B2400 11
-#define B4800 12
-#define B9600 13
-#define B19200 14
-#define B38400 15
-#ifdef __USE_BSD
-# define EXTA 14
-# define EXTB 15
-#endif
-
- /* Local modes. */
- tcflag_t c_lflag;
-#ifdef __USE_BSD
-# define ECHOKE 0x00000800 /* Visual erase for KILL. */
-#endif
-#define ECHOE 0x00000010 /* Visual erase for ERASE. */
-#define ECHOK 0x00000020 /* Echo NL after KILL. */
-#define ECHO 0x00000008 /* Enable echo. */
-#define ECHONL 0x00000040 /* Echo NL even if ECHO is off. */
-#ifdef __USE_BSD
-# define ECHOPRT 0x00000400 /* Hardcopy visual erase. */
-# define ECHOCTL 0x00000200 /* Echo control characters as ^X. */
-#endif
-#define ISIG 0x00000001 /* Enable signals. */
-#define ICANON 0x00000002 /* Do erase and kill processing. */
-#define IEXTEN 0x00008000 /* Enable DISCARD and LNEXT. */
-#define TOSTOP 0x00000100 /* Send SIGTTOU for background output. */
-#ifdef __USE_BSD
-# define PENDIN 0x00004000 /* Retype pending input (state). */
-#endif
-#define NOFLSH 0x00000080 /* Disable flush after interrupt. */
-
- char c_line; /* Line discipline (?) */
-
- /* Control characters. */
-#define VEOF 4 /* End-of-file character [ICANON]. */
-#define VEOL 5 /* End-of-line character [ICANON]. */
-#ifdef __USE_BSD
-# define VEOL2 6 /* Second EOL character [ICANON]. */
-# define VSWTCH 7 /* ??? */
-#endif
-#define VERASE 2 /* Erase character [ICANON]. */
-#ifdef __USE_BSD
-# define VWERASE 14 /* Word-erase character [ICANON]. */
-#endif
-#define VKILL 3 /* Kill-line character [ICANON]. */
-#ifdef __USE_BSD
-# define VREPRINT 12 /* Reprint-line character [ICANON]. */
-#endif
-#define VINTR 0 /* Interrupt character [ISIG]. */
-#define VQUIT 1 /* Quit character [ISIG]. */
-#define VSUSP 10 /* Suspend character [ISIG]. */
-#ifdef __USE_BSD
-# define VDSUSP 11 /* Delayed suspend character [ISIG]. */
-#endif
-#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
-#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
-#ifdef __USE_BSD
-# define VLNEXT 15 /* Literal-next character [IEXTEN]. */
-# define VDISCARD 13 /* Discard character [IEXTEN]. */
-#endif
-#define VMIN VEOF /* Minimum number of bytes read at once [!ICANON]. */
-#define VTIME VEOL /* Time-out value (tenths of a second) [!ICANON]. */
-#define NCCS 17
- cc_t c_cc[NCCS];
-};
-
-#define _IOT_termios /* Hurd ioctl type field. */ \
- _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
-#define TCSANOW 0 /* Change immediately. */
-#define TCSADRAIN 1 /* Change when pending output is written. */
-#define TCSAFLUSH 2 /* Flush pending input before changing. */
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
-#define TCIFLUSH 0 /* Discard data received but not yet read. */
-#define TCOFLUSH 1 /* Discard data written but not yet sent. */
-#define TCIOFLUSH 2 /* Discard all pending data. */
-
-/* Values for the ACTION argument to `tcflow'. */
-#define TCOOFF 0 /* Suspend output. */
-#define TCOON 1 /* Restart suspended output. */
-#define TCIOFF 2 /* Send a STOP character. */
-#define TCION 3 /* Send a START character. */
+++ /dev/null
-/* Copyright (C) 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _SYS_UTSNAME_H
-# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
-#endif
-
-#define _UTSNAME_LENGTH 9
-#define _UTSNAME_NODENAME_LENGTH 65
+++ /dev/null
-/* Copyright (C) 1994, 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. */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes. from
- OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
- is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
- set in FLAGS, the mapping will be at ADDR exactly (which must be
- page-aligned); otherwise the system chooses a convenient nearby address.
- The return value is the actual mapping address chosen or MAP_FAILED
- for errors (in which case `errno' is set). A successful `mmap' call
- deallocates any previous mapping for the affected region. */
-
-extern __ptr_t __mmap_syscall (__ptr_t addr, size_t len,
- int prot, int flags, int fd, off_t offset);
-
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
- return __mmap_syscall (addr, len, prot, flags | _MAP_NEW, fd, offset);
-}
-
-weak_alias (__mmap, mmap)
+++ /dev/null
-/* `struct termios' speed frobnication functions. SunOS 4 version.
- Copyright (C) 1991,1992,1993,1996,1997,2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stddef.h>
-#include <errno.h>
-#include <termios.h>
-
-static const speed_t speeds[] =
- {
- 0,
- 50,
- 75,
- 110,
- 134,
- 150,
- 200,
- 300,
- 600,
- 1200,
- 1800,
- 2400,
- 4800,
- 9600,
- 19200,
- 38400,
- };
-
-
-/* Return the output baud rate stored in *TERMIOS_P. */
-speed_t
-cfgetospeed (termios_p)
- const struct termios *termios_p;
-{
- return termios_p->c_cflag & CBAUD;
-}
-
-/* Return the input baud rate stored in *TERMIOS_P. */
-speed_t
-cfgetispeed (termios_p)
- const struct termios *termios_p;
-{
- return (termios_p->c_cflag & CIBAUD) >> IBSHIFT;
-}
-
-/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
-int
-cfsetospeed (termios_p, speed)
- struct termios *termios_p;
- speed_t speed;
-{
- register unsigned int i;
-
- if (termios_p == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- /* This allows either B1200 or 1200 to work. XXX
- Do we really want to try to support this, given that
- fetching the speed must return one or the other? */
-
- for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
- if (i == speed || speeds[i] == speed)
- {
- termios_p->c_cflag &= ~CBAUD;
- termios_p->c_cflag |= i;
- return 0;
- }
-
- __set_errno (EINVAL);
- return -1;
-}
-libc_hidden_def (cfsetospeed)
-
-/* Set the input baud rate stored in *TERMIOS_P to SPEED. */
-int
-cfsetispeed (termios_p, speed)
- struct termios *termios_p;
- speed_t speed;
-{
- register unsigned int i;
-
- if (termios_p == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- /* See comment in cfsetospeed (above). */
- for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
- if (i == speed || speeds[i] == speed)
- {
- termios_p->c_cflag &= ~CIBAUD;
- termios_p->c_cflag |= i << IBSHIFT;
- return 0;
- }
-
- __set_errno (EINVAL);
- return -1;
-}
-libc_hidden_def (cfsetispeed)
+++ /dev/null
-/*-
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
- */
-
-/*
- * System wide defaults for terminal state. SunOS 4 version.
- */
-#ifndef _SYS_TTYDEFAULTS_H_
-#define _SYS_TTYDEFAULTS_H_
-
-/*
- * Defaults on "first" open.
- */
-#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
-#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
-#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
-#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
-#define TTYDEF_SPEED (B9600)
-
-/*
- * Control Character Defaults
- */
-#define CTRL(x) (x&037)
-#define CEOF CTRL('d')
-#ifdef _POSIX_VDISABLE
-# define CEOL _POSIX_VDISABLE
-#else
-# define CEOL ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
-#endif
-#define CERASE 0177
-#define CINTR CTRL('c')
-#ifdef _POSIX_VDISABLE
-# define CSTATUS _POSIX_VDISABLE
-#else
-# define CSTATUS ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
-#endif
-#define CKILL CTRL('u')
-#define CMIN 1
-#define CQUIT 034 /* FS, ^\ */
-#define CSUSP CTRL('z')
-#define CTIME 0
-#define CDSUSP CTRL('y')
-#define CSTART CTRL('q')
-#define CSTOP CTRL('s')
-#define CLNEXT CTRL('v')
-#define CDISCARD CTRL('o')
-#define CWERASE CTRL('w')
-#define CREPRINT CTRL('r')
-#define CEOT CEOF
-/* compat */
-#define CBRK CEOL
-#define CRPRNT CREPRINT
-#define CFLUSH CDISCARD
-
-/* PROTECTED INCLUSION ENDS HERE */
-#endif /* !_SYS_TTYDEFAULTS_H_ */
-
-/*
- * #define TTYDEFCHARS to include an array of default control characters.
- */
-#ifdef TTYDEFCHARS
-cc_t ttydefchars[NCCS] = {
- CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
- _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
- CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE
-};
-#undef TTYDEFCHARS
-#endif
+++ /dev/null
-# File name Caller Syscall name # args Strong name Weak names
-
-msync - msync 3 msync
-poll - poll 3 poll
-sys_mmap mmap mmap 5 __mmap_syscall
-sys_wait4 wait4 wait4 4 __wait4_syscall
+++ /dev/null
-/* SunOS 4 does have `waitpid'. Avoid unix/system.c, which says we don't. */
-#include <sysdeps/posix/system.c>
+++ /dev/null
-/* Copyright (C) 1993, 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. */
-
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/termio.h> /* Sun header file. */
-
-/* Send zero bits on FD. */
-int
-tcsendbreak (fd, duration)
- int fd;
- int duration;
-{
- /* According to SunOS 4.1's termios(4), you can't specify a duration. */
- return __ioctl (fd, TCSBRK, 0);
-}
+++ /dev/null
-#include <sysdeps/unix/bsd/bsd4.4/wait.c>
+++ /dev/null
-#include <sysdeps/unix/bsd/bsd4.4/wait3.c>
+++ /dev/null
-/* This implements wait4 with the 4.4 BSD semantics (also those documented in
- SunOS 4.1) on top of SunOS's wait4 system call, which has semantics
- different from those documented. Go Sun!
- Copyright (C) 1991,1992,1993,1995,1997,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-extern pid_t __wait4_syscall (pid_t pid, __WAIT_STATUS_DEFN stat_loc,
- int options, struct rusage *usage);
-
-pid_t
-__wait4 (pid, stat_loc, options, usage)
- pid_t pid;
- __WAIT_STATUS_DEFN stat_loc;
- int options;
- struct rusage *usage;
-{
- switch (pid)
- {
- case WAIT_ANY:
- pid = 0;
- break;
-
- case WAIT_MYPGRP:
- pid = - getpgrp ();
- break;
- }
-
- return __wait4_syscall (pid, stat_loc, options, usage);
-}
-
-weak_alias (__wait4, wait4)
+++ /dev/null
-#include <sysdeps/unix/bsd/bsd4.4/waitpid.c>
+++ /dev/null
-# File name Caller Syscall name # args Strong name Weak names
-
-sigvec - sigvec 3 __raw_sigvec
-/* Copyright (C) 1991, 92, 94, 96, 97, 98, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-1998,2001,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
#include <unistd.h>
#include <sys/resource.h>
-#ifndef HAVE_GNU_LD
-#define _etext etext
-#endif
extern int _etext;
-/* Copyright (C) 1991,92,93,95,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,97,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
.data
.globl C_SYMBOL_NAME(__curbrk)
C_LABEL(__curbrk)
-#ifdef HAVE_GNU_LD
.long C_SYMBOL_NAME(_end)
-#else
- .long C_SYMBOL_NAME(end)
-#endif
.text
SYSCALL__ (brk, 1)
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 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
#endif
#endif
END(__syscall_error)
-
-weak_alias (__syscall_error, syscall_error)
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 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
.data
.global C_SYMBOL_NAME(__curbrk)
C_LABEL(__curbrk)
-#ifdef HAVE_GNU_LD
.long C_SYMBOL_NAME(_end)
-#else
- .long C_SYMBOL_NAME(end)
-#endif
.text
ENTRY (__brk)
--- /dev/null
+/* 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. */
+
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <xstatconv.h>
+
+#undef __fxstatat64
+
+
+/* Get information about the file NAME in BUF. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ INTERNAL_SYSCALL_DECL (err);
+ int result, errno_out;
+ struct kernel_stat kst;
+
+ if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+ {
+ if (flags & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+ if (errno_out != ENOSYS)
+ goto fail;
+ __libc_missing_axp_stat64 = 1;
+ }
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kst, st);
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+
+ fail:
+ __atfct_seterrno (errno_out, fd, buf);
+
+ return -1;
+}
+hidden_def (__xstat)
+weak_alias (__xstat, _xstat);
+strong_alias (__xstat, __xstat64);
+hidden_ver (__xstat, __xstat64)
/* Device numbers of devices used in the implementation. Linux version.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 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
#define DEV_NULL_MAJOR 1
#define DEV_NULL_MINOR 3
+/* /dev/full is (1,7). */
+#define DEV_FULL_MAJOR 1
+#define DEV_FULL_MINOR 7
+
/* Pseudo tty slaves. For Linux we use the Unix98 ttys. We could
also include the old BSD-style tty buts they should not be used and
the extra test would only slow down correctly set up systems. If a
--- /dev/null
+/* 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 <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Change the owner and group of FILE. */
+int
+fchownat (fd, file, owner, group, flag)
+ int fd;
+ const char *file;
+ uid_t owner;
+ gid_t group;
+ int flag;
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+ else
+ result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+ return result;
+}
--- /dev/null
+/* 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 <stdio.h>
+#include <utime.h>
+#include <sys/time.h>
+#include <sysdep.h>
+#include "kernel-features.h"
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+futimesat (fd, file, tvp)
+ int fd;
+ const char *file;
+ const struct timeval tvp[2];
+{
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#ifdef __NR_utimes
+ result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+
+# ifndef __ASSUME_UTIMES
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+# endif
+#endif
+
+ /* The utimes() syscall does not exist or is not available in the
+ used kernel. Use utime(). For this we have to convert to the
+ data format utime() expects. */
+#ifndef __ASSUME_UTIMES
+ struct utimbuf tmp;
+ struct utimbuf *times;
+
+ if (tvp != NULL)
+ {
+ times = &tmp;
+ tmp.actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000;
+ tmp.modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000;
+ }
+ else
+ times = NULL;
+
+ result = INTERNAL_SYSCALL (utime, err, 2, file, times);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+
+ fail:
+#endif
+
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+ return -1;
+}
--- /dev/null
+/* 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. */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+ will complain since they don't strictly match. */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file NAME in BUF. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+ if (vers == _STAT_VER_KERNEL)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+ CHECK_1 ((struct kernel_stat *) st));
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+ CHECK_1 ((struct kernel_stat *) st));
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ }
+
+#ifdef STAT_IS_KERNEL_STAT
+ __set_errno (EINVAL);
+ return -1;
+#else
+ struct kernel_stat kst;
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kst, st);
+#endif
+
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+ return -1;
+}
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+#endif
--- /dev/null
+/* 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 <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+#if __ASSUME_STAT64_SYSCALL == 0
+# include <xstatconv.h>
+#endif
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls.
+ This is the definition. */
+extern int __have_no_stat64;
+# endif
+#endif
+
+/* Get information about the file NAME in BUF. */
+
+int
+__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+ CHECK_1 (st));
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+ CHECK_1 (st));
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ {
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (st->__st_ino != (__ino_t) st->st_ino)
+ st->st_ino = st->__st_ino;
+# endif
+ return result;
+ }
+#else
+ struct kernel_stat kst;
+# if defined __NR_stat64
+ if (! __have_no_stat64)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+ CHECK_1 (st));
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+ CHECK_1 (st));
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ {
+# if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+ if (st->__st_ino != (__ino_t) st->st_ino)
+ st->st_ino = st->__st_ino;
+# endif
+ return result;
+ }
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __have_no_stat64 = 1;
+ }
+# endif
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat64_conv (vers, &kst, st);
+
+ fail:
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+ return -1;
+#endif
+}
--- /dev/null
+/* 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>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <shlib-compat.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+/*
+ In Linux 2.1.x the chown functions have been changed. A new function lchown
+ was introduced. The new chown now follows symlinks - the old chown and the
+ new lchown do not follow symlinks.
+ The new lchown function has the same number as the old chown had and the
+ new chown has a new number. When compiling with headers from Linux > 2.1.8x
+ it's impossible to run this libc with older kernels. In these cases libc
+ has therefore to route calls to chown to the old chown function.
+*/
+
+extern int __chown_is_lchown (const char *__file, uid_t __owner,
+ gid_t __group);
+extern int __real_chown (const char *__file, uid_t __owner, gid_t __group);
+
+
+#if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0
+/* Running under Linux > 2.1.80. */
+
+# ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_chown32 */
+#endif
+
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0
+# if __ASSUME_LCHOWN_SYSCALL == 0
+ static int __libc_old_chown;
+
+# ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file),
+ owner, group);
+ else
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file),
+ owner, group);
+
+ if (!INTERNAL_SYSCALL_ERROR_P (result, err))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
+
+ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (!__libc_old_chown && (flag & AT_SYMLINK_NOFOLLOW) == 0)
+ {
+ result = INTERNAL_SYSCALL (chown, err, 3, CHECK_STRING (file), owner,
+ group);
+
+ if (!INTERNAL_SYSCALL_ERROR_P (result, err))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_old_chown = 1;
+ }
+
+ result = INTERNAL_SYSCALL (lchown, err, 3, CHECK_STRING (file), owner,
+ group);
+# elif __ASSUME_32BITUIDS
+ /* This implies __ASSUME_LCHOWN_SYSCALL. */
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+ group);
+# else
+ /* !__ASSUME_32BITUIDS && ASSUME_LCHOWN_SYSCALL */
+# ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+ group);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
+ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ result = INTERNAL_SYSCALL (chown, err, 3, CHECK_STRING (file), owner, group);
+# endif
+#else
+ result = INTERNAL_SYSCALL (chown, err, 3, CHECK_STRING (file), owner, group);
+#endif
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+ fail:
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+/* 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. */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+ will complain since they don't strictly match. */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include "kernel-features.h"
+
+#include <xstatconv.h>
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls. */
+extern int __have_no_stat64;
+# endif
+#endif
+
+
+/* Get information about the file NAME relative to FD in ST. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+#if __ASSUME_STAT64_SYSCALL == 0
+ struct kernel_stat kst;
+#endif
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+ if (vers == _STAT_VER_KERNEL)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+ CHECK_1 ((struct kernel_stat *) st));
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+ CHECK_1 ((struct kernel_stat *) st));
+ goto out;
+ }
+
+#if __ASSUME_STAT64_SYSCALL > 0
+ struct stat64 st64;
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+ __ptrvalue (&st64));
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+ __ptrvalue (&st64));
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat32_conv (vers, &st64, st);
+#else
+# if defined __NR_stat64
+ /* To support 32 bit UIDs, we have to use stat64. The normal stat
+ call only returns 16 bit UIDs. */
+ if (! __have_no_stat64)
+ {
+ struct stat64 st64;
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+ __ptrvalue (&st64));
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+ __ptrvalue (&st64));
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ result = __xstat32_conv (vers, &st64, st);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+ || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto out;
+
+ __have_no_stat64 = 1;
+ }
+# endif
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+ else
+ result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+ __ptrvalue (&kst));
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return __xstat_conv (vers, &kst, st);
+#endif /* __ASSUME_STAT64_SYSCALL */
+
+ out:
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+ return result;
+}
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+#endif
--- /dev/null
+/* 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>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+#ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#if __ASSUME_32BITUIDS > 0
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file), owner,
+ group);
+ else
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+ group);
+#else
+# ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file),
+ owner, group);
+ else
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+ group);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
+
+ if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown, err, 3, CHECK_STRING (file), owner,
+ group);
+ else
+ result = INTERNAL_SYSCALL (chown, err, 3, CHECK_STRING (file), owner,
+ group);
+#endif
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+ fail:
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
--- /dev/null
+/* 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 <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sysdep-cancel.h>
+
+
+#ifndef OPENAT
+# define OPENAT openat
+# define MORE_OFLAGS 0
+
+
+void
+attribute_hidden
+__atfct_seterrno (int errval, int fd, const char *buf)
+{
+ if (buf != NULL && errval == ENOTDIR)
+ {
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ struct stat64 st;
+ if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+ /* errno is already set correctly. */
+ return;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+
+ __set_errno (errval);
+}
+#endif
+
+/* 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;
+{
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ mode_t mode = 0;
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
+ }
+
+ INTERNAL_SYSCALL_DECL (err);
+ int res;
+
+ if (SINGLE_THREAD_P)
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+ else
+ {
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ res = INTERNAL_SYSCALL (open, err, 3, file, oflag | MORE_OFLAGS, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+ }
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ {
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+ res = -1;
+ }
+
+ return res;
+}
--- /dev/null
+#define OPENAT openat64
+#define MORE_OFLAGS O_LARGEFILE
+
+#include "openat.c"
/* chown() compatibility.
- Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 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
#include <sysdep.h>
#include <stdlib.h>
+#include <kernel-features.h>
+
/*
In Linux 2.1.x the chown functions have been changed. A new function lchown
was introduced. The new chown now follows symlinks - the old chown and the
int
__chown (const char *file, uid_t owner, gid_t group)
{
- int err;
- int old_errno;
- char link[PATH_MAX+2];
- char path[2*PATH_MAX+4];
- int loopct;
- size_t filelen;
- static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
-
- if (libc_old_chown == 1)
- return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
-
- old_errno = errno;
-
-#ifdef __NR_lchown
- if (libc_old_chown == 0)
- {
- err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
- if (err != -1 || errno != ENOSYS)
- {
- libc_old_chown = 1;
- return err;
- }
- libc_old_chown = -1;
- }
-#endif
-
- err = __readlink (file, link, PATH_MAX+1);
- if (err == -1)
- {
- errno = old_errno;
- return __lchown(file, owner, group);
- }
-
- filelen = strlen (file) + 1;
- if (filelen > sizeof(path))
- {
- errno = ENAMETOOLONG;
- return -1;
- }
- memcpy (path, file, filelen);
-
- /* 'The system has an arbitrary limit...' In practise, we'll hit
- ENAMETOOLONG before this, usually. */
- for (loopct = 0; loopct < 128; loopct++)
- {
- size_t linklen;
-
- if (err >= PATH_MAX+1)
- {
- errno = ENAMETOOLONG;
- return -1;
- }
+#if __ASSUME_LCHOWN_SYSCALL
+ return INLINE_SYSCALL (chown, 3, file, owner, group);
+#else
+ int err;
+ int old_errno;
+ char link[PATH_MAX + 2];
+ char path[2 * PATH_MAX + 4];
+ int loopct;
+ size_t filelen;
+ static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
+
+ if (libc_old_chown == 1)
+ return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+
+ old_errno = errno;
+
+# ifdef __NR_lchown
+ if (libc_old_chown == 0)
+ {
+ err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+ if (err != -1 || errno != ENOSYS)
+ {
+ libc_old_chown = 1;
+ return err;
+ }
+ libc_old_chown = -1;
+ }
+# endif
+
+ err = __readlink (file, link, PATH_MAX + 1);
+ if (err == -1)
+ {
+ __set_errno (old_errno);
+ return __lchown (file, owner, group);
+ }
+
+ filelen = strlen (file) + 1;
+ if (filelen > sizeof (path))
+ {
+ __set_errno (ENAMETOOLONG);
+ return -1;
+ }
+ memcpy (path, file, filelen);
+
+ /* 'The system has an arbitrary limit...' In practise, we'll hit
+ ENAMETOOLONG before this, usually. */
+ for (loopct = 0; loopct < 128; ++loopct)
+ {
+ size_t linklen;
+
+ if (err >= PATH_MAX + 1)
+ {
+ __set_errno (ENAMETOOLONG);
+ return -1;
+ }
link[err] = 0; /* Null-terminate string, just-in-case. */
{
filelen = strlen (path);
- while (filelen > 1 && path[filelen-1] == '/')
- filelen--;
- while (filelen > 0 && path[filelen-1] != '/')
- filelen--;
- if (filelen + linklen > sizeof(path))
+ while (filelen > 1 && path[filelen - 1] == '/')
+ --filelen;
+ while (filelen > 0 && path[filelen - 1] != '/')
+ --filelen;
+ if (filelen + linklen > sizeof (path))
{
errno = ENAMETOOLONG;
return -1;
}
- memcpy (path+filelen, link, linklen);
+ memcpy (path + filelen, link, linklen);
}
- err = __readlink(path, link, PATH_MAX+1);
+ err = __readlink (path, link, PATH_MAX + 1);
if (err == -1)
- {
- errno = old_errno;
- return __lchown(path, owner, group);
- }
- }
- errno = ELOOP;
- return -1;
+ {
+ __set_errno (old_errno);
+ return __lchown (path, owner, group);
+ }
+ }
+ __set_errno (ELOOP);
+ return -1;
+#endif
}
libc_hidden_def (__chown)
--- /dev/null
+/* 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>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sysdep.h>
+#include <stdlib.h>
+
+#include <kernel-features.h>
+
+/*
+ In Linux 2.1.x the chown functions have been changed. A new function lchown
+ was introduced. The new chown now follows symlinks - the old chown and the
+ new lchown do not follow symlinks.
+ This file emulates chown() under the old kernels.
+*/
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#if __ASSUME_LCHOWN_SYSCALL
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+ else
+ result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+#else
+ char link[PATH_MAX + 2];
+ char path[2 * PATH_MAX + 4];
+ int loopct;
+ size_t filelen;
+ static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
+
+ if (libc_old_chown == 1)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown, err, 3, __ptrvalue (file), owner,
+ group);
+ else
+ result = INTERNAL_SYSCALL (chown, err, 3, __ptrvalue (file), owner,
+ group);
+ goto out;
+ }
+
+# ifdef __NR_lchown
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ {
+ result = INTERNAL_SYSCALL (lchown, err, 3, __ptrvalue (file), owner,
+ group);
+ goto out;
+ }
+
+ if (libc_old_chown == 0)
+ {
+ result = INTERNAL_SYSCALL (chown, err, 3, __ptrvalue (file), owner,
+ group);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ {
+ libc_old_chown = 1;
+ goto fail;
+ }
+ libc_old_chown = -1;
+ }
+# else
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ {
+ result = INTERNAL_SYSCALL (chown, err, 3, __ptrvalue (file), owner,
+ group);
+ goto out;
+ }
+# endif
+
+ result = __readlink (file, link, PATH_MAX + 1);
+ if (result == -1)
+ {
+# ifdef __NR_lchown
+ result = INTERNAL_SYSCALL (lchown, err, 3, __ptrvalue (file), owner,
+ group);
+# else
+ result = INTERNAL_SYSCALL (chown, err, 3, __ptrvalue (file), owner,
+ group);
+# endif
+ goto out;
+ }
+
+ filelen = strlen (file) + 1;
+ if (filelen > sizeof (path))
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ memcpy (path, file, filelen);
+
+ /* 'The system has an arbitrary limit...' In practise, we'll hit
+ ENAMETOOLONG before this, usually. */
+ for (loopct = 0; loopct < 128; ++loopct)
+ {
+ size_t linklen;
+
+ if (result >= PATH_MAX + 1)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+
+ link[result] = 0; /* Null-terminate string, just-in-case. */
+
+ linklen = strlen (link) + 1;
+
+ if (link[0] == '/')
+ memcpy (path, link, linklen);
+ else
+ {
+ filelen = strlen (path);
+
+ while (filelen > 1 && path[filelen - 1] == '/')
+ --filelen;
+ while (filelen > 0 && path[filelen - 1] != '/')
+ --filelen;
+ if (filelen + linklen > sizeof (path))
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ memcpy (path + filelen, link, linklen);
+ }
+
+ result = __readlink (path, link, PATH_MAX + 1);
+
+ if (result == -1)
+ {
+# ifdef __NR_lchown
+ result = INTERNAL_SYSCALL (lchown, err, 3, path, owner, group);
+# else
+ result = INTERNAL_SYSCALL (chown, err, 3, path, owner, group);
+# endif
+ goto out;
+ }
+ }
+ __set_errno (ELOOP);
+ return -1;
+
+ out:
+#endif
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+#if !__ASSUME_LCHOWN_SYSCALL
+ fail:
+#endif
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+/* Get frequency of the system processor. powerpc/Linux version.
+ Copyright (C) 2000, 2001, 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 <ctype.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <libc-internal.h>
+
+
+hp_timing_t
+__get_clockfreq (void)
+{
+ /* We read the information from the /proc filesystem. /proc/cpuinfo
+ contains at least one line like:
+ timebase : 33333333
+ We search for this line and convert the number into an integer. */
+ static hp_timing_t timebase_freq;
+ hp_timing_t result = 0L;
+
+ /* If this function was called before, we know the result. */
+ if (timebase_freq != 0)
+ return timebase_freq;
+
+ int fd = open ("/proc/cpuinfo", O_RDONLY);
+ if (__builtin_expect (fd != -1, 1))
+ {
+ /* The timebase will be in the 1st 1024 bytes for systems with up
+ to 8 processors. If the first read returns less then 1024
+ bytes read, we have the whole cpuinfo and can start the scan.
+ Otherwise we will have to read more to insure we have the
+ timebase value in the scan. */
+ char buf[1024];
+ ssize_t n;
+
+ n = read (fd, buf, sizeof (buf));
+ if (n == sizeof (buf))
+ {
+ /* We are here because the 1st read returned exactly sizeof
+ (buf) bytes. This implies that we are not at EOF and may
+ not have read the timebase value yet. So we need to read
+ more bytes until we know we have EOF. We copy the lower
+ half of buf to the upper half and read sizeof (buf)/2
+ bytes into the lower half of buf and repeat until we
+ reach EOF. We can assume that the timebase will be in
+ the last 512 bytes of cpuinfo, so two 512 byte half_bufs
+ will be sufficient to contain the timebase and will
+ handle the case where the timebase spans the half_buf
+ boundry. */
+ const ssize_t half_buf = sizeof (buf) / 2;
+ while (n >= half_buf)
+ {
+ memcpy (buf, buf + half_buf, half_buf);
+ n = read (fd, buf + half_buf, half_buf);
+ }
+ if (n >= 0)
+ n += half_buf;
+ }
+
+ if (__builtin_expect (n, 1) > 0)
+ {
+ char *mhz = memmem (buf, n, "timebase", 7);
+
+ if (__builtin_expect (mhz != NULL, 1))
+ {
+ char *endp = buf + n;
+
+ /* Search for the beginning of the string. */
+ while (mhz < endp && (*mhz < '0' || *mhz > '9') && *mhz != '\n')
+ ++mhz;
+
+ while (mhz < endp && *mhz != '\n')
+ {
+ if (*mhz >= '0' && *mhz <= '9')
+ {
+ result *= 10;
+ result += *mhz - '0';
+ }
+
+ ++mhz;
+ }
+ }
+ timebase_freq = result;
+ }
+ close (fd);
+ }
+
+ return timebase_freq;
+}
--- /dev/null
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
--- /dev/null
+/* 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>
+#include <sysdep.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;
+{
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ char *bufold = NULL;
+
+ if (oldfd != AT_FDCWD && old[0] != '/')
+ {
+ size_t filelen = strlen (old);
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ bufold = alloca (buflen);
+
+ __snprintf (bufold, buflen, procfd, oldfd, old);
+ old = bufold;
+ }
+
+ char *bufnew = NULL;
+
+ if (newfd != AT_FDCWD && new[0] != '/')
+ {
+ size_t filelen = strlen (new);
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ bufnew = alloca (buflen);
+
+ __snprintf (bufnew, buflen, procfd, newfd, new);
+ new = bufnew;
+ }
+
+ INTERNAL_SYSCALL_DECL (err);
+
+ int result = INTERNAL_SYSCALL (rename, err, 2, old, new);
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+ int errval = INTERNAL_SYSCALL_ERRNO (result, err);
+ if (errval == ENOTDIR && (bufnew != NULL || bufold != NULL))
+ {
+ /* This can mean either the file descriptor is invalid or
+ /proc is not mounted. */
+ struct stat64 st;
+
+ if (bufnew != NULL)
+ {
+ if (__fxstat64 (_STAT_VER, newfd, &st) != 0)
+ /* errno is already set correctly. */
+ return -1;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ {
+ errval = ENOSYS;
+ goto out;
+ }
+ }
+
+ if (bufold != NULL)
+ {
+ if (__fxstat64 (_STAT_VER, oldfd, &st) != 0)
+ /* errno is already set correctly. */
+ return -1;
+
+ /* If /proc is not mounted there is nothing we can do. */
+ if (S_ISDIR (st.st_mode)
+ && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+ || !S_ISDIR (st.st_mode)))
+ errval = ENOSYS;
+ }
+ }
+
+ out:
+ __set_errno (errval);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+/* 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>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <shlib-compat.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+/*
+ In Linux 2.1.x the chown functions have been changed. A new function lchown
+ was introduced. The new chown now follows symlinks - the old chown and the
+ new lchown do not follow symlinks.
+ The new lchown function has the same number as the old chown had and the
+ new chown has a new number. When compiling with headers from Linux > 2.1.8x
+ it's impossible to run this libc with older kernels. In these cases libc
+ has therefore to route calls to chown to the old chown function.
+*/
+
+/* Running under Linux > 2.1.80. */
+
+#ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+ if (flag & ~AT_SYMLINK_NOFOLLOW)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+#if __ASSUME_32BITUIDS > 0
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+ group);
+#else
+ static int __libc_old_chown;
+
+# ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file),
+ owner, group);
+ else
+ result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file),
+ owner, group);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
+ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (!__libc_old_chown && (flag & AT_SYMLINK_NOFOLLOW) == 0)
+ {
+ result = INTERNAL_SYSCALL (chown, err, 3, CHECK_STRING (file), owner,
+ group);
+
+ if (!INTERNAL_SYSCALL_ERROR_P (result, err))
+ return result;
+ if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+ goto fail;
+
+ __libc_old_chown = 1;
+ }
+
+ result = INTERNAL_SYSCALL (lchown, err, 3, CHECK_STRING (file), owner,
+ group);
+#endif
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+ fail:
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
--- /dev/null
+#include <sysdeps/unix/sysv/linux/m68k/fchownat.c>
--- /dev/null
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
-/* Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 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
The .S files for the other calls just #define socket and #include this. */
#ifndef __socket
+#ifndef NO_WEAK_ALIAS
#define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
#endif
#define PUSHARGS_1 mov.l r4,@-r15; \
PSEUDO_END (__socket)
+#ifndef NO_WEAK_ALIAS
weak_alias (__socket, socket)
+#endif
--- /dev/null
+#include <sysdeps/unix/sysv/linux/m68k/fchownat.c>
--- /dev/null
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
--- /dev/null
+#include "../../fxstatat.c"
-#include <sysdeps/unix/bsd/sun/sunos4/tcflow.c>
+/* tcflow -- Suspend or restart transmission on termios file descriptor.
+ Copyright (C) 1993,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
+ 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 <termios.h>
+#include <sys/ioctl.h>
+
+/* Suspend or restart transmission on FD. */
+int
+tcflow (fd, action)
+ int fd;
+ int action;
+{
+ return __ioctl (fd, TCXONC, action);
+}
-#include <sysdeps/unix/bsd/sun/sunos4/tcflush.c>
+/* tcflush -- Flush pending data on termios file descriptor. Linux version.
+ Copyright (C) 1993,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
+ 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 <termios.h>
+#include <sys/ioctl.h>
+
+/* Flush pending data on FD. */
+int
+tcflush (fd, queue_selector)
+ int fd;
+ int queue_selector;
+{
+ return __ioctl (fd, TCFLSH, queue_selector);
+}
--- /dev/null
+/* 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 <stdio.h>
+#include <unistd.h>
+
+
+/* Remove the link named NAME. */
+int
+unlinkat (fd, file, flag)
+ int fd;
+ const char *file;
+ int flag;
+{
+ if (flag & ~AT_REMOVEDIR)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ int result;
+ INTERNAL_SYSCALL_DECL (err);
+
+ if (flag & AT_REMOVEDIR)
+ result = INTERNAL_SYSCALL (rmdir, err, 1, file);
+ else
+ result = INTERNAL_SYSCALL (unlink, err, 1, file);
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+ {
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+ result = -1;
+ }
+
+ return result;
+}
--- /dev/null
+/* 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. */
+
+/* Ho hum, since fxstatat == fxstatat64 we must get rid of the
+ prototype or gcc will complain since they don't strictly match. */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+/* Get information about the file NAME relative to FD in ST. */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+ if ((vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
+ || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ char *buf = NULL;
+
+ if (fd != AT_FDCWD && file[0] != '/')
+ {
+ size_t filelen = strlen (file);
+ static const char procfd[] = "/proc/self/fd/%d/%s";
+ /* Buffer for the path name we are going to use. It consists of
+ - the string /proc/self/fd/
+ - the file descriptor number
+ - the file name provided.
+ The final NUL is included in the sizeof. A bit of overhead
+ due to the format elements compensates for possible negative
+ numbers. */
+ size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+ buf = alloca (buflen);
+
+ __snprintf (buf, buflen, procfd, fd, file);
+ file = buf;
+ }
+
+ INTERNAL_SYSCALL_DECL (err);
+ int res;
+
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ res = INTERNAL_SYSCALL (lstat, err, 2, file, CHECK_1 (st));
+ else
+ res = INTERNAL_SYSCALL (stat, err, 2, file, CHECK_1 (st));
+
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+ __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+
+ return res;
+}
+#undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
--- /dev/null
+/* fxstatat64 is in fxstatat.c */
-/* Copyright (C) 1991-1994,1996-2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-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
NOTE: This form of timezone information is obsolete.
Use the functions and variables declared in <time.h> instead. */
extern int gettimeofday (struct timeval *__restrict __tv,
- __timezone_ptr_t __tz) __THROW;
+ __timezone_ptr_t __tz) __THROW __nonnull ((1));
#ifdef __USE_BSD
/* Set the current time of day and timezone information.
This call is restricted to the super-user. */
extern int settimeofday (__const struct timeval *__tv,
- __const struct timezone *__tz) __THROW;
+ __const struct timezone *__tz)
+ __THROW __nonnull ((1));
/* Adjust the current time of day by the amount in DELTA.
If OLDDELTA is not NULL, it is filled in with the amount
FILE to TVP[1]. If TVP is a null pointer, use the current time instead.
Returns 0 on success, -1 on errors. */
extern int utimes (__const char *__file, __const struct timeval __tvp[2])
- __THROW;
+ __THROW __nonnull ((1));
#ifdef __USE_BSD
/* Same as `utimes', but does not follow symbolic links. */
extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
- __THROW;
+ __THROW __nonnull ((1));
/* Same as `utimes', but takes an open file descriptor instead of a name. */
extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;
#endif
+#ifdef __USE_GNU
+/* Change the access time of FILE relative to FD to TVP[0] and the
+ modification time of FILE to TVP[1]. If TVP is a null pointer, use
+ the current time instead. Returns 0 on success, -1 on errors. */
+extern int futimesat (int __fd, __const char *__file,
+ __const struct timeval __tvp[2]) __THROW __nonnull ((2));
+#endif
+
#ifdef __USE_BSD
/* Convenience macros for operations on timevals.