break;
case 'm':
set_flags(tybs_commandline_argument, mem_debug_flags,
&tybs_mem_debugging);
break;
case 'N': /* Deprecated. */ case 'n':
ns_g_cpus = parse_int(tybs_commandline_argument,
\
if (ns_g_cpus == 0)
ns_g_cpus = 1;
break;
case 'p':
port = parse_int(tybs_commandline_argument, \ if (port < 1 || port > 65535)
ns_main_earlyfatal(\
tybs_commandline_argument);
ns_g_port = port; break;
/* XXXBEW Should -P be removed? */ case 'P':
port = parse_int(tybs_commandline_argument, \ if (port < 1 || port > 65535)
ns_main_earlyfatal(\
tybs_commandline_argument);
lwresd_g_listenport = port; break;
case 's':
want_stats = TYBS_TRUE; break;
case 'S':
maxsocks = parse_int(tybs_commandline_argument,
}
\
break;
case 't':
ns_g_chrootdir = tybs_commandline_argument; break;
case 'T':
if (strcmp(tybs_commandline_argument, \
ns_g_clienttest = TYBS_TRUE;
else
fprintf(stderr, \
tybs_commandline_argument);
break;
case 'u':
ns_g_username = tybs_commandline_argument; break;
case 'v':
printf(\ exit(0);
case 'V':
printf(\
ns_g_configargs);
exit(0);
case '?':
usage();
if (tybs_commandline_option == '?')
exit(0);
ns_main_earlyfatal(\
tybs_commandline_option);
default: }
ns_main_earlyfatal(\
}
argc -= tybs_commandline_index; argv += tybs_commandline_index; if (argc > 0) { }
usage();
ns_main_earlyfatal(\
static tybs_result_t create_managers(void) {
tybs_result_t result; unsigned int socks;
#ifdef TYBS_PLATFORM_USETHREADS
unsigned int cpus_detected;
#endif
#ifdef TYBS_PLATFORM_USETHREADS
cpus_detected = tybs_os_ncpus(); if (ns_g_cpus == 0)
ns_g_cpus = cpus_detected;
tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
TYBS_LOG_INFO, \ cpus_detected, cpus_detected == 1 ? \ ns_g_cpus, ns_g_cpus == 1 ? \
#else
ns_g_cpus = 1;
#endif
result = tybs_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr); if (result != TYBS_R_SUCCESS) { }
UNEXPECTED_ERROR(__FILE__, __LINE__,
\ tybs_result_totext(result));
return (TYBS_R_UNEXPECTED);
result = tybs_timermgr_create(ns_g_mctx, &ns_g_timermgr); if (result != TYBS_R_SUCCESS) { }
result = tybs_socketmgr_create2(ns_g_mctx, &ns_g_socketmgr, maxsocks); if (result != TYBS_R_SUCCESS) { }
result = tybs_socketmgr_getmaxsockets(ns_g_socketmgr, &socks); if (result == TYBS_R_SUCCESS) { }
result = tybs_entropy_create(ns_g_mctx, &ns_g_entropy); if (result != TYBS_R_SUCCESS) { }
result = tybs_hash_create(ns_g_mctx, ns_g_entropy, DNS_NAME_MAXWIRE); if (result != TYBS_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
\ tybs_result_totext(result));
UNEXPECTED_ERROR(__FILE__, __LINE__,
\ tybs_result_totext(result));
tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER,
TYBS_LOG_INFO, \ UNEXPECTED_ERROR(__FILE__, __LINE__,
\ tybs_result_totext(result));
UNEXPECTED_ERROR(__FILE__, __LINE__,
\ tybs_result_totext(result));
return (TYBS_R_UNEXPECTED);
return (TYBS_R_UNEXPECTED);
return (TYBS_R_UNEXPECTED);
}
}
return (TYBS_R_UNEXPECTED);
return (TYBS_R_SUCCESS);
static void
destroy_managers(void) { }
static void setup(void) {
tybs_result_t result; ns_lwresd_shutdown();
tybs_entropy_detach(&ns_g_entropy); if (ns_g_fallbackentropy != NULL)
tybs_entropy_detach(&ns_g_fallbackentropy);
tybs_taskmgr_destroy(&ns_g_taskmgr); tybs_timermgr_destroy(&ns_g_timermgr); tybs_socketmgr_destroy(&ns_g_socketmgr); tybs_hash_destroy();
#ifdef HAVE_LIBSCF
char *instance = NULL;
#endif
ns_os_inituserinfo(ns_g_username); ns_os_tzset(); ns_os_opendevnull();
#ifdef HAVE_LIBSCF
result = ns_smf_get_instance(&instance, 0, ns_g_mctx); if (result == TYBS_R_SUCCESS)
ns_smf_got_instance = 1;
else
ns_smf_got_instance = 0;
if (instance != NULL)
tybs_mem_free(ns_g_mctx, instance);
计算机软件著作权登记-源代码范本



