tname NULL def if arglen intstrlendef-gtname ampamp memcmparg def-gtname arglen 0 ret def-gtvalue goto found ns_main_earlyfatalquotunrecognized flag .squot arglen arg found: if end 0 break arg end 1 static voidparse_command_lineint argc char argv int ch int port tybs_boolean_t disable6 TYBS_FALSE tybs_boolean_t disable4 TYBS_FALSE save_command_lineargc argv tybs_commandline_errprint TYBS_FALSE while ch tybs_commandline_parseargc argv quot46c:C:d:fgi:lm:n:N:p:P:quot quotsS:t:T:u:vVx:quot -1 switch ch case 4: if disable4 ns_main_earlyfatalquotcannot specify -4 and -6quot if tybs_net_probeipv4 TYBS_R_SUCCESS ns_main_earlyfatalquotIPv4 not supported by OSquot tybs_net_disableipv6 disable6 TYBS_TRUE break case 6: if disable6 ns_main_earlyfatalquotcannot specify -4 and -6quot if tybs_net_probeipv6 TYBS_R_SUCCESS ns_main_earlyfatalquotIPv6 not supported by OSquot tybs_net_disableipv4 disable4 TYBS_TRUE breakcase c: ns_g_conffile tybs_commandline_argument lwresd_g_conffile tybs_commandline_argument if lwresd_g_useresolvconf ns_main_earlyfatalquotcannot specify -c and -Cquot ns_g_conffileset TYBS_TRUE breakcase C: lwresd_g_resolvconffile tybs_commandline_argument if ns_g_conffileset ns_main_earlyfatalquotcannot specify -c and -Cquot lwresd_g_useresolvconf TYBS_TRUE breakcase d: ns_g_debuglevel parse_inttybs_commandline_argument quotdebug levelquot breakcase f: ns_g_foreground TYBS_TRUE breakcase g: ns_g_foreground TYBS_TRUE ns_g_logstderr TYBS_TRUE break/ XXXBEW -i should be removed /case i: lwresd_g_defaultpidfile tybs_commandline_argument breakcase l: ns_g_lwresdonly TYBS_TRUE breakcase m: set_flagstybs_commandline_argument mem_debug_flags amptybs_mem_debugging breakcase N: / Deprecated. /case n: ns_g_cpus parse_inttybs_commandline_argument quotnumber of cpusquot if ns_g_cpus 0 ns_g_cpus 1 breakcase p: port parse_inttybs_commandline_argument quotportquot if port lt 1 port gt 65535 ns_main_earlyfatalquotport s out of rangequot tybs_commandline_argument ns_g_port port break/ XXXBEW Should -P be removed /case P: port parse_inttybs_commandline_argument quotportquot if port lt 1 port gt 65535 ns_main_earlyfatalquotport s out of rangequot tybs_commandline_argument lwresd_g_listenport port break case s: want_stats TYBS_TRUE break case S: maxsocks parse_inttybs_commandline_argument quotmax number of socketsquot break case t: ns_g_chrootdir tybs_commandline_argument break case T: if strcmptybs_commandline_argument quotclienttestquot 0 ns_g_clienttest TYBS_TRUE else fprintfstderr quotunknown -T flag snquot tybs_commandline_argument break case u: ns_g_username tybs_commandline_argument break case v: printfquotBIND snquot ns_g_version exit0 case V: printfquotBIND s built with snquot ns_g_version ns_g_configargs exit0 case : usage if tybs_commandline_option exit0 ns_main_earlyfatalquotunknown option -cquot tybs_commandline_option default: ns_main_earlyfatalquotparsing options returned dquot ch argc - tybs_commandline_index argv tybs_commandline_index if argc gt 0 usage ns_main_earlyfatalquotextra command line argumentsquot static tybs_result_tcreate_managersvoid tybs_result_t result unsigned int socksifdef TYBS_PLATFORM_USETHREADS unsigned int cpus_detectedendififdef TYBS_PLATFORM_USETHREADS cpus_detected tybs_os_ncpus if ns_g_cpus 0 ns_g_cpus cpus_detected tybs_log_writens_g_lctx NS_LOGCATEGORY_GENERAL NS_LOGMODULE_SERVER TYBS_LOG_INFO quotfound u CPUs using u worker threadsquot cpus_detected cpus_detected 1 quotquot : quotsquot ns_g_cpus ns_g_cpus 1 quotquot : quotsquotelse ns_g_cpus 1endif result tybs_taskmgr_createns_g_mctx ns_g_cpus 0 ampns_g_taskmgr if result TYBS_R_SUCCESS UNEXPECTED_ERROR__FILE__ __LINE__ quottybs_taskmgr_create failed: squot tybs_result_totextresult return TYBS_R_UNEXPECTED result tybs_timermgr_createns_g_mctx ampns_g_timermgr if result TYBS_R_SUCCESS UNEXPECTED_ERROR__FILE__ __LINE__ quottybs_timermgr_create failed: squot tybs_result_totextresult return TYBS_R_UNEXPECTED result tybs_socketmgr_create2ns_g_mctx ampns_g_socketmgr maxsocks if result TYBS_R_SUCCESS UNEXPECTED_ERROR__FILE__ __LINE__ quottybs_socketmgr_create failed: squot tybs_result_totextresult return TYBS_R_UNEXPECTED result tybs_socketmgr_getmaxsocketsns_g_socketmgr ampsocks if result TYBS_R_SUCCESS tybs_log_writens_g_lctx NS_LOGCATEGORY_GENERAL NS_LOGMODULE_SERVER TYBS_LOG_INFO quotusing up to u socketsquot socks result tybs_entropy_createns_g_mctx ampns_g_entropy if result TYBS_R_SUCCESS UNEXPECTED_ERROR__FILE__ __LINE__ quottybs_entropy_create failed: squot tybs_result_totextresult return TYBS_R_UNEXPECTED result tybs_hash_createns_g_mctx ns_g_entropy DNS_NAME_MAXWIRE if result TYBS_R_SUCCESS UNEXPECTED_ERROR__FILE__ __LINE__ quottybs_hash_create failed: squot tybs_result_totextresult return TYBS_R_UNEXPECTED return TYBS_R_SUCCESSstatic voiddestroy_managersvoid ns_lwresd_shutdown tybs_entropy_detachampns_g_entropy if ns_g_fallbackentropy NULL tybs_entropy_detachampns_g_fallbackentropy tybs_taskmgr_destroyampns_g_taskmgr tybs_timermgr_destroyampns_g_timermgr tybs_socketmgr_destroyampns_g_socketmgr tybs_hash_destroystatic voidsetupvoid tybs_result_t resultifdef HAVE_LIBSCF char instance NULLendif ns_os_inituserinfons_g_username ns_os_tzset ns_os_opendevnullifde.
上一篇:
【精品】b标准作业b程序修订的版本说明
下一篇:
秋天是疼痛的