Module Name: src Committed By: christos Date: Sat Jan 26 15:53:00 UTC 2013
Modified Files: src/usr.bin/make: job.c main.c Log Message: Check read and write errors to avoid warnings from linux. XXX: Should we print an error and exit instead? To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/job.c cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.164 src/usr.bin/make/job.c:1.165 --- src/usr.bin/make/job.c:1.164 Thu Jan 24 21:01:10 2013 +++ src/usr.bin/make/job.c Sat Jan 26 10:52:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $ */ +/* $NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $"); #endif #endif /* not lint */ #endif @@ -477,7 +477,8 @@ JobCondPassSig(int signo) static void JobChildSig(int signo MAKE_ATTR_UNUSED) { - write(childExitJob.outPipe, CHILD_EXIT, 1); + while (write(childExitJob.outPipe, CHILD_EXIT, 1) == -1 && errno == EAGAIN) + continue; } @@ -504,7 +505,9 @@ JobContinueSig(int signo MAKE_ATTR_UNUSE * Defer sending to SIGCONT to our stopped children until we return * from the signal handler. */ - write(childExitJob.outPipe, DO_JOB_RESUME, 1); + while (write(childExitJob.outPipe, DO_JOB_RESUME, 1) == -1 && + errno == EAGAIN) + continue; } /*- @@ -1161,7 +1164,8 @@ Job_Touch(GNode *gn, Boolean silent) */ if (read(streamID, &c, 1) == 1) { (void)lseek(streamID, (off_t)0, SEEK_SET); - (void)write(streamID, &c, 1); + while (write(streamID, &c, 1) == -1 && errno == EAGAIN) + continue; } (void)close(streamID); @@ -2046,7 +2050,8 @@ Job_CatchOutput(void) if (nready < 0 || readyfd(&childExitJob)) { char token = 0; nready -= 1; - (void)read(childExitJob.inPipe, &token, 1); + while (read(childExitJob.inPipe, &token, 1) == -1 && errno == EAGAIN) + continue; if (token == DO_JOB_RESUME[0]) /* Complete relay requested from our SIGCONT handler */ JobRestartJobs(); @@ -2777,7 +2782,8 @@ JobTokenAdd(void) if (DEBUG(JOB)) fprintf(debug_file, "(%d) aborting %d, deposit token %c\n", getpid(), aborting, JOB_TOKENS[aborting]); - write(tokenWaitJob.outPipe, &tok, 1); + while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN) + continue; } /*- @@ -2890,13 +2896,15 @@ Job_TokenWithdraw(void) while (read(tokenWaitJob.inPipe, &tok1, 1) == 1) continue; /* And put the stopper back */ - write(tokenWaitJob.outPipe, &tok, 1); + while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN) + continue; Fatal("A failure has been detected in another branch of the parallel make"); } if (count == 1 && jobTokensRunning == 0) /* We didn't want the token really */ - write(tokenWaitJob.outPipe, &tok, 1); + while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN) + continue; jobTokensRunning++; if (DEBUG(JOB)) Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.204 src/usr.bin/make/main.c:1.205 --- src/usr.bin/make/main.c:1.204 Thu Jan 24 21:01:10 2013 +++ src/usr.bin/make/main.c Sat Jan 26 10:53:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $ */ +/* $NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $"; #else #include <sys/cdefs.h> #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $"); #endif #endif /* not lint */ #endif @@ -1708,7 +1708,8 @@ execError(const char *af, const char *av IOADD(")\n"); #ifdef USE_IOVEC - (void)writev(2, iov, 8); + while (writev(2, iov, 8) == -1 && errno == EAGAIN) + continue; #endif }