[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r11213 - in /fsf/trunk/libc: ./ grp/ nss/ nss/nss_files/ sysdeps/generic/netinet/ sysdeps/posix/ sysdeps/unix/sysv/linux/ sy...



Author: eglibc
Date: Thu Aug 12 00:03:43 2010
New Revision: 11213

Log:
Import glibc-mainline for 2010-08-12

Added:
    fsf/trunk/libc/nss/nss_test1.c
    fsf/trunk/libc/nss/tst-nss-test1.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/prlimit.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/fanotify.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/grp/initgroups.c
    fsf/trunk/libc/nss/Makefile
    fsf/trunk/libc/nss/getXXbyYY_r.c
    fsf/trunk/libc/nss/nss_files/files-parse.c
    fsf/trunk/libc/nss/nsswitch.c
    fsf/trunk/libc/nss/nsswitch.h
    fsf/trunk/libc/shlib-versions
    fsf/trunk/libc/sysdeps/generic/netinet/ip.h
    fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile
    fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/resource.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/statfs.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_statvfs.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/inotify.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Aug 12 00:03:43 2010
@@ -1,3 +1,67 @@
+2010-08-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/bits/statfs.h (struct statfs): Add f_flags
+	field.
+	(struct statfs64): Likewise.
+	(_STATFS_F_FLAGS): Define.
+	* sysdeps/unix/sysv/linux/s390/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
+	Don't define if __ASSUME_STATFS_F_FLAGS is defined.
+	(ST_VALID): Define locally.
+	(INTERNAL_STATVFS): If f_flags has ST_VALID set don't call
+	__statvfs_getflags, use the provided value.
+	* sysdeps/unix/sysv/linux/kernel-features.h: Define
+	__ASSUME_STATFS_F_FLAGS.
+
+	* sysdeps/unix/sysv/linux/sys/inotify.h (IN_EXCL_UNLINK): Define.
+
+	* sysdeps/unix/sysv/linux/Makefile [subdir=misc] (sysdep_headers):
+	Add sys/fanotify.h.
+	* sysdeps/unix/sysv/linux/Versions [libc]: Export fanotify_init and
+	fanotify_mask for GLIBC_2.13.
+	* sysdeps/unix/sysv/linux/i386/syscalls.list: Add entries for
+	fanotify_init and fanotify_mark.
+	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/sys/fanotify.h: New file.
+
+	* sysdeps/unix/sysv/linux/Makefile [subdir=misc] (sysdep_routines):
+	Add prlimit.
+	* sysdeps/unix/sysv/linux/Versions [libc]: Export prlimit and
+	prlimit64 for GLIBC_2.13.
+	* sysdeps/unix/sysv/linux/bits/resource.h: Declare prlimit and
+	prlimit64.
+	* sysdeps/unix/sysv/linux/i386/syscalls.list: Add entry for prlimit64
+	syscall.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/sh/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.lis: Likewise.
+	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.  Also
+	add prlimit alias.
+	* sysdeps/unix/sysv/linux/prlimit.c: New file.
+
+	[BZ #11903]
+	* sysdeps/generic/netinet/ip.h (IPTOS_CLASS): Fix definition.
+	Patch by Evgeni Bikov <bikovevg@xxxxxxx>.
+
+	* nss/Makefile: Add rules to build and run tst-nss-test1.
+	* shlib-versions: Add entry for libnss_test1.
+	* nss/nss_test1.c: New file.
+	* nss/tst-nss-test1.c: New file.
+
+	* nss/nsswitch.c (__nss_database_custom): Define new variable.
+	(__nss_configure_lookup): Set appropriate entry in
+	__nss_configure_lookup to true.
+	* nss/nsswitch.h: Define enum with indeces of databases in
+	databases and __nss_database_custom arrays.  Declare
+	__nss_database_custom.
+	* grp/initgroups.c (internal_getgrouplist): Use __nss_database_custom
+	to avoid using nscd when custom rules are installed.
+	* nss/getXXbyYY_r.c: Likewise.
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
+
+	* nss/nss_files/files-parse.c: Whitespace fixes.
+
 2010-08-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #11883]

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2010-8-9
+GNU C Library NEWS -- history of user-visible changes.  2010-8-11
 Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,7 +9,9 @@
 
 * The following bugs are resolved with this release:
 
-  11640, 11701, 11840, 11856, 11883
+  11640, 11701, 11840, 11856, 11883, 11903
+
+* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
 
 * POWER7 optimizations: memset, memcmp, strncmp
 

Modified: fsf/trunk/libc/grp/initgroups.c
==============================================================================
--- fsf/trunk/libc/grp/initgroups.c (original)
+++ fsf/trunk/libc/grp/initgroups.c Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989,91,93,1996-2005,2006,2008 Free Software Foundation, Inc.
+/* Copyright (C) 1989,91,93,1996-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,8 @@
   if (__nss_not_use_nscd_group > 0
       && ++__nss_not_use_nscd_group > NSS_NSCD_RETRY)
     __nss_not_use_nscd_group = 0;
-  if (!__nss_not_use_nscd_group)
+  if (!__nss_not_use_nscd_group
+      && !__nss_database_custom[NSS_DBSIDX_group])
     {
       int n = __nscd_getgrouplist (user, group, size, groupsp, limit);
       if (n >= 0)

Modified: fsf/trunk/libc/nss/Makefile
==============================================================================
--- fsf/trunk/libc/nss/Makefile (original)
+++ fsf/trunk/libc/nss/Makefile Thu Aug 12 00:03:43 2010
@@ -1,4 +1,5 @@
-# Copyright (C) 1996-1998,2000-2002,2007,2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998,2000-2002,2007,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
@@ -39,7 +40,7 @@
 others                  := getent
 install-bin             := getent
 
-tests			= test-netdb
+tests			= test-netdb tst-nss-test1
 xtests			= bug-erange
 
 include ../Makeconfig
@@ -84,3 +85,14 @@
 # a statically-linked program that hasn't already loaded it.
 $(services:%=$(objpfx)libnss_%.so): $(common-objpfx)libc.so \
 				    $(common-objpfx)libc_nonshared.a
+
+
+distribute		+= nss_test1.c
+
+CFLAGS-nss_test1.c = -DNOT_IN_libc=1
+$(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(common-objpfx)libc.so \
+			   $(common-objpfx)libc_nonshared.a
+	$(build-module)
+$(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
+	$(make-link)
+$(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)

Modified: fsf/trunk/libc/nss/getXXbyYY_r.c
==============================================================================
--- fsf/trunk/libc/nss/getXXbyYY_r.c (original)
+++ fsf/trunk/libc/nss/getXXbyYY_r.c Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004,2006,2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -87,6 +87,8 @@
 # define NOT_USENSCD_NAME ADD_NOT_NSCDUSE (DATABASE_NAME)
 # define ADD_NOT_NSCDUSE(name) ADD_NOT_NSCDUSE1 (name)
 # define ADD_NOT_NSCDUSE1(name) __nss_not_use_nscd_##name
+# define CONCAT2(arg1, arg2) CONCAT2_2 (arg1, arg2)
+# define CONCAT2_2(arg1, arg2) arg1##arg2
 #endif
 
 #define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
@@ -186,7 +188,8 @@
   if (NOT_USENSCD_NAME > 0 && ++NOT_USENSCD_NAME > NSS_NSCD_RETRY)
     NOT_USENSCD_NAME = 0;
 
-  if (!NOT_USENSCD_NAME)
+  if (!NOT_USENSCD_NAME
+      && !__nss_database_custom[CONCAT2 (NSS_DBSIDX_, DATABASE_NAME)])
     {
       nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
 			       H_ERRNO_VAR);

Modified: fsf/trunk/libc/nss/nss_files/files-parse.c
==============================================================================
--- fsf/trunk/libc/nss/nss_files/files-parse.c (original)
+++ fsf/trunk/libc/nss/nss_files/files-parse.c Thu Aug 12 00:03:43 2010
@@ -1,5 +1,5 @@
 /* Common code for file-based database parsers in nss_files module.
-   Copyright (C) 1996-2000, 2003, 2004, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2000,2003,2004,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
@@ -29,7 +29,7 @@
    DATABASE -- string of the database file's name ("hosts", "passwd").
 
    ENTDATA -- if defined, `struct ENTDATA' is used by the parser to store
-              things pointed to by the resultant `struct STRUCTURE'.
+	      things pointed to by the resultant `struct STRUCTURE'.
 
    NEED_H_ERRNO - defined iff an arg `int *herrnop' is used.
 
@@ -229,7 +229,7 @@
   char **list = parse_list (&line, buf_start, buf_end, '\0', errnop);	      \
   if (list)								      \
     result->TRAILING_LIST_MEMBER = list;				      \
-  else 									      \
+  else									      \
     return -1;		/* -1 indicates we ran out of space.  */	      \
 }
 

Added: fsf/trunk/libc/nss/nss_test1.c
==============================================================================
--- fsf/trunk/libc/nss/nss_test1.c (added)
+++ fsf/trunk/libc/nss/nss_test1.c Thu Aug 12 00:03:43 2010
@@ -1,0 +1,154 @@
+#include <errno.h>
+#include <nss.h>
+#include <pthread.h>
+#include <string.h>
+
+
+#define COPY_IF_ROOM(s) \
+  ({ size_t len_ = strlen (s) + 1;		\
+     char *start_ = cp;				\
+     buflen - (cp - buffer) < len_		\
+     ? NULL					\
+     : (cp = mempcpy (cp, s, len_), start_); })
+
+
+/* Password handling.  */
+#include <pwd.h>
+
+static struct passwd pwd_data[] =
+  {
+#define PWD(u) \
+    { .pw_name = (char *) "name" #u, .pw_passwd = (char *) "*", .pw_uid = u,  \
+      .pw_gid = 100, .pw_gecos = (char *) "*", .pw_dir = (char *) "*",	      \
+      .pw_shell = (char *) "*" }
+    PWD (100),
+    PWD (30),
+    PWD (200),
+    PWD (60),
+    PWD (20000)
+  };
+#define npwd_data (sizeof (pwd_data) / sizeof (pwd_data[0]))
+
+static size_t pwd_iter;
+#define CURPWD pwd_data[pwd_iter]
+
+static pthread_mutex_t pwd_lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+enum nss_status
+_nss_test1_setpwent (int stayopen)
+{
+  pwd_iter = 0;
+  return NSS_STATUS_SUCCESS;
+}
+
+
+enum nss_status
+_nss_test1_endpwent (void)
+{
+  return NSS_STATUS_SUCCESS;
+}
+
+
+enum nss_status
+_nss_test1_getpwent_r (struct passwd *result, char *buffer, size_t buflen,
+		       int *errnop)
+{
+  char *cp = buffer;
+  int res = NSS_STATUS_SUCCESS;
+
+  pthread_mutex_lock (&pwd_lock);
+
+  if (pwd_iter >= npwd_data)
+    res = NSS_STATUS_NOTFOUND;
+  else
+    {
+      result->pw_name = COPY_IF_ROOM (CURPWD.pw_name);
+      result->pw_passwd = COPY_IF_ROOM (CURPWD.pw_passwd);
+      result->pw_uid = CURPWD.pw_uid;
+      result->pw_gid = CURPWD.pw_gid;
+      result->pw_gecos = COPY_IF_ROOM (CURPWD.pw_gecos);
+      result->pw_dir = COPY_IF_ROOM (CURPWD.pw_dir);
+      result->pw_shell = COPY_IF_ROOM (CURPWD.pw_shell);
+
+      if (result->pw_name == NULL || result->pw_passwd == NULL
+	  || result->pw_gecos == NULL || result->pw_dir == NULL
+	  || result->pw_shell == NULL)
+	{
+	  *errnop = ERANGE;
+	  res = NSS_STATUS_TRYAGAIN;
+	}
+
+      ++pwd_iter;
+    }
+
+  pthread_mutex_unlock (&pwd_lock);
+
+  return res;
+}
+
+
+enum nss_status
+_nss_test1_getpwuid_r (uid_t uid, struct passwd *result, char *buffer,
+		       size_t buflen, int *errnop)
+{
+  for (size_t idx = 0; idx < npwd_data; ++idx)
+    if (pwd_data[idx].pw_uid == uid)
+      {
+	char *cp = buffer;
+	int res = NSS_STATUS_SUCCESS;
+
+	result->pw_name = COPY_IF_ROOM (pwd_data[idx].pw_name);
+	result->pw_passwd = COPY_IF_ROOM (pwd_data[idx].pw_passwd);
+	result->pw_uid = pwd_data[idx].pw_uid;
+	result->pw_gid = pwd_data[idx].pw_gid;
+	result->pw_gecos = COPY_IF_ROOM (pwd_data[idx].pw_gecos);
+	result->pw_dir = COPY_IF_ROOM (pwd_data[idx].pw_dir);
+	result->pw_shell = COPY_IF_ROOM (pwd_data[idx].pw_shell);
+
+	if (result->pw_name == NULL || result->pw_passwd == NULL
+	    || result->pw_gecos == NULL || result->pw_dir == NULL
+	    || result->pw_shell == NULL)
+	  {
+	    *errnop = ERANGE;
+	    res = NSS_STATUS_TRYAGAIN;
+	  }
+
+	return res;
+      }
+
+  return NSS_STATUS_NOTFOUND;
+}
+
+
+enum nss_status
+_nss_test1_getpwnam_r (const char *name, struct passwd *result, char *buffer,
+		       size_t buflen, int *errnop)
+{
+  for (size_t idx = 0; idx < npwd_data; ++idx)
+    if (strcmp (pwd_data[idx].pw_name, name) == 0)
+      {
+	char *cp = buffer;
+	int res = NSS_STATUS_SUCCESS;
+
+	result->pw_name = COPY_IF_ROOM (pwd_data[idx].pw_name);
+	result->pw_passwd = COPY_IF_ROOM (pwd_data[idx].pw_passwd);
+	result->pw_uid = pwd_data[idx].pw_uid;
+	result->pw_gid = pwd_data[idx].pw_gid;
+	result->pw_gecos = COPY_IF_ROOM (pwd_data[idx].pw_gecos);
+	result->pw_dir = COPY_IF_ROOM (pwd_data[idx].pw_dir);
+	result->pw_shell = COPY_IF_ROOM (pwd_data[idx].pw_shell);
+
+	if (result->pw_name == NULL || result->pw_passwd == NULL
+	    || result->pw_gecos == NULL || result->pw_dir == NULL
+	    || result->pw_shell == NULL)
+	  {
+	    *errnop = ERANGE;
+	    res = NSS_STATUS_TRYAGAIN;
+	  }
+
+	return res;
+      }
+
+  return NSS_STATUS_NOTFOUND;
+}

Modified: fsf/trunk/libc/nss/nsswitch.c
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.c (original)
+++ fsf/trunk/libc/nss/nsswitch.c Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999, 2001-2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999,2001-2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -71,6 +71,9 @@
 };
 #define ndatabases (sizeof (databases) / sizeof (databases[0]))
 
+/* Flags whether custom rules for database is set.  */
+bool __nss_database_custom[NSS_DBSIDX_max];
+
 
 __libc_lock_define_initialized (static, lock)
 
@@ -265,6 +268,7 @@
 
   /* Install new rules.  */
   *databases[cnt].dbp = new_db;
+  __nss_database_custom[cnt] = true;
 
   __libc_lock_unlock (lock);
 

Modified: fsf/trunk/libc/nss/nsswitch.h
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.h (original)
+++ fsf/trunk/libc/nss/nsswitch.h Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001,2002,2003,2004,2007
+/* Copyright (C) 1996-1999,2001,2002,2003,2004,2007,2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -28,6 +28,7 @@
 #include <resolv.h>
 #include <search.h>
 #include <dlfcn.h>
+#include <stdbool.h>
 
 /* Actions performed after lookup finished.  */
 typedef enum
@@ -94,6 +95,19 @@
   /* List of libraries with service implementation.  */
   service_library *library;
 } name_database;
+
+
+/* Indices into DATABASES in nsswitch.c and __NSS_DATABASE_CUSTOM.  */
+enum
+  {
+#define DEFINE_DATABASE(arg) NSS_DBSIDX_##arg,
+#include "databases.def"
+#undef DEFINE_DATABASE
+    NSS_DBSIDX_max
+  };
+
+/* Flags whether custom rules for database is set.  */
+extern bool __nss_database_custom[NSS_DBSIDX_max];
 
 
 /* Interface functions for NSS.  */

