summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2013-12-16 18:46:39 +0000
committermillert <millert@openbsd.org>2013-12-16 18:46:39 +0000
commitbe90352bfe9e996417d21804b14f4967e5fd803b (patch)
tree72467b798805ec1a96c2bda443aabd7b7e3c6908 /sys
parentReplace `[RESPONSEFILE=...] install auto` voodoo with plain'ol getopts, (diff)
downloadwireguard-openbsd-be90352bfe9e996417d21804b14f4967e5fd803b.tar.xz
wireguard-openbsd-be90352bfe9e996417d21804b14f4967e5fd803b.zip
Restore TIOCGSID ioctl that was removed along with the 4.3BSD tty(4)
compat. This will be used to implement tcgetsid() in the future. OK kettenis@ guenther@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/tty.c7
-rw-r--r--sys/sys/ttycom.h3
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index d46d29a1a7b..8abd6bdb39a 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.103 2013/12/13 19:55:12 naddy Exp $ */
+/* $OpenBSD: tty.c,v 1.104 2013/12/16 18:46:39 millert Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -835,6 +835,11 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
return (ENOTTY);
*(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
break;
+ case TIOCGSID: /* get sid of tty */
+ if (!isctty(pr, tp))
+ return (ENOTTY);
+ *(int *)data = tp->t_session->s_leader->ps_pid;
+ break;
#ifdef TIOCHPCL
case TIOCHPCL: /* hang up on last close */
s = spltty();
diff --git a/sys/sys/ttycom.h b/sys/sys/ttycom.h
index 7980cf1411c..6f1b8c0fe2f 100644
--- a/sys/sys/ttycom.h
+++ b/sys/sys/ttycom.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttycom.h,v 1.12 2013/12/15 21:09:48 naddy Exp $ */
+/* $OpenBSD: ttycom.h,v 1.13 2013/12/16 18:46:39 millert Exp $ */
/* $NetBSD: ttycom.h,v 1.4 1996/05/19 17:17:53 jonathan Exp $ */
/*-
@@ -115,6 +115,7 @@ struct tstamps {
#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
#define TIOCSTAT _IOW('t', 101, int) /* generate status message */
#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
+#define TIOCGSID _IOR('t', 99, int) /* get sid of tty */
#define TIOCCONS _IOW('t', 98, int) /* become virtual console */
#define TIOCSCTTY _IO('t', 97) /* become controlling tty */
#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */