4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_EXACCT_IMPL_H
27 #define _SYS_EXACCT_IMPL_H
33 #include <sys/types.h>
34 #include <sys/utsname.h>
38 * Setting the exacct error code. libexacct provides more detailed codes for
39 * identifying causes of operational failure; the kernel doesn't use this
40 * facility, since the kernel operations can't fail. (KM_SLEEP allocations,
44 #define EXACCT_SET_ERR(x)
46 extern void exacct_seterr(int);
47 #define EXACCT_SET_ERR(x) exacct_seterr(x)
50 typedef struct task_usage
{
51 hrtime_t tu_utime
; /* user time */
52 hrtime_t tu_stime
; /* system time */
54 uint64_t tu_minflt
; /* minor faults */
55 uint64_t tu_majflt
; /* major faults */
56 uint64_t tu_sndmsg
; /* messages sent */
57 uint64_t tu_rcvmsg
; /* messages received */
58 uint64_t tu_ioch
; /* characters read and written */
59 uint64_t tu_iblk
; /* input blocks */
60 uint64_t tu_oblk
; /* output blocks */
61 uint64_t tu_vcsw
; /* voluntary context switches */
62 uint64_t tu_icsw
; /* involuntary context switches */
63 uint64_t tu_nsig
; /* signals received */
64 uint64_t tu_nswp
; /* swaps */
65 uint64_t tu_nscl
; /* system calls */
66 uint64_t tu_startsec
; /* start time (seconds) */
67 uint64_t tu_startnsec
; /* start time (nanoseconds) */
68 uint64_t tu_finishsec
; /* finish time (seconds) */
69 uint64_t tu_finishnsec
; /* finish time (nanoseconds) */
70 taskid_t tu_anctaskid
; /* ancestor task's ID */
73 typedef struct proc_usage
{
74 uint64_t pu_minflt
; /* minor faults */
75 uint64_t pu_majflt
; /* major faults */
76 uint64_t pu_sndmsg
; /* messages sent */
77 uint64_t pu_rcvmsg
; /* messages received */
78 uint64_t pu_ioch
; /* characters read and written */
79 uint64_t pu_iblk
; /* input blocks */
80 uint64_t pu_oblk
; /* output blocks */
81 uint64_t pu_vcsw
; /* voluntary context switches */
82 uint64_t pu_icsw
; /* involuntary context switches */
83 uint64_t pu_nsig
; /* signals received */
84 uint64_t pu_nswp
; /* swaps */
85 uint64_t pu_nscl
; /* system calls */
86 uint64_t pu_utimesec
; /* user time (seconds) */
87 uint64_t pu_utimensec
; /* user time (nanoseconds) */
88 uint64_t pu_stimesec
; /* system time (seconds) */
89 uint64_t pu_stimensec
; /* system time (nanoseconds) */
90 uint64_t pu_startsec
; /* start time (seconds) */
91 uint64_t pu_startnsec
; /* start time (nanoseconds) */
92 uint64_t pu_finishsec
; /* finish time (seconds) */
93 uint64_t pu_finishnsec
; /* finish time (nanoseconds) */
94 uint64_t pu_mem_rss_avg
; /* average RSS (K) */
95 uint64_t pu_mem_rss_max
; /* peak RSS (K) */
97 pid_t pu_pid
; /* process ID */
98 uid_t pu_ruid
; /* user ID */
99 gid_t pu_rgid
; /* group ID */
100 projid_t pu_projid
; /* project ID */
101 taskid_t pu_taskid
; /* task ID */
102 uint32_t pu_acflag
; /* accounting flags */
103 char *pu_command
; /* command string */
104 uint32_t pu_major
; /* major number of controlling tty */
105 uint32_t pu_minor
; /* minor number of controlling tty */
106 int pu_wstat
; /* wait() status */
107 pid_t pu_ancpid
; /* ancestor process's ID */
108 char pu_zonename
[ZONENAME_MAX
]; /* Zone name */
109 char pu_nodename
[_SYS_NMLN
];
112 typedef struct flow_usage
{
113 uint32_t fu_saddr
[4]; /* source address */
114 uint32_t fu_daddr
[4]; /* remote address */
115 uint8_t fu_protocol
; /* protocol type */
116 uint16_t fu_sport
; /* source port */
117 uint16_t fu_dport
; /* remote port */
118 uint8_t fu_dsfield
; /* DS field */
119 uint32_t fu_nbytes
; /* number of bytes (incl. IP header) */
120 uint32_t fu_npackets
; /* number of packets */
121 uint64_t fu_ctime
; /* creation time for this item */
122 uint64_t fu_lseen
; /* when the last item of this desc. was seen */
123 projid_t fu_projid
; /* project ID */
124 uid_t fu_userid
; /* user ID */
125 boolean_t fu_isv4
; /* to extract the correct l/r-addr */
126 char *fu_aname
; /* action instance name */
129 #define EX_NET_LNDESC_REC 1
130 #define EX_NET_FLDESC_REC 2
131 #define EX_NET_LNSTAT_REC 3
132 #define EX_NET_FLSTAT_REC 4
134 typedef struct net_stat_s
{
138 uint64_t ns_ipackets
;
139 uint64_t ns_opackets
;
145 typedef struct net_desc_s
{
150 ushort_t nd_vlan_tpid
;
151 ushort_t nd_vlan_tci
;
153 ushort_t nd_priority
;
154 uint64_t nd_bw_limit
;
155 uint32_t nd_saddr
[4];
156 uint32_t nd_daddr
[4];
165 extern void exacct_order16(uint16_t *);
166 extern void exacct_order32(uint32_t *);
167 extern void exacct_order64(uint64_t *);
173 #endif /* _SYS_EXACCT_IMPL_H */