]> Zhao Yanbai Git Server - minix.git/commitdiff
usr.bin/make: -j fix
authorLionel Sambuc <lionel@minix3.org>
Fri, 25 Apr 2014 14:06:33 +0000 (16:06 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:15 +0000 (17:05 +0200)
The job option enable the usage of pipes to communicate with sub-makes.

On MINIX, it seems that there is possibility of receiving an EAGAIN on
such reads, even when it had previously been tested for POLLIN using
poll().

This patch is a workaround, by wrapping the read operation within a
do {} while(errno == EAGAIN && ...) loop.

Change-Id: Ia184c4d600efe7218d197820df87761604120862

servers/vfs/pipe.c
usr.bin/make/job.c

index eb61e3b6fa9aa0027680224c4370fa0d14c1a674..ea75afb070c49a3917ac0e700726ee31dd50363f 100644 (file)
@@ -394,13 +394,6 @@ int count;                 /* max number of processes to release */
                    f->filp_vno != vp)
                        continue;
 
-               /* Do a pipe_check to see if we really want to callback this
-                * select; a close() doesn't always warrant it.
-                */
-               if(pipe_check(f, op == VFS_READ ? READING : WRITING,
-                       f->filp_flags, 1, 1) != EAGAIN) {
-                       continue;
-               }
                select_callback(f, selop);
 
                f->filp_pipe_select_ops &= ~selop;
index 43df92375f50e561568fdc1a41de43ea52ac7ac4..c37ec6f207032129605d9d56c56c2b8b3623b0e2 100644 (file)
@@ -1380,7 +1380,7 @@ JobExec(Job *job, char **argv)
         * by killing its process family, but not commit suicide.
         */
 #if defined(MAKE_NATIVE) || defined(HAVE_SETPGID)
-#if defined(SYSV) || defined(__minix)
+#if defined(SYSV)
        /* XXX: dsl - I'm sure this should be setpgrp()... */
        (void)setsid();
 #else
@@ -2061,7 +2061,15 @@ Job_CatchOutput(void)
     if (nready > 0 && readyfd(&childExitJob)) {
        char token = 0;
        ssize_t count;
+#if defined(__minix)
+       /* Workaround: While the pipe is deemed ready to be read, it can still
+        * return EAGAIN in the read below. */
+       do {
+#endif /* defined(__minix) */
        count = read(childExitJob.inPipe, &token, 1);
+#if defined(__minix)
+       } while(-1 == count && EAGAIN == errno);
+#endif /* defined(__minix) */
        switch (count) {
        case 0:
            Punt("unexpected eof on token pipe");