diff options
Diffstat (limited to 'freebsd')
-rw-r--r-- | freebsd/lib/libc/rpc/auth_unix.c | 7 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/clnt_dg.c | 17 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/clnt_generic.c | 5 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/clnt_vc.c | 18 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/getnetconfig.c | 40 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/rpc_generic.c | 2 | ||||
-rw-r--r-- | freebsd/lib/libc/rpc/rpcb_clnt.c | 4 |
7 files changed, 91 insertions, 2 deletions
diff --git a/freebsd/lib/libc/rpc/auth_unix.c b/freebsd/lib/libc/rpc/auth_unix.c index ea8f44c9..3629fcc3 100644 --- a/freebsd/lib/libc/rpc/auth_unix.c +++ b/freebsd/lib/libc/rpc/auth_unix.c @@ -191,20 +191,27 @@ authunix_create_default(void) gid_t gid; gid_t *gids; +#ifndef __rtems__ ngids_max = sysconf(_SC_NGROUPS_MAX) + 1; gids = malloc(sizeof(gid_t) * ngids_max); if (gids == NULL) return (NULL); +#endif /* __rtems__ */ if (gethostname(machname, sizeof machname) == -1) abort(); machname[sizeof(machname) - 1] = 0; uid = geteuid(); gid = getegid(); +#ifndef __rtems__ if ((ngids = getgroups(ngids_max, gids)) < 0) abort(); if (ngids > NGRPS) ngids = NGRPS; +#else /* __rtems__ */ + ngids = 0; + gids = NULL; +#endif /* __rtems__ */ /* XXX: interface problem; we should translate from uid_t and gid_t */ auth = authunix_create(machname, uid, gid, ngids, gids); free(gids); diff --git a/freebsd/lib/libc/rpc/clnt_dg.c b/freebsd/lib/libc/rpc/clnt_dg.c index 4ec2e8b0..70d94272 100644 --- a/freebsd/lib/libc/rpc/clnt_dg.c +++ b/freebsd/lib/libc/rpc/clnt_dg.c @@ -67,6 +67,12 @@ __FBSDID("$FreeBSD$"); #include "mt_misc.h" +#ifdef __rtems__ +#undef thr_sigsetmask +#define thr_sigsetmask(_a, _b, _c) +#define cond_signal(_a) +#define sigfillset(_a) +#endif /* __rtems__ */ #ifdef _FREEFALL_CONFIG /* * Disable RPC exponential back-off for FreeBSD.org systems. @@ -204,10 +210,12 @@ clnt_dg_create(int fd, const struct netbuf *svcaddr, rpcprog_t program, thr_sigsetmask(SIG_SETMASK, &(mask), NULL); goto err1; } else { +#ifndef __rtems__ int i; for (i = 0; i < dtbsize; i++) cond_init(&dg_cv[i], 0, (void *) 0); +#endif /* __rtems__ */ } } @@ -345,8 +353,10 @@ clnt_dg_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs, void *argsp, sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (dg_fd_locks[cu->cu_fd]) cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock); +#endif /* __rtems__ */ if (__isthreaded) rpc_lock_value = 1; else @@ -630,8 +640,10 @@ clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (dg_fd_locks[cu->cu_fd]) cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock); +#endif /* __rtems__ */ xdrs->x_op = XDR_FREE; dummy = (*xdr_res)(xdrs, res_ptr); mutex_unlock(&clnt_fd_lock); @@ -658,8 +670,10 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (dg_fd_locks[cu->cu_fd]) cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock); +#endif * __rtems__ */ if (__isthreaded) rpc_lock_value = 1; else @@ -800,8 +814,10 @@ clnt_dg_destroy(CLIENT *cl) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (dg_fd_locks[cu_fd]) cond_wait(&dg_cv[cu_fd], &clnt_fd_lock); +#endif * __rtems__ */ if (cu->cu_closeit) (void)_close(cu_fd); if (cu->cu_kq >= 0) @@ -852,4 +868,3 @@ time_not_ok(struct timeval *t) return (t->tv_sec < -1 || t->tv_sec > 100000000 || t->tv_usec < -1 || t->tv_usec > 1000000); } - diff --git a/freebsd/lib/libc/rpc/clnt_generic.c b/freebsd/lib/libc/rpc/clnt_generic.c index 5d1f7480..07a5258f 100644 --- a/freebsd/lib/libc/rpc/clnt_generic.c +++ b/freebsd/lib/libc/rpc/clnt_generic.c @@ -398,6 +398,11 @@ clnt_tli_create(int fd, const struct netconfig *nconf, goto err1; /* borrow errors from clnt_dg/vc creates */ if (nconf) { cl->cl_netid = strdup(nconf->nc_netid); +#ifdef __rtems__ + if (nconf->nc_device == NULL) + cl->cl_tp = ""; + else +#endif /* __rtems__ */ cl->cl_tp = strdup(nconf->nc_device); } else { cl->cl_netid = ""; diff --git a/freebsd/lib/libc/rpc/clnt_vc.c b/freebsd/lib/libc/rpc/clnt_vc.c index 76ed41ff..96817d8f 100644 --- a/freebsd/lib/libc/rpc/clnt_vc.c +++ b/freebsd/lib/libc/rpc/clnt_vc.c @@ -85,6 +85,14 @@ __FBSDID("$FreeBSD$"); #include "rpc_com.h" #include "mt_misc.h" +#ifdef __rtems__ +#undef thr_sigsetmask +#define thr_sigsetmask(_a, _b, _c) +#define cond_signal(_a) +#define sigfillset(_a) +#define _sendmsg sendmsg +#define _recvmsg recvmsg +#endif /* __rtems__ */ #define MCALL_MSG_SIZE 24 struct cmessage { @@ -219,10 +227,12 @@ clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog, thr_sigsetmask(SIG_SETMASK, &(mask), NULL); goto err; } else { +#ifndef __rtems__ int i; for (i = 0; i < dtbsize; i++) cond_init(&vc_cv[i], 0, (void *) 0); +#endif /* __rtems__ */ } } else assert(vc_cv != (cond_t *) NULL); @@ -336,8 +346,10 @@ clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr, sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (vc_fd_locks[ct->ct_fd]) cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock); +#endif /* __rtems__ */ if (__isthreaded) rpc_lock_value = 1; else @@ -489,8 +501,10 @@ clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (vc_fd_locks[ct->ct_fd]) cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock); +#endif /* __rtems__ */ xdrs->x_op = XDR_FREE; dummy = (*xdr_res)(xdrs, res_ptr); mutex_unlock(&clnt_fd_lock); @@ -536,8 +550,10 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (vc_fd_locks[ct->ct_fd]) cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock); +#endif /* __rtems__ */ if (__isthreaded) rpc_lock_value = 1; else @@ -653,8 +669,10 @@ clnt_vc_destroy(CLIENT *cl) sigfillset(&newmask); thr_sigsetmask(SIG_SETMASK, &newmask, &mask); mutex_lock(&clnt_fd_lock); +#ifndef __rtems__ while (vc_fd_locks[ct_fd]) cond_wait(&vc_cv[ct_fd], &clnt_fd_lock); +#endif /* __rtems__ */ if (ct->ct_closeit && ct->ct_fd != -1) { (void)_close(ct->ct_fd); } diff --git a/freebsd/lib/libc/rpc/getnetconfig.c b/freebsd/lib/libc/rpc/getnetconfig.c index 63e80e26..4c66122d 100644 --- a/freebsd/lib/libc/rpc/getnetconfig.c +++ b/freebsd/lib/libc/rpc/getnetconfig.c @@ -63,7 +63,45 @@ __FBSDID("$FreeBSD$"); * used to specify the network transport to be used. */ - +#ifdef __rtems__ +#undef fopen +#undef fgets +#undef fclose +static const char *internal_netconfig[] = { + "udp6 tpi_clts v inet6 udp - -\n", + "tcp6 tpi_cots_ord v inet6 tcp - -\n", + "udp tpi_clts v inet udp - -\n", + "tcp tpi_cots_ord v inet tcp - -\n", + "rawip tpi_raw - inet - - -\n", + "local tpi_cots_ord - loopback - - -\n", + NULL +}; +static int netconfig_next; +static FILE* +nc_fopen(const char* name, const char* mode) { + netconfig_next = 0; + return (FILE*) &netconfig_next; +} +static int +nc_fclose(FILE *stream) { + return 0; +} +static char * +nc_fgets(char * str, int size, FILE *stream) { + int l; + const char *p = internal_netconfig[netconfig_next];; + if (p == NULL) + return NULL; + l = strlen(p); + size = l < size ? l : size; + memcpy(str, p, size); + ++netconfig_next; + return str; +} +#define fopen nc_fopen +#define fgets nc_fgets +#define fclose nc_fclose +#endif /* __rtems__ */ /* * netconfig errors */ diff --git a/freebsd/lib/libc/rpc/rpc_generic.c b/freebsd/lib/libc/rpc/rpc_generic.c index 9a72dacc..a634a810 100644 --- a/freebsd/lib/libc/rpc/rpc_generic.c +++ b/freebsd/lib/libc/rpc/rpc_generic.c @@ -122,9 +122,11 @@ __rpc_dtbsize(void) if (tbsize) { return (tbsize); } +#ifndef __rtems__ if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { return (tbsize = (int)rl.rlim_max); } +#endif /* __rtems__ */ /* * Something wrong. I'll try to save face by returning a * pessimistic number. diff --git a/freebsd/lib/libc/rpc/rpcb_clnt.c b/freebsd/lib/libc/rpc/rpcb_clnt.c index 88717a36..a351c184 100644 --- a/freebsd/lib/libc/rpc/rpcb_clnt.c +++ b/freebsd/lib/libc/rpc/rpcb_clnt.c @@ -361,7 +361,11 @@ getclnthandle(const char *host, const struct netconfig *nconf, char **targaddr) return (client); } } else { +#ifndef __rtems__ if (getaddrinfo(host, "sunrpc", &hints, &res) != 0) { +#else /* __rtems__ */ + if (getaddrinfo(host, "111", &hints, &res) != 0) { +#endif /* __rtems__ */ rpc_createerr.cf_stat = RPC_UNKNOWNHOST; return NULL; } |