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: Eli Zaretskii
Subject: Re: patch to support output synchronization under -j
Date: Fri, 15 Apr 2011 20:03:57 +0300

> Date: Fri, 15 Apr 2011 10:12:19 -0400
> From: David Boyce <address@hidden>
> Cc: Eli Zaretskii <address@hidden>, address@hidden
> 
> Attached is an updated patch with some improvements:

Thanks.

> - It uses stdout as its semaphore.

Can Make be invoked with its stdout closed by the parent process?  If
it is, will this still work?

> +  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.

> +      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?

> +  if (c->tempout)
> +      fclose(c->tempout);
> +  if (c->temperr)
> +      fclose(c->temperr);

Should we assign NULL to these once they are closed?



reply via email to

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