Libraries updates and cleanup

* Updating common/lib
 * Updating lib/csu
 * Updating lib/libc
 * Updating libexec/ld.elf_so
 * Corrected test on __minix in featuretest to actually follow the
   meaning of the comment.
 * Cleaned up _REENTRANT-related defintions.
 * Disabled -D_REENTRANT for libfetch
 * Removing some unneeded __NBSD_LIBC defines and tests

Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
2013-01-14 11:36:26 +01:00
parent f6aac1c3b5
commit f14fb60209
1285 changed files with 44244 additions and 14308 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.14 1999/02/24 15:05:21 drochner Exp $
# $NetBSD: Makefile.inc,v 1.15 2012/03/02 17:27:49 christos Exp $
# yp sources
.PATH: ${ARCHDIR}/yp ${.CURDIR}/yp
@@ -10,4 +10,5 @@ MAN+= ypclnt.3
MLINKS+=ypclnt.3 yp_all.3 ypclnt.3 yp_bind.3 ypclnt.3 yp_first.3 \
ypclnt.3 yp_get_default_domain.3 ypclnt.3 yp_master.3 \
ypclnt.3 yp_match.3 ypclnt.3 yp_next.3 ypclnt.3 yp_order.3 \
ypclnt.3 yp_unbind.3 ypclnt.3 yperr_string.3 ypclnt.3 ypprot_err.3
ypclnt.3 yp_unbind.3 ypclnt.3 yperr_string.3 ypclnt.3 ypprot_err.3 \
ypclnt.3 yp_setbindtries.3
+3 -3
View File
@@ -1,4 +1,4 @@
/* $NetBSD: local.h,v 1.3 2009/10/21 01:07:46 snj Exp $ */
/* $NetBSD: local.h,v 1.4 2012/03/20 16:30:26 matt Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -25,6 +25,6 @@
*/
__BEGIN_DECLS
void __yp_unbind __P((struct dom_binding *));
int _yp_invalid_domain __P((const char *));
void __yp_unbind(struct dom_binding *);
int _yp_invalid_domain(const char *);
__END_DECLS
+36 -88
View File
@@ -1,4 +1,4 @@
/* $NetBSD: xdryp.c,v 1.30 2006/05/11 17:11:57 mrg Exp $ */
/* $NetBSD: xdryp.c,v 1.32 2012/03/20 16:30:26 matt Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe <thorpej@NetBSD.org>.
@@ -61,7 +61,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: xdryp.c,v 1.30 2006/05/11 17:11:57 mrg Exp $");
__RCSID("$NetBSD: xdryp.c,v 1.32 2012/03/20 16:30:26 matt Exp $");
#endif
/*
@@ -115,18 +115,16 @@ __weak_alias(xdr_ypresp_val,_xdr_ypresp_val)
/*
* Functions used only within this file.
*/
static bool_t xdr_ypbind_binding __P((XDR *, struct ypbind_binding *));
static bool_t xdr_ypbind_resptype __P((XDR *, enum ypbind_resptype *));
static bool_t xdr_ypstat __P((XDR *, enum ypbind_resptype *));
static bool_t xdr_ypmaplist_str __P((XDR *, char *));
static bool_t xdr_ypbind_binding(XDR *, struct ypbind_binding *);
static bool_t xdr_ypbind_resptype(XDR *, enum ypbind_resptype *);
static bool_t xdr_ypstat(XDR *, enum ypbind_resptype *);
static bool_t xdr_ypmaplist_str(XDR *, char *);
__warn_references(xdr_domainname,
"warning: this program uses xdr_domainname(), which is deprecated and buggy.")
bool_t
xdr_domainname(xdrs, objp)
XDR *xdrs;
char *objp;
xdr_domainname(XDR *xdrs, char *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -139,9 +137,7 @@ __warn_references(xdr_peername,
"warning: this program uses xdr_peername(), which is deprecated and buggy.")
bool_t
xdr_peername(xdrs, objp)
XDR *xdrs;
char *objp;
xdr_peername(XDR *xdrs, char *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -154,9 +150,7 @@ __warn_references(xdr_mapname,
"warning: this program uses xdr_mapname(), which is deprecated and buggy.")
bool_t
xdr_mapname(xdrs, objp)
XDR *xdrs;
char *objp;
xdr_mapname(XDR *xdrs, char *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -166,9 +160,7 @@ xdr_mapname(xdrs, objp)
}
bool_t
xdr_ypdomain_wrap_string(xdrs, objp)
XDR *xdrs;
char **objp;
xdr_ypdomain_wrap_string(XDR *xdrs, char **objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -178,9 +170,7 @@ xdr_ypdomain_wrap_string(xdrs, objp)
}
bool_t
xdr_ypmap_wrap_string(xdrs, objp)
XDR *xdrs;
char **objp;
xdr_ypmap_wrap_string(XDR *xdrs, char **objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -190,9 +180,7 @@ xdr_ypmap_wrap_string(xdrs, objp)
}
bool_t
xdr_ypowner_wrap_string(xdrs, objp)
XDR *xdrs;
char **objp;
xdr_ypowner_wrap_string(XDR *xdrs, char **objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -202,9 +190,7 @@ xdr_ypowner_wrap_string(xdrs, objp)
}
bool_t
xdr_datum(xdrs, objp)
XDR *xdrs;
datum *objp;
xdr_datum(XDR *xdrs, datum *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -215,9 +201,7 @@ xdr_datum(xdrs, objp)
}
bool_t
xdr_ypreq_key(xdrs, objp)
XDR *xdrs;
struct ypreq_key *objp;
xdr_ypreq_key(XDR *xdrs, struct ypreq_key *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -236,9 +220,7 @@ xdr_ypreq_key(xdrs, objp)
}
bool_t
xdr_ypreq_nokey(xdrs, objp)
XDR *xdrs;
struct ypreq_nokey *objp;
xdr_ypreq_nokey(XDR *xdrs, struct ypreq_nokey *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -254,22 +236,18 @@ xdr_ypreq_nokey(xdrs, objp)
}
bool_t
xdr_yp_inaddr(xdrs, objp)
XDR *xdrs;
struct in_addr *objp;
xdr_yp_inaddr(XDR *xdrs, struct in_addr *objp)
{
_DIAGASSERT(xdrs != NULL);
_DIAGASSERT(objp != NULL);
return xdr_opaque(xdrs, (caddr_t)(void *)&objp->s_addr,
sizeof objp->s_addr);
(u_int)sizeof objp->s_addr);
}
static bool_t
xdr_ypbind_binding(xdrs, objp)
XDR *xdrs;
struct ypbind_binding *objp;
xdr_ypbind_binding(XDR *xdrs, struct ypbind_binding *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -279,16 +257,14 @@ xdr_ypbind_binding(xdrs, objp)
return FALSE;
if (!xdr_opaque(xdrs, (void *)&objp->ypbind_binding_port,
sizeof objp->ypbind_binding_port))
(u_int)sizeof objp->ypbind_binding_port))
return FALSE;
return TRUE;
}
static bool_t
xdr_ypbind_resptype(xdrs, objp)
XDR *xdrs;
enum ypbind_resptype *objp;
xdr_ypbind_resptype(XDR *xdrs, enum ypbind_resptype *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -298,9 +274,7 @@ xdr_ypbind_resptype(xdrs, objp)
}
static bool_t
xdr_ypstat(xdrs, objp)
XDR *xdrs;
enum ypbind_resptype *objp;
xdr_ypstat(XDR *xdrs, enum ypbind_resptype *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -310,9 +284,7 @@ xdr_ypstat(xdrs, objp)
}
bool_t
xdr_ypbind_resp(xdrs, objp)
XDR *xdrs;
struct ypbind_resp *objp;
xdr_ypbind_resp(XDR *xdrs, struct ypbind_resp *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -337,9 +309,7 @@ xdr_ypbind_resp(xdrs, objp)
}
bool_t
xdr_ypresp_val(xdrs, objp)
XDR *xdrs;
struct ypresp_val *objp;
xdr_ypresp_val(XDR *xdrs, struct ypresp_val *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -355,9 +325,7 @@ xdr_ypresp_val(xdrs, objp)
}
bool_t
xdr_ypbind_setdom(xdrs, objp)
XDR *xdrs;
struct ypbind_setdom *objp;
xdr_ypbind_setdom(XDR *xdrs, struct ypbind_setdom *objp)
{
char *cp;
@@ -379,9 +347,7 @@ xdr_ypbind_setdom(xdrs, objp)
}
bool_t
xdr_ypresp_key_val(xdrs, objp)
XDR *xdrs;
struct ypresp_key_val *objp;
xdr_ypresp_key_val(XDR *xdrs, struct ypresp_key_val *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -400,9 +366,7 @@ xdr_ypresp_key_val(xdrs, objp)
}
bool_t
xdr_ypall(xdrs, incallback)
XDR *xdrs;
struct ypall_callback *incallback;
xdr_ypall(XDR *xdrs, struct ypall_callback *incallback)
{
struct ypresp_key_val out;
char key[YPMAXRECORD], val[YPMAXRECORD];
@@ -448,9 +412,7 @@ xdr_ypall(xdrs, incallback)
}
bool_t
xdr_ypresp_master(xdrs, objp)
XDR *xdrs;
struct ypresp_master *objp;
xdr_ypresp_master(XDR *xdrs, struct ypresp_master *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -466,9 +428,7 @@ xdr_ypresp_master(xdrs, objp)
}
static bool_t
xdr_ypmaplist_str(xdrs, objp)
XDR *xdrs;
char *objp;
xdr_ypmaplist_str(XDR *xdrs, char *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -478,9 +438,7 @@ xdr_ypmaplist_str(xdrs, objp)
}
bool_t
xdr_ypmaplist(xdrs, objp)
XDR *xdrs;
struct ypmaplist *objp;
xdr_ypmaplist(XDR *xdrs, struct ypmaplist *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -490,16 +448,14 @@ xdr_ypmaplist(xdrs, objp)
return FALSE;
if (!xdr_pointer(xdrs, (char **)(void *)&objp->ypml_next,
sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
(u_int)sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
return FALSE;
return TRUE;
}
bool_t
xdr_ypresp_maplist(xdrs, objp)
XDR *xdrs;
struct ypresp_maplist *objp;
xdr_ypresp_maplist(XDR *xdrs, struct ypresp_maplist *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -509,16 +465,14 @@ xdr_ypresp_maplist(xdrs, objp)
return FALSE;
if (!xdr_pointer(xdrs, (char **)(void *)&objp->list,
sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
(u_int)sizeof(struct ypmaplist), (xdrproc_t)xdr_ypmaplist))
return FALSE;
return TRUE;
}
bool_t
xdr_ypresp_order(xdrs, objp)
XDR *xdrs;
struct ypresp_order *objp;
xdr_ypresp_order(XDR *xdrs, struct ypresp_order *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -534,9 +488,7 @@ xdr_ypresp_order(xdrs, objp)
}
bool_t
xdr_ypreq_xfr(xdrs, objp)
XDR *xdrs;
struct ypreq_xfr *objp;
xdr_ypreq_xfr(XDR *xdrs, struct ypreq_xfr *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -558,9 +510,7 @@ xdr_ypreq_xfr(xdrs, objp)
}
bool_t
xdr_ypmap_parms(xdrs, objp)
XDR *xdrs;
struct ypmap_parms *objp;
xdr_ypmap_parms(XDR *xdrs, struct ypmap_parms *objp)
{
_DIAGASSERT(xdrs != NULL);
@@ -582,9 +532,7 @@ xdr_ypmap_parms(xdrs, objp)
}
bool_t
xdr_yppushresp_xfr(xdrs, objp)
XDR *xdrs;
struct yppushresp_xfr *objp;
xdr_yppushresp_xfr(XDR *xdrs, struct yppushresp_xfr *objp)
{
_DIAGASSERT(xdrs != NULL);
+4 -6
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_all.c,v 1.12 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: yp_all.c,v 1.13 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_all.c,v 1.12 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: yp_all.c,v 1.13 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -46,10 +46,8 @@ __weak_alias(yp_all,_yp_all)
#endif
int
yp_all(indomain, inmap, incallback)
const char *indomain;
const char *inmap;
struct ypall_callback *incallback;
yp_all(const char *indomain, const char *inmap,
struct ypall_callback *incallback)
{
struct ypreq_nokey yprnk;
struct dom_binding *ysd;
+13 -22
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_first.c,v 1.14 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: yp_first.c,v 1.16 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_first.c,v 1.14 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: yp_first.c,v 1.16 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -41,6 +41,7 @@ __RCSID("$NetBSD: yp_first.c,v 1.14 2003/12/10 12:06:25 agc Exp $");
extern struct timeval _yplib_timeout;
extern int _yplib_nerrs;
extern int _yplib_bindtries;
#ifdef __weak_alias
__weak_alias(yp_first,_yp_first)
@@ -48,13 +49,8 @@ __weak_alias(yp_next,_yp_next)
#endif
int
yp_first(indomain, inmap, outkey, outkeylen, outval, outvallen)
const char *indomain;
const char *inmap;
char **outkey;
int *outkeylen;
char **outval;
int *outvallen;
yp_first(const char *indomain, const char *inmap, char **outkey,
int *outkeylen, char **outval, int *outvallen)
{
struct ypresp_key_val yprkv;
struct ypreq_nokey yprnk;
@@ -84,10 +80,11 @@ again:
(xdrproc_t)xdr_ypreq_nokey,
&yprnk, (xdrproc_t)xdr_ypresp_key_val, &yprkv, _yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_first: clnt_call");
nerrs = 0;
}
} else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
return YPERR_YPSERV;
ysd->dom_vers = -1;
goto again;
}
@@ -125,15 +122,8 @@ again:
}
int
yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen)
const char *indomain;
const char *inmap;
const char *inkey;
int inkeylen;
char **outkey;
int *outkeylen;
char **outval;
int *outvallen;
yp_next(const char *indomain, const char *inmap, const char *inkey,
int inkeylen, char **outkey, int *outkeylen, char **outval, int *outvallen)
{
struct ypresp_key_val yprkv;
struct ypreq_key yprk;
@@ -167,10 +157,11 @@ again:
(xdrproc_t)xdr_ypreq_key,
&yprk, (xdrproc_t)xdr_ypresp_key_val, &yprkv, _yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_next: clnt_call");
nerrs = 0;
}
} else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
return YPERR_YPSERV;
ysd->dom_vers = -1;
goto again;
}
+7 -7
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_maplist.c,v 1.11 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: yp_maplist.c,v 1.13 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_maplist.c,v 1.11 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: yp_maplist.c,v 1.13 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -40,15 +40,14 @@ __RCSID("$NetBSD: yp_maplist.c,v 1.11 2003/12/10 12:06:25 agc Exp $");
extern struct timeval _yplib_timeout;
extern int _yplib_nerrs;
extern int _yplib_bindtries;
#ifdef __weak_alias
__weak_alias(yp_maplist,_yp_maplist)
#endif
int
yp_maplist(indomain, outmaplist)
const char *indomain;
struct ypmaplist **outmaplist;
yp_maplist( const char *indomain, struct ypmaplist **outmaplist)
{
struct dom_binding *ysd;
struct ypresp_maplist ypml;
@@ -68,10 +67,11 @@ again:
(xdrproc_t)xdr_ypdomain_wrap_string, &indomain,
(xdrproc_t)xdr_ypresp_maplist, &ypml, _yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_maplist: clnt_call");
nerrs = 0;
}
} else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
return YPERR_YPSERV;
ysd->dom_vers = -1;
goto again;
}
+7 -8
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_master.c,v 1.13 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: yp_master.c,v 1.15 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_master.c,v 1.13 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: yp_master.c,v 1.15 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -41,16 +41,14 @@ __RCSID("$NetBSD: yp_master.c,v 1.13 2003/12/10 12:06:25 agc Exp $");
extern struct timeval _yplib_timeout;
extern int _yplib_nerrs;
extern int _yplib_bindtries;
#ifdef __weak_alias
__weak_alias(yp_master,_yp_master)
#endif
int
yp_master(indomain, inmap, outname)
const char *indomain;
const char *inmap;
char **outname;
yp_master(const char *indomain, const char *inmap, char **outname)
{
struct dom_binding *ysd;
struct ypresp_master yprm;
@@ -80,10 +78,11 @@ again:
(xdrproc_t)xdr_ypreq_nokey, &yprnk,
(xdrproc_t)xdr_ypresp_master, &yprm, _yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_master: clnt_call");
nerrs = 0;
}
} else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
return YPERR_YPSERV;
ysd->dom_vers = -1;
goto again;
}
+15 -25
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_match.c,v 1.17 2005/11/29 03:12:01 christos Exp $ */
/* $NetBSD: yp_match.c,v 1.19 2012/03/20 16:30:26 matt Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_match.c,v 1.17 2005/11/29 03:12:01 christos Exp $");
__RCSID("$NetBSD: yp_match.c,v 1.19 2012/03/20 16:30:26 matt Exp $");
#endif
#include "namespace.h"
@@ -47,6 +47,7 @@ __RCSID("$NetBSD: yp_match.c,v 1.17 2005/11/29 03:12:01 christos Exp $");
extern struct timeval _yplib_timeout;
extern int _yplib_nerrs;
extern int _yplib_bindtries;
extern char _yp_domain[];
#ifdef __weak_alias
@@ -64,17 +65,12 @@ static struct ypmatch_ent {
time_t expire_t;
} *ypmc;
static bool_t ypmatch_add __P((const char *, const char *, int, char *, int));
static bool_t ypmatch_find __P((const char *, const char *, int, const char **,
int *));
static bool_t ypmatch_add(const char *, const char *, int, char *, int);
static bool_t ypmatch_find(const char *, const char *, int, const char **,
int *);
static bool_t
ypmatch_add(map, key, keylen, val, vallen)
const char *map;
const char *key;
int keylen;
char *val;
int vallen;
ypmatch_add(const char *map, const char *key, int keylen, char *val, int vallen)
{
struct ypmatch_ent *ep;
time_t t;
@@ -137,12 +133,8 @@ ypmatch_add(map, key, keylen, val, vallen)
}
static bool_t
ypmatch_find(map, key, keylen, val, vallen)
const char *map;
const char *key;
int keylen;
const char **val;
int *vallen;
ypmatch_find(const char *map, const char *key, int keylen, const char **val,
int *vallen)
{
struct ypmatch_ent *ep;
time_t t;
@@ -175,13 +167,8 @@ ypmatch_find(map, key, keylen, val, vallen)
#endif
int
yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
const char *indomain;
const char *inmap;
const char *inkey;
int inkeylen;
char **outval;
int *outvallen;
yp_match(const char *indomain, const char *inmap, const char *inkey,
int inkeylen, char **outval, int *outvallen)
{
struct dom_binding *ysd;
struct ypresp_val yprv;
@@ -229,10 +216,13 @@ again:
(xdrproc_t)xdr_ypresp_val, &yprv,
_yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_match: clnt_call");
nerrs = 0;
}
else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries) {
return YPERR_YPSERV;
}
ysd->dom_vers = -1;
goto again;
}
+7 -8
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yp_order.c,v 1.12 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: yp_order.c,v 1.14 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yp_order.c,v 1.12 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: yp_order.c,v 1.14 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -40,16 +40,14 @@ __RCSID("$NetBSD: yp_order.c,v 1.12 2003/12/10 12:06:25 agc Exp $");
extern struct timeval _yplib_timeout;
extern int _yplib_nerrs;
extern int _yplib_bindtries;
#ifdef __weak_alias
__weak_alias(yp_order,_yp_order)
#endif
int
yp_order(indomain, inmap, outorder)
const char *indomain;
const char *inmap;
int *outorder;
yp_order(const char *indomain, const char *inmap, int *outorder)
{
struct dom_binding *ysd;
struct ypresp_order ypro;
@@ -78,10 +76,11 @@ again:
(xdrproc_t)xdr_ypresp_order, &ypro,
_yplib_timeout);
if (r != RPC_SUCCESS) {
if (++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && ++nerrs == _yplib_nerrs) {
clnt_perror(ysd->dom_client, "yp_order: clnt_call");
nerrs = 0;
}
} else if (_yplib_bindtries > 0 && ++nerrs == _yplib_bindtries)
return YPERR_YPSERV;
if (r == RPC_PROCUNAVAIL) {
/* Case of NIS+ server in NIS compat mode */
r = YPERR_YPERR;
+17 -3
View File
@@ -1,4 +1,4 @@
.\" $NetBSD: ypclnt.3,v 1.24 2010/03/22 19:30:55 joerg Exp $
.\" $NetBSD: ypclnt.3,v 1.26 2012/03/04 11:52:32 wiz Exp $
.\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd May 21, 1997
.Dd March 2, 2012
.Dt YPCLNT 3
.Os
.Sh NAME
@@ -42,6 +42,7 @@
.Nm yp_unbind ,
.Nm yperr_string ,
.Nm ypprot_err
.Nm yp_setbindtries
.Nd Interface to the YP subsystem
.Sh LIBRARY
.Lb libc
@@ -72,6 +73,8 @@
.Fn yperr_string "int incode"
.Ft int
.Fn ypprot_err "unsigned int incode"
.Ft int
.Fn yp_setbindtries "int ntries"
.Sh DESCRIPTION
The
.Nm ypclnt
@@ -196,7 +199,7 @@ is returned and control given back to the user code.
The
.Nm ypclnt
suite provides the following functionality:
.Bl -tag -width yp_match()xx
.Bl -tag -width yp_matchxxxx
.It Fn yp_match
Provides the value associated with the given key.
.It Fn yp_first
@@ -348,6 +351,17 @@ protocol error code to a
.Nm ypclnt
error code suitable for
.Fn yperr_string .
.It Fn yp_setbindtries
Set the number of tries to attempt to bind to the domain before returning
an error.
The default is
.Dv 0
which means wait forever if no ypserver is not found of if the RPC
communication with the yp server fails.
If the number passed is negative, the current number of tries is not modified.
.Pp
This function is an extention to the client library that allows application
to catch communication problems with the ypserver without blocking forever.
.El
.Sh RETURN VALUES
All functions in the
+3 -4
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yperr_string.c,v 1.7 2005/11/29 03:12:01 christos Exp $ */
/* $NetBSD: yperr_string.c,v 1.8 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yperr_string.c,v 1.7 2005/11/29 03:12:01 christos Exp $");
__RCSID("$NetBSD: yperr_string.c,v 1.8 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -42,8 +42,7 @@ __weak_alias(yperr_string,_yperr_string)
#endif
char *
yperr_string(incode)
int incode;
yperr_string(int incode)
{
static char err[80];
+28 -18
View File
@@ -1,4 +1,4 @@
/* $NetBSD: yplib.c,v 1.43 2006/11/03 20:18:49 christos Exp $ */
/* $NetBSD: yplib.c,v 1.45 2012/03/20 16:30:26 matt Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: yplib.c,v 1.43 2006/11/03 20:18:49 christos Exp $");
__RCSID("$NetBSD: yplib.c,v 1.45 2012/03/20 16:30:26 matt Exp $");
#endif
#include "namespace.h"
@@ -67,11 +67,13 @@ struct timeval _yplib_timeout = { YPLIB_TIMEOUT, 0 };
struct timeval _yplib_rpc_timeout = { YPLIB_TIMEOUT / YPLIB_RPC_RETRIES,
1000000 * (YPLIB_TIMEOUT % YPLIB_RPC_RETRIES) / YPLIB_RPC_RETRIES };
int _yplib_nerrs = 5;
int _yplib_bindtries = 0;
#ifdef __weak_alias
__weak_alias(yp_bind, _yp_bind)
__weak_alias(yp_unbind, _yp_unbind)
__weak_alias(yp_get_default_domain, _yp_get_default_domain)
__weak_alias(yp_setbindtries, _yp_setbindtries)
#endif
#ifdef _REENTRANT
@@ -84,9 +86,17 @@ static mutex_t _ypmutex = MUTEX_INITIALIZER;
#endif
int
_yp_dobind(dom, ypdb)
const char *dom;
struct dom_binding **ypdb;
yp_setbindtries(int ntries)
{
int old_val = _yplib_bindtries;
if (ntries >= 0)
_yplib_bindtries = ntries;
return old_val;
}
int
_yp_dobind(const char *dom, struct dom_binding **ypdb)
{
static int pid = -1;
char path[MAXPATHLEN];
@@ -218,12 +228,18 @@ trynet:
(xdrproc_t)xdr_ypdomain_wrap_string, &dom,
(xdrproc_t)xdr_ypbind_resp, &ypbr, _yplib_timeout);
if (r != RPC_SUCCESS) {
if (new == 0 && ++nerrs == _yplib_nerrs) {
if (_yplib_bindtries <= 0 && new == 0 &&
++nerrs == _yplib_nerrs) {
nerrs = 0;
fprintf(stderr,
"YP server for domain %s not responding, still trying\n",
dom);
}
else if (_yplib_bindtries > 0 &&
++nerrs == _yplib_bindtries) {
free(ysd);
return YPERR_YPBIND;
}
clnt_destroy(client);
ysd->dom_vers = -1;
goto again;
@@ -270,8 +286,7 @@ gotit:
}
void
__yp_unbind(ypb)
struct dom_binding *ypb;
__yp_unbind(struct dom_binding *ypb)
{
_DIAGASSERT(ypb != NULL);
@@ -282,8 +297,7 @@ __yp_unbind(ypb)
}
int
yp_bind(dom)
const char *dom;
yp_bind(const char *dom)
{
if (_yp_invalid_domain(dom))
return YPERR_BADARGS;
@@ -292,8 +306,7 @@ yp_bind(dom)
}
void
yp_unbind(dom)
const char *dom;
yp_unbind(const char *dom)
{
struct dom_binding *ypb, *ypbp;
@@ -317,8 +330,7 @@ yp_unbind(dom)
}
int
yp_get_default_domain(domp)
char **domp;
yp_get_default_domain(char **domp)
{
if (domp == NULL)
return YPERR_BADARGS;
@@ -331,8 +343,7 @@ yp_get_default_domain(domp)
}
int
_yp_check(dom)
char **dom;
_yp_check(char **dom)
{
char *unused;
int good;
@@ -358,8 +369,7 @@ done:
* returns non-zero if invalid
*/
int
_yp_invalid_domain(dom)
const char *dom;
_yp_invalid_domain(const char *dom)
{
if (dom == NULL || *dom == '\0')
return 1;
+3 -4
View File
@@ -1,4 +1,4 @@
/* $NetBSD: ypprot_err.c,v 1.5 2003/12/10 12:06:25 agc Exp $ */
/* $NetBSD: ypprot_err.c,v 1.6 2012/06/25 22:32:46 abs Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: ypprot_err.c,v 1.5 2003/12/10 12:06:25 agc Exp $");
__RCSID("$NetBSD: ypprot_err.c,v 1.6 2012/06/25 22:32:46 abs Exp $");
#endif
#include "namespace.h"
@@ -41,8 +41,7 @@ __weak_alias(ypprot_err,_ypprot_err)
#endif
int
ypprot_err(incode)
unsigned int incode;
ypprot_err(unsigned int incode)
{
switch (incode) {
case YP_TRUE: