Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/rpc fix error messages and warnings.
details: https://anonhg.NetBSD.org/src/rev/e949a813c40e
branches: trunk
changeset: 785217:e949a813c40e
user: christos <christos%NetBSD.org@localhost>
date: Mon Mar 04 17:17:56 2013 +0000
description:
fix error messages and warnings.
diffstat:
lib/libc/rpc/auth_unix.c | 12 ++--
lib/libc/rpc/clnt_raw.c | 6 +-
lib/libc/rpc/svc_generic.c | 89 +++++++++++++++++++++----------------------
lib/libc/rpc/svc_simple.c | 43 +++++++++-----------
lib/libc/rpc/svc_vc.c | 20 ++++----
lib/libc/rpc/xdr.c | 8 +-
lib/libc/rpc/xdr_array.c | 6 +-
lib/libc/rpc/xdr_rec.c | 10 ++--
lib/libc/rpc/xdr_reference.c | 6 +-
9 files changed, 97 insertions(+), 103 deletions(-)
diffs (truncated from 613 to 300 lines):
diff -r eb2e1eb5a1d8 -r e949a813c40e lib/libc/rpc/auth_unix.c
--- a/lib/libc/rpc/auth_unix.c Mon Mar 04 01:14:35 2013 +0000
+++ b/lib/libc/rpc/auth_unix.c Mon Mar 04 17:17:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth_unix.c,v 1.23 2012/03/20 17:14:50 matt Exp $ */
+/* $NetBSD: auth_unix.c,v 1.24 2013/03/04 17:17:56 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";
#else
-__RCSID("$NetBSD: auth_unix.c,v 1.23 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: auth_unix.c,v 1.24 2013/03/04 17:17:56 christos Exp $");
#endif
#endif
@@ -115,14 +115,14 @@
auth = mem_alloc(sizeof(*auth));
#ifndef KERNEL
if (auth == NULL) {
- warnx("authunix_create: out of memory");
+ warn("%s: out of memory", __func__);
goto cleanup_authunix_create;
}
#endif
au = mem_alloc(sizeof(*au));
#ifndef KERNEL
if (au == NULL) {
- warnx("authunix_create: out of memory");
+ warn("%s: out of memory", __func__);
goto cleanup_authunix_create;
}
#endif
@@ -155,7 +155,7 @@
au->au_origcred.oa_base = mem_alloc((size_t)len);
#else
if ((au->au_origcred.oa_base = mem_alloc((size_t)len)) == NULL) {
- warnx("authunix_create: out of memory");
+ warn("%s: out of memory", __func__);
goto cleanup_authunix_create;
}
#endif
@@ -342,7 +342,7 @@
xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
(! xdr_opaque_auth(xdrs, &(auth->ah_verf))))
- warnx("auth_none.c - Fatal marshalling problem");
+ warnx("%s: Fatal marshalling problem", __func__);
else
au->au_mpos = XDR_GETPOS(xdrs);
XDR_DESTROY(xdrs);
diff -r eb2e1eb5a1d8 -r e949a813c40e lib/libc/rpc/clnt_raw.c
--- a/lib/libc/rpc/clnt_raw.c Mon Mar 04 01:14:35 2013 +0000
+++ b/lib/libc/rpc/clnt_raw.c Mon Mar 04 17:17:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clnt_raw.c,v 1.30 2012/03/20 17:14:50 matt Exp $ */
+/* $NetBSD: clnt_raw.c,v 1.31 2013/03/04 17:17:56 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
#else
-__RCSID("$NetBSD: clnt_raw.c,v 1.30 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: clnt_raw.c,v 1.31 2013/03/04 17:17:56 christos Exp $");
#endif
#endif
@@ -128,7 +128,7 @@
call_msg.rm_call.cb_vers = (u_int32_t)vers;
xdrmem_create(xdrs, clp->u.mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
if (! xdr_callhdr(xdrs, &call_msg))
- warnx("clntraw_create - Fatal header serialization error.");
+ warnx("%s: Fatal header serialization error", __func__);
clp->mcnt = XDR_GETPOS(xdrs);
XDR_DESTROY(xdrs);
diff -r eb2e1eb5a1d8 -r e949a813c40e lib/libc/rpc/svc_generic.c
--- a/lib/libc/rpc/svc_generic.c Mon Mar 04 01:14:35 2013 +0000
+++ b/lib/libc/rpc/svc_generic.c Mon Mar 04 17:17:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svc_generic.c,v 1.12 2012/03/20 17:14:50 matt Exp $ */
+/* $NetBSD: svc_generic.c,v 1.13 2013/03/04 17:17:56 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro";
#else
-__RCSID("$NetBSD: svc_generic.c,v 1.12 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: svc_generic.c,v 1.13 2013/03/04 17:17:56 christos Exp $");
#endif
#endif
@@ -105,7 +105,7 @@
/* VARIABLES PROTECTED BY xprtlist_lock: xprtlist */
if ((handle = __rpc_setconf(nettype)) == NULL) {
- warnx("svc_create: unknown protocol");
+ warnx("%s: unknown protocol %s", __func__, nettype);
return (0);
}
while ((nconf = __rpc_getconf(handle)) != NULL) {
@@ -116,10 +116,10 @@
(void) rpcb_unset(prognum, versnum, nconf);
if (svc_reg(l->xprt, prognum, versnum,
dispatch, nconf) == FALSE)
- warnx(
- "svc_create: could not register prog %u vers %u on %s",
- (unsigned)prognum, (unsigned)versnum,
- nconf->nc_netid);
+ warnx("%s: could not register prog %u "
+ "vers %u on %s", __func__,
+ (unsigned)prognum,
+ (unsigned)versnum, nconf->nc_netid);
else
num++;
break;
@@ -131,7 +131,7 @@
if (xprt) {
l = malloc(sizeof(*l));
if (l == NULL) {
- warnx("svc_create: no memory");
+ warn("%s: out of memory", __func__);
mutex_unlock(&xprtlist_lock);
return (0);
}
@@ -166,9 +166,8 @@
SVCXPRT *xprt;
if (nconf == NULL) {
- warnx(
- "svc_tp_create: invalid netconfig structure for prog %u vers %u",
- (unsigned)prognum, (unsigned)versnum);
+ warnx("%s: invalid netconfig structure for prog %u vers %u",
+ __func__, (unsigned)prognum, (unsigned)versnum);
return (NULL);
}
xprt = svc_tli_create(RPC_ANYFD, nconf, NULL, 0, 0);
@@ -177,10 +176,9 @@
}
(void) rpcb_unset(prognum, versnum, __UNCONST(nconf));
if (svc_reg(xprt, prognum, versnum, dispatch, nconf) == FALSE) {
- warnx(
- "svc_tp_create: Could not register prog %u vers %u on %s",
- (unsigned)prognum, (unsigned)versnum,
- nconf->nc_netid);
+ warnx("%s: Could not register prog %u vers %u on %s",
+ __func__, (unsigned)prognum, (unsigned)versnum,
+ nconf->nc_netid);
SVC_DESTROY(xprt);
return (NULL);
}
@@ -212,14 +210,13 @@
if (fd == RPC_ANYFD) {
if (nconf == NULL) {
- warnx("svc_tli_create: invalid netconfig");
+ warnx("%s: invalid netconfig", __func__);
return (NULL);
}
fd = __rpc_nconf2fd(nconf);
if (fd == -1) {
- warnx(
- "svc_tli_create: could not open connection for %s",
- nconf->nc_netid);
+ warnx("%s: could not open connection for %s", __func__,
+ nconf->nc_netid);
return (NULL);
}
__rpc_nconf2sockinfo(nconf, &si);
@@ -229,8 +226,8 @@
* It is an open descriptor. Get the transport info.
*/
if (!__rpc_fd2sockinfo(fd, &si)) {
- warnx(
- "svc_tli_create: could not get transport information");
+ warnx("%s: could not get transport information",
+ __func__);
return (NULL);
}
}
@@ -246,8 +243,8 @@
ss.ss_len = si.si_alen;
if (bind(fd, (struct sockaddr *)(void *)&ss,
(socklen_t)si.si_alen) < 0) {
- warnx(
- "svc_tli_create: could not bind to anonymous port");
+ warn( "%s: could not bind to anonymous "
+ "port", __func__);
goto freedata;
}
}
@@ -256,8 +253,8 @@
if (bind(fd,
(struct sockaddr *)bindaddr->addr.buf,
(socklen_t)si.si_alen) < 0) {
- warnx(
- "svc_tli_create: could not bind to requested address");
+ warnx("%s: could not bind to requested address",
+ __func__);
goto freedata;
}
listen(fd, (int)bindaddr->qlen);
@@ -268,29 +265,29 @@
* call transport specific function.
*/
switch (si.si_socktype) {
- case SOCK_STREAM:
- slen = sizeof ss;
- if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen)
- == 0) {
- /* accepted socket */
- xprt = svc_fd_create(fd, sendsz, recvsz);
- } else
- xprt = svc_vc_create(fd, sendsz, recvsz);
- if (!nconf || !xprt)
- break;
+ case SOCK_STREAM:
+ slen = sizeof ss;
+ if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen)
+ == 0) {
+ /* accepted socket */
+ xprt = svc_fd_create(fd, sendsz, recvsz);
+ } else
+ xprt = svc_vc_create(fd, sendsz, recvsz);
+ if (!nconf || !xprt)
+ break;
#if 0
- /* XXX fvdl */
- if (strcmp(nconf->nc_protofmly, "inet") == 0 ||
- strcmp(nconf->nc_protofmly, "inet6") == 0)
- (void) __svc_vc_setflag(xprt, TRUE);
+ /* XXX fvdl */
+ if (strcmp(nconf->nc_protofmly, "inet") == 0 ||
+ strcmp(nconf->nc_protofmly, "inet6") == 0)
+ (void) __svc_vc_setflag(xprt, TRUE);
#endif
- break;
- case SOCK_DGRAM:
- xprt = svc_dg_create(fd, sendsz, recvsz);
- break;
- default:
- warnx("svc_tli_create: bad service type");
- goto freedata;
+ break;
+ case SOCK_DGRAM:
+ xprt = svc_dg_create(fd, sendsz, recvsz);
+ break;
+ default:
+ warnx("%s: bad service type %u", __func__, si.si_socktype);
+ goto freedata;
}
if (xprt == NULL)
diff -r eb2e1eb5a1d8 -r e949a813c40e lib/libc/rpc/svc_simple.c
--- a/lib/libc/rpc/svc_simple.c Mon Mar 04 01:14:35 2013 +0000
+++ b/lib/libc/rpc/svc_simple.c Mon Mar 04 17:17:56 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svc_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $ */
+/* $NetBSD: svc_simple.c,v 1.32 2013/03/04 17:17:56 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: svc_simple.c,v 1.31 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: svc_simple.c,v 1.32 2013/03/04 17:17:56 christos Exp $");
#endif
#include "namespace.h"
@@ -83,8 +83,6 @@
struct proglst *p_nxt;
} *proglst;
-static const char rpc_reg_err[] = "%s: %s";
-static const char rpc_reg_msg[] = "rpc_reg: ";
static const char __reg_err1[] = "can't find appropriate transport";
static const char __reg_err2[] = "can't get protocol info";
static const char __reg_err3[] = "unsupported transport size";
@@ -119,15 +117,15 @@
#endif
if (procnum == NULLPROC) {
- warnx("%s can't reassign procedure number %u", rpc_reg_msg,
- NULLPROC);
+ warnx("%s: can't reassign procedure number %u", __func__,
+ NULLPROC);
return (-1);
}
if (nettype == NULL)
nettype = __UNCONST("netpath"); /* The default behavior */
if ((handle = __rpc_setconf(nettype)) == NULL) {
Home |
Main Index |
Thread Index |
Old Index