summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/exacct.h
blob: 0c1481fd7af8dff95cfce448b63e2e149d14b44d (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
/* Declarations of privilege functions 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_EXACCT_H
#define _SYS_EXACCT_H

#include <sys/types.h>
#include <sys/procset.h>
#include <sys/task.h>
#include <sys/proc.h>
#include <features.h>

#define EXACCT_VERSION	1

#define EUP_ALLOC	0x00
#define EUP_NOALLOC	0x01
#define EUP_ALLOC_MASK	0x02

#define EW_PARTIAL	0x01
#define EW_INTERVAL	0x02
#define EW_FINAL	0x04

enum
  {
	EP_RAW = 0,
#define EP_RAW	EP_RAW
	EP_EXACCT_OBJECT = 1
#define EP_EXACCT_OBJECT	EP_EXACCT_OBJECT
  };

enum
  {
	EXR_OK = 0,
#define EXR_OK	EXR_OK
	EXR_SYSCALL_FAIL = 1,
#define EXR_SYSCALL_FAIL	EXR_SYSCALL_FAIL
	EXR_CORRUPT_FILE = 2,
#define EXR_CORRUPT_FILE	EXR_CORRUPT_FILE
	EXR_EOF = 3,
#define EXR_EOF	EXR_EOF
	EXR_NO_CREATOR = 4,
#define EXR_NO_CREATOR	EXR_NO_CREATOR
	EXR_INVALID_BUF = 5,
#define EXR_INVALID_BUF	EXR_INVALID_BUF
	EXR_NOTSUPP = 6,
#define EXR_NOTSUPP	EXR_NOTSUPP
	EXR_UNKN_VERSION = 7,
#define EXR_UNKN_VERSION	EXR_UNKN_VERSION
	EXR_INVALID_OBJ = 8
#define EXR_INVALID_OBJ	EXR_INVALID_OBJ
  };

typedef enum
  {
	EO_ERROR = -1,
	EO_NONE = 0,
	EO_GROUP = 1,
	EO_ITEM = 2
  } ea_object_type_t;

#define EXACCT_MAX_BUFSIZE	(64 * 1024) /* 64 kb */

typedef uint64_t ea_size_t;
typedef uint32_t ea_catalog_t;

typedef struct ea_item
  {
	union
	  {
		uint8_t ei_u_uint8;
		uint16_t ei_u_uint16;
		uint32_t ei_u_uint32;
		uint64_t ei_u_uint64;
		double ei_u_double;
		char *ei_u_string;
		void *ei_u_object;
		void *ei_u_raw;
	  } ei_u;
	ea_size_t ei_size;
  } ea_item_t;
#define ei_uint8	ei_u.ei_u_uint8
#define ei_uint16	ei_u.ei_u_uint16
#define ei_uint32	ei_u.ei_u_uint32
#define ei_uint64	ei_u.ei_u_uint64
#define ei_double	ei_u.ei_u_double
#define ei_string	ei_u.ei_u_string
#define ei_object	ei_u.ei_u_object
#define ei_raw		ei_u.ei_u_raw

typedef struct ea_group
  {
	uint32_t eg_nobjs;
	struct ea_object *eg_objs;
  } ea_group_t;

typedef struct ea_object
  {
	ea_object_type_t    eo_type;
	union
	  {
		ea_group_t eo_u_group;
		ea_item_t eo_u_item;
	  } eo_u;
	struct ea_object *eo_next;
	ea_catalog_t eo_catalog;
  } ea_object_t;
#define eo_group	eo_u.eo_u_group
#define eo_item		eo_u.eo_u_item

__BEGIN_DECLS

size_t getacct (idtype_t, id_t, void *, size_t);
int putacct (idtype_t, id_t, void *, size_t, int);
int wracct (idtype_t, id_t, int);

__END_DECLS

#endif /* _SYS_EXACCT_H */