lslog.c revision 113f42324b1acf3e5144da27ddbda36e338fbd07
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*/
/* system include files */
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <tiuser.h>
#include <values.h>
#include <ctype.h>
#include <time.h>
/* listener include files */
#include "lsparam.h" /* listener parameters */
#include "listen.h" /* listener */
#include "lsfiles.h" /* listener files info */
#include "lserror.h" /* listener error codes */
#include "lsdbf.h"
extern char Lastmsg[];
extern int NLPS_proc;
extern char *Netspec;
extern char Mytag[];
static char *stamp(char *);
void logmessage(char *s);
/*
* error handling and debug routines
* most routines take two args: code and exit.
* code is a #define in lserror.h.
* if EXIT bit in exitflag is non-zero, the routine exits. (see clean_up() )
* define COREDUMP to do the obvious.
*/
/*
* error: catastrophic error handler
*/
void
{
}
}
/*
* tli_error: Deal (appropriately) with an error in a TLI call
*/
static char *tlirange = "Unknown TLI error (t_errno > t_nerr)";
void
{
void t_error();
char scratch[256];
const char *p;
int save_errno = errno;
}
}
/*
* sys_error: error in a system call
*/
void
{
char scratch[256];
}
/*
* clean_up: if 'flag', and main listener is exiting, clean things
* up and exit. Dumps core if !(flag & NOCORE).
* Tries to send a message to someone if the listener
* is exiting due to an error. (Inherrently machine dependent.)
*/
void
{
extern int Dbf_entries;
extern void logexit();
int i;
return;
}
if (!(NLPS_proc)) {
/*
* unbind anything that we bound.
* Needs more intelligence.
*/
for (i=0;i<Dbf_entries;i++) {
dbp++;
}
}
#ifdef COREDUMP
abort();
#endif /* COREDUMP */
}
void
int exitcode;
char *msg;
{
if (msg) {
}
if (!NLPS_proc)
logmessage("*** listener terminating!!! ***");
}
#ifdef DEBUGMODE
/*VARARGS2*/
int
{
char buf[256];
}
#endif
/*
* log: given a message number (code), write a message to the logfile
* logmessage: given a string, write a message to the logfile
*/
void
{
}
static int nlogs; /* maintains size of logfile */
void
logmessage(char *s)
{
int err = 0;
extern int Logmax;
extern int Splflag;
/*
* The listener may be maintaining the size of it's logfile.
* Nothing in here should make the listener abort.
* If it can't save the file, it rewinds the existing log.
* Note that the algorithm is not exact, child listener's
* messages do not affect the parent's count.
*/
if (!Logfp)
return;
nlogs = 0;
++err;
}
} else {
++err;
}
if (err)
}
++nlogs;
}
static char *
{
return(Lastmsg);
}