From 0a6d6ce0fd8c130b0199577954f0fda08c7ceaee Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 10 Oct 2020 15:59:41 +0000 Subject: [PATCH] TIOCGSID is used by tcgetsid() so it is not really compat :-) This should reduce loading the compat module. --- sys/compat/common/tty_43.c | 18 ++---------------- sys/kern/tty.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/sys/compat/common/tty_43.c b/sys/compat/common/tty_43.c index 5f7ad40b1a4b..992053059e19 100644 --- a/sys/compat/common/tty_43.c +++ b/sys/compat/common/tty_43.c @@ -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 -__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 com, void *data, int flag, 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); } diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b54f9532ef38..298dd45163e3 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -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 -__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 *data, int flag, struct lwp *l) 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: