bug-make
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]