rcapd_collection_project.c revision 0209230bf1261579beab4f55226bb509e6b850cb
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <procfs.h>
#include <project.h>
#include <stdlib.h>
#include <strings.h>
#include "rcapd.h"
#include "utils.h"
/* absolute cap name */
#define PJ_ABS_ATTR_NAME "rcap.max-rss"
/* round up to next y = 2^n */
static int
{
void(*update_notification_cb)(char *, char *, int, uint64_t, int) =
char *capattr_abs;
char *end;
int changes;
if (capattr_abs != NULL) {
/*
* PJ_ABS_ATTR_NAME only matched part
* of an attribute.
*/
return (0);
}
} else
max_rss = 0;
&changes);
if (update_notification_cb != NULL)
return (0);
}
static int
{
char buf[PROJECT_BUFSZ];
NULL)
return (0);
}
static int
{
void(*update_notification_cb)(char *, char *, int, uint64_t, int) =
return (0);
(void *)update_notification_cb));
}
static int
{
char buf[PROJECT_BUFSZ];
int res = 0;
setprojent();
endprojent();
return (res);
}
void
void(*update_notification_cb)(char *, char *, int, uint64_t, int))
{
switch (ut) {
case LCU_ACTIVE_ONLY:
/*
* Enumerate active projects. This is much faster than
* enumerating all projects (as is done below, in the default
* case), and is done to efficiently and incrementally update
* lcollection with capped projects. The default case performs
* the initialization.
*/
(void *)update_notification_cb);
/*
* Enumerate once-active projects, including the active
* projects just enumerated, meaning active projects will be
* updated and marked twice.
*/
(void *)update_notification_cb);
break;
default:
/*
* Enumerate all projects.
*/
(void *)update_notification_cb);
}
}