Module Name:    src
Committed By:   christos
Date:           Sat Oct 10 15:59:41 UTC 2020

Modified Files:
        src/sys/compat/common: tty_43.c
        src/sys/kern: tty.c

Log Message:
TIOCGSID is used by tcgetsid() so it is not really compat :-)
This should reduce loading the compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/common/tty_43.c
cvs rdiff -u -r1.291 -r1.292 src/sys/kern/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/tty_43.c
diff -u src/sys/compat/common/tty_43.c:1.38 src/sys/compat/common/tty_43.c:1.39
--- src/sys/compat/common/tty_43.c:1.38	Fri Oct  9 06:41:53 2020
+++ src/sys/compat/common/tty_43.c	Sat Oct 10 11:59:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_43.c,v 1.38 2020/10/09 10:41:53 nia Exp $	*/
+/*	$NetBSD: tty_43.c,v 1.39 2020/10/10 15:59:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.38 2020/10/09 10:41:53 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.39 2020/10/10 15:59:41 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -277,20 +277,6 @@ compat_43_ttioctl(struct tty *tp, u_long
 		mutex_spin_exit(&tty_lock);
 		break;
 
-	case TIOCGSID:
-		mutex_enter(&proc_lock);
-		if (tp->t_session == NULL) {
-			mutex_exit(&proc_lock);
-			return ENOTTY;
-		}
-		if (tp->t_session->s_leader == NULL) {
-			mutex_exit(&proc_lock);
-			return ENOTTY;
-		}
-		*(int *) data =  tp->t_session->s_leader->p_pid;
-		mutex_exit(&proc_lock);
-		break;
-
 	default:
 		return (EPASSTHROUGH);
 	}

Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.291 src/sys/kern/tty.c:1.292
--- src/sys/kern/tty.c:1.291	Sat Oct 10 10:07:18 2020
+++ src/sys/kern/tty.c	Sat Oct 10 11:59:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.291 2020/10/10 14:07:18 nia Exp $	*/
+/*	$NetBSD: tty.c,v 1.292 2020/10/10 15:59:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.291 2020/10/10 14:07:18 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.292 2020/10/10 15:59:41 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1377,6 +1377,19 @@ ttioctl(struct tty *tp, u_long cmd, void
 		    s != tp->t_qsize)
 			error = tty_set_qsize(tp, s);
 		return error;
+	case TIOCGSID:
+		mutex_enter(&proc_lock);
+		if (tp->t_session == NULL) {
+			mutex_exit(&proc_lock);
+			return ENOTTY;
+		}
+		if (tp->t_session->s_leader == NULL) {
+			mutex_exit(&proc_lock);
+			return ENOTTY;
+		}
+		*(int *) data =  tp->t_session->s_leader->p_pid;
+		mutex_exit(&proc_lock);
+		break;
 
 	case TIOCSBRK:
 	case TIOCCBRK:

Reply via email to