exacct.h revision 7eceb558141dbb2c93db5dbdc07ec453f11fc8bd
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_EXACCT_H
#define _SYS_EXACCT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define EXACCT_VERSION 1
/*
* unpack and free allocation options: the behaviour of the ea_free_object()
* function is coordinated with whether an unpack used EUP_ALLOC or EUP_NOALLOC,
* such that unpacked object hierarchies can be later freed successfully.
*/
#define EUP_ALLOC_MASK 0x1
/*
* wracct and putacct record type options: the properties of the partial and
* interval records differ slightly: a partial record is a snapshot of the
* resource usage for the given process or task, while an interval record
* reports the current usage since the last interval record or creation.
* Interval records are supported only for tasks.
*/
/*
* putacct contents option: the contents of the buffer passed to putacct may be
* identified either as raw data or as a packed exacct record.
*/
#define EP_RAW 0
#define EP_EXACCT_OBJECT 1
#ifndef _KERNEL
#endif /* ! _KERNEL */
/*
* Error codes. libexacct reports these errors through the ea_error() function;
* in the case of EXR_SYSCALL_FAIL, errno will contain the error code
* encountered by the underlying system call.
*/
#define EXR_OK 0
#define EXR_SYSCALL_FAIL 1
#define EXR_CORRUPT_FILE 2
#define EXR_EOF 3
#define EXR_NO_CREATOR 4
#define EXR_INVALID_BUF 5
#define EXR_NOTSUPP 6
#define EXR_UNKN_VERSION 7
#define EXR_INVALID_OBJ 8
typedef uint32_t ea_catalog_t;
typedef struct ea_item {
/*
* The ei_u union is discriminated via the type field of the enclosing
* object's catalog tag.
*/
union {
double ei_u_double;
char *ei_u_string;
void *ei_u_object; /* for embedded packed object */
void *ei_u_raw;
} ei_u;
} ea_item_t;
typedef struct ea_group {
} ea_group_t;
typedef struct ea_object {
union {
} eo_u;
} ea_object_t;
/*
* In prior releases, the following three functions had the type void, and so
* could not return a status code. In SunOS 5.9, the return type has been
* changed to int, so that if errors are detected the invoking application
* can be notified appropriately.
*/
extern int ea_free_item(ea_object_t *, int);
extern void ea_free_object(ea_object_t *, int);
extern char *ea_strdup(const char *);
extern void ea_strfree(char *);
#ifdef _KERNEL
extern void exacct_commit_task(void *);
extern void exacct_commit_proc(proc_t *, int);
extern void exacct_update_task_mstate(proc_t *);
const char *);
extern void exacct_commit_flow(void *);
extern void exacct_init(void);
extern void *exacct_create_header(size_t *);
ulong_t *, int, int);
extern taskq_t *exacct_queue;
extern kmem_cache_t *exacct_object_cache;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_EXACCT_H */