Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Apr 2016 06:49:20 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r297533 - stable/10/lib/libthr/thread
Message-ID:  <201604040649.u346nK9t051613@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Apr  4 06:49:20 2016
New Revision: 297533
URL: https://svnweb.freebsd.org/changeset/base/297533

Log:
  MFC r297139:
  From libthr, remove special and strange code to set up session and
  control terminal, activated when running with pid 1.

Modified:
  stable/10/lib/libthr/thread/thr_init.c
  stable/10/lib/libthr/thread/thr_rtld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libthr/thread/thr_init.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_init.c	Mon Apr  4 02:43:35 2016	(r297532)
+++ stable/10/lib/libthr/thread/thr_init.c	Mon Apr  4 06:49:20 2016	(r297533)
@@ -303,7 +303,7 @@ _thread_init_hack(void)
 void
 _libpthread_init(struct pthread *curthread)
 {
-	int fd, first, dlopened;
+	int first, dlopened;
 
 	/* Check if this function has already been called: */
 	if ((_thr_initial != NULL) && (curthread == NULL))
@@ -319,27 +319,6 @@ _libpthread_init(struct pthread *curthre
 	memcpy(__thr_jtable, jmp_table, sizeof(jmp_table));
 	__thr_interpose_libc();
 
-	/*
-	 * Check for the special case of this process running as
-	 * or in place of init as pid = 1:
-	 */
-	if ((_thr_pid = 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 = __sys_open(_PATH_CONSOLE, O_RDWR)) < 0)
-			PANIC("Can't open console");
-		if (setlogin("root") == -1)
-			PANIC("Can't set login to root");
-		if (_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1)
-			PANIC("Can't set controlling terminal");
-	}
-
 	/* Initialize pthread private data. */
 	init_private();
 

Modified: stable/10/lib/libthr/thread/thr_rtld.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_rtld.c	Mon Apr  4 02:43:35 2016	(r297532)
+++ stable/10/lib/libthr/thread/thr_rtld.c	Mon Apr  4 06:49:20 2016	(r297533)
@@ -227,6 +227,7 @@ _thr_rtld_init(void)
 	_rtld_atfork_post(NULL);
 	_malloc_prefork();
 	_malloc_postfork();
+	getpid();
 	syscall(SYS_getpid);
 
 	/* mask signals, also force to resolve __sys_sigprocmask PLT */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604040649.u346nK9t051613>