diff options
author | Chris Johns <chrisj@rtems.org> | 2021-07-29 13:24:49 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2021-08-28 10:25:46 +1000 |
commit | c6dbc967480ed034cf52992ec5773252b646edc5 (patch) | |
tree | 73a94e2a5272e8fdb52ffd1483de87c14a15e3c7 /freebsd/sys/rpc | |
parent | freebsd/sys: Import RPC and XDR support (diff) | |
download | rtems-libbsd-c6dbc967480ed034cf52992ec5773252b646edc5.tar.bz2 |
kern/sys: Add the kernel RPC and XDR support
Updates #4475
Diffstat (limited to 'freebsd/sys/rpc')
-rw-r--r-- | freebsd/sys/rpc/auth_none.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/auth_unix.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/authunix_prot.c | 21 | ||||
-rw-r--r-- | freebsd/sys/rpc/clnt_bck.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/clnt_dg.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/clnt_rc.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/clnt_vc.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/getnetconfig.c | 4 | ||||
-rw-r--r-- | freebsd/sys/rpc/replay.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpc_callmsg.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpc_com.h | 5 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpc_generic.c | 4 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpc_prot.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpcb_clnt.c | 4 | ||||
-rw-r--r-- | freebsd/sys/rpc/rpcb_prot.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc.c | 17 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc_auth.c | 5 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc_auth_unix.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc_dg.c | 2 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc_generic.c | 4 | ||||
-rw-r--r-- | freebsd/sys/rpc/svc_vc.c | 2 |
21 files changed, 85 insertions, 5 deletions
diff --git a/freebsd/sys/rpc/auth_none.c b/freebsd/sys/rpc/auth_none.c index 236b4aa1..cafd8948 100644 --- a/freebsd/sys/rpc/auth_none.c +++ b/freebsd/sys/rpc/auth_none.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: auth_none.c,v 1.13 2000/01/22 22:19:17 mycroft Exp $ */ /*- diff --git a/freebsd/sys/rpc/auth_unix.c b/freebsd/sys/rpc/auth_unix.c index 4a3df5f7..3b344059 100644 --- a/freebsd/sys/rpc/auth_unix.c +++ b/freebsd/sys/rpc/auth_unix.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: auth_unix.c,v 1.18 2000/07/06 03:03:30 christos Exp $ */ /*- diff --git a/freebsd/sys/rpc/authunix_prot.c b/freebsd/sys/rpc/authunix_prot.c index b6cde0fb..06dfe863 100644 --- a/freebsd/sys/rpc/authunix_prot.c +++ b/freebsd/sys/rpc/authunix_prot.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $ */ /*- @@ -74,7 +76,11 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) /* * Restrict name length to 255 according to RFC 1057. */ +#ifndef __rtems__ getcredhostname(NULL, hostbuf, sizeof(hostbuf)); +#else /* __rtems__ */ + gethostname(hostbuf, sizeof(hostbuf)); +#endif /* __rtems__ */ namelen = strlen(hostbuf); if (namelen > 255) namelen = 255; @@ -97,9 +103,19 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) xdr_setpos(xdrs, xdr_getpos(xdrs) + RNDUP(namelen)); } +#ifndef __rtems__ if (!xdr_uint32_t(xdrs, &cred->cr_uid)) +#else /* __rtems__ */ + junk = cred->cr_uid; + if (!xdr_uint32_t(xdrs, &junk)) +#endif /* __rtems__ */ return (FALSE); +#ifndef __rtems__ if (!xdr_uint32_t(xdrs, &cred->cr_groups[0])) +#else /* __rtems__ */ + junk = cred->cr_groups[0]; + if (!xdr_uint32_t(xdrs, &junk)) +#endif /* __rtems__ */ return (FALSE); if (xdrs->x_op == XDR_ENCODE) { @@ -112,7 +128,12 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred) return (FALSE); for (i = 0; i < ngroups; i++) { if (i + 1 < ngroups_max + 1) { +#ifndef __rtems__ if (!xdr_uint32_t(xdrs, &cred->cr_groups[i + 1])) +#else /* __rtems__ */ + junk = cred->cr_uid; + if (!xdr_uint32_t(xdrs, &junk)) +#endif /* __rtems__ */ return (FALSE); } else { if (!xdr_uint32_t(xdrs, &junk)) diff --git a/freebsd/sys/rpc/clnt_bck.c b/freebsd/sys/rpc/clnt_bck.c index 66f3c308..aeb7087c 100644 --- a/freebsd/sys/rpc/clnt_bck.c +++ b/freebsd/sys/rpc/clnt_bck.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: clnt_vc.c,v 1.4 2000/07/14 08:40:42 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/clnt_dg.c b/freebsd/sys/rpc/clnt_dg.c index 4c40a494..217ff5a0 100644 --- a/freebsd/sys/rpc/clnt_dg.c +++ b/freebsd/sys/rpc/clnt_dg.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: clnt_dg.c,v 1.4 2000/07/14 08:40:41 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/clnt_rc.c b/freebsd/sys/rpc/clnt_rc.c index 5254f4c8..6f74a2cc 100644 --- a/freebsd/sys/rpc/clnt_rc.c +++ b/freebsd/sys/rpc/clnt_rc.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * diff --git a/freebsd/sys/rpc/clnt_vc.c b/freebsd/sys/rpc/clnt_vc.c index 0231c303..b3fb5d81 100644 --- a/freebsd/sys/rpc/clnt_vc.c +++ b/freebsd/sys/rpc/clnt_vc.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: clnt_vc.c,v 1.4 2000/07/14 08:40:42 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/getnetconfig.c b/freebsd/sys/rpc/getnetconfig.c index 05b30dfe..1ae0129d 100644 --- a/freebsd/sys/rpc/getnetconfig.c +++ b/freebsd/sys/rpc/getnetconfig.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * @@ -27,7 +29,7 @@ * SUCH DAMAGE. */ -#include "opt_inet6.h" +#include <rtems/bsd/local/opt_inet6.h> #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); diff --git a/freebsd/sys/rpc/replay.c b/freebsd/sys/rpc/replay.c index 8e161f72..2e9686e4 100644 --- a/freebsd/sys/rpc/replay.c +++ b/freebsd/sys/rpc/replay.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * diff --git a/freebsd/sys/rpc/rpc_callmsg.c b/freebsd/sys/rpc/rpc_callmsg.c index ab0848d7..a01f3f06 100644 --- a/freebsd/sys/rpc/rpc_callmsg.c +++ b/freebsd/sys/rpc/rpc_callmsg.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: rpc_callmsg.c,v 1.16 2000/07/14 08:40:42 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/rpc_com.h b/freebsd/sys/rpc/rpc_com.h index 70d4214f..7c6224bd 100644 --- a/freebsd/sys/rpc/rpc_com.h +++ b/freebsd/sys/rpc/rpc_com.h @@ -57,6 +57,10 @@ #define RPC_MAXDATASIZE 9000 #define RPC_MAXADDRSIZE 1024 +#ifdef __rtems__ +#define __RPC_GETXID(now) ((uint32_t)_Thread_Get_executing() ^ (uint32_t)(now)->tv_sec ^ \ + (uint32_t)(now)->tv_usec) +#else /* __rtems__ */ #ifdef _KERNEL #define __RPC_GETXID(now) ((uint32_t)curproc->p_pid ^ (uint32_t)(now)->tv_sec ^ \ @@ -68,6 +72,7 @@ (uint32_t)(now)->tv_usec) #endif +#endif /* __rtems__ */ __BEGIN_DECLS #ifndef _KERNEL diff --git a/freebsd/sys/rpc/rpc_generic.c b/freebsd/sys/rpc/rpc_generic.c index a4d6298b..e3eb8526 100644 --- a/freebsd/sys/rpc/rpc_generic.c +++ b/freebsd/sys/rpc/rpc_generic.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: rpc_generic.c,v 1.4 2000/09/28 09:07:04 kleink Exp $ */ /*- @@ -42,7 +44,7 @@ __FBSDID("$FreeBSD$"); * */ -#include "opt_inet6.h" +#include <rtems/bsd/local/opt_inet6.h> #include <sys/param.h> #include <sys/kernel.h> diff --git a/freebsd/sys/rpc/rpc_prot.c b/freebsd/sys/rpc/rpc_prot.c index 70a543d3..7ae4c9f1 100644 --- a/freebsd/sys/rpc/rpc_prot.c +++ b/freebsd/sys/rpc/rpc_prot.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: rpc_prot.c,v 1.16 2000/06/02 23:11:13 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/rpcb_clnt.c b/freebsd/sys/rpc/rpcb_clnt.c index 8a95999b..4316bc6b 100644 --- a/freebsd/sys/rpc/rpcb_clnt.c +++ b/freebsd/sys/rpc/rpcb_clnt.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: rpcb_clnt.c,v 1.6 2000/07/16 06:41:43 itojun Exp $ */ /*- @@ -49,7 +51,7 @@ __FBSDID("$FreeBSD$"); * Copyright (C) 1988, Sun Microsystems, Inc. */ -#include "opt_inet6.h" +#include <rtems/bsd/local/opt_inet6.h> #include <sys/param.h> #include <sys/systm.h> diff --git a/freebsd/sys/rpc/rpcb_prot.c b/freebsd/sys/rpc/rpcb_prot.c index a59dc501..8de849d1 100644 --- a/freebsd/sys/rpc/rpcb_prot.c +++ b/freebsd/sys/rpc/rpcb_prot.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: rpcb_prot.c,v 1.3 2000/07/14 08:40:42 fvdl Exp $ */ /*- diff --git a/freebsd/sys/rpc/svc.c b/freebsd/sys/rpc/svc.c index cd44b8fd..1f32ad30 100644 --- a/freebsd/sys/rpc/svc.c +++ b/freebsd/sys/rpc/svc.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: svc.c,v 1.21 2000/07/06 03:10:35 christos Exp $ */ /*- @@ -1226,6 +1228,11 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) } else if (error != 0) { KASSERT(error == EINTR || error == ERESTART, ("non-signal error %d", error)); +#ifdef __rtems__ + mtx_unlock(&grp->sg_lock); + svc_exit(pool); + mtx_lock(&grp->sg_lock); +#else /* __rtems__ */ mtx_unlock(&grp->sg_lock); p = curproc; PROC_LOCK(p); @@ -1240,6 +1247,7 @@ svc_run_internal(SVCGROUP *grp, bool_t ismaster) mtx_lock(&grp->sg_lock); break; } +#endif /* __rtems__ */ } continue; } @@ -1352,16 +1360,25 @@ void svc_run(SVCPOOL *pool) { int g, i; +#ifndef __rtems__ struct proc *p; struct thread *td; +#endif /* __rtems__ */ SVCGROUP *grp; +#ifndef __rtems__ p = curproc; td = curthread; snprintf(td->td_name, sizeof(td->td_name), "%s: master", pool->sp_name); +#endif /* __rtems__ */ + pool->sp_state = SVCPOOL_ACTIVE; +#ifndef __rtems__ pool->sp_proc = p; +#else /* __rtems__ */ + pool->sp_proc = NULL; +#endif /* __rtems__ */ /* Choose group count based on number of threads and CPUs. */ pool->sp_groupcount = max(1, min(SVC_MAXGROUPS, diff --git a/freebsd/sys/rpc/svc_auth.c b/freebsd/sys/rpc/svc_auth.c index 5dbc64b7..77d767ca 100644 --- a/freebsd/sys/rpc/svc_auth.c +++ b/freebsd/sys/rpc/svc_auth.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: svc_auth.c,v 1.12 2000/07/06 03:10:35 christos Exp $ */ /*- @@ -181,8 +183,10 @@ svc_getcred(struct svc_req *rqst, struct ucred **crp, int *flavorp) cr->cr_uid = cr->cr_ruid = cr->cr_svuid = xcr->cr_uid; crsetgroups(cr, xcr->cr_ngroups, xcr->cr_groups); cr->cr_rgid = cr->cr_svgid = cr->cr_groups[0]; +#ifndef __rtems__ cr->cr_prison = &prison0; prison_hold(cr->cr_prison); +#endif /* __rtems__ */ *crp = cr; return (TRUE); @@ -195,4 +199,3 @@ svc_getcred(struct svc_req *rqst, struct ucred **crp, int *flavorp) return (FALSE); } } - diff --git a/freebsd/sys/rpc/svc_auth_unix.c b/freebsd/sys/rpc/svc_auth_unix.c index de46bf43..4471d8c1 100644 --- a/freebsd/sys/rpc/svc_auth_unix.c +++ b/freebsd/sys/rpc/svc_auth_unix.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /*- * SPDX-License-Identifier: BSD-3-Clause * diff --git a/freebsd/sys/rpc/svc_dg.c b/freebsd/sys/rpc/svc_dg.c index 2bdd0700..5d051dc8 100644 --- a/freebsd/sys/rpc/svc_dg.c +++ b/freebsd/sys/rpc/svc_dg.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: svc_dg.c,v 1.4 2000/07/06 03:10:35 christos Exp $ */ /*- diff --git a/freebsd/sys/rpc/svc_generic.c b/freebsd/sys/rpc/svc_generic.c index 54e9cd0b..404ce3f8 100644 --- a/freebsd/sys/rpc/svc_generic.c +++ b/freebsd/sys/rpc/svc_generic.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: svc_generic.c,v 1.3 2000/07/06 03:10:35 christos Exp $ */ /*- @@ -46,7 +48,7 @@ __FBSDID("$FreeBSD$"); * */ -#include "opt_inet6.h" +#include <rtems/bsd/local/opt_inet6.h> #include <sys/param.h> #include <sys/lock.h> diff --git a/freebsd/sys/rpc/svc_vc.c b/freebsd/sys/rpc/svc_vc.c index dd6b801f..719fc87a 100644 --- a/freebsd/sys/rpc/svc_vc.c +++ b/freebsd/sys/rpc/svc_vc.c @@ -1,3 +1,5 @@ +#include <machine/rtems-bsd-kernel-space.h> + /* $NetBSD: svc_vc.c,v 1.7 2000/08/03 00:01:53 fvdl Exp $ */ /*- |