Re: Remove 4.3BSD tty compatibility, take 2

2013-12-12 Thread Christian Weisgerber
Christian Weisgerber na...@mips.inka.de wrote:

 New attempt, now that the userland has been cleaned up.  This diff
 kills the remaining parts of the COMPAT_43 tty handling in the
 kernel.  (There are some further network-related COMPAT_43 fragments
 that are not touched by this.)
 
 Comments?  ok?

make build, release, and xenocara are fine.
Full ports build done and remaining fallout fixed.

Any okays?

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-12 Thread Todd C. Miller
On Tue, 10 Dec 2013 14:49:26 -0700, Theo de Raadt wrote:

   Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
   ioctl.  Rather a System V compat ioctl.
  
  Well, it's implemented in compat/common/tty_43.c.  If we want to save
  it, we need to move it to kern/tty.c:ttioctl().  Do we?
 
 that's a seperate issue.  It can be recovered later ;)

I have diffs to put it back properly and add tcgetsid(3) that can
ride the next libc bump.

 - todd



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-12 Thread Todd C. Miller
On Thu, 12 Dec 2013 22:03:53 +, Christian Weisgerber wrote:

 make build, release, and xenocara are fine.
 Full ports build done and remaining fallout fixed.
 
 Any okays?

OK millert@

 - todd



Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Christian Weisgerber
New attempt, now that the userland has been cleaned up.  This diff
kills the remaining parts of the COMPAT_43 tty handling in the
kernel.  (There are some further network-related COMPAT_43 fragments
that are not touched by this.)

Comments?  ok?

R compat/common/tty_43.c
M conf/files
M ddb/db_structinfo.c
M kern/tty.c
M kern/tty_conf.c
M kern/tty_pty.c
M sys/ioctl.h
M sys/ioctl_compat.h
M sys/tty.h
R sys/ttychars.h
R sys/ttydev.h

