/*
* 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.
*/
/*
* Implementation to get PORT nodes state and condition information
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <locale.h>
#include <syslog.h>
#include <fcntl.h>
#include <kstat.h>
#include <signal.h>
#include <assert.h>
#include <config_admin.h>
#include <picl.h>
#include "piclfrutree.h"
static int serial_port_state(kstat_ctl_t *, char *, int);
static int parallel_port_state(kstat_ctl_t *, char *, int);
static void sig_alarm_handler(int);
};
};
/*
* kstat_port_state: returns ethernet, or serial, or parallel port status
* 1 = up, 0 = down, anything else = unknown
*/
int
int driver_instance)
{
switch (port_type) {
case NETWORK_PORT:
case SERIAL_PORT:
case PARALLEL_PORT:
return (-1);
}
return (rc);
default:
return (-1);
}
}
/*
* kstat_port_cond: returns ethernet, or serial, or parallel port condition
*/
int
int driver_instance)
{
switch (port_type) {
case NETWORK_PORT:
case SERIAL_PORT:
case PARALLEL_PORT:
return (-1);
}
return (rc);
default:
return (-1);
}
}
static kstat_named_t *
{
if (!ksp)
return (NULL);
return (NULL);
}
}
return (NULL);
}
/*
* kstat_network_port_state: returns kstat info of a network port
* 1 = up, 0 = down, anything else = unknown
*/
static int
{
return (-1);
}
if (port_datap == NULL) {
return (-1);
}
return (1);
return (0);
} else {
return (-1);
}
} else {
return (1);
return (0);
} else {
return (-1);
}
}
}
/*
* kstat_network_port_cond: returns kstat info of a network port
* 0 = OK, 1 = FAILING, 2 = FAILED, 3 = TESTING, -1 = unknown
*/
static int
{
return (-1);
}
} else {
}
if (link_up == 0) {
return (2);
}
return (-1);
}
} else {
}
if (link_duplex == 0) {
return (2);
}
return (-1);
}
} else {
}
if (ifspeed == 0) {
return (2);
}
/* check for FAILING conditions */
return (-1);
}
} else {
}
return (-1);
}
} else {
}
return (1);
}
return (-1);
}
} else {
}
return (-1);
}
} else {
}
return (1);
}
RUNT_ERRORS)) == NULL) {
return (-1);
}
} else {
}
return (1);
}
COLLISIONS)) == NULL) {
return (-1);
}
} else {
}
return (1);
}
return (0);
}
/*
* serial_port_state: returns status a serial port
* 1 = up, 0 = down, anything else = unknown
*/
/* ARGSUSED */
static int
{
int fd;
(void) alarm(1);
/* Restore sig action flags */
/* Disable alarm */
(void) alarm(0);
if (fd == -1) {
return (-1);
}
return (-1);
}
return (-1);
}
}
/* ARGSUSED */
static void
{
}
/*
* serial_port_cond: returns status of a serial port
* 0 = OK, 1 = FAILING, 2 = FAILED, 3 = TESTING, anything else = UNKNOWN
*/
static int
{
case 1:
return (0);
default:
return (-1);
}
}
/*
* parallel_port_state: returns kstat info of a serial port
* 1 = up, 0 = down, anything else = unknown
*/
static int
{
char *data_lookup;
return (-1);
}
return (-1);
}
data_lookup = "";
if (port_datap == NULL) {
return (-1);
}
return (-1);
}
/*
* parallel_port_cond: returns kstat info of a serial port
* 1 = up, 0 = down, anything else = unknown
*/
static int
{
}