This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/9] Add vectorized getenv for glibc use


On 05/11/2013 12:41 AM, Andi Kleen wrote:

Andi, just some comments on style below

diff --git a/elf/Makefile b/elf/Makefile
index c01ca9e..7e02623 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -35,6 +35,7 @@ dl-routines	= $(addprefix dl-,load lookup object reloc deps hwcaps \
  ifeq (yes,$(use-ldconfig))
  dl-routines += dl-cache
  endif
+dl-routines += dl-glibc-var
  all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
  # But they are absent from the shared libc, because that code is in ld.so.
  elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \
diff --git a/elf/Versions b/elf/Versions
index 2383992..caf40fc 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -54,6 +54,8 @@ ld {
      _dl_argv; _dl_find_dso_for_object; _dl_get_tls_static_info;
      _dl_deallocate_tls; _dl_make_stack_executable; _dl_out_of_memory;
      _dl_rtld_di_serinfo; _dl_starting_up; _dl_tls_setup;
+    _dl_glibc_var;
+    __glibc_var_init;

These variables should be sorted, please add your new ones at the right place.
[...]
diff --git a/include/glibc-var.h b/include/glibc-var.h
new file mode 100644
index 0000000..e84fc42
--- /dev/null
+++ b/include/glibc-var.h
@@ -0,0 +1,48 @@
+/* Fast access to GLIBC_* environment variables, without having to walk
+   the environment. Register new ones in in elf/glibc-var.c
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+#ifndef _GLIBC_VAR_H
+#define _GLIBC_VAR_H 1

Always indent these - a problem with all your patches. So, write
#ifndef...
# define
# include
# if
#  define
# endif
#else
# define
#endif

+
+#include <libc-symbols.h>
+
+enum
+{
+ GLIBC_VAR_MUTEX,
+ GLIBC_VAR_RWLOCK,
+ GLIBC_VAR_MAX
+};
+
+struct glibc_var
+{
+  const char *name;
+  int len;
+  char *val;
+};
+
+extern struct glibc_var _dl_glibc_var[];
+extern void __record_glibc_var (char *name, int len, char *val) internal_function;
+
+/* Call this if you're in a constructor that may run before glibc-var's.  */
+#ifndef SHARED
+extern void __glibc_var_init (int ac, char **av, char **env);
+#else
+/* For shared this is always done in the dynamic linker early enough.  */
+# define __glibc_var_init(a,b,c) do {} while (0)
+#endif
+
+#endif


--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]