debug.c revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <thread.h>
#include <unistd.h>
#include <sys/lx_brand.h>
#include <sys/lx_debug.h>
/* internal debugging state */
static char lx_debug_path_buf[MAXPATHLEN];
void
lx_debug_enable(void)
{
lx_debug_path = "/dev/tty";
}
void
lx_debug_init(void)
{
return;
/*
* It's OK to use this value without any locking, as all callers can
* use the return value to decide whether extra work should be done
* before calling lx_debug().
*
* If debugging is disabled after a routine calls this function it
* doesn't really matter as lx_debug() will see debugging is disabled
* and will not output anything.
*/
lx_debug_enabled = 1;
/* check if there's a debug log file specified */
if (lx_debug_path == NULL) {
lx_debug_path = "/dev/tty";
}
sizeof (lx_debug_path_buf));
lx_debug("lx_debug: debugging output ENABLED to path: \"%s\"",
}
void
{
int errno_backup;
if (lx_debug_enabled == 0)
return;
return;
}
/* format the message */
if (rv == -1) {
return;
}
/* add a carrige return if there isn't one already */
return;
}
/*
* Open the debugging output file. note that we don't protect
* ourselves against exec or fork1 here. if an mt process were
* extra open desciptor in their fd space. a'well. shouldn't
* really matter.
*/
return;
}
/* we retry in case of EINTR */
do {
}