Added: fsf/trunk/libc/nss/tst-nss-test1.c
==============================================================================
--- fsf/trunk/libc/nss/tst-nss-test1.c (added)
+++ fsf/trunk/libc/nss/tst-nss-test1.c Thu Aug 12 00:03:43 2010
@@ -1,0 +1,72 @@
+#include <nss.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+  int retval = 0;
+
+  __nss_configure_lookup ("passwd", "test1");
+
+  static const unsigned int pwdids[] = { 100, 30, 200, 60, 20000 };
+#define npwdids (sizeof (pwdids) / sizeof (pwdids[0]))
+  setpwent ();
+
+  const unsigned int *np = pwdids;
+  for (struct passwd *p = getpwent (); p != NULL; ++np, p = getpwent ())
+    if (p->pw_uid != *np || strncmp (p->pw_name, "name", 4) != 0
+	|| atol (p->pw_name + 4) != *np)
+      {
+	printf ("passwd entry %ju wrong (%s, %u)\n",
+		np - pwdids, p->pw_name, p->pw_uid);
+	retval = 1;
+	break;
+      }
+
+  endpwent ();
+
+  for (int i = npwdids - 1; i >= 0; --i)
+    {
+      char buf[30];
+      snprintf (buf, sizeof (buf), "name%u", pwdids[i]);
+
+      struct passwd *p = getpwnam (buf);
+      if (p == NULL || p->pw_uid != pwdids[i] || strcmp (buf, p->pw_name) != 0)
+	{
+	  printf ("passwd entry \"%s\" wrong\n", buf);
+	  retval = 1;
+	}
+
+      p = getpwuid (pwdids[i]);
+      if (p == NULL || p->pw_uid != pwdids[i] || strcmp (buf, p->pw_name) != 0)
+	{
+	  printf ("passwd entry %u wrong\n", pwdids[i]);
+	  retval = 1;
+	}
+
+      snprintf (buf, sizeof (buf), "name%u", pwdids[i] + 1);
+
+      p = getpwnam (buf);
+      if (p != NULL)
+	{
+	  printf ("passwd entry \"%s\" wrong\n", buf);
+	  retval = 1;
+	}
+
+      p = getpwuid (pwdids[i] + 1);
+      if (p != NULL)
+	{
+	  printf ("passwd entry %u wrong\n", pwdids[i] + 1);
+	  retval = 1;
+	}
+    }
+
+  return retval;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/shlib-versions
==============================================================================
--- fsf/trunk/libc/shlib-versions (original)
+++ fsf/trunk/libc/shlib-versions Thu Aug 12 00:03:43 2010
@@ -114,6 +114,10 @@
 .*-.*-.*		libnss_ldap=2
 .*-.*-.*		libnss_hesiod=2
 
