/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* bridged - bridging control daemon.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include <syslog.h>
#include <locale.h>
#include <stropts.h>
#include "global.h"
/*
* engine_lock is held while the main loop is busy calling librstp functions.
* Door threads take the lock to protect the library from reentrancy.
*/
/*
* These wrapper functions allow the other components in the daemon to remain
* ignorant of pthreads details.
*/
int
lock_engine(void)
{
return (pthread_mutex_lock(&engine_lock));
}
void
unlock_engine(void)
{
(void) pthread_mutex_unlock(&engine_lock);
}
/*
* Utility function for STREAMS ioctls.
*/
{
int retv;
return (retv);
else
}
static void
daemonize(void)
{
/*
* A little bit of magic here. By the first fork+setsid, we
* disconnect from our current controlling terminal and become
* a session group leader. By forking again without calling
* setsid again, we make certain that we are not the session
* group leader and can never reacquire a controlling terminal.
*/
}
if (pid != 0) {
}
}
}
if (pid != 0)
(void) chdir("/");
(void) umask(022);
}
static void *
{
int sig;
(void) sigfillset(&sigset);
for (;;) {
switch (sig) {
case SIGHUP:
break;
default:
if (debugging)
break;
}
/* if we're shutting down, exit this thread */
if (shutting_down)
return (NULL);
}
}
static void
init_signalhandling(void)
{
int err;
}
}
(void) sigfillset(&new);
(void) pthread_attr_init(&attr);
if (err != 0) {
}
(void) pthread_attr_destroy(&attr);
}
int
{
(void) textdomain(TEXT_DOMAIN);
if (argc != 2) {
}
}
&tablemax);
if (status != DLADM_STATUS_OK) {
}
/* Get the properties once so that we have the right initial values */
rstp_init();
daemonize();
init_door();
if (debugging)
event_loop();
(void) pthread_cancel(sighand);
return (0);
}