教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 互联网资料 >

软件著作权-源代码范本(3)

来源:网络收集 时间:2026-01-20
导读: 天一博胜企业管理软件V1.0 源代码 11 } #endif ns_os_chroot(ns_g_chrootdir); ns_os_minprivs(); result = ns_log_init(TYBS_TF(ns_g_username != NULL)); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ ty

天一博胜企业管理软件V1.0 源代码

11

} #endif ns_os_chroot(ns_g_chrootdir); ns_os_minprivs(); result = ns_log_init(TYBS_TF(ns_g_username != NULL)); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); if (!ns_g_foreground) ns_os_daemonize(); result = tybs_app_start(); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, \ saved_command_line); tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, \ (void)tybs_resource_getlimit(tybs_resource_stacksize, &ns_g_initstacksize); (void)tybs_resource_getlimit(tybs_resource_datasize, &ns_g_initdatasize); (void)tybs_resource_getlimit(tybs_resource_coresize, &ns_g_initcoresize); (void)tybs_resource_getlimit(tybs_resource_openfiles, &ns_g_initopenfiles); if (! tybs_file_isabsolute(ns_g_conffile)) { result = tybs_file_absolutepath(ns_g_conffile, absolute_conffile, sizeof(absolute_conffile)); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ \ tybs_result_totext(result)); ns_g_conffile = absolute_conffile; } result = tybs_time_now(&ns_g_boottime); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); result = create_managers(); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); ns_builtin_init(); #ifdef DLZ result = dlz_drivers_init(); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); #endif

天一博胜企业管理软件V1.0 源代码

12

ns_server_create(ns_g_mctx, &ns_g_server); }

static void

cleanup(void) { destroy_managers(); ns_server_destroy(&ns_g_server); ns_builtin_deinit(); #ifdef DLZ dlz_drivers_clear(); #endif dns_name_destroy(); tybs_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, TYBS_LOG_NOTICE, \ ns_log_shutdown(); }

static char *memstats = NULL; void

ns_main_setmemstats(const char *filename) { if (memstats != NULL) { free(memstats); memstats = NULL; } if (filename == NULL) return; memstats = malloc(strlen(filename) + 1); if (memstats) strcpy(memstats, filename); }

#ifdef HAVE_LIBSCF tybs_result_t

ns_smf_get_instance(char **ins_name, int debug, tybs_mem_t *mctx) { scf_handle_t *h = NULL; int namelen; char *instance; REQUIRE(ins_name != NULL && *ins_name == NULL); if ((h = scf_handle_create(SCF_VERSION)) == NULL) { if (debug) UNEXPECTED_ERROR(__FILE__, __LINE__, \ scf_strerror(scf_error())); return (TYBS_R_FAILURE); } if (scf_handle_bind(h) == -1) { if (debug) UNEXPECTED_ERROR(__FILE__, __LINE__, \ scf_strerror(scf_error())); scf_handle_destroy(h); return (TYBS_R_FAILURE); } if ((namelen = scf_myname(h, NULL, 0)) == -1) { if (debug)

天一博胜企业管理软件V1.0 源代码

13

UNEXPECTED_ERROR(__FILE__, __LINE__, \ scf_strerror(scf_error())); scf_handle_destroy(h); return (TYBS_R_FAILURE); } if ((instance = tybs_mem_allocate(mctx, namelen + 1)) == NULL) { UNEXPECTED_ERROR(__FILE__, __LINE__, \ \ tybs_result_totext(TYBS_R_NOMEMORY)); scf_handle_destroy(h); return (TYBS_R_FAILURE); } if (scf_myname(h, instance, namelen + 1) == -1) { if (debug) UNEXPECTED_ERROR(__FILE__, __LINE__, \ scf_strerror(scf_error())); scf_handle_destroy(h); tybs_mem_free(mctx, instance); return (TYBS_R_FAILURE); } scf_handle_destroy(h); *ins_name = instance; return (TYBS_R_SUCCESS); }

#endif int

main(int argc, char *argv[]) { tybs_result_t result; #ifdef HAVE_LIBSCF char *instance = NULL; #endif strlcat(version, #ifdef __DATE__ \TE__ \#else \#endif sizeof(version)); result = tybs_file_progname(*argv, program_name, sizeof(program_name)); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ if (strcmp(program_name, \ ns_g_lwresdonly = TYBS_TRUE; tybs_assertion_setcallback(assertion_failed); tybs_error_setfatal(library_fatal_error); tybs_error_setunexpected(library_unexpected_error); ns_os_init(program_name); dns_result_register(); dst_result_register();

天一博胜企业管理软件V1.0 源代码

14

tybscc_result_register(); parse_command_line(argc, argv); if (ns_g_chrootdir != NULL) { int len = strlen(ns_g_chrootdir); if (strncmp(ns_g_chrootdir, ns_g_conffile, len) == 0 && (ns_g_conffile[len] == '/' || ns_g_conffile[len] == '\\\\')) ns_main_earlywarning(\ \ ns_g_conffile, ns_g_chrootdir); } result = tybs_mem_create(0, 0, &ns_g_mctx); if (result != TYBS_R_SUCCESS) ns_main_earlyfatal(\ tybs_result_totext(result)); tybs_mem_setname(ns_g_mctx, \ setup(); do { result = tybs_app_run(); if (result == TYBS_R_RELOAD) { ns_server_reloadwanted(ns_g_server); } else if (result != TYBS_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, \ tybs_result_totext(result)); result = TYBS_R_SUCCESS; } } while (result != TYBS_R_SUCCESS); #ifdef HAVE_LIBSCF if (ns_smf_want_disable == 1) { result = ns_smf_get_instance(&instance, 1, ns_g_mctx); if (result == TYBS_R_SUCCESS && instance != NULL) { if (smf_disable_instance(instance, 0) != 0) UNEXPECTED_ERROR(__FILE__, __LINE__, \ \ instance, scf_strerror(scf_error())); } if (instance != NULL) tybs_mem_free(ns_g_mctx, instance); }

#endif /* HAVE_LIBSCF */ cleanup(); if (want_stats) { tybs_mem_stats(ns_g_mctx, stdout); tybs_mutex_stats(stdout); } if (ns_g_memstatistics && memstats != NULL) { FILE *fp = NULL; result = tybs_stdio_open(memstats, \ if (result == TYBS_R_SUCCESS) { tybs_mem_stats(ns_g_mctx, fp);

天一博胜企业管理软件V1.0 源代码

15

tybs_mu …… 此处隐藏:3765字,全部文档内容请下载后查看。喜欢就下载吧 ……

软件著作权-源代码范本(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/442201.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)