+# Tests for NSS.  They must have the same NSS_SHLIB_REVISION number as
+# the rest.
+.*-.*-.*		libnss_test1=2
+
 # Version for libnsl with YP and NIS+ functions.
 alpha.*-.*-linux.*	libnsl=1.1
 .*-.*-.*		libnsl=1

Modified: fsf/trunk/libc/sysdeps/generic/netinet/ip.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/netinet/ip.h (original)
+++ fsf/trunk/libc/sysdeps/generic/netinet/ip.h Thu Aug 12 00:03:43 2010
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2009 Free Software
-   Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2000,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
@@ -194,7 +193,7 @@
  */
 
 #define	IPTOS_CLASS_MASK		0xe0
-#define	IPTOS_CLASS(class)		((tos) & IPTOS_CLASS_MASK)
+#define	IPTOS_CLASS(class)		((class) & IPTOS_CLASS_MASK)
 #define	IPTOS_CLASS_CS0			0x00
 #define	IPTOS_CLASS_CS1			0x20
 #define	IPTOS_CLASS_CS2			0x40

Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Thu Aug 12 00:03:43 2010
@@ -600,7 +600,8 @@
 	      && ++__nss_not_use_nscd_hosts > NSS_NSCD_RETRY)
 	    __nss_not_use_nscd_hosts = 0;
 
