软件著作权源代码范本_第1页
软件著作权源代码范本_第2页
软件著作权源代码范本_第3页
软件著作权源代码范本_第4页
软件著作权源代码范本_第5页
已阅读5页,还剩53页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

软件著作权-源代码范本

注意事项:常见的源代码包含: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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论