main.c revision 7f159024d938d3699c5fadbaf3c1e06639e95c04
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdarg.h>
#include <sys/systeminfo.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "prnt.h"
#define YPDNSVERS 2L
extern void svc_run_as(void);
int verbose = 0; /* Verbose mode, 0=off, 1=on */
int verbose_out = 0; /* Verbose ouput, 0=log, 1=stdout */
/*
* The -v -V is used to distinguiish between verbose to stdout
* versus verbose to syslog rather then the background flag
* because this may be started from a daemon (nisd). When started
* from a daemon we can't use forground to print to stdout.
*/
static void usage()
{
"usage: rpc.nisd_resolv [-v|-V] [-F[-C xx]] [-t xx] [-p yy]\n");
"\tC fd - use fd for service xprt (from nisd)\n");
exit(1);
}
void
{
if (verbose_out) {
/* LINTED E_SEC_PRINTF_VAR_FMT */
} else
/* LINTED E_SEC_PRINTF_VAR_FMT */
} else if (verbose) {
if (verbose_out) {
/* LINTED E_SEC_PRINTF_VAR_FMT */
} else
/* LINTED E_SEC_PRINTF_VAR_FMT */
}
}
void
{
/* unreg prog */
exit(0);
}
/* ARGSUSED */
static void
toggle_verbose(int sig)
{
if (verbose) {
} else {
}
}
/*
* Callback function passed to fdwalk() to close all files.
*/
static int
{
return (0);
}
int
{
int c;
char *t_type = "ticots";
int connmaxrec = RPC_MAXDATASIZE;
/*
* Process the command line arguments
*/
opterr = 0;
switch (c) {
case 'v' : /* syslog */
verbose_out = 0;
break;
case 'V' : /* stdout */
verbose_out = 1;
break;
case 'F' :
background = FALSE;
break;
case 'C' :
break;
case 't' :
break;
case 'p' :
break;
case '?':
usage();
}
}
if (background) {
switch (fork()) {
case -1:
"Couldn't fork a process: exiting.\n");
exit(1);
/* NOTREACHED */
case 0:
break;
default:
exit(0);
}
closefrom(0);
(void) dup(1);
} else { /* foreground */
/* pardon the mess: due to transient p# requirement */
switch (use_fd) {
case -2: /* -C not used: just close stdin */
(void) close(0);
break;
case -1: /* close all (nisd non transient) */
closefrom(0);
break;
default: /* use use_fd as svc fd; close others (nisd trans) */
break;
}
}
if (!verbose_out)
(void) gettimeofday(&start_time, 0);
/*
* Set non-blocking mode and maximum record size for
* connection oriented RPC transports.
*/
}
/* no check for already running since using transient */
exit(1);
}
/* use passed in fd = use_fd */
exit(1);
}
/* parent did rpcb_set(): just add to callout */
exit(1);
}
} else {
exit(1);
}
}
/* Need udp xprt for sendreply()s, but don't reg it. */
if (udp_nconf4 == 0 && udp_nconf6 == 0) {
exit(1);
}
if (udp_nconf4 != 0)
else
reply_xprt4 = 0;
if (udp_nconf6 != 0)
else
reply_xprt6 = 0;
exit(1);
} else
/* keep udp_nconf[46] which is used later to create nbuf from uaddr */
svc_run_as();
return (0);
}