smbstat.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* 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"
/*
* smbstat: Server Message Block File System statistics
*/
#include <stdio.h>
#include <stdlib.h>
#include <kstat.h>
#include <stdarg.h>
#include <errno.h>
#include <inttypes.h>
#include <strings.h>
#include <utility.h>
#include <libintl.h>
#include <zone.h>
static kstat_t *smb_dispatch;
static kstat_t *ksmb_kstat;
static int get_smbinfo_stat(void);
static int get_smbdispatch_stat(void);
static void smbstat_setup(void);
static void smbstat_smb_info_print();
static void smbstat_smb_dispatch_print();
static void smbstat_print(const char *, kstat_t *, int);
static int smbstat_width(kstat_t *, int);
static void smbstat_fail(int, char *, ...);
static void smbstat_usage(void);
#define MAX_COLUMNS 80
int
{
int c;
int iflag = 0; /* smb_info stats */
int dflag = 0; /* smb_dispatch_all stats */
if (getzoneid() != GLOBAL_ZONEID) {
gettext("%s: Cannot execute in non-global zone.\n"),
argv[0]);
return (0);
}
if (is_system_labeled()) {
gettext("%s: Trusted Extensions not supported.\n"),
argv[0]);
return (0);
}
switch (c) {
case 'i':
iflag++;
break;
case 'd':
dflag++;
break;
case '?':
default:
}
}
}
if (iflag) {
} else if (dflag) {
} else {
}
(void) kstat_close(kc);
return (0);
}
static int
get_smbinfo_stat(void)
{
return (smbstat_width(smb_info, 0));
}
static int
get_smbdispatch_stat(void)
{
return (smbstat_width(smb_dispatch, 0));
}
static void
{
int field_width;
if (field_width == 0)
return;
}
static void
{
int field_width;
if (field_width == 0)
return;
}
static void
smbstat_setup(void)
{
(void) kstat_close(kc);
}
"Your kernel module may not be loaded\n"));
}
static int
{
char fixlen[128];
for (i = 0; i < nreq; i++) {
if (field_width < len)
field_width = len;
if (field_width < len)
field_width = len;
}
return (field_width);
}
static void
{
char fixlen[128];
return;
if (field_width == 0)
return;
/* prints out the titles of the columns */
}
(void) printf("\n");
/* prints out the stat numbers */
}
(void) printf("\n");
}
}
static void
smbstat_usage(void)
{
exit(1);
}
static void
{
/* LINTED E_SEC_PRINTF_VAR_FMT */
if (do_perror)
exit(1);
}
static kid_t
{
if (kstat_chain_id == -1)
return (kstat_chain_id);
}
/*
* Enable libumem debugging by default on DEBUG builds.
*/
#ifdef DEBUG
/* LINTED - external libumem symbol */
const char *
_umem_debug_init(void)
{
return ("default,verbose"); /* $UMEM_DEBUG setting */
}
/* LINTED - external libumem symbol */
const char *
_umem_logging_init(void)
{
return ("fail,contents"); /* $UMEM_LOGGING setting */
}
#endif