aconf.c 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include "aconf.h"
#include "utils.h"
#include "res.h"
typedef struct ac_token {
char *tok_name;
int tok_type;
int (*tok_parse)(acctconf_t *, char *, int);
} ac_token_t;
static ac_token_t tokens[] = {
{ "ACCTADM_PROC_ENABLE",
{ "ACCTADM_PROC_FILE",
{ "ACCTADM_PROC_TRACKED",
{ "ACCTADM_PROC_UNTRACKED",
{ "ACCTADM_TASK_ENABLE",
{ "ACCTADM_TASK_FILE",
{ "ACCTADM_TASK_TRACKED",
{ "ACCTADM_TASK_UNTRACKED",
{ "ACCTADM_FLOW_ENABLE",
{ "ACCTADM_FLOW_FILE",
{ "ACCTADM_FLOW_TRACKED",
{ "ACCTADM_FLOW_UNTRACKED",
{ NULL,
};
void
{
void *buf;
void *pathname;
int state;
/*
* Initialize process accounting settings
*/
if (errno == ENOTACTIVE)
else
} else {
}
/*
* Initialize flow accounting settings
*/
if (errno == ENOTACTIVE)
else
} else {
}
/*
* Initialize task accounting settings
*/
if (errno == ENOTACTIVE)
else
} else {
}
}
int
{
return (-1);
}
return (-1);
}
return (0);
}
int
{
int line;
int ret = 0;
return (-1);
}
return (-1);
}
int len;
continue;
/*
* Look for "name=value", with optional whitespace on either
* side, terminated by a newline, and consuming the whole line.
*/
/* LINTED - unbounded string specifier */
/*
* Locate a matching token in the tokens[] table,
* and invoke its parsing function.
*/
"warning: invalid %s\n"),
ret = -1;
}
break;
}
}
/*
* If we hit the end of the tokens[] table,
* no matching token was found.
*/
ret = -1;
}
} else {
ret = -1;
}
}
if (line == 1) {
ret = -1;
}
return (ret);
}
int
{
void *buf;
/*
* Setup process accounting
*/
return (-1);
}
return (-1);
}
} else {
return (-1);
}
}
sizeof (int)) == -1) {
return (-1);
}
/*
* Setup flow accounting
*/
return (-1);
}
return (-1);
}
} else {
return (-1);
}
}
sizeof (int)) == -1) {
return (-1);
}
/*
* Setup task accounting
*/
return (-1);
}
return (-1);
}
} else {
return (-1);
}
}
sizeof (int)) == -1) {
return (-1);
}
return (0);
}
int
{
return (-1);
else
return (0);
}
int
{
return (-1);
}
return (-1);
}
(void) fputs("#\n# acctadm.conf\n#\n"
"# Configuration parameters for extended accounting.\n"
"# Do NOT edit this file by hand -- use acctadm(1m) instead.\n"
return (-1);
}
}
return (0);
}
void
{
gettext(" Task accounting: %s\n"),
acp->ac_task_state ?
gettext(" Task accounting file: %s\n"),
acp->ac_task_file);
gettext(" Tracked task resources: %s\n"),
gettext(" Untracked task resources: %s\n"),
}
gettext(" Process accounting: %s\n"),
acp->ac_proc_state ?
gettext(" Process accounting file: %s\n"),
acp->ac_proc_file);
gettext(" Tracked process resources: %s\n"),
gettext("Untracked process resources: %s\n"),
}
gettext(" Flow accounting: %s\n"),
acp->ac_flow_state ?
gettext(" Flow accounting file: %s\n"),
acp->ac_flow_file);
gettext(" Tracked flow resources: %s\n"),
gettext(" Untracked flow resources: %s\n"),
}
}
int
{
int state;
else
return (-1);
else
return (-1);
return (0);
}
int
{
return (-1);
return (0);
}
int
{
else
return (-1);
return (0);
}
int
{
else
return (-1);
return (0);
}
static int
{
AC_STR_NO : AC_STR_YES));
AC_STR_NO : AC_STR_YES));
AC_STR_NO : AC_STR_YES));
else
return (-1);
}
static int
{
else
return (-1);
}
static int
{
else
return (-1);
}
static int
{
else
return (-1);
}