Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/telnet Inline the only use of NetNonblockingIO.



details:   https://anonhg.NetBSD.org/src/rev/7f9a22441f96
branches:  trunk
changeset: 446671:7f9a22441f96
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Dec 14 06:17:30 2018 +0000

description:
Inline the only use of NetNonblockingIO.
While here inline SetSockOpt. From openbsd.

diffstat:

 usr.bin/telnet/externs.h |   3 +--
 usr.bin/telnet/sys_bsd.c |  22 +++++++---------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diffs (74 lines):

diff -r 989f8d33e520 -r 7f9a22441f96 usr.bin/telnet/externs.h
--- a/usr.bin/telnet/externs.h  Fri Dec 14 06:08:18 2018 +0000
+++ b/usr.bin/telnet/externs.h  Fri Dec 14 06:17:30 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs.h,v 1.42 2018/12/14 06:08:18 maya Exp $        */
+/*     $NetBSD: externs.h,v 1.43 2018/12/14 06:17:30 maya Exp $        */
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -250,7 +250,6 @@
 void TerminalSpeeds(long *, long *);
 int TerminalWindowSize(long *, long *);
 int NetClose(int);
-void NetNonblockingIO(int, int);
 void NetSigIO(int, int);
 void NetSetPgrp(int);
 void sys_telnet_init(void);
diff -r 989f8d33e520 -r 7f9a22441f96 usr.bin/telnet/sys_bsd.c
--- a/usr.bin/telnet/sys_bsd.c  Fri Dec 14 06:08:18 2018 +0000
+++ b/usr.bin/telnet/sys_bsd.c  Fri Dec 14 06:17:30 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_bsd.c,v 1.37 2018/12/13 09:20:05 maya Exp $        */
+/*     $NetBSD: sys_bsd.c,v 1.38 2018/12/14 06:17:30 maya Exp $        */
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 from: static char sccsid[] = "@(#)sys_bsd.c    8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: sys_bsd.c,v 1.37 2018/12/13 09:20:05 maya Exp $");
+__RCSID("$NetBSD: sys_bsd.c,v 1.38 2018/12/14 06:17:30 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -481,14 +481,6 @@
     return close(fd);
 }
 
-
-void
-NetNonblockingIO(int fd, int onoff)
-{
-    ioctl(fd, FIONBIO, (char *)&onoff);
-}
-
-
 /*
  * Various signal handling routines.
  */
@@ -553,6 +545,8 @@
 void
 sys_telnet_init(void)
 {
+    int one = 1;
+
     (void) signal(SIGINT, intr);
     (void) signal(SIGQUIT, intr2);
     (void) signal(SIGPIPE, SIG_IGN);
@@ -562,11 +556,9 @@
 
     setconnmode(0);
 
-    NetNonblockingIO(net, 1);
-
-
-    if (SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1) == -1) {
-       perror("SetSockOpt");
+    ioctl(net, FIONBIO, &one);
+    if (setsockopt(net, SOL_SOCKET, SO_OOBINLINE, &one, sizeof(one)) == -1) {
+       perror("setsockopt");
     }
 }
 



Home | Main Index | Thread Index | Old Index