#include cleanup for ping6

2015-11-04 Thread Florian Obser
I think this is correct...
OK?

diff --git ping6.c ping6.c
index 2c786f9..8e42ade 100644
--- ping6.c
+++ ping6.c
@@ -81,35 +81,29 @@
  */
 
 #include 
-#include 
 #include 
-
-#include 
-#include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
-
-#include 
-#include 
 
 struct tv64 {
u_int64_t tv64_sec;

-- 
I'm not entirely sure you are real.



Re: em(4) watchdog timeouts

2015-11-04 Thread Sonic
On Wed, Nov 4, 2015 at 2:51 PM, Sonic  wrote:
> Is there anything else I can provide to assist in finding a cure for this 
> issue?

Not sure this helps at all but the specific error I get is "em0:
watchdog timeout -- resetting". In this case em0 is the nic on the
internal network. I do not see the errors on the external network nic
(em1) which connects to the cable modem. The internal network nic
(em0) connects directly to an HP 2520 switch.

# dmesg |grep em1
em1 at pci3 dev 0 function 0 "Intel 82574L" rev 0x00: msi, address
00:25:90:92:d4:f9
spdmem1 at iic0 addr 0x51: 2GB DDR3 SDRAM PC3-10600 SO-DIMM
# dmesg |grep em0
em0 at pci2 dev 0 function 0 "Intel 82574L" rev 0x00: msi, address
00:25:90:92:d4:f8
spdmem0 at iic0 addr 0x50: 2GB DDR3 SDRAM PC3-10600 SO-DIMM
em0: watchdog timeout -- resetting
em0: watchdog timeout -- resetting
em0: watchdog timeout -- resetting
em0: watchdog timeout -- resetting
em0: watchdog timeout -- resetting
em0: watchdog timeout -- resetting

Chris



[patch] tail(1) follow multiple files

2015-11-04 Thread Martijn van Duren

Hello tech@,

I got somewhat annoyed by the fact that OpenBSD's tail can't follow 
multiple files and since the last attempt at it was from 2008 I thought 
I'd give it a shot. I already sent an earlier version of this diff to 
Landry who called it "a welcomed addition", but doesn't have time to 
review my patch.


I've field tested this patch for a couple of days now and I didn't 
experienced any problems. I also run it through 
/usr/src/regress/usr.bin/tail/ both on UFS and NFS (v3), so it should 
not suffer from the same issues as before.


The patch isn't based on any other follow implementation (at least not 
by intent) and leans fully on kqueue for reading, deletion/renaming, and 
truncation. When a file gets deleted I set a timeout to kevent(2) of 1 
second and poll for the files individually, since the parent directory 
might not always be available for kqueue monitoring.


Sincerely,

Martijn van Duren
Index: extern.h
===
--- extern.h	(revision 1)
+++ extern.h	(revision 34)
@@ -36,17 +36,23 @@
 	if (write(STDOUT_FILENO, p, size) != size) \
 		oerr();
 
+struct tailfile {
+	char		*fname;
+	FILE		*fp;
+	struct stat	 sb;
+};
+
 enum STYLE { NOTSET = 0, FBYTES, FLINES, RBYTES, RLINES, REVERSE };
 
-void forward(FILE *, enum STYLE, off_t, struct stat *);
-void reverse(FILE *, enum STYLE, off_t, struct stat *);
+void forward(struct tailfile *, int, enum STYLE, off_t);
+void reverse(struct tailfile *, int, enum STYLE, off_t);
 
-int bytes(FILE *, off_t);
-int lines(FILE *, off_t);
+int bytes(struct tailfile *, off_t);
+int lines(struct tailfile *, off_t);
 
-void ierr(void);
+void ierr(const char *);
 void oerr(void);
+void printfname(const char *);
 
 extern int fflag, rflag, rval;
-extern char *fname;
 extern int is_stdin;
Index: misc.c
===
--- misc.c	(revision 1)
+++ misc.c	(revision 34)
@@ -41,7 +41,7 @@
 #include "extern.h"
 
 void
