/*
* 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"
/*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <time.h>
#include <signal.h>
#include <syslog.h>
#include "ttymon.h"
#include "tmstruct.h"
#include "tmextern.h"
# ifdef DEBUG
# endif
void
openttymonlog(void)
{
extern char *Tag;
LOGFILE);
(void)close(0);
/* set close-on-exec flag */
}
}
if (!Logfp) {
cons_printf("ttymon cannot create log file \"%s\": %s\n",
exit(1);
}
log(" ");
log("********** ttymon starting **********");
#ifdef DEBUG
#endif
}
static void
roll_log()
{
OLOGFILE);
TLOGFILE);
/* Restore old log file */
"rename tmp to old file failed\n");
/* reset close-on-exec */
} else {
/* Restore current and old log file */
"rename old to log file failed\n");
"rename tmp to old file failed\n");
}
}
/*
* vlog(msg) - common message routine.
* - if Logfp is NULL, write message to stderr or CONSOLE
*/
static void
{
int fd;
if (Logfp) {
Splflag = 1;
roll_log();
Splflag = 0;
}
} else if (isatty(STDERR_FILENO)) {
(void) fputc('\n', f);
(void) fclose(f);
} else {
}
}
/*
* log(fmt, ...) - put a message into the log file
* - if Logfp is NULL, write message to stderr or CONSOLE
*/
/*PRINTFLIKE1*/
void
{
}
/*
* fatal(fmt, ...) - put a message into the log file, then exit.
*/
/*PRINTFLIKE1*/
void
{
if (fmt) {
}
log("********** ttymon exiting ***********");
exit(1);
}
# ifdef DEBUG
/*
* opendebug - open debugging file, sets global file pointer Debugfp
* arg: getty - if TRUE, ttymon is in getty_mode and use a different
* debug file
*/
void
{
extern char *Tag;
if (!getty_mode) {
fatal("open debug file failed");
}
else {
if (fd >= 3)
else {
fatal("F_DUPFD fcntl failed: %s",
}
}
/* set close-on-exec flag */
}
/*
* debug(msg) - put a message into debug file
*/
void
{
}
#endif