From 48dc5f853aeb553348dfbdb1479414857d9e66b9 Mon Sep 17 00:00:00 2001 From: David Roundy Date: Sat, 28 Feb 2015 13:11:58 -0800 Subject: [PATCH] only use sendfile on linux --- Makefile | 2 +- new-build.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 22d134c..5c20369 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ targets.o : lib/iterablehash.h lib/listset.h lib/sha1.h fac.h targets.c clean.o : lib/iterablehash.h lib/listset.h lib/sha1.h fac.h clean.c gcc -std=c11 -c clean.c -new-build.o : lib/hashset.h environ.h lib/listset.h lib/bigbrother.h lib/sha1.h lib/iterablehash.h fac.h new-build.c new-build.h +new-build.o : lib/hashset.h environ.h lib/iterablehash.h lib/listset.h lib/bigbrother.h lib/sha1.h fac.h new-build.c new-build.h gcc -std=c11 -c new-build.c git.o : lib/iterablehash.h lib/listset.h lib/sha1.h fac.h git.c diff --git a/new-build.c b/new-build.c index e23c1b9..92f7516 100644 --- a/new-build.c +++ b/new-build.c @@ -11,7 +11,11 @@ #include #include #include + +#ifdef __linux__ #include +#endif + #include #include #include @@ -516,7 +520,9 @@ static void build_marked(struct all_targets *all, const char *log_directory) { if (bs[i]->all_done != built || show_output) { off_t stdoutlen = lseek(bs[i]->stdouterrfd, 0, SEEK_END); off_t myoffset = 0; +#ifdef __linux__ sendfile(1, bs[i]->stdouterrfd, &myoffset, stdoutlen); +#endif } if (bs[i]->all_done != built && bs[i]->all_done != failed) { printf("INTERRUPTED! bs[i]->all_done == %s\n",