/*
* 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"
/*
* Display synchronous serial line statistics
*/
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ser_sync.h>
#include <libdlpi.h>
static void usage(void);
static int fd;
int
{
char *cp;
int do_clear = 0;
int period = 0;
int count;
int retval;
if (argc == 1) {
usage();
exit(1);
}
argc--; /* skip the command name */
argv++;
/*
* The following loop processes command line arguments.
* If the argument begins with a '-', it is trated as an option.
* The only option currently implemented is "-c" (clears statistics).
* If the argument begins with a numeral, it is treated as an interval.
* Intervals must be positive integers greater than zero.
* Any argument that survives this is treated as a device name to be
* found under /dev.
*/
while (argc > 0) {
if (argv[0][0] == '-') {
if (argc == 1) {
usage();
exit(1);
}
usage();
exit(1);
}
do_clear = 1;
if (period == 0) {
"syncstat: bad interval: %s\n", *argv);
exit(1);
}
} else {
"device name (too long) %s\n", *argv);
exit(1);
}
}
argc--;
argv++;
}
"syncstat: %s missing minor device number\n", sername);
exit(1);
}
exit(1);
}
perror("S_IOCGETMODE");
"syncstat: can't get sync mode info for %s\n", sername);
exit(1);
}
if (do_clear) {
perror("S_IOCCLRSTATS");
"syncstat: can't clear stats for %s\n", sername);
exit(1);
}
}
perror("S_IOCGETSTATS");
sername);
exit(1);
}
if (period) {
if (sm.sm_baudrate == 0) {
exit(1);
}
}
}
(void) printf(" speed ipkts opkts undrun ovrrun abort "
"crc isize osize\n");
return (0);
}
static void
{
perror("S_IOCGETSTATS");
sername);
exit(1);
}
if ((count % 20) == 0)
(void) printf(" ipkts opkts undrun ovrrun abort "
"crc iutil outil\n");
}
static void
usage()
{
}