-ierr(void)
+ierr(const char *fname)
 {
 	warn("%s", fname);
 	rval = 1;
@@ -52,3 +52,11 @@
 {
 	err(1, "stdout");
 }
+
+void printfname(const char *fname)
+{
+	static int first = 1;
+	(void)printf("%s==> %s <==\n", first ? "" : "\n", fname);
+	first = 0;
+	(void)fflush(stdout);
+}
Index: read.c
===
--- read.c	(revision 1)
+++ read.c	(revision 34)
@@ -59,7 +59,7 @@
  *
  */
 int
-bytes(FILE *fp, off_t off)
+bytes(struct tailfile *tf, off_t off)
 {
 	int ch;
 	size_t len, tlen;
@@ -73,7 +73,7 @@
 	if ((sp = p = malloc(off)) == NULL)
 		err(1, NULL);
 
-	for (wrap = 0, ep = p + off; (ch = getc(fp)) != EOF;) {
+	for (wrap = 0, ep = p + off; (ch = getc(tf->fp)) != EOF;) {
 		*p = ch;
 		if (++p == ep) {
 			wrap = 1;
@@ -80,8 +80,8 @@
 			p = sp;
 		}
 	}
-	if (ferror(fp)) {
-		ierr();
+	if (ferror(tf->fp)) {
+		ierr(tf->fname);
 		free(sp);
 		return(1);
 	}
@@ -135,7 +135,7 @@
  *
  */
 int
-lines(FILE *fp, off_t off)
+lines(struct tailfile *tf, off_t off)
 {
 	struct {
 		size_t blen;
@@ -156,7 +156,7 @@
 
 	blen = cnt = recno = wrap = 0;
 
-	while ((ch = getc(fp)) != EOF) {
+	while ((ch = getc(tf->fp)) != EOF) {
 		if (++cnt > blen) {
 			newsize = blen + 1024;
 			if ((newp = realloc(sp, newsize)) == NULL)
@@ -184,8 +184,8 @@
 			}
 		}
 	}
-	if (ferror(fp)) {
-		ierr();
+	if (ferror(tf->fp)) {
+		ierr(tf->fname);
 		rc = 1;
 		goto done;
 	}
Index: reverse.c
===
--- reverse.c	(revision 1)
+++ reverse.c	(revision 34)
@@ -43,12 +43,12 @@
 #include "extern.h"
 
 static void r_buf(FILE *);
-static int r_reg(FILE *, enum STYLE, off_t, struct stat *);
+static int r_reg(struct tailfile *, enum STYLE, off_t);
 
-#define COPYCHAR(fp, ch)\
+#define COPYCHAR(tf, ch)\
 	do {		\
-		if ((ch = getc(fp)) == EOF) {		\
-			ierr();\
+		if ((ch = getc(tf->fp)) == EOF) {	\
+			ierr(tf->fname);		\
 			return (0);			\
 		}	\
 		if (putchar(ch) == EOF) {		\
@@ -76,25 +76,35 @@
  *	NOREG	cyclically read input into a linked list of buffers
  */
 void
-reverse(FILE *fp, enum STYLE style, off_t off, struct stat *sbp)
+reverse(struct tailfile *tf, int nfiles, enum STYLE style, off_t off)
 {
+	int i;
+
 	if (style != REVERSE && off == 0)
 		return;
 
-	if (!S_ISREG(sbp->st_mode) || r_reg(fp, style, off, sbp) != 0)
-		switch(style) {
-		case FBYTES:
-		case RBYTES:
-			(void)bytes(fp, off);
-			break;
-		case FLINES:
-		case RLINES:
-			(void)lines(fp, off);
-			break;
-		case REVERSE:
-			r_buf(fp);
-			break;
+	for (i = 0; i < nfiles; i++) {
+		if (nfiles > 1)
+			printfname(tf[i].fname);
+		if (!S_ISREG(tf[i].sb.st_mode) ||
+		r_reg(&(tf[i]), style, off) != 0) {
+			switch(style) {
+			case FBYTES:
+			case RBYTES:
+(void)bytes(&(tf[i]), off);
+break;
+			case FLINES:
+			case RLINES:
+(void)lines(&(tf[i]), off);
+break;
+			case REVERSE:
+r_buf(tf[i].fp);
+break;
+			default:
+err(1, 

Re: UPDATE: xkeyboard-config 2.16

2015-11-04 Thread Matthieu Herrb
On Wed, Nov 04, 2015 at 01:50:28PM +0500, Alexandr Shadchin wrote:
> Hi,
> 
> This diff updates xkeyboard-config to the latest release.
> 
> Changes:
> 2.16  10 bugs fixed
>   Translations updated
> 2.15  7 bugs fixed
>   Translations updated
> 
> Test:
> * ftp http://devio.us/~koba/distfiles/xkeyboard-config-2.16.diff (or attach)
> * cd /path/to/xenocara
> * patch < /path/to/xkeyboard-config-2.16.diff
> * cd data/xkeyboard-config
> * make clean
> * make obj
> * make build
> * restart X
> 
> Comments ? OK ?
> 

I'm running it on my amd64 laptop, with a sadly simple standard US
layout. No regression.

I also looked at the diff and didn't see anything problematic.

so ok matthieu@
-- 
Matthieu Herrb


signature.asc
Description: PGP signature


[3/3] replace setbuf(3) etc by setvbuf(3) - libc man pages & regress

2015-11-04 Thread Frederic Nowak
Hi there,

setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".
The patch below replaces all occurrences in libc man pages and
src/regress.

Cheers,
Frederic

Index: libc/stdio/fclose.3
===
RCS file: /cvs/src/lib/libc/stdio/fclose.3,v
retrieving revision 1.8
diff -u -p -r1.8 fclose.3
--- libc/stdio/fclose.3 17 Jul 2013 05:42:11 -  1.8
+++ libc/stdio/fclose.3 4 Nov 2015 20:28:56 -
@@ -78,7 +78,7 @@ or
 .Xr close 2 ,
 .Xr fflush 3 ,
 .Xr fopen 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh STANDARDS
 The
 .Fn fclose
Index: libc/stdio/fflush.3
===
RCS file: /cvs/src/lib/libc/stdio/fflush.3,v
retrieving revision 1.11
diff -u -p -r1.11 fflush.3
--- libc/stdio/fflush.3 13 Mar 2015 19:58:40 -  1.11
+++ libc/stdio/fflush.3 4 Nov 2015 20:28:56 -
@@ -97,7 +97,7 @@ for any of the errors specified for the 
 .Xr write 2 ,
 .Xr fclose 3 ,
 .Xr fopen 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh STANDARDS
 The
 .Fn fflush
Index: libc/stdio/funopen.3
===
RCS file: /cvs/src/lib/libc/stdio/funopen.3,v
retrieving revision 1.17
diff -u -p -r1.17 funopen.3
--- libc/stdio/funopen.313 Jan 2015 14:02:30 -  1.17
+++ libc/stdio/funopen.34 Nov 2015 20:28:56 -
@@ -148,7 +148,7 @@ for any of the errors specified for the 
 .Xr fclose 3 ,
 .Xr fopen 3 ,
 .Xr fseek 3 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Sh HISTORY
 The
 .Fn funopen
Index: lib/libpthread/socket/1/socket1.c
===
RCS file: /cvs/src/regress/lib/libpthread/socket/1/socket1.c,v
retrieving revision 1.3
diff -u -p -r1.3 socket1.c
--- lib/libpthread/socket/1/socket1.c   5 Jan 2006 03:47:19 -   1.3
+++ lib/libpthread/socket/1/socket1.c   4 Nov 2015 20:29:53 -
@@ -176,8 +176,8 @@ main(int argc, char *argv[])
 {
pthread_t thread;
 
-   setbuf(stdout, NULL);
-   setbuf(stderr, NULL);
+   setvbuf(stdout, NULL, _IONBUF, 0);
+   setvbuf(stderr, NULL, _IONBUF, 0);
 
CHECKr(pthread_attr_init());
 #if 0
Index: lib/libpthread/socket/2/socket2.c
===
RCS file: /cvs/src/regress/lib/libpthread/socket/2/socket2.c,v
retrieving revision 1.6
diff -u -p -r1.6 socket2.c
--- lib/libpthread/socket/2/socket2.c   30 Oct 2005 23:59:43 -  1.6
+++ lib/libpthread/socket/2/socket2.c   4 Nov 2015 20:29:53 -
@@ -177,8 +177,8 @@ main(int argc, char *argv[])
 {
pthread_t thread;
 
-   setbuf(stdout, NULL);
-   setbuf(stderr, NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);
+   setvbuf(stderr, NULL, _IONBF, 0);
 
CHECKr(pthread_create(, NULL, sock_accept, 
(void *)0xdeadbeaf));
Index: lib/libpthread/socket/2a/socket2a.c
===
RCS file: /cvs/src/regress/lib/libpthread/socket/2a/socket2a.c,v
retrieving revision 1.4
diff -u -p -r1.4 socket2a.c
--- lib/libpthread/socket/2a/socket2a.c 31 Jul 2003 21:48:06 -  1.4
+++ lib/libpthread/socket/2a/socket2a.c 4 Nov 2015 20:29:53 -
@@ -100,8 +100,8 @@ main(int argc, char *argv[])
 
if (argc == 3 && (!strcmp(argv[1], "fork okay"))) {
sleep(1);
-   setbuf(stdout, NULL);
-   setbuf(stderr, NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);
+   setvbuf(stderr, NULL, _IONBF, 0);
 
CHECKr(pthread_create(, NULL, sock_connect, 
(void *)argv[2]));
Index: usr.sbin/syslogd/ttylog.c
===
RCS file: /cvs/src/regress/usr.sbin/syslogd/ttylog.c,v
retrieving revision 1.2
diff -u -p -r1.2 ttylog.c
--- usr.sbin/syslogd/ttylog.c   23 Oct 2015 14:06:55 -  1.2
+++ usr.sbin/syslogd/ttylog.c   4 Nov 2015 20:29:54 -
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
 
if ((lg = fopen(logfile, "w")) == NULL)
err(1, "fopen %s", logfile);
-   if (setlinebuf(lg) != 0)
+   if (setvbuf(lg, NULL, _IOLBF, 0) != 0)
err(1, "setlinebuf");
 
memset(, 0, sizeof(act));



[0/3] replace setbuf(3) etc by setvbuf(3) - games

2015-11-04 Thread Frederic Nowak
Hi there,

setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".
The patch below updates all occurrences in src/games.

Cheers,
Frederic


Index: atc/graphics.c
===
RCS file: /cvs/src/games/atc/graphics.c,v
retrieving revision 1.9
diff -u -p -r1.9 graphics.c
--- atc/graphics.c  13 Jul 2014 13:00:40 -  1.9
+++ atc/graphics.c  4 Nov 2015 20:27:10 -
@@ -117,7 +117,7 @@ setup_screen(const C_SCREEN *scp)
endwin();
errx(1, "screen too small.");
}
-   setbuf(stdout, buffer);
+   setvbuf(stdout, buffer, _IOFBF, sizeof buffer);
input = newwin(INPUT_LINES, COLS - PLANE_COLS, LINES - INPUT_LINES,
0);
credit = newwin(INPUT_LINES, PLANE_COLS, LINES - INPUT_LINES, 
COLS - PLANE_COLS);
Index: gomoku/main.c
===
RCS file: /cvs/src/games/gomoku/main.c,v
retrieving revision 1.27
diff -u -p -r1.27 main.c
--- gomoku/main.c   7 Dec 2014 19:56:19 -   1.27
+++ gomoku/main.c   4 Nov 2015 20:27:10 -
@@ -155,7 +155,7 @@ again:
clrtoeol();
}
} else {
-   setbuf(stdout, 0);
+   setvbuf(stdout, NULL, _IONBF, 0);
get_line(buf, sizeof(buf));
if (strcmp(buf, "black") == 0)
color = BLACK;
Index: hack/hack.main.c
===
RCS file: /cvs/src/games/hack/hack.main.c,v
retrieving revision 1.17
diff -u -p -r1.17 hack.main.c
--- hack/hack.main.c27 Sep 2015 05:13:11 -  1.17
+++ hack/hack.main.c4 Nov 2015 20:27:10 -
@@ -175,7 +175,7 @@ main(int argc, char **argv)
 * Remember tty modes, to be restored on exit.
 */
gettty();
-   setbuf(stdout,obuf);
+   setvbuf(stdout, obuf, _IOFBF, sizeof obuf);
umask(007);
startup();
cls();
Index: mille/mille.c
===
RCS file: /cvs/src/games/mille/mille.c,v
retrieving revision 1.20
diff -u -p -r1.20 mille.c
--- mille/mille.c   19 Jan 2015 00:47:01 -  1.20
+++ mille/mille.c   4 Nov 2015 20:27:10 -
@@ -48,7 +48,7 @@ main(ac, av)
 #ifdef DEBUG
if (strcmp(av[0], "a.out") == 0) {
outf = fopen("q", "w");
-   setbuf(outf, (char *)NULL);
+   setvbuf(outf, NULL, _IONBF, 0);
Debug = TRUE;
}
 #endif
Index: mille/move.c
===
RCS file: /cvs/src/games/mille/move.c,v
retrieving revision 1.14
diff -u -p -r1.14 move.c
--- mille/move.c24 Oct 2015 17:51:59 -  1.14
+++ mille/move.c4 Nov 2015 20:27:10 -
@@ -442,7 +442,7 @@ over:
leaveok(Board, TRUE);
if ((outf = fopen(buf, "w")) == NULL)
warn("%s", buf);
-   setbuf(outf, (char *)NULL);
+   setvbuf(outf, NULL, _IONBF, 0);
}
Debug = !Debug;
break;
Index: mille/varpush.c
===
RCS file: /cvs/src/games/mille/varpush.c,v
retrieving revision 1.8
diff -u -p -r1.8 varpush.c
--- mille/varpush.c 19 Jan 2015 00:47:01 -  1.8
+++ mille/varpush.c 4 Nov 2015 20:27:10 -
@@ -85,7 +85,7 @@ over:
goto over;
}
if (strcmp(buf, _PATH_DEVNULL) != 0)
-   setbuf(outf, (char *)NULL);
+   setvbuf(outf, NULL, _IONBF, 0);
}
 #endif
} else {
Index: random/random.c
===
RCS file: /cvs/src/games/random/random.c,v
retrieving revision 1.13
diff -u -p -r1.13 random.c
--- random/random.c 14 Oct 2015 08:12:12 -  1.13
+++ random/random.c 4 Nov 2015 20:27:10 -
@@ -101,7 +101,7 @@ main(int argc, char *argv[])
 * to write to the standard output.
 */
if (unbuffer_output)
-   setbuf(stdout, NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);

/*
 * Select whether to print the first line.  (Prime the pump.)
Index: worm/worm.c
===
RCS file: /cvs/src/games/worm/worm.c,v
retrieving revision 1.32
diff -u -p -r1.32 worm.c
--- worm/worm.c 26 Aug 2015 01:25:57 -  1.32
+++ worm/worm.c 4 Nov 2015 20:27:10 -
@@ -94,7 +94,7 @@ main(int argc, char **argv)
 
timespecclear();
 
-   setbuf(stdout, outbuf);
+   setvbuf(stdout, outbuf, _IOFBF, sizeof outbuf);
signal(SIGINT, 

[1/3] replace setbuf(3) etc by setvbuf(3) - cat, sed & top

2015-11-04 Thread Frederic Nowak
Hi there,

setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".
The patch below replaces all occurrences in cat, sed & top.

Cheers,
Frederic

Index: cat/cat.1
===
RCS file: /cvs/src/bin/cat/cat.1,v
retrieving revision 1.34
diff -u -p -r1.34 cat.1
--- cat/cat.1   15 Jan 2015 19:06:31 -  1.34
+++ cat/cat.1   4 Nov 2015 20:24:19 -
@@ -82,7 +82,7 @@ option and also prints tab characters as
 .Ql ^I .
 .It Fl u
 The output is guaranteed to be unbuffered (see
-.Xr setbuf 3 ) .
+.Xr setvbuf 3 ) .
 .It Fl v
 Displays non-printing characters so they are visible.
 Control characters print as
@@ -149,7 +149,7 @@ operand.
 .Xr sh 1 ,
 .Xr tail 1 ,
 .Xr vis 1 ,
-.Xr setbuf 3
+.Xr setvbuf 3
 .Rs
 .%A Rob Pike
 .%T "UNIX Style, or cat -v Considered Harmful"
Index: cat/cat.c
===
RCS file: /cvs/src/bin/cat/cat.c,v
retrieving revision 1.23
diff -u -p -r1.23 cat.c
--- cat/cat.c   9 Oct 2015 01:37:06 -   1.23
+++ cat/cat.c   4 Nov 2015 20:24:19 -
@@ -87,7 +87,7 @@ main(int argc, char *argv[])
tflag = vflag = 1;  /* -t implies -v */
break;
case 'u':
-   setbuf(stdout, NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);
break;
case 'v':
vflag = 1;
Index: sed/sed.1
===
RCS file: /cvs/src/usr.bin/sed/sed.1,v
retrieving revision 1.46
diff -u -p -r1.46 sed.1
--- sed/sed.1   18 Jul 2015 09:33:00 -  1.46
+++ sed/sed.1   4 Nov 2015 20:35:12 -
@@ -122,7 +122,7 @@ printing each line as it becomes availab
 By default, output is line buffered when standard output is a terminal
 and block buffered otherwise.
 See
-.Xr setbuf 3
+.Xr setvbuf 3
 for a more detailed explanation.
 .El
 .Pp
Index: top/top.c
===
RCS file: /cvs/src/usr.bin/top/top.c,v
retrieving revision 1.86
diff -u -p -r1.86 top.c
--- top/top.c   30 Oct 2015 13:57:33 -  1.86
+++ top/top.c   4 Nov 2015 20:35:12 -
@@ -288,9 +288,9 @@ main(int argc, char *argv[])
 
/* set the buffer for stdout */
 #ifdef DEBUG
-   setbuffer(stdout, NULL, 0);
+   setvbuf(stdout, NULL, _IONBUF, 0);
 #else
-   setbuffer(stdout, stdoutbuf, sizeof stdoutbuf);
+   setvbuf(stdout, stdoutbuf, _IOFBF, sizeof stdoutbuf);
 #endif
 
/* initialize some selection options */



[2/3] replace setbuf(3) etc by setvbuf(3) - ping, ping6, lptest & rmt

2015-11-04 Thread Frederic Nowak
Hi there,

setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".
The patch below replaces all occurrences in ping, ping6, lptest & rmt.

Cheers,
Frederic

Index: ping/ping.c
===
RCS file: /cvs/src/sbin/ping/ping.c,v
retrieving revision 1.131
diff -u -p -r1.131 ping.c
--- ping/ping.c 30 Oct 2015 11:00:52 -  1.131
+++ ping/ping.c 4 Nov 2015 20:32:01 -
@@ -234,7 +234,7 @@ main(int argc, char *argv[])
if (getuid())
errx(1, "%s", strerror(EPERM));
options |= F_FLOOD;
-   setbuf(stdout, (char *)NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);
break;
case 'I':
case 'S':   /* deprecated */
Index: ping6/ping6.c
===
RCS file: /cvs/src/sbin/ping6/ping6.c,v
retrieving revision 1.135
diff -u -p -r1.135 ping6.c
--- ping6/ping6.c   25 Oct 2015 20:01:21 -  1.135
+++ ping6/ping6.c   4 Nov 2015 20:32:01 -
@@ -276,7 +276,7 @@ main(int argc, char *argv[])
errx(1, "Must be superuser to flood ping");
}
options |= F_FLOOD;
-   setbuf(stdout, (char *)NULL);
+   setvbuf(stdout, NULL, _IONBF, 0);
break;
case 'H':
options |= F_HOSTNAME;
Index: lpr/lptest/lptest.c
===
RCS file: /cvs/src/usr.sbin/lpr/lptest/lptest.c,v
retrieving revision 1.8
diff -u -p -r1.8 lptest.c
--- lpr/lptest/lptest.c 27 Oct 2009 23:59:52 -  1.8
+++ lpr/lptest/lptest.c 4 Nov 2015 20:36:15 -
@@ -44,7 +44,7 @@ main(int argc, char **argv)
int i, j, fc, nc;
char outbuf[BUFSIZ];
 
-   setbuf(stdout, outbuf);
+   setvbuf(stdout, outbuf, _IOFBF, sizeof outbuf);
if (argc >= 2)
len = atoi(argv[1]);
else
Index: rmt/rmt.c
===
RCS file: /cvs/src/usr.sbin/rmt/rmt.c,v
retrieving revision 1.18
diff -u -p -r1.18 rmt.c
--- rmt/rmt.c   20 Oct 2015 18:47:21 -  1.18
+++ rmt/rmt.c   4 Nov 2015 20:36:15 -
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
debug = fopen(*argv, "w");
if (debug == 0)
err(1, "cannot open debug file");
-   (void) setbuf(debug, (char *)0);
+   setvbuf(debug, NULL, _IONBF, 0);
}
 
if (dir) {



fix hypotf(3) for large and small values

2015-11-04 Thread Alexandr Shadchin
>From FreeBSD 23397: 
Fixed wrong magic numbers in scaling.  hypotf() was very broken for large
and small values:

hypotf(2.3819765e+38, 2.0416943e+38) was NaN instead of 3.1372484e+38
hypotf(-3.4028235e+38, 3.3886450e+38) was NaN instead of Inf
hypotf(-2.8025969e-45, -2.8025969e-45) was 0 instead of 4.2038954e-45

Found by:   ucbtest

Comment ? OK ?

-- 
Alexandr Shadchin

Index: e_hypotf.c
===
RCS file: /cvs/src/lib/libm/src/e_hypotf.c,v
retrieving revision 1.5
diff -u -p -r1.5 e_hypotf.c
--- e_hypotf.c  27 Oct 2009 23:59:29 -  1.5
+++ e_hypotf.c  4 Nov 2015 21:44:01 -
@@ -38,22 +38,22 @@ hypotf(float x, float y)
   if(hb == 0x7f80) w = b;
   return w;
   }
-  /* scale a and b by 2**-60 */
-  ha -= 0x5d80; hb -= 0x5d80;  k += 60;
+  /* scale a and b by 2**-68 */
+  ha -= 0x2200; hb -= 0x2200;  k += 68;
   SET_FLOAT_WORD(a,ha);
   SET_FLOAT_WORD(b,hb);
}
if(hb < 0x2680) {   /* b < 2**-50 */
if(hb <= 0x007f) {  /* subnormal b or 0 */  
if(hb==0) return a;
-   SET_FLOAT_WORD(t1,0x3f00);  /* t1=2^126 */
+   SET_FLOAT_WORD(t1,0x7e80);  /* t1=2^126 */
b *= t1;
a *= t1;
k -= 126;
-   } else {/* scale a and b by 2^60 */
-   ha += 0x5d80;   /* a *= 2^60 */
-   hb += 0x5d80;   /* b *= 2^60 */
-   k -= 60;
+   } else {/* scale a and b by 2^68 */
+   ha += 0x2200;   /* a *= 2^68 */
+   hb += 0x2200;   /* b *= 2^68 */
+   k -= 68;
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
}



Re: [1/3] replace setbuf(3) etc by setvbuf(3) - cat, sed & top

2015-11-04 Thread Ted Unangst
Frederic Nowak wrote:
> Hi there,
> 
> setbuf(3) etc "are obsoleted by setvbuf(3)" and "should be avoided".

thanks!



[patch] option DEBUG_INTC + option DDB in ampintc.c

2015-11-04 Thread Daniel Bolgheroni
When compiling kernel with option DEBUG_INTC, we do not have
AMPINTC_IRQ_TO_REG nor AMPINTC_IRQ_TO_REGi.

In the same file, most uses of Debugger() is protected with either

#ifdef DDB

or with a

#if defined(DEBUG_SOMETHING) && defined(DDB)

as it is with sys/arch/amd64/amd64/cpu.c, sys/arch/arm/arm/pmap.c, and
many others. This is not a problem with GENERIC that has option DDB, but
it is with RAMDISK.

(...)
cc  -Werror -Wall -Wimplicit-function-declaration  -Wno-main -Wno-uninitialized 
 -Wframe-larger-than=2047 -ffreestanding -msoft-float -march=armv6 
-Wa,-march=armv7a -fno-builtin-printf -fno-builtin-snprintf  
-fno-builtin-vsnprintf -fno-builtin-log  -fno-builtin-log2 -fno-builtin-malloc  
-fno-stack-protector -O2 -pipe -nostdinc -I../../../.. -I. -I../../../../arch 
-DCPU_ARMv7 -DDEBUG -DDEBUG_INTC -DTIMEZONE="0" -DDST="0" -DSMALL_KERNEL 
-DNO_PROPOLICE -DBOOT_CONFIG -DMINIROOTSIZE="0x2800" -DRAMDISK_HOOKS -DFFS 
-DMSDOSFS -DINET6 -DEXT2FS -DUSBVERBOSE -DMAXUSERS=4 -D_KERNEL -D__armv7__ -MD 
-MP  -c ../../../../arch/arm/cortex/ampintc.c
cc1: warnings being treated as errors
../../../../arch/arm/cortex/ampintc.c: In function 'ampintc_irq_handler':
../../../../arch/arm/cortex/ampintc.c:498: warning: implicit declaration of 
function 'Debugger'
*** Error 1 in /usr/src/sys/arch/armv7/compile/RAMDISK (Makefile:536 
'ampintc.o')

ok?

Index: ampintc.c
===
RCS file: /cvs/src/sys/arch/arm/cortex/ampintc.c,v
retrieving revision 1.7
diff -u -p -r1.7 ampintc.c
--- ampintc.c   15 Jul 2015 21:09:40 -  1.7
+++ ampintc.c   4 Nov 2015 18:43:40 -
@@ -386,13 +386,6 @@ ampintc_calc_mask(void)
if (max == IPL_NONE)
min = IPL_NONE;

-#ifdef DEBUG_INTC
-   if (min != IPL_NONE) {
-   printf("irq %d to block at %d %d reg %d bit %d\n",
-   irq, max, min, AMPINTC_IRQ_TO_REG(irq),
-   AMPINTC_IRQ_TO_REGi(irq));
-   }
-#endif
/* Enable interrupts at lower levels, clear -> enable */
/* Set interrupt priority/enable */
if (min != IPL_NONE) {
@@ -494,8 +487,7 @@ ampintc_irq_handler(void *frame)
int  irq, pri, s;

iack_val = ampintc_iack();
-//#define DEBUG_INTC
-#ifdef DEBUG_INTC
+#if defined(DEBUG_INTC) && defined(DDB)
if (iack_val != 27)
printf("irq  %d fired\n", iack_val);
else {

-- 
db



[patch] tcpdump print-null AF_LINK segfault

2015-11-04 Thread Kevin Reay
Fixes a segfault (in tcpdump.c:default_print) when a printing a raw
packet of family AF_LINK with an unknown ether_type with
MALLOC_OPTIONS=S. The original version would print 4-bytes of d0 and
occasionally segfault.

With this change, default_print() receives a caplen that is reduced by
NULL_HDRLEN (4-bytes) which offsets the value that the p pointer has
been incremented by earlier. This behaviour matches the other
default_print call later in the function.
Index: print-null.c
===
RCS file: /cvs/src/usr.sbin/tcpdump/print-null.c,v
retrieving revision 1.21
diff -u -p -r1.21 print-null.c
--- print-null.c16 Jan 2015 06:40:21 -  1.21
+++ print-null.c5 Nov 2015 02:05:00 -
@@ -179,7 +179,7 @@ null_if_print(u_char *user, const struct
   
etherproto_string(htons(extracted_ethertype)));
}
if (!xflag && !qflag)
-   default_print(p, caplen);
+   default_print(p, caplen - NULL_HDRLEN);
}
} else if (ether_encap_print(ether_type, p, length,
   caplen) == 0) {
@@ -188,7 +188,7 @@ null_if_print(u_char *user, const struct
ether_print((u_char *)ep, length +
sizeof(*ep));
if (!xflag && !qflag)
-   default_print(p, caplen);
+   default_print(p, caplen - NULL_HDRLEN);
}
break;
 #endif /* __OpenBSD__ */


[patch] cvs: retire xfree()

2015-11-04 Thread Michael W. Bombardieri
Hi tech@,

Function xfree() was previously removed from rcs, so drop it from
opencvs too...

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/rcs/xmalloc.c?f=h#rev1.9

Footnote:
I noticed that rcsnum_free() is just free() so maybe that could be
removed also (not included in this patch).

- Michael


Index: add.c
===
RCS file: /cvs/src/usr.bin/cvs/add.c,v
retrieving revision 1.111
diff -u -p -u -r1.111 add.c
--- add.c   16 Jan 2015 06:40:06 -  1.111
+++ add.c   5 Nov 2015 02:49:20 -
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -146,7 +147,7 @@ cvs_add_entry(struct cvs_file *cf)
entlist = cvs_ent_open(cf->file_wd);
cvs_ent_add(entlist, entry);
 
-   xfree(entry);
+   free(entry);
} else {
add_entry(cf);
}
@@ -252,7 +253,7 @@ cvs_add_tobranch(struct cvs_file *cf, ch
(void)xsnprintf(attic, PATH_MAX, "%s/%s/%s%s", repo,
CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);
 
-   xfree(cf->file_rpath);
+   free(cf->file_rpath);
cf->file_rpath = xstrdup(attic);
 
cf->repo_fd = open(cf->file_rpath, O_CREAT|O_RDONLY);
@@ -277,7 +278,7 @@ cvs_add_tobranch(struct cvs_file *cf, ch
if (rcs_rev_add(cf->file_rcs, RCS_HEAD_REV, msg, -1, NULL) == -1)
fatal("cvs_add_tobranch: failed to create first branch "
"revision");
-   xfree(msg);
+   free(msg);
 
if (rcs_findrev(cf->file_rcs, cf->file_rcs->rf_head) == NULL)
fatal("cvs_add_tobranch: cannot find newly added revision");
@@ -359,7 +360,7 @@ add_directory(struct cvs_file *cf)
 
entlist = cvs_ent_open(cf->file_wd);
cvs_ent_add(entlist, p);
-   xfree(p);
+   free(p);
}
}
 
@@ -381,10 +382,8 @@ add_directory(struct cvs_file *cf)
}
cvs_printf("%s\n", msg);
 
-   if (tag != NULL)
-   xfree(tag);
-   if (date != NULL)
-   xfree(date);
+   free(tag);
+   free(date);
 
cvs_get_repository_name(cf->file_path, repo, PATH_MAX);
line_list = cvs_trigger_getlines(CVS_PATH_LOGINFO, repo);
@@ -400,8 +399,7 @@ add_directory(struct cvs_file *cf)
 
cvs_trigger_freeinfo(_info);
cvs_trigger_freelist(line_list);
-   if (loginfo != NULL)
-   xfree(loginfo);
+   free(loginfo);
}
}
 
@@ -564,5 +562,5 @@ add_entry(struct cvs_file *cf)
entlist = cvs_ent_open(cf->file_wd);
cvs_ent_add(entlist, entry);
}
-   xfree(entry);
+   free(entry);
 }
Index: admin.c
===
RCS file: /cvs/src/usr.bin/cvs/admin.c,v
retrieving revision 1.65
diff -u -p -u -r1.65 admin.c
--- admin.c 16 Jan 2015 06:40:06 -  1.65
+++ admin.c 5 Nov 2015 02:49:20 -
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -304,8 +305,8 @@ cvs_admin_local(struct cvs_file *cf)
while (!TAILQ_EMPTY(&(cf->file_rcs->rf_access))) {
rap = TAILQ_FIRST(&(cf->file_rcs->rf_access));
TAILQ_REMOVE(&(cf->file_rcs->rf_access), rap, ra_list);
-   xfree(rap->ra_name);
-   xfree(rap);
+   free(rap->ra_name);
+   free(rap);
}
/* no synced anymore */
cf->file_rcs->rf_flags &= ~RCS_SYNCED;
Index: annotate.c
===
RCS file: /cvs/src/usr.bin/cvs/annotate.c,v
retrieving revision 1.64
diff -u -p -u -r1.64 annotate.c
--- annotate.c  16 Jan 2015 06:40:06 -  1.64
+++ annotate.c  5 Nov 2015 02:49:20 -
@@ -235,7 +235,7 @@ cvs_annotate_local(struct cvs_file *cf)
p[line->l_len] = '\0';
 
if (line->l_needsfree)
-   xfree(line->l_line);
+   free(line->l_line);
line->l_line = p;
line->l_len++;
line->l_needsfree = 1;
@@ -244,9 +244,9 @@ cvs_annotate_local(struct cvs_file *cf)
line->l_delta->rd_author, date, line->l_line);
 
if (line->l_needsfree)
-   xfree(line->l_line);
-   xfree(line);
+   free(line->l_line);
+   free(line);
}
 
-   xfree(alines);
+   free(alines);
 }
Index: buf.c
===
RCS 

Another uvm(9) tweak

2015-11-04 Thread Michael McConville
It's probably best to say that UVM_MAPFLAG() returns a uvm_flag_t. It's
almost exclusively used for uvm_map()'s flag arg, which has that type.
Of course, it's an arithmetic macro, so it doesn't actually have a
return type.

ok?


Index: share/man/man9/uvm.9
===
RCS file: /cvs/src/share/man/man9/uvm.9,v
retrieving revision 1.61
diff -u -p -r1.61 uvm.9
--- share/man/man9/uvm.930 Oct 2015 04:21:42 -  1.61
+++ share/man/man9/uvm.95 Nov 2015 04:14:30 -
@@ -147,7 +147,7 @@ function initialises the swap subsystem.
 .Fn uvm_uarea_alloc "void"
 .Ft void
 .Fn uvm_uarea_free "struct proc *p"
-.Ft int
+.Ft uvm_flag_t
 .Fn UVM_MAPFLAG "vm_prot_t prot" "vm_prot_t maxprot" "vm_inherit_t inh" "int 
advice" "int flags"
 .nr nS 0
 .Pp



Re: Another uvm(9) tweak

2015-11-04 Thread Michael McConville
Ted Unangst wrote:
> Michael McConville wrote:
> > It's probably best to say that UVM_MAPFLAG() returns a uvm_flag_t. It's
> > almost exclusively used for uvm_map()'s flag arg, which has that type.
> > Of course, it's an arithmetic macro, so it doesn't actually have a
> > return type.
> 
> I would argue we should delete some of these bullshit types instead.

Fine by me. No strong opinion, though - I'm very new to this code.



Re: Another uvm(9) tweak

2015-11-04 Thread Ted Unangst
Michael McConville wrote:
> It's probably best to say that UVM_MAPFLAG() returns a uvm_flag_t. It's
> almost exclusively used for uvm_map()'s flag arg, which has that type.
> Of course, it's an arithmetic macro, so it doesn't actually have a
> return type.

I would argue we should delete some of these bullshit types instead.



Re: [patch] cvs: retire xfree()

2015-11-04 Thread Michael McConville
Michael W. Bombardieri wrote:
> Hi tech@,
> 
> Function xfree() was previously removed from rcs, so drop it from
> opencvs too...
> 
> http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/rcs/xmalloc.c?f=h#rev1.9

Good catch, thanks.

My eyes glazed over a little while reviewing this, but tentative ok
mmcc@

Below is what I consider a better refactoring of buf_free(). It makes it
NULL-safe and has more classic free function logic.

> Footnote:
> I noticed that rcsnum_free() is just free() so maybe that could be
> removed also (not included in this patch).

I'll have to look, but this sounds like a good idea to me.


Index: buf.c
===
RCS file: /cvs/src/usr.bin/cvs/buf.c,v
retrieving revision 1.82
diff -u -p -r1.82 buf.c
--- buf.c   5 Feb 2015 12:59:57 -   1.82
+++ buf.c   5 Nov 2015 05:08:57 -
@@ -119,15 +119,15 @@ buf_load_fd(int fd)
 void
 buf_free(BUF *b)
 {
-   if (b->cb_buf != NULL)
-   xfree(b->cb_buf);
-   xfree(b);
+   if (b != NULL) {
+   free(b->cb_buf);
+   free(b);
+   }
 }
 
 /*
  * Free the buffer 's structural information but do not free the contents
- * of the buffer.  Instead, they are returned and should be freed later using
- * xfree().
+ * of the buffer.  Instead, they are returned and should be freed later.
  */
 void *
 buf_release(BUF *b)
@@ -135,7 +135,7 @@ buf_release(BUF *b)
void *tmp;
 
tmp = b->cb_buf;
-   xfree(b);
+   free(b);
return (tmp);
 }
 



Re: [patch] cvs: retire xfree()

2015-11-04 Thread Michael W. Bombardieri
> Good catch, thanks.
> 
> My eyes glazed over a little while reviewing this, but tentative ok
> mmcc@
> 
> Below is what I consider a better refactoring of buf_free(). It makes it
> NULL-safe and has more classic free function logic.

I didn't include buf_free() in my patch but that looks good.

> > Footnote:
> > I noticed that rcsnum_free() is just free() so maybe that could be
> > removed also (not included in this patch).
> 
> I'll have to look, but this sounds like a good idea to me.

In rcs(1) rcsnum_free() is more complicated since rn_id is dynamically 
allocated.

> Index: buf.c
> ===
> RCS file: /cvs/src/usr.bin/cvs/buf.c,v
> retrieving revision 1.82
> diff -u -p -r1.82 buf.c
> --- buf.c 5 Feb 2015 12:59:57 -   1.82
> +++ buf.c 5 Nov 2015 05:08:57 -
> @@ -119,15 +119,15 @@ buf_load_fd(int fd)
>  void
>  buf_free(BUF *b)
>  {
> - if (b->cb_buf != NULL)
> - xfree(b->cb_buf);
> - xfree(b);
> + if (b != NULL) {
> + free(b->cb_buf);
> + free(b);
> + }
>  }
>  
>  /*
>   * Free the buffer 's structural information but do not free the contents
> - * of the buffer.  Instead, they are returned and should be freed later using
> - * xfree().
> + * of the buffer.  Instead, they are returned and should be freed later.
>   */
>  void *
>  buf_release(BUF *b)
> @@ -135,7 +135,7 @@ buf_release(BUF *b)
>   void *tmp;
>  
>   tmp = b->cb_buf;
> - xfree(b);
> + free(b);
>   return (tmp);
>  }
>  



Re: em(4) watchdog timeouts

2015-11-04 Thread Sonic
On Mon, Nov 2, 2015 at 11:19 PM, Sonic  wrote:
> Sorry to report that the diff does not solve the timeout problem here.
>
> All was working fine with the if_em* versions from 2015/09/29 (I
> downgraded to this version per Stuarts post on 10-14):
> "try backing out the last commits to
> if_em.c and if_em.h ("cd /sys/dev/pci; cvs up -D 2015/09/29 if_em*") to
> see if it makes a difference."
>
> However, that version no longer compiles with -current and the
> watchdog timeouts are back (even with the diff).

Is there anything else I can provide to assist in finding a cure for this issue?
I get sporadic timeouts even under normal usage, but starting a
bittorrent on a client brings the firewall to its knees. And as all
the firewalls I manage use the em driver I cannot take a chance on
upgrading any of them to -current.

Thank you,

Chris



Re: tcpdump: stop building SLIP support

2015-11-04 Thread Jérémie Courrèges-Anglas
Theo de Raadt  writes:

> Why?
>
> We don't have decnet code either, yet it is nice to sniff it if you
> see it.

My understanding was that since sl(4) is gone, there's no way to have an
interface configured with SLIP on OpenBSD, thus no way to see that
protocol and no way to reach that code.  I'm also looking at the useless
DLT_SLIP occurrence in net/bpf.c.  Or am I missing something?

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: tcpdump: stop building SLIP support

2015-11-04 Thread Stuart Henderson
On 2015/11/04 19:41, Jérémie Courrèges-Anglas wrote:
> 
> Some time ago mpi removed the sl(4) driver, IIUC this makes a bunch of
> code useless in tcpdump.

It still has slight use for pcap files generated on another system..



Re: tcpdump: stop building SLIP support

2015-11-04 Thread Theo de Raadt
Why?

We don't have decnet code either, yet it is nice to sniff it if you
see it.

> Some time ago mpi removed the sl(4) driver, IIUC this makes a bunch of
> code useless in tcpdump.
> 
> The diff below only removes the define.  If people prefer, I could also
> kill some noise by removing the useless code in print-sl.c, leaving only
> the stub functions.
> 
> Comments / ok?
> 
> Index: Makefile
> ===
> RCS file: /cvs/src/usr.sbin/tcpdump/Makefile,v
> retrieving revision 1.59
> diff -u -p -p -u -r1.59 Makefile
> --- Makefile  14 Oct 2015 04:55:17 -  1.59
> +++ Makefile  4 Nov 2015 18:05:23 -
> @@ -28,7 +28,7 @@ CFLAGS+=-Wall -I${.CURDIR}/../../sbin/pf
>  # for pcap-int.h
>  CFLAGS+=-I${.CURDIR}/../../lib/libpcap
>  
> -CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_NET_SLIP_H 
> -DHAVE_ETHER_NTOHOST -DINET6
> +CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_ETHER_NTOHOST 
> -DINET6
>  
>  LDADD+=  -lpcap -ll -lcrypto
>  DPADD+=  ${LIBL} ${LIBPCAP} ${LIBCRYPTO}
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



Re: [PATCH] intro(8) - corrections and update

2015-11-04 Thread Jason McIntyre
On Wed, Nov 04, 2015 at 10:56:58AM +, Raf Czlonka wrote:
> 
> I've attached an updated patch, with only the "undisputed" parts :^)
> 
> Raf
> 

committed, slightly tweaked, with one notable change:

> Index: share/man/man8/intro.8
> ===
> RCS file: /cvs/src/share/man/man8/intro.8,v
> retrieving revision 1.26
> diff -u -p -r1.26 intro.8
> --- share/man/man8/intro.821 Sep 2015 09:23:35 -  1.26
> +++ share/man/man8/intro.84 Nov 2015 10:55:48 -
> @@ -95,6 +95,10 @@ the following line might be added to
>  .Bd -literal -offset indent
>  httpd_flags=""
>  .Ed
> +or
> +.Bd -literal -offset indent -compact
> +httpd_flags="-vv"
> +.Ed

instead of adding a second example, i just altered the first to read

httpd_flags="-v"

jmc

>  .Pp
>  As can be seen above,
>  this method is also used to specify additional options.
> @@ -106,7 +110,7 @@ and the individual pages for the utiliti
>  .Ss Automounter daemon (amd)
>  If using the
>  .Xr amd 8
> -package,
> +daemon,
>  go into the
>  .Pa /etc/amd
>  directory and set it up by
> @@ -123,7 +127,7 @@ variables:
>  .Va amd_flags
>  and
>  .Va amd_master .
> -.Ss Domain Name Server (DNS)
> +.Ss DNS server
>  If you are using a name server, check the
>  .Pa /etc/resolv.conf
>  file.
> @@ -141,7 +145,7 @@ If using a caching name server, add the 
>  Relevant
>  .Xr rc.conf 8
>  variables:
> -.Va named_flags
> +.Va nsd_flags
>  and
>  .Va unbound_flags .
>  .Ss Clock synchronisation
> @@ -224,6 +228,7 @@ variables:
>  .Ss Routing Daemons
>  Various daemons for managing routing tables are available:
>  .Xr bgpd 8 ,
> +.Xr eigrpd 8 ,
>  .Xr ospfd 8 ,
>  and
>  .Xr ripd 8 .
> @@ -232,6 +237,7 @@ Relevant
>  .Xr rc.conf 8
>  variables:
>  .Va bgpd_flags ,
> +.Va eigrpd_flags ,
>  .Va ospfd_flags ,
>  and
>  .Va ripd_flags .
> 



Re: wc does not count last line if no trailing newline present

2015-11-04 Thread Jason McIntyre
On Wed, Nov 04, 2015 at 12:09:45PM +0100, Ingo Schwarze wrote:
> Hi,
> 
> Jason McIntyre wrote on Wed, Nov 04, 2015 at 07:51:30AM +:
> 
> > the clarity is good, but i worry that you're making a clear sentence
> > harder to grasp. posix spec itself says -l counts "newline characters",
> > which i find easier to understand in itself, but as flag -l i find it
> > much easier to understand mentally that this option can count lines.
> > 
> > i guess we could leave the description as-is, but add a sentence to
> > qualift this statement.
> 
> POSIX requires that a text file must end in a newline character -
> if it doesn't, it is not a text file.
> 
> So we have the unusual situation here that POSIX specifies how a
> specific utility must deal with a specific kind of invalid input.
> More often, the behaviour for invalid input is left undefined.
> 
> Admittedly, this may seem somewhat confusing to people who don't
> know POSIX.  If you want it clarified, we would have to apply the
> following or a similar patch.  That *is* wordy, but making it shorter
> will make it even more confusing:
> 
>  - If we explicitly talk about the fact that a string of characters
>not ending in a newline is not a line, we have to say that this
>is implied by the definition of the term "text file", or we
>provoke exactly the confusion Dan fell prey to, because many
>people will consider that definition counterintuitive.
> 
>  - If we dive down to this level of detail, saying just "a string
>of characters ending in a newline" is no longer enough because
>that would disallow empty lines, so "zero or more characters"
>is required.  Note that in the definition of a "word", "string
>of characters" without further qualification does indeed require
>at least one character.  Being extremely pedantic about invalid
>trailing characters but at the same time slightly imprecise about
>the much more common and perfectly legal case of empty lines
>seems like a very bad idea to me.
> 
>  - If we try to be that precise, the sentence about words is no
>longer correct.  If the file contains no whitespace character
>whatsoever, its content is still considered to be a word, even
>though it is not delimited by whitespace.  If we explicitly
>distinguish between "ended by newline" and "ended by EOF" in the
>definition of a line, than we have to apply the same precision
>to the definition of a word and can no longer expect "delimited
>by whitespace" to imply "delimited by EOF".
> 
>  - In any case, the word "maximal" is redundant and not helpful.
>If a string is not maximal, it is obviously not delimited by
>whitespace.
> 
> Do you want this?
> 
> Or do you say people should read POSIX to understand what a text
> file and what a line is?
> 

hi.

i don;t expect anyone to read posix ;) i would rather just leave this an
exercise to the reader.

jmc

> Yours,
>   Ingo
> 
> 
> Index: wc.1
> ===
> RCS file: /cvs/src/usr.bin/wc/wc.1,v
> retrieving revision 1.25
> diff -u -p -r1.25 wc.1
> --- wc.1  21 Apr 2015 10:46:48 -  1.25
> +++ wc.1  4 Nov 2015 11:04:20 -
> @@ -52,9 +52,12 @@ contained in each input file to the stan
>  If more than one input file is specified,
>  a line of cumulative count(s) for all named files is output on a
>  separate line following the last file count.
> -.Nm
> -considers a word to be a maximal string of characters delimited by
> -whitespace.
> +.Pp
> +In a text file, a line is a string of zero or more characters ending
> +in a newline character, which means that trailing characters after
> +the last newline character do not count as a line.
> +A word is a string of characters delimited by whitespace or by the
> +beginning or the end of the file.
>  Whitespace characters are the set of characters for which the
>  .Xr isspace 3
>  function returns true.



Re: restricting DNS to port 53

2015-11-04 Thread gwes

Apologies... I found a set of how-tos on the web.
They suggest the "use a separate address for the
internal nsd". I will change my setup accordingly.

On 11/04/15 09:31, gwes wrote:

Will unbound and nsd be restricted to port 53 only?

