/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#include <stdio.h>
#include <libintl.h>
#include <string.h>
#include "utils.h"
#include "aconf.h"
#include "res.h"
/*
* resource names
*/
/*
* Process accounting resources
*/
/*
* Task accounting resources
*/
/*
* Flow accounting resources
*/
/*
* Net accounting resources
*/
/*
* These are included for compatibility with old acctadm that
* didn't have resource groups for individual accounting types.
* It was possible to have resource "pid" enabled for task
* accounting even though we couldn't actually track it.
*/
};
/*
* resource groups
*/
{ AC_PROC, "extended",
AC_PROC_MICROSTATE, AC_NONE } },
{ AC_PROC, "basic",
AC_NONE } },
{ AC_TASK, "extended",
AC_TASK_ZONENAME, AC_NONE } },
{ AC_TASK, "basic",
AC_NONE } },
{ AC_FLOW, "extended",
{ AC_FLOW, "basic",
AC_NONE } },
{ AC_NET, "extended",
{ AC_NET, "basic",
AC_NET_OERRPKTS, AC_NONE } },
{ AC_NONE } }
};
/*
* this function returns the id of the named resource
*/
static int
{
/*
* For compatibility with older versions.
*/
return (-1);
else
}
acname++;
}
return (0);
}
/*
* this function gives name of the resource by its id
*/
static char *
{
acname++;
}
return (NULL);
}
static void
{
int r, g, id;
continue;
(void) printf("\n");
}
}
/*
* this function prints the list of resource groups and their members
*/
void
{
int header = 0;
header = 1;
}
if (header == 1)
(void) printf("process:\n");
}
if (header == 1)
(void) printf("task:\n");
}
if (header == 1)
(void) printf("flow:\n");
}
if (header == 1)
(void) printf("net:\n");
}
}
/*
* this function sets the state of the particular resource
*/
static void
{
}
/*
* this function gets the state of the particular resource
*/
static int
{
}
/*
* this function converts a string of resources into a buffer which then
* can be used for acctctl() system call
*/
void
{
char *p, *g, *copy;
return;
/*
* Take a lap through str, processing resources, modifying buf copy
* as appropriate and making sure that all resource names are valid.
*/
while (p != NULL) {
/*
* check if str contains any resource groups
*/
AC_NONE; j++)
ok = 1;
break;
}
}
if (ok == 0) {
if (id > 0)
else if (id == 0)
ac_type_name(type), p);
}
}
}
/*
* this function converts a buffer into a string of resource names.
* accounting type is selected by the fourth argument.
* it is caller's responsibility to free the allocated string buffer.
*/
char *
{
char *str, *g;
/*
* check if buf has any resource groups in it
*/
continue;
ok = 1;
ok = 0;
break;
}
}
if (ok) { /* buf contains this resource group */
j++)
ok = 0;
}
}
/*
* browse through the rest of the buf for all remaining resources
* that are not a part of any groups
*/
}
}
return (str);
}