TIOCGSID is used by tcgetsid() so it is not really compat :-)

This should reduce loading the compat module.
This commit is contained in:
christos 2020-10-10 15:59:41 +00:00
parent 212af7edad
commit 0a6d6ce0fd
2 changed files with 17 additions and 18 deletions

View File

@ -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 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);
}

View File

@ -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 *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: