misc.c revision 34e485807cef99a975f8962a04f4b7d1aa3529fe
/*
* 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 <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <signal.h>
#include <poll.h>
#include "misc.h"
#include "msgs.h"
#include "extern.h"
#include <sac.h>
#include "adm.h"
#include "structs.h"
/*
* findpm - find a port monitor entry
*
* args: tag - tag of desired port monitor
*/
struct sactab *
register char *tag;
{
return(sp);
}
return(NULL);
}
/*
* sigpoll - handle messages coming in on the command pipe (SIGPOLL signal
* handler)
*/
void
sigpoll()
{
char **data; /* "dumped" sactab */
char *p; /* scratch pointer */
register int i; /* loop control variable */
int ret; /* return value */
# ifdef DEBUG
debug("in sigpoll");
# endif
case POLLIN:
}
/*
* request to start a port monitor
*/
case AC_START:
# ifdef DEBUG
# endif
break;
}
case UNKNOWN:
break;
case FAILED:
case NOTRUNNING:
if (ret == -1)
else
break;
}
break;
case ENABLED:
case DISABLED:
case STARTING:
case STOPPING:
break;
}
break;
/*
* request to kill a port monitor
*/
case AC_KILL:
# ifdef DEBUG
# endif
break;
}
case UNKNOWN:
break;
case NOTRUNNING:
case FAILED:
case STOPPING:
break;
case STARTING:
case ENABLED:
case DISABLED:
break;
}
/* signal sent ok */
break;
}
break;
/*
* request to enable a port monitor
*/
case AC_ENABLE:
# ifdef DEBUG
# endif
break;
}
case UNKNOWN:
break;
case NOTRUNNING:
case FAILED:
case STOPPING:
break;
case STARTING:
case DISABLED:
break;
case ENABLED:
break;
}
break;
/*
* request to disable a port monitor
*/
case AC_DISABLE:
# ifdef DEBUG
# endif
break;
}
case UNKNOWN:
break;
case NOTRUNNING:
case FAILED:
case STOPPING:
break;
case STARTING:
case ENABLED:
break;
case DISABLED:
break;
}
break;
/*
* request for port monitor status information
*/
case AC_STATUS:
# ifdef DEBUG
log("Got AC_STATUS");
# endif
/* get all the info in one convenient place */
data = dump_table();
/* something bad happened in dump_table */
break;
}
/* count how big it is */
for (i = 0; i < Nentries; ++i)
# ifdef DEBUG
# endif
/* get a contiguous chunk */
for (i = 0; i < Nentries; ++i)
break;
}
/* condense the data into the contiguous chunk */
*p = '\0';
for (i = 0; i < Nentries; ++i) {
}
# ifdef DEBUG
debug(p);
# endif
if (data)
/* ak->ak_size was set above */
log("could not send info");
free(p);
break;
/*
* request for sac to read sactab
*/
case AC_SACREAD:
# ifdef DEBUG
log("Got AC_SACREAD");
# endif
break;
/*
* request for port monitor to read _pmtab
*/
case AC_PMREAD:
# ifdef DEBUG
# endif
break;
}
case UNKNOWN:
break;
case NOTRUNNING:
case FAILED:
case STOPPING:
break;
case STARTING:
case ENABLED:
case DISABLED:
break;
}
break;
/*
* garbled message
*/
default:
break;
}
break;
default:
}
}
/*
* sendack - send a response to the administrative command
*
* args: ap - pointer to acknowlegment message
*/
void
{
# ifdef DEBUG
debug("in sendack");
# endif
log("Could not send ack");
}
/*
* sendpmmsg - send a message to a PM. Note: sc_size is always 0 in
* this version so just send the header.
*
* args: sp - pointer to sac's port monitor information for
* designated port monitor
* sm - pointer to message to send
*/
void
{
# ifdef DEBUG
debug("in sendpmmsg");
# endif
}
}
/*
* sendsig - send a signal to the port monitor
*
* args: sp - pointer to sac's port monitor infomation for
* designated port monitor
* signo - signal number to send
*/
int
{
# ifdef DEBUG
# endif
# ifdef DEBUG
debug("in sendsig - kill failed");
# endif
return(-1);
}
else
return(0);
}
else {
# ifdef DEBUG
debug("in sendsig - checklock failed");
# endif
return(-1);
}
}
/*
* checklock - check to see if a _pid file is locked
* if so, return pid in file, else 0
*
* args: sp - pointer to sac's port monitor infomation for
* designated port monitor
*/
{
int fd; /* scratch file descriptor */
int ret; /* return value */
# ifdef DEBUG
debug("in checklock");
# endif
if (fd < 0) {
return((pid_t)0);
}
return((pid_t)0);
}
/* in case pid wasn't null-terminated */
}
return((pid_t)0);
}