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 (c) 1991, 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI" /* SunOS */
29 #include <sys/types.h>
30 #include <sys/errno.h>
34 #include <netinet/in.h>
35 #include <rpc/types.h>
40 #include <rpc/rpc_msg.h>
41 #include <rpcsvc/rquota.h>
44 extern char *dlc_header
;
45 extern jmp_buf xdr_err
;
47 static char *procnames_short
[] = {
53 static char *procnames_long
[] = {
54 "Null procedure", /* 0 */
56 "Get active quotas", /* 2 */
61 static void show_quota(void);
64 interpret_rquota(flags
, type
, xid
, vers
, proc
, data
, len
)
65 int flags
, type
, xid
, vers
, proc
;
70 char buff
[RQ_PATHLEN
+ 1];
74 if (proc
< 0 || proc
> MAXPROC
)
78 if (setjmp(xdr_err
)) {
82 line
= get_sum_line();
85 (void) getxdr_string(buff
, RQ_PATHLEN
);
88 "RQUOTA C %s Uid=%d Path=%s",
89 procnames_short
[proc
],
92 check_retransmit(line
, xid
);
94 (void) sprintf(line
, "RQUOTA R %s ",
95 procnames_short
[proc
]);
97 status
= getxdr_u_long();
99 (void) sprintf(line
, "OK");
100 else if (status
== Q_NOQUOTA
)
101 (void) sprintf(line
, "No quota");
102 else if (status
== Q_EPERM
)
103 (void) sprintf(line
, "No permission");
107 if (flags
& F_DTAIL
) {
108 show_header("RQUOTA: ", "Remote Quota Check", len
);
110 if (setjmp(xdr_err
)) {
113 (void) sprintf(get_line(0, 0),
115 proc
, procnames_long
[proc
]);
119 case RQUOTAPROC_GETQUOTA
:
120 case RQUOTAPROC_GETACTIVEQUOTA
:
121 (void) showxdr_string(RQ_PATHLEN
,
123 (void) showxdr_long("User id = %d");
127 status
= getxdr_u_long();
128 (void) sprintf(get_line(0, 0),
131 status
== Q_OK
? "OK" :
132 status
== Q_NOQUOTA
? "No quota" :
133 status
== Q_EPERM
? "No permission":"");
148 (void) showxdr_u_long("Block size = %lu");
149 active
= getxdr_u_long();
150 (void) sprintf(get_line(0, 0),
151 " Quota checking = %lu (%s)",
153 active
? "on" : "off");
154 (void) showxdr_u_long(" Blocks hard limit = %lu");
155 (void) showxdr_u_long(" Blocks soft limit = %lu");
156 (void) showxdr_u_long(" Current block count = %lu");
158 (void) showxdr_u_long(" File hard limit = %lu");
159 (void) showxdr_u_long(" File soft limit = %lu");
160 (void) showxdr_u_long(" Current file count = %lu");
162 (void) showxdr_u_long("Excessive blocks limit = %lu sec");
163 (void) showxdr_u_long("Excessive files limit = %lu sec");