mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-28 07:41:05 +00:00
* nis/nss_nis/nis-alias.c: Optimize use of yperr2nss. Avoid calling
it for YPERR_SUCCESS. Minor cleanups. Add __builtin_expect. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-initgroups.c: Likewise. * nis/nss_nis/nis-netgrp.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-publickey.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise.
This commit is contained in:
parent
7960f2a704
commit
ab9a9ff8a1
15
ChangeLog
15
ChangeLog
@ -1,5 +1,20 @@
|
||||
2006-04-08 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* nis/nss_nis/nis-alias.c: Optimize use of yperr2nss. Avoid calling
|
||||
it for YPERR_SUCCESS. Minor cleanups. Add __builtin_expect.
|
||||
* nis/nss_nis/nis-ethers.c: Likewise.
|
||||
* nis/nss_nis/nis-grp.c: Likewise.
|
||||
* nis/nss_nis/nis-hosts.c: Likewise.
|
||||
* nis/nss_nis/nis-initgroups.c: Likewise.
|
||||
* nis/nss_nis/nis-netgrp.c: Likewise.
|
||||
* nis/nss_nis/nis-network.c: Likewise.
|
||||
* nis/nss_nis/nis-proto.c: Likewise.
|
||||
* nis/nss_nis/nis-publickey.c: Likewise.
|
||||
* nis/nss_nis/nis-pwd.c: Likewise.
|
||||
* nis/nss_nis/nis-rpc.c: Likewise.
|
||||
* nis/nss_nis/nis-service.c: Likewise.
|
||||
* nis/nss_nis/nis-spwd.c: Likewise.
|
||||
|
||||
* nis/nis_ping.c: Remove unnecessary conditionals before
|
||||
nis_freeresult calls.
|
||||
* nis/nis_ismember.c: Likewise.
|
||||
|
@ -125,52 +125,53 @@ internal_nis_getaliasent_r (struct aliasent *alias, char *buffer,
|
||||
size_t buflen, int *errnop)
|
||||
{
|
||||
char *domain;
|
||||
char *result;
|
||||
int len;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
char *p;
|
||||
int parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
alias->alias_local = 0;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *result;
|
||||
int len;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "mail.aliases",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "mail.aliases", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "mail.aliases", oldkey,
|
||||
oldkeylen, &outkey, &keylen,
|
||||
&result, &len));
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
yperr = yp_next (domain, "mail.aliases", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer, buflen,
|
||||
errnop);
|
||||
if (parse_res == -1)
|
||||
parse_res = _nss_nis_parse_aliasent (outkey, p, alias, buffer,
|
||||
buflen, errnop);
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*errnop = ERANGE;
|
||||
@ -216,7 +217,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
|
||||
char name2[namlen + 1];
|
||||
|
||||
char *domain;
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* Convert name to lowercase. */
|
||||
@ -227,17 +228,18 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
|
||||
|
||||
char *result;
|
||||
int len;
|
||||
enum nss_status retval = yperr2nss (yp_match (domain, "mail.aliases", name2,
|
||||
namlen, &result, &len));
|
||||
int yperr = yp_match (domain, "mail.aliases", name2, namlen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -253,7 +255,7 @@ _nss_nis_getaliasbyname_r (const char *name, struct aliasent *alias,
|
||||
alias->alias_local = 0;
|
||||
int parse_res = _nss_nis_parse_aliasent (name, p, alias, buffer, buflen,
|
||||
errnop);
|
||||
if (parse_res < 1)
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -182,45 +182,46 @@ enum nss_status
|
||||
_nss_nis_gethostton_r (const char *name, struct etherent *eth,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "ethers.byname", name,
|
||||
strlen (name), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "ethers.byname", name, strlen (name), &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@ -234,22 +235,18 @@ enum nss_status
|
||||
_nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, nlen, parse_res;
|
||||
char buf[33];
|
||||
|
||||
if (addr == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
nlen = sprintf (buf, "%x:%x:%x:%x:%x:%x",
|
||||
char buf[33];
|
||||
int nlen = snprintf (buf, sizeof (buf), "%x:%x:%x:%x:%x:%x",
|
||||
(int) addr->ether_addr_octet[0],
|
||||
(int) addr->ether_addr_octet[1],
|
||||
(int) addr->ether_addr_octet[2],
|
||||
@ -257,31 +254,35 @@ _nss_nis_getntohost_r (const struct ether_addr *addr, struct etherent *eth,
|
||||
(int) addr->ether_addr_octet[4],
|
||||
(int) addr->ether_addr_octet[5]);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "ethers.byaddr", buf,
|
||||
nlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "ethers.byaddr", buf, nlen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_etherent (p, eth, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_etherent (p, eth, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-1999, 2001-2003, 2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1999, 2001-2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -71,49 +71,52 @@ static enum nss_status
|
||||
internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *outkey;
|
||||
int len, keylen, parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
char *result;
|
||||
char *outkey;
|
||||
int len;
|
||||
int keylen;
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "group.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "group.byname", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "group.byname",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_next (domain, "group.byname", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*errnop = ERANGE;
|
||||
@ -149,45 +152,46 @@ enum nss_status
|
||||
_nss_nis_getgrnam_r (const char *name, struct group *grp,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "group.byname", name,
|
||||
strlen (name), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "group.byname", name, strlen (name), &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@ -201,42 +205,42 @@ enum nss_status
|
||||
_nss_nis_getgrgid_r (gid_t gid, struct group *grp,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, nlen, parse_res;
|
||||
char buf[32];
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
nlen = sprintf (buf, "%lu", (unsigned long int) gid);
|
||||
char buf[32];
|
||||
int nlen = sprintf (buf, "%lu", (unsigned long int) gid);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "group.bygid", buf,
|
||||
nlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "group.bygid", buf, nlen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2000, 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -131,17 +131,11 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
|
||||
int af, int flags)
|
||||
{
|
||||
char *domain;
|
||||
char *result;
|
||||
int len, parse_res;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
struct parser_data *data = (void *) buffer;
|
||||
size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
if (buflen < sizeof *data + 1)
|
||||
struct parser_data *data = (void *) buffer;
|
||||
if (__builtin_expect (buflen < sizeof *data + 1, 0))
|
||||
{
|
||||
*errnop = ERANGE;
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
@ -149,21 +143,26 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
|
||||
}
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
const size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
|
||||
char *result;
|
||||
int len;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
int yperr;
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "hosts.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "hosts.byname", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "hosts.byname",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
switch (retval)
|
||||
{
|
||||
case NSS_STATUS_TRYAGAIN:
|
||||
@ -180,7 +179,7 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > linebuflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
@ -188,14 +187,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (data->linebuffer, result, len);
|
||||
char *p = strncpy (data->linebuffer, result, len);
|
||||
data->linebuffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
|
||||
if (parse_res == -1)
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
@ -235,11 +234,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
char *buffer, size_t buflen, int *errnop,
|
||||
int *h_errnop, int flags)
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
struct parser_data *data = (void *) buffer;
|
||||
size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
@ -247,6 +242,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
char *domain;
|
||||
if (yp_get_default_domain (&domain))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
@ -256,8 +252,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Convert name to lowercase. */
|
||||
size_t namlen = strlen (name);
|
||||
char name2[namlen + 1];
|
||||
@ -267,13 +262,14 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
name2[i] = tolower (name[i]);
|
||||
name2[i] = '\0';
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "hosts.byname", name2,
|
||||
namlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "hosts.byname", name2, namlen, &result, &len);
|
||||
|
||||
}
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
{
|
||||
*h_errnop = TRY_AGAIN;
|
||||
@ -284,7 +280,8 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > linebuflen)
|
||||
const size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
@ -292,15 +289,15 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (data->linebuffer, result, len);
|
||||
char *p = strncpy (data->linebuffer, result, len);
|
||||
data->linebuffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
|
||||
int parse_res = parse_line (p, host, data, buflen, errnop, af, flags);
|
||||
|
||||
if (parse_res < 1 || host->h_addrtype != af)
|
||||
if (__builtin_expect (parse_res < 1 || host->h_addrtype != af, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
{
|
||||
@ -351,42 +348,42 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
|
||||
struct hostent *host, char *buffer, size_t buflen,
|
||||
int *errnop, int *h_errnop)
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
char *buf;
|
||||
struct parser_data *data = (void *) buffer;
|
||||
size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
if (buflen < sizeof *data + 1)
|
||||
struct parser_data *data = (void *) buffer;
|
||||
if (__builtin_expect (buflen < sizeof *data + 1, 0))
|
||||
{
|
||||
*errnop = ERANGE;
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
buf = inet_ntoa (*(const struct in_addr *) addr);
|
||||
char *buf = inet_ntoa (*(const struct in_addr *) addr);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "hosts.byaddr", buf,
|
||||
strlen (buf), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "hosts.byaddr", buf, strlen (buf), &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
{
|
||||
*h_errnop = TRY_AGAIN;
|
||||
*errnop = errno;
|
||||
}
|
||||
if (retval == NSS_STATUS_NOTFOUND)
|
||||
else if (retval == NSS_STATUS_NOTFOUND)
|
||||
*h_errnop = HOST_NOT_FOUND;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > linebuflen)
|
||||
const size_t linebuflen = buffer + buflen - data->linebuffer;
|
||||
if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -394,15 +391,16 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (data->linebuffer, result, len);
|
||||
char *p = strncpy (data->linebuffer, result, len);
|
||||
data->linebuffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = parse_line (p, host, data, buflen, errnop, af,
|
||||
((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
|
||||
if (parse_res < 1)
|
||||
int parse_res = parse_line (p, host, data, buflen, errnop, af,
|
||||
((_res.options & RES_USE_INET6)
|
||||
? AI_V4MAPPED : 0));
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
||||
|
||||
@ -99,25 +99,23 @@ static enum nss_status
|
||||
internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
|
||||
int *errnop, intern_t *intern)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if (intern->start == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
if (intern->next == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
|
||||
p = strncpy (buffer, intern->next->val, buflen);
|
||||
char *p = strncpy (buffer, intern->next->val, buflen);
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
|
||||
parse_res = _nss_files_parse_grent (p, grp, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
parse_res = _nss_files_parse_grent (p, grp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
intern->next = intern->next->next;
|
||||
}
|
||||
@ -166,13 +164,12 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
|
||||
ssize_t keylen = snprintf (key, sizeof (key), "unix.%lu@%s",
|
||||
(unsigned long int) uid, domainname);
|
||||
|
||||
enum nss_status retval;
|
||||
char *result;
|
||||
int reslen;
|
||||
retval = yperr2nss (yp_match (domainname, "netid.byname", key, keylen,
|
||||
&result, &reslen));
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
return retval;
|
||||
int yperr = yp_match (domainname, "netid.byname", key, keylen, &result,
|
||||
&reslen);
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
return yperr2nss (yperr);
|
||||
|
||||
/* Parse the result: following the colon is a comma separated list of
|
||||
group IDs. */
|
||||
@ -207,7 +204,6 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
|
||||
if (*start == *size)
|
||||
{
|
||||
/* Need a bigger buffer. */
|
||||
gid_t *newgroups;
|
||||
long int newsize;
|
||||
|
||||
if (limit > 0 && *size == limit)
|
||||
@ -219,7 +215,7 @@ initgroups_netid (uid_t uid, gid_t group, long int *start, long int *size,
|
||||
else
|
||||
newsize = MIN (limit, 2 * *size);
|
||||
|
||||
newgroups = realloc (groups, newsize * sizeof (*groups));
|
||||
gid_t *newgroups = realloc (groups, newsize * sizeof (*groups));
|
||||
if (newgroups == NULL)
|
||||
goto errout;
|
||||
*groupsp = groups = newgroups;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005
|
||||
/* Copyright (C) 1996,1997,1999,2000,2002,2003,2004,2005,2006
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
@ -47,24 +47,25 @@ internal_nis_endnetgrent (struct __netgrent *netgrp)
|
||||
netgrp->cursor = NULL;
|
||||
}
|
||||
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_setnetgrent (const char *group, struct __netgrent *netgrp)
|
||||
{
|
||||
char *domain;
|
||||
int len;
|
||||
enum nss_status status;
|
||||
|
||||
status = NSS_STATUS_SUCCESS;
|
||||
|
||||
if (group == NULL || group[0] == '\0')
|
||||
if (__builtin_expect (group == NULL || group[0] == '\0', 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
status = yperr2nss (yp_match (domain, "netgroup", group, strlen (group),
|
||||
&netgrp->data, &len));
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
|
||||
{
|
||||
/* Our implementation of yp_match already allocates a buffer
|
||||
which is one byte larger than the value in LEN specifies
|
||||
@ -90,6 +91,7 @@ _nss_nis_endnetgrent (struct __netgrent *netgrp)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_getnetgrent_r (struct __netgrent *result, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2003, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@ -73,28 +73,32 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
|
||||
int *errnop, int *herrnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *outkey;
|
||||
int len, keylen, parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
char *result;
|
||||
char *outkey;
|
||||
int len;
|
||||
int keylen;
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "networks.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "networks.byname", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "networks.byname",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_next (domain, "networks.byname", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
{
|
||||
*herrnop = NETDB_INTERNAL;
|
||||
@ -103,7 +107,7 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -111,14 +115,14 @@ internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*herrnop = NETDB_INTERNAL;
|
||||
@ -155,11 +159,6 @@ enum nss_status
|
||||
_nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
|
||||
size_t buflen, int *errnop, int *herrnop)
|
||||
{
|
||||
enum nss_status retval;
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
@ -167,17 +166,18 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
struct parser_data *data = (void *) buffer;
|
||||
if (buflen < sizeof *data + 1)
|
||||
{
|
||||
*herrnop = NETDB_INTERNAL;
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Convert name to lowercase. */
|
||||
size_t namlen = strlen (name);
|
||||
char name2[namlen + 1];
|
||||
@ -187,13 +187,15 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
|
||||
name2[i] = _tolower (name[i]);
|
||||
name2[i] = '\0';
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "networks.byname", name2,
|
||||
namlen, &result, &len));
|
||||
}
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "networks.byname", name2, namlen, &result,
|
||||
&len);
|
||||
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
{
|
||||
*errnop = errno;
|
||||
@ -202,7 +204,7 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -210,15 +212,15 @@ _nss_nis_getnetbyname_r (const char *name, struct netent *net, char *buffer,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
|
||||
int parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
|
||||
|
||||
if (parse_res < 1)
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
*herrnop = NETDB_INTERNAL;
|
||||
if (parse_res == -1)
|
||||
@ -235,32 +237,26 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
|
||||
char *buffer, size_t buflen, int *errnop,
|
||||
int *herrnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain;
|
||||
char *result;
|
||||
int len;
|
||||
char buf[256];
|
||||
int blen;
|
||||
struct in_addr in;
|
||||
char *p;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
in = inet_makeaddr (addr, 0);
|
||||
strcpy (buf, inet_ntoa (in));
|
||||
blen = strlen (buf);
|
||||
struct in_addr in = inet_makeaddr (addr, 0);
|
||||
char *buf = inet_ntoa (in);
|
||||
size_t blen = strlen (buf);
|
||||
|
||||
while (1)
|
||||
{
|
||||
enum nss_status retval;
|
||||
int parse_res;
|
||||
char *result;
|
||||
int len;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "networks.byaddr", buf,
|
||||
strlen (buf), &result, &len));
|
||||
int yperr = yp_match (domain, "networks.byaddr", buf, blen, &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_NOTFOUND)
|
||||
{
|
||||
if (buf[blen - 2] == '.' && buf[blen - 1] == '0')
|
||||
@ -282,7 +278,7 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
|
||||
}
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -290,15 +286,16 @@ _nss_nis_getnetbyaddr_r (uint32_t addr, int type, struct netent *net,
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_netent (p, net, data, buflen, errnop);
|
||||
int parse_res = _nss_files_parse_netent (p, net, (void *) buffer,
|
||||
buflen, errnop);
|
||||
|
||||
if (parse_res < 1)
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
*herrnop = NETDB_INTERNAL;
|
||||
if (parse_res == -1)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-1998, 2000-2003, 2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1998, 2000-2004, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -179,45 +179,46 @@ enum nss_status
|
||||
_nss_nis_getprotobyname_r (const char *name, struct protoent *proto,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "protocols.byname", name,
|
||||
strlen (name), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "protocols.byname", name, strlen (name),
|
||||
&result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@ -231,42 +232,43 @@ enum nss_status
|
||||
_nss_nis_getprotobynumber_r (int number, struct protoent *proto,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, nlen, parse_res;
|
||||
char buf[32];
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
nlen = sprintf (buf, "%d", number);
|
||||
char buf[32];
|
||||
int nlen = snprintf (buf, sizeof (buf), "%d", number);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "protocols.bynumber", buf,
|
||||
nlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "protocols.bynumber", buf, nlen, &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_protoent (p, proto, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_protoent (p, proto, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -36,10 +36,6 @@ extern int xdecrypt (char *, char *);
|
||||
enum nss_status
|
||||
_nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *domain, *result;
|
||||
int len;
|
||||
|
||||
pkey[0] = 0;
|
||||
|
||||
if (netname == NULL)
|
||||
@ -48,19 +44,23 @@ _nss_nis_getpublickey (const char *netname, char *pkey, int *errnop)
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
domain = strchr (netname, '@');
|
||||
if (!domain)
|
||||
char *domain = strchr (netname, '@');
|
||||
if (domain == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
++domain;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "publickey.byname", netname,
|
||||
strlen (netname), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
|
||||
&result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
@ -82,11 +82,6 @@ enum nss_status
|
||||
_nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
|
||||
int *errnop)
|
||||
{
|
||||
enum nss_status retval;
|
||||
char buf[2 * (HEXKEYBYTES + 1)];
|
||||
char *domain, *result;
|
||||
int len;
|
||||
|
||||
skey[0] = 0;
|
||||
|
||||
if (netname == NULL || passwd == NULL)
|
||||
@ -95,19 +90,23 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
domain = strchr (netname, '@');
|
||||
if (!domain)
|
||||
char *domain = strchr (netname, '@');
|
||||
if (domain == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
++domain;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "publickey.byname", netname,
|
||||
strlen (netname), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "publickey.byname", netname, strlen (netname),
|
||||
&result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
@ -118,6 +117,8 @@ _nss_nis_getsecretkey (const char *netname, char *skey, char *passwd,
|
||||
char *p = strchr (result, ':');
|
||||
if (p != NULL)
|
||||
{
|
||||
char buf[2 * (HEXKEYBYTES + 1)];
|
||||
|
||||
++p;
|
||||
strncpy (buf, p, 2 * (HEXKEYBYTES + 1));
|
||||
buf[2 * HEXKEYBYTES + 1] = '\0';
|
||||
@ -195,13 +196,8 @@ enum nss_status
|
||||
_nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
|
||||
gid_t *gidp, int *gidlenp, gid_t *gidlist, int *errnop)
|
||||
{
|
||||
char *domain;
|
||||
int yperr;
|
||||
char *lookup;
|
||||
int len;
|
||||
|
||||
domain = strchr (netname, '@');
|
||||
if (!domain)
|
||||
char *domain = strchr (netname, '@');
|
||||
if (domain == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
@ -209,8 +205,9 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
|
||||
|
||||
/* Point past the '@' character */
|
||||
++domain;
|
||||
lookup = NULL;
|
||||
yperr = yp_match (domain, "netid.byname", netname, strlen (netname),
|
||||
char *lookup = NULL;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "netid.byname", netname, strlen (netname),
|
||||
&lookup, &len);
|
||||
switch (yperr)
|
||||
{
|
||||
@ -224,17 +221,15 @@ _nss_nis_netname2user (char netname[MAXNETNAMELEN + 1], uid_t *uidp,
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (lookup)
|
||||
{
|
||||
enum nss_status err;
|
||||
|
||||
lookup[len] = '\0';
|
||||
err = parse_netid_str (lookup, uidp, gidp, gidlenp, gidlist);
|
||||
free (lookup);
|
||||
return err;
|
||||
}
|
||||
else
|
||||
if (lookup == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
|
||||
lookup[len] = '\0';
|
||||
|
||||
enum nss_status err = parse_netid_str (lookup, uidp, gidp, gidlenp, gidlist);
|
||||
|
||||
free (lookup);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@ -71,31 +71,31 @@ static enum nss_status
|
||||
internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain;
|
||||
int parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *result, *outkey, *result2, *p;
|
||||
int len, keylen, len2;
|
||||
size_t namelen;
|
||||
char *result;
|
||||
char *outkey;
|
||||
int len;
|
||||
int keylen;
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "passwd.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "passwd.byname", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "passwd.byname",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_next (domain, "passwd.byname", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
@ -103,7 +103,10 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
|
||||
|
||||
/* Check for adjunct style secret passwords. They can be
|
||||
recognized by a password starting with "##". */
|
||||
p = strchr (result, ':');
|
||||
char *p = strchr (result, ':');
|
||||
size_t namelen;
|
||||
char *result2;
|
||||
int len2;
|
||||
if (p != NULL /* This better should be true in all cases. */
|
||||
&& p[1] == '#' && p[2] == '#'
|
||||
&& (namelen = p - result,
|
||||
@ -128,7 +131,8 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
|
||||
}
|
||||
|
||||
restlen = len - (p - result);
|
||||
if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
|
||||
if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
|
||||
+ restlen + 2) > buflen, 0))
|
||||
{
|
||||
free (result2);
|
||||
free (result);
|
||||
@ -147,7 +151,7 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
|
||||
else
|
||||
{
|
||||
non_adjunct:
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -162,8 +166,9 @@ internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*errnop = ERANGE;
|
||||
@ -199,28 +204,26 @@ enum nss_status
|
||||
_nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *result2, *p;
|
||||
int len, len2, parse_res;
|
||||
size_t namelen;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
namelen = strlen (name);
|
||||
size_t namelen = strlen (name);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "passwd.byname", name,
|
||||
namelen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "passwd.byname", name, namelen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
@ -228,7 +231,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
|
||||
/* Check for adjunct style secret passwords. They can be recognized
|
||||
by a password starting with "##". */
|
||||
p = strchr (result, ':');
|
||||
char *result2;
|
||||
int len2;
|
||||
char *p = strchr (result, ':');
|
||||
if (p != NULL /* This better should be true in all cases. */
|
||||
&& p[1] == '#' && p[2] == '#'
|
||||
&& yp_match (domain, "passwd.adjunct.byname", name, namelen,
|
||||
@ -238,7 +243,6 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
therein into original result. */
|
||||
char *encrypted = strchr (result2, ':');
|
||||
char *endp;
|
||||
size_t restlen;
|
||||
|
||||
if (encrypted == NULL
|
||||
|| (endp = strchr (++encrypted, ':')) == NULL
|
||||
@ -251,8 +255,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
goto non_adjunct;
|
||||
}
|
||||
|
||||
restlen = len - (p - result);
|
||||
if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
|
||||
size_t restlen = len - (p - result);
|
||||
if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
|
||||
+ restlen + 2) > buflen, 0))
|
||||
{
|
||||
free (result2);
|
||||
free (result);
|
||||
@ -271,7 +276,7 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
else
|
||||
{
|
||||
non_adjunct:
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -286,8 +291,9 @@ _nss_nis_getpwnam_r (const char *name, struct passwd *pwd,
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@ -302,23 +308,21 @@ enum nss_status
|
||||
_nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p, *result2;
|
||||
int len, nlen, parse_res, len2;
|
||||
char buf[32];
|
||||
size_t namelen;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
nlen = sprintf (buf, "%lu", (unsigned long int) uid);
|
||||
char buf[32];
|
||||
int nlen = snprintf (buf, sizeof (buf), "%lu", (unsigned long int) uid);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "passwd.byuid", buf,
|
||||
nlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "passwd.byuid", buf, nlen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
@ -326,7 +330,10 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||
|
||||
/* Check for adjunct style secret passwords. They can be recognized
|
||||
by a password starting with "##". */
|
||||
p = strchr (result, ':');
|
||||
char *result2;
|
||||
int len2;
|
||||
size_t namelen;
|
||||
char *p = strchr (result, ':');
|
||||
if (p != NULL /* This better should be true in all cases. */
|
||||
&& p[1] == '#' && p[2] == '#'
|
||||
&& (namelen = p - result,
|
||||
@ -351,7 +358,8 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||
}
|
||||
|
||||
restlen = len - (p - result);
|
||||
if ((size_t) (namelen + (endp - encrypted) + restlen + 2) > buflen)
|
||||
if (__builtin_expect ((size_t) (namelen + (endp - encrypted)
|
||||
+ restlen + 2) > buflen, 0))
|
||||
{
|
||||
free (result2);
|
||||
free (result);
|
||||
@ -370,7 +378,7 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||
else
|
||||
{
|
||||
non_adjunct:
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
@ -385,8 +393,9 @@ _nss_nis_getpwuid_r (uid_t uid, struct passwd *pwd,
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_pwent (p, pwd, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_pwent (p, pwd, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 1996-1998,2000,2002,2003,2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1998,2000,2002,2003,2004,2006
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -158,7 +159,7 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
|
||||
++p;
|
||||
|
||||
parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
data->next = data->next->next;
|
||||
}
|
||||
@ -186,21 +187,18 @@ enum nss_status
|
||||
_nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
intern_t data = {NULL, NULL};
|
||||
enum nss_status status;
|
||||
int found;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
status = internal_nis_setrpcent (&data);
|
||||
if (status != NSS_STATUS_SUCCESS)
|
||||
intern_t data = { NULL, NULL };
|
||||
enum nss_status status = internal_nis_setrpcent (&data);
|
||||
if (__builtin_expect (status != NSS_STATUS_SUCCESS, 0))
|
||||
return status;
|
||||
|
||||
found = 0;
|
||||
int found = 0;
|
||||
while (!found &&
|
||||
((status = internal_nis_getrpcent_r (rpc, buffer, buflen, errnop,
|
||||
&data)) == NSS_STATUS_SUCCESS))
|
||||
@ -226,9 +224,9 @@ _nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
|
||||
|
||||
internal_nis_endrpcent (&data);
|
||||
|
||||
if (!found && status == NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (!found && status == NSS_STATUS_SUCCESS, 0))
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
else
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -236,43 +234,42 @@ enum nss_status
|
||||
_nss_nis_getrpcbynumber_r (int number, struct rpcent *rpc,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, nlen, parse_res;
|
||||
char buf[32];
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
nlen = sprintf (buf, "%d", number);
|
||||
char buf[32];
|
||||
int nlen = snprintf (buf, sizeof (buf), "%d", number);
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "rpc.bynumber", buf,
|
||||
nlen, &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "rpc.bynumber", buf, nlen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_rpcent (p, rpc, data, buflen, errnop);
|
||||
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_rpcent (p, rpc, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2004, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
|
||||
|
||||
@ -98,29 +98,26 @@ dosearch (int instatus, char *inkey, int inkeylen, char *inval,
|
||||
{
|
||||
struct search_t *req = (struct search_t *) indata;
|
||||
|
||||
if (instatus != YP_TRUE)
|
||||
if (__builtin_expect (instatus != YP_TRUE, 0))
|
||||
return 1;
|
||||
|
||||
if (inkey && inkeylen > 0 && inval && invallen > 0)
|
||||
{
|
||||
struct parser_data *pdata = (void *) req->buffer;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if ((size_t) (invallen + 1) > req->buflen)
|
||||
if (__builtin_expect ((size_t) (invallen + 1) > req->buflen, 0))
|
||||
{
|
||||
*req->errnop = ERANGE;
|
||||
req->status = NSS_STATUS_TRYAGAIN;
|
||||
return 1;
|
||||
}
|
||||
|
||||
p = strncpy (req->buffer, inval, invallen);
|
||||
char *p = strncpy (req->buffer, inval, invallen);
|
||||
req->buffer[invallen] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
|
||||
parse_res = _nss_files_parse_servent (p, req->serv, pdata, req->buflen,
|
||||
req->errnop);
|
||||
int parse_res = _nss_files_parse_servent (p, req->serv,
|
||||
(void *) req->buffer,
|
||||
req->buflen, req->errnop);
|
||||
if (parse_res == -1)
|
||||
{
|
||||
req->status = NSS_STATUS_TRYAGAIN;
|
||||
@ -237,7 +234,7 @@ internal_nis_getservent_r (struct servent *serv, char *buffer,
|
||||
++p;
|
||||
|
||||
parse_res = _nss_files_parse_servent (p, serv, pdata, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
data->next = data->next->next;
|
||||
}
|
||||
@ -266,60 +263,56 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol,
|
||||
struct servent *serv, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
enum nss_status status;
|
||||
char *domain;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* If the protocol is given, we could try if our NIS server knows
|
||||
about services.byservicename map. If yes, we only need one query. */
|
||||
char key[strlen (name) + (protocol ? strlen (protocol) : 0) + 2];
|
||||
char *cp, *result;
|
||||
size_t keylen, len;
|
||||
int int_len;
|
||||
size_t keylen = strlen (name) + 1 + (protocol ? strlen (protocol) : 0);
|
||||
char key[keylen + 1];
|
||||
|
||||
/* key is: "name/proto" */
|
||||
cp = stpcpy (key, name);
|
||||
if (protocol)
|
||||
char *cp = stpcpy (key, name);
|
||||
if (protocol != NULL)
|
||||
{
|
||||
*cp++ = '/';
|
||||
strcpy (cp, protocol);
|
||||
}
|
||||
keylen = strlen (key);
|
||||
status = yperr2nss (yp_match (domain, "services.byservicename", key,
|
||||
|
||||
char *result;
|
||||
int int_len;
|
||||
enum nss_status status = yperr2nss (yp_match (domain,
|
||||
"services.byservicename", key,
|
||||
keylen, &result, &int_len));
|
||||
len = int_len;
|
||||
size_t len = int_len;
|
||||
|
||||
/* If we found the key, it's ok and parse the result. If not,
|
||||
fall through and parse the complete table. */
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1))
|
||||
{
|
||||
struct parser_data *pdata = (void *) buffer;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
parse_res = _nss_files_parse_servent (p, serv, pdata,
|
||||
|
||||
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
|
||||
buflen, errnop);
|
||||
if (parse_res < 0)
|
||||
if (__builtin_expect (parse_res < 0, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@ -360,10 +353,8 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
|
||||
struct servent *serv, char *buffer,
|
||||
size_t buflen, int *errnop)
|
||||
{
|
||||
enum nss_status status;
|
||||
char *domain;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* If the protocol is given, we only need one query.
|
||||
@ -372,47 +363,44 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
|
||||
const char *proto = protocol != NULL ? protocol : "tcp";
|
||||
do
|
||||
{
|
||||
char key[sizeof (int) * 3 + strlen (proto) + 2];
|
||||
char *result;
|
||||
size_t keylen, len;
|
||||
int int_len;
|
||||
|
||||
/* key is: "port/proto" */
|
||||
keylen = snprintf (key, sizeof (key), "%d/%s", ntohs (port), proto);
|
||||
status = yperr2nss (yp_match (domain, "services.byname", key,
|
||||
keylen, &result, &int_len));
|
||||
len = int_len;
|
||||
char key[sizeof (int) * 3 + strlen (proto) + 2];
|
||||
size_t keylen = snprintf (key, sizeof (key), "%d/%s", ntohs (port),
|
||||
proto);
|
||||
|
||||
char *result;
|
||||
int int_len;
|
||||
enum nss_status status = yperr2nss (yp_match (domain, "services.byname",
|
||||
key, keylen, &result,
|
||||
&int_len));
|
||||
size_t len = int_len;
|
||||
|
||||
/* If we found the key, it's ok and parse the result. If not,
|
||||
fall through and parse the complete table. */
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
{
|
||||
struct parser_data *pdata = (void *) buffer;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
parse_res = _nss_files_parse_servent (p, serv, pdata,
|
||||
int parse_res = _nss_files_parse_servent (p, serv, (void *) buffer,
|
||||
buflen, errnop);
|
||||
if (parse_res < 0)
|
||||
if (__builtin_expect (parse_res < 0, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
else
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
}
|
||||
else
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -434,7 +422,8 @@ _nss_nis_getservbyport_r (int port, const char *protocol,
|
||||
req.buflen = buflen;
|
||||
req.errnop = errnop;
|
||||
req.status = NSS_STATUS_NOTFOUND;
|
||||
status = yperr2nss (yp_all (domain, "services.byname", &ypcb));
|
||||
enum nss_status status = yperr2nss (yp_all (domain, "services.byname",
|
||||
&ypcb));
|
||||
|
||||
if (status != NSS_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@ -69,48 +69,53 @@ internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,
|
||||
int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *outkey;
|
||||
int len, keylen, parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
int parse_res;
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
char *result;
|
||||
char *outkey;
|
||||
int len;
|
||||
int keylen;
|
||||
int yperr;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "shadow.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_first (domain, "shadow.byname", &outkey, &keylen, &result,
|
||||
&len);
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "shadow.byname",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
yperr = yp_next (domain, "shadow.byname", oldkey, oldkeylen, &outkey,
|
||||
&keylen, &result, &len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop);
|
||||
if (parse_res == -1)
|
||||
parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res == -1, 0))
|
||||
{
|
||||
free (outkey);
|
||||
*errnop = ERANGE;
|
||||
@ -146,45 +151,46 @@ enum nss_status
|
||||
_nss_nis_getspnam_r (const char *name, struct spwd *sp,
|
||||
char *buffer, size_t buflen, int *errnop)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
char *domain, *result, *p;
|
||||
int len, parse_res;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
*errnop = EINVAL;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
char *domain;
|
||||
if (__builtin_expect (yp_get_default_domain (&domain), 0))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
retval = yperr2nss (yp_match (domain, "shadow.byname", name,
|
||||
strlen (name), &result, &len));
|
||||
char *result;
|
||||
int len;
|
||||
int yperr = yp_match (domain, "shadow.byname", name, strlen (name), &result,
|
||||
&len);
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
|
||||
{
|
||||
enum nss_status retval = yperr2nss (yperr);
|
||||
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
*errnop = errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
|
||||
{
|
||||
free (result);
|
||||
*errnop = ERANGE;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
char *p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_spent (p, sp, data, buflen, errnop);
|
||||
if (parse_res < 1)
|
||||
int parse_res = _nss_files_parse_spent (p, sp, (void *) buffer, buflen,
|
||||
errnop);
|
||||
if (__builtin_expect (parse_res < 1, 0))
|
||||
{
|
||||
if (parse_res == -1)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
@ -1,5 +1,14 @@
|
||||
2006-04-08 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Remove branch predicion
|
||||
suffix for conditional jumps.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Likewise.
|
||||
|
||||
* init.c (sigcancel_handler): Compare with correct PID even if the
|
||||
thread is in the middle of a fork call.
|
||||
(sighandler_setxid): Likewise.
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef UP
|
||||
# define LOCK \
|
||||
cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \
|
||||
je,pt 0f; \
|
||||
je 0f; \
|
||||
lock; \
|
||||
0:
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ __lll_mutex_lock_wait:
|
||||
xchgl %eax, (%ebx) /* NB: lock is implied */
|
||||
|
||||
testl %eax, %eax
|
||||
jnz,pn 1b
|
||||
jnz 1b
|
||||
|
||||
popl %esi
|
||||
popl %ebx
|
||||
|
@ -82,7 +82,7 @@ pthread_barrier_wait:
|
||||
#else
|
||||
cmpl %edx, CURR_EVENT(%ebx)
|
||||
#endif
|
||||
je,pn 8b
|
||||
je 8b
|
||||
|
||||
/* Increment LEFT. If this brings the count back to the
|
||||
initial count unlock the object. */
|
||||
@ -92,7 +92,7 @@ pthread_barrier_wait:
|
||||
xaddl %edx, LEFT(%ebx)
|
||||
subl $1, %ecx
|
||||
cmpl %ecx, %edx
|
||||
jne,pt 10f
|
||||
jne 10f
|
||||
|
||||
/* Release the mutex. We cannot release the lock before
|
||||
waking the waiting threads since otherwise a new thread might
|
||||
@ -131,7 +131,7 @@ pthread_barrier_wait:
|
||||
xaddl %edx, LEFT(%ebx)
|
||||
subl $1, %ecx
|
||||
cmpl %ecx, %edx
|
||||
jne,pt 5f
|
||||
jne 5f
|
||||
|
||||
/* Release the mutex. We cannot release the lock before
|
||||
waking the waiting threads since otherwise a new thread might
|
||||
|
@ -49,12 +49,12 @@ sem_timedwait:
|
||||
|
||||
movl (%ecx), %eax
|
||||
2: testl %eax, %eax
|
||||
je,pn 1f
|
||||
je 1f
|
||||
|
||||
leal -1(%eax), %edx
|
||||
LOCK
|
||||
cmpxchgl %edx, (%ecx)
|
||||
jne,pn 2b
|
||||
jne 2b
|
||||
|
||||
xorl %eax, %eax
|
||||
ret
|
||||
@ -117,7 +117,7 @@ sem_timedwait:
|
||||
call __pthread_disable_asynccancel
|
||||
|
||||
testl %esi, %esi
|
||||
je,pt 9f
|
||||
je 9f
|
||||
cmpl $-EWOULDBLOCK, %esi
|
||||
jne 3f
|
||||
|
||||
@ -128,7 +128,7 @@ sem_timedwait:
|
||||
leal -1(%eax), %ecx
|
||||
LOCK
|
||||
cmpxchgl %ecx, (%ebx)
|
||||
jne,pn 8b
|
||||
jne 8b
|
||||
|
||||
addl $12, %esp
|
||||
cfi_adjust_cfa_offset(-12)
|
||||
|
@ -42,7 +42,7 @@ __new_sem_trywait:
|
||||
leal -1(%eax), %edx
|
||||
LOCK
|
||||
cmpxchgl %edx, (%ecx)
|
||||
jne,pn 2b
|
||||
jne 2b
|
||||
xorl %eax, %eax
|
||||
ret
|
||||
|
||||
|
@ -62,7 +62,7 @@ __new_sem_wait:
|
||||
leal -1(%eax), %edx
|
||||
LOCK
|
||||
cmpxchgl %edx, (%ebx)
|
||||
jne,pn 2b
|
||||
jne 2b
|
||||
xorl %eax, %eax
|
||||
|
||||
movl 4(%esp), %esi
|
||||
|
@ -384,7 +384,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
|
||||
# define lll_trylock(futex) \
|
||||
({ unsigned char ret; \
|
||||
__asm __volatile ("cmpl $0, %%gs:%P5\n\t" \
|
||||
"je,pt 0f\n\t" \
|
||||
"je 0f\n\t" \
|
||||
"lock\n" \
|
||||
"0:\tcmpxchgl %2, %1; setne %0" \
|
||||
: "=a" (ret), "=m" (futex) \
|
||||
@ -398,7 +398,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
|
||||
# define lll_lock(futex) \
|
||||
(void) ({ int ignore1, ignore2; \
|
||||
__asm __volatile ("cmpl $0, %%gs:%P6\n\t" \
|
||||
"je,pt 0f\n\t" \
|
||||
"je 0f\n\t" \
|
||||
"lock\n" \
|
||||
"0:\tcmpxchgl %1, %2\n\t" \
|
||||
"jnz _L_mutex_lock_%=\n\t" \
|
||||
@ -420,7 +420,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
|
||||
# define lll_unlock(futex) \
|
||||
(void) ({ int ignore; \
|
||||
__asm __volatile ("cmpl $0, %%gs:%P3\n\t" \
|
||||
"je,pt 0f\n\t" \
|
||||
"je 0f\n\t" \
|
||||
"lock\n" \
|
||||
"0:\tsubl $1,%0\n\t" \
|
||||
"jne _L_mutex_unlock_%=\n\t" \
|
||||
@ -459,7 +459,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
|
||||
"1:\tmovl %1, %%eax\n\t" \
|
||||
LLL_ENTER_KERNEL \
|
||||
"cmpl $0, (%%ebx)\n\t" \
|
||||
"jne,pn 1b\n\t" \
|
||||
"jne 1b\n\t" \
|
||||
LLL_EBX_LOAD \
|
||||
: "=&a" (__ignore) \
|
||||
: "i" (SYS_futex), LLL_EBX_REG (&tid), "S" (0), \
|
||||
|
Loading…
Reference in New Issue
Block a user