Re: improving OpenBSD's gmac.c...

2014-10-13 Thread Christian Weisgerber
David Gwynne:

 dont you need endian.h to get bemtoh64 and htobem64?

I went by the man page, which says sys/types.h.


PS: I accidentally omitted a chunk:

Index: sys/conf/files
===
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.581
diff -u -p -r1.581 files
--- sys/conf/files  9 Oct 2014 08:21:48 -   1.581
+++ sys/conf/files  12 Oct 2014 17:29:33 -
@@ -870,6 +870,7 @@ file crypto/arc4.c  
 file crypto/michael.c  wlan
 file crypto/cmac.c wlan
 file crypto/hmac.c wlan | (softraid  crypto)
+file crypto/gfmult.c   (inet  ipsec) | crypto
 file crypto/gmac.c (inet  ipsec) | crypto
 file crypto/key_wrap.c wlan
 file crypto/idgen.cinet6 | nfsclient | nfsserver
-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: ps: remove redundant prototype

2014-10-13 Thread Ingo Schwarze
Hi,

Martin Natano wrote on Sun, Oct 12, 2014 at 07:52:47PM +0200:

 The findvar() function in keyword.c contains a prototype of the vcmp()
 function, which is already declared further up in the same file. I'm not
 even sure that prototype is correct, as it fails to include the 'static'
 classifier (vcmp() is a static function).

This seems correct to me and compiles and works on i386.

