2 * Copyright (c) 2009, Sun Microsystems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
30 * clnt_tcp.c, Implements a TCP/IP based, client side RPC.
32 * Copyright (C) 1984, Sun Microsystems, Inc.
34 * TCP based RPC supports 'batched calls'.
35 * A sequence of calls may be batched-up in a send buffer. The rpc call
36 * return immediately to the client even though the call was not necessarily
37 * sent. The batching occurs if the results' xdr routine is NULL (0) AND
38 * the rpc timeout value is zero (see clnt.h, rpc).
40 * Clients should NOT casually batch calls that in fact return results; that is,
41 * the server side should be aware that a call is batched and not produce any
42 * return message. Batched calls that produce many result messages can
43 * deadlock (netlock) the client and the server....
45 * Now go hang yourself.
49 #include <reentrant.h>
50 #include <sys/types.h>
52 #include <sys/syslog.h>
55 #include <sys/socket.h>
56 #include <arpa/inet.h>
70 #define MCALL_MSG_SIZE 24
72 #define CMGROUP_MAX 16
73 #define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
76 * Credentials structure, used to verify the identity of a peer
77 * process that has sent us a message. This is allocated by the
78 * peer process but filled in by the kernel. This prevents the
79 * peer from lying about its identity. (Note that cmcred_groups[0]
80 * is the effective GID.)
83 pid_t cmcred_pid; /* PID of sending process */
84 uid_t cmcred_uid; /* real UID of sending process */
85 uid_t cmcred_euid; /* effective UID of sending process */
86 gid_t cmcred_gid; /* real GID of sending process */
87 short cmcred_ngroups; /* number or groups */
88 gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
93 struct cmsgcred cmcred;
96 static enum clnt_stat clnt_vc_call(CLIENT *, rpcproc_t, xdrproc_t, void *,
97 xdrproc_t, void *, struct timeval);
98 static void clnt_vc_geterr(CLIENT *, struct rpc_err *);
99 static bool_t clnt_vc_freeres(CLIENT *, xdrproc_t, void *);
100 static void clnt_vc_abort(CLIENT *);
101 static bool_t clnt_vc_control(CLIENT *, u_int, void *);
102 static void clnt_vc_destroy(CLIENT *);
103 static struct clnt_ops *clnt_vc_ops(void);
104 static bool_t time_not_ok(struct timeval *);
105 static int read_vc(void *, void *, int);
106 static int write_vc(void *, void *, int);
109 int ct_fd; /* connection's fd */
110 bool_t ct_closeit; /* close it on destroy */
111 struct timeval ct_wait; /* wait interval in milliseconds */
112 bool_t ct_waitset; /* wait set by clnt_control? */
113 struct netbuf ct_addr; /* remote addr */
114 struct rpc_err ct_error;
116 char ct_mcallc[MCALL_MSG_SIZE]; /* marshalled callmsg */
119 u_int ct_mpos; /* pos after marshal */
120 XDR ct_xdrs; /* XDR stream */
124 * This machinery implements per-fd locks for MT-safety. It is not
125 * sufficient to do per-CLIENT handle locks for MT-safety because a
126 * user may create more than one CLIENT handle with the same fd behind
127 * it. Therfore, we allocate an array of flags (vc_fd_locks), protected
128 * by the clnt_fd_lock mutex, and an array (vc_cv) of condition variables
129 * similarly protected. Vc_fd_lock[fd] == 1 => a call is active on some
130 * CLIENT handle created for that fd.
131 * The current implementation holds locks across the entire RPC and reply.
132 * Yes, this is silly, and as soon as this code is proven to work, this
133 * should be the first thing fixed. One step at a time.
135 static int *vc_fd_locks;
136 extern pthread_mutex_t disrupt_lock;
137 extern mutex_t clnt_fd_lock;
138 static cond_t *vc_cv;
139 #define release_fd_lock(fd, mask) { \
140 mutex_lock(&clnt_fd_lock); \
141 vc_fd_locks[fd] = 0; \
142 mutex_unlock(&clnt_fd_lock); \
143 thr_sigsetmask(SIG_SETMASK, &(mask), (sigset_t *) NULL); \
144 cond_signal(&vc_cv[fd]); \
147 static const char clnt_vc_errstr[] = "%s : %s";
148 static const char clnt_vc_str[] = "clnt_vc_create";
149 static const char clnt_read_vc_str[] = "read_vc";
150 static const char __no_mem_str[] = "out of memory";
153 * Create a client handle for a connection.
154 * Default options are set, which the user can change using clnt_control()'s.
155 * The rpc/vc package does buffering similar to stdio, so the client
156 * must pick send and receive buffer sizes, 0 => use the default.
157 * NB: fd is copied into a private area.
158 * NB: The rpch->cl_auth is set null authentication. Caller may wish to
159 * set this something more useful.
161 * fd should be an open socket
164 clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
165 int fd; /* open file descriptor */
166 const struct netbuf *raddr; /* servers address */
167 const rpcprog_t prog; /* program number */
168 const rpcvers_t vers; /* version number */
169 u_int sendsz; /* buffer recv size */
170 u_int recvsz; /* buffer send size */
172 CLIENT *cl; /* client handle */
173 struct ct_data *ct = NULL; /* client handle */
175 struct rpc_msg call_msg;
176 static u_int32_t disrupt;
179 struct sockaddr_storage ss;
181 struct __rpc_sockinfo si;
183 mutex_lock(&disrupt_lock);
185 disrupt = (u_int32_t)(long)raddr;
186 mutex_unlock(&disrupt_lock);
188 cl = (CLIENT *)mem_alloc(sizeof (*cl));
189 ct = (struct ct_data *)mem_alloc(sizeof (*ct));
190 if ((cl == (CLIENT *)NULL) || (ct == (struct ct_data *)NULL)) {
191 (void) syslog(LOG_ERR, clnt_vc_errstr,
192 clnt_vc_str, __no_mem_str);
193 rpc_createerr.cf_stat = RPC_SYSTEMERROR;
194 rpc_createerr.cf_error.re_errno = errno;
197 ct->ct_addr.buf = NULL;
198 sigfillset(&newmask);
199 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
200 mutex_lock(&clnt_fd_lock);
201 if (vc_fd_locks == (int *) NULL) {
202 int cv_allocsz, fd_allocsz;
203 int dtbsize = __rpc_dtbsize();
205 fd_allocsz = dtbsize * sizeof (int);
206 vc_fd_locks = (int *) mem_alloc(fd_allocsz);
207 if (vc_fd_locks == (int *) NULL) {
208 mutex_unlock(&clnt_fd_lock);
209 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
212 memset(vc_fd_locks, '\0', fd_allocsz);
214 assert(vc_cv == (cond_t *) NULL);
215 cv_allocsz = dtbsize * sizeof (cond_t);
216 vc_cv = (cond_t *) mem_alloc(cv_allocsz);
217 if (vc_cv == (cond_t *) NULL) {
218 mem_free(vc_fd_locks, fd_allocsz);
219 vc_fd_locks = (int *) NULL;
220 mutex_unlock(&clnt_fd_lock);
221 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
226 for (i = 0; i < dtbsize; i++)
227 cond_init(&vc_cv[i], 0, (void *) 0);
230 assert(vc_cv != (cond_t *) NULL);
233 * XXX - fvdl connecting while holding a mutex?
236 if (getpeername(fd, (struct sockaddr *)&ss, &slen) < 0) {
237 if (errno != ENOTCONN) {
238 rpc_createerr.cf_stat = RPC_SYSTEMERROR;
239 rpc_createerr.cf_error.re_errno = errno;
240 mutex_unlock(&clnt_fd_lock);
241 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
244 if (connect(fd, (struct sockaddr *)raddr->buf, raddr->len) < 0){
245 rpc_createerr.cf_stat = RPC_SYSTEMERROR;
246 rpc_createerr.cf_error.re_errno = errno;
247 mutex_unlock(&clnt_fd_lock);
248 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
252 mutex_unlock(&clnt_fd_lock);
253 if (!__rpc_fd2sockinfo(fd, &si))
255 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
257 ct->ct_closeit = FALSE;
260 * Set up private data struct
263 ct->ct_wait.tv_usec = 0;
264 ct->ct_waitset = FALSE;
265 ct->ct_addr.buf = malloc(raddr->maxlen);
266 if (ct->ct_addr.buf == NULL)
268 memcpy(ct->ct_addr.buf, raddr->buf, raddr->len);
269 ct->ct_addr.len = raddr->len;
270 ct->ct_addr.maxlen = raddr->maxlen;
273 * Initialize call message
275 (void)gettimeofday(&now, NULL);
276 mutex_lock(&disrupt_lock);
277 call_msg.rm_xid = ((u_int32_t)++disrupt) ^ __RPC_GETXID(&now);
278 mutex_unlock(&disrupt_lock);
279 call_msg.rm_direction = CALL;
280 call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
281 call_msg.rm_call.cb_prog = (u_int32_t)prog;
282 call_msg.rm_call.cb_vers = (u_int32_t)vers;
285 * pre-serialize the static part of the call msg and stash it away
287 xdrmem_create(&(ct->ct_xdrs), ct->ct_u.ct_mcallc, MCALL_MSG_SIZE,
289 if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
290 if (ct->ct_closeit) {
295 ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs));
296 XDR_DESTROY(&(ct->ct_xdrs));
299 * Create a client handle which uses xdrrec for serialization
300 * and authnone for authentication.
302 cl->cl_ops = clnt_vc_ops();
304 cl->cl_auth = authnone_create();
305 sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz);
306 recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
307 xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
308 cl->cl_private, read_vc, write_vc);
315 mem_free(ct->ct_addr.buf, ct->ct_addr.len);
316 mem_free(ct, sizeof (struct ct_data));
319 mem_free(cl, sizeof (CLIENT));
321 return ((CLIENT *)NULL);
324 static enum clnt_stat
325 clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
330 xdrproc_t xdr_results;
332 struct timeval timeout;
334 struct ct_data *ct = (struct ct_data *) cl->cl_private;
335 XDR *xdrs = &(ct->ct_xdrs);
336 struct rpc_msg reply_msg;
338 u_int32_t *msg_x_id = &ct->ct_u.ct_mcalli; /* yuk */
341 sigset_t mask, newmask;
346 sigfillset(&newmask);
347 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
348 mutex_lock(&clnt_fd_lock);
349 while (vc_fd_locks[ct->ct_fd])
350 cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
352 vc_fd_locks[ct->ct_fd] = rpc_lock_value;
353 mutex_unlock(&clnt_fd_lock);
354 if (!ct->ct_waitset) {
355 /* If time is not within limits, we ignore it. */
356 if (time_not_ok(&timeout) == FALSE)
357 ct->ct_wait = timeout;
361 (xdr_results == NULL && timeout.tv_sec == 0
362 && timeout.tv_usec == 0) ? FALSE : TRUE;
365 xdrs->x_op = XDR_ENCODE;
366 ct->ct_error.re_status = RPC_SUCCESS;
367 x_id = ntohl(--(*msg_x_id));
369 if ((! XDR_PUTBYTES(xdrs, ct->ct_u.ct_mcallc, ct->ct_mpos)) ||
370 (! XDR_PUTINT32(xdrs, (int32_t *)&proc)) ||
371 (! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
372 (! AUTH_WRAP(cl->cl_auth, xdrs, xdr_args, args_ptr))) {
373 if (ct->ct_error.re_status == RPC_SUCCESS)
374 ct->ct_error.re_status = RPC_CANTENCODEARGS;
375 (void)xdrrec_endofrecord(xdrs, TRUE);
376 release_fd_lock(ct->ct_fd, mask);
377 return (ct->ct_error.re_status);
379 if (! xdrrec_endofrecord(xdrs, shipnow)) {
380 release_fd_lock(ct->ct_fd, mask);
381 return (ct->ct_error.re_status = RPC_CANTSEND);
384 release_fd_lock(ct->ct_fd, mask);
385 return (RPC_SUCCESS);
388 * Hack to provide rpc-based message passing
390 if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
391 release_fd_lock(ct->ct_fd, mask);
392 return(ct->ct_error.re_status = RPC_TIMEDOUT);
397 * Keep receiving until we get a valid transaction id
399 xdrs->x_op = XDR_DECODE;
401 reply_msg.acpted_rply.ar_verf = _null_auth;
402 reply_msg.acpted_rply.ar_results.where = NULL;
403 reply_msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
404 if (! xdrrec_skiprecord(xdrs)) {
405 release_fd_lock(ct->ct_fd, mask);
406 return (ct->ct_error.re_status);
408 /* now decode and validate the response header */
409 if (! xdr_replymsg(xdrs, &reply_msg)) {
410 if (ct->ct_error.re_status == RPC_SUCCESS)
412 release_fd_lock(ct->ct_fd, mask);
413 return (ct->ct_error.re_status);
415 if (reply_msg.rm_xid == x_id)
422 _seterr_reply(&reply_msg, &(ct->ct_error));
423 if (ct->ct_error.re_status == RPC_SUCCESS) {
424 if (! AUTH_VALIDATE(cl->cl_auth,
425 &reply_msg.acpted_rply.ar_verf)) {
426 ct->ct_error.re_status = RPC_AUTHERROR;
427 ct->ct_error.re_why = AUTH_INVALIDRESP;
428 } else if (! AUTH_UNWRAP(cl->cl_auth, xdrs,
429 xdr_results, results_ptr)) {
430 if (ct->ct_error.re_status == RPC_SUCCESS)
431 ct->ct_error.re_status = RPC_CANTDECODERES;
433 /* free verifier ... */
434 if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
435 xdrs->x_op = XDR_FREE;
436 (void)xdr_opaque_auth(xdrs,
437 &(reply_msg.acpted_rply.ar_verf));
439 } /* end successful completion */
441 /* maybe our credentials need to be refreshed ... */
442 if (refreshes-- && AUTH_REFRESH(cl->cl_auth, &reply_msg))
444 } /* end of unsuccessful completion */
445 release_fd_lock(ct->ct_fd, mask);
446 return (ct->ct_error.re_status);
450 clnt_vc_geterr(cl, errp)
452 struct rpc_err *errp;
457 assert(errp != NULL);
459 ct = (struct ct_data *) cl->cl_private;
460 *errp = ct->ct_error;
464 clnt_vc_freeres(cl, xdr_res, res_ptr)
477 ct = (struct ct_data *)cl->cl_private;
478 xdrs = &(ct->ct_xdrs);
480 sigfillset(&newmask);
481 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
482 mutex_lock(&clnt_fd_lock);
483 while (vc_fd_locks[ct->ct_fd])
484 cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
485 xdrs->x_op = XDR_FREE;
486 dummy = (*xdr_res)(xdrs, res_ptr);
487 mutex_unlock(&clnt_fd_lock);
488 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
489 cond_signal(&vc_cv[ct->ct_fd]);
502 clnt_vc_control(cl, request, info)
517 ct = (struct ct_data *)cl->cl_private;
519 sigfillset(&newmask);
520 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
521 mutex_lock(&clnt_fd_lock);
522 while (vc_fd_locks[ct->ct_fd])
523 cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
525 vc_fd_locks[ct->ct_fd] = rpc_lock_value;
526 mutex_unlock(&clnt_fd_lock);
530 ct->ct_closeit = TRUE;
531 release_fd_lock(ct->ct_fd, mask);
533 case CLSET_FD_NCLOSE:
534 ct->ct_closeit = FALSE;
535 release_fd_lock(ct->ct_fd, mask);
541 /* for other requests which use info */
543 release_fd_lock(ct->ct_fd, mask);
548 if (time_not_ok((struct timeval *)info)) {
549 release_fd_lock(ct->ct_fd, mask);
552 ct->ct_wait = *(struct timeval *)infop;
553 ct->ct_waitset = TRUE;
556 *(struct timeval *)infop = ct->ct_wait;
558 case CLGET_SERVER_ADDR:
559 (void) memcpy(info, ct->ct_addr.buf, (size_t)ct->ct_addr.len);
562 *(int *)info = ct->ct_fd;
565 /* The caller should not free this memory area */
566 *(struct netbuf *)info = ct->ct_addr;
568 case CLSET_SVC_ADDR: /* set to new address */
569 release_fd_lock(ct->ct_fd, mask);
573 * use the knowledge that xid is the
574 * first element in the call structure
575 * This will get the xid of the PREVIOUS call
578 ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
581 /* This will set the xid of the NEXT call */
582 *(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
583 htonl(*((u_int32_t *)info) + 1);
584 /* increment by 1 as clnt_vc_call() decrements once */
588 * This RELIES on the information that, in the call body,
589 * the version number field is the fifth field from the
590 * begining of the RPC header. MUST be changed if the
591 * call_struct is changed
593 memcpy(&tmp, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, sizeof (tmp));
595 memcpy(info, <mp, sizeof (ltmp));
599 memcpy(<mp, info, sizeof (ltmp));
601 memcpy(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, &tmp, sizeof(tmp));
606 * This RELIES on the information that, in the call body,
607 * the program number field is the fourth field from the
608 * begining of the RPC header. MUST be changed if the
609 * call_struct is changed
611 memcpy(&tmp, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, sizeof (tmp));
613 memcpy(info, <mp, sizeof (ltmp));
617 memcpy(<mp, info, sizeof (ltmp));
619 memcpy(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, &tmp, sizeof(tmp));
623 release_fd_lock(ct->ct_fd, mask);
626 release_fd_lock(ct->ct_fd, mask);
635 struct ct_data *ct = (struct ct_data *) cl->cl_private;
636 int ct_fd = ct->ct_fd;
642 ct = (struct ct_data *) cl->cl_private;
644 sigfillset(&newmask);
645 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
646 mutex_lock(&clnt_fd_lock);
647 while (vc_fd_locks[ct_fd])
648 cond_wait(&vc_cv[ct_fd], &clnt_fd_lock);
649 if (ct->ct_closeit && ct->ct_fd != -1) {
650 (void)close(ct->ct_fd);
652 XDR_DESTROY(&(ct->ct_xdrs));
654 free(ct->ct_addr.buf);
655 mem_free(ct, sizeof(struct ct_data));
656 if (cl->cl_netid && cl->cl_netid[0])
657 mem_free(cl->cl_netid, strlen(cl->cl_netid) +1);
658 if (cl->cl_tp && cl->cl_tp[0])
659 mem_free(cl->cl_tp, strlen(cl->cl_tp) +1);
660 mem_free(cl, sizeof(CLIENT));
661 mutex_unlock(&clnt_fd_lock);
662 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
663 cond_signal(&vc_cv[ct_fd]);
667 * Interface between xdr serializer and tcp connection.
668 * Behaves like the system calls, read & write, but keeps some error state
669 * around for the rpc level.
672 read_vc(ctp, buf, len)
681 struct ct_data *ct = (struct ct_data *)ctp;
683 int milliseconds = (int)((ct->ct_wait.tv_sec * 1000) +
684 (ct->ct_wait.tv_usec / 1000));
691 switch (poll(&fd, 1, milliseconds)) {
693 ct->ct_error.re_status = RPC_TIMEDOUT;
699 ct->ct_error.re_status = RPC_CANTRECV;
700 ct->ct_error.re_errno = errno;
706 len = read(ct->ct_fd, buf, (size_t)len);
711 ct->ct_error.re_errno = ECONNRESET;
712 ct->ct_error.re_status = RPC_CANTRECV;
713 len = -1; /* it's really an error */
717 ct->ct_error.re_errno = errno;
718 ct->ct_error.re_status = RPC_CANTRECV;
725 write_vc(ctp, buf, len)
730 struct ct_data *ct = (struct ct_data *)ctp;
733 for (cnt = len; cnt > 0; cnt -= i, buf += i) {
734 if ((i = write(ct->ct_fd, buf, (size_t)cnt)) == -1) {
735 ct->ct_error.re_errno = errno;
736 ct->ct_error.re_status = RPC_CANTSEND;
743 static struct clnt_ops *
746 static struct clnt_ops ops;
747 extern mutex_t ops_lock;
748 sigset_t mask, newmask;
750 /* VARIABLES PROTECTED BY ops_lock: ops */
752 sigfillset(&newmask);
753 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
754 mutex_lock(&ops_lock);
755 if (ops.cl_call == NULL) {
756 ops.cl_call = clnt_vc_call;
757 ops.cl_abort = clnt_vc_abort;
758 ops.cl_geterr = clnt_vc_geterr;
759 ops.cl_freeres = clnt_vc_freeres;
760 ops.cl_destroy = clnt_vc_destroy;
761 ops.cl_control = clnt_vc_control;
763 mutex_unlock(&ops_lock);
764 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
769 * Make sure that the time is not garbage. -1 value is disallowed.
770 * Note this is different from time_not_ok in clnt_dg.c
776 return (t->tv_sec <= -1 || t->tv_sec > 100000000 ||
777 t->tv_usec <= -1 || t->tv_usec > 1000000);