This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch roland/disable-nscd created. glibc-2.16-ports-merge-210-g5c4ff95


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, roland/disable-nscd has been created
        at  5c4ff95422a9d477ccc302159aa96c956850c51d (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5c4ff95422a9d477ccc302159aa96c956850c51d

commit 5c4ff95422a9d477ccc302159aa96c956850c51d
Author: Roland McGrath <roland@hack.frob.com>
Date:   Thu Aug 16 15:00:34 2012 -0700

    BZ#13696: Add --disable-nscd configure option.

diff --git a/ChangeLog b/ChangeLog
index 6cb87f2..86ff36c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,41 @@
 2012-08-16  Roland McGrath  <roland@hack.frob.com>
 
+	[BZ# 13696]
+	* configure.in (use_nscd): New substituted variable, set by
+	--disable-nscd.  If enabled, define USE_NSCD.
+	* configure: Regenerated.
+	* config.h.in: Add USE_NSCD.
+	* config.make.in (use-nscd): New substituted variable.
+	* inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise.
+	(CFLAGS-gethstbynm_r.c, CFLAGS-gethstbynm2_r.c): Likewise.
+	(CFLAGS-getsrvbynm_r.c, CFLAGS-getsrvbypt_r.c): Variables removed.
+	* grp/Makefile (CFLAGS-getgrgid_r.c): Remove -DUSE_NSCD.
+	(CFLAGS-getgrnam_r.c): Likewise.
+	(CFLAGS-initgroups.c): Likewise.
+	* posix/Makefile (CFLAGS-getaddrinfo.c): Remove -DUSE_NSCD.
+	* pwd/Makefile (CFLAGS-getpwuid_r.c, CFLAGS-getpwnam_r.c):
+	Variables removed.
+	* inet/getnetgrent_r.c
+	(nscd_setnetgrent): New function, broken out of ...
+	(setnetgrent): ... here.  Call it.
+	(innetgr): Conditionalize nscd bits on [USE_NSCD].
+	* nscd/Makefile (routines, aux): Move definitions after include of
+	Makeconfig.  Conditionalize on [$(use-nscd) != no].
+	* nss/nsswitch.c (nss_load_all_libraries, __nss_disable_nscd):
+	Conditionalize on [USE_NSCD].
+	(is_nscd, nscd_init_cb): Likewise.
+	(nss_load_library): Conditionalize init callback on [USE_NSCD].
+	* nss/nss_files/files-init.c: Conditionalize body on [USE_NSCD].
+	* nss/nss_db/db-init.c: Likewise.
+	* nscd/nscd.c (main): Conditionalize __nss_disable_nscd call on
+	[USE_NSCD].
+	* sysdeps/unix/sysv/linux/check_pf.c (get_nl_timestamp): New function.
+	(make_request): Use it.
+	(cache_valid_p): New function.
+	(__check_pf): Use it.
+
+2012-08-16  Roland McGrath  <roland@hack.frob.com>
+
 	* inet/getnetgrent_r.c (internal_setnetgrent): Renamed to ...
 	(__internal_setnetgrent): ... this.  Add internal_function to
 	definition.  Add libc_hidden_def.
diff --git a/config.h.in b/config.h.in
index e27e86d..10a9925 100644
--- a/config.h.in
+++ b/config.h.in
@@ -174,6 +174,9 @@
 /* Define if Systemtap <sys/sdt.h> probes should be defined.  */
 #undef USE_STAP_PROBE
 
+/* Define if library functions should try to contact the nscd daemon.  */
+#undef USE_NSCD
+
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index 65410ab..62aea26 100644
--- a/config.make.in
+++ b/config.make.in
@@ -99,6 +99,7 @@ sysdeps-add-ons = @sysdeps_add_ons@
 cross-compiling = @cross_compiling@
 force-install = @force_install@
 link-obsolete-rpc = @link_obsolete_rpc@
+use-nscd = @use_nscd@
 
 # Build tools.
 CC = @CC@
diff --git a/configure b/configure
index facb6a5..c61a1ca 100755
--- a/configure
+++ b/configure
@@ -597,6 +597,7 @@ libc_cv_sysconfdir
 libc_cv_localedir
 libc_cv_slibdir
 old_glibc_headers
+use_nscd
 libc_cv_gcc_unwind_find_fde
 libc_extra_cflags
 CPPUNDEFS
@@ -749,6 +750,7 @@ enable_multi_arch
 enable_nss_crypt
 enable_obsolete_rpc
 enable_systemtap
+enable_nscd
 with_cpu
 '
       ac_precious_vars='build_alias
@@ -1407,6 +1409,7 @@ Optional Features:
   --enable-obsolete-rpc   build and install the obsolete RPC code for
                           link-time usage
   --enable-systemtap      enable systemtap static probe points [default=no]
+  --disable-nscd          library functions will not contact the nscd daemon
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3751,6 +3754,15 @@ See \`config.log' for more details" "$LINENO" 5; }
   fi
 fi
 
+# Note the use of $use_nscd is near the bottom of the file.
+# Check whether --enable-nscd was given.
+if test "${enable_nscd+set}" = set; then :
+  enableval=$enable_nscd; use_nscd=$enableval
+else
+  use_nscd=yes
+fi
+
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
@@ -7402,6 +7414,14 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
 fi
 
 
+# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
+# configure fragment can override the value to prevent this AC_DEFINE.
+
+if test "x$use_nscd" != xno; then
+  $as_echo "#define USE_NSCD 1" >>confdefs.h
+
+fi
+
 # Test for old glibc 2.0.x headers so that they can be removed properly
 # Search only in includedir.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for old glibc 2.0.x headers" >&5
diff --git a/configure.in b/configure.in
index 1219b9f..c490fde 100644
--- a/configure.in
+++ b/configure.in
@@ -292,6 +292,13 @@ void foo (int i, void *p)
   fi
 fi
 
+# Note the use of $use_nscd is near the bottom of the file.
+AC_ARG_ENABLE([nscd],
+	      [AS_HELP_STRING([--disable-nscd],
+	       [library functions will not contact the nscd daemon])],
+	      [use_nscd=$enableval],
+	      [use_nscd=yes])
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
@@ -2098,6 +2105,13 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then
 fi
 AC_SUBST(libc_cv_gcc_unwind_find_fde)
 
+# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
+# configure fragment can override the value to prevent this AC_DEFINE.
+AC_SUBST(use_nscd)
+if test "x$use_nscd" != xno; then
+  AC_DEFINE([USE_NSCD])
+fi
+
 # Test for old glibc 2.0.x headers so that they can be removed properly
 # Search only in includedir.
 AC_MSG_CHECKING(for old glibc 2.0.x headers)
diff --git a/grp/Makefile b/grp/Makefile
index 127310f..d09537c 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -39,14 +39,14 @@ include ../Rules
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-getgrgid_r.c = -DUSE_NSCD=1 -fexceptions
-CFLAGS-getgrnam_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-getgrgid_r.c = -fexceptions
+CFLAGS-getgrnam_r.c = -fexceptions
 CFLAGS-getgrent_r.c = -fexceptions
 CFLAGS-getgrent.c = -fexceptions
 CFLAGS-fgetgrent.c = -fexceptions
 CFLAGS-fgetgrent_r.c = -fexceptions -D_IO_MTSAFE_IO
 CFLAGS-putgrent.c = -fexceptions -D_IO_MTSAFE_IO
-CFLAGS-initgroups.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-initgroups.c = -fexceptions
 CFLAGS-getgrgid.c = -fexceptions
 
 endif
diff --git a/inet/Makefile b/inet/Makefile
index 80e2d7a..1af5dc7 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -56,11 +56,11 @@ include ../Rules
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-gethstbyad_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbyad_r.c = -fexceptions
 CFLAGS-gethstbyad.c = -fexceptions
-CFLAGS-gethstbynm_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm_r.c = -fexceptions
 CFLAGS-gethstbynm.c = -fexceptions
-CFLAGS-gethstbynm2_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm2_r.c = -fexceptions
 CFLAGS-gethstbynm2.c = -fexceptions
 CFLAGS-gethstent_r.c = -fexceptions
 CFLAGS-gethstent.c = -fexceptions
@@ -77,8 +77,6 @@ CFLAGS-getrpcent_r.c = -fexceptions
 CFLAGS-getrpcent.c = -fexceptions
 CFLAGS-getservent_r.c = -fexceptions
 CFLAGS-getservent.c = -fexceptions
-CFLAGS-getsrvbynm_r.c = -DUSE_NSCD=1
-CFLAGS-getsrvbypt_r.c = -DUSE_NSCD=1
 CFLAGS-getprtent_r.c = -fexceptions
 CFLAGS-getprtent.c = -fexceptions
 CFLAGS-either_ntoh.c = -fexceptions
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index c57e7de..145e089 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -182,28 +182,32 @@ __internal_setnetgrent (const char *group, struct __netgrent *datap)
 }
 libc_hidden_def (__internal_setnetgrent)
 
-int
-setnetgrent (const char *group)
+static int
+nscd_setnetgrent (const char *group)
 {
-  int result;
-
-  __libc_lock_lock (lock);
-
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
 
   if (!__nss_not_use_nscd_netgroup
       && !__nss_database_custom[NSS_DBSIDX_netgroup])
-    {
-      result = __nscd_setnetgrent (group, &dataset);
-      if (result >= 0)
-	goto out;
-    }
+    return __nscd_setnetgrent (group, &dataset);
+#endif
+  return -1;
+}
+
+int
+setnetgrent (const char *group)
+{
+  int result;
 
-  result = __internal_setnetgrent (group, &dataset);
+  __libc_lock_lock (lock);
+
+  result = nscd_setnetgrent (group);
+  if (result < 0)
+    result = __internal_setnetgrent (group, &dataset);
 
- out:
   __libc_lock_unlock (lock);
 
   return result;
@@ -375,6 +379,7 @@ int
 innetgr (const char *netgroup, const char *host, const char *user,
 	 const char *domain)
 {
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
@@ -386,6 +391,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
       if (result >= 0)
 	return result;
     }
+#endif
 
   union
   {
diff --git a/nscd/Makefile b/nscd/Makefile
index ba052eb..de26f06 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -20,11 +20,13 @@
 #
 subdir	:= nscd
 
+include ../Makeconfig
+
+ifneq ($(use-nscd),no)
 routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
 	    nscd_initgroups nscd_getserv_r nscd_netgroup
 aux	:= nscd_helper
-
-include ../Makeconfig
+endif
 
 # To find xmalloc.c
 vpath %.c ../locale/programs
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 79fb32f..bee9ed4 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -305,8 +305,10 @@ main (int argc, char **argv)
 # endif
 #endif
 
+#ifdef USE_NSCD
   /* Make sure we do not get recursive calls.  */
   __nss_disable_nscd (register_traced_file);
+#endif
 
   /* Init databases.  */
   nscd_init ();
diff --git a/nss/nss_db/db-init.c b/nss/nss_db/db-init.c
index d23e8f8..26508c2 100644
--- a/nss/nss_db/db-init.c
+++ b/nss/nss_db/db-init.c
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifdef USE_NSCD
+
 #include <paths.h>
 #include <nscd/nscd.h>
 #include <string.h>
@@ -51,3 +53,5 @@ _nss_db_init (void (*cb) (size_t, struct traced_file *))
   strcpy (serv_traced_file.file.fname, _PATH_VARDB "services.db");
   cb (servdb, &serv_traced_file.file);
 }
+
+#endif
diff --git a/nss/nss_files/files-init.c b/nss/nss_files/files-init.c
index 18757cb..d58bd82 100644
--- a/nss/nss_files/files-init.c
+++ b/nss/nss_files/files-init.c
@@ -1,5 +1,5 @@
 /* Initialization in nss_files module.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 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
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifdef USE_NSCD
+
 #include <nscd/nscd.h>
 
 
@@ -55,3 +57,5 @@ _nss_files_init (void (*cb) (size_t, struct traced_file *))
 
   cb (netgrdb, &netgr_traced_file.file);
 }
+
+#endif
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index a2628c7..750cd02 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -92,10 +92,12 @@ static name_database *service_table;
 static name_database_entry *defconfig_entries;
 
 
+#ifdef USE_NSCD
 /* Nonzero if this is the nscd process.  */
 static bool is_nscd;
 /* The callback passed to the init functions when nscd is used.  */
 static void (*nscd_init_cb) (size_t, struct traced_file *);
+#endif
 
 
 /* -1 == database not found
@@ -358,6 +360,7 @@ nss_load_library (service_user *ni)
 	  ni->library->lib_handle = (void *) -1l;
 	  __set_errno (saved_errno);
 	}
+# ifdef USE_NSCD
       else if (is_nscd)
 	{
 	  /* Call the init function when nscd is used.  */
@@ -377,12 +380,13 @@ nss_load_library (service_user *ni)
 	  if (ifct != NULL)
 	    {
 	      void (*cb) (size_t, struct traced_file *) = nscd_init_cb;
-# ifdef PTR_DEMANGLE
+#  ifdef PTR_DEMANGLE
 	      PTR_DEMANGLE (cb);
-# endif
+#  endif
 	      ifct (cb);
 	    }
 	}
+# endif
     }
 
   return 0;
@@ -808,7 +812,7 @@ nss_new_service (name_database *database, const char *name)
 }
 
 
-#ifdef SHARED
+#if defined SHARED && defined USE_NSCD
 /* Load all libraries for the service.  */
 static void
 nss_load_all_libraries (const char *service, const char *def)
diff --git a/posix/Makefile b/posix/Makefile
index 922f9c0..3560bb2 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -134,7 +134,7 @@ $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
 	mv -f $@.new $@
 
 CFLAGS-regex.c = -Wno-strict-prototypes
-CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
+CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions
 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/pwd/Makefile b/pwd/Makefile
index 1da4059..5f2c4c1 100644
--- a/pwd/Makefile
+++ b/pwd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1996-1999,2003,2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 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
@@ -31,8 +31,6 @@ include ../Rules
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-getpwuid_r.c = -DUSE_NSCD=1
-CFLAGS-getpwnam_r.c = -DUSE_NSCD=1
 CFLAGS-getpwent_r.c = -fexceptions
 CFLAGS-getpwent.c = -fexceptions
 CFLAGS-getpw.c = -fexceptions
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 950498a..eebb3a4 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -78,6 +78,29 @@ __bump_nl_timestamp (void)
 }
 #endif
 
+static inline uint32_t
+get_nl_timestamp (void)
+{
+#ifdef IS_IN_nscd
+  return nl_timestamp;
+#elif defined USE_NSCD
+  return __nscd_get_nl_timestamp ();
+#else
+  return 0;
+#endif
+}
+
+static inline bool
+cache_valid_p (void)
+{
+  if (cache != NULL)
+    {
+      uint32_t timestamp = get_nl_timestamp ();
+      return timestamp != 0 && cache->timestamp == timestamp;
+    }
+  return false;
+}
+
 
 static struct cached_data *
 make_request (int fd, pid_t pid)
@@ -253,11 +276,7 @@ make_request (int fd, pid_t pid)
       if (result == NULL)
 	goto out_fail;
 
-#ifdef IS_IN_nscd
-      result->timestamp = nl_timestamp;
-#else
-      result->timestamp = __nscd_get_nl_timestamp ();
-#endif
+      result->timestamp = get_nl_timestamp ();
       result->usecnt = 2;
       result->seen_ipv4 = seen_ipv4;
       result->seen_ipv6 = true;
@@ -302,14 +321,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
 
   __libc_lock_lock (lock);
 
-#ifdef IS_IN_nscd
-# define cache_valid() nl_timestamp != 0 && cache->timestamp == nl_timestamp
-#else
-# define cache_valid() \
-      ({ uint32_t val = __nscd_get_nl_timestamp ();			      \
-	 val != 0 && cache->timestamp == val; })
-#endif
-  if (cache != NULL && cache_valid ())
+  if (cache_valid_p ())
     {
       data = cache;
       atomic_increment (&cache->usecnt);

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


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