[lxc-devel] [PATCH 1/5] start child in its own process group, and put it into the foreground
Ferenc Wagner
wferi at niif.hu
Thu Jun 10 21:57:20 UTC 2010
Daniel Lezcano <daniel.lezcano at free.fr> writes:
> On 06/09/2010 07:56 PM, Ferenc Wagner wrote:
>
>> @@ -509,6 +510,22 @@ int lxc_spawn(struct lxc_handler *handler)
>> }
>> }
>>
>> + if (setpgid(handler->pid, 0)) {
>> + SYSERROR("failed to create new process group");
>> + goto out_delete_net;
>> + }
>> + DEBUG("created new process group %d", handler->pid);
>> + ctty = open("/dev/tty", O_RDONLY);
>> + if (ctty != -1) {
>> + int ret = tcsetpgrp(ctty, handler->pid);
>> + close(ctty);
>> + if (ret) {
>> + SYSERROR("failed to set terminal foreground process group");
>> + goto out_delete_net;
>> + }
>> + DEBUG("set terminal foreground process group");
>> + }
>>
>
> Is there a particular reason to do that from the parent and not from the
> child ?
I can't think of one. It shouldn't matter, as long as the child can
open /dev/tty.
--
Regards,
Feri.
More information about the lxc-devel
mailing list