Hi,
On 01/21/2014 06:11 AM, Peter Hutterer wrote:
On Thu, Jan 16, 2014 at 11:24:50AM +0100, Hans de Goede wrote:
This is a preparation patch for automatically doing keeptty when the server
gets passed the current vt as vt to use on the cmdline.
I found the commit message a bit confusing. The bit you moved merely moves
the process group handling code, so it'd be great if you could amend the
message for that.
The setsid call at the end is what is doing the detach from tty, the process
group "mangling" is merely there because it is required for setsid to work.
Regards,
Hans
Reviewed-by: Peter Hutterer <[email protected]> for the series
though.
Cheers,
Peter
---
hw/xfree86/os-support/linux/lnx_init.c | 43 ++++++++++++++++------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/hw/xfree86/os-support/linux/lnx_init.c
b/hw/xfree86/os-support/linux/lnx_init.c
index bead72e..5f7d39b 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -126,27 +126,6 @@ xf86OpenConsole(void)
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
- if (!KeepTty) {
- pid_t ppid = getppid();
- pid_t ppgid;
-
- ppgid = getpgid(ppid);
-
- /*
- * change to parent process group that pgid != pid so
- * that setsid() doesn't fail and we become process
- * group leader
- */
- if (setpgid(0, ppgid) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
- strerror(errno));
-
- /* become process group leader */
- if ((setsid() < 0))
- xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
- strerror(errno));
- }
-
i = 0;
while (vcs[i] != NULL) {
snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /*
/dev/tty1-64 */
@@ -170,8 +149,26 @@ xf86OpenConsole(void)
else
activeVT = vts.v_active;
-#if 0
if (!KeepTty) {
+ pid_t ppid = getppid();
+ pid_t ppgid;
+
+ ppgid = getpgid(ppid);
+
+ /*
+ * change to parent process group that pgid != pid so
+ * that setsid() doesn't fail and we become process
+ * group leader
+ */
+ if (setpgid(0, ppgid) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
+ strerror(errno));
+
+ /* become process group leader */
+ if ((setsid() < 0))
+ xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
+ strerror(errno));
+#if 0
/*
* Detach from the controlling tty to avoid char loss
*/
@@ -179,8 +176,8 @@ xf86OpenConsole(void)
SYSCALL(ioctl(i, TIOCNOTTY, 0));
close(i);
}
- }
#endif
+ }
if (!xf86Info.ShareVTs) {
struct termios nTty;
--
1.8.4.2
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel