Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Check read and write errors to avoid warnings f...



details:   https://anonhg.NetBSD.org/src/rev/d9cb5e2f4b9f
branches:  trunk
changeset: 784349:d9cb5e2f4b9f
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 26 15:52:59 2013 +0000

description:
Check read and write errors to avoid warnings from linux.
XXX: Should we print an error and exit instead?

diffstat:

 usr.bin/make/job.c  |  28 ++++++++++++++++++----------
 usr.bin/make/main.c |   9 +++++----
 2 files changed, 23 insertions(+), 14 deletions(-)

diffs (132 lines):

diff -r ad96535e99a1 -r d9cb5e2f4b9f usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Jan 26 15:46:24 2013 +0000
+++ b/usr.bin/make/job.c        Sat Jan 26 15:52:59 2013 +0000
@@ -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 @@
 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 @@
      * 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 @@
                 */
                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 @@
     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 @@
     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 @@
        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))
diff -r ad96535e99a1 -r d9cb5e2f4b9f usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Jan 26 15:46:24 2013 +0000
+++ b/usr.bin/make/main.c       Sat Jan 26 15:52:59 2013 +0000
@@ -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 @@
 #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 @@
        IOADD(")\n");
 
 #ifdef USE_IOVEC
-       (void)writev(2, iov, 8);
+       while (writev(2, iov, 8) == -1 && errno == EAGAIN)
+           continue;
 #endif
 }
 



Home | Main Index | Thread Index | Old Index