xref: /netbsd-src/lib/libc/compat/rpc/compat_rpcb.c (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1*404fbe5fSchristos /*	$NetBSD: compat_rpcb.c,v 1.2 2009/01/11 03:41:28 christos Exp $	*/
2*404fbe5fSchristos 
3*404fbe5fSchristos /*-
4*404fbe5fSchristos  * Copyright (c) 2003 The NetBSD Foundation, Inc.
5*404fbe5fSchristos  * All rights reserved.
6*404fbe5fSchristos  *
7*404fbe5fSchristos  * This code is derived from software contributed to The NetBSD Foundation
8*404fbe5fSchristos  * by Christos Zoulas.
9*404fbe5fSchristos  *
10*404fbe5fSchristos  * Redistribution and use in source and binary forms, with or without
11*404fbe5fSchristos  * modification, are permitted provided that the following conditions
12*404fbe5fSchristos  * are met:
13*404fbe5fSchristos  * 1. Redistributions of source code must retain the above copyright
14*404fbe5fSchristos  *    notice, this list of conditions and the following disclaimer.
15*404fbe5fSchristos  * 2. Redistributions in binary form must reproduce the above copyright
16*404fbe5fSchristos  *    notice, this list of conditions and the following disclaimer in the
17*404fbe5fSchristos  *    documentation and/or other materials provided with the distribution.
18*404fbe5fSchristos  * 3. All advertising materials mentioning features or use of this software
19*404fbe5fSchristos  *    must display the following acknowledgement:
20*404fbe5fSchristos  *        This product includes software developed by the NetBSD
21*404fbe5fSchristos  *        Foundation, Inc. and its contributors.
22*404fbe5fSchristos  * 4. Neither the name of The NetBSD Foundation nor the names of its
23*404fbe5fSchristos  *    contributors may be used to endorse or promote products derived
24*404fbe5fSchristos  *    from this software without specific prior written permission.
25*404fbe5fSchristos  *
26*404fbe5fSchristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27*404fbe5fSchristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28*404fbe5fSchristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29*404fbe5fSchristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30*404fbe5fSchristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31*404fbe5fSchristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32*404fbe5fSchristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33*404fbe5fSchristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34*404fbe5fSchristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35*404fbe5fSchristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36*404fbe5fSchristos  * POSSIBILITY OF SUCH DAMAGE.
37*404fbe5fSchristos  */
38*404fbe5fSchristos #include <sys/cdefs.h>
39*404fbe5fSchristos #if defined(LIBC_SCCS) && !defined(lint)
40*404fbe5fSchristos __RCSID("$NetBSD: compat_rpcb.c,v 1.2 2009/01/11 03:41:28 christos Exp $");
41*404fbe5fSchristos #endif /* LIBC_SCCS and not lint */
42*404fbe5fSchristos 
43*404fbe5fSchristos 
44*404fbe5fSchristos #define __LIBC12_SOURCE__
45*404fbe5fSchristos 
46*404fbe5fSchristos #include "namespace.h"
47*404fbe5fSchristos #include <sys/types.h>
48*404fbe5fSchristos #include <sys/time.h>
49*404fbe5fSchristos #include <compat/sys/time.h>
50*404fbe5fSchristos #include <rpc/rpcb_clnt.h>
51*404fbe5fSchristos #include <compat/include/rpc/rpcb_clnt.h>
52*404fbe5fSchristos 
53*404fbe5fSchristos __warn_references(rpcb_rmtcall,
54*404fbe5fSchristos     "warning: reference to compatibility rpcb_rmtcall(); include <rpc/rpcb_clnt.h> to generate correct reference")
55*404fbe5fSchristos __warn_references(rpcb_gettime,
56*404fbe5fSchristos     "warning: reference to compatibility rpcb_gettime(); include <rpc/rpcb_clnt.h> to generate correct reference")
57*404fbe5fSchristos 
58*404fbe5fSchristos #ifdef __weak_alias
__weak_alias(rpcb_rmtcall,_rpcb_rmtcall)59*404fbe5fSchristos __weak_alias(rpcb_rmtcall, _rpcb_rmtcall)
60*404fbe5fSchristos __weak_alias(rpcb_gettime, _rpcb_gettime)
61*404fbe5fSchristos #endif
62*404fbe5fSchristos 
63*404fbe5fSchristos enum clnt_stat
64*404fbe5fSchristos rpcb_rmtcall(const struct netconfig *nc,
65*404fbe5fSchristos     const char *name, const rpcprog_t prog, const rpcvers_t vers,
66*404fbe5fSchristos     const rpcproc_t proc, const xdrproc_t inproc, const char *inbuf,
67*404fbe5fSchristos     const xdrproc_t outproc, caddr_t outbuf,
68*404fbe5fSchristos     const struct timeval50 tout50, const struct netbuf *nb)
69*404fbe5fSchristos {
70*404fbe5fSchristos 	struct timeval tout;
71*404fbe5fSchristos 	timeval50_to_timeval(&tout50, &tout);
72*404fbe5fSchristos 	return __rpcb_rmtcall50(nc, name, prog, vers, proc, inproc, inbuf,
73*404fbe5fSchristos 	    outproc, outbuf, tout, nb);
74*404fbe5fSchristos }
75*404fbe5fSchristos 
76*404fbe5fSchristos bool_t
rpcb_gettime(const char * name,int32_t * t50)77*404fbe5fSchristos rpcb_gettime(const char *name, int32_t *t50)
78*404fbe5fSchristos {
79*404fbe5fSchristos 	time_t t;
80*404fbe5fSchristos 	bool_t rv = __rpcb_gettime50(name, &t);
81*404fbe5fSchristos 	*t50 = (int32_t)t;
82*404fbe5fSchristos 	return rv;
83*404fbe5fSchristos }
84