Sat Jan 29 18:21:23 2011 UTC ()
Add EVCNT_TYPE_ANY for sysctl.  Fix EVCNT_STRING_MAX fencepost error.


(matt)
diff -r1.7 -r1.8 src/sys/sys/evcnt.h

cvs diff -r1.7 -r1.8 src/sys/sys/evcnt.h (expand / switch to unified diff)

--- src/sys/sys/evcnt.h 2010/12/11 22:30:55 1.7
+++ src/sys/sys/evcnt.h 2011/01/29 18:21:22 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: evcnt.h,v 1.7 2010/12/11 22:30:55 matt Exp $ */ 1/* $NetBSD: evcnt.h,v 1.8 2011/01/29 18:21:22 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -86,29 +86,30 @@ struct evcnt { @@ -86,29 +86,30 @@ struct evcnt {
86 uint64_t ev_count; /* how many have occurred */ 86 uint64_t ev_count; /* how many have occurred */
87 TAILQ_ENTRY(evcnt) ev_list; /* entry on list of all counters */ 87 TAILQ_ENTRY(evcnt) ev_list; /* entry on list of all counters */
88 unsigned char ev_type; /* counter type; see below */ 88 unsigned char ev_type; /* counter type; see below */
89 unsigned char ev_grouplen; /* 'group' len, excluding NUL */ 89 unsigned char ev_grouplen; /* 'group' len, excluding NUL */
90 unsigned char ev_namelen; /* 'name' len, excluding NUL */ 90 unsigned char ev_namelen; /* 'name' len, excluding NUL */
91 char ev_pad1; /* reserved (for now); 0 */ 91 char ev_pad1; /* reserved (for now); 0 */
92 const struct evcnt *ev_parent; /* parent, for hierarchical ctrs */ 92 const struct evcnt *ev_parent; /* parent, for hierarchical ctrs */
93 const char *ev_group; /* name of group */ 93 const char *ev_group; /* name of group */
94 const char *ev_name; /* name of specific event */ 94 const char *ev_name; /* name of specific event */
95}; 95};
96TAILQ_HEAD(evcntlist, evcnt); 96TAILQ_HEAD(evcntlist, evcnt);
97 97
98/* maximum group/name lengths, including trailing NUL */ 98/* maximum group/name lengths, including trailing NUL */
99#define EVCNT_STRING_MAX 256 99#define EVCNT_STRING_MAX 255
100 100
101/* ev_type values */ 101/* ev_type values */
 102#define EVCNT_TYPE_ANY -1 /* for sysctl */
102#define EVCNT_TYPE_MISC 0 /* miscellaneous; catch all */ 103#define EVCNT_TYPE_MISC 0 /* miscellaneous; catch all */
103#define EVCNT_TYPE_INTR 1 /* interrupt; count with vmstat -i */ 104#define EVCNT_TYPE_INTR 1 /* interrupt; count with vmstat -i */
104#define EVCNT_TYPE_TRAP 2 /* processor trap/execption */ 105#define EVCNT_TYPE_TRAP 2 /* processor trap/execption */
105 106
106/* 107/*
107 * initializer for an event count structure. the lengths are initted and 108 * initializer for an event count structure. the lengths are initted and
108 * it is added to the evcnt list at attach time. 109 * it is added to the evcnt list at attach time.
109 */ 110 */
110#define EVCNT_INITIALIZER(type, parent, group, name) \ 111#define EVCNT_INITIALIZER(type, parent, group, name) \
111 { \ 112 { \
112 .ev_type = type, \ 113 .ev_type = type, \
113 .ev_parent = parent, \ 114 .ev_parent = parent, \
114 .ev_group = group, \ 115 .ev_group = group, \