-	  if (!__nss_not_use_nscd_hosts)
+	  if (!__nss_not_use_nscd_hosts
+	      && !__nss_database_custom[NSS_DBSIDX_hosts])
 	    {
 	      /* Try to use nscd.  */
 	      struct nscd_ai_result *air = NULL;

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/Makefile Thu Aug 12 00:03:43 2010
@@ -18,7 +18,7 @@
 ifeq ($(subdir),misc)
 sysdep_routines += sysctl clone llseek umount umount2 readahead \
 		   setfsuid setfsgid makedev epoll_pwait signalfd \
-		   eventfd eventfd_read eventfd_write
+		   eventfd eventfd_read eventfd_write prlimit
 
 CFLAGS-gethostid.c = -fexceptions
 
@@ -30,7 +30,7 @@
 		  scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
 		  sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
 		  bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
-		  sys/timerfd.h
+		  sys/timerfd.h sys/fanotify.h
 
 install-others += $(inst_includedir)/bits/syscall.h
 

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions Thu Aug 12 00:03:43 2010
@@ -149,6 +149,11 @@
 
     recvmmsg;
   }
+  GLIBC_2.13 {
+    prlimit; prlimit64;
+
+    fanotify_init; fanotify_mark;
+  }
   GLIBC_PRIVATE {
     # functions used in other libraries
     __syscall_rt_sigqueueinfo;

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/resource.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/resource.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/resource.h Thu Aug 12 00:03:43 2010
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005, 2008, 2009
+   Copyright (C) 1994, 1996-2000, 2004, 2005, 2008, 2009, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -232,3 +232,31 @@
   PRIO_USER = 2			/* WHO is a user ID.  */
 #define PRIO_USER PRIO_USER
 };
