




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
軟件著作權-源代碼范本
注意事項:常見的源代碼包含:C語言,VB,C++,JAVA,.NET等。
提交的代碼必須是源代碼的開頭載入程序,第30頁必須斷開,第60頁是軟
件的程序結尾,代碼中不得出現與申請表內容不符合的日期,著作權人,軟
件名字等,不能出現開源代碼,不能出現任何版權糾紛。
格式要求:一、源代碼應提交前、后各連續30頁,不足60頁的,應當全部提交。
二、源代碼頁眉應標注軟件的名稱和版本號,應當與申請表中名稱完全一致,頁
眉右上應標注頁碼,源代碼每頁不少于50行。
范例如下:
#include<tybs/cominandline.h>
#include<tybs/dir.h>
#includc<tybs/cntropy.h>
#include<tybs/file.h>
#include<tybs/hash.h>
#include<lybs/os.h>
#include<tybs/platform.h>
#include<tybs/resource.h>
#include<tybs/stdio.h>
#include<tybs/string.h>
#include<tybs/task.h>
#include<tybs/timer.h>
#include<tybs/util.h>
#include<tybscc/resuk.h>
#includc<dns/dispa(ch.h>
#include<dns/name.h>
#include<dns/result.h>
#include<dns/vicw.h>
#include<dst/result.h>
#defineNS_MAIN1
#include<named/ns_smfLglobals.h>
#endif
#ifdefDLZ
#include<d1z/d1z_drivers.h>
#endif
statictybsjboolcan_twant_stats=TYBS_FALSE;
staticcharprogramnamefTYBSDIRNAMEMAXI="named":
staticcharabsolute_conffile[TYBS_DIR_PATHMAX];
staticcharsavcd_command_linc[512];
staticcharversion[512];
staticunsignedintrnaxsocks=0;
void
ns_main_earlywaming(constchar*format....){
va_Iistargs;
va_start(args,format);
if(ns_g」clx!=NULL){
tybs_log_vwritc(ns_g_lctK,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_carlyfatal(constchar"format,...){
va_listargs;
va_starl(args,format);
if(ns_g_lctx!=NULL){
tybs_log_vwrite(ns_g_lct^NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CR1TICAL,
format,args);
tybs_log_wrile(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"exiting(duetoearlyfatalerror)");
}else{
fprintf(stdcrr,*'%s:",program_nainc);
vfprintf(stderr,format,args);
fprintf(stderr,"\n");
fflush(stderr);
va_end(args);
exit(l);
)
staticvoid
assertion_failed(constchariniline.lybs_assertiontype_ttype,
constchar*cond)
(
if(ns_g」clx!=NULL){
tybs_asscrtion_sctcallback(NULL);
tybs」og_wrile(ns_g」ctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"%s:%d:%s(%s)failed",file,line,
tybs_assertion_(ypelotext(type),cond);
tybs」og_write(ns_g」ctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"exiling(duetoassertionfailure)");
}else{
fprintf(stderr."%s:%d:%s(%s)failed\n".
file,line,tybs_assertion_typetotext(type),cond);
fflush(stdcrr);
)
if(ns_g_coreok)
abort();
exit(l);
I
staticvoid
library_fa(al_error(constcharin(line,constchar*formal,
vajistargs)TYBS_FORMAT_PRINTF(3,0);
staticvoid
library_fa(al_error(constcharin(line,constchar*format,
va_listargs)
(
if(ns_g」ctx!=NULL){
tybs_error_setfatal(NULL);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"%s:%d:fatalerror:",file,line);
tybs_log_vwrite(ns_g_lctK,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MA1N,TYBS_LOG_CR1TICAL,
format,args);
tybs_log_wrile(ns_g」ctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_CRITICAL,
"exiting(duetofatalerrorinlibrary)");
)else{
fprintf(stderr,n%s:%d:fatalerror:",file,line);
vfprintf(stderr,format,args);
fprinif(sidcrr,"\n");
fflush(stderr);
if(ns_g_corcok)
aborl();
exit(l);
)
staticvoid
library_unexpected_error(constchar"file,intline,constchar*format,
vajistargs)TYBS_FORMAT_PRINTF(3,0);
staticvoid
library_unexpected_error(constchar"file,intline,constchar*format,
vajistargs)
(
if(ns_g_lctx!=NULL){
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,
"%s:%d:unexpectederror:",file,line);
tybs_log_vwrite(ns_g_lctK,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN,TYBS_LOG_ERROR,
format,args);
)else{
fprintf(stderr,*'%s:%d:fatalerror:",file,line);
vfprintf(stderr,format,args);
fprintf(stderr,
fflush(stderr):
)
}
staticvoid
lwresd_usage(void){
fprintf(stdcrr,
"usage:IwresdI-4|-61[-cconffile|-Cresolvconffile]"
"[-ddebuglevel]\n"
[-f]-g][-nnumber_oLepus][-pport]"
M[-Plisten-port][-s]\n"
[-tchrootdir][-uusernamej[-ipidfile]\n'r
[-m{usage|trace|record|size|mctx}]\n");
)
staticvoid
usage(void){
if(ns_g」wresdonly){
lwresd_usage();
return;
)
fprintf(stderr,
"usage:named[-4|-6][-cconffile][-ddebuglevel]H
'1-fl-gJ[-?number.oiLcpus]\n"
[-pport][-s][-1chrootdirl[-uusername]\ii"
[-m{usage|trace|record|size|mclx}]\n");
)
staticvoid
save_connnand_line(intargc,char*argv[]){
inti;
char*src;
char*dst;
char*eob;
constchar(runcated[]=
tybs_boolcan_tquoted=TYBS_FALSE;
dst=saved_command_line;
eob=saved_command_line+sizeof(saved_command_line);
for(i=1;i<argc&&dst<ecb;i++){
*dst++='
src=argv[i];
while(*src!='O'&&dst<eob){
if(quoted||isalnum(*src&Oxff)||
*src==||*src==II
*src==||*src==Z){
*dst++=*src++;
quoted=TYBS_FALSE;
}else{
*dst++='W;
quoted=TYBS_TRUE;
INSIST(sizeof(savcd_comtnaiid_line)>=sizeof(truncated));
if(dst==eob)
strcpy(eob-sizeof(trunca(ed),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_inain_carlyfatal("%s'%s'mustbenumeric”,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},
{"metx",TYBS_MEM_DEBUGCTX},
{NULL,0}
};
staticvoid
set_flags(constchar*arg,structflag_def*defs,unsignedint*ret){
for(;;){
constsirucrflag_dcfsltdcf;
constchar*end=strchr(arg,
intarglen;
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;
}
1
ns_main_carlyfatal("unrccognizcdflagarglen,arg);
found:
if(*end=='\0")
break;
arg=end+1;
)
)
staticvoid
parse_command_line(intargc,char*argv[J){
intch;
intport;
tybs_boolcan_tdisablc6=TYBS_FALSE;
tybsbooleantdisable4=TYBSFALSE:
save_command_line(argc,argv);
tybs_commandlinc_crrprint=TYBS_FALSE;
while((ch=tybs_commandline_parse(argc,argv,
"46c:C:d:fgi:lm:n:N:p:P:"
"sS:t:T:u:vVx:"))!=-l){
switch(ch){
case'4':
if(disable4)
ns_main_earlyfatal("cannotspecify-4and-6");
if(tybs_nct_probeipv4()!=TYBS_R_SUCCESS)
ns_main_earlyfatal("IPv4notsupportedbyOS");
tybs_net_disableipv6();
disable6=TYBS_TRUE;
break;
case'6’:
if(disable6)
ns_main_earlyfatal("cannotspecify-4and-6");
if(tybs_net_probeipv6()!=TYBS_R_SUCCESS)
ns_main_earlyfatal("IPv6notsupportedbyOS");
lybs_nel_disableipv^();
disablc4=TYBS_TRUE;
break;
case'c':
ns_g_conffile=tybs_comniandline_argunient;
lwresd_g_conffile=tybs_commandline_argumen(;
if(lwresd_g_useresolvconf)
ns_main_earlyfatal("cannotspecify-cand-C");
ns_g_confflleset=TYBS_TRUE;
break;
case'C:
Iwresd_g_resolvconffiIe=tybs_commandline_argument;
if(ns_g_conffilcsct)
ns_main_earlyfatal("cannotspecify-cand-C");
lwresd_g_useresolvconf=TYBS_TRUE;
break;
case'd':
ns_g_debuglevel=p<irse_int(tybs_conmiandline_argunient,
"debuglevel");
break;
case'f:
ns_g_fbreground-TYBS_TRUE;
break;
case'g':
ns_g_fbreground=TYBS_TRUE;
ns_g_Iogstdcrr=TYBS_TRUE;
break;
/*XXXBEW-ishouldberemoved*/
case'i':
lwresd_g_defaullpidfile=tybs_commandline_argumenl;
break;
case
ns_g_lwresdonly=TYBS_TRUE;
break;
case'm':
set_flags(tybs_commandline_argument,mem_debug_tlags,
&tybs_mein_dcbugging);
break;
case'N':/*Deprecated.*/
case'n':
ns_g_cpus=parse_int(tybs_commandline_argument,
"numberofepus");
if(ns_g_cpus==0)
ns_g_cpus=I;
break;
case'p':
port=parse_in((tybs_commandline_argument,"port");
if(port<1||port>65535)
ns_main_earlyfatal("port'%s'outofrange",
tybs_commandline_argument);
ns_g_port=port;
break;
/*XXXBEWShould-Pberemoved?*/
case'P':
port=parse_in((tybs_commandline_argument."port");
if(port<1||port>65535)
ns_main_earlyfatal("port'%s'outofrange",
tybs_connnandline_argument);
lwresd_g_listenport=port;
break;
case's':
want_stats=TYBS_TRUE;
break;
case'S":
maxsocks=parse_int(tybs_conimandline_argument,
"maxnumberofsockets");
break;
caset:
ns_g_chrootdir=tybs_commandline_argument;
break;
caseT:
if(strcmp(tybs_commandline_argument,"clienttest")==0)
ns_g_clientlest=TYBS_TRUE;
else
fprintf(stderr,"unknown-Tflag'%s\n",
tybs_commandline_argumen();
break;
case'u':
ns_g_usemame=(ybs_commandline_argument;
break;
case'v':
printf("BIND%s\n",ns_g_version);
exit(O);
caseV:
printf("BIND%sbuiltwith%s\n",ns_g_version,
ns_g_configargs);
exil(O);
case
usageO;
if(tybs_commandline_option=='?')
exit(O);
ns_main_earlyfatal("unknownoption
tybs_cornmandline_option);
default:
ns_main_earlyfatal("parsingoptionsreturned%d",ch);
)
)
argc-=(ybs_comman(Jline_index;
argv+=tybs_commandline_indcx;
if(argc>0){
usage();
ns_main_earlyfatal("extracommandlinearguments");
)
)
statictybs_result_t
create_managers(void){
tybs_result_tresult;
unsignedintsocks;
#ifdefTYBS_PLATFORM_USETHREADS
unsignedintcpus_dctcctcd;
#endif
#ifdefTYBS_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,"found%uCPU%s,using%uworkerthread%s",
cpus_dctccicd,cpus_dciccicd==1?"":"s",
ns_g_cpus,ns_g_cpus==1?"":"s");
#else
ns_g_cpus=1;
#endif
result=tybs_tasknigr_create(ns_g_mctx,ns_g_cpus,0,&ns_g_taskmgr);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
"tybs_taskmgr_create()failed:%s",
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
)
result-tybs_timermgr_create(ns_g_mctx,&ns_g_timermgr);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
"tybs.timermgccreateOfailed:%s",
tybs_rcsult_toicxt(rcsult));
return(TYBS_R_UNEXPECTED);
)
result=tybs_socketnigr_create2(ns_g_mctx,&ns_g_socketmgr,niaxsocks);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
"tybs_socketnigr_create()failed:%s",
tybs_result_toiext(result));
return(TYBS_R_UNEXPECTED);
}
result=tybs_socke(mgr_getmaxsockets(ns_g_socketmgr,&socks);
if(result==TYBS_R_SUCCESS){
tybs」og_write(ns_g」ctx,NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER,
TYBS_LOG」NFO,"usingupto%usockets",socks);
I
result=tybs_entropy_create(n5_g_mctx,&ns_g_entropy);
if(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
"tybs_cntropy_crcatc()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_,
"tybs_hash_create()failed:%s",
tybs_result_totext(result));
return(TYBS_R_UNEXPECTED);
)
return(TYBS_R_SUCCESS);
)
sialicvoid
destroy_managers(void){
ns」wresd_shuldown();
tyhs_en(ropy_detach(&ns_g_entropy);
if(ns_g_fallbackentropy!=NULL)
tybs_entropy_detach(&ns_g_fallbackentropy);
iybs_iaskmgr_clcstroy(&ns_g_(askmgr);
tybs_timermgr_destroy(&ns_g_timermgr);
tybs_socketmgr_destroy(&ns_g_socke(mgr);
tybs_hash_dcstroy();
staticvoid
setup(void){
tybs_result_tresult;
#ifdefHAVE_LIBSCF
char*instance=NULL;
#endif
ns_os_inituserinfo(ns_g_username);
ns_os_lzse(();
ns_os_opcndcvnull();
#ifdefHAVE_LIBSCF
result=ns_smCget_instance(&inslance,0,ns_g_mctx);
if(result==TYBS_K_SUCCESS)
ns_smf_got_instance=1;
else
ns_smf_got_instance=0;
if(instance!=NULL)
tybs_mem_free(ns_g_nicix,instance);
#endif/*HAVE_LIBSCF*/
#ifdefPATH_RANDOMDEV
if(ns_g_chrootdir!=NULL){
result=tybsentropycreate(nsgmetx.&nsgfallbackentropy);
if(result!=TYBS_R_SUCCESS)
ns_main_carlyfatal("tybs_cntropy_crcatc()failed:%s",
tybs_result_totext(result));
result=tybs_entropy_createfilesource(ns_g_fallbackentropy,
PATH.RANDOMDEV);
if(result!=TYBS_R_SUCCESS){
ns_main_earlywarning("couldnotopenpre-chroot"
"entropysource%s:%s",
PATH_RANDOMDEV,
tybs_rcsult_totcxt(result));
tybs_entropy_detach(&ns_g_fallbackentropy);
1
)
#endif
ns_os_chroot(ns_g_chrootdir);
ns_os_minprivs();
result=ns_log_init(TYBS_TF(ns_g_usernaine!=NULL));
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal("ns_log_init()failed:%s",
tybs_result_totext(result));
if(!ns_g_forcground)
ns_os_daemonize();
result=tybs_app_start();
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal("tybs_app_start()failed:%s”,
tybs_result_totext(result));
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_LOG_NOTICE,"startingBIND%s%s",ns_g_version,
savcd_command_linc);
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_LOG_NOTICE,"builtwith%s",ns_g_configargs);
(void)tybs_rcsourcc_gctlimit(tybs_rcsourcc_stacksizc,
&ns_g_inilstacksize);
(void)tybs_resource_getlimit(tybs_resource_datasize,
&ns_?_inildatasize);
(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_absolulepath(ns_g_conffile,
absolutc_conffilc,
sizeof(absolute_conffile));
if(result!=TYBS_R_SUCCESS)
ns_main_carlyfatal("couldnotconstructabsolutepathof°
"configurationfile:%s",
tybs_result_totext(result));
ns_g_conffile=absolute_conffile;
I
result=tybs_time_now(&ns_g_boottime);
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfa(al("tybs_time_now()failed:%s",
tybs_rcsult_totcxt(result));
result=createmanagersO;
if(result!=TYBS_R_SUCCESS)
ns_main_carlyfatal("crcatc_managcrs()failed:%s",
tybs_result_totext(result));
ns_builtin_init();
#ifdefDLZ
result=dlz_drivers_init();
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfatal("dlz_drivers_init()failed:%s",
tybs_result_totext(result));
#endif
ns_server_create(ns_g_mctx,&ns_g_server);
)
staticvoid
cleanup(void){
destroy_managers();
ns_servcr_destroy(&ns_g_server);
ns_builtin_deinit();
#ifdefDLZ
dlz_drivers_clear();
#endif
dns_namc_dcstroy();
tybs_log_write(ns_g_lctx,NS_LOGCATEGORY_GENERAL,NS_LOGMODULE_MAIN,
TYBS_LOG_NOTICE,"exiting");
ns_log_shutdown();
}
staticchar*inemstats=NULL;
void
ns_main_setmemstats(constchar*filename){
if(mcmsiats!=NULL){
free(memstats);
memstats=NULL;
if(filename==NULL)
return;
memstats=malloc(strlen(filename)+1):
if(mems(ats)
strcpy(memstats,filename);
)
#ifdefHAVE_LIBSCF
tybs_result_t
ns_smCget_instance(char**ins_name,in(debug,tybs_mem_l*mctx){
scflhandle_t*h=NULL;
intnamelen;
char.instance;
REQUIRE(ins_namc!=NULL&&*ins_namc==NULL);
if((h=scf_handIe_create(SCF_VERSION))==NULL){
if(debug)
UNEXPECTED_ERROR(_FILE_,_LINE_,
nscf_handle_creale()failed:%s'\
scCstrerror(scflerror()));
return(TYBS_R_FAILURE);
)
if(scf_handlc_bind(h)==-1){
if(debug)
UNEXPECTED_ERROR(_FILE_,_LINE_,
"scf_handle_bind()failed:%s",
scf_streriT>r(scLerror()));
scLhandle_destroy(h);
return(TYBS_R_FAILURE);
I
if((namelen=scfLmyname(h,NULL,()))==-1){
if(debug)
UNEXPECTED_ERROR(_FILE_,_LINE_,
"scILmynamc。failed:%s",
scCstierror(scLerror()));
scLhandle_desiroy(h);
return(TYBS_R_FAILURE);
)
if((instance=lybs_mem_allocate(mctx,namelen+I))==NULL)(
UNEXPECTED_ERROR(_FILE_,_LINE_,
"ns_smf_get_instancememory”
"allocationfailed:%s",
tybs_result_totext(TYBS_R_NOMEMORY));
scLhandle_destroy(h);
return(TYBS_R_FAILURE);
)
if(sc匚myname(h,instance,namelen+!)=="!){
if(debug)
UNEXPECTED_ERROR(_FILE_,_LINE_,
nscf_myname()failed:%s",
scLstrerror(scLerror()));
scLhandle_destroy(h);
iybs_incm_frcc(mcix,insiancc);
return(TYBS_R_FAILURE);
scflhandlc_destroy(h);
*ins_name=instance;
return(TYBS_R_SUCCESS);
)
#endif
int
main(intargc,char*argv[]){
tybs_result_tresult;
#ifdefHAVE_LIBSCF
char*instance=NULL;
#cndif
strlcat(version,
#ifdef_DATE_
"namedversion:BIND"VERSION"("_DATE_
#else
"namedversion:BIND"VERSION,
#endif
sizeof(version));
result=tybs_file_progname(*argv,program_name,sizeof(prograni_nanie));
if(result!=TYBS_R_SUCCESS)
ns_main_earlyfa(al("programnametoolong");
if(strcnip(program_namc,"Iwresd")==0)
nsgIwresdonly=TYBSTRUE:
tybs_assertion_setcallback(assertion_failed);
tybs_crror_sctfatal(library_fatal_crror);
tybs_error_setunexpected(librcry_unexpected_error);
ns_os_init(program_name);
dns_rcsult_register();
dst_result_register();
tybscc_result_register();
parse_command_Iine(argc,argv);
if(ns_g_chrootdir!=NULL){
intlen=str!cn(ns_g_chrootdir);
if(strncmp(ns_g_chrootdir,ns_g_conffile,len)==0&&
(ns_g_conffile[lenl==7||ns_g_conffile[lenl--3\'))
ns_main_earlywarning("configfilename(-c%s)contains"
"chrootpath(-t%s)'\
ns_g_conffile,ns_g_chrootdir);
)
result=tybs_mem_create(O,0.&ns_g_mctx);
if(result!=TYBS_R_SUCCESS)
ns_niain_earlyfatal("tybs_mem_create()failed:%s",
tybs_result_totext(result));
tybs_mem_setname(ns_g_mctx,"main1',NULL);
setupO;
do{
result=tybs_app_run();
if(result==TYBS_R_RELOAD){
ns_server_reloadwanted(ns_g_server);
}elseif(result!=TYBS_R_SUCCESS){
UNEXPECTED_ERROR(_FILE_,_LINE_,
"(ybs_app_run():%s",
tybs_resiilt_totext(result));
result=TYBS_R_SUCCESS;
}while(result!=TYBS_R_SUCCESS);
#ifdefHAVE_LIBSCF
if(ns-smflwant_disable==1){
result=ns_smflget_instance(&instance,i,ns_g_mctx);
if(result==TYBS_R_SUCCESS&&instance!=NULL){
if(smC<Jisable_insunce(instance,0)!=0)
UNEXPECTED_ERR()R(_FILE_____LINE_,
"smCdisable_instance()"
"failedfor%s:%s",
instance,
scf_strerror(scLerror()));
)
if(instance!=NULL)
tybs_memfree(nsgmetx.instance);
)
#endif/*HAVE_LIBSCF*/
cleanupO;
if(want_stats){
tybs_mem_stats(ns_g_mctx,stdout);
(ybs_mutex_stats(stdout);
)
if(nsgmemstatistics&&memstats!=NULL){
FILE*fp=NULL;
result=tybs_stdio_opcn(incmstats,^w",&fp);
if(result==TYBS_R_SUCCESS){
tybs_mem_stats(ns_g_mctx,fp);
tybs_mutex_stats(fpi;
tybs_stdio_close(fp);
)
)
tybs_mem_destroy(&ns_g_mctx);
tyhs_mcm_chcckdcstroycd(stdcrr);
ns_main_setmemstats(NULL):
tybs_app_finish();
ns_os_closcdevnull();
ns_os_shutdown();
return(0);
}
#defineZENDJNCLUDE_FULL_WINDOWS_HEADERS
include"php.h"
#include<stdio.h>
#include<fcn(l.h>
#ifdcfPHP_WIN32
#include"win32/time.h"
#include"win32/signal.h"
#include"win32/php_win32_globals.h"
#include<process.h>
#elifdefined(NETWARE)
#include<sys/timeval.h>
#ifdefUSE_WINSOCK
#include<novsock2.h)
#endif
#endif
#ifHAVE_SYS_TIME_H
#include<sys/time.h>
#endif
#ifHAVE_UNISTD_H
#include<unistd.h>
#endif
#ifHAVE_SIGNAL_H
#include<signal.h>
#endif
#ifHAVE_SETLOCALE
#include<localc.h>
#endif
#include"zend.h"
#include"zcnd_cxtcnsions.h"
#include"php_ini.h"
#include"php_globals.h"
#include"php_main.h"
#include"fopen_wrappers.h"
#include"ext/standard/php_standard.h"
#include"php_variables.h"
#include"ext/standard/credils.h"
#ifdefPHP_WIN32
#include<io.h>
#include"win32/php_registry.h"
#includc"cxt/standard/flock_compat.h"
#endif
#include"php_syslog.h"
#include"Zend/zend_exccptions.h"
#ifPHP_SIGCHILD
#include<sys/typcs.h>
#include<sys/wait.h>
#endif
#include"zcnd_compilc.h''
#include"zend_execute.h"
#include"zend_highlight.h"
#include"zend_indent.h"
#include"zend_extensions.h"
#include"zend_ini.h"
#include"php_content_typcs.h"
#include"php_ticks.h"
#include"php_logos.h"
#include"php_streams.h"
#include"php_open_temporary_file.h"
include"SAPl.h"
include"rfcl867.h"
/*}}}*/
#ifndefZTS
php_core_globalscore_globals;
#else
PHPAPIintcore_globals_id:
#endif
^defineSAFE_FILENAME(f)
/*{{{PHP」NI_MH
*;
staticPHP_INI_MH(OnSctPrccision)
inti=atoi(new_value);
if(i>=0){
EG(precision)=i;
returnSUCCESS;
}else{
returnFAILURE;
staticPHP_INI_MH(OnChangeMemoryLimit)
(
if(new_value){
PG(memory」imit)=zcnd_atoi(new_valuc,ncw_valuc_lcngth);
}else{
PG(memory_limit)=1?30;/*effectively,nolimit*/
)
returnzend_set_memory_limit(PG(memory_limit));
)
staticvoidphp_disable_functions(TSRMLS_D)
{
char*s=NULL,*e;
if(!*(INISTRC'disablefunctions"))){
return;
)
e=PG(disable_functions)=strdup(INI_STR("disable_functions"));
while(*e){
switch(*e){
case'
case
if(s){
*e='\0';
zcnd_disable_function(s,c-sTSRMLS_CC);
s=NULL:
)
break;
default:
if(!s){
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2031年中國拖拉機放線車行業投資前景及策略咨詢研究報告
- 2025年度防水工程承包合同
- 2025至2031年中國四方葉片鎖行業投資前景及策略咨詢研究報告
- 2025至2031年中國助駁接爪行業投資前景及策略咨詢研究報告
- 2025年安徽省高考數學對標命題2(教師版)
- 2025年公有土地租賃合同樣本
- 2025至2030年中國離心力卸料離心機數據監測研究報告
- 門診部健康教育課件
- 2025至2030年中國接線端子自動裝配機數據監測研究報告
- 風險預控管理體系
- 貫徹落實清理規范非融資性擔保方案指導意見
- 期中模擬卷(新疆專用)-2024-2025學年八年級英語下學期核心素養素質調研模擬練習試題(考試版)A4
- 2025年簽訂好的勞動合同模板
- 物理試題2025年東北三省四城市聯考暨沈陽市高三質量監測(二)及答案
- 2025廣東省深圳市中考數學復習分類匯編《函數綜合題》含答案解析
- 七年級地理下冊第七單元測試題(人教版)
- 【9道一模】2025年安徽省合肥市蜀山區九年級中考一模道法試卷(含答案)
- 金融工程重點總結
- 控煙知識培訓課件
- 設備的技改和更新管理制度
- GB/T 5453-2025紡織品織物透氣性的測定
評論
0/150
提交評論