mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 18:41:59 +08:00
Update to FreeBSD head 2016-08-23
Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
@@ -143,7 +143,6 @@ static cond_t *vc_cv;
|
||||
|
||||
static const char clnt_vc_errstr[] = "%s : %s";
|
||||
static const char clnt_vc_str[] = "clnt_vc_create";
|
||||
static const char clnt_read_vc_str[] = "read_vc";
|
||||
static const char __no_mem_str[] = "out of memory";
|
||||
|
||||
/*
|
||||
@@ -156,15 +155,17 @@ static const char __no_mem_str[] = "out of memory";
|
||||
* set this something more useful.
|
||||
*
|
||||
* fd should be an open socket
|
||||
*
|
||||
* fd - open file descriptor
|
||||
* raddr - servers address
|
||||
* prog - program number
|
||||
* vers - version number
|
||||
* sendsz - buffer send size
|
||||
* recvsz - buffer recv size
|
||||
*/
|
||||
CLIENT *
|
||||
clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
||||
int fd; /* open file descriptor */
|
||||
const struct netbuf *raddr; /* servers address */
|
||||
const rpcprog_t prog; /* program number */
|
||||
const rpcvers_t vers; /* version number */
|
||||
u_int sendsz; /* buffer recv size */
|
||||
u_int recvsz; /* buffer send size */
|
||||
clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
|
||||
const rpcvers_t vers, u_int sendsz, u_int recvsz)
|
||||
{
|
||||
CLIENT *cl; /* client handle */
|
||||
struct ct_data *ct = NULL; /* client handle */
|
||||
@@ -261,7 +262,7 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
||||
if (ct->ct_addr.buf == NULL)
|
||||
goto err;
|
||||
memcpy(ct->ct_addr.buf, raddr->buf, raddr->len);
|
||||
ct->ct_addr.len = raddr->maxlen;
|
||||
ct->ct_addr.len = raddr->len;
|
||||
ct->ct_addr.maxlen = raddr->maxlen;
|
||||
|
||||
/*
|
||||
@@ -314,14 +315,8 @@ err:
|
||||
}
|
||||
|
||||
static enum clnt_stat
|
||||
clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
|
||||
CLIENT *cl;
|
||||
rpcproc_t proc;
|
||||
xdrproc_t xdr_args;
|
||||
void *args_ptr;
|
||||
xdrproc_t xdr_results;
|
||||
void *results_ptr;
|
||||
struct timeval timeout;
|
||||
clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr,
|
||||
xdrproc_t xdr_results, void *results_ptr, struct timeval timeout)
|
||||
{
|
||||
struct ct_data *ct = (struct ct_data *) cl->cl_private;
|
||||
XDR *xdrs = &(ct->ct_xdrs);
|
||||
@@ -464,9 +459,7 @@ call_again:
|
||||
}
|
||||
|
||||
static void
|
||||
clnt_vc_geterr(cl, errp)
|
||||
CLIENT *cl;
|
||||
struct rpc_err *errp;
|
||||
clnt_vc_geterr(CLIENT *cl, struct rpc_err *errp)
|
||||
{
|
||||
struct ct_data *ct;
|
||||
|
||||
@@ -478,10 +471,7 @@ clnt_vc_geterr(cl, errp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
clnt_vc_freeres(cl, xdr_res, res_ptr)
|
||||
CLIENT *cl;
|
||||
xdrproc_t xdr_res;
|
||||
void *res_ptr;
|
||||
clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
|
||||
{
|
||||
struct ct_data *ct;
|
||||
XDR *xdrs;
|
||||
@@ -510,16 +500,26 @@ clnt_vc_freeres(cl, xdr_res, res_ptr)
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
clnt_vc_abort(cl)
|
||||
CLIENT *cl;
|
||||
clnt_vc_abort(CLIENT *cl)
|
||||
{
|
||||
}
|
||||
|
||||
static __inline void
|
||||
htonlp(void *dst, const void *src, uint32_t incr)
|
||||
{
|
||||
/* We are aligned, so we think */
|
||||
*(uint32_t *)dst = htonl(*(const uint32_t *)src + incr);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
ntohlp(void *dst, const void *src)
|
||||
{
|
||||
/* We are aligned, so we think */
|
||||
*(uint32_t *)dst = htonl(*(const uint32_t *)src);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
clnt_vc_control(cl, request, info)
|
||||
CLIENT *cl;
|
||||
u_int request;
|
||||
void *info;
|
||||
clnt_vc_control(CLIENT *cl, u_int request, void *info)
|
||||
{
|
||||
struct ct_data *ct;
|
||||
void *infop = info;
|
||||
@@ -592,49 +592,39 @@ clnt_vc_control(cl, request, info)
|
||||
* first element in the call structure
|
||||
* This will get the xid of the PREVIOUS call
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
|
||||
ntohlp(info, &ct->ct_u.ct_mcalli);
|
||||
break;
|
||||
case CLSET_XID:
|
||||
/* This will set the xid of the NEXT call */
|
||||
*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
|
||||
htonl(*((u_int32_t *)info) + 1);
|
||||
/* increment by 1 as clnt_vc_call() decrements once */
|
||||
htonlp(&ct->ct_u.ct_mcalli, info, 1);
|
||||
break;
|
||||
case CLGET_VERS:
|
||||
/*
|
||||
* This RELIES on the information that, in the call body,
|
||||
* the version number field is the fifth field from the
|
||||
* begining of the RPC header. MUST be changed if the
|
||||
* beginning of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT));
|
||||
ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
|
||||
break;
|
||||
|
||||
case CLSET_VERS:
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
|
||||
break;
|
||||
|
||||
case CLGET_PROG:
|
||||
/*
|
||||
* This RELIES on the information that, in the call body,
|
||||
* the program number field is the fourth field from the
|
||||
* begining of the RPC header. MUST be changed if the
|
||||
* beginning of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT));
|
||||
ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
|
||||
break;
|
||||
|
||||
case CLSET_PROG:
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -647,8 +637,7 @@ clnt_vc_control(cl, request, info)
|
||||
|
||||
|
||||
static void
|
||||
clnt_vc_destroy(cl)
|
||||
CLIENT *cl;
|
||||
clnt_vc_destroy(CLIENT *cl)
|
||||
{
|
||||
struct ct_data *ct = (struct ct_data *) cl->cl_private;
|
||||
int ct_fd = ct->ct_fd;
|
||||
@@ -668,8 +657,7 @@ clnt_vc_destroy(cl)
|
||||
(void)_close(ct->ct_fd);
|
||||
}
|
||||
XDR_DESTROY(&(ct->ct_xdrs));
|
||||
if (ct->ct_addr.buf)
|
||||
free(ct->ct_addr.buf);
|
||||
free(ct->ct_addr.buf);
|
||||
mem_free(ct, sizeof(struct ct_data));
|
||||
if (cl->cl_netid && cl->cl_netid[0])
|
||||
mem_free(cl->cl_netid, strlen(cl->cl_netid) +1);
|
||||
@@ -687,10 +675,7 @@ clnt_vc_destroy(cl)
|
||||
* around for the rpc level.
|
||||
*/
|
||||
static int
|
||||
read_vc(ctp, buf, len)
|
||||
void *ctp;
|
||||
void *buf;
|
||||
int len;
|
||||
read_vc(void *ctp, void *buf, int len)
|
||||
{
|
||||
struct sockaddr sa;
|
||||
socklen_t sal;
|
||||
@@ -744,10 +729,7 @@ read_vc(ctp, buf, len)
|
||||
}
|
||||
|
||||
static int
|
||||
write_vc(ctp, buf, len)
|
||||
void *ctp;
|
||||
void *buf;
|
||||
int len;
|
||||
write_vc(void *ctp, void *buf, int len)
|
||||
{
|
||||
struct sockaddr sa;
|
||||
socklen_t sal;
|
||||
@@ -778,7 +760,7 @@ write_vc(ctp, buf, len)
|
||||
}
|
||||
|
||||
static struct clnt_ops *
|
||||
clnt_vc_ops()
|
||||
clnt_vc_ops(void)
|
||||
{
|
||||
static struct clnt_ops ops;
|
||||
sigset_t mask, newmask;
|
||||
@@ -806,18 +788,14 @@ clnt_vc_ops()
|
||||
* Note this is different from time_not_ok in clnt_dg.c
|
||||
*/
|
||||
static bool_t
|
||||
time_not_ok(t)
|
||||
struct timeval *t;
|
||||
time_not_ok(struct timeval *t)
|
||||
{
|
||||
return (t->tv_sec <= -1 || t->tv_sec > 100000000 ||
|
||||
t->tv_usec <= -1 || t->tv_usec > 1000000);
|
||||
}
|
||||
|
||||
static int
|
||||
__msgread(sock, buf, cnt)
|
||||
int sock;
|
||||
void *buf;
|
||||
size_t cnt;
|
||||
__msgread(int sock, void *buf, size_t cnt)
|
||||
{
|
||||
struct iovec iov[1];
|
||||
struct msghdr msg;
|
||||
@@ -842,10 +820,7 @@ __msgread(sock, buf, cnt)
|
||||
}
|
||||
|
||||
static int
|
||||
__msgwrite(sock, buf, cnt)
|
||||
int sock;
|
||||
void *buf;
|
||||
size_t cnt;
|
||||
__msgwrite(int sock, void *buf, size_t cnt)
|
||||
{
|
||||
struct iovec iov[1];
|
||||
struct msghdr msg;
|
||||
|
Reference in New Issue
Block a user