4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
48 #include <rpc/rpcb_clnt.h>
49 #include <sys/socket.h>
52 #include <sys/errno.h>
54 #include <rpcsvc/mount.h>
62 main(int argc
, char *argv
[])
70 while ((c
= getopt(argc
, argv
, "h")) != EOF
) {
82 for (i
= optind
; i
< argc
; i
++)
85 if (gethostname(hostbuf
, sizeof (hostbuf
)) < 0) {
86 perror("nfs dfshares: gethostname");
95 struct timeval rpc_totout_new
= {15, 0};
102 struct exportnode
*ex
= NULL
;
104 struct timeval tout
, rpc_totout_old
;
106 (void) __rpc_control(CLCR_GET_RPCB_TIMEOUT
, &rpc_totout_old
);
107 (void) __rpc_control(CLCR_SET_RPCB_TIMEOUT
, &rpc_totout_new
);
110 * First try circuit, then drop back to datagram if
111 * circuit is unavailable (an old version of mountd perhaps)
112 * Using circuit is preferred because it can handle
113 * arbitrarily long export lists.
115 cl
= clnt_create(host
, MOUNTPROG
, MOUNTVERS
, "circuit_n");
117 if (rpc_createerr
.cf_stat
== RPC_PROGNOTREGISTERED
)
118 cl
= clnt_create(host
, MOUNTPROG
, MOUNTVERS
,
121 (void) fprintf(stderr
, "nfs dfshares:");
122 clnt_pcreateerror(host
);
123 (void) __rpc_control(CLCR_SET_RPCB_TIMEOUT
,
129 (void) __rpc_control(CLCR_SET_RPCB_TIMEOUT
, &rpc_totout_old
);
133 if (err
= clnt_call(cl
, MOUNTPROC_EXPORT
, xdr_void
,
134 0, xdr_exports
, (caddr_t
)&ex
, tout
)) {
135 (void) fprintf(stderr
, "nfs dfshares: %s\n", clnt_sperrno(err
));
146 printf("%-35s %12s %-8s %s\n",
147 "RESOURCE", "SERVER", "ACCESS", "TRANSPORT");
152 printf("%10s:%-24s %12s %-8s %s\n",
153 host
, ex
->ex_dir
, host
, " -", " -");
162 struct exportnode
*ex
;
164 struct groupnode
*gr
, *tmpgr
;
165 struct exportnode
*tmpex
;
184 (void) fprintf(stderr
, "Usage: dfshares [-h] [host ...]\n");