On Thu, Jun 10, 2010 at 11:57:20PM +0200, Ferenc Wagner wrote:
> Daniel Lezcano <daniel.lezc...@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.

I think shells implementing job control do it in the parent (shell) 
rather than the child (job) purely out of convention. It might be good
to follow a similar convention even if lxc is not, strictly speaking, a 
shell.

Cheers,
        -Matt Helsley

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to