版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
計算機(jī)軟件著作權(quán)登記-源代碼范本
天一博勝企業(yè)管理軟件VI.0源代碼1
計算機(jī)軟件著作權(quán)登記-源代碼范本
注意事項:常見的源代碼包含:c語言,VB,C++,JAVA,.NET等。
提交的代碼必須是源代碼的開頭載入程序,第30頁必須斷開,第60頁是軟件的程序結(jié)
尾,代碼中不得出現(xiàn)與申請表內(nèi)容不符合的日期,著作權(quán)人,軟件名字等,不能出現(xiàn)開源
代碼,不能出現(xiàn)任何版權(quán)糾紛。
格式要求:一、源代碼應(yīng)提交前、后各連續(xù)30頁,不足60頁的,應(yīng)當(dāng)全部提交。
二、源代碼頁眉應(yīng)標(biāo)注軟件的名稱和版本號,應(yīng)當(dāng)與申請表中名稱完全一致,頁
眉右上應(yīng)標(biāo)注頁碼,源代碼每頁不少于50行。
范例如下:
#include<tybs/commandline.h>
#include<tybs/dir.h>
ttinclude<tybs/entropy.h>
#include<tybs/file.h>
#include<tybs/hash.h>
#include<tybs/os.h>
#include<tybs/platform.h>
#include<tybs/resource.h>
#include<tybs/stdio.h>
#include<tybs/string.h>
#include<tybs/task.h>天一博勝企業(yè)管理軟件VI.0源代碼2#include
<tybs/timer.h>
#include<tybs/util.h>
#include<tybscc/result.h>
#include<dns/dispatch.h>
#include<dns/name.h>
/include<dns/result.h>
#include<dns/view.h>
#include<dst/result.h>
#defineNSJfAIN1
#include<named/ns_smf_globals.h>
ttendif
#ifdefDLZ
ttinclude<dlz/dlz_drivers.h>
ttendif
statictybsbooleantwant_stats:TYBSFALSE;
staticcharprogram_name[TYBS_DTRNAMEMAX]="named”;staticchar
absolute_conffile[TYBS_DIR_PATHMAX];
staticcharsaved_command_line[512];
staticcharversion[512];
staticunsignedintmaxsocks=0;
void
ns_main_earlywarning(constchar*format,...){
valistargs;
va_start(args,format);
if(ns_g_lctx!=NULL){
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_WARNING,format,args);
}else{
fprintf(stderr,"%s:〃,program_name);
vfprintf(stderr,format,args);
fprintf(stderr,〃\n〃);
fflush(stderr);
)
va_end(args);
)
Voidns_main_earlyfatal(constchar*format,…){
va_listargs;
vastart(args,format);
if(ns_g_lctx!=NULL){
tybslogvwrite(nsgIctx,NSLOGCATEGORYGENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CR1TICAL,format,args);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,"exiting(duetoearlyfatalerror)");
}else{
fprintf(stderr,/z%s:〃,programname);
vfprintf(stderr,format,args);
fprintf(stderr,〃\n〃);
fflush(stderr);}
天一博勝企業(yè)管理軟件VLO源代碼3va_end(args);
exit⑴;
)
staticvoid
assertion_failed(constchar*file,intline,tybs_assertiontype_ttype,
constcharMond)
(
if(ns_g_lctx!=NULL){
tybs_assertion_setcallback(NULL);
tybs」og_writc(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,〃%s:%d:%s(%s)failed",file,line,
tybs_assertion_typetotext(type),cond);
tybslogwrite(nsgIctx,NSLOGCATEGORYGENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,"exiting(duetoassertionfailure)");
}else{
fprintf(stderr,"%s:%d:%s(%s)failed\n〃,
file,line,tybs_assertion_typetotext(type),cond);
fflush(stderr);
)
if(ns_gcoreok)
abort();
exit(1);
staticvoid
library_fatal_error(constcharintline,constchar*format,
va_listargs)TYBS_F0RMAT_PRINTF(3,0);
staticvoid
1ibrary_fatal_error(constchar*file,intline,constchar"format,
valistargs)
(
if(ns_g_lctx!=NULL){
tybs_error_setfatal(NULL);
tybs」og_writc(ns_g_lctx,NS_L0GCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,〃%s:%d:fatalerror:",file,line);
tybs_log_vwrite(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NSLOGMODULE.MAIN,TYBS_LOG_CRITICAL,format,args);
tybs」og_write(ns_g_lctx,NS_L0GCATEGORY_GENERAL,
NS.L0GM0DULE__MAIN,TYBS_LOGCRITICAL,"exiting(duetofatalerrorin
library)〃);
}else{
fprintf(stderr,fatalerror:〃,file,line);
vfprintf(stderr,format,args);
fprintf(stderr,〃\n〃);
fflush(stderr);
)
if(ns_g_coreok)
abort0;exit(1);
天一博勝企業(yè)管理軟件VI.0源代碼4)
staticvoid
1ibrary_unexpected_error(constchar*file,int1ine,constchar*format,
va_listargs)TYBS_F0RMAT_PRINTF(3,0);
staticvoid
libraryunexpectederror(constchar*file,intline,constchar*format,
va_listargs)
(
if(ns_g_lctx!=NULL){
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_L0G_ERR0R,z,%s:%d:unexpectederror/7,file,line);
tybslog_vwrite(nsg_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULEJiAIN,
TYBS_LOG_ERROR,format,args);
}else{
fprintf(stderr,z,%s:%d:fatalerror:〃,file,line);
vfprintf(stderr,format,args);
fprintf(stderr,〃\n〃);
fflush(stderr);
)
)
staticvoid
lwresd_usage(void){
fprintf(stderr,
“usage:Iwresd[-4|-6][-cconffile-Cresolvconffile]
〃[-ddebuglevel]\n〃
〃E-fl-g][-nnumber_of_cpus][-pport]〃〃[-Plisten-port][-s]\n〃
〃[-tchrootdir][-uusername][-ipidfile]\nz/〃[-m
{usage|tracerecord|size|mctx)]\nz,);}
staticvoid
usage(void){
if(ns_g_lwresdonly){
Iwresdusage();
return;
)
fprintf(stderr,
“usage:named[-4|-6][-cconffile][-ddebuglevel]〃
[-nnumber_of_cpus]\n/z
〃[-pport][-s][-tchrootdir][-uusername]\n,z〃[-m
{usage|trace!record|size|mctx)]\n〃);}
staticvoid
save_command_line(intargc,char*argv[]){
inti;
char*src;
char*dst;
char*eob;
constchartruncated[]=
tybs_boolean_tquoted=TYBS_FALSE;天一博勝企業(yè)管理軟件VI.0源代碼5dst=
savedcommandline;
eob=saved_command_line+sizeof(saved_command_line);for(i=1;i<argc
&&dst<eob;i++){
*dst++二,,;
src=argv[i];
while(*src!='\0'&&dst<eob){
if(quoted||isalnum(*src&Oxff)||
*src二二,一,||*src二二,」||
*src二二,.'||*src=二,/,){
*dst++=*src++;
quoted=TYBS_FALSE;
}else{
*dst++=';
quoted=TYBS_TRUE;
)
)
)
INSIST(sizeof(saved_command_line)>=sizeof(truncated));if(dst=eob)
strcpy(eob-sizeof(truncated),truncated);
else
*dst='\0';
)
staticint
parse_int(char*arg,constchar*desc){
char*endp;
inttmp;
longintItmp;
Itmp=strtol(arg,&endp,10);
tmp=(int)Itmp;
if(*endp!='\0')
ns_main_earlyfatal(z,%s'%s'mustbenumeric'7,desc,arg);if(tmp<0
tmp!=Itmp)
ns_main_earlyfatal(",%s'%s'outofrange”,desc,arg);return(tmp);
)
staticstructflag_def{
constchar*name;
unsignedintvalue;
}mem_debug_flags[]二{
{"trace",TYBS_MEM_DEBUGTRACE},
{"record",TYBS_MEM_DEBUGRECORD},
{"usage",TYBS_MEM_DEBUGUSAGE),
{〃size〃,TYBS_MEM_DEBUGSIZE},
{〃mctx〃,TYBS_MEM_DEBUGCTX),
{NULL,0}
);
staticvoid
set_flags(constchar*arg,structflag_def*defs,unsignedint*ret){for
(;;)7
conststructflag_def*def;
constchar*end=strchr(arg,',');天博勝企業(yè)管理軟件VI.0源代碼6int
arglen;
if(end=NULL)
end=arg+strlen(arg);
arglen=end-arg;
for(def=defs;def->name!=NULL;def++){
if(arglen==(int)strlen(def->name)&&
memcmp(arg,def->name,arglen)=0){*ret=def->value;
gotofound;
}
}
ns_main_earlyfatal(''unrecognizedflagarglen,arg);found:
if(*end='\0')
break;
arg=end+1;
)
}
staticvoid
parse_command_line(intargc,char*argv[]){
intch;
intport;
tybs_boolean_tdisable6=TYBS_FALSE;
tybs_boolean_tdisable4=TYBS_FALSE;
save_command_line(argc,argv);
tybscommandlineerrprint=TYBSFALSE;
while((ch=tybs_command]ine_parse(argc,argv,
〃46c:C:d:fgi:lm:n:N:p:P:〃
〃sS:t:T:u:vVx:〃))!=-1){
switch(ch){
case'4f:
if(disable4)
ns_main_earlyfatal(z,cannotspecify-4and-6〃);if(tybs_net_probeipv4()!=
TYBS_R_SUCCESS)
ns_main_earlyfatal(,zTPv4notsupportedby0S〃);tybs_net_disableipv6();
disable6=TYBS_TRUE;
break;
case'6’:
if(disable6)
ns_main_earlyfatal(z/cannotspecify_4and-6〃);if(tybs_net_probeipv6()!二
TYBS_R_SUCCESS)
ns_main_earlyfatal(/zIPv6notsupportedby0S〃);tybs_net_disableipv4();
disable4=TYBS_TRUE;
break;
case'c:
ns_g_conffile=tybs_commandline_argument;
1wresd_g_conffi1e=tybs_commandline_argument;if(lwresd_g_useresolvconf)
ns_main_earlyfatal(z,cannotspecify-cand-C〃);ns_g_conffileset=TYBS_TRUE;
天一偏勝企業(yè)管理軟件VI.0源代碼7
break;case'C':1wresd_g_resolvconffile=tybs_commandline_argument;if
(ns_g_conffileset)ns_main_earlyfatal(^cannotspecify-cand-C〃);
lwresd_g_useresolvconf=TYBS_TRUE;break;case'd':ns_g_debugleve1=
parse_int(tybs_commandline_argument,“debuglevel");break;case'f':
ns_g_foreground=TYBSTRUE;break;case'g':ns_g_foreground=TYBSTRUE;
nsglogstderr=TYBSTRUE;break;/*XXXBEW-ishouldberemoved*/case'i':
lwresd_g_defaultpidfile=tybs_commandline_argument;break;case'1’:
ns_g_lwresdonly=TYBS_TRUE;break;case'm':
setflags(tybscommandlineargument,memdebugflags,&tybsmemdebugging);
break;case'N':/*Deprecated.*/case'n':ns_gcpus=
parse_int(tybs_commandline_argument,,znumberofcpus〃);if(ns_g_cpus=0)
ns_g_cpus=1;break;case'p':port=parse_int(tybs_commandline_argument,
〃port〃);if(port<1||port>65535)ns_main_earlyfatal(,?port'%s'outof
range”,tybs_commandline_argument);ns_g_port=port;break;/*XXXBEWShould
-Pberemoved?*/case'P':port=parse_int(tybs_commandline_argument,
〃port〃);if(port<1||port>65535)ns_main_earlyfatal(,zport'%s'outof
range”,tybs_commandline_argument);lwresd_g_listenport=port;break;case
,,
s:
天一博勝企業(yè)管理軟件VI.0源代碼8want_stats=TYBS_TRUE;
break;
case'S':
maxsocks=parse_int(tybs_command1ine_argament,“maxnumberofsockets");
break;
case't':
ns_g_chrootdir=tybs_commandline_argument;
break;
caseT:
if(strcmp(tybs_commandline_argument,“clienttest")==0)ns_g_clienttest=
TYBS_TRUE;
else
fprintf(stderr,“unknown-Tflag'*s\n〃,
tybs_command1ine_argument);
break;
case'u':
ns_g_username=tybs_commandline_argument;
break;
case'v':
/Z
printf(BIND%s\n〃,ns_g_version);
exit(0);
case'V’:
printf(,ZBIND%sbuiltwith%s\n”,ns_g_version,ns_g_configargs);
exit(0);
case'?':
usage();
if(tybscommandlineoption=='?')
exit(0);
ns_main_earlyfatal(^unknownoption'〃,
tybs_command1ine_option);
default:
nsjnainearlyfatal(''parsingoptionsreturned%d〃,ch);}
}
argc一二tybs_commandline_index;
argv+=tybscommand1ineindex;
if(argc>0){
usage();
nsmainearlyfatal(''extracommandlinearguments'");}
}
statictybs_result_t
createmanagers(void){
tybs_result_tresult;
unsignedintsocks;
#ifdefTYBS_PLATFORM_USETHREADS
unsignedintcpus_detected;
#endif
SifdefTYBS_PLATFORM_USETHREADS
cpusdetected=tybsos_ncpus();天一博勝企業(yè)管理軟件VI.0源代碼9if
(ns_g_cpus=0)
ns_g_cpus=cpus_detected;
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_SERVER,
TYBS_L0G_INF0,“found%uCPU%s,using%uworkerthread%sz/,
cpus_detected,cpus_detected==1?〃〃:〃s〃,
ns_g_cpus,ns_g_cpus==1?〃〃:〃s〃);
#else
ns_g_cpus=1;
#endif
result=tybs_taskmgr_create(ns_g_mctx,ns_g_cpus,0,&ns_g_taskmgr);
if(result!=TYBSRSUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
z,tybs_taskmgr_create0failed:%s”,
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
)
result=tybstimermgrcreate(ns_gmctx,&ns_gtimermgr);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
z/tybs_timermgr_create()failed:%s//,
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
)
result=tybs_socketmgr_create2(ns_gmctx,&ns_g_socketmgr,maxsocks);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED.ERROR(_FILE_,_LINE__,
z/tybs_socketmgr_create()failed:%s”,
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
)
result=tybssocketmgrgetmaxsockets(ns_g_socketmgr,&socks);
if(result==TYBS_R_SUCCESS){
tybs」og_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NSLOGMODULE.SERVER,
TYBS_LOG_INFO,“usingupto%usockets”,socks);
)
result=tybsentropycreate(nsgmctx,&nsgentropy);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
z,tybs_entropycreate()failed:%s〃,
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
}
result=tybs_hash_create(ns_g_mctx,ns_g_entropy,DNS_NAME_MAXWIRE);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
/ztybs_hashcreate()failed:%s〃,
tybs_result_totext(result));
return(TYBSR一UNEXPECTED);
)
return(TYBS_R_SUCCESS);}
天一博勝企業(yè)管理軟件VI.0源代碼10staticvoid
destroymanagers(void){
nsIwresdshutdown();
tybs_entropy_detach(&ns_g_entropy);
if(ns_g_falIbackentropy!=NULL)
tybsentropydetach(&nsgfallbackentropy);
tybs_taskmgr_destroy(&ns_g_taskmgr);
tybs_timermgr_destroy(&ns_g_timermgr);
tybssocketmgrdestroy(&nsgsocketmgr);
tybs_hash_destroy();
)
staticvoid
setup(void){
tybs_result_tresult;
#ifdefHAVE_LIBSCF
char*instance=NULL;
ttendif
ns_os_inituserinfo(ns_g_username);
nsos_tzset();
ns_os_opendevnul1();
ttifdefHAVELIBSCF
result=ns_smf_get_instance(feinstance,0,ns_g_mctx);
if(result==TYBS_R_SUCCESS)
ns_smf_got_instance=1;
else
nssmf_gotinstance=0;
if(instance!=NULL)
tybs_mem_free(ns_g_mctx,instance);
ttendif/*HAVELIBSCF*/
#ifdefPATH_RANDOMDEV
if(ns_g_chrootdir!=NULL){
result=tybsentropycreate(nsgmctx,&nsgfallbackentropy);if
(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal(〃tybs_entropy_create()failed:%s〃,
tybs_result_totext(result));
result=tybs_entropy_createfilesource(ns_g_fallbackentropy,PATH_RANDOMDEV);
if(result!=TYBS_R_SUCCESS){
nsmainear1ywarning(cou1dnotopenpre-chroot〃”entropysource%s:%s〃,
PATH_RANDOMDEV,
tybs_result_totext(result));
tybsentropydetach(&ns_gfallbackentropy);
)
)
#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(〃ns_log_init()failed:%s〃,
tybs_result_totext(result));天一博勝企業(yè)管理軟件VLO源代碼11if
(!ns_g_foreground)
nsosdaemonize();
result=tybs_app_start();
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal(/ztybs_app_start()failed:%s〃,
tybsresulttotext(result));
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_L0G_N0TICE,"startingBINDns_g_version,
saved_command_line);
tybslogwritersgIctx,NS_L0GCATEG0RYGENERAL,NS_L0GM0DULE_MAIN,
TYBS_L0G_N0TICE,“builtwith%s〃,ns_g_configargs);
(void)tybsresourceget!imit(tybsresourcestacksize,
&ns_g_initstacksize);
(void)tybs_resource_getlimit(tybs_resource_datasize,
&nsginitdatasize);
(void)tybsresourceget1imit(tybsresourcecoresize,
&ns_g_initcoresize);
(void)tybs_resource_getlimit(tybs_resource_openfiles,
&ns_g_initopenfi1es);
if(!tybs_file_isabsolute(ns_g_conffile)){
result=tybs_file_absolutepath(ns_g_conffile,
absolute_conffile,
sizeof(absolute_conffile));
if(result!=TYBS_R_SUCCESS)
nsmainearlyfatal(z,couldnotconstructabsolutepathof”
?"configurationfile:%s”,
tybs_result_totext(result));
ns_g_conffile=absolute_conffile;
)
result=tybstimenow(&nsgboottime);
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal(,ztybs_time_now()failed:%s”,
tybsresulttotext(result));
result=create_managers();
if(result!二TYBS_R_SUCCESS)
z,
ns_main_earlyfatal(create_managers()failed:%s〃,
tybs_result_totext(result));
ns_builtin_init();
SifdefDLZ
result=dlz_drivers_init();
if(result!=TYBS_R_SUCCESS)
nsmainearlyfatalC'dlzdriversinit()failed:%s〃,
tybs_result_totext(result));
ttendif
ns_server_create(ns_g_mctx,&ns_g_server);
)
staticvoid
cleanup(void){
destroy_managers();
nsserverdestroy(&nsgserver);
ns_builtin_deinit();#ifdefDLZ
天一博勝企業(yè)管理軟件Vl.O源代碼12dlz_drivers_clear();
#endif
dns_name_destroy();
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_LOG_NOTICE,"exiting");
nslogshutdown();
)
staticchar*memstats=NULL;
void
ns_main_setmemstats(constchar*filename){
if(memstats!=NULL){
free(memstats);
memstats=NULL;
)
if(filename=NULL)
return;
memstats=malloc(strlen(filename)+1);
if(memstats)
strcpy(memstats,filename);
)
#ifdefHAVE_LIBSCF
tybs_result_t
ns_smf_get_instance(char**ins_name,intdebug,tybs_mem_t*mctx)
scf_handle_t*h=NULL;
intnamelen;
char*instance;
REQUIRE(ins_name!=NULL&&*ins_name=NULL);
if((h=scfhandle_create(SCF_VERSION))==NULL){
if(debug)
UNEXPECTED_ERROR(_FILE_,_LINE_,
〃scf_handle_create()failed:%s〃,
scf_strerror(scf_error()));
return(TYBS_R_FAILURE);
)
if(scf_handle_bind(h)==-1){
if(debug)
UNEXPECTEDERROR(FILELINE_,
〃scf_handle_bind()failed:%s〃,
scf_strerror(scf_error()));
scf_handle_destroy(h);
return(TYBS_R_FAILURE);
)
if((namelen=scf_myname(h,NULL,0))=二-1){
if(debug)
UNEXPECTEDERROR(FILE_,_LINE
〃scf_jnyname()failed:%s〃,
scf_strerror(scf_error()));
scfhand1edestroy(h);
return(TYBS_R_FAILURE);
)
if((instance=tybsmemallocate(mctx,namelen+1))==NULL){
UNEXPECTED_ERROR(_FTLE_,_LINE_,天一博勝企業(yè)管理軟件VI.0源代碼13
,zns_smfgetinstancememory〃
z,allocationfailed:%s〃,
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_myname()failed:%s〃,
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(intargc,char*argv[]){
tybs_result_tresult;
SifdefHAVE_LIBSCF
char*instance二NULL;
#endif
strlcat(version,
Sifdef_DATE_
"namedversion:BIND"VERSION〃(〃__DATE_〃)”
#else
“namedversion:BIND〃VERSION,
#endif
sizeof(version));
result=tybs_filejprogname(*argv,program_name,sizeof(program_name));if
(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal(''programnametoolong");
if(strcmp(programname,“Iwresd")==0)
ns_g_lwresdonly=TYBS_TRUE;
tybs_assertion_setcallback(assertion_failed);
tybs_error_setfatal(1ibrary_fatal_error);
tybs_error_setunexpected(1ibrary_unexpected_error);
nsosinit(programname);
dns_result_register();
dst_result_register();
tybsccresult_register();
parse_command_line(argc,argv);
if(ns_g_chrootdir!=NULL){
intlen=strlen(ns_g_chrootdir);
if(strncmp(ns_g_chrootdir,ns_g_conffile,len)==0&&
(ns_g_conffile[len]=='/'||ns_g_conffile[len]=='\\'))
ns_main_ear1ywarning(/zconfigfilename("c%s)contains〃”chrootpath(-
t%s〉,天一博勝企業(yè)管理軟件VI.0源代碼14ns_g_conffile,ns_g_chrootdir);}
result=tybs_mem_create(0,0,&ns_g_mctx);
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal(z/tybs_mem_create()failed:%s〃,
tybs_result_totext(result));
tybs_mem_setname(ns_g_mctx,"main”,NULL);
setup();
do{
result=tybs_app_run();
if(result二二TYBS_R_RELOAD){
ns_server_reloadwanted(ns_g_server);
}elseif(result!=TYBSRSUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,〃tybs_app_run():%s〃,
tybs_result_totext(result));
result=TYBS_RSUCCESS;
}
}while(result!=TYBS_R_SUCCESS);
#ifdefHAVE_LIBSCF
if(ns_smf_want_disab1e==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_,"smf.disableJnstanceO〃
“failedfor%s:%s”,
instance,
scf_strerror(scf_error()));
)
if(instance!=NULL)
tybs_mem_free(ns_g_mctx,instance);
)
#cndif/*HAVE_LIBSCF*/
cleanup();
if(want_stats){
tybsmemstats(ns_gmctx,stdout);
tybs_mutex_stats(stdout);
if(ns_g_memstatisties&&memstats!=NULL){
FILE*fp=NULL;
result=tybsstdioopen(memstats,〃w〃,&fp);
if(result=TYBS_R_SUCCESS){
tybs_mem_stats(ns_g_mctx,fp);
tybsmutexstats(fp);
tybs_stdio_close(fp);
)
}
tybs_mem_destroy(&ns_g_mctx);
tybs_mcm_checkdestroyed(stderr);
ns_main_setmemstats(NULL);
tybsappfinish。;天一博勝企業(yè)管理軟件VI.0源代碼15ns_os_closedevnull();
ns_os_shutdown();
return(0);
)
ttdefineZEND_INCLUDE_FULL_WINDOWS_HEADERSttinclude〃php.h〃
/include<stdio.h>
ttinclude<fcntl.h>
#ifdefPUPWIN32
/include〃wir)32/time.h〃
#include〃win32/signal.h〃
ttinclude〃win32/phpWin32globals.h〃
/include<process.h>
#elifdefined(NETWARE)
ttinclude<sys/timeval.h>
#ifdefUSE_WINSOCK
#include<novsock2.h>
#endif
ttendif
#ifHAVE_SYS_TIME_H
/include<sys/time.h>
#endif
#ifHAVE_UNISTD_H
#include<unistd.h>
ttendif
#ifHAVE_SIGNAL_H
ttinclude<signal.h>
#endif
#ifHAVE_SETLOCALE
/include<locale.h>
ttendif
#include〃zend.h〃
/includeZ,zend_extensions.h〃
#include〃php_ini.h〃
ttincludezzphp_globals.h〃
#include〃php_main.h"
#include〃fopen_wrappers.h〃
#include/?ext/standard/phpstandard.h〃
/include〃php_variables.h〃
#include^ext/standard/credits.h〃
#ifdefPHPWIN32
#include<io.h>
#include,,win32/php_registry.h〃
#include^ext/standard/flock-Compat.h〃
#cndif
ttinclude〃php_syslog.h〃
ttinclude/zZend/zend_exceptions.h〃
#ifPHP_SIGCHILD
ttinclude<sys/types.h>
ttinclude<sys/wait.h>
#endif
ttinclude"zend_compile.h“天一博勝企業(yè)管理軟件VI.0源代碼16ttinclude
,,zend_execute.h〃
#include〃zend_highlight.h〃
ttinclude/Zzend_indent.h〃
ttincludeZ,zendextensions.h,z
#include〃zend_ini.h〃
#include,zphp_content_types.h,z
#include〃php_ticks.h〃
itinclude〃php_logos.h〃
ttinclude〃phpstreams.h〃
#include,zphp_open_temporary_file.h〃
Sinclude〃SAPLh〃
#include”rfcl867.h〃
/*}}}*/
itifndefZTS
php_core_globalscore_globals;
#else
PHPAPTintcore_globals_id;
#endif
ttdefineSAFE__FILENAME(f)((f)?(f):〃-〃)
/*{{{PHP_INI_MH
*/
staticPHP_INI_MH(OnSetPrecision)
(
inti=atoi(new_value);
if(i>=0){
EG(precision)=i;
returnSUCCESS;
}else{
returnFAILURE;
)
)
staticPHPINIMH(OnChangeMemoryLimit)
(
if(new_value){
PG(memorylimit)=zendatoi(newvalue,newvaluelength);}else{
PG(memory_limit)=KOO;/*effectively,nolimit*/}
returnzend_set_memory_limit(PG(memory_limit));
}
staticvoidphp_disable_functions(TSRMLS_D)
(
char*s=NULL,*e;
if(!*(INISTR(z,disablefunctions'"))){
return;
)
e=PG(disable_functions)二strdup(INI_STR(z,disable_functions'"));while(*e)
switch(*e){
case'':
case',':
if(s){
天一博勝企業(yè)管理軟件VL0源代碼17*e='\0';
zend_disable_function(s,e-sTSRMLS_CC);s=NULL;
)
break;
default:
if(!s){
s=e;
)
break;
)
e++;
)
if(s){
zend_disable_function(s,e-sTSRMLS_CC);
)
}
staticvoidphpdisableclasses(TSRMLSD)
(
char*s=NULL,*e;
if(!*(INI_STR(z,disable_classes"))){
return;
)
e=PG(disable_classes)=strdup(INI_STR(,,disable_classes,z));while(*e){
switch(*e){
case
case
if(s){
*e='\0';
zend_disable_class(s,e-sTSRMLS_CC);s=NULL;
)
break;
default:
if(!s){
s=e;
)
break;
)
e++;
}
if(s){
zend_disable_class(s,e-sTSRMLS_CC);
)
)
staticPHPINIMH(OnUpdateTimeout)
(
EG(timeout_seconds)=atoi(new_value);
if(stage=PHP_INI_STAGE_STARTUP){
/*Don,tsetatimeoutonstartup,onlyper-request*/returnSUCCESS;天一博
勝企業(yè)管理軟件VI.0源代碼}
zend_unset_timeout(TSRMLS_C);
zendsettimeout(EG(timeoutseconds));
returnSUCCESS;
}
staticintphpgetdisplayerrorsmode(charlvalue,intvaluelength)
(
intmode;
if(lvalue){
returnPHP_DISPLAY_ERRORS_STDOUT;
}
if(value_length=2&&!strcasecmp(〃on〃,value)){
mode=PHP_DISPLAY_ERRORS_STDOUT;
}elseif(value_length==3&&!strcasecmp(〃yes〃,value)){
mode=PHP_DISPLAY_ERRORS_STDOUT;
}elseif(value_length=二4&&!strcasecmp(,ztrue,z,value)){
mode=PHP_DISPLAY_ERRORS_STDOUT;
}elseif(value_length=6&&!strcasecmp(value,“stderr")){
mode=PHP_DISPLAY_ERRORS_STDERR;
}elseif(valuelength==6&&!strcasecmp(value,“stdout")){
mode=PHP_DISPLAY_ERRORS_STDOUT;
}else{
mode=atoi(value);
if(mode&&mode!=PHP_DISPLAY_ERRORS_STDOUT&&mode
PHP_DISPLAY_ERRORS_STDERR){
mode:PHPDISPLAYERRORS_STDOUT;
)
}
returnmode;
)
staticPHP_INI_MH(OnUpdateDisp1ayErrors)
(
PG(display_errors)=(zendbool)php_get_display_errors_mode(new_value,
newvaluelength);returnSUCCESS;
)
staticPHP_INI_DISP(disp1ay_errors_mode)
(
intmode,tmp_value_length,cgi_or_cli;
char*tmp_value;
TSRMLS_FETCH();
if(type==ZEND_INI_DISPLAY_ORIG&&ini_entry->modified){
tmp_value=(ini_entry->orig_va1ue?ini_entry->orig_value:NULL);
tmp_value_length=ini_entry->orig_value_length;
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年庫房轉(zhuǎn)租合同轉(zhuǎn)租條件、轉(zhuǎn)租手續(xù)及租金處理分析
- 2024年企業(yè)內(nèi)部審計保密協(xié)議
- 2024年度企業(yè)社會責(zé)任報告合同
- 2024年度住宅小區(qū)木門安裝工程合同
- 2024年度許可使用合同(商標(biāo))
- 腰椎ct課件教學(xué)課件
- 2024北京技術(shù)合同
- 2024年大數(shù)據(jù)使用協(xié)議:數(shù)據(jù)收集、分析和應(yīng)用的具體規(guī)定
- 液體密度課件教學(xué)課件
- 輿論學(xué)課件教學(xué)
- 入團(tuán)志愿書(2016版本)(可編輯打印標(biāo)準(zhǔn)A4) (1)
- 專項基金投資募集合作框架協(xié)議模版
- 浙江省公路山嶺隧道機(jī)械化裝備應(yīng)用指導(dǎo)手冊
- (完整word版)拼音練習(xí)jqx和ü、üe的相拼
- 醫(yī)療質(zhì)量檢查分析、總結(jié)、反饋5篇
- 桅桿工藝技術(shù)及施工要求
- (完整版)六年級下冊體育教學(xué)計劃與教案
- 北京地鐵受電弓的維護(hù)與故障檢修-畢業(yè)設(shè)計說明書
- 幼兒園教育和家庭教育的有效結(jié)合研究
- 集團(tuán)公司兩金管理評價辦法
- 電影的聲音分析PPT課件
評論
0/150
提交評論