]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 31 Jan 1998 12:11:10 +0000 (12:11 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 31 Jan 1998 12:11:10 +0000 (12:11 +0000)
1998-01-31 20:52  Ulrich Drepper  <drepper@cygnus.com>

* nscd/grpcache.c (cache_grpinit): Let calloc do the multiplication.

* nscd/pwdcache.c (cache_pwdinit): Use thread attribute to detach
thread and no pthread_detach.

* nscd/nscd.c: Rewrite to use argp instead of getopt.

* config.make.in: Likewise.

ChangeLog
FAQ
FAQ.in
Makefile
Makerules
config.make.in
configure.in
nscd/grpcache.c
nscd/nscd.c
nscd/pwdcache.c
time/README

index ea73c1c7536a76e09933206b84ca3dd264679cbf..bcb2ac7d1da594e947fe8c6da28c1d22abd72e75 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,17 @@
+1998-01-31 20:52  Ulrich Drepper  <drepper@cygnus.com>
+
+       * nscd/grpcache.c (cache_grpinit): Let calloc do the multiplication.
+
+       * nscd/pwdcache.c (cache_pwdinit): Use thread attribute to detach
+       thread and no pthread_detach.
+
+       * nscd/nscd.c: Rewrite to use argp instead of getopt.
+
 1998-01-31  Phil Blundell  <philb@gnu.org>
 
        * configure.in: Add --without-cvs option to suppress automatic
        checkin of regenerated files.
-       * config.make: Likewise.
+       * config.make.in: Likewise.
        * Makefile: Respect with-cvs setting.
        * Makerules: Likewise.
 
diff --git a/FAQ b/FAQ
index f8d462c559dd1e55653fe761cf0e9b5f93af0fcd..a54db102da3da1576d6c7c99dfae1e98c2f42397 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -60,15 +60,17 @@ please let me know.
        were used on my Linux libc5 based system.  Why?
 2.10.  I have set up /etc/nis.conf, and the Linux libc 5 with NYS
        works great.  But the glibc NIS+ doesn't seem to work.
-2.11.  After installing glibc name resolving doesn't work properly.
-2.12.  I have /usr/include/net and /usr/include/scsi as symlinks
+2.11.  I have killed ypbind to stop using NIS, but glibc will
+        continue using NIS.
+2.12.  After installing glibc name resolving doesn't work properly.
+2.13.  I have /usr/include/net and /usr/include/scsi as symlinks
        into my Linux source tree.  Is that wrong?
-2.13.  Programs like `logname', `top', `uptime' `users', `w' and
+2.14.  Programs like `logname', `top', `uptime' `users', `w' and
        `who', show incorrect information about the (number of)
        users on my system.  Why?
-2.14.  After upgrading to glibc 2.1 with symbol versioning I get
+2.15.  After upgrading to glibc 2.1 with symbol versioning I get
        errors about undefined symbols.  What went wrong?
-2.15.  When I start the program XXX after upgrading the library
+2.16.  When I start the program XXX after upgrading the library
        I get
          XXX: Symbol `_sys_errlist' has different size in shared
          object, consider re-linking
@@ -638,14 +640,24 @@ it with nisinit from the nis-tools package (available at
 http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
 
 
-2.11.  After installing glibc name resolving doesn't work properly.
+2.11.  I have killed ypbind to stop using NIS, but glibc will
+        continue using NIS.
+
+{TK} For faster NIS lookups, glibc uses the /var/yp/binding/ files
+from ypbind.  ypbind 3.3 and older versions don't always remove these
+files, so glibc will use them furthermore.  Other BSD versions seem to
+work correct.  Until ypbind 3.4 is released, you can find a patch at
+ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc2.diff.
+
+
+2.12.  After installing glibc name resolving doesn't work properly.
 
 {AJ} You probably should read the manual section describing
 nsswitch.conf (just type `info libc "NSS Configuration File"').
 The NSS configuration file is usually the culprit.
 
 
-2.12.  I have /usr/include/net and /usr/include/scsi as symlinks
+2.13.  I have /usr/include/net and /usr/include/scsi as symlinks
        into my Linux source tree.  Is that wrong?
 
 {PB} This was necessary for libc5, but is not correct when using
@@ -656,14 +668,14 @@ any symlink that you have in place before you install glibc.  However,
 /usr/include/asm and /usr/include/linux should remain as they were.
 
 
-2.13.  Programs like `logname', `top', `uptime' `users', `w' and
+2.14.  Programs like `logname', `top', `uptime' `users', `w' and
        `who', show incorrect information about the (number of)
        users on my system.  Why?
 
 {MK} See question 3.2.
 
 
-2.14.  After upgrading to glibc 2.1 with symbol versioning I get
+2.15.  After upgrading to glibc 2.1 with symbol versioning I get
        errors about undefined symbols.  What went wrong?
 
 {AJ} The problem is caused either by wrong program code or tools.  In
@@ -677,7 +689,7 @@ the price you might have to pay once for quite a number of advantages
 with symbol versioning.
 
 
-2.15.  When I start the program XXX after upgrading the library
+2.16.  When I start the program XXX after upgrading the library
        I get
          XXX: Symbol `_sys_errlist' has different size in shared
          object, consider re-linking
diff --git a/FAQ.in b/FAQ.in
index 621e9f8c2e70b0c0b24ee6de3248d7fda1f091d7..bc7d3de276ccdc00468201594b3b315bc18c4ad5 100644 (file)
--- a/FAQ.in
+++ b/FAQ.in
@@ -520,6 +520,15 @@ client (the NIS_COLD_START file is byte order independent) or generate
 it with nisinit from the nis-tools package (available at
 http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html).
 
+??     I have killed ypbind to stop using NIS, but glibc will
+        continue using NIS.
+
+{TK} For faster NIS lookups, glibc uses the /var/yp/binding/ files
+from ypbind.  ypbind 3.3 and older versions don't always remove these
+files, so glibc will use them furthermore.  Other BSD versions seem to
+work correct.  Until ypbind 3.4 is released, you can find a patch at
+ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc2.diff.
+
 ??     After installing glibc name resolving doesn't work properly.
 
 {AJ} You probably should read the manual section describing
index bad92c6e8c492fdd462668595eb42f6a4cb96cd0..84e31d307ece620e0375104a9a49c4141263b833 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,7 @@ endif
 .PHONY: all
 all: lib others
 \f
+ifeq ($(with-cvs),yes)
 define autoconf-it
 @-rm -f $@.new
 autoconf $(ACFLAGS) $< > $@.new
@@ -35,6 +36,14 @@ chmod a-w,a+x $@.new
 mv -f $@.new $@
 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
 endef
+else
+define autoconf-it
+@-rm -f $@.new
+autoconf $(ACFLAGS) $< > $@.new
+chmod a-w,a+x $@.new
+mv -f $@.new $@
+endef
+endif
 
 configure: configure.in aclocal.m4; $(autoconf-it)
 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
index a747ac2a9ee4e36b47ca315be2418d1b41cba935..563c528b9339bec913bdd0be1dc304afb8821b24 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -956,6 +956,8 @@ $(gpl2lgpl): %: $(..)gpl2lgpl.sed /home/gd/gnu/lib/%
 # So I don't edit them by mistake.
        chmod a-w $@-tmp
        mv -f $@-tmp $@
+ifeq ($(with-cvs),yes)
        test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $^' $@
 endif
 endif
+endif
index 500333f4b0ca6c34edf3bbd60f6ba815319ba058..069d5ddf2477440efd15cf42c8ae130b5df468b6 100644 (file)
@@ -27,6 +27,7 @@ defines = @DEFINES@
 elf = @elf@
 have-initfini = @libc_cv_have_initfini@
 need-nopic-initfini = @nopic_initfini@
+with-cvs = @with_cvs@
 
 versioning = @VERSIONING@
 
index 81dffb7bc1e777f28a81d88672f51af5ca0ea3a0..ce626ca35261038616fb71f2cafbf0149605bfdc 100644 (file)
@@ -42,6 +42,10 @@ AC_ARG_WITH(binutils, dnl
 AC_ARG_WITH(elf, dnl
   --with-elf             if using the ELF object format,
            elf=$withval, elf=no)
+AC_ARG_WITH(cvs, dnl
+[  --without-cvs         if CVS should not be used],
+           with_cvs=$withval, with_cvs=yes)
+AC_SUBST(with_cvs)
 
 AC_ARG_ENABLE(libio, dnl
 [  --enable-libio          build in GNU libio instead of GNU stdio],
@@ -140,8 +144,8 @@ esac
 ### platforms.
 ###
 if test -z "$enable_hacker_mode"; then
-  case "$host_os" in
-  linux* | gnu*)
+  case "$machine-$host_os" in
+  *-linux* | *-gnu* | arm*-none*)
     ;;
   *)
     echo "*** The GNU C library is currently not available for this platform."
index 9f6c767fd7d31fbb9fb3d54dc04c5eb19c452157..71309f464f84129793cb1506bd547fbf76280d55 100644 (file)
@@ -106,13 +106,13 @@ cache_grpinit ()
   pthread_attr_t attr;
   pthread_t thread;
 
-  grptbl = calloc (1, modulo * sizeof (grphash));
+  grptbl = calloc (modulo, sizeof (grphash));
   if (grptbl == NULL)
     return -1;
-  calloc (1, modulo * sizeof (grphash));
+  calloc (modulo, sizeof (grphash));
   if (gidtbl == NULL)
     return -1;
-  negtbl = calloc (1, modulo * sizeof (neghash));
+  negtbl = calloc (modulo, sizeof (neghash));
   if (negtbl == NULL)
     return -1;
 
index 59d4a60e020826914ff93a9b4071242791109b23..7e0b32ae1974e87c889b0c94a60eb36f2e9e42eb 100644 (file)
@@ -19,8 +19,9 @@
 
 /* nscd - Name Service Cache Daemon. Caches passwd and group.  */
 
+#include <argp.h>
 #include <errno.h>
-#include <getopt.h>
+#include <error.h>
 #include <libintl.h>
 #include <locale.h>
 #include <pthread.h>
@@ -58,90 +59,59 @@ thread_info_t thread_info;
 int do_shutdown = 0;
 int disabled_passwd = 0;
 int disabled_group = 0;
+int go_background = 1;
+const char *conffile = _PATH_NSCDCONF;
 
 static void termination_handler (int signum);
 static int check_pid (const char *file);
 static int write_pid (const char *file);
-static void usage (int status) __attribute__ ((noreturn));
 static void handle_requests (void);
 
+/* Name and version of program.  */
+static void print_version (FILE *stream, struct argp_state *state);
+void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+
+/* Definitions of arguments for argp functions.  */
+static const struct argp_option options[] =
+{
+  { "config-file", 'f', N_("NAME"), 0,
+    N_("Read configuration data from NAME") },
+  { "debug", 'd', NULL, 0,
+    N_("Do not fork and display messages on the current tty") },
+  { "shutdown", 'K', NULL, 0, N_("Shut the server down") },
+  { NULL, 0, NULL, 0, NULL }
+};
+
+/* Short description of program.  */
+static const char doc[] = N_("Name Switch Cache Daemon.");
+
+/* Prototype for option handler.  */
+static error_t parse_opt __P ((int key, char *arg, struct argp_state *state));
+
+/* Data structure to communicate with argp functions.  */
+static struct argp argp =
+{
+  options, parse_opt, NULL, doc,
+};
+
 int
 main (int argc, char **argv)
 {
-  int go_background = 1;
-  const char *conffile = _PATH_NSCDCONF;
+  int remaining;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
   /* Set the text message domain.  */
   textdomain (PACKAGE);
 
-  while (1)
+  /* Parse and process arguments.  */
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+
+  if (remaining != 0)
     {
-      int c;
-      int option_index = 0;
-      static struct option long_options[] = {
-       { "debug", no_argument, NULL, 'd' },
-       { "help", no_argument, NULL, 'h' },
-       { "version", no_argument, NULL, 'V' },
-       { "shutdown", no_argument, NULL, 'K' },
-        {NULL, 0, NULL, '\0'}
-      };
-
-      c = getopt_long (argc, argv, "df:ghKV", long_options, &option_index);
-      if (c == (-1))
-        break;
-      switch (c)
-       {
-       case 'd':
-         debug_flag = 1;
-         go_background = 0;
-         break;
-       case 'f':
-         conffile = optarg;
-         break;
-       case 'h':
-         usage (EXIT_SUCCESS);
-         break;
-       case 'K':
-         if (getuid () != 0)
-           {
-             printf (_("Only root is allowed to use this option!\n\n"));
-             usage (EXIT_FAILURE);
-           }
-         {
-           int sock = __nscd_open_socket ();
-           request_header req;
-           ssize_t nbytes;
-
-           if (sock == -1)
-             exit (EXIT_FAILURE);
-
-           req.version = NSCD_VERSION;
-           req.type = SHUTDOWN;
-           req.key_len = 0;
-           nbytes = write (sock, &req, sizeof (request_header));
-           close (sock);
-           if (nbytes != req.key_len)
-             exit (EXIT_FAILURE);
-           else
-             exit (EXIT_SUCCESS);
-         }
-       case 'g':
-         print_stat ();
-         exit (EXIT_SUCCESS);
-       case 'V':
-         printf ("nscd (GNU %s) %s\n", PACKAGE, VERSION);
-         printf (_("\
-Copyright (C) %s Free Software Foundation, Inc.\n\
-This is free software; see the source for copying conditions.  There is NO\n\
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "1998");
-         printf (_("Written by %s.\n"), "Thorsten Kukuk");
-         exit (EXIT_SUCCESS);
-       default:
-         usage (EXIT_FAILURE);
-       }
+      error (0, 0, gettext ("wrong number of arguments"));
+      argp_help (&argp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
+      exit (EXIT_FAILURE);
     }
 
   signal (SIGINT, termination_handler);
@@ -190,6 +160,67 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   return 0;
 }
 
+
+/* Handle program arguments.  */
+static error_t
+parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+    {
+    case 'd':
+      debug_flag = 1;
+      go_background = 0;
+      break;
+    case 'f':
+      conffile = arg;
+      break;
+    case 'K':
+      if (getuid () != 0)
+       {
+         printf (_("Only root is allowed to use this option!\n\n"));
+         exit (EXIT_FAILURE);
+       }
+      {
+       int sock = __nscd_open_socket ();
+       request_header req;
+       ssize_t nbytes;
+
+       if (sock == -1)
+         exit (EXIT_FAILURE);
+
+       req.version = NSCD_VERSION;
+       req.type = SHUTDOWN;
+       req.key_len = 0;
+       nbytes = write (sock, &req, sizeof (request_header));
+       close (sock);
+       if (nbytes != req.key_len)
+         exit (EXIT_FAILURE);
+       else
+         exit (EXIT_SUCCESS);
+      }
+    case 'g':
+      print_stat ();
+      exit (EXIT_SUCCESS);
+    default:
+      return ARGP_ERR_UNKNOWN;
+    }
+  return 0;
+}
+
+/* Print the version information.  */
+static void
+print_version (FILE *stream, struct argp_state *state)
+{
+  fprintf (stream, "nscd (GNU %s) %s\n", PACKAGE, VERSION);
+  fprintf (stream, gettext ("\
+Copyright (C) %s Free Software Foundation, Inc.\n\
+This is free software; see the source for copying conditions.  There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
+"), "1998");
+  fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
+}
+
+
 /* Create a socket connected to a name. */
 int
 __nscd_open_socket (void)
@@ -227,31 +258,6 @@ termination_handler (int signum)
   exit (EXIT_SUCCESS);
 }
 
-/* Display usage information and exit.  */
-static void
-usage (int status)
-{
-  if (status != EXIT_SUCCESS)
-    fprintf (stderr, _("Try `%s --help' for more information.\n"),
-             program_invocation_name);
-  else
-    {
-      printf (_("\
-Usage: %s [OPTION]...\n\
-  -d, --debug           do not fork and display messages on the current tty\n\
-  -h, --help            display this help and exit\n\
-  -V, --version         output version information and exit\n\
-  -f configuration-file read configuration data from the specified file.\n\
-  -K, --shutdown        shut the server down.\n\
-  -g                    Prints configuration and statistics to stdout.\n"),
-              program_invocation_name);
-      fputs (_("\
-Report bugs using the `glibcbug' script to <bugs@gnu.org>.\n"),
-             stdout);
-    }
-  exit (status);
-}
-
 /* Returns 1 if the process in pid file FILE is running, 0 if not.  */
 static int
 check_pid (const char *file)
index a3676666da7b62ae19630e3cb80e452767ce65c9..82a26efc2581f5d6fa2ada4f540311359b37c03c 100644 (file)
@@ -103,6 +103,7 @@ set_neg_pwd_ttl (unsigned long int ttl)
 int
 cache_pwdinit ()
 {
+  pthread_attr_t attr;
   pthread_t thread;
 
   pwdtbl = calloc (modulo, sizeof (pwdhash));
@@ -115,10 +116,14 @@ cache_pwdinit ()
   if (negtbl == NULL)
     return -1;
 
-  pthread_create (&thread, NULL, pwdtable_update, (void *)NULL);
-  pthread_detach (thread);
-  pthread_create (&thread, NULL, negtable_update, (void *)NULL);
-  pthread_detach (thread);
+  pthread_attr_init (&attr);
+  pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+
+  pthread_create (&thread, NULL, pwdtable_update, &attr);
+  pthread_create (&thread, NULL, negtable_update, &attr);
+
+  pthread_attr_destroy (&attr);
+
   return 0;
 }
 
index 7875a929228295dec471345be8af1d8eaced6db0..009a7973bc3fd60f08d32449ce949b38eef68a25 100644 (file)
@@ -1,14 +1,14 @@
 The files
        zic.c zdump.c ialloc.c scheck.c tzfile.h
        private.h tzselect.ksh checktab.awk
-come from the tzcode1997h package by Arthur David Olson et.al.
+come from the tzcode1998b package by Arthur David Olson et.al.
 
 The files
        africa antarctica asia australasia europe
        northamerica southamerica pacificnew etcetera factory
        backward systemv solar87 solar88 solar89
        iso3166.tab zone.tab leapseconds yearistype
-come from the tzdata1997j package by Arthur David Olson et.al.
+come from the tzdata1998b package by Arthur David Olson et.al.
 
 These packages may be found at ftp://elsie.nci.nih.gov/pub/.  Commentary
 should be addressed to tz@elsie.nci.nih.gov.
This page took 0.064739 seconds and 5 git commands to generate.