static int use_splice = 1;
static unsigned long packets = -1;
-static unsigned long seed = 0x9e37fffffffc0001UL;
+static unsigned long seed = 0x9e370001UL;
unsigned long mtime_since(struct timeval *s, struct timeval *e)
{
* Keep four pipes of buffers, that should be enough to ensure that
* we don't reuse
*/
-static void setup_buffers(void)
+static int setup_buffers(void)
{
int i;
buffers = malloc(sizeof(void *) * nr_bufs);
- for (i = 0; i < nr_bufs; i++)
- posix_memalign(&buffers[i], 4096, msg_size);
+ for (i = 0; i < nr_bufs; i++) {
+ if (posix_memalign(&buffers[i], 4096, msg_size)) {
+ printf("posix_memalign: %s\n", strerror(errno));
+ return -1;
+ }
+ }
+
+ return 0;
}
static void free_buffers(void)
if (pipe(pipes) < 0)
return error("pipe");
- setup_buffers();
+ if (setup_buffers())
+ return -1;
while (packets--) {
m = buffers[cur_buf];