[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r2029 - in /fsf/trunk/libc: ./ include/rpcsvc/ include/sys/ misc/ nis/
- To: commits@xxxxxxxxxx
- Subject: [commits] r2029 - in /fsf/trunk/libc: ./ include/rpcsvc/ include/sys/ misc/ nis/
- From: eglibc@xxxxxxxxxx
- Date: Fri, 20 Apr 2007 07:01:47 -0000
Author: eglibc
Date: Fri Apr 20 00:01:47 2007
New Revision: 2029
Log:
Import glibc-mainline for 2007-04-20
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/include/rpcsvc/nislib.h
fsf/trunk/libc/include/sys/mman.h
fsf/trunk/libc/misc/madvise.c
fsf/trunk/libc/nis/nis_call.c
fsf/trunk/libc/nis/nis_domain_of.c
fsf/trunk/libc/nis/nis_lookup.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Apr 20 00:01:47 2007
@@ -1,3 +1,22 @@
+2007-04-19 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * include/sys/mman.h: Mark madvise hidden.
+ * misc/madvise.c: Add libc_hidden_def.
+
+2007-04-06 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * nis/nis_domain_of.c (__nis_domain_of): New function.
+ * include/rpcsvc/nislib.h (__nis_domain_of): New prototype.
+ * nis/nis_lookup.c (nis_lookup): Use __nis_domain_of.
+ * nis/nis_call.c (rec_dirsearch): Likewise.
+ (first_shoot): Likewise. Remove search_parent_first argument.
+ (struct nis_server_cache): Rename search_parent_first field
+ to search_parent.
+ (nis_server_cache_search, nis_server_cache_add): Rename
+ search_parent_first argument to search_parent.
+ (__nisfind_server): Likewise. If search_parent, call
+ __nis_domain_of.
+
2007-04-18 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/posix/getaddrinfo.c: Remove commented-out code.
Modified: fsf/trunk/libc/include/rpcsvc/nislib.h
==============================================================================
--- fsf/trunk/libc/include/rpcsvc/nislib.h (original)
+++ fsf/trunk/libc/include/rpcsvc/nislib.h Fri Apr 20 00:01:47 2007
@@ -42,4 +42,6 @@
libnsl_hidden_proto (__nis_default_access)
libnsl_hidden_proto (nis_clone_object)
+extern const_nis_name __nis_domain_of (const_nis_name) __THROW;
+
#endif
Modified: fsf/trunk/libc/include/sys/mman.h
==============================================================================
--- fsf/trunk/libc/include/sys/mman.h (original)
+++ fsf/trunk/libc/include/sys/mman.h Fri Apr 20 00:01:47 2007
@@ -12,4 +12,7 @@
/* This one is Linux specific. */
extern void *__mremap (void *__addr, size_t __old_len,
size_t __new_len, int __flags, ...);
+
+libc_hidden_proto (madvise);
+
#endif
Modified: fsf/trunk/libc/misc/madvise.c
==============================================================================
--- fsf/trunk/libc/misc/madvise.c (original)
+++ fsf/trunk/libc/misc/madvise.c Fri Apr 20 00:01:47 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1995,1996,1997,2000,2007 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,5 +29,6 @@
__set_errno (ENOSYS);
return -1;
}
+libc_hidden_def (madvise)
stub_warning (madvise)
#include <stub-tag.h>
Modified: fsf/trunk/libc/nis/nis_call.c
==============================================================================
--- fsf/trunk/libc/nis/nis_call.c (original)
+++ fsf/trunk/libc/nis/nis_call.c Fri Apr 20 00:01:47 2007
@@ -422,9 +422,7 @@
case HIGHER_NAME:
{ /* We need data from a parent domain */
directory_obj *obj;
- char ndomain[strlen (dir->do_name) + 3];
-
- nis_domain_of_r (dir->do_name, ndomain, sizeof (ndomain));
+ const char *ndomain = __nis_domain_of (dir->do_name);
/* The root server of our domain is a replica of the parent
domain ! (Now I understand why a root server must be a
@@ -468,7 +466,7 @@
size_t namelen = strlen (name);
char leaf[namelen + 3];
char domain[namelen + 3];
- char ndomain[namelen + 3];
+ const char *ndomain;
char *cp;
strcpy (domain, name);
@@ -481,8 +479,8 @@
return NULL;
}
nis_leaf_of_r (domain, leaf, sizeof (leaf));
- nis_domain_of_r (domain, ndomain, sizeof (ndomain));
- strcpy (domain, ndomain);
+ ndomain = __nis_domain_of (domain);
+ memmove (domain, ndomain, strlen (ndomain) + 1);
}
while (nis_dir_cmp (domain, dir->do_name) != SAME_NAME);
@@ -535,29 +533,16 @@
/* We try to query the current server for the searched object,
maybe he know about it ? */
static directory_obj *
-first_shoot (const_nis_name name, int search_parent_first, directory_obj *dir)
+first_shoot (const_nis_name name, directory_obj *dir)
{
directory_obj *obj = NULL;
fd_result *fd_res;
XDR xdrs;
- char domain[strlen (name) + 3];
-
-#if 0
+
if (nis_dir_cmp (name, dir->do_name) == SAME_NAME)
return dir;
-#endif
-
- const char *search_name = name;
- if (search_parent_first)
- {
- nis_domain_of_r (name, domain, sizeof (domain));
- search_name = domain;
- }
-
- if (nis_dir_cmp (search_name, dir->do_name) == SAME_NAME)
- return dir;
-
- fd_res = __nis_finddirectory (dir, search_name);
+
+ fd_res = __nis_finddirectory (dir, name);
if (fd_res == NULL)
return NULL;
if (fd_res->status == NIS_SUCCESS
@@ -585,7 +570,7 @@
static struct nis_server_cache
{
- int search_parent_first;
+ int search_parent;
int uses;
unsigned int size;
unsigned int server_used;
@@ -597,7 +582,7 @@
__libc_lock_define_initialized (static, nis_server_cache_lock)
static directory_obj *
-nis_server_cache_search (const_nis_name name, int search_parent_first,
+nis_server_cache_search (const_nis_name name, int search_parent,
unsigned int *server_used, unsigned int *current_ep,
struct timeval *now)
{
@@ -621,7 +606,7 @@
free (nis_server_cache[i]);
nis_server_cache[i] = NULL;
}
- else if (nis_server_cache[i]->search_parent_first == search_parent_first
+ else if (nis_server_cache[i]->search_parent == search_parent
&& strcmp (nis_server_cache[i]->name, name) == 0)
{
ret = calloc (1, sizeof (directory_obj));
@@ -653,7 +638,7 @@
}
static void
-nis_server_cache_add (const_nis_name name, int search_parent_first,
+nis_server_cache_add (const_nis_name name, int search_parent,
directory_obj *dir, unsigned int server_used,
unsigned int current_ep, struct timeval *now)
{
@@ -672,7 +657,7 @@
new = calloc (1, sizeof (*new) + strlen (name) + 8 + size);
if (new == NULL)
return;
- new->search_parent_first = search_parent_first;
+ new->search_parent = search_parent;
new->uses = 1;
new->expires = now->tv_sec + dir->do_ttl;
new->size = size;
@@ -713,7 +698,7 @@
}
nis_error
-__nisfind_server (const_nis_name name, int search_parent_first,
+__nisfind_server (const_nis_name name, int search_parent,
directory_obj **dir, dir_binding *dbp, unsigned int flags)
{
nis_error result = NIS_SUCCESS;
@@ -732,7 +717,7 @@
(void) gettimeofday (&now, NULL);
if ((flags & NO_CACHE) == 0)
- *dir = nis_server_cache_search (name, search_parent_first, &server_used,
+ *dir = nis_server_cache_search (name, search_parent, &server_used,
¤t_ep, &now);
if (*dir != NULL)
{
@@ -762,10 +747,13 @@
return NIS_UNAVAIL;
/* Try at first, if servers in "dir" know our object */
- obj = first_shoot (name, search_parent_first, *dir);
+ const char *search_name = name;
+ if (search_parent)
+ search_name = __nis_domain_of (name);
+ obj = first_shoot (search_name, *dir);
if (obj == NULL)
{
- obj = rec_dirsearch (name, *dir, &status);
+ obj = rec_dirsearch (search_name, *dir, &status);
if (obj == NULL)
result = status;
}
@@ -786,7 +774,7 @@
current_ep = dbp->current_ep;
}
if ((flags & NO_CACHE) == 0)
- nis_server_cache_add (name, search_parent_first, obj,
+ nis_server_cache_add (name, search_parent, obj,
server_used, current_ep, &now);
}
else
Modified: fsf/trunk/libc/nis/nis_domain_of.c
==============================================================================
--- fsf/trunk/libc/nis/nis_domain_of.c (original)
+++ fsf/trunk/libc/nis/nis_domain_of.c Fri Apr 20 00:01:47 2007
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxxxxx>, 1997.
@@ -26,3 +26,17 @@
return nis_domain_of_r (name, result, NIS_MAXNAMELEN);
}
+
+const_nis_name
+__nis_domain_of (const_nis_name name)
+{
+ const_nis_name cptr = strchr (name, '.');
+
+ if (cptr++ == NULL)
+ return "";
+
+ if (*cptr == '\0')
+ return ".";
+
+ return cptr;
+}
Modified: fsf/trunk/libc/nis/nis_lookup.c
==============================================================================
--- fsf/trunk/libc/nis/nis_lookup.c (original)
+++ fsf/trunk/libc/nis/nis_lookup.c Fri Apr 20 00:01:47 2007
@@ -75,7 +75,6 @@
{
static const struct timeval RPCTIMEOUT = {10, 0};
enum clnt_stat result;
- char ndomain[strlen (req.ns_name) + 1];
again:
result = clnt_call (bptr.clnt, NIS_LOOKUP,
@@ -137,10 +136,9 @@
if (__nisbind_next (&bptr) != NIS_SUCCESS)
{
/* No more servers to search. Try parent. */
- nis_domain_of_r (req.ns_name, ndomain,
- sizeof (ndomain));
+ const char *ndomain = __nis_domain_of (req.ns_name);
req.ns_name = strdupa (ndomain);
- if (strcmp (ndomain, ".") == 0)
+ if (strcmp (req.ns_name, ".") == 0)
{
NIS_RES_STATUS (res) = NIS_NAMEUNREACHABLE;
goto out;