about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-06-16 19:50:36 +0000
committerUlrich Drepper <drepper@redhat.com>2001-06-16 19:50:36 +0000
commit8fee1bb0b2373357ded21bd69dc9e33ad619493c (patch)
tree3d0b09f7d9a3c472de0ecc5f4768cd3135f6769e
parentcc765c2a2e1ab7702080b7fd2f0a7b21d8ac60ff (diff)
downloadglibc-8fee1bb0b2373357ded21bd69dc9e33ad619493c.tar.gz
glibc-8fee1bb0b2373357ded21bd69dc9e33ad619493c.tar.xz
glibc-8fee1bb0b2373357ded21bd69dc9e33ad619493c.zip
Update.
2001-06-07  Mark Kettenis  <kettenis@gnu.org>

	* grp/initgroups.c (initgroups): Factor out re-usable code into...
	(internal_getgrouplist): ... new function.
	(getgrouplist): New function.
	* grp/grp.h (getgrouplist): New prototype.
	* grp/Versions [2.2.4]: Add getgrouplist.

2001-06-16  Ulrich Drepper  <drepper@redhat.com>

	* inet/netinet/ip6.h: Fix comments in ip6_hdr.
	Patch by Pekka Savola <pekkas@netcore.fi>.
-rw-r--r--ChangeLog13
-rw-r--r--NEWS5
-rw-r--r--grp/Versions4
-rw-r--r--grp/grp.h8
-rw-r--r--grp/initgroups.c119
-rw-r--r--inet/netinet/ip6.h23
-rw-r--r--linuxthreads/ChangeLog7
7 files changed, 126 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog
index 30026f2f7b..e3f16dad0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2001-06-07  Mark Kettenis  <kettenis@gnu.org>
+
+	* grp/initgroups.c (initgroups): Factor out re-usable code into...
+	(internal_getgrouplist): ... new function.
+	(getgrouplist): New function.
+	* grp/grp.h (getgrouplist): New prototype.
+	* grp/Versions [2.2.4]: Add getgrouplist.
+
+2001-06-16  Ulrich Drepper  <drepper@redhat.com>
+
+	* inet/netinet/ip6.h: Fix comments in ip6_hdr.
+	Patch by Pekka Savola <pekkas@netcore.fi>.
+
 2001-06-15  Roland McGrath  <roland@frob.com>
 
 	* rt/Makefile (aio-routines, clock-routines, timer-routines): New
diff --git a/NEWS b/NEWS
index d0e7f899d7..f9c7dc7924 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2001-4-20
+GNU C Library NEWS -- history of user-visible changes.  2001-6-16
 Copyright (C) 1992-2000, 2001 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -10,6 +10,9 @@ Version 2.2.4
 
 * Stephen Moshier implemented cosh, expm1, log1p, acos, sinh for the
   128-bit long double format.
+
+* Bruno Haible updated all the code handling Unicode in some form to
+  support Unicode 3.1.
 
 Version 2.2.3
 
diff --git a/grp/Versions b/grp/Versions
index 36b5b70366..e01360da42 100644
--- a/grp/Versions
+++ b/grp/Versions
@@ -24,4 +24,8 @@ libc {
     # g*
     getgrent_r; getgrgid_r; getgrnam_r;
   }
+  GLIBC_2.2.4 {
+    # g*
+    getgrouplist;
+  }
 }
diff --git a/grp/grp.h b/grp/grp.h
index fc805c6f46..c70689a097 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 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
@@ -136,6 +136,12 @@ extern int fgetgrent_r (FILE *__restrict __stream,
 /* Set the group set for the current user to GROUPS (N of them).  */
 extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW;
 
+/* Store at most *NGROUPS members of the group set for USER into
+   *GROUPS.  Also include GROUP.  The actual number of groups found is
+   returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.  */
+extern int getgrouplist (__const char *__user, __gid_t __group,
+			 __gid_t *__groups, int *__ngroups) __THROW;
+
 /* Initialize the group set for the current user
    by reading the group database and using all groups
    of which USER is a member.  Also include GROUP.  */
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 89dc4d64fc..ee809d726e 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -136,50 +136,18 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
   return NSS_STATUS_SUCCESS;
 }
 
-/* Initialize the group set for the current user
-   by reading the group database and using all groups
-   of which USER is a member.  Also include GROUP.  */
-int
-initgroups (user, group)
-     const char *user;
-     gid_t group;
+static int
+internal_getgrouplist (const char *user, gid_t group, long int *size,
+		       gid_t **groupsp, long int limit)
 {
-#if defined NGROUPS_MAX && NGROUPS_MAX == 0
-
-  /* No extra groups allowed.  */
-  return 0;
-
-#else
-
   service_user *nip = NULL;
   initgroups_dyn_function fct;
   enum nss_status status = NSS_STATUS_UNAVAIL;
   int no_more;
   /* Start is one, because we have the first group as parameter.  */
   long int start = 1;
-  long int size;
-  gid_t *groups;
-  int result;
 
-  /* We always use sysconf even if NGROUPS_MAX is defined.  That way, the
-     limit can be raised in the kernel configuration without having to
-     recompile libc.  */
-  long int limit = __sysconf (_SC_NGROUPS_MAX);
-
-  if (limit > 0)
-    size = limit;
-  else
-    {
-      /* No fixed limit on groups.  Pick a starting buffer size.  */
-      size = 16;
-    }
-
-  groups = (gid_t *) malloc (size * sizeof (gid_t));
-  if (__builtin_expect (groups == NULL, 0))
-    /* No more memory.  */
-    return -1;
-
-  groups[0] = group;
+  *groupsp[0] = group;
 
   if (__nss_group_database != NULL)
     {
@@ -196,14 +164,14 @@ initgroups (user, group)
 
       if (fct == NULL)
 	{
-	  status = compat_call (nip, user, group, &start, &size, &groups,
+	  status = compat_call (nip, user, group, &start, size, groupsp,
 				limit, &errno);
 
 	  if (nss_next_action (nip, NSS_STATUS_UNAVAIL) != NSS_ACTION_CONTINUE)
 	    break;
 	}
       else
-	status = DL_CALL_FCT (fct, (user, group, &start, &size, &groups,
+	status = DL_CALL_FCT (fct, (user, group, &start, size, groupsp,
 				    limit, &errno));
 
       /* This is really only for debugging.  */
@@ -220,10 +188,81 @@ initgroups (user, group)
 	nip = nip->next;
     }
 
+  return start;
+}
+
+/* Store at most *NGROUPS members of the group set for USER into
+   *GROUPS.  Also include GROUP.  The actual number of groups found is
+   returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.  */
+int
+getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
+{
+  gid_t *newgroups;
+  long int size = *ngroups;
+  int result;
+
+  newgroups = (gid_t *) malloc (size * sizeof (gid_t));
+  if (__builtin_expect (newgroups == NULL, 0))
+    /* No more memory.  */
+    return -1;
+
+  result = internal_getgrouplist (user, group, &size, &newgroups, -1);
+  if (result > *ngroups)
+    {
+      *ngroups = result;
+      result = -1;
+    }
+  else
+    *ngroups = result;
+      
+  memcpy (groups, newgroups, *ngroups * sizeof (gid_t));
+
+  free (newgroups);
+  return result;
+}
+
+/* Initialize the group set for the current user
+   by reading the group database and using all groups
+   of which USER is a member.  Also include GROUP.  */
+int
+initgroups (const char *user, gid_t group)
+{
+#if defined NGROUPS_MAX && NGROUPS_MAX == 0
+
+  /* No extra groups allowed.  */
+  return 0;
+
+#else
+
+  long int size;
+  gid_t *groups;
+  int ngroups;
+  int result;
+
+ /* We always use sysconf even if NGROUPS_MAX is defined.  That way, the
+     limit can be raised in the kernel configuration without having to
+     recompile libc.  */
+  long int limit = __sysconf (_SC_NGROUPS_MAX);
+
+  if (limit > 0)
+    size = limit;
+  else
+    {
+      /* No fixed limit on groups.  Pick a starting buffer size.  */
+      size = 16;
+    }
+
+  groups = (gid_t *) malloc (size * sizeof (gid_t));
+  if (__builtin_expect (groups == NULL, 0))
+    /* No more memory.  */
+    return -1;
+
+  ngroups = internal_getgrouplist (user, group, &size, &groups, limit);
+
   /* Try to set the maximum number of groups the kernel can handle.  */
   do
-    result = setgroups (start, groups);
-  while (result == -1 && errno == EINVAL && --start > 0);
+    result = setgroups (ngroups, groups);
+  while (result == -1 && errno == EINVAL && --ngroups > 0);
 
   free (groups);
 
diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h
index cd42ef64b9..976fa885ca 100644
--- a/inet/netinet/ip6.h
+++ b/inet/netinet/ip6.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997, 2001 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
@@ -22,18 +22,19 @@
 #include <inttypes.h>
 #include <netinet/in.h>
 
-struct ip6_hdr 
+struct ip6_hdr
   {
-    union 
+    union
       {
-	struct ip6_hdrctl 
+	struct ip6_hdrctl
 	  {
-	    uint32_t ip6_un1_flow;   /* 24 bits of flow-ID */
+	    uint32_t ip6_un1_flow;   /* 4 bits version, 8 bits TC,
+					20 bits flow-ID */
 	    uint16_t ip6_un1_plen;   /* payload length */
 	    uint8_t  ip6_un1_nxt;    /* next header */
 	    uint8_t  ip6_un1_hlim;   /* hop limit */
 	  } ip6_un1;
-	uint8_t ip6_un2_vfc;       /* 4 bits version, 4 bits priority */
+	uint8_t ip6_un2_vfc;       /* 4 bits version, top 4 bits tclass */
       } ip6_ctlun;
     struct in6_addr ip6_src;      /* source address */
     struct in6_addr ip6_dst;      /* destination address */
@@ -47,7 +48,7 @@ struct ip6_hdr
 #define ip6_hops  ip6_ctlun.ip6_un1.ip6_un1_hlim
 
 /* Hop-by-Hop options header.  */
-struct ip6_hbh 
+struct ip6_hbh
   {
     uint8_t  ip6h_nxt;        /* next hesder.  */
     uint8_t  ip6h_len;        /* length in units of 8 octets.  */
@@ -55,7 +56,7 @@ struct ip6_hbh
   };
 
 /* Destination options header */
-struct ip6_dest 
+struct ip6_dest
   {
     uint8_t  ip6d_nxt;        /* next header */
     uint8_t  ip6d_len;        /* length in units of 8 octets */
@@ -63,7 +64,7 @@ struct ip6_dest
   };
 
 /* Routing header */
-struct ip6_rthdr 
+struct ip6_rthdr
   {
     uint8_t  ip6r_nxt;        /* next header */
     uint8_t  ip6r_len;        /* length in units of 8 octets */
@@ -73,7 +74,7 @@ struct ip6_rthdr
   };
 
 /* Type 0 Routing header */
-struct ip6_rthdr0 
+struct ip6_rthdr0
   {
     uint8_t  ip6r0_nxt;       /* next header */
     uint8_t  ip6r0_len;       /* length in units of 8 octets */
@@ -85,7 +86,7 @@ struct ip6_rthdr0
   };
 
 /* Fragment header */
-struct ip6_frag 
+struct ip6_frag
   {
     uint8_t   ip6f_nxt;       /* next header */
     uint8_t   ip6f_reserved;  /* reserved field */
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 9153fb9f61..c60416d2bc 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,10 @@
+2001-03-23  Matthew Wilcox  <willy@ldl.fc.hp.com>
+
+	* attr.c: Make _STACK_GROWS_UP work.
+	* internals.h: Likewise.
+	* manager.c: Likewise.
+	* pthread.c: Likewise.
+
 2001-06-15  H.J. Lu  <hjl@gnu.org>
 
 	* pthread.c (__pthread_reset_main_thread): Fix a typo.