Skip to content

Instantly share code, notes, and snippets.

@kerneltoast
Last active December 14, 2020 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerneltoast/460801e4e497aca8759e2516f5d36863 to your computer and use it in GitHub Desktop.
Save kerneltoast/460801e4e497aca8759e2516f5d36863 to your computer and use it in GitHub Desktop.
diff --git a/staprun/relay.c b/staprun/relay.c
index 3eb8df34b..d0202e52f 100644
--- a/staprun/relay.c
+++ b/staprun/relay.c
@@ -232,10 +232,17 @@ static void *reader_thread(void *data)
wbuf += bytes;
wsize += bytes;
} else {
- rc = write(out_fd[cpu], wbuf, wbytes);
+ int fd;
+ /* Only bulkmode and fsize_max use per-cpu output files. Otherwise,
+ there's just a single output fd stored at out_fd[avail_cpus[0]]. */
+ if (bulkmode || fsize_max)
+ fd = out_fd[cpu];
+ else
+ fd = out_fd[avail_cpus[0]];
+ rc = write(fd, wbuf, wbytes);
if (rc <= 0) {
perr("Couldn't write to output %d for cpu %d, exiting.",
- out_fd[cpu], cpu);
+ fd, cpu);
goto error_out;
}
wbytes -= rc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment