summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acctctl.h
blob: f3664c156dcccc1599637129bc9f03a817db9c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* Declarations of acctlctl function and types.
   Copyright (C) 2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _SYS_ACCTCTL_H
#define _SYS_ACCTCTL_H

#include <sys/types.h>
#include <features.h>

#define AC_PROC		(0x1 << 28)
#define AC_TASK		(0x2 << 28)
#define AC_FLOW		(0x4 << 28)
#define AC_MODE(x)	((x) & 0xf0000000)

#define AC_FILE_SET	0x01
#define AC_FILE_GET	0x02
#define AC_RES_SET	0x04
#define AC_RES_GET	0x08
#define AC_STATE_SET	0x10
#define AC_STATE_GET	0x20
#define AC_OPTION(x)	((x) & 0x0fffffff)

enum
  {
	AC_NONE = 0,
#define AC_NONE			AC_NONE
	AC_PROC_PID = 1,
#define AC_PROC_PID		AC_PROC_PID
	AC_PROC_UID = 2,
#define AC_PROC_UID		AC_PROC_UID
	AC_PROC_GID = 3,
#define AC_PROC_GID		AC_PROC_GID
	AC_PROC_PROJID = 4,
#define AC_PROC_PROJID		AC_PROC_PROJID
	AC_PROC_TASKID = 5,
#define AC_PROC_TASKID		AC_PROC_TASKID
	AC_PROC_CPU = 6,
#define AC_PROC_CPU		AC_PROC_CPU
	AC_PROC_TIME = 7,
#define AC_PROC_TIME		AC_PROC_TIME
	AC_PROC_COMMAND = 8,
#define AC_PROC_COMMAND		AC_PROC_COMMAND
	AC_PROC_TTY = 9,
#define AC_PROC_TTY		AC_PROC_TTY
	AC_PROC_HOSTNAME = 10,
#define AC_PROC_HOSTNAME	AC_PROC_HOSTNAME
	AC_PROC_MICROSTATE = 11,
#define AC_PROC_MICROSTATE	AC_PROC_MICROSTATE
	AC_PROC_FLAG = 12,
#define AC_PROC_FLAG		AC_PROC_FLAG
	AC_PROC_ANCPID = 13,
#define AC_PROC_ANCPID		AC_PROC_ANCPID
	AC_PROC_WAIT_STATUS = 14,
#define AC_PROC_WAIT_STATUS	AC_PROC_WAIT_STATUS
	AC_PROC_ZONENAME = 15,
#define AC_PROC_ZONENAME	AC_PROC_ZONENAME
	AC_PROC_MEM = 16,
#define AC_PROC_MEM		AC_PROC_MEM
	AC_PROC_MAX_RES = 17
#define AC_PROC_MAX_RES		AC_PROC_MAX_RES
  };

enum
  {
	AC_TASK_TASKID = 1,
#define AC_TASK_TASKID		AC_TASK_TASKID
	AC_TASK_PROJID = 2,
#define AC_TASK_PROJID		AC_TASK_PROJID
	AC_TASK_CPU = 3,
#define AC_TASK_CPU		AC_TASK_CPU
	AC_TASK_TIME = 4,
#define AC_TASK_TIME		AC_TASK_TIME
	AC_TASK_HOSTNAME = 5,
#define AC_TASK_HOSTNAME	AC_TASK_HOSTNAME
	AC_TASK_MICROSTATE = 6,
#define AC_TASK_MICROSTATE	AC_TASK_MICROSTATE
	AC_TASK_ANCTASKID = 7,
#define AC_TASK_ANCTASKID	AC_TASK_ANCTASKID
	AC_TASK_ZONENAME = 8
#define AC_TASK_ZONENAME	AC_TASK_ZONENAME
#define A_TASK_MAX_RES		AC_TASK_ZONENAME
  };

enum
  {
	AC_FLOW_SADDR = 1,
#define AC_FLOW_SADDR		AC_FLOW_SADDR
	AC_FLOW_DADDR = 2,
#define AC_FLOW_DADDR		AC_FLOW_DADDR
	AC_FLOW_SPORT = 3,
#define AC_FLOW_SPORT		AC_FLOW_DPORT
	AC_FLOW_DPORT =  4,
#define AC_FLOW_DPORT		AC_FLOW_DPORT
	AC_FLOW_PROTOCOL = 5,
#define AC_FLOW_PROTOCOL	AC_FLOW_PROTOCOL
	AC_FLOW_DSFIELD = 6,
#define AC_FLOW_DSFIELD		AC_FLOW_DSFIELD
	AC_FLOW_CTIME = 7,
#define AC_FLOW_CTIME		AC_FLOW_CTIME
	AC_FLOW_LSEEN = 8,
#define AC_FLOW_LSEEN		AC_FLOW_LSEEN
	AC_FLOW_NBYTES = 9,
#define AC_FLOW_NBYTES		AC_FLOW_NBYTES
	AC_FLOW_NPKTS = 10,
#define AC_FLOW_NPKTS		AC_FLOW_NPKTS
	AC_FLOW_PROJID = 11,
#define AC_FLOW_PROJID		AC_FLOW_PROJID
	AC_FLOW_UID = 12,
#define AC_FLOW_UID		AC_FLOW_UID
	AC_FLOW_ANAME = 13
#define AC_FLOW_ANAME		AC_FLOW_ANAME
#define AC_FLOW_MAX_RES		AC_FLOW_ANAME
  };

#define AC_MAX_RES_TMP	MAX (AC_PROC_MAX_RES, AC_TASK_MAX_RES)
#define AC_MAX_RES	MAX (AC_MAX_RES_TMP, AC_FLOW_MAX_RES)
#define AC_MASK_SZ	BT_BITOUL (AC_MAX_RES + 1)

enum
  {
	AC_OFF = 0,
#define AC_OFF		AC_OFF
	AC_ON = 1
#define AC_ON		AC_ON
  };

typedef struct ac_res
  {
	int ar_id;
	int ar_state;
  } ac_res_t;

__BEGIN_DECLS

extern int acctctl (int, void *, size_t);

__END_DECLS

#endif /* _SYS_ACCTCTL_H */