2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
25 * Sun Microsystems, Inc.
27 * Mountain View, California 94043
29 * @(#)clnt_dg.c 1.23 94/04/22 SMI; 1.19 89/03/16 Copyr 1988 Sun Micro
30 * $NetBSD: clnt_dg.c,v 1.4 2000/07/14 08:40:41 fvdl Exp $
31 * $FreeBSD: src/lib/libc/rpc/clnt_dg.c,v 1.18 2006/02/27 22:10:58 deischen Exp $
34 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
38 * Implements a connectionless client side RPC.
41 #include "namespace.h"
42 #include "reentrant.h"
43 #include <sys/types.h>
44 #include <sys/event.h>
46 #include <sys/socket.h>
47 #include <sys/ioctl.h>
48 #include <arpa/inet.h>
56 #include "un-namespace.h"
61 #define RPC_MAX_BACKOFF 30 /* seconds */
64 static void clnt_dg_abort(CLIENT *);
65 static enum clnt_stat clnt_dg_call(CLIENT *, rpcproc_t, xdrproc_t, void *,
66 xdrproc_t, void *, struct timeval);
67 static bool_t clnt_dg_control(CLIENT *, u_int, void *);
68 static void clnt_dg_destroy(CLIENT *);
69 static bool_t clnt_dg_freeres(CLIENT *, xdrproc_t, void *);
70 static void clnt_dg_geterr(CLIENT *, struct rpc_err *);
71 static struct clnt_ops *clnt_dg_ops(void);
72 static bool_t time_not_ok(struct timeval *);
76 * This machinery implements per-fd locks for MT-safety. It is not
77 * sufficient to do per-CLIENT handle locks for MT-safety because a
78 * user may create more than one CLIENT handle with the same fd behind
79 * it. Therfore, we allocate an array of flags (dg_fd_locks), protected
80 * by the clnt_fd_lock mutex, and an array (dg_cv) of condition variables
81 * similarly protected. Dg_fd_lock[fd] == 1 => a call is activte on some
82 * CLIENT handle created for that fd.
83 * The current implementation holds locks across the entire RPC and reply,
84 * including retransmissions. Yes, this is silly, and as soon as this
85 * code is proven to work, this should be the first thing fixed. One step
88 static int *dg_fd_locks;
90 #define release_fd_lock(fd, mask) { \
91 mutex_lock(&clnt_fd_lock); \
92 dg_fd_locks[fd] = 0; \
93 mutex_unlock(&clnt_fd_lock); \
94 thr_sigsetmask(SIG_SETMASK, &(mask), NULL); \
95 cond_signal(&dg_cv[fd]); \
98 static const char mem_err_clnt_dg[] = "clnt_dg_create: out of memory";
100 /* VARIABLES PROTECTED BY clnt_fd_lock: dg_fd_locks, dg_cv */
103 * Private data kept per client handle
106 int cu_fd; /* connections fd */
107 bool_t cu_closeit; /* opened by library */
108 struct sockaddr_storage cu_raddr; /* remote address */
110 struct timeval cu_wait; /* retransmit interval */
111 struct timeval cu_total; /* total time for the call */
112 struct rpc_err cu_error;
115 u_int cu_sendsz; /* send size */
117 u_int cu_recvsz; /* recv size */
119 int cu_connect; /* Use connect(). */
120 int cu_connected; /* Have done connect(). */
121 struct kevent cu_kin;
127 * Connection less client creation returns with client handle parameters.
128 * Default options are set, which the user can change using clnt_control().
129 * fd should be open and bound.
130 * NB: The rpch->cl_auth is initialized to null authentication.
131 * Caller may wish to set this something more useful.
133 * sendsz and recvsz are the maximum allowable packet sizes that can be
134 * sent and received. Normally they are the same, but they can be
135 * changed to improve the program efficiency and buffer allocation.
136 * If they are 0, use the transport default.
138 * If svcaddr is NULL, returns NULL.
141 clnt_dg_create(int fd, /* open file descriptor */
142 const struct netbuf *svcaddr, /* servers address */
143 rpcprog_t program, /* program number */
144 rpcvers_t version, /* version number */
145 u_int sendsz, /* buffer recv size */
146 u_int recvsz) /* buffer send size */
148 CLIENT *cl = NULL; /* client handle */
149 struct cu_data *cu = NULL; /* private data */
151 struct rpc_msg call_msg;
154 struct __rpc_sockinfo si;
157 sigfillset(&newmask);
158 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
159 mutex_lock(&clnt_fd_lock);
160 if (dg_fd_locks == NULL) {
163 int dtbsize = __rpc_dtbsize();
165 fd_allocsz = dtbsize * sizeof (int);
166 dg_fd_locks = (int *) mem_alloc(fd_allocsz);
167 if (dg_fd_locks == NULL) {
168 mutex_unlock(&clnt_fd_lock);
169 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
172 memset(dg_fd_locks, '\0', fd_allocsz);
174 cv_allocsz = dtbsize * sizeof (cond_t);
175 dg_cv = (cond_t *) mem_alloc(cv_allocsz);
177 mem_free(dg_fd_locks, fd_allocsz);
179 mutex_unlock(&clnt_fd_lock);
180 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
185 for (i = 0; i < dtbsize; i++)
186 cond_init(&dg_cv[i], 0, NULL);
190 mutex_unlock(&clnt_fd_lock);
191 thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
193 if (svcaddr == NULL) {
194 rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
198 if (!__rpc_fd2sockinfo(fd, &si)) {
199 rpc_createerr.cf_stat = RPC_TLIERROR;
200 rpc_createerr.cf_error.re_errno = 0;
204 * Find the receive and the send size
206 sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz);
207 recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
208 if ((sendsz == 0) || (recvsz == 0)) {
209 rpc_createerr.cf_stat = RPC_TLIERROR; /* XXX */
210 rpc_createerr.cf_error.re_errno = 0;
214 if ((cl = mem_alloc(sizeof (CLIENT))) == NULL)
217 * Should be multiple of 4 for XDR.
219 sendsz = ((sendsz + 3) / 4) * 4;
220 recvsz = ((recvsz + 3) / 4) * 4;
221 cu = mem_alloc(sizeof (*cu) + sendsz + recvsz);
224 memcpy(&cu->cu_raddr, svcaddr->buf, (size_t)svcaddr->len);
225 cu->cu_rlen = svcaddr->len;
226 cu->cu_outbuf = &cu->cu_inbuf[recvsz];
227 /* Other values can also be set through clnt_control() */
228 cu->cu_wait.tv_sec = 15; /* heuristically chosen */
229 cu->cu_wait.tv_usec = 0;
230 cu->cu_total.tv_sec = -1;
231 cu->cu_total.tv_usec = -1;
232 cu->cu_sendsz = sendsz;
233 cu->cu_recvsz = recvsz;
234 cu->cu_async = FALSE;
235 cu->cu_connect = FALSE;
236 cu->cu_connected = FALSE;
237 gettimeofday(&now, NULL);
238 call_msg.rm_xid = __RPC_GETXID(&now);
239 call_msg.rm_call.cb_prog = program;
240 call_msg.rm_call.cb_vers = version;
241 xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE);
242 if (! xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
243 rpc_createerr.cf_stat = RPC_CANTENCODEARGS; /* XXX */
244 rpc_createerr.cf_error.re_errno = 0;
247 cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
249 /* XXX fvdl - do we still want this? */
251 bindresvport_sa(fd, (struct sockaddr *)svcaddr->buf);
253 _ioctl(fd, FIONBIO, (char *)(void *)&one);
256 * By default, closeit is always FALSE. It is users responsibility
257 * to do a close on it, else the user may use clnt_control
258 * to let clnt_destroy do it for him/her.
260 cu->cu_closeit = FALSE;
262 cl->cl_ops = clnt_dg_ops();
263 cl->cl_private = (caddr_t)(void *)cu;
264 cl->cl_auth = authnone_create();
268 EV_SET(&cu->cu_kin, cu->cu_fd, EVFILT_READ, EV_ADD, 0, 0, 0);
271 warnx(mem_err_clnt_dg);
272 rpc_createerr.cf_stat = RPC_SYSTEMERROR;
273 rpc_createerr.cf_error.re_errno = errno;
276 mem_free(cl, sizeof (CLIENT));
278 mem_free(cu, sizeof (*cu) + sendsz + recvsz);
283 static enum clnt_stat
284 clnt_dg_call(CLIENT *cl, /* client handle */
285 rpcproc_t proc, /* procedure number */
286 xdrproc_t xargs, /* xdr routine for args */
287 void *argsp, /* pointer to args */
288 xdrproc_t xresults, /* xdr routine for results */
289 void *resultsp, /* pointer to results */
290 struct timeval utimeout) /* seconds to wait before giving up */
292 struct cu_data *cu = (struct cu_data *)cl->cl_private;
295 struct rpc_msg reply_msg;
298 int nrefreshes = 2; /* number of times to refresh cred */
299 struct timeval timeout;
300 struct timeval retransmit_time;
301 struct timeval next_sendtime, starttime, time_waited, tv;
307 socklen_t inlen, salen;
309 int kin_len, n, rpc_lock_value;
313 sigfillset(&newmask);
314 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
315 mutex_lock(&clnt_fd_lock);
316 while (dg_fd_locks[cu->cu_fd])
317 cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
322 dg_fd_locks[cu->cu_fd] = rpc_lock_value;
323 mutex_unlock(&clnt_fd_lock);
324 if (cu->cu_total.tv_usec == -1) {
325 timeout = utimeout; /* use supplied timeout */
327 timeout = cu->cu_total; /* use default timeout */
330 if (cu->cu_connect && !cu->cu_connected) {
331 if (_connect(cu->cu_fd, (struct sockaddr *)&cu->cu_raddr,
333 cu->cu_error.re_errno = errno;
334 cu->cu_error.re_status = RPC_CANTSEND;
337 cu->cu_connected = 1;
339 if (cu->cu_connected) {
343 sa = (struct sockaddr *)&cu->cu_raddr;
346 time_waited.tv_sec = 0;
347 time_waited.tv_usec = 0;
348 retransmit_time = next_sendtime = cu->cu_wait;
349 gettimeofday(&starttime, NULL);
351 /* Clean up in case the last call ended in a longjmp(3) call. */
354 if ((cu->cu_kq = kqueue()) < 0) {
355 cu->cu_error.re_errno = errno;
356 cu->cu_error.re_status = RPC_CANTSEND;
362 xdrs = &(cu->cu_outxdrs);
363 if (cu->cu_async == TRUE && xargs == NULL)
365 xdrs->x_op = XDR_ENCODE;
366 XDR_SETPOS(xdrs, cu->cu_xdrpos);
368 * the transaction is the first thing in the out buffer
369 * XXX Yes, and it's in network byte order, so we should to
370 * be careful when we increment it, shouldn't we.
372 xid = ntohl(*(u_int32_t *)(void *)(cu->cu_outbuf));
374 *(u_int32_t *)(void *)(cu->cu_outbuf) = htonl(xid);
376 if ((! XDR_PUTINT32(xdrs, &proc)) ||
377 (! AUTH_MARSHALL(cl->cl_auth, xdrs)) ||
378 (! (*xargs)(xdrs, argsp))) {
379 cu->cu_error.re_status = RPC_CANTENCODEARGS;
382 outlen = (size_t)XDR_GETPOS(xdrs);
385 if (_sendto(cu->cu_fd, cu->cu_outbuf, outlen, 0, sa, salen) != outlen) {
386 cu->cu_error.re_errno = errno;
387 cu->cu_error.re_status = RPC_CANTSEND;
392 * Hack to provide rpc-based message passing
394 if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
395 cu->cu_error.re_status = RPC_TIMEDOUT;
402 * sub-optimal code appears here because we have
403 * some clock time to spare while the packets are in flight.
404 * (We assume that this is actually only executed once.)
406 reply_msg.acpted_rply.ar_verf = _null_auth;
407 reply_msg.acpted_rply.ar_results.where = resultsp;
408 reply_msg.acpted_rply.ar_results.proc = xresults;
411 /* Decide how long to wait. */
412 if (timercmp(&next_sendtime, &timeout, <))
413 timersub(&next_sendtime, &time_waited, &tv);
415 timersub(&timeout, &time_waited, &tv);
416 if (tv.tv_sec < 0 || tv.tv_usec < 0)
417 tv.tv_sec = tv.tv_usec = 0;
418 TIMEVAL_TO_TIMESPEC(&tv, &ts);
420 n = _kevent(cu->cu_kq, &cu->cu_kin, kin_len, &kv, 1, &ts);
421 /* We don't need to register the event again. */
425 if (kv.flags & EV_ERROR) {
426 cu->cu_error.re_errno = kv.data;
427 cu->cu_error.re_status = RPC_CANTRECV;
430 /* We have some data now */
432 recvlen = _recvfrom(cu->cu_fd, cu->cu_inbuf,
433 cu->cu_recvsz, 0, NULL, NULL);
434 } while (recvlen < 0 && errno == EINTR);
435 if (recvlen < 0 && errno != EWOULDBLOCK) {
436 cu->cu_error.re_errno = errno;
437 cu->cu_error.re_status = RPC_CANTRECV;
440 if (recvlen >= sizeof(u_int32_t) &&
441 (cu->cu_async == TRUE ||
442 *((u_int32_t *)(void *)(cu->cu_inbuf)) ==
443 *((u_int32_t *)(void *)(cu->cu_outbuf)))) {
444 /* We now assume we have the proper reply. */
448 if (n == -1 && errno != EINTR) {
449 cu->cu_error.re_errno = errno;
450 cu->cu_error.re_status = RPC_CANTRECV;
453 gettimeofday(&tv, NULL);
454 timersub(&tv, &starttime, &time_waited);
456 /* Check for timeout. */
457 if (timercmp(&time_waited, &timeout, >)) {
458 cu->cu_error.re_status = RPC_TIMEDOUT;
462 /* Retransmit if necessary. */
463 if (timercmp(&time_waited, &next_sendtime, >)) {
464 /* update retransmit_time */
465 if (retransmit_time.tv_sec < RPC_MAX_BACKOFF)
466 timeradd(&retransmit_time, &retransmit_time,
468 timeradd(&next_sendtime, &retransmit_time,
473 inlen = (socklen_t)recvlen;
476 * now decode and validate the response
479 xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int)recvlen, XDR_DECODE);
480 ok = xdr_replymsg(&reply_xdrs, &reply_msg);
481 /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
483 if ((reply_msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
484 (reply_msg.acpted_rply.ar_stat == SUCCESS))
485 cu->cu_error.re_status = RPC_SUCCESS;
487 _seterr_reply(&reply_msg, &(cu->cu_error));
489 if (cu->cu_error.re_status == RPC_SUCCESS) {
490 if (! AUTH_VALIDATE(cl->cl_auth,
491 &reply_msg.acpted_rply.ar_verf)) {
492 cu->cu_error.re_status = RPC_AUTHERROR;
493 cu->cu_error.re_why = AUTH_INVALIDRESP;
495 if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
496 xdrs->x_op = XDR_FREE;
497 xdr_opaque_auth(xdrs,
498 &(reply_msg.acpted_rply.ar_verf));
500 } /* end successful completion */
502 * If unsuccesful AND error is an authentication error
503 * then refresh credentials and try again, else break
505 else if (cu->cu_error.re_status == RPC_AUTHERROR)
506 /* maybe our credentials need to be refreshed ... */
507 if (nrefreshes > 0 &&
508 AUTH_REFRESH(cl->cl_auth, &reply_msg)) {
512 /* end of unsuccessful completion */
513 } /* end of valid reply message */
515 cu->cu_error.re_status = RPC_CANTDECODERES;
522 release_fd_lock(cu->cu_fd, mask);
523 return (cu->cu_error.re_status);
527 clnt_dg_geterr(CLIENT *cl, struct rpc_err *errp)
529 struct cu_data *cu = (struct cu_data *)cl->cl_private;
531 *errp = cu->cu_error;
535 clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
537 struct cu_data *cu = (struct cu_data *)cl->cl_private;
538 XDR *xdrs = &(cu->cu_outxdrs);
543 sigfillset(&newmask);
544 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
545 mutex_lock(&clnt_fd_lock);
546 while (dg_fd_locks[cu->cu_fd])
547 cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
548 xdrs->x_op = XDR_FREE;
549 dummy = (*xdr_res)(xdrs, res_ptr);
550 mutex_unlock(&clnt_fd_lock);
551 thr_sigsetmask(SIG_SETMASK, &mask, NULL);
552 cond_signal(&dg_cv[cu->cu_fd]);
558 clnt_dg_abort(CLIENT *h __unused)
563 clnt_dg_control(CLIENT *cl, u_int request, void *info)
565 struct cu_data *cu = (struct cu_data *)cl->cl_private;
571 sigfillset(&newmask);
572 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
573 mutex_lock(&clnt_fd_lock);
574 while (dg_fd_locks[cu->cu_fd])
575 cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
580 dg_fd_locks[cu->cu_fd] = rpc_lock_value;
581 mutex_unlock(&clnt_fd_lock);
584 cu->cu_closeit = TRUE;
585 release_fd_lock(cu->cu_fd, mask);
587 case CLSET_FD_NCLOSE:
588 cu->cu_closeit = FALSE;
589 release_fd_lock(cu->cu_fd, mask);
593 /* for other requests which use info */
595 release_fd_lock(cu->cu_fd, mask);
600 if (time_not_ok((struct timeval *)info)) {
601 release_fd_lock(cu->cu_fd, mask);
604 cu->cu_total = *(struct timeval *)info;
607 *(struct timeval *)info = cu->cu_total;
609 case CLGET_SERVER_ADDR: /* Give him the fd address */
610 /* Now obsolete. Only for backward compatibility */
611 memcpy(info, &cu->cu_raddr, (size_t)cu->cu_rlen);
613 case CLSET_RETRY_TIMEOUT:
614 if (time_not_ok((struct timeval *)info)) {
615 release_fd_lock(cu->cu_fd, mask);
618 cu->cu_wait = *(struct timeval *)info;
620 case CLGET_RETRY_TIMEOUT:
621 *(struct timeval *)info = cu->cu_wait;
624 *(int *)info = cu->cu_fd;
627 addr = (struct netbuf *)info;
628 addr->buf = &cu->cu_raddr;
629 addr->len = cu->cu_rlen;
630 addr->maxlen = sizeof cu->cu_raddr;
632 case CLSET_SVC_ADDR: /* set to new address */
633 addr = (struct netbuf *)info;
634 if (addr->len < sizeof cu->cu_raddr) {
635 release_fd_lock(cu->cu_fd, mask);
638 memcpy(&cu->cu_raddr, addr->buf, addr->len);
639 cu->cu_rlen = addr->len;
643 * use the knowledge that xid is the
644 * first element in the call structure *.
645 * This will get the xid of the PREVIOUS call
648 ntohl(*(u_int32_t *)(void *)cu->cu_outbuf);
652 /* This will set the xid of the NEXT call */
653 *(u_int32_t *)(void *)cu->cu_outbuf =
654 htonl(*(u_int32_t *)info - 1);
655 /* decrement by 1 as clnt_dg_call() increments once */
660 * This RELIES on the information that, in the call body,
661 * the version number field is the fifth field from the
662 * begining of the RPC header. MUST be changed if the
663 * call_struct is changed
666 ntohl(*(u_int32_t *)(void *)(cu->cu_outbuf +
667 4 * BYTES_PER_XDR_UNIT));
671 *(u_int32_t *)(void *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT)
672 = htonl(*(u_int32_t *)info);
677 * This RELIES on the information that, in the call body,
678 * the program number field is the fourth field from the
679 * begining of the RPC header. MUST be changed if the
680 * call_struct is changed
683 ntohl(*(u_int32_t *)(void *)(cu->cu_outbuf +
684 3 * BYTES_PER_XDR_UNIT));
688 *(u_int32_t *)(void *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT)
689 = htonl(*(u_int32_t *)info);
692 cu->cu_async = *(int *)info;
695 cu->cu_connect = *(int *)info;
698 release_fd_lock(cu->cu_fd, mask);
701 release_fd_lock(cu->cu_fd, mask);
706 clnt_dg_destroy(CLIENT *cl)
708 struct cu_data *cu = (struct cu_data *)cl->cl_private;
709 int cu_fd = cu->cu_fd;
713 sigfillset(&newmask);
714 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
715 mutex_lock(&clnt_fd_lock);
716 while (dg_fd_locks[cu_fd])
717 cond_wait(&dg_cv[cu_fd], &clnt_fd_lock);
722 XDR_DESTROY(&(cu->cu_outxdrs));
723 mem_free(cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
724 if (cl->cl_netid && cl->cl_netid[0])
725 mem_free(cl->cl_netid, strlen(cl->cl_netid) +1);
726 if (cl->cl_tp && cl->cl_tp[0])
727 mem_free(cl->cl_tp, strlen(cl->cl_tp) +1);
728 mem_free(cl, sizeof (CLIENT));
729 mutex_unlock(&clnt_fd_lock);
730 thr_sigsetmask(SIG_SETMASK, &mask, NULL);
731 cond_signal(&dg_cv[cu_fd]);
734 static struct clnt_ops *
737 static struct clnt_ops ops;
741 /* VARIABLES PROTECTED BY ops_lock: ops */
743 sigfillset(&newmask);
744 thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
745 mutex_lock(&ops_lock);
746 if (ops.cl_call == NULL) {
747 ops.cl_call = clnt_dg_call;
748 ops.cl_abort = clnt_dg_abort;
749 ops.cl_geterr = clnt_dg_geterr;
750 ops.cl_freeres = clnt_dg_freeres;
751 ops.cl_destroy = clnt_dg_destroy;
752 ops.cl_control = clnt_dg_control;
754 mutex_unlock(&ops_lock);
755 thr_sigsetmask(SIG_SETMASK, &mask, NULL);
760 * Make sure that the time is not garbage. -1 value is allowed.
763 time_not_ok(struct timeval *t)
765 return (t->tv_sec < -1 || t->tv_sec > 100000000 ||
766 t->tv_usec < -1 || t->tv_usec > 1000000);