Это - достаточно беспорядочный архив сообщений конференций сети fidonet, которые на момент их прочтения мной
показались полезными или интересными. Многие устарели, многие узкоспецифичны и малоинтересны, но может оказаться и что-то новое...
- __techs (2:5015/42) ----------------------------------------------- __techs - Msg : 96 of 1000 Pvt From : Nick Vasilyev 2:5030/25.70 26 Sep 96 10:00:30 To : All 28 Sep 96 22:43:46 Subj : crashme (3/3) ------------------------------------------------------------------------------- @AREA:RU.OS.CMP Мое почтение, доpогой господин All и все остальные господа! [пpодолжение] nseed = atol(argv[2]); ntrys = atol(argv[3]); sprintf(notes,"crashme %s%ld.%d %ld %ld", (malloc_flag == 0) ? "" : "+",nbytes,incptr,nseed,ntrys); note(3); record_note(); if (malloc_flag == 0) {the_data = bad_malloc((nbytes < 0) ? -nbytes : nbytes); badboy = castaway(the_data); sprintf(notes,"Badboy at %d. 0x%X",badboy,badboy); note(3);} srand(nseed); #ifdef WIN32 SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); #endif badboy_loop();} #ifdef WIN32 DWORD exception_filter(DWORD value) {int sev,cus,res,fac,cod; sev = 3 & (value >> 30); cus = 1 & (value >> 29); res = 1 & (value >> 28); fac = 07777 & (value >> 16); cod = 0xFFFF & value; sprintf(notes,"sev(%d)cus(%d)res(%d)fac(%d)code(%d)", sev,cus,res,fac,cod); note(5); return(EXCEPTION_EXECUTE_HANDLER);} #endif void badboy_loop() {int i; for(i=0;i<ntrys;++i) {compute_badboy(); if (offset) sprintf(notes,"try %d, offset %d",i,offset); else if (malloc_flag == 1) sprintf(notes,"try %d, Badboy at %d. 0x%X",i,badboy,badboy); else sprintf(notes,"try %d",i); note(5); #ifdef WIN32 try {try_one_crash(); sprintf(notes,"didn't barf!"); note(5);} except(exception_filter(GetExceptionCode())) {} #else if (setjmp(again_buff) == 3) {sprintf(notes,"Barfed"); note(5);} else {set_up_signals(); alarm(10); try_one_crash(); sprintf(notes,"didn't barf!"); note(5);} #endif }} struct status_list {long status; long count; struct status_list *next;}; struct status_list *slist = NULL; record_status(n) long n; {struct status_list *l; for(l=slist;l != NULL; l = l->next) if (n == l->status) return(++l->count); l = (struct status_list *) malloc(sizeof(struct status_list)); l->count = 1; l->status = n; l->next = slist; slist = l; return(1);} summarize_status() {struct status_list *l; sprintf(notes,"exit status ... number of cases"); note(2); for(l=slist;l != NULL; l = l->next) {sprintf(notes,"exit status ... number of cases"); sprintf(notes,"%11d ... %5d",l->status,l->count); note(2);}} #ifndef WIN32 long monitor_pid = 0; long monitor_period = 5; long monitor_limit = 6; /* 30 second limit on a subprocess */ long monitor_count = 0; long monitor_active = 0; void monitor_fcn(sig) int sig; {long status; my_signal(SIGALRM,monitor_fcn); alarm(monitor_period); if (monitor_active) {++monitor_count; if (monitor_count >= monitor_limit) {sprintf(notes,"time limit reached on pid %d 0x%X. using kill.", monitor_pid,monitor_pid); note(3); status = kill(monitor_pid,SIGKILL); if (status < 0) {sprintf(notes,"failed to kill process"); note(3);} monitor_active = 0;}}} void vfork_main(tflag,nsubs,cmd,nb,sr,nt) long tflag,nsubs,sr; char *cmd,*nb,*nt; {long j,pid,n,seq,total_time,dys,hrs,mns,scs; int status; char arg2[20],arg4[20],arg5[20]; time_t before_time,after_time; if (tflag == 1) {seq = 1; n = 100000000;} else if (nsubs < 0) {n = -nsubs; seq = 1;} else {n = nsubs; seq = 0;} if (seq == 1) {my_signal(SIGALRM,monitor_fcn); alarm(monitor_period);} time(&before_time); sprintf(arg5,"%d",verbose_level); for(j=0;j<n;++j) {sprintf(arg2,"%d",sr+j); sprintf(arg4,"%d",j+1); #ifdef VMS status = vfork(); #else status = fork(); #endif if (status == 0) {status = execl(cmd,cmd,nb,arg2,nt,arg4,arg5,subprocess_ind,0); if (status == -1) {perror(cmd); exit(1);}} else if (status < 0) perror(cmd); else {sprintf(notes,"pid = %d 0x%X (subprocess %d)",status,status,j+1); note(3); if (seq == 1) {monitor_pid = status; monitor_count = 0; monitor_active = 1; while((pid = wait(&status)) > 0) {monitor_active = 0; sprintf(notes,"pid %d 0x%X exited with status %d",pid,pid,status); note(3); record_status(status);}} if (tflag == 1) {time(&after_time); total_time = after_time - before_time; if (total_time >= nsubs) {sprintf(notes,"Time limit reached after run %d",j+1); note(2); break;}}}} if (seq == 0) while((pid = wait(&status)) > 0) {sprintf(notes,"pid %d 0x%X exited with status %d",pid,pid,status); note(3); record_status(status);} time(&after_time); total_time = after_time - before_time; scs = total_time; mns = scs / 60; hrs = mns / 60; dys = hrs / 24; scs = scs % 60; mns = mns % 60; hrs = hrs % 24; open_record(); sprintf(notes, "Test complete, total real time: %d seconds (%d %02d:%02d:%02d)", total_time,dys,hrs,mns,scs); note(1); summarize_status(); close_record();} #else void chk_CloseHandle(HANDLE h) {DWORD err; if (CloseHandle(h) == FALSE) {err = GetLastError(); sprintf(notes,"err %d trying to close handle.",err); note(3);}} int maxticks = 100; /* tenths of a second before forced termination of the subprocess */ void vfork_main(tflag,nsubs,cmd,nb,sr,nt) long tflag,nsubs,sr; char *cmd,*nb,*nt; {long j,pid,n,seq,total_time,dys,hrs,mns,scs; char arg2[20],arg4[20],arg5[20]; time_t before_time,after_time; char cmdbuf[250]; int nticks; PROCESS_INFORMATION pinfo; STARTUPINFO sinfo; DWORD exit_code,err; if (tflag == 1) {seq = 1; n = 100000000;} else if (nsubs < 0) {n = -nsubs; seq = 1;} else {n = nsubs; seq = 0;} /* tflag says this is a timed run. So nsub is the time in seconds. seq says to run in sequence, not created nsub processes all at once. */ if (seq == 0) {printf("Not implemented. Use [-nsub] or [HH:MM:SS] instead.\\n"); return;} time(&before_time); sprintf(arg5,"%d",verbose_level); for(j=0;j<n;++j) {sprintf(arg2,"%d",sr+j); sprintf(arg4,"%d",j+1); sprintf(cmdbuf,"%s %s %s %s %s %s %s", cmd,nb,arg2,nt,arg4,arg5,subprocess_ind); /* kind of dumb that this sinfo structure is a required argument */ memset(&sinfo,0,sizeof(STARTUPINFO)); sinfo.cb = sizeof (STARTUPINFO); if (CreateProcess(NULL,cmdbuf,NULL,NULL,TRUE,0,NULL,NULL,&sinfo,&pinfo) == FALSE) {err = GetLastError(); sprintf(notes,"err %d trying to create process",err); continue;} sprintf(notes,"pid = %d 0x%X (subprocess %d)", pinfo.dwProcessId,pinfo.dwProcessId,j+1); note(3); nticks = 0; while(1) {if (GetExitCodeProcess(pinfo.hProcess,&exit_code) == TRUE) {if (exit_code == STILL_ACTIVE) {if (nticks == maxticks) {sprintf(notes,"time limit reached on pid %d 0x%X. using kill.", pinfo.dwProcessId,pinfo.dwProcessId); note(3); if (TerminateProcess(pinfo.hProcess, APPLICATION_ERROR_MASK | ERROR_SEVERITY_ERROR | 1) == FALSE) {err = GetLastError(); sprintf(notes,"err %d trying to terminate process.",err); note(3); chk_CloseHandle(pinfo.hProcess); chk_CloseHandle(pinfo.hThread); break;} ++nticks;} else {++nticks; Sleep(100);}} else {sprintf(notes,"pid %d 0x%X exited with status %d", pinfo.dwProcessId,pinfo.dwProcessId,exit_code); note(3); record_status(exit_code); chk_CloseHandle(pinfo.hProcess); chk_CloseHandle(pinfo.hThread); break;}} else {err = GetLastError(); sprintf(notes,"err %d on GetExitCodeProcess."); note(3); chk_CloseHandle(pinfo.hProcess); chk_CloseHandle(pinfo.hThread); break;}} if (tflag == 1) {time(&after_time); total_time = after_time - before_time; if (total_time >= nsubs) {sprintf(notes,"Time limit reached after run %d",j+1); note(2); break;}}} time(&after_time); total_time = after_time - before_time; scs = total_time; mns = scs / 60; hrs = mns / 60; dys = hrs / 24; scs = scs % 60; mns = mns % 60; hrs = hrs % 24; open_record(); sprintf(notes, "Test complete, total real time: %d seconds (%d %02d:%02d:%02d)", total_time,dys,hrs,mns,scs); note(1); summarize_status(); open_record();} #endif =============================================================================== ========== Всего вам наилучшего, доpогие господа! --- FleetStreet 1.17+ * Origin: Bliss (2:5030/25.70)