Restricting unbound and nsd to port 53 would be
a flag day for me.

I am simulating bind's views for my split horizon by
using two copies of nsd, one of which serves external
queries and one which unbound queries for internal
zones. They share some zone files. The internal and
external views are split into separate zone files
by a script when one or the other changes.

The internal nsd serves from port 10053 so that
it isn't visible to random programs expecting
a recursive server. Note that port options are
explicit in release versions of man unbound.conf and
nsd.conf.

I am using stub-zone in unbound pointing to my
internal nsd on port 10053. Using local-data is
both ugly and impractical since my internal zone
changes frequently.

The solutions I see are:

Ideally, implement views in nsd. There is no mention
  of "split horizon" or "views" in the nsd archive.
  I haven't looked at their repository to see if
  there is WIP.

My probable solution:
  add a loopback interface on (say) 127.0.1.1
  make unbound and nsd communicate there on port 53

Ugly and philosophically bad:
  generate unbound.conf from zone files
 or
  modify unbound to read zone files

Comments?

Geoff Steckel





restricting DNS to port 53

2015-11-04 Thread gwes

Will unbound and nsd be restricted to port 53 only?

Restricting unbound and nsd to port 53 would be
a flag day for me.

I am simulating bind's views for my split horizon by
using two copies of nsd, one of which serves external
queries and one which unbound queries for internal
zones. They share some zone files. The internal and
external views are split into separate zone files
by a script when one or the other changes.

The internal nsd serves from port 10053 so that
it isn't visible to random programs expecting
a recursive server. Note that port options are
explicit in release versions of man unbound.conf and
nsd.conf.

I am using stub-zone in unbound pointing to my
internal nsd on port 10053. Using local-data is
both ugly and impractical since my internal zone
changes frequently.

The solutions I see are:

Ideally, implement views in nsd. There is no mention
  of "split horizon" or "views" in the nsd archive.
  I haven't looked at their repository to see if
  there is WIP.

My probable solution:
  add a loopback interface on (say) 127.0.1.1
  make unbound and nsd communicate there on port 53

Ugly and philosophically bad:
  generate unbound.conf from zone files
 or
  modify unbound to read zone files

Comments?

Geoff Steckel



Re: restricting DNS to port 53

2015-11-04 Thread Chris Cappuccio
gwes [g...@oat.com] wrote:
> Will unbound and nsd be restricted to port 53 only?
> 

No



Re: ftp.1: "dir |more" example not working as intended

2015-11-04 Thread Ingo Schwarze
Hi,

Frederic Nowak wrote on Tue, Nov 03, 2015 at 04:59:35PM +0100:

> I think the "dir |more" example in ftp.1 is not working as intended.

True.

> ls (and by extension its synonym dir) expects to be called like this:
> 
> ls [remote-directory [local-file]]
> 
> Therefore, "dir |more" would print the contents of a remote directory
> called "|more", which usually doesn't exist. I think the example is
> supposed to be "dir . |more" which pipes the contents of the current
> directory to more.
> 
> The first patch below changes "dir |more" to "dir . |more". The second
> patch changes it to "ls . |more", in case ls should be preferred over
> its synonym dir.