OK to commit?
  Ingo


 Index: keyword.c
 ===
 RCS file: /cvs/src/bin/ps/keyword.c,v
 retrieving revision 1.40
 diff -u -r1.40 keyword.c
 --- keyword.c 20 Mar 2014 03:38:33 -  1.40
 +++ keyword.c 12 Oct 2014 17:27:55 -
 @@ -250,7 +250,6 @@
  {
   VAR *v, key;
   char *hp;
 - int vcmp(const void *, const void *);
  
   key.name = p;
  



Re: improving OpenBSD's gmac.c...

2014-10-13 Thread David Gwynne

On 13 Oct 2014, at 9:00 pm, Christian Weisgerber na...@mips.inka.de wrote:

 David Gwynne:
 
 dont you need endian.h to get bemtoh64 and htobem64?
 
 I went by the man page, which says sys/types.h.

and cvs blame says that's my fault... fair enough.

ill talk to philip about whether that should change, but dont let that hold the 
process up on this code.

dlg




share/mk/bsd.README: bsd.prog.mk only has seven targets

2014-10-13 Thread Theo Buehler
This confused me quite a bit when I first read it.  After lint was
unhooked from the tree, there remain only seven targets in
bsd.prog.mk:
all, clean, cleandir, depend, includes, install, and tags.

Same goes for bsd.subdir.mk and bsd.lib.mk.

Index: bsd.README
===
RCS file: /cvs/src/share/mk/bsd.README,v
retrieving revision 1.57
diff -u -p -r1.57 bsd.README
--- bsd.README  9 Oct 2014 04:44:09 -   1.57
+++ bsd.README  13 Oct 2014 12:41:24 -
@@ -266,7 +266,7 @@ The include file bsd.prog.mk handles b
 more source files, along with their manual pages.  It has a limited number
 of suffixes, consistent with the current needs of the BSD tree.
 
-It has eight targets:
+It has seven targets:
 
all:
build the program and its manual page
@@ -401,7 +401,7 @@ If foo has multiple source files, add th
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 The include file bsd.subdir.mk contains the default targets for building
-subdirectories.  It has the same eight targets as bsd.prog.mk: all, 
+subdirectories.  It has the same seven targets as bsd.prog.mk: all, 
 clean, cleandir, depend, includes, install, and tags.  For all of
 the directories listed in the variable SUBDIR, the specified directory 
 will be visited and the target made.  There is also a default target which
@@ -419,7 +419,7 @@ yacc that allow multiple lex and yacc ta
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 The include file bsd.lib.mk has support for building libraries.  It has
-the same eight targets as bsd.prog.mk: all, clean, cleandir, depend,
+the same seven targets as bsd.prog.mk: all, clean, cleandir, depend,
 includes, install, and tags.  It has a limited number of suffixes,
 consistent with the current needs of the BSD tree.
 



Re: increase netcat's buffer...

2014-10-13 Thread Arne Becker
Hi again.

 +/* make all fds non-blocking */
 +for (n = 0; n  4; n++) {
 +if (pfd[n].fd == -1)
 +continue;
 +flags = fcntl(pfd[n].fd, F_GETFL, 0);
 +/*
 + * For sockets and pipes, we want non-block, but setting it
 + * might fail for files or devices, so we ignore the return
 + * code.
 + */
 +fcntl(pfd[n].fd, F_SETFL, flags | O_NONBLOCK);
 +}
 
 Thanks. I think this is the trouble spot. Without this, we don't need
 to fool around in atelnet either. And we probably don't really need
 this. The point isn't really to create an nc that never blocks. In
 particular, turning stdin and stdout non-blocking has weird effects
 that has broken sh pipelines in the past.
 
 Drop the above, the relevant chunk in atelnet, and I think it looks good.

OK, no more fiddling with O_NONBLOCK.
New diff below, tested with tcpbench and file transfers.

An interesting aside:
I have a test case like this:
host1$ ./nc -N host2 portX  infile  outfile
host2$ ./echoserver portX

With the 16k Buffer you get less syscalls obviously. Still this version
with the 16k buffer is slower for this test than the original nc with
the 2k buffer. Using the same 2k buffer makes them equal again. So far,
I'm not sure why.
For other tests, speed and CPU usage seem to be about equal.

Index: netcat.c
===
RCS file: /mount/cvsdev/cvs/openbsd/src/usr.bin/nc/netcat.c,v
retrieving revision 1.122
diff -u -p -r1.122 netcat.c
--- netcat.c20 Jul 2014 01:38:40 -  1.122
+++ netcat.c13 Oct 2014 12:48:09 -
@@ -65,6 +65,12 @@
 #define PORT_MAX_LEN   6
 #define UNIX_DG_TMP_SOCKET_SIZE19

+#define POLL_STDIN 0
+#define POLL_NETOUT 1
+#define POLL_NETIN 2
+#define POLL_STDOUT 3
+#define BUFSIZE 16384
+
 /* Command Line Options */
 intdflag;  /* detached, no stdin */
 intFflag;  /* fdpass sock to stdout */
@@ -112,6 +118,8 @@ voidset_common_sockopts(int);
 intmap_tos(char *, int *);
 void   report_connect(const struct sockaddr *, socklen_t);
 void   usage(int);
+ssize_t drainbuf(int, unsigned char *, size_t *);
+ssize_t fillbuf(int, unsigned char *, size_t *);

 int
 main(int argc, char *argv[])
@@ -391,7 +399,7 @@ main(int argc, char *argv[])
len);
if (connfd == -1) {
/* For now, all errnos are fatal */
-   err(1, accept);
+   err(1, accept);
}
if (vflag)
report_connect((struct sockaddr 
*)cliaddr, len);
@@ -730,66 +738,224 @@ local_listen(char *host, char *port, str
  * Loop that polls on the network file descriptor and stdin.
  */
 void
-readwrite(int nfd)
+readwrite(int net_fd)
 {
-   struct pollfd pfd[2];
-   unsigned char buf[16 * 1024];
-   int n, wfd = fileno(stdin);
-   int lfd = fileno(stdout);
-   int plen;
-
-   plen = sizeof(buf);
-
-   /* Setup Network FD */
-   pfd[0].fd = nfd;
-   pfd[0].events = POLLIN;
-
-   /* Set up STDIN FD. */
-   pfd[1].fd = wfd;
-   pfd[1].events = POLLIN;
+   struct pollfd pfd[4];
+   int stdin_fd = STDIN_FILENO;
+   int stdout_fd = STDOUT_FILENO;
+   unsigned char netinbuf[BUFSIZE];
+   size_t netinbufpos = 0;
+   unsigned char stdinbuf[BUFSIZE];
+   size_t stdinbufpos = 0;
+   int n, num_fds, flags;
+   ssize_t ret;
+
+   /* don't read from stdin if requested */
+   if (dflag)
+   stdin_fd = -1;
+
+   /* stdin */
+   pfd[POLL_STDIN].fd = stdin_fd;
+   pfd[POLL_STDIN].events = POLLIN;
+
+   /* network out */
+   pfd[POLL_NETOUT].fd = net_fd;
+   pfd[POLL_NETOUT].events = 0;
+
+   /* network in */
+   pfd[POLL_NETIN].fd = net_fd;
+   pfd[POLL_NETIN].events = POLLIN;
+
+   /* stdout */
+   pfd[POLL_STDOUT].fd = stdout_fd;
+   pfd[POLL_STDOUT].events = 0;
+
+   while (1) {
+   /* both inputs are gone, buffers are empty, we are done */
+   if (pfd[POLL_STDIN].fd == -1  pfd[POLL_NETIN].fd == -1
+stdinbufpos == 0  netinbufpos == 0) {
+   close(net_fd);
+   return;
+   }
+   /* both outputs are gone, we can't continue */
+   if (pfd[POLL_NETOUT].fd == -1  pfd[POLL_STDOUT].fd == -1) {
+   close(net_fd);
+   return;
+   }
+   /* listen and net in gone, queues empty, done */
+   if (lflag  pfd[POLL_NETIN].fd == -1
+stdinbufpos == 0  netinbufpos == 0) {
+   close(net_fd);
+

mention lkm removal on current.html

2014-10-13 Thread Theo Buehler
Here's a shot at removing the binaries and manuals that are obsolete
after the lkm removal.  I hope I caught them all.

There remains the user _lkm in /etc/groups.  I am unsure how to remove that
one properly.

Index: faq/current.html
===
RCS file: /cvs/www/faq/current.html,v
retrieving revision 1.557
diff -u -p -r1.557 current.html
--- faq/current.html6 Oct 2014 15:43:04 -   1.557
+++ faq/current.html13 Oct 2014 12:26:31 -
@@ -76,6 +76,7 @@
 lia href=#201409152014/09/15 - sendmail removed/a
 lia href=#201409192014/09/19 - rc.conf(8) moved to the base set/a
 lia href=#201409252014/09/25 - [ports] collectd updated to 5.4.1/a
+lia href=#201410132014/10/13 - lkm removed/a
 /ul
 
 hr
@@ -893,6 +894,17 @@ Note that a backup version of rc.conf(8)
 a href=https://collectd.org/wiki/index.php/V4_to_v5_migration_guide;upgrade 
guide/a
 to migrate their existing setups.
 
+a name=20141013/a
+h32014/10/13 - lkm removed/h3
+The lkm interface has been removed, thus several binaries and manual pages
+and the lkm directory should be deleted:
+pre
+   rm -rf /usr/lkm
+
+   rm -f /usr/bin/modstat
+   rm -f /sbin/mod{,un}load
+   rm -f /usr/share/man/man8/mod{stat,load,unload}.8
+/pre
 
 br
 hr



Remove lkm tendrils from bsd.own.mk

2014-10-13 Thread Theo Buehler
After lkm is gone, these should probably also be removed.

Index: bsd.own.mk
===
RCS file: /cvs/src/share/mk/bsd.own.mk,v
retrieving revision 1.150
diff -u -p -r1.150 bsd.own.mk
--- bsd.own.mk  22 Apr 2014 14:42:53 -  1.150
+++ bsd.own.mk  13 Oct 2014 12:47:48 -
@@ -84,11 +84,6 @@ DOCGRP?= bin
 DOCOWN?=   root
 DOCMODE?=  ${NONBINMODE}
 
-LKMDIR?=   /usr/lkm
-LKMGRP?=   ${BINGRP}
-LKMOWN?=   ${BINOWN}
-LKMMODE?=  ${NONBINMODE}
-
 NLSDIR?=   /usr/share/nls
 NLSGRP?=   bin
 NLSOWN?=   root



Re: mention lkm removal on current.html

2014-10-13 Thread Stuart Henderson
On 2014/10/13 14:56, Theo Buehler wrote:
 Here's a shot at removing the binaries and manuals that are obsolete
 after the lkm removal.  I hope I caught them all.

Thanks, committed.

 There remains the user _lkm in /etc/groups.  I am unsure how to remove that
 one properly.

It should just be like this, I think:

Index: group
===
RCS file: /cvs/src/etc/group,v
retrieving revision 1.69
diff -u -p -r1.69 group
--- group   20 Sep 2014 09:59:52 -  1.69
+++ group   13 Oct 2014 13:21:12 -
@@ -22,7 +22,6 @@ _sshagnt:*:34:
 _x11:*:35:
 utmp:*:45:
 _unbound:*:53:
-_lkm:*:61:
 _spamd:*:62:
 _radius:*:63:
 _token:*:64:



Re: mention lkm removal on current.html

2014-10-13 Thread David Coppa
On Mon, Oct 13, 2014 at 3:22 PM, Stuart Henderson st...@openbsd.org wrote:
 On 2014/10/13 14:56, Theo Buehler wrote:
 Here's a shot at removing the binaries and manuals that are obsolete
 after the lkm removal.  I hope I caught them all.

 Thanks, committed.

 There remains the user _lkm in /etc/groups.  I am unsure how to remove that
 one properly.

groupdel _lkm ?

Ciao,
David
-- 
If you try a few times and give up, you'll never get there. But if
you keep at it... There's a lot of problems in the world which can
really be solved by applying two or three times the persistence that
other people will.
-- Stewart Nelson



Re: share/mk/bsd.README: bsd.prog.mk only has seven targets

2014-10-13 Thread Ingo Schwarze
Hi Theo,

Theo Buehler wrote on Mon, Oct 13, 2014 at 02:45:53PM +0200:

 This confused me quite a bit when I first read it.  After lint was
 unhooked from the tree, there remain only seven targets in
 bsd.prog.mk:
 all, clean, cleandir, depend, includes, install, and tags.
 
 Same goes for bsd.subdir.mk and bsd.lib.mk.

Committed, thanks.
  Ingo


 Index: bsd.README
 ===
 RCS file: /cvs/src/share/mk/bsd.README,v
 retrieving revision 1.57
 diff -u -p -r1.57 bsd.README
 --- bsd.README9 Oct 2014 04:44:09 -   1.57
 +++ bsd.README13 Oct 2014 12:41:24 -
 @@ -266,7 +266,7 @@ The include file bsd.prog.mk handles b
  more source files, along with their manual pages.  It has a limited number
  of suffixes, consistent with the current needs of the BSD tree.
  
 -It has eight targets:
 +It has seven targets:
  
   all:
   build the program and its manual page
 @@ -401,7 +401,7 @@ If foo has multiple source files, add th
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  
  The include file bsd.subdir.mk contains the default targets for building
 -subdirectories.  It has the same eight targets as bsd.prog.mk: all, 
 +subdirectories.  It has the same seven targets as bsd.prog.mk: all, 
  clean, cleandir, depend, includes, install, and tags.  For all of
  the directories listed in the variable SUBDIR, the specified directory 
  will be visited and the target made.  There is also a default target which
 @@ -419,7 +419,7 @@ yacc that allow multiple lex and yacc ta
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  
  The include file bsd.lib.mk has support for building libraries.  It has
 -the same eight targets as bsd.prog.mk: all, clean, cleandir, depend,
 +the same seven targets as bsd.prog.mk: all, clean, cleandir, depend,
  includes, install, and tags.  It has a limited number of suffixes,
  consistent with the current needs of the BSD tree.
  



Re: ps: remove redundant prototype

2014-10-13 Thread Ingo Schwarze
Hi Martin,

Martin Natano wrote on Sun, Oct 12, 2014 at 07:52:47PM +0200:

 The findvar() function in keyword.c contains a prototype of the vcmp()
 function, which is already declared further up in the same file. I'm not
 even sure that prototype is correct, as it fails to include the 'static'
 classifier (vcmp() is a static function).

Committed, thanks.
  Ingo


 Index: keyword.c
 ===
 RCS file: /cvs/src/bin/ps/keyword.c,v
 retrieving revision 1.40
 diff -u -r1.40 keyword.c
 --- keyword.c 20 Mar 2014 03:38:33 -  1.40
 +++ keyword.c 12 Oct 2014 17:27:55 -
 @@ -250,7 +250,6 @@
  {
   VAR *v, key;
   char *hp;
 - int vcmp(const void *, const void *);
  
   key.name = p;
  



Re: em(4) fix for Intel I218 chip

2014-10-13 Thread Brad Smith

On 12/10/14 3:53 PM, Claudio Jeker wrote:

This seems to be enough to help em(4) in modern laptops like the X240 to
no longer generate watchdog timeouts on high throughput.
This should only affect I218 but tests on different em(4) devices would
not hurt.


Chunk #3 is within the ICH8/IGP3 workaround, that shouldn't be changed
like that. But the rest works for the i218. I can now actually use the
Ethernet interface on my T440s. It was too unreliable under more or
less any load.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



vi: remove bitstring.h copy

2014-10-13 Thread Martin Natano
The vi editor includes its own (outdated) copy of bitstring.h. It can
safely be removed; the binary doesn't change.

cheers,
natano

--- usr.bin/vi/LAYOUT   29 Jan 2001 01:58:24 -  1.4
+++ usr.bin/vi/LAYOUT   13 Oct 2014 19:12:53 -
@@ -103,7 +103,6 @@
 include/
Replacement include files:
 
-   bitstring.h -- The 4.4BSD bitstring operations.
sys/queue.h -- The 4.4BSD queue operations.
 
 perl_api/
--- usr.bin/vi/include/bitstring.h  Sun Jan  8 22:05:40 2006
+++ /dev/null   Mon Oct 13 21:12:04 2014
@@ -1,141 +0,0 @@
-/* $OpenBSD: bitstring.h,v 1.4 2006/01/08 21:05:40 miod Exp $  */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Vixie.
- *
- * 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.
- *
- * @(#)bitstring.h 8.1 (Berkeley) 7/19/93
- */
-
-#ifndef _BITSTRING_H_
-#define_BITSTRING_H_
-
-typedefunsigned char bitstr_t;
-
-/* internal macros */
-   /* byte of the bitstring bit is in */
-#define_bit_byte(bit) \
-   ((bit)  3)
-
-   /* mask for the bit within its byte */
-#define_bit_mask(bit) \
-   (1  ((bit)0x7))
-
-/* external macros */
-   /* bytes in a bitstring of nbits bits */
-#definebitstr_size(nbits) \
-   nbits) - 1)  3) + 1)
-
-   /* allocate a bitstring */
-#definebit_alloc(nbits) \
-   (bitstr_t *)calloc(1, \
-   (unsigned int)bitstr_size(nbits) * sizeof(bitstr_t))
-
-   /* allocate a bitstring on the stack */
-#definebit_decl(name, nbits) \
-   (name)[bitstr_size(nbits)]
-
-   /* is bit N of bitstring name set? */
-#definebit_test(name, bit) \
-   ((name)[_bit_byte(bit)]  _bit_mask(bit))
-
-   /* set bit N of bitstring name */
-#definebit_set(name, bit) \
-   (name)[_bit_byte(bit)] |= _bit_mask(bit)
-
-   /* clear bit N of bitstring name */
-#definebit_clear(name, bit) \
-   (name)[_bit_byte(bit)] = ~_bit_mask(bit)
-
-   /* clear bits start ... stop in bitstring */
-#definebit_nclear(name, start, stop) { \
-   register bitstr_t *_name = (name); \
-   register int _start = (start), _stop = (stop); \
-   register int _startbyte = _bit_byte(_start); \
-   register int _stopbyte = _bit_byte(_stop); \
-   if (_startbyte == _stopbyte) { \
-   _name[_startbyte] = ((0xff  (8 - (_start0x7))) | \
- (0xff  ((_stop0x7) + 1))); \
-   } else { \
-   _name[_startbyte] = 0xff  (8 - (_start0x7)); \
-   while (++_startbyte  _stopbyte) \
-   _name[_startbyte] = 0; \
-   _name[_stopbyte] = 0xff  ((_stop0x7) + 1); \
-   } \
-}
-
-   /* set bits start ... stop in bitstring */
-#definebit_nset(name, start, stop) { \
-   register bitstr_t *_name = (name); \
-   register int _start = (start), _stop = (stop); \
-   register int _startbyte = _bit_byte(_start); \
-   register int _stopbyte = _bit_byte(_stop); \
-   if (_startbyte == _stopbyte) { \
-   _name[_startbyte] |= ((0xff  (_start0x7))  \
-   

vi: remove obsolete headers, documentation cleanup

2014-10-13 Thread Martin Natano
There are some left-over (unused) header files from removed components
in vi. The following patch deletes them and cleans up the documentation
to remove references to these components. No binary change.

cheers,
natano

---
Index: LAYOUT
===
RCS file: /cvs/src/usr.bin/vi/LAYOUT,v
retrieving revision 1.4
diff -u -u -r1.4 LAYOUT
--- LAYOUT  29 Jan 2001 01:58:24 -  1.4
+++ LAYOUT  13 Oct 2014 19:54:29 -
@@ -2,6 +2,9 @@
 
 #  @(#)LAYOUT  8.12 (Berkeley) 10/10/96
 
+FAQ
+   Frequently asked questions.
+
 LAYOUT
This file: the layout of the nvi sources.
 
@@ -22,27 +25,12 @@
 cl/
Source files for nvi's curses screen support.
 
-clib/
-   Replacement source files for C library functions.
-
 common/
Source files for pieces of code that are shared by ex and vi,
e.g., searching and logging code or code translating line numbers
into requests to the dbopen(3) database code.  It also has the
interface code for modifying records in the underlying database.
 
-curses/
-   A stripped-down replacement curses library.  Do not try and use
-   this library outside of nvi, many standard curses functions have
-   been removed because nvi doesn't use them.  See build/README for
-   more information.
-
-db/
-   A stripped-down replacement DB library.  Do not try and use this
-   library outside of nvi, many standard DB functions have been
-   removed because nvi doesn't use them.  See db/README for more
-   information.
-
 docs/
Ex/vi documentation, both current and historic.
 
@@ -104,27 +92,12 @@
Replacement include files:
 
bitstring.h -- The 4.4BSD bitstring operations.
-   sys/queue.h -- The 4.4BSD queue operations.
 
 perl_api/
Source code supporting the Perl scripting language for nvi.
 
 perl_scripts/
Scripts for Perl included with nvi.
-
-regex/
-   Henry Spencer's POSIX 1003.2 regular expression (RE) library.
-
-tcl_api/
-   Source code supporting the Tcl scripting language for nvi.
-
-tcl_scripts/
-   Scripts for Tcl included with nvi.
-
-tk/
-   Source files for nvi's Tk screen support.
-
-   init.tcl-- Vi startup tcl script.
 
 vi/
The vi source code.
Index: README
===
RCS file: /cvs/src/usr.bin/vi/README,v
retrieving revision 1.10
diff -u -u -r1.10 README
--- README  29 Jan 2001 01:58:25 -  1.10
+++ README  13 Oct 2014 20:01:01 -
@@ -8,36 +8,24 @@
 
 The directory layout is as follows:
 
-FAQ ... Frequently asked questions.
-LICENSE ... Copyright, use and redistribution information.
-README  This file.
-catalog ... Message catalogs; see catalog/README.
-changelog . Log of changes from version to version.
-cl  Vi interface to the curses(3) library.
-clib .. C library replacement source code.
-common  Code shared by ex and vi.
-curses  A stripped-down, replacement curses(3) library.
-db  A stripped-down, replacement db(3) library.
-dist .. Various files used to build the vi distribution.
-docs .. Ex/vi documentation, both current and historic.
-docs/README ... Documentation overview.
-docs/edit . Edit: A tutorial.
-docs/exref  Ex Reference Manual -- Version 3.7.
-docs/vi.man ... UNIX manual page for nex/nvi.
-docs/vi.ref ... Nex/nvi reference manual.
-docs/vitut  An Introduction to Display Editing with Vi.
-ex  Ex source code.
-include ... Replacement include files.
-ip  Library interface to vi: vi side.
-ipc ... Library interface to vi: application side.
-motif . Vi motif application.
-motif_l ... Motif library interface to vi.
-perl_api .. Perl scripting language support.
-perl_scripts .. Perl scripts.
-regex . POSIX 1003.2 regular expression library.
-tcl_api ... Tcl scripting language support.
-tcl_scripts ... Tcl scripts.
-vi  Vi source code.
+FAQ ... Frequently asked questions.
+LAYOUT  The layout of the nvi sources.
+LICENSE ... Copyright, use and redistribution information.
+README  This file.
+catalog ... Message catalogs; see catalog/README.
+cl  Vi interface to the curses(3) library.
+common  Code shared by ex and vi.
+docs .. Ex/vi documentation, both current and historic.
+docs/USD.doc/edit . Edit: A tutorial.
+docs/USD.doc/exref  Ex Reference Manual -- Version 3.7.
+docs/USD.doc/vi.man ... UNIX manual page for nex/nvi.
+docs/USD.doc/vi.ref ... Nex/nvi reference manual.
+

rcctl: find(1) service files in /etc/rc.d

2014-10-13 Thread Craig R. Skinner
Move 2 duplicate searches into a function.

The diff also ignores (RCS) subdirectories.

$ find /etc/rc.d ! -type f
/etc/rc.d
/etc/rc.d/RCS


Index: rcctl.sh
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
retrieving revision 1.43
diff -u -p -r1.43 rcctl.sh
--- rcctl.sh11 Oct 2014 19:12:19 -  1.43
+++ rcctl.sh13 Oct 2014 20:10:34 -
@@ -93,7 +93,7 @@ svc_get_defaults()
print -r -- $(svc_default_enabled_flags ${_svc})
svc_default_enabled ${_svc}
else
-   for _i in $(ls -A /etc/rc.d | grep -v rc.subr); do
+   get_svc_list | while read _i; do
echo ${_i}_flags=$(svc_default_enabled_flags ${_i})
done
for _i in ${_special_services}; do
@@ -134,7 +134,7 @@ svc_get_status()
svc_get_flags ${_svc}
svc_is_enabled ${_svc}
else
-   for _i in $(ls -A /etc/rc.d | grep -v rc.subr); do
+   get_svc_list | while read _i; do
echo ${_i}_flags=$(svc_get_flags ${_i})
done
for _i in ${_special_services}; do
@@ -175,6 +175,12 @@ svc_is_special()
[ -n ${_svc} ] || return
 
echo ${_special_services} | grep -qw ${_svc}
+}
+
+get_svc_list()
+{
+   # Ignore rc.subr  (RCS) subdirectories:
+   find /etc/rc.d -type f -maxdepth 1 ! -name rc.subr
 }
 
 append_to_pkg_scripts()



Re: improving OpenBSD's gmac.c...

2014-10-13 Thread Philip Guenther
On Mon, Oct 13, 2014 at 5:26 AM, David Gwynne da...@gwynne.id.au wrote:
 On 13 Oct 2014, at 9:00 pm, Christian Weisgerber na...@mips.inka.de wrote:

 David Gwynne:

 dont you need endian.h to get bemtoh64 and htobem64?

(This is kernel code, so that would be sys/endian.h)


 I went by the man page, which says sys/types.h.

 and cvs blame says that's my fault... fair enough.

 ill talk to philip about whether that should change, but dont let that hold 
 the process up on this code.

Well.  Right now sys/types.h pulls in sys/endian.h (or at least
sys/_endian.h); someone with lots of patience and many archs to test
on could try removing that (and making sys/types.h pull in
sys/_types.h directly!) and see how many .c files would need to
change and, more importantly, how badly ports break.

Until then, I see little benefit for kernel code to pull in
sys/endian.h; you'll get it indirectly after pulling in
sys/types.h or sys/param.h, so it's just noise and wasted compiler
cycles.  The manpages for the kernel-only interfaces (bemtoh*, etc)
should presumably follow that: recommending sys/types.h until someone
removes the indirect #include.


Philip Guenther



[patch]rcs: memcmp against 0

2014-10-13 Thread Fritjof Bornebusch
Hi,

it's better to compare memcmp against 0, for clarity.

fritjof


Index: diff3.c
===
RCS file: /cvs/src/usr.bin/rcs/diff3.c,v
retrieving revision 1.33
diff -u -p -r1.33 diff3.c
--- diff3.c 4 Mar 2012 04:05:15 -   1.33
+++ diff3.c 21 Jun 2014 21:03:30 -
@@ -517,7 +517,7 @@ ed_patch_lines(struct rcs_lines *dlines,
if (lp == NULL)
errx(1, ed_patch_lines);
 
-   if (!memcmp(lp-l_line, ., 1))
+   if (memcmp(lp-l_line, ., 1) == 0)
break;
 
TAILQ_REMOVE((plines-l_lines), lp, l_list);



Re: em(4) fix for Intel I218 chip

2014-10-13 Thread Claudio Jeker
On Mon, Oct 13, 2014 at 01:50:45PM -0400, Brad wrote:
 On 12/10/14 3:53 PM, Claudio Jeker wrote:
 This seems to be enough to help em(4) in modern laptops like the X240 to
 no longer generate watchdog timeouts on high throughput.
 This should only affect I218 but tests on different em(4) devices would
 not hurt.
 
 Chunk #3 is within the ICH8/IGP3 workaround, that shouldn't be changed
 like that. But the rest works for the i218. I can now actually use the
 Ethernet interface on my T440s. It was too unreliable under more or
 less any load.

Yeah, but that chunk should be commited no the less. The FreeBSD version
does not have the duplicated line and it seems like a bad merge to me.

-- 
:wq Claudio



Re: rcctl: find(1) service files in /etc/rc.d

2014-10-13 Thread Antoine Jacoutot
On Mon, Oct 13, 2014 at 09:31:05PM +0100, Craig R. Skinner wrote:
 Move 2 duplicate searches into a function.
 
 The diff also ignores (RCS) subdirectories.
 
 $ find /etc/rc.d ! -type f
 /etc/rc.d
 /etc/rc.d/RCS

Makes sense yes. Not sure I'd want a function just for that one liner though.
I'll commit something tomorrow.

 Index: rcctl.sh
 ===
 RCS file: /cvs/src/usr.sbin/rcctl/rcctl.sh,v
 retrieving revision 1.43
 diff -u -p -r1.43 rcctl.sh
 --- rcctl.sh  11 Oct 2014 19:12:19 -  1.43
 +++ rcctl.sh  13 Oct 2014 20:10:34 -
 @@ -93,7 +93,7 @@ svc_get_defaults()
   print -r -- $(svc_default_enabled_flags ${_svc})
   svc_default_enabled ${_svc}
   else
 - for _i in $(ls -A /etc/rc.d | grep -v rc.subr); do
 + get_svc_list | while read _i; do
   echo ${_i}_flags=$(svc_default_enabled_flags ${_i})
   done
   for _i in ${_special_services}; do
 @@ -134,7 +134,7 @@ svc_get_status()
   svc_get_flags ${_svc}
   svc_is_enabled ${_svc}
   else
 - for _i in $(ls -A /etc/rc.d | grep -v rc.subr); do
 + get_svc_list | while read _i; do
   echo ${_i}_flags=$(svc_get_flags ${_i})
   done
   for _i in ${_special_services}; do
 @@ -175,6 +175,12 @@ svc_is_special()
   [ -n ${_svc} ] || return
  
   echo ${_special_services} | grep -qw ${_svc}
 +}
 +
 +get_svc_list()
 +{
 + # Ignore rc.subr  (RCS) subdirectories:
 + find /etc/rc.d -type f -maxdepth 1 ! -name rc.subr
  }
  
  append_to_pkg_scripts()
 

-- 
Antoine



Re: em(4) fix for Intel I218 chip

2014-10-13 Thread Brad Smith

On 13/10/14 5:09 PM, Claudio Jeker wrote:

On Mon, Oct 13, 2014 at 01:50:45PM -0400, Brad wrote:

On 12/10/14 3:53 PM, Claudio Jeker wrote:

This seems to be enough to help em(4) in modern laptops like the X240 to
no longer generate watchdog timeouts on high throughput.
This should only affect I218 but tests on different em(4) devices would
not hurt.


Chunk #3 is within the ICH8/IGP3 workaround, that shouldn't be changed
like that. But the rest works for the i218. I can now actually use the
Ethernet interface on my T440s. It was too unreliable under more or
less any load.


Yeah, but that chunk should be commited no the less. The FreeBSD version
does not have the duplicated line and it seems like a bad merge to me.


But that is not how the code is in the FreeBSD driver and does not match
the behavior used everywhere else in the driver as is.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: Brainy: OpenSSH Memory Leak

2014-10-13 Thread Daniel Dickman
On Sat, Sep 20, 2014 at 3:07 PM, Maxime Villard m...@m00nbsd.net wrote:
 Hi,
 I put here a bug among others:

 Index: ssh-ed25519.c
 ===
 RCS file: /cvs/src/usr.bin/ssh/ssh-ed25519.c,v
 retrieving revision 1.4
 diff -u -r1.4 ssh-ed25519.c
 --- ssh-ed25519.c   24 Jun 2014 01:13:21 -  1.4
 +++ ssh-ed25519.c   29 Aug 2014 10:28:35 -
 @@ -125,8 +125,10 @@
 r = SSH_ERR_INVALID_FORMAT;
 goto out;
 }
 -   if (datalen = SIZE_MAX - len)
 -   return SSH_ERR_INVALID_ARGUMENT;
 +   if (datalen = SIZE_MAX - len) {
 +   r = SSH_ERR_INVALID_ARGUMENT;
 +   goto out;
 +   }
 smlen = len + datalen;
 mlen = smlen;
 if ((sm = malloc(smlen)) == NULL || (m = xmalloc(mlen)) == NULL) {

 Found by my code scanner.

 Maxime


applied. thanks.



Re: LibreSSL 2.1.0 released.

2014-10-13 Thread Bob Beck
normally tech@openbsd.org would be the place to start contributing. If
you have fixes, post diffs there.

On Sun, Oct 12, 2014 at 9:26 PM, Jiri Navratil j...@navratil.cz wrote:
 Sun, Oct 12, 2014 at 07:36:02PM CEST, b...@openbsd.org napsal(a):
 We have released LibreSSL 2.1.0 - which should be arriving in the
 LIbreSSL directory of an OpenBSD mirror near you very soon.

 This release continues on with further work from after OpenBSD 5.6
 code freeze. Our intention is to finalize LibreSSL 2.1 with OpenBSD
 5.7

 As noted before, we welcome feedback from the broader community.

 Enjoy,

 -Bob

 I'm willing to help with LibreSSL testing and also with fixes.

 Where / how I shall start?

 Thank you,
 Jiri Navratil