/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <libscf.h>
#include <libscf_priv.h>
#include <libuutil.h>
#include "rcapd.h"
#include "rcapd_conf.h"
#include "rcapd_stat.h"
#include "utils.h"
/*
* Read configuration and set the fields of an rcfg_t correspondingly.
* Verify that the statistics file is writable, with the optional
* verify_stat_file_creation() callback.
*/
int
{
== NULL) {
scf_strerror(scf_error()));
goto err;
}
== SCF_FAILED) {
"not found. \n"), PRESSURE);
goto err;
} else {
if (count_val > 100)
else
= count_val;
debug("cap max pressure: %d%%\n",
}
== SCF_FAILED) {
"not found. \n"), RECONFIG_INT);
goto err;
} else {
debug("reconfiguration interval: %d seconds\n",
}
== SCF_FAILED) {
"not found. \n"), REPORT_INT);
goto err;
} else {
debug("report interval: %d seconds\n",
}
== SCF_FAILED) {
"not found. \n"), RSS_SAMPLE_INT);
goto err;
} else {
debug("RSS sample interval: %d seconds\n",
}
== SCF_FAILED) {
"not found. \n"), WALK_INT);
goto err;
} else {
debug("proc_walk interval: %d seconds\n",
}
/*
* Set project mode, by default.
*/
}
if (verify_stat_file_creation != 0 && verify_stat_file_creation()
!= 0) {
goto err;
}
debug("done parsing\n");
goto out;
err:
if (scf_error() != SCF_ERROR_NONE) {
scf_strerror(scf_error()));
}
out:
return (ret);
}
void
{
}
/*
* Modify configuration in repository given the rcfg_t structure.
*/
int
{
== NULL) {
scf_strerror(scf_error()));
goto out;
}
scf_strerror(scf_error()));
goto out;
}
do {
!= SCF_SUCCESS) {
PRESSURE);
goto out;
}
goto out;
}
goto out;
}
goto out;
}
WALK_INT);
goto out;
}
goto out;
if (rval == 0) {
!= SCF_SUCCESS) {
goto out;
}
}
} while (rval == 0);
out:
}
return (ret);
}