Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common Add LINUX_TIOCGPTN for ptyfs pty emu...



details:   https://anonhg.NetBSD.org/src/rev/51de3c6ff756
branches:  trunk
changeset: 571182:51de3c6ff756
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 13 07:18:34 2004 +0000

description:
Add LINUX_TIOCGPTN for ptyfs pty emulation.

diffstat:

 sys/compat/linux/common/linux_termios.c |  34 ++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 3 deletions(-)

diffs (62 lines):

diff -r c3b8941d6da3 -r 51de3c6ff756 sys/compat/linux/common/linux_termios.c
--- a/sys/compat/linux/common/linux_termios.c   Sat Nov 13 06:09:47 2004 +0000
+++ b/sys/compat/linux/common/linux_termios.c   Sat Nov 13 07:18:34 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_termios.c,v 1.20 2003/06/29 22:29:32 fvdl Exp $  */
+/*     $NetBSD: linux_termios.c,v 1.21 2004/11/13 07:18:34 christos Exp $      */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.20 2003/06/29 22:29:32 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.21 2004/11/13 07:18:34 christos Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_ptm.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -498,7 +502,7 @@
        com = SCARG(uap, com);
        retval[0] = 0;
                 
-       switch (com) {
+       switch (com & 0xffff) {
        case LINUX_TCGETS:
                error = (*bsdioctl)(fp, TIOCGETA, (caddr_t)&tmpbts, p);
                if (error)
@@ -708,6 +712,30 @@
        case LINUX_TIOCMSET:
                SCARG(&ia, com) = TIOCMSET;
                break;
+#ifdef LINUX_TIOCGPTN
+       case LINUX_TIOCGPTN:
+#ifndef NO_DEV_PTM
+               {
+                       caddr_t sg = stackgap_init(p, 0);
+                       struct ptmget ptm, *ptmp = stackgap_alloc(p, &sg, 
+                               sizeof(*ptmp));
+
+                       SCARG(&ia, fd) = SCARG(uap, fd);
+                       SCARG(&ia, com) = TIOCPTSNAME;
+                       SCARG(&ia, data) = ptmp;
+
+                       if ((error = sys_ioctl(curlwp, &ia, retval)) != 0)
+                               goto out;
+
+                       if ((error = copyin(ptmp, &ptm, sizeof(ptm))) != 0)
+                               printf("copyin %d\n", error);
+
+                       error = copyout(&ptm.sfd, SCARG(uap, data),
+                           sizeof(ptm.sfd));
+                       goto out;
+               }
+#endif /* NO_DEV_PTM */
+#endif /* LINUX_TIOCGPTN */
        default:
                error = EINVAL;
                goto out;



Home | Main Index | Thread Index | Old Index