[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch to support output synchronization under -j
From: |
David Boyce |
Subject: |
Re: patch to support output synchronization under -j |
Date: |
Fri, 15 Apr 2011 13:44:53 -0400 |
On Fri, Apr 15, 2011 at 1:03 PM, Eli Zaretskii <address@hidden> wrote:
> Can Make be invoked with its stdout closed by the parent process? If
> it is, will this still work?
I've tried to code it such that if anything goes wrong setting up the
sync, of which a closed stdout would be one example, it prints a
message and continues on without the sync feature but does not fail
the build. Such corner cases have not been tested much.
>> + memset(&fl, 0, sizeof(fl));
>> + fl.l_type = F_WRLCK;
>> + fl.l_whence = SEEK_SET;
>> + fl.l_pid = getpid();
>> + fl.l_start = fl.l_len = 0;
>> + if (fcntl(syncfd, F_SETLKW, &fl) == -1)
>> + perror("fcntl");
>
> As discussed, please factor this out into a separate function.
As soon as things settle down.
>> + if (c->tempout)
>> + while ((nread = fread(buffer, 1, sizeof(buffer), c->tempout)) > 0)
>> + write(fileno(stdout), buffer, nread);
>
> Are we sure c->tempout will be zeroed out by initialization?
They're explicitly initialized:
+ child->tempout = child->temperr = NULL;
>> + if (c->tempout)
>> + fclose(c->tempout);
>> + if (c->temperr)
>> + fclose(c->temperr);
>
> Should we assign NULL to these once they are closed?
Yes. I'm working on a new version which replaces these with
descriptors anyway. Same principal applies though.
David
- patch to support output synchronization under -j, David Boyce, 2011/04/12
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/14
- Re: patch to support output synchronization under -j, Paul Smith, 2011/04/14
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/14
- Re: patch to support output synchronization under -j, Paul Smith, 2011/04/14
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/14
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/14
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/15
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/15
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/15
- Re: patch to support output synchronization under -j,
David Boyce <=
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/19
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/19
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/21
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/14
- Re: patch to support output synchronization under -j, Tim Murphy, 2011/04/14
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/14
- Re: patch to support output synchronization under -j, David Boyce, 2011/04/14
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/15
- Re: patch to support output synchronization under -j, Tim Murphy, 2011/04/15
- Re: patch to support output synchronization under -j, Eli Zaretskii, 2011/04/15