xref: /illumos-gate/usr/src/uts/common/sys/msacct.h (revision 3ce5372277f4657ad0e52d36c979527c4ca22de2)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_MSACCT_H
28 #define	_SYS_MSACCT_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /* LWP microstates */
35 #define	LMS_USER	0	/* running in user mode */
36 #define	LMS_SYSTEM	1	/* running in sys call or page fault */
37 #define	LMS_TRAP	2	/* running in other trap */
38 #define	LMS_TFAULT	3	/* asleep in user text page fault */
39 #define	LMS_DFAULT	4	/* asleep in user data page fault */
40 #define	LMS_KFAULT	5	/* asleep in kernel page fault */
41 #define	LMS_USER_LOCK	6	/* asleep waiting for user-mode lock */
42 #define	LMS_SLEEP	7	/* asleep for any other reason */
43 #define	LMS_WAIT_CPU	8	/* waiting for CPU (latency) */
44 #define	LMS_STOPPED	9	/* stopped (/proc, jobcontrol, lwp_suspend) */
45 
46 /*
47  * NMSTATES must never exceed 17 because of the size restriction
48  * of 128 bytes imposed on struct siginfo (see <sys/siginfo.h>).
49  */
50 #define	NMSTATES	10	/* number of microstates */
51 
52 /*
53  * CPU Microstates
54  *
55  * The following define the implemented CPU microstates
56  */
57 
58 #define	CMS_USER	0
59 #define	CMS_SYSTEM	1
60 #define	CMS_IDLE	2
61 #define	CMS_DISABLED	3
62 
63 /*
64  * NCMSTATES is set to NMSTATES - 1, because CMS_DISABLED is not a state for
65  * which accounting information is kept.  CPUs that are offline but remain in
66  * the system are kept in the CMS_IDLE state until they are brought back online,
67  * or unconfigured and deleted from the system.  Only when a cpu is unconfigured
68  * and about to be deleted is the CMS_DISABLED state entered.  It is a
69  * placeholder state to ensure that our behavior is sane.  ASSERT()s exist to
70  * verify this.
71  */
72 
73 #define	NCMSTATES	3
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _SYS_MSACCT_H */
80