Index: [thread] [date] [subject] [author]
  From: Marcus Sundberg <mackan@stacken.kth.se>
  To  : ggi-develop@eskimo.com
  Date: Wed, 03 Feb 1999 10:42:11 +0000

Re: Problems with Linux_kbd & 2.2.0-pre9 (fwd)

Andrew Apted wrote:
> 
> Marcus writes:
> >  But it would currently require to run XGGI
> >  as root though. IIRC XF86_Fbdev can be run without root privs,
> 
> Are you sure ?  I just tried it here, and it failed saying :
> 
>    Fatal server error:
>    xf86OpenConsole: Server must be running with root permissions
>    You should be using Xwrapper to start the server or xdm.
>    We strongly advise against making the server SUID root!

Doh. ;) And I even remember that message. Wonder where I got the idea
that it worked.

> >  we should have a look at that and see what it does to allocate a new
> >  console.
> 
> I'm 99% sure, that allocating a new console and switching to it cannot
> be done (reliably) by non-root programs _without a fork_.

*grin* It's not an interresting challenge until someone has said
it's impossible. ;-)

After a lot of testing and reading man-pages and kernel source I
produced this piece of code:

if (setsid() < 0) {
	setpgid(0, getpgid(getppid()));
	setsid();
}

If you do that instead of plain setsid() it works in all cases I tried.
(I think I tried all cases you would want to do - including starting
it from xinit.)

I did all the work with a small test program, so I haven't
incorporated any of it into linvtsw. Are you working on that, or
should I do that?

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

Index: [thread] [date] [subject] [author]