Changeset 1657
- Timestamp:
- Jan 12, 2007, 4:47:48 PM (16 years ago)
- Location:
- zzuf/trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/Makefile.am
-
Property
svn:keywords
set to
Id
r1521 r1657 1 # $Id$ 1 2 2 3 SUBDIRS = src test doc -
Property
svn:keywords
set to
-
zzuf/trunk/src/Makefile.am
-
Property
svn:keywords
set to
Id
r1639 r1657 1 # $Id$ 2 1 3 COMMON = random.c random.h fd.c fd.h fuzz.c fuzz.h 2 4 3 5 bin_PROGRAMS = zzuf 4 zzuf_SOURCES = zzuf.c $(COMMON) md5.c md5.h 6 zzuf_SOURCES = zzuf.c $(COMMON) md5.c md5.h timer.c timer.h 5 7 zzuf_CFLAGS = -DLIBDIR=\"$(libdir)/zzuf\" 6 8 -
Property
svn:keywords
set to
-
zzuf/trunk/src/zzuf.c
r1655 r1657 34 34 #include <errno.h> 35 35 #include <signal.h> 36 #include <sys/time.h>37 #include <time.h>38 36 #include <sys/wait.h> 39 37 #include <sys/time.h> … … 45 43 #include "fuzz.h" 46 44 #include "md5.h" 45 #include "timer.h" 47 46 48 47 static void spawn_child(char **); … … 72 71 int fd[3]; /* 0 is debug, 1 is stderr, 2 is stdout */ 73 72 int bytes, seed; 74 time_t date;73 int64_t date; 75 74 struct md5 *ctx; 76 75 } *child_list; … … 84 83 static int checkexit = 0; 85 84 static int maxmem = -1; 86 static double maxtime = -1.0;85 static int64_t maxtime = -1; 87 86 88 87 #define ZZUF_FD_SET(fd, p_fdset, maxfd) \ … … 215 214 break; 216 215 case 'T': /* --max-time */ 217 maxtime = atof(optarg);216 maxtime = (int64_t)(atof(optarg) * 1000000.0); 218 217 break; 219 218 case 'x': /* --check-exit */ … … 469 468 470 469 /* We’re the parent, acknowledge spawn */ 471 child_list[i].date = time(NULL);470 child_list[i].date = _zz_time(); 472 471 child_list[i].pid = pid; 473 472 for(j = 0; j < 3; j++) … … 487 486 static void clean_children(void) 488 487 { 489 time_t now = time(NULL);488 int64_t now = _zz_time(); 490 489 int i, j; 491 490 … … 504 503 505 504 if(child_list[i].status == STATUS_RUNNING 506 && maxtime >= 0 .0507 && difftime(now, child_list[i].date) >maxtime)505 && maxtime >= 0 506 && now > child_list[i].date + maxtime) 508 507 { 509 508 fprintf(stdout, "zzuf[seed=%i]: time exceeded, sending SIGTERM\n", … … 515 514 } 516 515 517 /* Kill children if necessary */516 /* Kill children if necessary (still there after 2 seconds) */ 518 517 for(i = 0; i < maxforks; i++) 519 518 { 520 519 if(child_list[i].status == STATUS_SIGTERM 521 && difftime(now, child_list[i].date) > 2.0)520 && now > child_list[i].date + 2000000) 522 521 { 523 522 fprintf(stdout, "zzuf[seed=%i]: not responding, sending SIGKILL\n",
Note: See TracChangeset
for help on using the changeset viewer.