/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* netcfgd - network configuration daemon. At present, this daemon implements
* the configuration backend for libnwam (via calls to nwam_backend_init()
* and nwam_backend_fini()). Initialization of the backend creates a door
* that libnwam calls use to read, update and destroy persistent configuration.
*
* More long-term, netcfgd will be used to manage other sources of configuration
* data and the backend functionality currently contained in libnwam will be
* generalized.
*/
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <wait.h>
#include <libnwam_priv.h>
#include <libnwam.h>
static const char *progname;
/*
* This function allows you to drop a dtrace probe here and trace
* complete strings (not just those containing formatting). It's
* important that we actually format the strings so we could trace them
* even if we choose not to log them.
*/
static void
{
if (fg) {
} else {
}
}
/* PRINTFLIKE2 */
void
{
char *vbuf;
}
}
static void
start_logging(void)
{
if (!fg)
}
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) {
_exit(0);
}
}
}
if (pid != 0) {
_exit(0);
}
(void) chdir("/");
(void) umask(022);
}
/* ARGSUSED */
static void
{
}
int
{
int c;
else
progname++;
switch (c) {
case 'f':
break;
default:
}
}
if (!fg)
daemonize();
(void) atexit(nwam_backend_fini);
"couldn't initialize libnwam backend: %s",
nwam_strerror(err));
}
for (;;)
(void) pause();
/* NOTREACHED */
return (EXIT_SUCCESS);
}