commit 8a974ac29d6ba6771d6934a9ac9d1b7e35f38e4f
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Sun Jan 15 17:01:12 2017 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Sun Jan 15 17:01:43 2017 +0100
blind-config: fix -j
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/src/blind-concat.c b/src/blind-concat.c
index 63a9b21..bea127a 100644
--- a/src/blind-concat.c
+++ b/src/blind-concat.c
_AT_@ -2,7 +2,7 @@
#include "stream.h"
#include "util.h"
-#if defined(HAVE_SYS_EPOLL_H)
+#if defined(HAVE_EPOLL)
# include <sys/epoll.h>
#endif
#include <sys/mman.h>
_AT_@ -98,6 +98,12 @@ concat_to_file(int argc, char *argv[], char *output_file)
static void
concat_to_file_parallel(int argc, char *argv[], char *output_file, size_t jobs)
{
+#if !defined(HAVE_EPOLL)
+ int fd = eopen(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) == -1)
+ eprintf("dup2:");
+ concat_to_stdout(argc, argv, output_file);
+#else
struct epoll_event *events;
struct stream *streams;
size_t *ptrs;
_AT_@ -106,14 +112,6 @@ concat_to_file_parallel(int argc, char *argv[], char *output_file, size_t jobs)
ssize_t headlen;
int fd, i, n, pollfd;
-#if !defined(HAVE_SYS_EPOLL_H)
- fd = eopen(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) == -1)
- eprintf("dup2:");
- concat_to_stdout(argc, argv, output_file);
- return;
-#else
-
if (jobs > (size_t)argc)
jobs = (size_t)argc;
_AT_@ -153,7 +151,7 @@ concat_to_file_parallel(int argc, char *argv[], char *output_file, size_t jobs)
if (pollfd == -1)
eprintf("epoll_create1:");
- epwriteall(fd, head, (size_t)head_len, 0, output_file);
+ epwriteall(fd, head, (size_t)headlen, 0, output_file);
for (i = 0; i < argc; i++) {
epwriteall(fd, streams[i].buf, streams[i].ptr, ptrs[i], output_file);
ptrs[i] += streams[i].ptr;
_AT_@ -177,7 +175,7 @@ concat_to_file_parallel(int argc, char *argv[], char *output_file, size_t jobs)
eprintf("epoll_wait:");
for (i = 0; i < n; i++) {
j = events[i].data.u64;
- if (!eread_stream(streams + j)) {
+ if (!eread_stream(streams + j, SIZE_MAX)) {
close(streams[j].fd);
if (next < (size_t)argc) {
events->events = EPOLLIN;
_AT_@ -203,7 +201,6 @@ concat_to_file_parallel(int argc, char *argv[], char *output_file, size_t jobs)
free(events);
free(streams);
free(ptrs);
-
#endif
}
Received on Sun Jan 15 2017 - 17:03:56 CET
This archive was generated by hypermail 2.3.0
: Sun Jan 15 2017 - 17:12:22 CET