+
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+/* Modify and return resource limits of a process atomically.  */
+# ifndef __USE_FILE_OFFSET64
+extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
+		    __const struct rlimit *__new_limit,
+		    struct rlimit *__old_limit) __THROW;
+# else
+#  ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+				     enum __rlimit_resource __resource,
+				     __const struct rlimit *__new_limit,
+				     struct rlimit *__old_limit), prlimit64);
+#  else
+#   define prlimit prlimit64
+#  endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+		      __const struct rlimit64 *__new_limit,
+		      struct rlimit64 *__old_limit) __THROW;
+# endif
+#endif
+
+__END_DECLS

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/statfs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/statfs.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/statfs.h Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002,2003,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
@@ -42,7 +42,8 @@
     __fsid_t f_fsid;
     __SWORD_TYPE f_namelen;
     __SWORD_TYPE f_frsize;
-    __SWORD_TYPE f_spare[5];
+    __SWORD_TYPE f_flags;
+    __SWORD_TYPE f_spare[4];
   };
 
 #ifdef __USE_LARGEFILE64
@@ -58,10 +59,12 @@
     __fsid_t f_fsid;
     __SWORD_TYPE f_namelen;
     __SWORD_TYPE f_frsize;
-    __SWORD_TYPE f_spare[5];
+    __SWORD_TYPE f_flags;
+    __SWORD_TYPE f_spare[4];
   };
 #endif
 
 /* Tell code we have these members.  */
 #define _STATFS_F_NAMELEN
 #define _STATFS_F_FRSIZE
+#define _STATFS_F_FLAGS

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/syscalls.list Thu Aug 12 00:03:43 2010
@@ -6,3 +6,8 @@
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@xxxxxxxxx
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@xxxxxxxxx
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
+
+fanotify_init	EXTRA	fanotify_init	i:iii	fanotify_init
+fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_statvfs.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_statvfs.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/internal_statvfs.c Thu Aug 12 00:03:43 2010
@@ -29,6 +29,11 @@
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
 #include "linux_fsinfo.h"
+#include "kernel-features.h"
+
+
+/* Special internal-only bit value.  */
+#define ST_VALID 0x0020
 
 
 #ifndef STATFS