The fix seems correct, i'd like to commit it in the following form,
also clarifying that special handling of `-' and `|' only applies
to local file names, not to remote file names.  Note that item 5
does talk about remote file names, so it's not an option to simply
change the first word for the whole "FILE NAMING CONVENTIONS"
section to "Local files".

OK?
  Ingo


Index: ftp.1
===
RCS file: /cvs/src/usr.bin/ftp/ftp.1,v
retrieving revision 1.100
diff -u -p -r1.100 ftp.1
--- ftp.1   25 Sep 2015 20:32:39 -  1.100
+++ ftp.1   4 Nov 2015 14:01:13 -
@@ -1461,13 +1461,13 @@ Files specified as arguments to
 commands are processed according to the following rules.
 .Bl -enum
 .It
-If the file name
+If
 .Sq -
-is specified, the standard input (for reading)
+is specified as a local file name, the standard input (for reading)
 or standard output (for writing)
 is used.
 .It
-If the first character of the file name is
+If the first character of a local file name is
 .Sq \&| ,
 the
 remainder of the argument is interpreted as a shell command.
@@ -1481,7 +1481,7 @@ must be quoted; e.g.,
 .Qq ls -lt .
 A particularly
 useful example of this mechanism is:
-.Qq dir |more .
+.Qq ls \&. |more .
 .It
 Failing the above checks, if
 .Dq globbing


> Index: usr.bin/ftp/ftp.1
> ===
> RCS file: /cvs/src/usr.bin/ftp/ftp.1,v
> retrieving revision 1.100
> diff -u -p -r1.100 ftp.1
> --- usr.bin/ftp/ftp.1 25 Sep 2015 20:32:39 -  1.100
> +++ usr.bin/ftp/ftp.1 3 Nov 2015 15:31:04 -
> @@ -1481,7 +1481,7 @@ must be quoted; e.g.,
>  .Qq ls -lt .
>  A particularly
>  useful example of this mechanism is:
> -.Qq dir |more .
> +.Qq dir \&. |more .
>  .It
>  Failing the above checks, if
>  .Dq globbing
> 
> 
> Index: usr.bin/ftp/ftp.1
> ===
> RCS file: /cvs/src/usr.bin/ftp/ftp.1,v
> retrieving revision 1.100
> diff -u -p -r1.100 ftp.1
> --- usr.bin/ftp/ftp.1 25 Sep 2015 20:32:39 -  1.100
> +++ usr.bin/ftp/ftp.1 3 Nov 2015 15:31:04 -
> @@ -1481,7 +1481,7 @@ must be quoted; e.g.,
>  .Qq ls -lt .
>  A particularly
>  useful example of this mechanism is:
> -.Qq dir |more .
> +.Qq ls \&. |more .
>  .It
>  Failing the above checks, if
>  .Dq globbing



Re: [patch] tcpdump gre sre segfault

2015-11-04 Thread Stuart Henderson
On 2015/11/03 20:04, Kevin Reay wrote:
> Fix a segfault in the GRE printer when a GRE packet SRE length
> extends past the actual captured length (but not the packet's
> original length).

That's OK with me..

> gre_print() now checks if the length extends past snapend and, if so,
> uses the snapend to determine the usable length.
> 
> Also includes a small change to use the already defined GRE_VERS
> instead of a hardcoded mask.
> 
> Note that the GRE printer does its own length testing. It would
> probably be better to migrate it to use the TCHECK* functions instead
> of the manual length check logic it's doing now.

> Index: print-gre.c
> ===
> RCS file: /cvs/src/usr.sbin/tcpdump/print-gre.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 print-gre.c
> --- print-gre.c   16 Jan 2015 06:40:21 -  1.9
> +++ print-gre.c   4 Nov 2015 02:52:41 -
> @@ -73,11 +73,14 @@ gre_print(const u_char *bp, u_int length
>  {
>   u_int len = length, vers;
>  
> + if (bp + len > snapend)
> + len = snapend - bp;
> +
>   if (len < 2) {
>   printf("[|gre]");
>   return;
>   }
> - vers = EXTRACT_16BITS(bp) & 7;
> + vers = EXTRACT_16BITS(bp) & GRE_VERS;
>  
>   if (vers == 0)
>   gre_print_0(bp, len);



Re: [PATCH] intro(8) - corrections and update

2015-11-04 Thread Stuart Henderson
On 2015/11/04 10:56, Raf Czlonka wrote:
> @@ -141,7 +145,7 @@ If using a caching name server, add the 
>  Relevant
>  .Xr rc.conf 8
>  variables:
> -.Va named_flags
> +.Va nsd_flags
>  and
>  .Va unbound_flags .

Hmm. This section is a bit weird.

 If you are using a name server, check the /etc/resolv.conf file.  It may
 look something like:

   domain nts.umn.edu
   nameserver 128.101.101.101
   nameserver 134.84.84.84
   search nts.umn.edu. umn.edu.
   lookup file bind

 If using a caching name server, add the line "nameserver 127.0.0.1"
 first.

Most name servers that people will list in resolv.conf are caching
name servers, and they don't need to be on localhost..

 Relevant rc.conf(8) variables: named_flags and unbound_flags.

Just going by the section name "Domain Name Server (DNS)" nsd_flags
fits, but the text only talks about resolvers. Would it make any kind
of sense to split this into "DNS resolver" and "Authoritative DNS"?
There is also rebound(8) to mention, which runs on localhost, but
is not a caching server.

> @@ -224,6 +228,7 @@ variables:
>  .Ss Routing Daemons
>  Various daemons for managing routing tables are available:
>  .Xr bgpd 8 ,
> +.Xr eigrpd 8 ,
>  .Xr ospfd 8 ,
>  and
>  .Xr ripd 8 .

This text makes it look like an exhaustive list. I'd either add
the word "including" or add the others - in either case ospf6d could
do with being added.

Might be better, though, to go with something like "Various daemons
for managing dynamic routing are available" (i.e. not saying "routing
tables") and include ldpd.



Re: Call for Testing: rtalloc(9) change

2015-11-04 Thread Martin Pieuchot
On 12/08/15(Wed) 17:03, Martin Pieuchot wrote:
> I'm currently working on the routing table interface to make is safe
> to use by multiple CPUs at the same time.  The diff below is a big
> step in this direction and I'd really appreciate if people could test
> it with their usual network setup and report back.

Below is an updated version of the diff now that bluhm@ fixed the
potential loop with RTF_GATEWAY routes.

Note that regression tests will fail because we no longer call
rtalloc(9) inside rt_setgate().  In other words we do not cache
a next-hop route before using it.

Ok?

Index: net/route.c
===
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.268
diff -u -p -r1.268 route.c
--- net/route.c 4 Nov 2015 10:13:55 -   1.268
+++ net/route.c 4 Nov 2015 11:15:00 -
@@ -151,6 +151,7 @@ voidrt_timer_init(void);
 intrtflushclone1(struct rtentry *, void *, u_int);
 void   rtflushclone(unsigned int, struct rtentry *);
 intrt_if_remove_rtdelete(struct rtentry *, void *, u_int);
+struct rtentry *rt_match(struct sockaddr *, int, unsigned int);
 
 struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *,
u_int);
@@ -194,6 +195,12 @@ rtisvalid(struct rtentry *rt)
if (rt == NULL)
return (0);
 
+#ifdef DIAGNOSTIC
+   if (ISSET(rt->rt_flags, RTF_GATEWAY) && (rt->rt_gwroute != NULL) &&
+   ISSET(rt->rt_gwroute->rt_flags, RTF_GATEWAY))
+   panic("next hop must be directly reachable");
+#endif
+
if ((rt->rt_flags & RTF_UP) == 0)
return (0);
 
@@ -201,11 +208,27 @@ rtisvalid(struct rtentry *rt)
if (rt->rt_ifa == NULL || rt->rt_ifa->ifa_ifp == NULL)
return (0);
 
+   if (ISSET(rt->rt_flags, RTF_GATEWAY) && !rtisvalid(rt->rt_gwroute))
+   return (0);
+
return (1);
 }
 
+/*
+ * Do the actual lookup for rtalloc(9), do not use directly!
+ *
+ * Return the best matching entry for the destination ``dst''.
+ *
+ * "RT_RESOLVE" means that a corresponding L2 entry should
+ *   be added to the routing table and resolved (via ARP or
+ *   NDP), if it does not exist.
+ *
+ * "RT_REPORT" indicates that a message should be sent to
+ *   userland if no matching route has been found or if an
+ *   error occured while adding a L2 entry.
+ */
 struct rtentry *
-rtalloc(struct sockaddr *dst, int flags, unsigned int tableid)
+rt_match(struct sockaddr *dst, int flags, unsigned int tableid)
 {
struct rtentry  *rt0, *rt = NULL;
struct rt_addrinfo   info;
@@ -336,6 +359,76 @@ rtalloc_mpath(struct sockaddr *dst, uint
 }
 #endif /* SMALL_KERNEL */
 
+/*
+ * Look in the routing table for the best matching entry for
+ * ``dst''.
+ *
+ * If a route with a gateway is found and its next hop is no
+ * longer valid, try to cache it.
+ */
+struct rtentry *
+rtalloc(struct sockaddr *dst, int flags, unsigned int rtableid)
+{
+   struct rtentry *rt, *nhrt;
+
+   rt = rt_match(dst, flags, rtableid);
+
+   /* No match or route to host?  We're done. */
+   if (rt == NULL || !ISSET(rt->rt_flags, RTF_GATEWAY))
+   return (rt);
+
+   /* Nothing to do if the next hop is valid. */
+   if (rtisvalid(rt->rt_gwroute))
+   return (rt);
+
+   rtfree(rt->rt_gwroute);
+   rt->rt_gwroute = NULL;
+
+   /*
+* If we cannot find a valid next hop, return the route
+* with a gateway.
+*
+* XXX Some dragons hiding in the tree certainly depends on
+* this behavior.  But it is safe since rt_checkgate() wont
+* allow us to us this route later on.
+*/
+   nhrt = rt_match(rt->rt_gateway, flags | RT_RESOLVE, rtableid);
+   if (nhrt == NULL)
+   return (rt);
+
+   /*
+* Next hop must be reachable, this also prevents rtentry
+* loops for example when rt->rt_gwroute points to rt.
+*/
+   if (ISSET(nhrt->rt_flags, RTF_CLONING|RTF_GATEWAY)) {
+   rtfree(nhrt);
+   return (rt);
+   }
+
+   /*
+* Next hop entry must be UP and on the same interface.
+*/
+   if (!ISSET(nhrt->rt_flags, RTF_UP) || nhrt->rt_ifidx != rt->rt_ifidx) {
+   rtfree(nhrt);
+   return (rt);
+   }
+
+   /*
+* If the MTU of next hop is 0, this will reset the MTU of the
+* route to run PMTUD again from scratch.
+*/
+   if (!ISSET(rt->rt_locks, RTV_MTU) && (rt->rt_mtu > nhrt->rt_mtu))
+   rt->rt_mtu = nhrt->rt_mtu;
+
+   /*
+* Do not return the cached next-hop route, rt_checkgate() will
+* do the magic for us.
+*/
+   rt->rt_gwroute = nhrt;
+
+   return (rt);
+}
+
 void
 rtref(struct rtentry *rt)
 {
@@ -499,7 +592,7 @@ create:
rt->rt_flags |= RTF_MODIFIED;
flags |= RTF_MODIFIED;
  

Re: [PATCH] intro(8) - corrections and update

2015-11-04 Thread Raf Czlonka
On Wed, Nov 04, 2015 at 11:57:39AM GMT, Stuart Henderson wrote:
> On 2015/11/04 10:56, Raf Czlonka wrote:
> > @@ -141,7 +145,7 @@ If using a caching name server, add the 
> >  Relevant
> >  .Xr rc.conf 8
> >  variables:
> > -.Va named_flags
> > +.Va nsd_flags
> >  and
> >  .Va unbound_flags .
> 
> Hmm. This section is a bit weird.
> 
>  If you are using a name server, check the /etc/resolv.conf file.  It may
>  look something like:
> 
>domain nts.umn.edu
>nameserver 128.101.101.101
>nameserver 134.84.84.84
>search nts.umn.edu. umn.edu.
>lookup file bind
> 
>  If using a caching name server, add the line "nameserver 127.0.0.1"
>  first.
> 
> Most name servers that people will list in resolv.conf are caching
> name servers, and they don't need to be on localhost..
> 
>  Relevant rc.conf(8) variables: named_flags and unbound_flags.
> 
> Just going by the section name "Domain Name Server (DNS)" nsd_flags
> fits, but the text only talks about resolvers. Would it make any kind
> of sense to split this into "DNS resolver" and "Authoritative DNS"?
> There is also rebound(8) to mention, which runs on localhost, but
> is not a caching server.

I had similar thoughts regarding this section but wasn't sure what would
be the best way to modify it, so in the end decided to only bring it
back to date with named -> nsd change.

Given that rebound is not enabled yet, I didn't want to jump the gun.

> > @@ -224,6 +228,7 @@ variables:
> >  .Ss Routing Daemons
> >  Various daemons for managing routing tables are available:
> >  .Xr bgpd 8 ,
> > +.Xr eigrpd 8 ,
> >  .Xr ospfd 8 ,
> >  and
> >  .Xr ripd 8 .
> 
> This text makes it look like an exhaustive list. I'd either add
> the word "including" or add the others - in either case ospf6d could
> do with being added.

I was also thinking about the IPv6 counterparts but though that adding
*those* might make it exhaustive ;^)

> Might be better, though, to go with something like "Various daemons
> for managing dynamic routing are available" (i.e. not saying "routing
> tables") and include ldpd.

As above, I only added eigrpd to bring the man page up to date.

In terms of the man page as a whole, I didn't want to make too many
drastic changes as jmc appears to have been the main contributor here in
the past and very recently, and I didn't want to step on his toes.

As you can see, I was erring on the side of caution :^)

