main.c revision 0818d0a7646cde4ecee39e69cbe711d4b6727ea3
ca41b452ede6feaa9d8739ec3cae19389a7b0d03Bob Halley * Copyright (C) 1999 Internet Software Consortium.
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * Permission to use, copy, modify, and distribute this software for any
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * purpose with or without fee is hereby granted, provided that the above
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * copyright notice and this permission notice appear in all copies.
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff#include <unistd.h> /* XXXRTH Naughty. Needed for getopt(). */
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff "usage: named [[-c cachefile] ...] [[-z zonefile] ...]\n");
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff " [-s] [-N number of cpus]\n");
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff /*+ XXXRTH we need a veneered getopt() */
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff while ((ch = getopt(argc, argv, "c:N:sz:")) != -1) {
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff /* XXXRTH temporary syntax */
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff dbi->path = isc_mem_strdup(ns_g_mctx, optarg);
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff /* XXXRTH temporary syntax */
e4f074a2c2340ea80099beebecc3b89aa234fa8fMichael Graff /* XXXRTH temporary syntax */
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff dbi->path = isc_mem_strdup(ns_g_mctx, argtext);
c05e003dce672b2f8555a3e56857f29ce89c1677Michael Graff dbi->origin = isc_mem_strdup(ns_g_mctx, origintext);
291b0d910d115e41a4b69d0603c3376aebf0c630Michael Graff result = isc_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr);
4e675038a097065ff13944232cd7c89ac5961984Michael Graff "ns_taskmgr_create() failed: %s\n",
4e675038a097065ff13944232cd7c89ac5961984Michael Graff result = isc_timermgr_create(ns_g_mctx, &ns_g_timermgr);
291b0d910d115e41a4b69d0603c3376aebf0c630Michael Graff "ns_timermgr_create() failed: %s\n",
291b0d910d115e41a4b69d0603c3376aebf0c630Michael Graff result = isc_socketmgr_create(ns_g_mctx, &ns_g_socketmgr);
e24f605ad64182532640dc6721070456b13112d5Michael Graff "isc_socketmgr_create() failed: %s\n",
e24f605ad64182532640dc6721070456b13112d5Michael Graff result = ns_clientmgr_create(ns_g_mctx, ns_g_taskmgr, ns_g_timermgr,
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff "ns_clientmgr_create() failed: %s\n",
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff result = ns_interfacemgr_create(ns_g_mctx, ns_g_taskmgr,
e24f605ad64182532640dc6721070456b13112d5Michael Graff "ns_interfacemgr_create() failed: %s\n",
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff * The interface manager owns tasks, so we have to destroy it before
e24f605ad64182532640dc6721070456b13112d5Michael Graff * we destroy the task manager.
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff * isc_taskmgr_destroy() will block until all tasks have exited,
ae7d0a4375abaecfd5c5b0816616d9882831e69bMichael Graff result = isc_rwlock_init(&ns_g_viewlock, 0, 0);
2311073ce0ef26c0250e91e4a083d7cc94fa7d33Michael Graff * Start things running and then wait for a shutdown request.
2311073ce0ef26c0250e91e4a083d7cc94fa7d33Michael Graff UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_run(): %s",