rcapd.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RCAPD_H
#define _RCAPD_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <procfs.h>
#include "rcapd_conf.h"
#define LC_NAME_LEN 32
#define RCAPD_DEFAULT_CONF_FILE "/etc/rcap.conf"
/* flushes of the ignored set */
/*
* set the buffer length for /proc-based path names based on the actual
* length of the largest pid
*/
#define RCAPD__STR(a) #a
"/pagedata"))
/*
* lcollection_insert_update() result flags
*/
#define LCST_CAP_CHANGED (1<<0)
typedef enum {
LCU_COMPLETE, /* an enumeration of all possible collections */
LCU_ACTIVE_ONLY /* an enumeration of only once-active collections */
struct lmapping;
struct lprocess;
struct lcollection;
struct prxmap;
struct psinfo;
/*
* Per-process data.
*/
typedef struct lprocess {
int lpc_unscannable; /* flag indicating zombie or */
/* other unscannable process */
int lpc_mark; /* mark-and-sweep flag */
int lpc_psinfo_fd; /* cached psinfo fd */
int lpc_pgdata_fd; /* cached pagedata fd */
int lpc_xmap_fd; /* cached xmap fd */
/* current pagedata */
int lpc_nxmap; /* number of mappings in xmap */
} lprocess_t;
/*
* Collection statistics.
*/
typedef struct {
/* enforced, but wasn't (due to low */
/* global memory pressure, or global */
/* scanner being activated) */
/* at last completion */
/* revolutions of clock hand after */
/* which the excess was not */
/* completely reduced */
/*
* Collection.
*/
typedef struct lcollection {
struct lcollection *lcol_next;
/* "unknown" */
int lcol_stat_invalidate; /* flag to reset interval statistics */
int lcol_mark; /* mark-and-sweep flag */
void *lcol_resaddr; /* address to resume scanning from */
/*
* Collection report.
*/
typedef struct lcollection_report {
/* "unknown" */
lprocess_t *);
extern void lcollection_freq_move(lprocess_t *);
int *changes);
extern void lcollection_set_type(rctype_t);
extern void lcollection_free(lcollection_t *);
extern void lcollection_update(lcollection_update_type_t);
extern void list_walk_collection(int (*)(lcollection_t *, void *), void *);
extern int lprocess_update_psinfo_fd_cb(void *, int);
extern void lprocess_free(lprocess_t *);
extern void scan_abort(void);
extern void check_update_statistics(void);
/*
* The collection-specific function determining the collection ID from a
* process' psinfo.
*/
/*
* Global (in rcapd only) variables.
*/
extern uint64_t phys_total;
extern int should_run;
#ifdef __cplusplus
}
#endif
#endif /* _RCAPD_H */