/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "misc.h"
#include "msgs.h"
#include <sac.h>
#include "structs.h"
#include <unistd.h>
#include "extern.h"
/*
* read_table - read in SAC's administrative file and build internal
* data structures
*
* args: startflag - flag to indicate if port monitor's should be
* started as a side effect of reading
*/
void
int startflag;
{
# ifdef DEBUG
debug("in read_table");
# endif
/*
* make sure _sactab is ok
*/
Nentries = 0;
else if (ret == 2)
else if (ret == 3)
/*
* mark all entries as invalid
*/
/*
* build internal structures
*/
purge();
}
/*
* read_entry - read an entry from _sactab
*
* args: fp - file pointer referencing _sactab
*/
struct sactab *
{
register char *p; /* scratch pointer */
/*
* retrieve a line from the file
*/
do {
return(NULL);
} while (*p == '\0');
/*
* allocate a list element for it and then parse the line, parsed
* info goes into list element
*/
return(sp);
}
/*
* insert - insert a sactab entry into the linked list
*
* args: sp - entry to be inserted
* startflag - flag to indicate if port monitor's should be
* started as a side effect of reading
*/
void
int startflag;
{
# ifdef DEBUG
debug("in insert");
# endif
/*
* find the correct place to insert this element
*/
while (tsp) {
# ifdef DEBUG
(void) sprintf(Scratch, "sp->sc_tag <%s> tsp->sc_tag <%s>, ret is %d", sp->sc_tag, tsp->sc_tag, ret);
# endif
if (ret > 0) {
/* keep on looking */
continue;
}
else if (ret == 0) {
/*
* found an entry for it in the list, either a duplicate or we're
* rereading the file.
*/
/* this is a duplicate entry, ignore it */
}
else {
/* found a valid match, replace flags & restart max only */
# ifdef DEBUG
# endif
/* this entry is "current" */
Nentries++;
}
return;
}
else {
/* insert it here */
}
else {
}
# ifdef DEBUG
# endif
Nentries++;
/* this entry is "current" */
return;
}
}
/*
* either an empty list or should put element at end of list
*/
else
# ifdef DEBUG
# endif
++Nentries;
/* this entry is "current" */
}
/*
* purge - purge linked list of "old" entries
*/
void
purge()
{
# ifdef DEBUG
debug("in purge");
# endif
/* get current signal mask */
while (sp) {
continue;
}
/* element should be removed */
case UNKNOWN:
case ENABLED:
case DISABLED:
case STARTING:
/* need to kill it */
else
/* fall thru */
case STOPPING:
/* fall thru */
case NOTRUNNING:
case FAILED:
}
else
# ifdef DEBUG
# endif
/*
* all done cleaning up, restore signal mask
*/
break;
}
}
}
/*
* dump_table - dump the internal SAC table, used to satisfy sacadm -l
*/
char **
{
register char *p; /* scratch pointer */
# ifdef DEBUG
# endif
/*
* get space for number of entries we have
*/
if (Nentries == 0)
return(NULL);
return(NULL);
}
/*
* traverse the list allocating space for entries and formatting them
*/
size = strlen(sp->sc_tag) + strlen(sp->sc_type) + strlen(sp->sc_cmd) + strlen(sp->sc_comment) + SLOP;
return(NULL);
}
*info++ = p;
# ifdef DEBUG
# endif
}
return(savinfo);
}