diff -u old/ new/ --- old/Makefile.in 2008-09-18 14:43:55.000000000 -0700 +++ new/Makefile.in 2008-09-18 14:42:53.000000000 -0700 @@ -22,10 +22,10 @@ all: dbench tbench tbench_srv dbench: $(DB_OBJS) - $(CC) -o $@ $(DB_OBJS) $(LIBS) + $(CC) -lpthread -o $@ $(DB_OBJS) $(LIBS) tbench: $(TB_OBJS) - $(CC) -o $@ $(TB_OBJS) $(LIBS) + $(CC) -lpthread -o $@ $(TB_OBJS) $(LIBS) tbench_srv: $(SRV_OBJS) $(CC) -o $@ $(SRV_OBJS) $(LIBS) diff -u old/ new/ --- old/dbench.c 2008-09-18 14:43:49.000000000 -0700 +++ new/dbench.c 2008-09-18 14:42:46.000000000 -0700 @@ -130,6 +130,8 @@ int synccount; struct timeval tv; FILE *load; + int shmid; + sem_t *sema; load = open_loadfile(); if (load == NULL) { @@ -162,12 +164,24 @@ children[i].directory = directory; } + shmid = shmget(IPC_PRIVATE, sizeof(*sema), IPC_CREAT | 0666); + if (shmid < 0) { + perror("could not create shared memory segment"); + exit(1); + } + sema = shmat(shmid, NULL, 0); + + if (sem_init(sema, 1, 0) < 0) { + perror("semaphore initilization failed"); + exit(1); + } + for (i=0;i #include #include +#include #ifdef HAVE_SYS_VFS_H #include