xref: /titanic_41/usr/src/head/rpcsvc/rstat.x (revision d58fda4376e4bf67072ce2e69f6f47036f9dbb68)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 %/*
23 % * Copyright (c) 1985, 1990, 1991 by Sun Microsystems, Inc.
24 % */
25 
26 %/* from rstat.x */
27 
28 /*
29  * Gather statistics on remote machines
30  */
31 
32 #ifdef RPC_HDR
33 %
34 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
35 %
36 %/*
37 % * Scale factor for scaled integers used to count load averages.
38 % */
39 %#ifndef	FSCALE
40 %#define	FSHIFT	8	/* bits to right of fixed binary point */
41 %#define	FSCALE	(1<<FSHIFT)
42 %#endif	/* ndef FSCALE */
43 %
44 %#ifndef DST_NONE
45 %#include <sys/time.h>		/* The time struct defined below is	*/
46 %#endif				/* meant to match struct timeval.	*/
47 %
48 %
49 %
50 %
51 %
52 %
53 #elif RPC_SVC
54 %
55 %/*
56 % *  Server side stub routines for the rstat daemon
57 % */
58 %
59 #elif RPC_CLNT
60 %
61 %/*
62 % *  Client side stub routines for the rstat daemon
63 % */
64 %
65 #elif RPC_XDR
66 %/*
67 % * XDR routines for the rstat daemon, rup and perfmeter.
68 % */
69 %
70 %/*
71 % * xdr_timeval was used in previous releases.
72 % */
73 %
74 %bool_t
75 %#ifdef __STDC__
76 %xdr_timeval(XDR *xdrs, struct timeval *tvp)
77 %#else /* K&R C */
78 %xdr_timeval(xdrs, tvp)
79 %	XDR *xdrs;
80 %	struct timeval *tvp;
81 %#endif /* K&R C */
82 %{
83 %	return (xdr_rstat_timeval(xdrs, (rstat_timeval *)tvp));
84 %}
85 
86 %
87 #endif
88 
89 const RSTAT_CPUSTATES = 4;
90 const RSTAT_DK_NDRIVE = 4;
91 
92 /*
93  * the cpu stat values
94  */
95 
96 const RSTAT_CPU_USER = 0;
97 const RSTAT_CPU_NICE = 1;
98 const RSTAT_CPU_SYS = 2;
99 const RSTAT_CPU_IDLE = 3;
100 
101 /*
102  * GMT since 0:00, January 1, 1970
103  */
104 struct rstat_timeval {
105 	int tv_sec;	/* seconds */
106 	int tv_usec;	/* and microseconds */
107 };
108 
109 struct statsvar {				/* RSTATVERS_VAR */
110 	int cp_time<>; 		/* variable number of CPU states */
111 	int dk_xfer<>;		/* variable number of disks */
112 	unsigned v_pgpgin;	/* these are cumulative sum */
113 	unsigned v_pgpgout;
114 	unsigned v_pswpin;
115 	unsigned v_pswpout;
116 	unsigned v_intr;
117 	int if_ipackets;
118 	int if_ierrors;
119 	int if_opackets;
120 	int if_oerrors;
121 	int if_collisions;
122 	unsigned v_swtch;
123 	int avenrun[3];
124 	rstat_timeval boottime;
125 	rstat_timeval curtime;
126 };
127 
128 struct statstime {				/* RSTATVERS_TIME */
129 	int cp_time[RSTAT_CPUSTATES];
130 	int dk_xfer[RSTAT_DK_NDRIVE];
131 	unsigned int v_pgpgin;	/* these are cumulative sum */
132 	unsigned int v_pgpgout;
133 	unsigned int v_pswpin;
134 	unsigned int v_pswpout;
135 	unsigned int v_intr;
136 	int if_ipackets;
137 	int if_ierrors;
138 	int if_oerrors;
139 	int if_collisions;
140 	unsigned int v_swtch;
141 	int avenrun[3];
142 	rstat_timeval boottime;
143 	rstat_timeval curtime;
144 	int if_opackets;
145 };
146 
147 program RSTATPROG {
148         /*
149          * Version 4 allows for variable number of disk and RSTAT_CPU states.
150          */
151 	version RSTATVERS_VAR {
152 		statsvar
153 		RSTATPROC_STATS (void) = 1;
154 		unsigned int
155 		RSTATPROC_HAVEDISK (void) = 2;
156 	} = 4;
157 	/*
158 	 * Newest version includes current time and context switching info
159 	 */
160 	version RSTATVERS_TIME {
161 		statstime
162 		RSTATPROC_STATS(void) = 1;
163 		unsigned int
164 		RSTATPROC_HAVEDISK(void) = 2;
165 	} = 3;
166 } = 100001;
167 
168 #ifdef RPC_HDR
169 %
170 %#if defined(__STDC__) || defined(__cplusplus)
171 %enum clnt_stat rstat(char *, struct statstime *);
172 %int havedisk(char *);
173 %#else
174 %enum clnt_stat rstat();
175 %int havedisk();
176 %#endif
177 %
178 #endif
179