]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ipcmk: allow high speed ipc creation
authorSami Kerola <kerolasa@iki.fi>
Mon, 12 Sep 2011 20:01:03 +0000 (22:01 +0200)
committerSami Kerola <kerolasa@iki.fi>
Sat, 17 Sep 2011 13:07:52 +0000 (15:07 +0200)
This commit will allow user to create quickly plenty of ipc
resources. Earlier the line bellow gave no satisfaction.

for i in $(seq 0 42); do ipcmk -Q; done

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/ipcmk.c

index b4bc5be197551ce0ee509e0321a033b3a0566db5..c91908bde895e59670018cb2e06b137860a29529 100644 (file)
@@ -28,7 +28,7 @@
 #include <sys/msg.h>
 #include <sys/sem.h>
 #include <sys/shm.h>
-#include <time.h>
+#include <sys/time.h>
 
 #include "c.h"
 #include "nls.h"
@@ -36,7 +36,9 @@
 
 key_t create_key(void)
 {
-       srandom(time(NULL));
+       struct timeval now;
+       gettimeofday(&now, NULL);
+       srandom(now.tv_usec);
        return random();
 }