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