Regards,

Raf



cron: clean up includes

2015-11-04 Thread Todd C. Miller
This changes cron from including all headers in every file to only
including what each .c file needs.  I have not removed cron.h since
it will be used in a future clean up of the internal .h files.

 - todd

Index: usr.sbin/cron/atrun.c
===
RCS file: /cvs/src/usr.sbin/cron/atrun.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 atrun.c
--- usr.sbin/cron/atrun.c   25 Oct 2015 21:30:11 -  1.33
+++ usr.sbin/cron/atrun.c   4 Nov 2015 15:48:07 -
@@ -20,9 +20,33 @@
  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
  */
 
-#include "cron.h"
-#include 
+#include 
 #include 
+#include 
+#include 
+
+#include  /* for structs.h */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "config.h"
+#include "pathnames.h"
+#include "macros.h"
+#include "structs.h"
+#include "funcs.h"
+#include "globals.h"
 
 static void unlink_job(at_db *, atjob *);
 static void run_job(atjob *, char *);
Index: usr.sbin/cron/client.c
===
RCS file: /cvs/src/usr.sbin/cron/client.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 client.c
--- usr.sbin/cron/client.c  3 Nov 2015 04:16:36 -   1.2
+++ usr.sbin/cron/client.c  4 Nov 2015 15:48:07 -
@@ -17,7 +17,23 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cron.h"
+#include 
+#include 
+#include 
+
+#include  /* for structs.h */
+#include 
+#include 
+#include 
+#include   /* for structs.h */
+#include 
+#include 
+
+#include "pathnames.h"
+#include "macros.h"
+#include "structs.h"
+#include "funcs.h"
+#include "globals.h"
 
 /* int in_file(const char *string, FILE *file, int error)
  * return TRUE if one of the lines in file matches string exactly,
Index: usr.sbin/cron/common.c
===
RCS file: /cvs/src/usr.sbin/cron/common.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 common.c
--- usr.sbin/cron/common.c  31 Oct 2015 12:19:41 -  1.1
+++ usr.sbin/cron/common.c  4 Nov 2015 15:48:07 -
@@ -17,7 +17,25 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cron.h"
+#include 
+#include 
+
+#include  /* for structs.h */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "config.h"
+#include "pathnames.h"
+#include "macros.h"
+#include "structs.h"
+#include "funcs.h"
+#include "globals.h"
 
 void
 set_cron_cwd(void)
Index: usr.sbin/cron/cron.c
===
RCS file: /cvs/src/usr.sbin/cron/cron.c,v
retrieving revision 1.61
diff -u -p -u -r1.61 cron.c
--- usr.sbin/cron/cron.c4 Nov 2015 12:53:05 -   1.61
+++ usr.sbin/cron/cron.c4 Nov 2015 15:48:07 -
@@ -19,7 +19,29 @@
 
 #defineMAIN_PROGRAM
 
-#include "cron.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "config.h"
+#include "pathnames.h"
+#include "macros.h"
+#include "structs.h"
+#include "funcs.h"
+#include "globals.h"
 
 enum timejump { negative, small, medium, large };
 
Index: usr.sbin/cron/cron.h
===
RCS file: /cvs/src/usr.sbin/cron/cron.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 cron.h
--- usr.sbin/cron/cron.h6 Oct 2015 14:58:37 -   1.11
+++ usr.sbin/cron/cron.h4 Nov 2015 15:48:07 -
@@ -17,9 +17,7 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define CRON_VERSION "V5.0"
 #include "config.h"
-#include "externs.h"
 #include "pathnames.h"
 #include "macros.h"
 #include "structs.h"
Index: usr.sbin/cron/crontab.c
===
RCS file: /cvs/src/usr.sbin/cron/crontab.c,v
retrieving revision 1.81
diff -u -p -u -r1.81 crontab.c
--- usr.sbin/cron/crontab.c 3 Nov 2015 21:10:08 -   1.81
+++ usr.sbin/cron/crontab.c 4 Nov 2015 15:48:07 -
@@ -17,18 +17,34 @@
  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include 
-
 #defineMAIN_PROGRAM
 
-#include "cron.h"
+#include 
+#include 
+#include 
+
+#include  /* for structs.h */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pathnames.h"
+#include "macros.h"
+#include "structs.h"
+#include "funcs.h"
+#include "globals.h"
 
 #define NHEADER_LINES 3
 
 enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace };
 
-static char*getoptargs = "u:ler";
-
 static pid_t   Pid;
 static gid_t   

Re: usbdump, a tool to print usb descriptor

2015-11-04 Thread Martin Pieuchot
On 25/10/15(Sun) 12:10, Ludovic Coues wrote:
> Usbdump is the result of my work during this summer of code.
> It is a tool inspired by pcidump. It reads usb device descriptor and
> print them with a bit of parsing. It aim to be a more friendly
> alternative to lsusb.

I'd like to have an alternative to lsusb in base, simply to be able to
debug USB-related problem without the need of installing a port.

What do you mean by "more friendly"?  Right now I have a hard time
reading the output of the tool :)

> There is two main difference with pcidump, boiling down to the nature of
> the usb protocol.
> First, an usb device does not provide a block of data like a pci
> ddevice. It provide many piece of data, the descriptors. So the data
> have to be fetched piece by piece.
> Second, there is a few standard descriptors and many more specific to
> certain class of device. In its current state, usbdump is far from
> showing parsed data about most of these.
> 
> In the future, I would like to add the ability show the data send by usb
> device inside this tool, to make it more useful at troubleshooting.

Something like tcpdump for USB?  This would be really awesome.

> As there there is nearly 3,000 lines, I will link to the sources.
> It's available at http://home.jellycopter.net/usbdump . usbdump.tar.gz
> is an archive of the directory, minus the archive. Full history
> is hosted at http://home.jellycopter.net/repo/usbdump .
> 
> I hope this will be useful.

I believe it can be really useful.  However I don't think we need both
usbdevs(8) and usbdump(8) in base.  Is your tool a drop-in replacement?

Concerning the functionalities, I don't see the port hub status flags,
this is really useful to be able to debug hub issues.  Here's what lsusb
prints:

 Hub Port Status:
   Port 1: .0503 highspeed power enable connect
   Port 2: .0500 highspeed power

Regarding your code style(9) is not respected, simply running indent(1)
should give you some hints ;)

I would also recommend against mixing custom ioctl & USB request to fetch
the information you need.

I also think that mixing descriptor parsing and I/O is not a good idea.
You should rather fetch all the data you need then parse it, rather than
calling getstring() for example in the middle of your parser.  This would
allow to structure properly your code since USB data structure are defined
by standard an independent from the kernel/OS interface.

Finally I'd use more tables to map enums to strings and less printf()
calls, this would also help changing the final output without digging in
every function to find the corresponding printf() ;) 

I'd happily help if this was hosted in a VCS I can use (git or cvs).  Maybe
others would like to help too?  What about putting this on github or similar
in order to polish it?

Martin



Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Noth

Got my first beta board today, here's the dmesg:

OpenBSD 5.8 (GENERIC.MP) #1: Mon Oct 19 02:13:53 CEST 2015
r...@openbsd64.nineinchnetworks.ch:/root/binpatchng-2.1.2/work-binpatch58-amd64/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4261081088 (4063MB)
avail mem = 4128047104 (3936MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdffb7020 (7 entries)
bios0: vendor coreboot version "APU2A_20150924-3-g0bf9198-dirty" date 
09/28/2015

bios0: PC Engines apu2
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S2 S3 S4 S5
acpi0: tables DSDT FACP SSDT APIC HEST SSDT SSDT HPET
acpi0: wakeup devices PWRB(S4) PBR4(S4) PBR5(S4) PBR6(S4) PBR7(S4) 
PBR8(S4) UOH1(S3) UOH3(S3) UOH5(S3) XHC0(S4)

acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD GX-412TC SOC, 998.27 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu0: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD GX-412TC SOC, 998.13 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu1: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu1: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu1: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: AMD GX-412TC SOC, 998.13 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu2: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu2: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu2: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: AMD GX-412TC SOC, 998.17 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu3: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu3: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu3: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 4 pa 0xfec0, version 21, 24 pins
ioapic1 at mainbus0: apid 5 pa 0xfec2, version 21, 32 pins
ioapic1: misconfigured as apic 0, remapped to apid 5
acpihpet0 at acpi0: 14318180 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PBR4)
acpiprt2 at acpi0: bus 1 (PBR5)
acpiprt3 at acpi0: bus 2 (PBR6)
acpiprt4 at acpi0: bus 3 (PBR7)
acpiprt5 at acpi0: bus -1 (PBR8)
acpicpu0 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu1 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu2 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu3 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpibtn0 at acpi0: PWRB
cpu0: 998 MHz: speeds: 1000 800 600 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 vendor "AMD", unknown product 0x1566 rev 0x00
pchb1 at pci0 dev 2 function 0 vendor "AMD", unknown product 0x156b rev 0x00
ppb0 at pci0 dev 2 function 2 "AMD AMD64 16h PCIE" rev 0x00: msi
pci1 at ppb0 bus 1
em0 at pci1 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0c

ppb1 at pci0 dev 2 function 3 "AMD AMD64 16h PCIE" rev 0x00: msi
pci2 at ppb1 bus 2
em1 at pci2 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0d

ppb2 at pci0 dev 2 function 4 "AMD AMD64 16h PCIE" rev 0x00: msi
pci3 at ppb2 bus 3
em2 at pci3 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0e
vendor 

Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Noth

This is with the -CURRENT :

OpenBSD 5.8-current (GENERIC.MP) #0: Wed Nov  4 17:47:40 CET 2015
r...@euryale.nineinchnetworks.ch:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4261081088 (4063MB)
avail mem = 4127813632 (3936MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdffb7020 (7 entries)
bios0: vendor coreboot version "APU2A_20150924-3-g0bf9198-dirty" date 
09/28/2015

bios0: PC Engines apu2
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S2 S3 S4 S5
acpi0: tables DSDT FACP SSDT APIC HEST SSDT SSDT HPET
acpi0: wakeup devices PWRB(S4) PBR4(S4) PBR5(S4) PBR6(S4) PBR7(S4) 
PBR8(S4) UOH1(S3) UOH3(S3) UOH5(S3) XHC0(S4)

acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD GX-412TC SOC, 998.27 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu0: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu0: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu0: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD GX-412TC SOC, 998.11 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu1: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu1: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu1: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: AMD GX-412TC SOC, 998.11 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu2: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu2: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu2: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: AMD GX-412TC SOC, 998.11 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,NXE,MMXX,FFXSR,PAGE1GB,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,SKINIT,TOPEXT,ITSC,BMI1
cpu3: 32KB 64b/line 2-way I-cache, 32KB 64b/line 8-way D-cache, 2MB 
64b/line 16-way L2 cache

cpu3: ITLB 32 4KB entries fully associative, 8 4MB entries fully associative
cpu3: DTLB 40 4KB entries fully associative, 8 4MB entries fully associative
cpu3: smt 0, core 3, package 0
ioapic0 at mainbus0: apid 4 pa 0xfec0, version 21, 24 pins
ioapic1 at mainbus0: apid 5 pa 0xfec2, version 21, 32 pins
ioapic1: misconfigured as apic 0, remapped to apid 5
acpihpet0 at acpi0: 14318180 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PBR4)
acpiprt2 at acpi0: bus 1 (PBR5)
acpiprt3 at acpi0: bus 2 (PBR6)
acpiprt4 at acpi0: bus 3 (PBR7)
acpiprt5 at acpi0: bus -1 (PBR8)
acpicpu0 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu1 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu2 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpicpu3 at acpi0: !C2(0@400 io@0x1771), C1(@1 halt!), PSS
acpibtn0 at acpi0: PWRB
cpu0: 998 MHz: speeds: 1000 800 600 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "AMD AMD64 16h Root Complex" rev 0x00
pchb1 at pci0 dev 2 function 0 "AMD AMD64 16h Host" rev 0x00
ppb0 at pci0 dev 2 function 2 "AMD AMD64 16h PCIE" rev 0x00: msi
pci1 at ppb0 bus 1
em0 at pci1 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0c

ppb1 at pci0 dev 2 function 3 "AMD AMD64 16h PCIE" rev 0x00: msi
pci2 at ppb1 bus 2
em1 at pci2 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0d

ppb2 at pci0 dev 2 function 4 "AMD AMD64 16h PCIE" rev 0x00: msi
pci3 at ppb2 bus 3
em2 at pci3 dev 0 function 0 "Intel I210" rev 0x03: msi, address 
00:0d:b9:3f:9e:0e

"AMD CCP" rev 0x00 at pci0 dev 8 function 0 not configured
xhci0 at pci0 dev 16 

Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Adam Van Ymeren
On Sat, Oct 31, 2015 at 2:29 PM, Theo de Raadt  wrote:
>>Whilst browsing their forums I found a link to this:
>> http://pcengines.ch/apu2b4.htm . AMD Jaguar APU, 4 cores, up to 4Gb
>> DDR1333 ram with ECC, and 3 intel i211 or i210 NICs. Hopefully there
>> won't be so many issues with this iteration of their APU series.
>
> Hopefully.
>
> It would be nice if some developers get some early, to verify this.
> Otherwise, I agree, there could be lots of pain once again.
>

I don't know the details of PC Engine's beta program, but if any
developers need a hardware donation let me know and I'll try to help.



Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Stuart Henderson
this will probably get you a cpu temperature sensor.

