4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include "rpcsvc/nfs4_prot.h"
37 * The waiting() function returns the value passed in, until something
38 * external modifies it. In this case, the D script tst.call.d will
39 * modify the value of *a, and thus break the while loop in dotest().
41 * This serves the purpose of not making the RPC calls until tst.call.d
42 * is active. Thus, the probes in tst.call.d can fire as a result of
43 * the RPC call in dotest().
47 waiting(volatile int *a
)
59 enum clnt_stat status
;
60 struct timeval timeout
;
62 char *tag
= "dtrace test";
65 while (waiting(&a
) == 0)
71 client
= clnt_create("localhost", NFS4_PROGRAM
, NFS_V4
, "tcp");
73 clnt_pcreateerror("test");
76 auth
= authsys_create_default();
77 client
->cl_auth
= auth
;
78 args
.minorversion
= 0;
79 args
.tag
.utf8string_len
= strlen(tag
);
80 args
.tag
.utf8string_val
= tag
;
81 args
.argarray
.argarray_len
= sizeof (arg
) / sizeof (nfs_argop4
);
82 args
.argarray
.argarray_val
= arg
;
84 arg
[0].argop
= OP_PUTROOTFH
;
85 /* no need to manipulate nfs_argop4_u */
87 bzero(&res
, sizeof (res
));
89 status
= clnt_call(client
, NFSPROC4_COMPOUND
,
90 xdr_COMPOUND4args
, (caddr_t
)&args
,
91 xdr_COMPOUND4res
, (caddr_t
)&res
,
93 if (status
!= RPC_SUCCESS
) {
94 clnt_perror(client
, "test");
103 main(int argc
, char **argv
)
105 char shareline
[BUFSIZ
], unshareline
[BUFSIZ
];
108 (void) snprintf(shareline
, sizeof (shareline
),
109 "mkdir /tmp/nfsv4test.%d ; share /tmp/nfsv4test.%d", getpid(),
111 (void) snprintf(unshareline
, sizeof (unshareline
),
112 "unshare /tmp/nfsv4test.%d ; rmdir /tmp/nfsv4test.%d", getpid(),
115 (void) system(shareline
);
117 (void) system(unshareline
);