[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r11981 - in /trunk: libc/ libc/elf/ libc/include/ libc/malloc/ libc/math/ libc/po/ libc/string/ libc/sysdeps/generic/ libc/s...
- To: commits@xxxxxxxxxx
- Subject: [commits] r11981 - in /trunk: libc/ libc/elf/ libc/include/ libc/malloc/ libc/math/ libc/po/ libc/string/ libc/sysdeps/generic/ libc/s...
- From: joseph@xxxxxxxxxx
- Date: Sun, 07 Nov 2010 12:11:42 -0000
Author: joseph
Date: Sun Nov 7 04:11:40 2010
New Revision: 11981
Log:
Merge changes between r11842 and r11980 from /fsf/trunk.
Added:
trunk/libc/string/bug-strchr1.c
- copied unchanged from r11980, fsf/trunk/libc/string/bug-strchr1.c
trunk/libc/sysdeps/powerpc/powerpc32/a2/
- copied from r11980, fsf/trunk/libc/sysdeps/powerpc/powerpc32/a2/
trunk/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S
- copied unchanged from r11980, fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/mempcpy.S
trunk/libc/sysdeps/powerpc/powerpc64/a2/
- copied from r11980, fsf/trunk/libc/sysdeps/powerpc/powerpc64/a2/
trunk/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S
- copied unchanged from r11980, fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/mempcpy.S
trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/a2/
- copied from r11980, fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/a2/
trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/a2/
- copied from r11980, fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/a2/
Modified:
trunk/libc/ChangeLog
trunk/libc/Makeconfig
trunk/libc/NEWS
trunk/libc/elf/dl-deps.c
trunk/libc/elf/dl-load.c
trunk/libc/elf/dl-object.c
trunk/libc/elf/dl-open.c
trunk/libc/elf/rtld-Rules
trunk/libc/elf/rtld.c
trunk/libc/include/dlfcn.h
trunk/libc/malloc/malloc.c
trunk/libc/math/math.h
trunk/libc/po/da.po
trunk/libc/string/Makefile
trunk/libc/sysdeps/generic/ldsodefs.h
trunk/libc/sysdeps/i386/i686/cacheinfo.c
trunk/libc/sysdeps/powerpc/dl-procinfo.c
trunk/libc/sysdeps/powerpc/dl-procinfo.h
trunk/libc/sysdeps/unix/sysv/linux/ttyname.c
trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c
trunk/libc/sysdeps/x86_64/cacheinfo.c
trunk/libc/sysdeps/x86_64/multiarch/strchr.S
trunk/ports/ChangeLog.m68k
trunk/ports/sysdeps/unix/sysv/linux/m68k/fchownat.c
Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Sun Nov 7 04:11:40 2010
@@ -1,3 +1,110 @@
+2010-11-04 Luis Machado <luisgpm@xxxxxxxxxx>
+
+ * sysdeps/powerpc/powerpc32/power7/mempcpy.S: New file.
+ * sysdeps/powerpc/powerpc64/power7/mempcpy.S: New file.
+
+2010-11-03 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ [BZ #12191]
+ * sysdeps/i386/i686/cacheinfo.c (__x86_64_raw_data_cache_size): New.
+ (__x86_64_raw_data_cache_size_half): Likewise.
+ (__x86_64_raw_shared_cache_size): Likewise.
+ (__x86_64_raw_shared_cache_size_half): Likewise.
+
+ * sysdeps/x86_64/cacheinfo.c (__x86_64_raw_data_cache_size): New.
+ (__x86_64_raw_data_cache_size_half): Likewise.
+ (__x86_64_raw_shared_cache_size): Likewise.
+ (__x86_64_raw_shared_cache_size_half): Likewise.
+ (init_cacheinfo): Set __x86_64_raw_data_cache_size,
+ __x86_64_raw_data_cache_size_half, __x86_64_raw_shared_cache_size
+ and __x86_64_raw_shared_cache_size_half. Round
+ __x86_64_data_cache_size_half, __x86_64_data_cache_size
+ __x86_64_shared_cache_size_half and __x86_64_shared_cache_size,
+ to multiple of 256 bytes.
+
+2010-11-03 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12167]
+ * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Recognize new mangling
+ of inacessible symlinks. Verify result of symlink before returning it.
+ * sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
+ Patch mostly by Miklos Szeredi <miklos@xxxxxxxxxx>.
+
+2010-10-28 Erich Ritz <erichritz@xxxxxxxxx>
+
+ * math/math.h (isinf): Fix typo in comment.
+
+2010-11-01 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * po/da.po: Update from translation team.
+
+2010-10-26 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * elf/rtld.c (dl_main): Move assertion after the point where rtld map
+ is added to the list.
+
+2010-10-20 Andreas Krebbel <Andreas.Krebbel@xxxxxxxxxx>
+ Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * elf/dl-object.c (_dl_new_object): Don't append the new object to
+ the global list here. Move code to...
+ (_dl_add_to_namespace_list): ...here. New function.
+ * elf/rtld.c (dl_main): Invoke _dl_add_to_namespace_list.
+ * sysdeps/generic/ldsodefs.h (_dl_add_to_namespace_list): Declare.
+ * elf/dl-load.c (lose): Don't remove the element from the list.
+ (_dl_map_object_from_fd): Invoke _dl_add_to_namespace_list.
+ (_dl_map_object): Likewise.
+
+2010-10-25 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12159]
+ * sysdeps/x86_64/multiarch/strchr.S: Fix propagation of search byte
+ into all bytes of SSE register.
+ Patch by Richard Li <richardpku@xxxxxxxxx>.
+
+2010-10-24 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12140]
+ * malloc/malloc.c (_int_free): Fill correct number of bytes when
+ perturbing.
+
+2010-10-20 Michael B. Brutman <brutman@xxxxxxxxxx>
+
+ * sysdeps/powerpc/dl-procinfo.c: Add support for ppca2 platform
+ * sysdeps/powerpc/dl-procinfo.h: Add support for ppca2 platform
+ * sysdeps/powerpc/powerpc32/a2/memcpy.S: New file.
+ * sysdeps/powerpc/powerpc64/a2/memcpy.S: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/a2/Implies: New
+ submachine.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/a2/Implies: Likewise.
+
+2010-10-22 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * include/dlfcn.h (__RTLD_SECURE): Define.
+ * elf/dl-load.c (_dl_map_object): Remove preloaded parameter. Use
+ mode & __RTLD_SECURE instead.
+ (open_path): Rename preloaded parameter to secure.
+ * sysdeps/generic/ldsodefs.h (_dl_map_object): Adjust declaration.
+ * elf/dl-open.c (dl_open_worker): Adjust call to _dl_map_object.
+ * elf/dl-deps.c (openaux): Likewise.
+ * elf/rtld.c (struct map_args): Remove is_preloaded.
+ (map_doit): Don't use it.
+ (dl_main): Likewise.
+ (do_preload): Use __RTLD_SECURE instead of is_preloaded.
+ (dlmopen_doit): Add __RTLD_SECURE to mode bits.
+
+2010-09-09 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * Makeconfig (sysd-rules-patterns): Add rtld-%:rtld-%.
+ (sysd-rules-targets): Remove duplicates.
+ * elf/rtld-Rules ($(objpfx)rtld-%.os): Add pattern rules with
+ rtld-%.$o dependency.
+
+2010-10-18 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * elf/dl-open.c (dl_open_worker): Don't expand DST here, let
+ _dl_map_object do it.
+
2010-10-19 Ulrich Drepper <drepper@xxxxxxxxx>
* sysdeps/i386/bits/mathdef.h (FP_FAST_FMA): If the GCC 4.6 port has
Modified: trunk/libc/Makeconfig
==============================================================================
--- trunk/libc/Makeconfig (original)
+++ trunk/libc/Makeconfig Sun Nov 7 04:11:40 2010
@@ -703,7 +703,7 @@
-include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
$(CPPFLAGS-$(suffix $@)) \
$(foreach lib,$(libof-$(basename $(@F))) \
- $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
+ $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
$(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
@@ -992,7 +992,7 @@
# emitted into sysd-rules. A sysdeps Makeconfig fragment can
# add its own special object file prefix to this list with e.g. foo-%:%
# to have foo-*.? compiled from *.? using $(foo-CPPFLAGS).
-sysd-rules-patterns := %:% rtld-%:% m_%:s_%
+sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_%
# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
@@ -1001,8 +1001,8 @@
endif
# Compute just the target patterns. Makeconfig has set sysd-rules-patterns.
-sysd-rules-targets := $(foreach p,$(sysd-rules-patterns),\
- $(firstword $(subst :, ,$p)))
+sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
+ $(firstword $(subst :, ,$p))))
endif # Makeconfig not yet included
Modified: trunk/libc/NEWS
==============================================================================
--- trunk/libc/NEWS (original)
+++ trunk/libc/NEWS Sun Nov 7 04:11:40 2010
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2010-10-13
+GNU C Library NEWS -- history of user-visible changes. 2010-11-5
Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -11,7 +11,7 @@
3268, 7066, 10851, 11611, 11640, 11701, 11840, 11856, 11883, 11903, 11904,
11968, 11979, 12005, 12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108,
- 12113
+ 12113, 12140, 12159, 12167, 12191
* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
Modified: trunk/libc/elf/dl-deps.c
==============================================================================
--- trunk/libc/elf/dl-deps.c (original)
+++ trunk/libc/elf/dl-deps.c Sun Nov 7 04:11:40 2010
@@ -62,7 +62,7 @@
{
struct openaux_args *args = (struct openaux_args *) a;
- args->aux = _dl_map_object (args->map, args->name, 0,
+ args->aux = _dl_map_object (args->map, args->name,
(args->map->l_type == lt_executable
? lt_library : args->map->l_type),
args->trace_mode, args->open_mode,
Modified: trunk/libc/elf/dl-load.c
==============================================================================
--- trunk/libc/elf/dl-load.c (original)
+++ trunk/libc/elf/dl-load.c Sun Nov 7 04:11:40 2010
@@ -798,22 +798,7 @@
/* The file might already be closed. */
if (fd != -1)
(void) __close (fd);
- if (l != NULL)
- {
- /* We modify the list of loaded objects. */
- __rtld_lock_lock_recursive (GL(dl_load_write_lock));
- /* Remove the stillborn object from the list and free it. */
- assert (l->l_next == NULL);
- if (l->l_prev == NULL)
- /* No other module loaded. This happens only in the static library,
- or in rtld under --verify. */
- GL(dl_ns)[l->l_ns]._ns_loaded = NULL;
- else
- l->l_prev->l_next = NULL;
- --GL(dl_ns)[l->l_ns]._ns_nloaded;
- free (l);
- __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
- }
+ free (l);
free (realname);
if (r != NULL)
@@ -897,6 +882,9 @@
/* No need to bump the refcount of the real object, ld.so will
never be unloaded. */
__close (fd);
+
+ /* Add the map for the mirrored object to the object list. */
+ _dl_add_to_namespace_list (l, nsid);
return l;
}
@@ -1491,6 +1479,9 @@
&& l->l_info[DT_SONAME] != NULL)
add_name_to_object (l, ((const char *) D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_SONAME]->d_un.d_val));
+
+ /* Now that the object is fully initialized add it to the object list. */
+ _dl_add_to_namespace_list (l, nsid);
#ifdef SHARED
/* Auditing checkpoint: we have a new object. */
@@ -1812,7 +1803,7 @@
if MAY_FREE_DIRS is true. */
static int
-open_path (const char *name, size_t namelen, int preloaded,
+open_path (const char *name, size_t namelen, int secure,
struct r_search_path_struct *sps, char **realname,
struct filebuf *fbp, struct link_map *loader, int whatcode,
bool *found_other_class)
@@ -1894,7 +1885,7 @@
/* Remember whether we found any existing directory. */
here_any |= this_dir->status[cnt] != nonexisting;
- if (fd != -1 && __builtin_expect (preloaded, 0)
+ if (fd != -1 && __builtin_expect (secure, 0)
&& INTUSE(__libc_enable_secure))
{
/* This is an extra security effort to make sure nobody can
@@ -1963,7 +1954,7 @@
struct link_map *
internal_function
-_dl_map_object (struct link_map *loader, const char *name, int preloaded,
+_dl_map_object (struct link_map *loader, const char *name,
int type, int trace_mode, int mode, Lmid_t nsid)
{
int fd;
@@ -2067,7 +2058,8 @@
for (l = loader; l; l = l->l_loader)
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
{
- fd = open_path (name, namelen, preloaded, &l->l_rpath_dirs,
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
+ &l->l_rpath_dirs,
&realname, &fb, loader, LA_SER_RUNPATH,
&found_other_class);
if (fd != -1)
@@ -2082,14 +2074,15 @@
&& main_map != NULL && main_map->l_type != lt_loaded
&& cache_rpath (main_map, &main_map->l_rpath_dirs, DT_RPATH,
"RPATH"))
- fd = open_path (name, namelen, preloaded, &main_map->l_rpath_dirs,
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
+ &main_map->l_rpath_dirs,
&realname, &fb, loader ?: main_map, LA_SER_RUNPATH,
&found_other_class);
}
/* Try the LD_LIBRARY_PATH environment variable. */
if (fd == -1 && env_path_list.dirs != (void *) -1)
- fd = open_path (name, namelen, preloaded, &env_path_list,
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &env_path_list,
&realname, &fb,
loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded,
LA_SER_LIBPATH, &found_other_class);
@@ -2098,12 +2091,12 @@
if (fd == -1 && loader != NULL
&& cache_rpath (loader, &loader->l_runpath_dirs,
DT_RUNPATH, "RUNPATH"))
- fd = open_path (name, namelen, preloaded,
+ fd = open_path (name, namelen, mode & __RTLD_SECURE,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
if (fd == -1
- && (__builtin_expect (! preloaded, 1)
+ && (__builtin_expect (! (mode & __RTLD_SECURE), 1)
|| ! INTUSE(__libc_enable_secure)))
{
/* Check the list of libraries in the file /etc/ld.so.cache,
@@ -2169,7 +2162,7 @@
&& ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
|| __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
&& rtld_search_dirs.dirs != (void *) -1)
- fd = open_path (name, namelen, preloaded, &rtld_search_dirs,
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
/* Add another newline when we are tracing the library loading. */
@@ -2214,7 +2207,7 @@
have. */
static const Elf_Symndx dummy_bucket = STN_UNDEF;
- /* Enter the new object in the list of loaded objects. */
+ /* Allocate a new object map. */
if ((name_copy = local_strdup (name)) == NULL
|| (l = _dl_new_object (name_copy, name, type, loader,
mode, nsid)) == NULL)
@@ -2231,6 +2224,9 @@
l->l_buckets = &dummy_bucket;
l->l_nbuckets = 1;
l->l_relocated = 1;
+
+ /* Enter the object in the object list. */
+ _dl_add_to_namespace_list (l, nsid);
return l;
}
Modified: trunk/libc/elf/dl-object.c
==============================================================================
--- trunk/libc/elf/dl-object.c (original)
+++ trunk/libc/elf/dl-object.c Sun Nov 7 04:11:40 2010
@@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2002,2004,2006-2008,2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2004,2006-2009,2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,16 +26,41 @@
#include <assert.h>
+/* Add the new link_map NEW to the end of the namespace list. */
+void
+internal_function
+_dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
+{
+ /* We modify the list of loaded objects. */
+ __rtld_lock_lock_recursive (GL(dl_load_write_lock));
+
+ if (GL(dl_ns)[nsid]._ns_loaded != NULL)
+ {
+ struct link_map *l = GL(dl_ns)[nsid]._ns_loaded;
+ while (l->l_next != NULL)
+ l = l->l_next;
+ new->l_prev = l;
+ /* new->l_next = NULL; Would be necessary but we use calloc. */
+ l->l_next = new;
+ }
+ else
+ GL(dl_ns)[nsid]._ns_loaded = new;
+ ++GL(dl_ns)[nsid]._ns_nloaded;
+ new->l_serial = GL(dl_load_adds);
+ ++GL(dl_load_adds);
+
+ __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
+}
+
+
/* Allocate a `struct link_map' for a new object being loaded,
and enter it into the _dl_loaded list. */
-
struct link_map *
internal_function
_dl_new_object (char *realname, const char *libname, int type,
struct link_map *loader, int mode, Lmid_t nsid)
{
struct link_map *l;
- int idx;
size_t libname_len = strlen (libname) + 1;
struct link_map *new;
struct libname_list *newname;
@@ -93,31 +118,12 @@
new->l_scope = new->l_scope_mem;
new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
- /* We modify the list of loaded objects. */
- __rtld_lock_lock_recursive (GL(dl_load_write_lock));
-
/* Counter for the scopes we have to handle. */
- idx = 0;
+ int idx = 0;
if (GL(dl_ns)[nsid]._ns_loaded != NULL)
- {
- l = GL(dl_ns)[nsid]._ns_loaded;
- while (l->l_next != NULL)
- l = l->l_next;
- new->l_prev = l;
- /* new->l_next = NULL; Would be necessary but we use calloc. */
- l->l_next = new;
-
- /* Add the global scope. */
- new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
- }
- else
- GL(dl_ns)[nsid]._ns_loaded = new;
- ++GL(dl_ns)[nsid]._ns_nloaded;
- new->l_serial = GL(dl_load_adds);
- ++GL(dl_load_adds);
-
- __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
+ /* Add the global scope. */
+ new->l_scope[idx++] = &GL(dl_ns)[nsid]._ns_loaded->l_searchlist;
/* If we have no loader the new object acts as it. */
if (loader == NULL)
Modified: trunk/libc/elf/dl-open.c
==============================================================================
--- trunk/libc/elf/dl-open.c (original)
+++ trunk/libc/elf/dl-open.c Sun Nov 7 04:11:40 2010
@@ -221,38 +221,9 @@
assert (_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT);
- /* Maybe we have to expand a DST. */
- if (__builtin_expect (dst != NULL, 0))
- {
- size_t len = strlen (file);
-
- /* Determine how much space we need. We have to allocate the
- memory locally. */
- size_t required = DL_DST_REQUIRED (call_map, file, len,
- _dl_dst_count (dst, 0));
-
- /* Get space for the new file name. */
- char *new_file = (char *) alloca (required + 1);
-
- /* Generate the new file name. */
- _dl_dst_substitute (call_map, file, new_file, 0);
-
- /* If the substitution failed don't try to load. */
- if (*new_file == '\0')
- _dl_signal_error (0, "dlopen", NULL,
- N_("empty dynamic string token substitution"));
-
- /* Now we have a new file name. */
- file = new_file;
-
- /* It does not matter whether call_map is set even if we
- computed it only because of the DST. Since the path contains
- a slash the value is not used. See dl-load.c. */
- }
-
/* Load the named object. */
struct link_map *new;
- args->map = new = _dl_map_object (call_map, file, 0, lt_loaded, 0,
+ args->map = new = _dl_map_object (call_map, file, lt_loaded, 0,
mode | __RTLD_CALLMAP, args->nsid);
/* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
Modified: trunk/libc/elf/rtld-Rules
==============================================================================
--- trunk/libc/elf/rtld-Rules (original)
+++ trunk/libc/elf/rtld-Rules Sun Nov 7 04:11:40 2010
@@ -1,6 +1,6 @@
# Subroutine makefile for compiling libc modules linked into dynamic linker.
-# Copyright (C) 2002, 2003, 2005, 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2005,2006,2008,2010 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
@@ -56,7 +56,7 @@
# Use the verbose option of ar and tar when not running silently.
ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
verbose := v
-else # -s
+else # -s
verbose :=
endif # not -s
@@ -93,6 +93,12 @@
# These are the basic compilation rules corresponding to the Makerules ones.
# The sysd-rules generated makefile already defines pattern rules for rtld-%
# targets built from sysdeps source files.
+$(objpfx)rtld-%.os: rtld-%.S $(before-compile)
+ $(compile-command.S) $(rtld-CPPFLAGS)
+$(objpfx)rtld-%.os: rtld-%.s $(before-compile)
+ $(compile-command.s) $(rtld-CPPFLAGS)
+$(objpfx)rtld-%.os: rtld-%.c $(before-compile)
+ $(compile-command.c) $(rtld-CPPFLAGS)
$(objpfx)rtld-%.os: %.S $(before-compile)
$(compile-command.S) $(rtld-CPPFLAGS)
$(objpfx)rtld-%.os: %.s $(before-compile)
@@ -101,6 +107,9 @@
$(compile-command.c) $(rtld-CPPFLAGS)
# The rules for generated source files.
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.S $(before-compile); $(compile-command.S)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.s $(before-compile); $(compile-command.s)
+$(objpfx)rtld-%.os: $(objpfx)rtld-%.c $(before-compile); $(compile-command.c)
$(objpfx)rtld-%.os: $(objpfx)%.S $(before-compile); $(compile-command.S)
$(objpfx)rtld-%.os: $(objpfx)%.s $(before-compile); $(compile-command.s)
$(objpfx)rtld-%.os: $(objpfx)%.c $(before-compile); $(compile-command.c)
Modified: trunk/libc/elf/rtld.c
==============================================================================
--- trunk/libc/elf/rtld.c (original)
+++ trunk/libc/elf/rtld.c Sun Nov 7 04:11:40 2010
@@ -589,7 +589,6 @@
/* Argument to map_doit. */
char *str;
struct link_map *loader;
- int is_preloaded;
int mode;
/* Return value of map_doit. */
struct link_map *map;
@@ -627,16 +626,17 @@
map_doit (void *a)
{
struct map_args *args = (struct map_args *) a;
- args->map = _dl_map_object (args->loader, args->str,
- args->is_preloaded, lt_library, 0, args->mode,
- LM_ID_BASE);
+ args->map = _dl_map_object (args->loader, args->str, lt_library, 0,
+ args->mode, LM_ID_BASE);
}
static void
dlmopen_doit (void *a)
{
struct dlmopen_args *args = (struct dlmopen_args *) a;
- args->map = _dl_open (args->fname, RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT,
+ args->map = _dl_open (args->fname,
+ (RTLD_LAZY | __RTLD_DLOPEN | __RTLD_AUDIT
+ | __RTLD_SECURE),
dl_main, LM_ID_NEWLM, _dl_argc, INTUSE(_dl_argv),
__environ);
}
@@ -806,8 +806,7 @@
args.str = fname;
args.loader = main_map;
- args.is_preloaded = 1;
- args.mode = 0;
+ args.mode = __RTLD_SECURE;
unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
@@ -1054,7 +1053,6 @@
args.str = rtld_progname;
args.loader = NULL;
- args.is_preloaded = 0;
args.mode = __RTLD_OPENEXEC;
(void) _dl_catch_error (&objname, &err_str, &malloced, map_doit,
&args);
@@ -1066,7 +1064,7 @@
else
{
HP_TIMING_NOW (start);
- _dl_map_object (NULL, rtld_progname, 0, lt_library, 0,
+ _dl_map_object (NULL, rtld_progname, lt_library, 0,
__RTLD_OPENEXEC, LM_ID_BASE);
HP_TIMING_NOW (stop);
@@ -1110,10 +1108,14 @@
main_map = _dl_new_object ((char *) "", "", lt_executable, NULL,
__RTLD_OPENEXEC, LM_ID_BASE);
assert (main_map != NULL);
- assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
main_map->l_phdr = phdr;
main_map->l_phnum = phnum;
main_map->l_entry = *user_entry;
+
+ /* Even though the link map is not yet fully initialized we can add
+ it to the map list since there are no possible users running yet. */
+ _dl_add_to_namespace_list (main_map, LM_ID_BASE);
+ assert (main_map == GL(dl_ns)[LM_ID_BASE]._ns_loaded);
/* At this point we are in a bit of trouble. We would have to
fill in the values for l_dev and l_ino. But in general we
@@ -1257,7 +1259,7 @@
/* We were invoked directly, so the program might not have a
PT_INTERP. */
_dl_rtld_libname.name = GL(dl_rtld_map).l_name;
- /* _dl_rtld_libname.next = NULL; Already zero. */
+ /* _dl_rtld_libname.next = NULL; Already zero. */
GL(dl_rtld_map).l_libname = &_dl_rtld_libname;
}
else
@@ -1382,6 +1384,9 @@
l->l_libname->name = memcpy (copy, dsoname, len);
}
+ /* Add the vDSO to the object list. */
+ _dl_add_to_namespace_list (l, LM_ID_BASE);
+
/* Rearrange the list so this DSO appears after rtld_map. */
assert (l->l_next == NULL);
assert (l->l_prev == main_map);
Modified: trunk/libc/include/dlfcn.h
==============================================================================
--- trunk/libc/include/dlfcn.h (original)
+++ trunk/libc/include/dlfcn.h Sun Nov 7 04:11:40 2010
@@ -9,6 +9,7 @@
#define __RTLD_OPENEXEC 0x20000000
#define __RTLD_CALLMAP 0x10000000
#define __RTLD_AUDIT 0x08000000
+#define __RTLD_SECURE 0x04000000 /* Apply additional security checks. */
#define __LM_ID_CALLER -2
Modified: trunk/libc/malloc/malloc.c
==============================================================================
--- trunk/libc/malloc/malloc.c (original)
+++ trunk/libc/malloc/malloc.c Sun Nov 7 04:11:40 2010
@@ -4850,7 +4850,7 @@
}
if (__builtin_expect (perturb_byte, 0))
- free_perturb (chunk2mem(p), size - SIZE_SZ);
+ free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
set_fastchunks(av);
unsigned int idx = fastbin_index(size);
@@ -4954,7 +4954,7 @@
}
if (__builtin_expect (perturb_byte, 0))
- free_perturb (chunk2mem(p), size - SIZE_SZ);
+ free_perturb (chunk2mem(p), size - 2 * SIZE_SZ);
/* consolidate backward */
if (!prev_inuse(p)) {
Modified: trunk/libc/math/math.h
==============================================================================
--- trunk/libc/math/math.h (original)
+++ trunk/libc/math/math.h Sun Nov 7 04:11:40 2010
@@ -265,7 +265,7 @@
? __isnan (x) : __isnanl (x))
# endif
-/* Return nonzero value is X is positive or negative infinity. */
+/* Return nonzero value if X is positive or negative infinity. */
# ifdef __NO_LONG_DOUBLE_MATH
# define isinf(x) \
(sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
Modified: trunk/libc/po/da.po
==============================================================================
--- trunk/libc/po/da.po (original)
+++ trunk/libc/po/da.po Sun Nov 7 04:11:40 2010
@@ -1,15 +1,14 @@
-# translation of libc-2.9.90.po to Danish
# Danish messages for GNU libc.
# Copyright (C) 1996, 2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the glibc package.
#
-# Keld Simonsen <keld@xxxxxxxx>, 2000-2002, 2009.
+# Keld Simonsen <keld@xxxxxxxxxx>, 2000-2002, 2009-2010.
msgid ""
msgstr ""
-"Project-Id-Version: libc-2.9.90\n"
+"Project-Id-Version: libc-2.11.1\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-05-20 11:37+0200\n"
-"Last-Translator: Keld Simonsen <keld@xxxxxxxx>\n"
+"PO-Revision-Date: 2010-11-01 10:37+0100\n"
+"Last-Translator: Keld Simonsen <keld@xxxxxxxxxx>\n"
"Language-Team: Danish <dansk@xxxxxxxxxxxxxxxx>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
@@ -122,7 +121,7 @@
"Generate message catalog.\vIf INPUT-FILE is -, input is read from standard input. If OUTPUT-FILE\n"
"is -, output is written to standard output.\n"
msgstr ""
-"Generér meddelelseskatalog.\\vHvis INDFIL er '-' læses inddata fra standard ind.\n"
+"Generér meddelelseskatalog.\vHvis INDFIL er '-' læses inddata fra standard ind.\n"
"Hvis UDFIL er '-' skrives uddata til standard ud.\n"
#: catgets/gencat.c:124
Modified: trunk/libc/string/Makefile
==============================================================================
--- trunk/libc/string/Makefile (original)
+++ trunk/libc/string/Makefile Sun Nov 7 04:11:40 2010
@@ -59,7 +59,7 @@
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
tst-strtok tst-strfry \
bug-strtok1 $(addprefix test-,$(strop-tests)) \
- tst-strxfrm2 tst-endian tst-svc2 bug-strstr1
+ tst-strxfrm2 tst-endian tst-svc2 bug-strstr1 bug-strchr1
tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
tests-$(OPTION_EGLIBC_LOCALE_CODE) \
+= tst-strxfrm bug-strcoll1
Modified: trunk/libc/sysdeps/generic/ldsodefs.h
==============================================================================
--- trunk/libc/sysdeps/generic/ldsodefs.h (original)
+++ trunk/libc/sysdeps/generic/ldsodefs.h Sun Nov 7 04:11:40 2010
@@ -832,11 +832,9 @@
/* Open the shared object NAME and map in its segments.
LOADER's DT_RPATH is used in searching for NAME.
- If the object is already opened, returns its existing map.
- For preloaded shared objects PRELOADED is set to a non-zero
- value to allow additional security checks. */
+ If the object is already opened, returns its existing map. */
extern struct link_map *_dl_map_object (struct link_map *loader,
- const char *name, int preloaded,
+ const char *name,
int type, int trace_mode, int mode,
Lmid_t nsid)
internal_function attribute_hidden;
@@ -901,8 +899,11 @@
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name)
internal_function;
-/* Allocate a `struct link_map' for a new object being loaded,
- and enter it into the _dl_main_map list. */
+/* Add the new link_map NEW to the end of the namespace list. */
+extern void _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
+ internal_function attribute_hidden;
+
+/* Allocate a `struct link_map' for a new object being loaded. */
extern struct link_map *_dl_new_object (char *realname, const char *libname,
int type, struct link_map *loader,
int mode, Lmid_t nsid)
Modified: trunk/libc/sysdeps/i386/i686/cacheinfo.c
==============================================================================
--- trunk/libc/sysdeps/i386/i686/cacheinfo.c (original)
+++ trunk/libc/sysdeps/i386/i686/cacheinfo.c Sun Nov 7 04:11:40 2010
@@ -1,7 +1,11 @@
#define __x86_64_data_cache_size __x86_data_cache_size
+#define __x86_64_raw_data_cache_size __x86_raw_data_cache_size
#define __x86_64_data_cache_size_half __x86_data_cache_size_half
+#define __x86_64_raw_data_cache_size_half __x86_raw_data_cache_size_half
#define __x86_64_shared_cache_size __x86_shared_cache_size
+#define __x86_64_raw_shared_cache_size __x86_raw_shared_cache_size
#define __x86_64_shared_cache_size_half __x86_shared_cache_size_half
+#define __x86_64_raw_shared_cache_size_half __x86_raw_shared_cache_size_half
#define DISABLE_PREFETCHW
#define DISABLE_PREFERRED_MEMORY_INSTRUCTION
Modified: trunk/libc/sysdeps/powerpc/dl-procinfo.c
==============================================================================
--- trunk/libc/sysdeps/powerpc/dl-procinfo.c (original)
+++ trunk/libc/sysdeps/powerpc/dl-procinfo.c Sun Nov 7 04:11:40 2010
@@ -68,7 +68,7 @@
#if !defined PROCINFO_DECL && defined SHARED
._dl_powerpc_platforms
#else
-PROCINFO_CLASS const char _dl_powerpc_platforms[8][12]
+PROCINFO_CLASS const char _dl_powerpc_platforms[9][12]
#endif
#ifndef PROCINFO_DECL
= {
@@ -79,7 +79,8 @@
[PPC_PLATFORM_POWER6] = "power6",
[PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
[PPC_PLATFORM_POWER6X] = "power6x",
- [PPC_PLATFORM_POWER7] = "power7"
+ [PPC_PLATFORM_POWER7] = "power7",
+ [PPC_PLATFORM_PPCA2] = "ppca2"
}
#endif
#if !defined SHARED || defined PROCINFO_DECL
Modified: trunk/libc/sysdeps/powerpc/dl-procinfo.h
==============================================================================
--- trunk/libc/sysdeps/powerpc/dl-procinfo.h (original)
+++ trunk/libc/sysdeps/powerpc/dl-procinfo.h Sun Nov 7 04:11:40 2010
@@ -31,7 +31,7 @@
#define HWCAP_IMPORTANT (PPC_FEATURE_HAS_ALTIVEC \
+ PPC_FEATURE_HAS_DFP)
-#define _DL_PLATFORMS_COUNT 8
+#define _DL_PLATFORMS_COUNT 9
#define _DL_FIRST_PLATFORM 32
/* Mask to filter out platforms. */
@@ -47,6 +47,7 @@
#define PPC_PLATFORM_CELL_BE 5
#define PPC_PLATFORM_POWER6X 6
#define PPC_PLATFORM_POWER7 7
+#define PPC_PLATFORM_PPCA2 8
static inline const char *
__attribute__ ((unused))
@@ -123,6 +124,10 @@
GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
== 0)
return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
+ else if (strcmp (str + 3,
+ GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPCA2] + 3)
+ == 0)
+ return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPCA2;
}
return -1;
Modified: trunk/libc/sysdeps/unix/sysv/linux/ttyname.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/ttyname.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/ttyname.c Sun Nov 7 04:11:40 2010
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,1996-2002,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1996-2002,2006,2009,2010
+ 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
@@ -131,6 +132,9 @@
if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
return NULL;
+ if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+ return NULL;
+
/* We try using the /proc filesystem. */
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
@@ -161,13 +165,32 @@
{
if ((size_t) len >= buflen)
return NULL;
+
+#define UNREACHABLE_LEN strlen ("(unreachable)")
+ if (len > UNREACHABLE_LEN
+ && memcmp (ttyname_buf, "(unreachable)", UNREACHABLE_LEN) == 0)
+ {
+ memmove (ttyname_buf, ttyname_buf + UNREACHABLE_LEN,
+ len - UNREACHABLE_LEN);
+ len -= UNREACHABLE_LEN;
+ }
+
/* readlink need not terminate the string. */
ttyname_buf[len] = '\0';
- return ttyname_buf;
- }
-
- if (__fxstat64 (_STAT_VER, fd, &st) < 0)
- return NULL;
+
+ /* Verify readlink result, fall back on iterating through devices. */
+ if (ttyname_buf[0] == '/'
+ && __xstat64 (_STAT_VER, ttyname_buf, &st1) == 0
+#ifdef _STATBUF_ST_RDEV
+ && S_ISCHR (st1.st_mode)
+ && st1.st_rdev == st.st_rdev
+#else
+ && st1.st_ino == st.st_ino
+ && st1.st_dev == st.st_dev
+#endif
+ )
+ return ttyname_buf;
+ }
if (__xstat64 (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
{
Modified: trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c Sun Nov 7 04:11:40 2010
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,1995-2001,2003,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2001,2003,2006,2010
+ 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
@@ -122,6 +123,9 @@
if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
return errno;
+ if (__fxstat64 (_STAT_VER, fd, &st) < 0)
+ return errno;
+
/* We try using the /proc filesystem. */
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
@@ -145,12 +149,30 @@
#endif
, 1))
{
+#define UNREACHABLE_LEN strlen ("(unreachable)")
+ if (ret > UNREACHABLE_LEN
+ && memcmp (buf, "(unreachable)", UNREACHABLE_LEN) == 0)
+ {
+ memmove (buf, buf + UNREACHABLE_LEN, ret - UNREACHABLE_LEN);
+ ret -= UNREACHABLE_LEN;
+ }
+
+ /* readlink need not terminate the string. */
buf[ret] = '\0';
- return 0;
- }
-
- if (__fxstat64 (_STAT_VER, fd, &st) < 0)
- return errno;
+
+ /* Verify readlink result, fall back on iterating through devices. */
+ if (buf[0] == '/'
+ && __xstat64 (_STAT_VER, buf, &st1) == 0
+#ifdef _STATBUF_ST_RDEV
+ && S_ISCHR (st1.st_mode)
+ && st1.st_rdev == st.st_rdev
+#else
+ && st1.st_ino == st.st_ino
+ && st1.st_dev == st.st_dev
+#endif
+ )
+ return 0;
+ }
/* Prepare the result buffer. */
memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/"));
Modified: trunk/libc/sysdeps/x86_64/cacheinfo.c
==============================================================================
--- trunk/libc/sysdeps/x86_64/cacheinfo.c (original)
+++ trunk/libc/sysdeps/x86_64/cacheinfo.c Sun Nov 7 04:11:40 2010
@@ -455,13 +455,21 @@
/* Data cache size for use in memory and string routines, typically
- L1 size. */
+ L1 size, rounded to multiple of 256 bytes. */
long int __x86_64_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
long int __x86_64_data_cache_size attribute_hidden = 32 * 1024;
+/* Similar to __x86_64_data_cache_size_half, but not rounded. */
+long int __x86_64_raw_data_cache_size_half attribute_hidden = 32 * 1024 / 2;
+/* Similar to __x86_64_data_cache_size, but not rounded. */
+long int __x86_64_raw_data_cache_size attribute_hidden = 32 * 1024;
/* Shared cache size for use in memory and string routines, typically
- L2 or L3 size. */
+ L2 or L3 size, rounded to multiple of 256 bytes. */
long int __x86_64_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
long int __x86_64_shared_cache_size attribute_hidden = 1024 * 1024;
+/* Similar to __x86_64_shared_cache_size_half, but not rounded. */
+long int __x86_64_raw_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
+/* Similar to __x86_64_shared_cache_size, but not rounded. */
+long int __x86_64_raw_shared_cache_size attribute_hidden = 1024 * 1024;
#ifndef DISABLE_PREFETCHW
/* PREFETCHW support flag for use in memory and string routines. */
@@ -661,12 +669,20 @@
if (data > 0)
{
+ __x86_64_raw_data_cache_size_half = data / 2;
+ __x86_64_raw_data_cache_size = data;
+ /* Round data cache size to multiple of 256 bytes. */
+ data = data & ~255L;
__x86_64_data_cache_size_half = data / 2;
__x86_64_data_cache_size = data;
}
if (shared > 0)
{
+ __x86_64_raw_shared_cache_size_half = shared / 2;
+ __x86_64_raw_shared_cache_size = shared;
+ /* Round shared cache size to multiple of 256 bytes. */
+ shared = shared & ~255L;
__x86_64_shared_cache_size_half = shared / 2;
__x86_64_shared_cache_size = shared;
}
Modified: trunk/libc/sysdeps/x86_64/multiarch/strchr.S
==============================================================================
--- trunk/libc/sysdeps/x86_64/multiarch/strchr.S (original)
+++ trunk/libc/sysdeps/x86_64/multiarch/strchr.S Sun Nov 7 04:11:40 2010
@@ -1,5 +1,5 @@
/* strchr with SSE4.2
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010 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
@@ -87,13 +87,13 @@
pxor %xmm2, %xmm2
movd %esi, %xmm1
movl %edi, %ecx
+ pshufb %xmm2, %xmm1
andl $15, %ecx
movq %rdi, %r8
je L(aligned_start)
/* Handle unaligned string. */
andq $-16, %r8
- pshufb %xmm2, %xmm1
movdqa (%r8), %xmm0
pcmpeqb %xmm0, %xmm2
pcmpeqb %xmm1, %xmm0
Modified: trunk/ports/ChangeLog.m68k
==============================================================================
--- trunk/ports/ChangeLog.m68k (original)
+++ trunk/ports/ChangeLog.m68k Sun Nov 7 04:11:40 2010
@@ -1,3 +1,8 @@
+2010-11-05 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/m68k/fchownat.c: Include
+ i386/fchownat.c.
+
2010-10-11 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Remove fma inlines.
Modified: trunk/ports/sysdeps/unix/sysv/linux/m68k/fchownat.c
==============================================================================
--- trunk/ports/sysdeps/unix/sysv/linux/m68k/fchownat.c (original)
+++ trunk/ports/sysdeps/unix/sysv/linux/m68k/fchownat.c Sun Nov 7 04:11:40 2010
@@ -1,128 +1,1 @@
-/* Copyright (C) 2005, 2006, 2009 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 <string.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);
- if (__builtin_expect (filelen == 0, 0))
- {
- __set_errno (ENOENT);
- return -1;
- }
-
- 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;
-}
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>