Date: Thu, 18 Apr 2002 14:47:44 -0400 (EDT) From: Daniel Eischen <eischen@pcnet1.pcnet.com> To: Oswald Buddenhagen <ossi@kde.org> Cc: current@FreeBSD.org Subject: Re: thread pipe in libc_r Message-ID: <Pine.GSO.4.10.10204181444230.4282-100000@pcnet1.pcnet.com> In-Reply-To: <20020418171403.GB18271@ugly.homeip.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 18 Apr 2002, Oswald Buddenhagen wrote: > hi, > > heck, was it hard for me (a person who never used freebsd) to find the > right address ... nah, whatever. :) > > src/lib/libc_r/uthread/uthread_init.c > some time ago you commited a workaround for processes with pid 1 (and no > stdio). unfortunately, this won't catch programs started directly from > init (in my case it was kdm). they have no stdio set up as well, so they > will experience major havoc, too. i'm not sure about the check, though - > just test, if ppid == 1? > in my case the problem was building kdm with -pthread in the first place, > but still this should be fixed. Anyone know what to do for this problem? Here's what libc_r does for pid == 1: /* * Check for the special case of this process running as * or in place of init as pid = 1: */ if (getpid() == 1) { /* * Setup a new session for this process which is * assumed to be running as root. */ if (setsid() == -1) PANIC("Can't set session ID"); if (revoke(_PATH_CONSOLE) != 0) PANIC("Can't revoke console"); if ((fd = _thread_sys_open(_PATH_CONSOLE, O_RDWR)) < 0) PANIC("Can't open console"); if (setlogin("root") == -1) PANIC("Can't set login to root"); if (_thread_sys_ioctl(fd,TIOCSCTTY, (char *) NULL) == -1) PANIC("Can't set controlling terminal"); if (_thread_sys_dup2(fd,0) == -1 || _thread_sys_dup2(fd,1) == -1 || _thread_sys_dup2(fd,2) == -1) PANIC("Can't dup2"); } Is it valid to check for ppid == 1 and do the same thing? -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10204181444230.4282-100000>