Index: compat/common/tty_43.c
===
RCS file: compat/common/tty_43.c
diff -N compat/common/tty_43.c
--- compat/common/tty_43.c  9 Apr 2013 02:56:50 -   1.11
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,485 +0,0 @@
-/* $OpenBSD: tty_43.c,v 1.11 2013/04/09 02:56:50 tedu Exp $*/
-/* $NetBSD: tty_43.c,v 1.5 1996/05/20 14:29:17 mark Exp $  */
-
-/*-
- * Copyright (c) 1982, 1986, 1991, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tty_compat.c8.1 (Berkeley) 6/10/93
- */
-
-/*
- * mapping routines for old line discipline (yuck)
- */
-#include sys/param.h
-#include sys/systm.h
-#include sys/ioctl.h
-#include sys/proc.h
-#include sys/tty.h
-#include sys/termios.h
-#include sys/file.h
-#include sys/conf.h
-#include sys/kernel.h
-#include sys/syslog.h
-#include sys/ioctl_compat.h
-
-/*
- * XXX libcompat files should be included with config attributes
- */
-#ifdef COMPAT_OLDTTY
-
-int ttydebug = 0;
-
-static const struct speedtab compatspeeds[] = {
-#define MAX_SPEED  17
-   { 115200, 17 },
-   { 57600, 16 },
-   { 38400, 15 },
-   { 19200, 14 },
-   { 9600, 13 },
-   { 4800, 12 },
-   { 2400, 11 },
-   { 1800, 10 },
-   { 1200, 9 },
-   { 600,  8 },
-   { 300,  7 },
-   { 200,  6 },
-   { 150,  5 },
-   { 134,  4 },
-   { 110,  3 },
-   { 75,   2 },
-   { 50,   1 },
-   { 0,0 },
-   { -1,   -1 },
-};
-static const int compatspcodes[] = {
-   0, 50, 75, 110, 134, 150, 200, 300, 600, 1200,
-   1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200
-};
-
-int ttcompatgetflags(struct tty *);
-void ttcompatsetflags(struct tty *, struct termios *);
-void ttcompatsetlflags(struct tty *, struct termios *);
-
-/*ARGSUSED*/
-int
-ttcompat(struct tty *tp, u_long com, caddr_t data, int flag, struct proc *p)
-{
-
-   switch (com) {
-   case TIOCGETP: {
-   struct sgttyb *sg = (struct sgttyb *)data;
-   u_char *cc = tp-t_cc;
-   int speed;
-
-   speed = ttspeedtab(tp-t_ospeed, compatspeeds);
-   sg-sg_ospeed = (speed == -1) ? MAX_SPEED : speed;
-   if (tp-t_ispeed == 0)
-   sg-sg_ispeed = sg-sg_ospeed;
-   else {
-   speed = ttspeedtab(tp-t_ispeed, compatspeeds);
-   sg-sg_ispeed = (speed == -1) ? MAX_SPEED : speed;
-   }
-   sg-sg_erase = cc[VERASE];
-   sg-sg_kill = cc[VKILL];
-   sg-sg_flags = ttcompatgetflags(tp);
-   break;
-   }
-
-   case TIOCSETP:
-   case TIOCSETN: {
-   struct sgttyb *sg = (struct sgttyb *)data;
-   struct termios term;
-   int speed;
-
-   term = tp-t_termios;
-   if ((speed = sg-sg_ispeed)  MAX_SPEED || speed  0)
-   term.c_ispeed = speed;
-   

Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Mark Kettenis
 Date: Tue, 10 Dec 2013 21:48:41 +0100
 From: Christian Weisgerber na...@mips.inka.de
 
 New attempt, now that the userland has been cleaned up.  This diff
 kills the remaining parts of the COMPAT_43 tty handling in the
 kernel.  (There are some further network-related COMPAT_43 fragments
 that are not touched by this.)
 
 Comments?  ok?

Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
ioctl.  Rather a System V compat ioctl.  Might be useful if we ever
find the need to implement tcgetsid(3).  There is code in gnulib (the
GNU portability library) that uses this ioctl to implement
tcgetsid(3):

https://github.com/gagern/gnulib/blob/master/lib/tcgetsid.c

Not sure if there actually is anything out there that uses it.



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Christian Weisgerber
Mark Kettenis:

 Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
 ioctl.  Rather a System V compat ioctl.

Well, it's implemented in compat/common/tty_43.c.  If we want to save
it, we need to move it to kern/tty.c:ttioctl().  Do we?

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Theo de Raadt
  Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
  ioctl.  Rather a System V compat ioctl.
 
 Well, it's implemented in compat/common/tty_43.c.  If we want to save
 it, we need to move it to kern/tty.c:ttioctl().  Do we?

that's a seperate issue.  It can be recovered later ;)



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Mark Kettenis
 From: Theo de Raadt dera...@cvs.openbsd.org
 Date: Tue, 10 Dec 2013 14:49:26 -0700
 
   Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
   ioctl.  Rather a System V compat ioctl.
  
  Well, it's implemented in compat/common/tty_43.c.  If we want to save
  it, we need to move it to kern/tty.c:ttioctl().  Do we?
 
 that's a seperate issue.  It can be recovered later ;)

If no important ports depend on it, yes ;)



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Marc Espie
On Tue, Dec 10, 2013 at 10:31:31PM +0100, Mark Kettenis wrote:
  Date: Tue, 10 Dec 2013 21:48:41 +0100
  From: Christian Weisgerber na...@mips.inka.de
  
  New attempt, now that the userland has been cleaned up.  This diff
  kills the remaining parts of the COMPAT_43 tty handling in the
  kernel.  (There are some further network-related COMPAT_43 fragments
  that are not touched by this.)
  
  Comments?  ok?
 
 Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
 ioctl.  Rather a System V compat ioctl.  Might be useful if we ever
 find the need to implement tcgetsid(3).  There is code in gnulib (the
 GNU portability library) that uses this ioctl to implement
 tcgetsid(3):
 
 https://github.com/gagern/gnulib/blob/master/lib/tcgetsid.c
 
 Not sure if there actually is anything out there that uses it.

Note that tcgetsid(3) is part of posix 2008... I don't see this as
a noxious interface, so I don't see any reason not to keep it...

In ports, devel/ddd uses it as a fallback on systems without setsid.

lang/sbcl checks for it, but it definitely is just wanting to create
a wrapper for it.

(apparently, vala has similar code, just looking thru google).

Oh, hey, and it's in Stevens... so we MUST have it :)



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Mark Kettenis
 Date: Tue, 10 Dec 2013 23:05:01 +0100
 From: Marc Espie es...@nerim.net
 
 On Tue, Dec 10, 2013 at 10:31:31PM +0100, Mark Kettenis wrote:
   Date: Tue, 10 Dec 2013 21:48:41 +0100
   From: Christian Weisgerber na...@mips.inka.de
   
   New attempt, now that the userland has been cleaned up.  This diff
   kills the remaining parts of the COMPAT_43 tty handling in the
   kernel.  (There are some further network-related COMPAT_43 fragments
   that are not touched by this.)
   
   Comments?  ok?
  
  Noticed TIOCGSID in that list.  Don't think that is a 4.3 compat
  ioctl.  Rather a System V compat ioctl.  Might be useful if we ever
  find the need to implement tcgetsid(3).  There is code in gnulib (the
  GNU portability library) that uses this ioctl to implement
  tcgetsid(3):
  
  https://github.com/gagern/gnulib/blob/master/lib/tcgetsid.c
  
  Not sure if there actually is anything out there that uses it.
 
 Note that tcgetsid(3) is part of posix 2008... I don't see this as
 a noxious interface, so I don't see any reason not to keep it...

Well, we don't actually have tcgetsid(3); only the ioctl that can be
used to implement it.  And tcgetsid(3) is an XSI extension, so not a
required POSIX interface.



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Marc Espie
On Tue, Dec 10, 2013 at 11:05:01PM +0100, Marc Espie wrote:
 
 Note that tcgetsid(3) is part of posix 2008... I don't see this as
 a noxious interface, so I don't see any reason not to keep it...

My bad, it's XSI in posix 2008, but I was reading posix 2013, which has:

Issue 7

The tcgetsid() function is moved from the XSI option to the Base.



Re: Remove 4.3BSD tty compatibility, take 2

2013-12-10 Thread Philip Guenther
On Tue, Dec 10, 2013 at 2:14 PM, Mark Kettenis mark.kette...@xs4all.nl wrote:
 Well, we don't actually have tcgetsid(3); only the ioctl that can be
 used to implement it.  And tcgetsid(3) is an XSI extension, so not a
 required POSIX interface.

Issue 7
...
The tcgetsid() function is moved from the XSI option to the Base.


:-/