Some doc path fixes from Anders
[pkg-k5-afs_openafs.git] / src / rxstat / rxstat.c
blob857ec3997a441cc1214a429914bbc29edd8f254e
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <afsconfig.h>
11 #include <afs/param.h>
13 #ifndef KERNEL
14 #include <roken.h>
15 #endif
17 #include <afs/stds.h>
18 #include <rx/rx.h>
19 #include <rx/rxstat.h>
20 #if defined(KERNEL) && !defined(UKERNEL)
21 #include "sys/errno.h"
22 #endif /* KERNEL && !UKERNEL */
25 * This file creates a centralized mechanism for implementing the rpc
26 * stat code - which is generic across all servers.
29 afs_int32
30 MRXSTATS_RetrieveProcessRPCStats(struct rx_call *call,
31 IN afs_uint32 clientVersion,
32 OUT afs_uint32 * serverVersion,
33 OUT afs_uint32 * clock_sec,
34 OUT afs_uint32 * clock_usec,
35 OUT afs_uint32 * stat_count,
36 OUT rpcStats * stats)
38 afs_int32 rc;
39 size_t allocSize;
41 rc = rx_RetrieveProcessRPCStats(clientVersion, serverVersion, clock_sec,
42 clock_usec, &allocSize, stat_count,
43 &stats->rpcStats_val);
44 stats->rpcStats_len = (u_int)(allocSize / sizeof(afs_uint32));
45 return rc;
49 afs_int32
50 MRXSTATS_RetrievePeerRPCStats(struct rx_call * call,
51 IN afs_uint32 clientVersion,
52 OUT afs_uint32 * serverVersion,
53 OUT afs_uint32 * clock_sec,
54 OUT afs_uint32 * clock_usec,
55 OUT afs_uint32 * stat_count,
56 OUT rpcStats * stats)
58 afs_int32 rc;
59 size_t allocSize;
61 rc = rx_RetrievePeerRPCStats(clientVersion, serverVersion, clock_sec,
62 clock_usec, &allocSize, stat_count,
63 &stats->rpcStats_val);
64 stats->rpcStats_len = (u_int)(allocSize / sizeof(afs_uint32));
65 return rc;
69 afs_int32
70 MRXSTATS_QueryProcessRPCStats(struct rx_call * call, OUT afs_int32 * on)
72 afs_int32 rc = 0;
73 *on = rx_queryProcessRPCStats();
74 return rc;
78 afs_int32
79 MRXSTATS_QueryPeerRPCStats(struct rx_call * call, OUT afs_int32 * on)
81 afs_int32 rc = 0;
82 *on = rx_queryPeerRPCStats();
83 return rc;
87 afs_int32
88 MRXSTATS_EnableProcessRPCStats(struct rx_call * call)
90 afs_int32 rc = 0;
91 if (!rx_RxStatUserOk(call)) {
92 rc = EPERM;
93 } else {
94 rx_enableProcessRPCStats();
96 return rc;
99 afs_int32
100 MRXSTATS_EnablePeerRPCStats(struct rx_call * call)
102 afs_int32 rc = 0;
103 if (!rx_RxStatUserOk(call)) {
104 rc = EPERM;
105 } else {
106 rx_enablePeerRPCStats();
108 return rc;
112 afs_int32
113 MRXSTATS_DisableProcessRPCStats(struct rx_call * call)
115 afs_int32 rc = 0;
116 if (!rx_RxStatUserOk(call)) {
117 rc = EPERM;
118 } else {
119 rx_disableProcessRPCStats();
121 return rc;
124 afs_int32
125 MRXSTATS_DisablePeerRPCStats(struct rx_call * call)
127 afs_int32 rc = 0;
128 if (!rx_RxStatUserOk(call)) {
129 rc = EPERM;
130 } else {
131 rx_disablePeerRPCStats();
133 return rc;
136 afs_int32
137 MRXSTATS_QueryRPCStatsVersion(struct rx_call * call, OUT afs_uint32 * ver)
139 afs_int32 rc = 0;
140 *ver = RX_STATS_RETRIEVAL_VERSION;
141 return rc;
144 afs_int32
145 MRXSTATS_ClearProcessRPCStats(struct rx_call * call, IN afs_uint32 clearFlag)
147 afs_int32 rc = 0;
148 if (!rx_RxStatUserOk(call)) {
149 rc = EPERM;
150 } else {
151 rx_clearProcessRPCStats(clearFlag);
153 return rc;
156 afs_int32
157 MRXSTATS_ClearPeerRPCStats(struct rx_call * call, IN afs_uint32 clearFlag)
159 afs_int32 rc = 0;
160 if (!rx_RxStatUserOk(call)) {
161 rc = EPERM;
162 } else {
163 rx_clearPeerRPCStats(clearFlag);
165 return rc;