Import Debian changes 1.8.5-1
[hcoop/debian/openafs.git] / src / rxstat / rxstat.c
CommitLineData
805e021f
CE
1/*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
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 */
9
10#include <afsconfig.h>
11#include <afs/param.h>
12
13#ifndef KERNEL
14#include <roken.h>
15#endif
16
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 */
23
24/*
25 * This file creates a centralized mechanism for implementing the rpc
26 * stat code - which is generic across all servers.
27 */
28
29afs_int32
30MRXSTATS_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)
37{
38 afs_int32 rc;
39 size_t allocSize;
40
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;
46}
47
48
49afs_int32
50MRXSTATS_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)
57{
58 afs_int32 rc;
59 size_t allocSize;
60
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;
66}
67
68
69afs_int32
70MRXSTATS_QueryProcessRPCStats(struct rx_call * call, OUT afs_int32 * on)
71{
72 afs_int32 rc = 0;
73 *on = rx_queryProcessRPCStats();
74 return rc;
75}
76
77
78afs_int32
79MRXSTATS_QueryPeerRPCStats(struct rx_call * call, OUT afs_int32 * on)
80{
81 afs_int32 rc = 0;
82 *on = rx_queryPeerRPCStats();
83 return rc;
84}
85
86
87afs_int32
88MRXSTATS_EnableProcessRPCStats(struct rx_call * call)
89{
90 afs_int32 rc = 0;
91 if (!rx_RxStatUserOk(call)) {
92 rc = EPERM;
93 } else {
94 rx_enableProcessRPCStats();
95 }
96 return rc;
97}
98
99afs_int32
100MRXSTATS_EnablePeerRPCStats(struct rx_call * call)
101{
102 afs_int32 rc = 0;
103 if (!rx_RxStatUserOk(call)) {
104 rc = EPERM;
105 } else {
106 rx_enablePeerRPCStats();
107 }
108 return rc;
109}
110
111
112afs_int32
113MRXSTATS_DisableProcessRPCStats(struct rx_call * call)
114{
115 afs_int32 rc = 0;
116 if (!rx_RxStatUserOk(call)) {
117 rc = EPERM;
118 } else {
119 rx_disableProcessRPCStats();
120 }
121 return rc;
122}
123
124afs_int32
125MRXSTATS_DisablePeerRPCStats(struct rx_call * call)
126{
127 afs_int32 rc = 0;
128 if (!rx_RxStatUserOk(call)) {
129 rc = EPERM;
130 } else {
131 rx_disablePeerRPCStats();
132 }
133 return rc;
134}
135
136afs_int32
137MRXSTATS_QueryRPCStatsVersion(struct rx_call * call, OUT afs_uint32 * ver)
138{
139 afs_int32 rc = 0;
140 *ver = RX_STATS_RETRIEVAL_VERSION;
141 return rc;
142}
143
144afs_int32
145MRXSTATS_ClearProcessRPCStats(struct rx_call * call, IN afs_uint32 clearFlag)
146{
147 afs_int32 rc = 0;
148 if (!rx_RxStatUserOk(call)) {
149 rc = EPERM;
150 } else {
151 rx_clearProcessRPCStats(clearFlag);
152 }
153 return rc;
154}
155
156afs_int32
157MRXSTATS_ClearPeerRPCStats(struct rx_call * call, IN afs_uint32 clearFlag)
158{
159 afs_int32 rc = 0;
160 if (!rx_RxStatUserOk(call)) {
161 rc = EPERM;
162 } else {
163 rx_clearPeerRPCStats(clearFlag);
164 }
165 return rc;
166}