Re: [PATCH v2 2/2] gc: config option for running --auto in background

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

 



Duy Nguyen <pclouds@xxxxxxxxx> writes:

> On Tue, Feb 11, 2014 at 2:11 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> On Mon, Feb 10, 2014 at 10:43 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>>> If --quiet is set, we should not be printing anyway. If not, I thinkg
>>>> we could only print "auto packing in background.." when we actually
>>>> can do that, else just print the old message. It means an #ifdef
>>>> NO_POSIX_GOODIES here again though..
>>>
>>> Didn't you change it not to die but return nosys or something?
>>
>> Ah, the problem is that it is too late to take back "... will do so in
>> the background" when you noticed that daemonize() did not succeed, so
>> you would need a way to see if we can daemonize() before actually
>> doing so if you want to give different messages.
>>
>> "int can_daemonize(void)" could be an answer that is nicer than
>> NO_POSIX_GOODIES, but I am not sure if it is worth it.
>
> Or we could pass the "quiet" flag to daemonize() and let it print
> something in the #ifdef NO_POSIX_GOODIES part.

Hmph...  What would that something say?  "I was asked to gc in the
background but I can't here" is not suitable for daemonize() that is
not specific to "gc".

The flow I had in mind was something along the lines of this

	if (!quiet) {
        	if (detach_auto && can_daemonize())
                	say "auto packing in the background";
		else
                       	say "auto packing"
	}
        if (detach_auto && can_daemonize())
        	daemonize();

If we had daemonize(noisy=1) and coded it this way:

	if (!quiet)
        	say "auto packing";
	if (detach_auto)
        	daemonize(!quiet);

we could do something like:

	daemonize(int noisy) {
        	if (noisy && !defined(NO_POSIX_GOODIES))
                	say ", and doing so in the background";
		... do the actual daemonizing ...
	}

but that feels ugly.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]