Index: km.c
===
RCS file: /cvs/src/sys/dev/pci/km.c,v
retrieving revision 1.10
diff -u -p -r1.10 km.c
--- km.c14 Mar 2015 03:38:48 -  1.10
+++ km.c4 Nov 2015 17:44:25 -
@@ -72,7 +72,8 @@ static const struct pci_matchid km_devic
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_14_MISC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_0x_MISC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_1x_MISC },
-   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC }
+   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC },
+   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_3X_MISC }
 };
 
 



Re: wc does not count last line if no trailing newline present

2015-11-04 Thread Jack J. Woehr

Mike Burns wrote:

It's not a "source file" unless it ends with a newline. Somewhere along
the way "source file" -> "text file."

"Source file" in 1980's Unix docs in context was understood to mean "the file 
which is the source of the
text being counted", not "a file of source code for a compiler or interpreter".

We would probably call it today a "target file".

--
Jack J. Woehr # Science is more than a body of knowledge. It's a way of
www.well.com/~jax # thinking, a way of skeptically interrogating the universe
www.softwoehr.com # with a fine understanding of human fallibility. - Carl Sagan



Re: wc does not count last line if no trailing newline present

2015-11-04 Thread Mike Burns
On 2015-11-04 01.05.38 -0500, dan mclaughlin wrote:
> On Tue, 3 Nov 2015 21:01:36 -0800 Philip Guenther  wrote:
> > ...but it's not a bug.  wc's line count is required by POSIX to be a
> > count of the number of newline characters in the involved input.
> 
> out of curiosity, do you know why? some historic artifact?

https://gcc.gnu.org/ml/gcc/2003-11/msg01568.html

It's not a "source file" unless it ends with a newline. Somewhere along
the way "source file" -> "text file."



Re: [patch] tcpdump print-tcp printf format tweaks

2015-11-04 Thread Jérémie Courrèges-Anglas
Kevin Reay  writes:

> Change printf format to print unsigned values. Minor spacing change of
> casts to match file/style(9).
>
> Attempted to match printf formating of unsigned 32bits to rest of
> file.

I don't think this is the good direction.  "seq" and "length" are 32bits
integers.  Why cast them to long, and then print them as unsigned long?
Let's just print them as unsigned int.

"ack" and "win" are unsigned shorts.  They can be printed using %u since
they are automatically promoted to unsigned ints.

Thoughts?

Index: print-tcp.c
===
RCS file: /cvs/src/usr.sbin/tcpdump/print-tcp.c,v
retrieving revision 1.33
diff -u -p -p -u -r1.33 print-tcp.c
--- print-tcp.c 20 Aug 2015 22:39:29 -  1.33
+++ print-tcp.c 4 Nov 2015 18:01:51 -
@@ -221,7 +221,7 @@ tcp_print(register const u_char *bp, reg
 
ch = '\0';
if (length < sizeof(*tp)) {
-   (void)printf("truncated-tcp %d", length);
+   (void)printf("truncated-tcp %u", length);
return;
}
 
@@ -476,15 +476,14 @@ tcp_print(register const u_char *bp, reg
 
length -= hlen;
if (vflag > 1 || length > 0 || flags & (TH_SYN | TH_FIN | TH_RST))
-   (void)printf(" %lu:%lu(%d)", (long) seq, (long) (seq + length),
-   length);
+   (void)printf(" %u:%u(%u)", seq, seq + length, length);
if (flags & TH_ACK)
(void)printf(" ack %u", ack);
 
-   (void)printf(" win %d", win);
+   (void)printf(" win %u", win);
 
if (flags & TH_URG)
-   (void)printf(" urg %d", urp);
+   (void)printf(" urg %u", urp);
/*
 * Handle any options.
 */


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Noth

Thanks Stuart, that works for me!

# sysctl hw
hw.machine=amd64
hw.model=AMD GX-412TC SOC
hw.ncpu=4
hw.byteorder=1234
hw.pagesize=4096
hw.disknames=sd0:47e18331a1a8156e
hw.diskcount=1
hw.sensors.km0.temp0=59.38 degC
hw.cpuspeed=998
hw.setperf=100
hw.vendor=PC Engines
hw.product=apu2
hw.version=1.0
hw.serialno=123456789
hw.physmem=4261081088
hw.usermem=4261056512
hw.ncpufound=4
hw.allowpowerdown=1
hw.perfpolicy=manual

On 04/11/15 18:47, Stuart Henderson wrote:

this will probably get you a cpu temperature sensor.

Index: km.c
===
RCS file: /cvs/src/sys/dev/pci/km.c,v
retrieving revision 1.10
diff -u -p -r1.10 km.c
--- km.c14 Mar 2015 03:38:48 -  1.10
+++ km.c4 Nov 2015 17:44:25 -
@@ -72,7 +72,8 @@ static const struct pci_matchid km_devic
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_14_MISC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_0x_MISC },
{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_1x_MISC },
-   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC }
+   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC },
+   { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_3X_MISC }
  };
  
  





Re: [patch] tcpdump print-tcp printf format tweaks

2015-11-04 Thread Kevin Reay
> > Attempted to match printf formating of unsigned 32bits to rest of
> > file.
> 
> I don't think this is the good direction.  "seq" and "length" are 32bits
> integers.  Why cast them to long, and then print them as unsigned long?
> Let's just print them as unsigned int.

That sounds good to me. I'll create another patch.

Do you think it's worth cleaning up the existing long cast/print
formats that exist elsewhere in the file?



Re: ftp(1): pledge smaller subset in SMALL version

2015-11-04 Thread Jérémie Courrèges-Anglas
j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

> Frederic Nowak  writes:
>
>> Hi there,
>
> Hi,
>
>> at the moment ftp pledges "proc exec" in its SMALL version, but not
>> otherwise. This seems wrong, because the SMALL version does not support
>> interactive mode (which needs "proc exec" for e.g. the page command),
>> while the !SMALL version does.
>> The patch below switches the two pledges, so that the SMALL version
>> pledges a smaller subset.
>
> I can confirm that it is possible to have ftp(1) killed by pledge in the
> non-SMALL build.
>
> The diff looks correct and I doubt that there's a risk for it to
> introduce further regressions.  However there's a popen() call in
> recvrequest() that could trigger pledge protection.  If anyone wants to
> make sense of that code, be my guest...

Since no one stepped up to investigate this issue, I committed your diff
as is.  Thanks!

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: PC Engines APU2 coming soon - how is OpenBSD's support so far?

2015-11-04 Thread Chris Cappuccio
Noth,
I got my APU (first rev) to go from 56-58 temps down to 49-50 by using heatsink 
paste instead of the thermal pad...

Noth [nothingn...@citycable.ch] wrote:
> Thanks Stuart, that works for me!
> 
> # sysctl hw
> hw.machine=amd64
> hw.model=AMD GX-412TC SOC
> hw.ncpu=4
> hw.byteorder=1234
> hw.pagesize=4096
> hw.disknames=sd0:47e18331a1a8156e
> hw.diskcount=1
> hw.sensors.km0.temp0=59.38 degC
> hw.cpuspeed=998
> hw.setperf=100
> hw.vendor=PC Engines
> hw.product=apu2
> hw.version=1.0
> hw.serialno=123456789
> hw.physmem=4261081088
> hw.usermem=4261056512
> hw.ncpufound=4
> hw.allowpowerdown=1
> hw.perfpolicy=manual
> 
> On 04/11/15 18:47, Stuart Henderson wrote:
> >this will probably get you a cpu temperature sensor.
> >
> >Index: km.c
> >===
> >RCS file: /cvs/src/sys/dev/pci/km.c,v
> >retrieving revision 1.10
> >diff -u -p -r1.10 km.c
> >--- km.c 14 Mar 2015 03:38:48 -  1.10
> >+++ km.c 4 Nov 2015 17:44:25 -
> >@@ -72,7 +72,8 @@ static const struct pci_matchid km_devic
> > { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_14_MISC },
> > { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_0x_MISC },
> > { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_15_1x_MISC },
> >-{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC }
> >+{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_MISC },
> >+{ PCI_VENDOR_AMD, PCI_PRODUCT_AMD_AMD64_16_3X_MISC }
> >  };
> >



Re: cron: clean up includes

2015-11-04 Thread Nicholas Marriott

Looks great, ok nicm


On Wed, Nov 04, 2015 at 08:50:37AM -0700, Todd C. Miller wrote:
> This changes cron from including all headers in every file to only
> including what each .c file needs.  I have not removed cron.h since
> it will be used in a future clean up of the internal .h files.
> 
>  - todd
> 
> Index: usr.sbin/cron/atrun.c
> ===
> RCS file: /cvs/src/usr.sbin/cron/atrun.c,v
> retrieving revision 1.33
> diff -u -p -u -r1.33 atrun.c
> --- usr.sbin/cron/atrun.c 25 Oct 2015 21:30:11 -  1.33
> +++ usr.sbin/cron/atrun.c 4 Nov 2015 15:48:07 -
> @@ -20,9 +20,33 @@
>   * Materiel Command, USAF, under agreement number F39502-99-1-0512.
>   */
>  
> -#include "cron.h"
> -#include 
> +#include 
>  #include 
> +#include 
> +#include 
> +
> +#include/* for structs.h */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "config.h"
> +#include "pathnames.h"
> +#include "macros.h"
> +#include "structs.h"
> +#include "funcs.h"
> +#include "globals.h"
>  
>  static void unlink_job(at_db *, atjob *);
>  static void run_job(atjob *, char *);
> Index: usr.sbin/cron/client.c
> ===
> RCS file: /cvs/src/usr.sbin/cron/client.c,v
> retrieving revision 1.2
> diff -u -p -u -r1.2 client.c
> --- usr.sbin/cron/client.c3 Nov 2015 04:16:36 -   1.2
> +++ usr.sbin/cron/client.c4 Nov 2015 15:48:07 -
> @@ -17,7 +17,23 @@
>   * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include "cron.h"
> +#include 
> +#include 
> +#include 
> +
> +#include/* for structs.h */
> +#include 
> +#include 
> +#include 
> +#include /* for structs.h */
> +#include 
> +#include 
> +
> +#include "pathnames.h"
> +#include "macros.h"
> +#include "structs.h"
> +#include "funcs.h"
> +#include "globals.h"
>  
>  /* int in_file(const char *string, FILE *file, int error)
>   *   return TRUE if one of the lines in file matches string exactly,
> Index: usr.sbin/cron/common.c
> ===
> RCS file: /cvs/src/usr.sbin/cron/common.c,v
> retrieving revision 1.1
> diff -u -p -u -r1.1 common.c
> --- usr.sbin/cron/common.c31 Oct 2015 12:19:41 -  1.1
> +++ usr.sbin/cron/common.c4 Nov 2015 15:48:07 -
> @@ -17,7 +17,25 @@
>   * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include "cron.h"
> +#include 
> +#include 
> +
> +#include/* for structs.h */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "config.h"
> +#include "pathnames.h"
> +#include "macros.h"
> +#include "structs.h"
> +#include "funcs.h"
> +#include "globals.h"
>  
>  void
>  set_cron_cwd(void)
> Index: usr.sbin/cron/cron.c
> ===
> RCS file: /cvs/src/usr.sbin/cron/cron.c,v
> retrieving revision 1.61
> diff -u -p -u -r1.61 cron.c
> --- usr.sbin/cron/cron.c  4 Nov 2015 12:53:05 -   1.61
> +++ usr.sbin/cron/cron.c  4 Nov 2015 15:48:07 -
> @@ -19,7 +19,29 @@
>  
>  #define  MAIN_PROGRAM
>  
> -#include "cron.h"
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "config.h"
> +#include "pathnames.h"
> +#include "macros.h"
> +#include "structs.h"
> +#include "funcs.h"
> +#include "globals.h"
>  
>  enum timejump { negative, small, medium, large };
>  
> Index: usr.sbin/cron/cron.h
> ===
> RCS file: /cvs/src/usr.sbin/cron/cron.h,v
> retrieving revision 1.11
> diff -u -p -u -r1.11 cron.h
> --- usr.sbin/cron/cron.h  6 Oct 2015 14:58:37 -   1.11
> +++ usr.sbin/cron/cron.h  4 Nov 2015 15:48:07 -
> @@ -17,9 +17,7 @@
>   * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#define CRON_VERSION "V5.0"
>  #include "config.h"
> -#include "externs.h"
>  #include "pathnames.h"
>  #include "macros.h"
>  #include "structs.h"
> Index: usr.sbin/cron/crontab.c
> ===
> RCS file: /cvs/src/usr.sbin/cron/crontab.c,v
> retrieving revision 1.81
> diff -u -p -u -r1.81 crontab.c
> --- usr.sbin/cron/crontab.c   3 Nov 2015 21:10:08 -   1.81
> +++ usr.sbin/cron/crontab.c   4 Nov 2015 15:48:07 -
> @@ -17,18 +17,34 @@
>   * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
>  
> -#include 
> -
>  #define  MAIN_PROGRAM
>  
> -#include "cron.h"
> +#include 
> +#include 
> +#include 
> +
> +#include

tcpdump: stop building SLIP support

2015-11-04 Thread Jérémie Courrèges-Anglas

Some time ago mpi removed the sl(4) driver, IIUC this makes a bunch of
code useless in tcpdump.

The diff below only removes the define.  If people prefer, I could also
kill some noise by removing the useless code in print-sl.c, leaving only
the stub functions.

Comments / ok?

Index: Makefile
===
RCS file: /cvs/src/usr.sbin/tcpdump/Makefile,v
retrieving revision 1.59
diff -u -p -p -u -r1.59 Makefile
--- Makefile14 Oct 2015 04:55:17 -  1.59
+++ Makefile4 Nov 2015 18:05:23 -
@@ -28,7 +28,7 @@ CFLAGS+=-Wall -I${.CURDIR}/../../sbin/pf
 # for pcap-int.h
 CFLAGS+=-I${.CURDIR}/../../lib/libpcap
 
-CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_NET_SLIP_H 
-DHAVE_ETHER_NTOHOST -DINET6
+CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_ETHER_NTOHOST -DINET6
 
 LDADD+=-lpcap -ll -lcrypto
 DPADD+=${LIBL} ${LIBPCAP} ${LIBCRYPTO}


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: ld.so crash second attempt

2015-11-04 Thread Alf Schlichting
On Tue, 03 Nov 2015 10:46:57 +0100,
Philip Guenther wrote:
> 
> On Sun, 25 Oct 2015, Peter Hajdu wrote:
> > I try to give it one more attempt with a bit more description about the 
> > bug.
> > 
> > After calling dlclose in _dl_notify_unload_shlib_ group reference counts 
> > are decreased by following the object's grpref-list.  Unfortunately the 
> > references are removed from the list during the graph traversal.
> > 
> > dlclose will run all destructors of the unused objects and tries to 
> > unload all objects reachable from the closed object's child and 
> > grpref-list.  Since the grpref-list references were removed, the unused 
> > destructed object stays in memory as garbage.  Next time when this 
> > object is loaded it is found in the memory and crashes during load.
> > 
> > This patch unloads all unused objects instead of following the closed 
> > object's child and grpref list.
> 
> Thank you for working on this.  After a long rumination, I'd like to 
> propose a different diff, seen below.
> 
> Your diff changes dlclose() to switch from calling _dl_unload_shlib() to a 
> new function _dl_unload_unused().  They both unload refcnt==0 objects: 
> _dl_unload_shlib() finds them by walking the dependency tree from the 
> selected object, while _dl_unload_unused() just scans the entire list.
> 
> So why is the former not sufficient?  As you describe, the problem occurs 
> when a grpref is removed which is the last reference to an object. grprefs 
> are used guarantee that entire load groups are unloaded all at once and 
> not piecemeal.  If later dlopen() adds a dependency to a child in this 
> load group, the entire group will be kept even if that child is the last 
> real link.  When that dependency is added, the later object takes a grpref 
> to the load_object, which is root of the load group.
> 
> As you note _dl_run_all_dtors() releases that grpref, but we still know 
> where it had pointed: to the load_object of some object being released!  
> So we can retain the behavior of _dl_unload_shlib(), but we need to add a 
> check for whether our load_object is now unreferenced.  If so, it 
> previously had a grpref which has been released, so we need to take down 
> the entire load group.
> 
> Thus the diff below.  It works with your test setup (thanks for writing 
> that!), passes regress/libexec/ld.so/, and chrome hasn't choked on it.  
> Can someone who's familiar with the sdl problem case test it there?
> 
> 
> Does that make sense?
> 
> 
> Again, thank you for pushing on this.  If what I show here works, it's 
> because your description triggered an "ahhh, wait a moment..." thought.
> 
> 
> Philip
> 

sdl2 (the old, marked-as-broken) port and sdl2 apps start and work
with this patch on amd64 -current.

Thx,
Alf

> 
> Index: library.c
> ===
> RCS file: /data/src/openbsd/src/libexec/ld.so/library.c,v
> retrieving revision 1.71
> diff -u -p -r1.71 library.c
> --- library.c 16 Jan 2015 16:18:07 -  1.71
> +++ library.c 3 Nov 2015 09:09:15 -
> @@ -59,9 +59,27 @@ void
>  _dl_unload_shlib(elf_object_t *object)
>  {
>   struct dep_node *n;
> + elf_object_t *load_object = object->load_object;
> +
> + /*
> +  * If our load object has become unreferenced then we lost the
> +  * last group reference to it, so the entire group should be taken
> +  * down.  The current object is somewhere below load_object in
> +  * the child_list tree, so it'll get cleaned up by the recursion.
> +  * That means we can just switch here to the load object.
> +  */
> + if (load_object != object && OBJECT_REF_CNT(load_object) == 0 &&
> + (load_object->status & STAT_UNLOADED) == 0) {
> + DL_DEB(("unload_shlib switched from %s to %s\n",
> + object->load_name, load_object->load_name));
> + object = load_object;
> + goto unload;
> + }
> +
>   DL_DEB(("unload_shlib called on %s\n", object->load_name));
>   if (OBJECT_REF_CNT(object) == 0 &&
>   (object->status & STAT_UNLOADED) == 0) {
> +unload:
>   object->status |= STAT_UNLOADED;
>   TAILQ_FOREACH(n, >child_list, next_sib)
>   _dl_unload_shlib(n->data);
> Index: library_mquery.c
> ===
> RCS file: /data/src/openbsd/src/libexec/ld.so/library_mquery.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 library_mquery.c
> --- library_mquery.c  22 Jan 2015 05:48:17 -  1.49
> +++ library_mquery.c  3 Nov 2015 09:10:39 -
> @@ -64,10 +64,27 @@ void
>  _dl_unload_shlib(elf_object_t *object)
>  {
>   struct dep_node *n;
> + elf_object_t *load_object = object->load_object;
> +
> + /*
> +  * If our load object has become unreferenced then we lost the
> +  * last group reference to it, so the entire group should be taken
> +  * down.  The current object is 

Re: [PATCH] intro(8) - corrections and update

2015-11-04 Thread Raf Czlonka
On Wed, Nov 04, 2015 at 07:47:38AM GMT, Jason McIntyre wrote:
> On Wed, Nov 04, 2015 at 03:14:56AM +, Raf Czlonka wrote:
> > Hi all,
> > 
> > Some explanation regarding the changes:
> > 
> > - might -> "needs to" - it has to be there, no "might" about it :^)
> > - I've added the additional httpd_flags example back - without it, the
> >   following sentence doesn't make sense. Alternatively the "As can be
> >   seen..." sentence can be removed entirely.
> > - even though "package" hadn't, most likely, been used literally the
> >   words means has a special meaning in OpenBSD, which may lead to some
> >   confusion
> > - since the DNS is being used in brackets, let's expand it properly
> > - named -> nsd has been missed when unbound's been added to the man page
> > - since eigrpd appeared recently, it's a good excuse to add it here
> > - "being running" doesn't sound good
> > 
> > Regards,
> > 
> > Raf
> > 
> > Index: share/man/man8/intro.8
> > ===
> > RCS file: /cvs/src/share/man/man8/intro.8,v
> > retrieving revision 1.26
> > diff -u -p -r1.26 intro.8
> > --- share/man/man8/intro.8  21 Sep 2015 09:23:35 -  1.26
> > +++ share/man/man8/intro.8  4 Nov 2015 02:23:45 -
> > @@ -90,11 +90,14 @@ file overrides variable assignments in
> >  .Xr rc.conf 8 .
> >  So to enable
> >  .Xr httpd 8 ,
> > -the following line might be added to
> > +the following line needs to be added to
> 
> this is not really correct. the "might" indicates this is one way to
> enable httpd. as you show yourself immediately below, there are other
> ways.

I specifically meant that the empty 'httpd_flags' enables httpd, and
most other daemons but clearly I don't read "might" in "To enable httpd,
the following line might be added", the same way :^)

> >  .Pa /etc/rc.conf.local :
> >  .Bd -literal -offset indent
> >  httpd_flags=""
> >  .Ed
> > +or
> > +.Bd -literal -offset indent -compact
> > +httpd_flags="-vv"
> 
> without your initial change, this would be unneccessary.

Yep. As I've mentioned earlier, I had only added it back so that the
sentence, which follows it, can be kept intact.

Also, I had missed the end display context there.

> >  .Pp
> >  As can be seen above,
> >  this method is also used to specify additional options.
> > @@ -106,7 +109,7 @@ and the individual pages for the utiliti
> >  .Ss Automounter daemon (amd)
> >  If using the
> >  .Xr amd 8
> > -package,
> > +daemon,
> 
> yes, i agree this is a better choice of words.
> 
> >  go into the
> >  .Pa /etc/amd
> >  directory and set it up by
> > @@ -123,7 +126,7 @@ variables:
> >  .Va amd_flags
> >  and
> >  .Va amd_master .
> > -.Ss Domain Name Server (DNS)
> > +.Ss Domain Name System (DNS)
> 
> that reads better in one way, but worse in another. i honestly think
> it's fine as-is. we could change it to "DNS server" i guess. or servers.

Sure, I only meant the correct expansion of the initialism - especially
since the former is in all caps, and not, i.e. Domain Name server.

However, given that the man page already contains BOOTP/DHCP and NFS
servers in subsection headers, I agree that DNS server simply fits
better.

> >  If you are using a name server, check the
> >  .Pa /etc/resolv.conf
> >  file.
> > @@ -141,7 +144,7 @@ If using a caching name server, add the 
> >  Relevant
> >  .Xr rc.conf 8
> >  variables:
> > -.Va named_flags
> > +.Va nsd_flags
> >  and
> >  .Va unbound_flags .
> >  .Ss Clock synchronisation
> > @@ -224,6 +227,7 @@ variables:
> >  .Ss Routing Daemons
> >  Various daemons for managing routing tables are available:
> >  .Xr bgpd 8 ,
> > +.Xr eigrpd 8 ,
> >  .Xr ospfd 8 ,
> >  and
> >  .Xr ripd 8 .
> > @@ -232,13 +236,14 @@ Relevant
> >  .Xr rc.conf 8
> >  variables:
> >  .Va bgpd_flags ,
> > +.Va eigrpd_flags ,
> >  .Va ospfd_flags ,
> >  and
> >  .Va ripd_flags .
> >  .Ss RPC-based network services
> >  Several services depend on the RPC portmapper,
> >  .Xr portmap 8 ,
> > -being running for proper operation.
> > +running, for proper operation.
> 
> "being running" is correct. i agree it's a difficult concept though. but
> without it, you can read it as several services depend on rpc (running
> for proper operation), where the part i marked in brackets is "one
> thing".

Strange construct indeed - doesn't exactly roll off the tongue, at least
for me :^)

> >  This includes YP and NFS exports, among other services.
> >  .Pp
> >  Relevant
> >
> 
> jmc
> 

I've attached an updated patch, with only the "undisputed" parts :^)

Raf

Index: share/man/man8/intro.8
===
RCS file: /cvs/src/share/man/man8/intro.8,v
retrieving revision 1.26
diff -u -p -r1.26 intro.8
--- share/man/man8/intro.8  21 Sep 2015 09:23:35 -  1.26
+++ share/man/man8/intro.8  4 Nov 2015 10:55:48 -
@@ -95,6 +95,10 @@ the following line might be added to
 .Bd -literal -offset indent
 httpd_flags=""
 .Ed
+or
+.Bd -literal -offset 

Re: wc does not count last line if no trailing newline present

2015-11-04 Thread Ingo Schwarze
Hi,

Jason McIntyre wrote on Wed, Nov 04, 2015 at 07:51:30AM +:

> the clarity is good, but i worry that you're making a clear sentence
> harder to grasp. posix spec itself says -l counts "newline characters",
> which i find easier to understand in itself, but as flag -l i find it
> much easier to understand mentally that this option can count lines.
> 
> i guess we could leave the description as-is, but add a sentence to
> qualift this statement.

POSIX requires that a text file must end in a newline character -
if it doesn't, it is not a text file.

So we have the unusual situation here that POSIX specifies how a
specific utility must deal with a specific kind of invalid input.
More often, the behaviour for invalid input is left undefined.

Admittedly, this may seem somewhat confusing to people who don't
know POSIX.  If you want it clarified, we would have to apply the
following or a similar patch.  That *is* wordy, but making it shorter
will make it even more confusing:

 - If we explicitly talk about the fact that a string of characters
   not ending in a newline is not a line, we have to say that this
   is implied by the definition of the term "text file", or we
   provoke exactly the confusion Dan fell prey to, because many
   people will consider that definition counterintuitive.

 - If we dive down to this level of detail, saying just "a string
   of characters ending in a newline" is no longer enough because
   that would disallow empty lines, so "zero or more characters"
   is required.  Note that in the definition of a "word", "string
   of characters" without further qualification does indeed require
   at least one character.  Being extremely pedantic about invalid
   trailing characters but at the same time slightly imprecise about
   the much more common and perfectly legal case of empty lines
   seems like a very bad idea to me.

 - If we try to be that precise, the sentence about words is no
   longer correct.  If the file contains no whitespace character
   whatsoever, its content is still considered to be a word, even
   though it is not delimited by whitespace.  If we explicitly
   distinguish between "ended by newline" and "ended by EOF" in the
   definition of a line, than we have to apply the same precision
   to the definition of a word and can no longer expect "delimited
   by whitespace" to imply "delimited by EOF".

 - In any case, the word "maximal" is redundant and not helpful.
   If a string is not maximal, it is obviously not delimited by
   whitespace.

Do you want this?

Or do you say people should read POSIX to understand what a text
file and what a line is?

Yours,
  Ingo


Index: wc.1
===
RCS file: /cvs/src/usr.bin/wc/wc.1,v
retrieving revision 1.25
diff -u -p -r1.25 wc.1
--- wc.121 Apr 2015 10:46:48 -  1.25
+++ wc.14 Nov 2015 11:04:20 -
@@ -52,9 +52,12 @@ contained in each input file to the stan
 If more than one input file is specified,
 a line of cumulative count(s) for all named files is output on a
 separate line following the last file count.
-.Nm
-considers a word to be a maximal string of characters delimited by
-whitespace.
+.Pp
+In a text file, a line is a string of zero or more characters ending
+in a newline character, which means that trailing characters after
+the last newline character do not count as a line.
+A word is a string of characters delimited by whitespace or by the
+beginning or the end of the file.
 Whitespace characters are the set of characters for which the
 .Xr isspace 3
 function returns true.