@@ -37,6 +42,7 @@
 # define INTERNAL_STATVFS __internal_statvfs
 
 
+# ifndef __ASSUME_STATFS_F_FLAGS
 int
 __statvfs_getflags (const char *name, int fstype, struct stat64 *st)
 {
@@ -200,6 +206,7 @@
 
   return result;
 }
+# endif
 #else
 extern int __statvfs_getflags (const char *name, int fstype,
 			       struct stat64 *st);
@@ -240,9 +247,14 @@
   /* XXX I have no idea how to compute f_favail.  Any idea???  */
   buf->f_favail = buf->f_ffree;
 
-  /* Determining the flags is tricky.  We have to read /proc/mounts or
-     the /etc/mtab file and search for the entry which matches the given
-     file.  The way we can test for matching filesystem is using the
-     device number.  */
-  buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
+#ifndef __ASSUME_STATFS_F_FLAGS
+  if ((fsbuf->f_flags & ST_VALID) == 0)
+    /* Determining the flags is tricky.  We have to read /proc/mounts or
+       the /etc/mtab file and search for the entry which matches the given
+       file.  The way we can test for matching filesystem is using the
+       device number.  */
+    buf->f_flag = __statvfs_getflags (name, fsbuf->f_type, st);
+  else
+#endif
+    buf->f_flag = fsbuf->f_flags ^ ST_VALID;
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Thu Aug 12 00:03:43 2010
@@ -530,3 +530,8 @@
 #if __LINUX_KERNEL_VERSION >= 0x020621
 # define __ASSUME_RECVMMSG	1
 #endif
+
+/* statfs fills in f_flags since 2.6.36.  */
+#if __LINUX_KERNEL_VERSION >= 0x020624
+# define __ASSUME_STATFS_F_FLAGS	1
+#endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list Thu Aug 12 00:03:43 2010
@@ -6,3 +6,5 @@
 
 # Due to 64bit alignment there is a dummy second parameter
 readahead	-	readahead	i:iiiii	__readahead	readahead
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/prlimit.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/prlimit.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/prlimit.c Thu Aug 12 00:03:43 2010
@@ -1,0 +1,92 @@
+/* Copyright (C) 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
+   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 <sys/resource.h>
+#include <sys/syscall.h>
+
+
+#ifdef __NR_prlimit64
+int
+prlimit (__pid_t pid, enum __rlimit_resource resource,
+	 __const struct rlimit *new_limit, struct rlimit *old_limit)
+{
+  struct rlimit64 new_rlimit64_mem;
+  struct rlimit64 *new_rlimit64 = NULL;
+  struct rlimit64 old_rlimit64_mem;
+  struct rlimit64 *old_rlimit64 = (old_rlimiit != NULL
+				   ? &old_rlimit64_mem : NULL);
+
+  if (new_rlimit != NULL)
+    {
+      if (new_rlimit->rlim_cur == RLIM_INFINITY)
+	new_rlimit64_mem.rlim_cur = RLIM64_INFINITY;
+      else
+	new_rlimit64_mem.rlim_cur = new_rlimit->rlim_cur;
+      if (new_rlimit->rlim_max == RLIM_INFINITY)
+	new_rlimit64_mem.rlim_max =  = RLIM64_INFINITY;
+      else
+	new_rlimit64_mem.rlim_max = new_rlimit->rlim_max;
+      new_rlimit64 = &new_rlimit64_mem;
+    }
+
+  int res = INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit64,
+			    old_rlimit64);
+
+  if (res == 0 && old_limit != NULL)
+    {
+      /* The prlimit64 syscall is ill-designed for 32-bit machines.
+	 We have to provide a 32-bit variant since otherwise the LFS
+	 system would not work.  But what shall we do if the syscall
+	 succeeds but the old values do not fit into a rlimit
+	 structure?  We cannot return an error because the operation
+	 itself worked.  Best is perhaps to return RLIM_INFINITY.  */
+      old_rlimit->rlim_cur = old_rlimit64_mem.rlim_cur;
+      if (old_rlimit->rlim_cur != old_rlimit64_mem.rlim_cur)
+	{
+	  if (new_limit == NULL)
+	    {
+	      __set_errno (EOVERFLOW);
+	      return -1;
+	    }
+	  old_rlimit->rlim_cur = RLIM_INFINITY;
+	}
+      old_rlimit->rlim_max = old_rlimit64_mem.rlim_max;
+      if (old_rlimit->rlim_max != old_rlimit64_mem.rlim_max)
+	{
+	  if (new_limit == NULL)
+	    {
+	      __set_errno (EOVERFLOW);
+	      return -1;
+	    }
+	  old_rlimit->rlim_max = RLIM_INFINITY;
+	}
+    }
+
+  return res;
+}
+#else
+int
+prlimit (__pid_t pid, enum __rlimit_resource resource,
+	 __const struct rlimit *new_limit, struct rlimit *old_limit)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (prlimit)
+#endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2003, 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
@@ -42,7 +42,8 @@
     __fsid_t f_fsid;
     int f_namelen;
     int f_frsize;
-    int f_spare[5];
+    int f_flags;
+    int f_spare[4];
   };
 
 #ifdef __USE_LARGEFILE64
@@ -58,10 +59,12 @@
     __fsid_t f_fsid;
     int f_namelen;
     int f_frsize;
-    int f_spare[5];
+    int f_flags;
+    int f_spare[4];
   };
 #endif
 
 /* Tell code we have this member.  */
 #define _STATFS_F_NAMELEN
 #define _STATFS_F_FRSIZE
+#define _STATFS_F_FLAGS

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list Thu Aug 12 00:03:43 2010
@@ -3,3 +3,5 @@
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@xxxxxxxxx
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@xxxxxxxxx
 vfork		-	vfork		0	__vfork		vfork
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/syscalls.list Thu Aug 12 00:03:43 2010
@@ -1,3 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list Thu Aug 12 00:03:43 2010
@@ -4,3 +4,5 @@
 getrlimit	-	getrlimit	2	__getrlimit	getrlimit
 getresuid	-	getresuid32	3	getresuid
 getresgid	-	getresgid32	3	getresgid
+
+prlimit64	EXTRA	prlimit64	i:iipp	prlimit64

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/fanotify.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/fanotify.h (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/fanotify.h Thu Aug 12 00:03:43 2010
@@ -1,0 +1,39 @@
+/* Copyright (C) 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
+   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.  */
+
+#ifndef	_SYS_FANOTIFY_H
+#define	_SYS_FANOTIFY_H	1
+
+#include <stdint.h>
+#include <linux/fanotify.h>
+
+
+__BEGIN_DECLS
+
+/* Create and initialize fanotify group.  */
+extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags,
+			  int __priority) __THROW;
+
+/* Add, remove, or modify an fanotify mark on a filesystem object.  */
+extern int fanotify_mark (int __fanotify_fd, unsigned int __flags,
+			  uint64_t __mask, int __dfd, const char *__pathname)
+     __THROW;
+
+__END_DECLS
+
+#endif /* sys/fanotify.h */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/inotify.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/inotify.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sys/inotify.h Thu Aug 12 00:03:43 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2008, 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
@@ -72,6 +72,8 @@
 #define IN_ONLYDIR	 0x01000000	/* Only watch the path if it is a
 					   directory.  */
 #define IN_DONT_FOLLOW	 0x02000000	/* Do not follow a sym link.  */
+#define IN_EXCL_UNLINK	 0x04000000	/* Exclude events on unlinked
+					   objects.  */
 #define IN_MASK_ADD	 0x20000000	/* Add to the mask of an already
 					   existing watch.  */
 #define IN_ISDIR	 0x40000000	/* Event occurred against dir.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list Thu Aug 12 00:03:43 2010
@@ -17,3 +17,7 @@
 sync_file_range	-	sync_file_range	i:iiii	sync_file_range
 creat		-	creat		Ci:si	__libc_creat	creat creat64
 open		-	open		Ci:siv	__libc_open	__open open __open64 open64
+prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
+
+fanotify_init	EXTRA	fanotify_init	i:iii	fanotify_init
+fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark