CVS commit: src/share/man/man9

2017-06-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jun 30 05:22:14 UTC 2017

Modified Files:
src/share/man/man9: wsbell.9

Log Message:
Minor wording improvement, and use an apostrophe for possession.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man9/wsbell.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/wsbell.9
diff -u src/share/man/man9/wsbell.9:1.1 src/share/man/man9/wsbell.9:1.2
--- src/share/man/man9/wsbell.9:1.1	Tue Jun 13 06:27:10 2017
+++ src/share/man/man9/wsbell.9	Fri Jun 30 05:22:14 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: wsbell.9,v 1.1 2017/06/13 06:27:10 nat Exp $
+.\" $NetBSD: wsbell.9,v 1.2 2017/06/30 05:22:14 pgoyette Exp $
 .\"
 .\" Copyright (c) 2017 Nathanial Sloss 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 13, 2017
+.Dd June 30, 2017
 .Dt WSBELL 9
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ The
 .Nm
 module is a component of the
 .Xr wscons 9
-framework to provide keyboard-independent bell support.
+framework, providing keyboard-independent bell support.
 All of the support is provided by the
 .Xr wsbell 4
 device driver, which must be a child of the hardware device driver.
@@ -80,7 +80,7 @@ To attach the
 .Xr wsbell 4
 device, the speaker driver must allocate and populate a
 .Fa wsbelldev_attach_args
-structure with a pointer to the parents device structure as an access cookie
+structure with a pointer to the parent's device structure as an access cookie
 and call
 .Fn config_found
 to perform the attach (see



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 05:18:36 UTC 2017

Modified Files:
src/bin/ksh: edit.c

Log Message:
ksh: Eliminate dead function x_complete_word()


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/edit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.32 src/bin/ksh/edit.c:1.33
--- src/bin/ksh/edit.c:1.32	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/edit.c	Fri Jun 30 05:18:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $");
 #endif
 
 #include 
@@ -451,35 +451,6 @@ static char	*add_glob ARGS((const char *
 static void	glob_table ARGS((const char *, XPtrV *, struct table *));
 static void	glob_path ARGS((int, const char *, XPtrV *, const char *));
 
-#if 0 /* not used... */
-int	x_complete_word ARGS((const char *, int, int, int *, char **));
-int
-x_complete_word(str, slen, is_command, nwordsp, ret)
-	const char *str;
-	int slen;
-	int is_command;
-	int *nwordsp;
-	char **ret;
-{
-	int nwords;
-	int prefix_len;
-	char **words;
-
-	nwords = (is_command ? x_command_glob : x_file_glob)(XCF_FULLPATH,
-str, slen, );
-	*nwordsp = nwords;
-	if (nwords == 0) {
-		*ret = (char *) 0;
-		return -1;
-	}
-
-	prefix_len = x_longest_prefix(nwords, words);
-	*ret = str_nsave(words[0], prefix_len, ATEMP);
-	x_free_words(nwords, words);
-	return prefix_len;
-}
-#endif /* 0 */
-
 void
 x_print_expansions(nwords, words, is_command)
 	int nwords;



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 05:14:12 UTC 2017

Modified Files:
src/bin/ksh: expand.h

Log Message:
ksh: Eliminate dead code from expand.h


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/expand.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/expand.h
diff -u src/bin/ksh/expand.h:1.5 src/bin/ksh/expand.h:1.6
--- src/bin/ksh/expand.h:1.5	Fri Oct 18 19:53:34 2013
+++ src/bin/ksh/expand.h	Fri Jun 30 05:14:12 2017
@@ -1,30 +1,12 @@
-/*	$NetBSD: expand.h,v 1.5 2013/10/18 19:53:34 christos Exp $	*/
+/*	$NetBSD: expand.h,v 1.6 2017/06/30 05:14:12 kamil Exp $	*/
 
 /*
  * Expanding strings
  */
-/* $Id: expand.h,v 1.5 2013/10/18 19:53:34 christos Exp $ */
+/* $Id: expand.h,v 1.6 2017/06/30 05:14:12 kamil Exp $ */
 
 #define X_EXTRA		8	/* this many extra bytes in X string */
 
-#if 0/* Usage */
-	XString xs;
-	char *xp;
-
-	Xinit(xs, xp, 128, ATEMP); /* allocate initial string */
-	while ((c = generate()) {
-		Xcheck(xs, xp);	/* expand string if necessary */
-		Xput(xs, xp, c); /* add character */
-	}
-	return Xclose(xs, xp);	/* resize string */
-/*
- * NOTE:
- * The Xcheck and Xinit macros have a magic + X_EXTRA in the lengths.
- * This is so that you can put up to X_EXTRA characters in a XString
- * before calling Xcheck. (See yylex in lex.c)
- */
-#endif /* 0 */
-
 typedef struct XString {
 	char   *end, *beg;	/* end, begin of string */
 	size_t	len;		/* length */



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:44:46 UTC 2017

Modified Files:
src/bin/ksh: sh.h

Log Message:
ksh: Drop old hack for FreeBSD 1.1.5 and CLK_TCK


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.34 src/bin/ksh/sh.h:1.35
--- src/bin/ksh/sh.h:1.34	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:44:46 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.34 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.35 2017/06/30 04:44:46 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.34 2017/06/30 04:41:19 kamil Exp $ */
+/* $Id: sh.h,v 1.35 2017/06/30 04:44:46 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -47,9 +47,6 @@
 # endif /* L_SET */
 #endif /* !SEEK_SET */
 
-/* Some machines (eg, FreeBSD 1.1.5) define CLK_TCK in limits.h
- * (ksh_limval.h assumes limits has been included, if available)
- */
 #include 
 
 #include 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:41:19 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_test.c edit.c edit.h emacs.c eval.c
exec.c expr.c history.c io.c jobs.c lex.c mail.c main.c misc.c
proto.h sh.h syn.c trap.c tty.c var.c vi.c

Log Message:
ksh: Upgrade to C99 

This shell already used C99 functions.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/c_sh.c src/bin/ksh/exec.c \
src/bin/ksh/misc.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/c_test.c src/bin/ksh/proto.h \
src/bin/ksh/tty.c
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/edit.c
cvs rdiff -u -r1.3 -r1.4 src/bin/ksh/edit.h
cvs rdiff -u -r1.36 -r1.37 src/bin/ksh/emacs.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/eval.c src/bin/ksh/main.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/expr.c src/bin/ksh/syn.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/history.c src/bin/ksh/io.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/jobs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/lex.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/mail.c
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/sh.h
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/trap.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/var.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.25 src/bin/ksh/c_ksh.c:1.26
--- src/bin/ksh/c_ksh.c:1.25	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_ksh.c	Fri Jun 30 04:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $");
 #endif
 
 #include 
@@ -717,7 +717,7 @@ c_typeset(wp)
 		for (i = builtin_opt.optind; wp[i]; i++) {
 			if (func) {
 f = findfunc(wp[i], hash(wp[i]),
-	 (fset_AL) ? TRUE : FALSE);
+	 (fset_AL) ? true : false);
 if (!f) {
 	/* at ksh does ++rval: bogus */
 	rval = 1;
@@ -1173,7 +1173,7 @@ c_kill(wp)
 	/* assume old style options if -digits or -UPPERCASE */
 	if ((p = wp[1]) && *p == '-'
 	&& (digit(p[1]) || isupper((unsigned char)p[1]))) {
-		if (!(t = gettrap(p + 1, TRUE))) {
+		if (!(t = gettrap(p + 1, true))) {
 			bi_errorf("bad signal `%s'", p + 1);
 			return 1;
 		}
@@ -1187,7 +1187,7 @@ c_kill(wp)
 lflag = 1;
 break;
 			  case 's':
-if (!(t = gettrap(builtin_opt.optarg, TRUE))) {
+if (!(t = gettrap(builtin_opt.optarg, true))) {
 	bi_errorf("bad signal `%s'",
 		builtin_opt.optarg);
 	return 1;
@@ -1311,7 +1311,7 @@ c_getopts(wp)
 		bi_errorf("missing name argument");
 		return 1;
 	}
-	if (!*var || *skip_varname(var, TRUE)) {
+	if (!*var || *skip_varname(var, true)) {
 		bi_errorf("%s: is not an identifier", var);
 		return 1;
 	}

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.22 src/bin/ksh/c_sh.c:1.23
--- src/bin/ksh/c_sh.c:1.22	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 04:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $");
 #endif
 
 #include 
@@ -464,7 +464,7 @@ c_eval(wp)
 		exstat = subst_exstat;
 	}
 
-	rv = shell(s, FALSE);
+	rv = shell(s, false);
 	afree(s, ATEMP);
 	return rv;
 }
@@ -515,13 +515,13 @@ c_trap(wp)
 	 * command 'exit' isn't confused with the pseudo-signal
 	 * 'EXIT'.
 	 */
-	s = (gettrap(*wp, FALSE) == NULL) ? *wp++ : NULL; /* get command */
+	s = (gettrap(*wp, false) == NULL) ? *wp++ : NULL; /* get command */
 	if (s != NULL && s[0] == '-' && s[1] == '\0')
 		s = NULL;
 
 	/* set/clear traps */
 	while (*wp != NULL) {
-		p = gettrap(*wp++, TRUE);
+		p = gettrap(*wp++, true);
 		if (p == NULL) {
 			bi_errorf("bad signal %s", wp[-1]);
 			return 1;
@@ -546,7 +546,7 @@ c_exitreturn(wp)
 	if (arg) {
 	if (!getn(arg, )) {
 		exstat = 1;
-		warningf(TRUE, "%s: bad number", arg);
+		warningf(true, "%s: bad number", arg);
 	} else
 		exstat = n;
 	}
@@ -612,7 +612,7 @@ c_brkcont(wp)
 		 * scripts, but don't generate an error (ie, keep going).
 		 */
 		if (n == quit) {
-			warningf(TRUE, "%s: cannot %s", wp[0], wp[0]);
+			warningf(true, "%s: cannot %s", wp[0], wp[0]);
 			return 0;
 		}
 		/* POSIX says if n is too big, the last enclosing loop
@@ -621,7 +621,7 @@ c_brkcont(wp)
 		 */
 		if (last_ep)
 			last_ep->flags &= ~EF_BRKCONT_PASS;
-		warningf(TRUE, "%s: can only %s %d level(s)",
+		warningf(true, "%s: can only %s %d 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:30:26 UTC 2017

Modified Files:
src/bin/ksh: main.c sh.h

Log Message:
ksh: Eliminate dead MEM_DEBUG sections, there is missing code for it

MEM_DEBUG used to contain malloc(3) debugging facilities.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/main.c
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/main.c
diff -u src/bin/ksh/main.c:1.20 src/bin/ksh/main.c:1.21
--- src/bin/ksh/main.c:1.20	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/main.c	Fri Jun 30 04:30:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: main.c,v 1.21 2017/06/30 04:30:26 kamil Exp $	*/
 
 /*
  * startup, main loop, environments and error handling
@@ -10,7 +10,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2017/06/30 04:30:26 kamil Exp $");
 #endif
 
 
@@ -102,11 +102,6 @@ main(int argc, char *argv[])
 	struct env env;
 	pid_t ppid;
 
-#ifdef MEM_DEBUG
-	chmem_set_defaults("ct", 1);
-	/* chmem_push("+c", 1); */
-#endif /* MEM_DEBUG */
-
 	/* make sure argv[] is sane */
 	if (!*argv) {
 		static const char	*empty_argv[] = {
@@ -711,9 +706,6 @@ quitenv()
 	kill(0, sig);
 }
 			}
-#ifdef MEM_DEBUG
-			chmem_allfree();
-#endif /* MEM_DEBUG */
 		}
 		exit(exstat);
 	}

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.32 src/bin/ksh/sh.h:1.33
--- src/bin/ksh/sh.h:1.32	Fri Jun 30 04:22:22 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:30:26 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.33 2017/06/30 04:30:26 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $ */
+/* $Id: sh.h,v 1.33 2017/06/30 04:30:26 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -205,10 +205,6 @@ EXTERN	Area	aperm;		/* permanent object 
 #define	APERM	
 #define	ATEMP	>area
 
-#ifdef MEM_DEBUG
-# include "chmem.h" /* a debugging front end for malloc et. al. */
-#endif /* MEM_DEBUG */
-
 #ifdef KSH_DEBUG
 # define kshdebug_init()	kshdebug_init_()
 # define kshdebug_printf(a)	kshdebug_printf_ a



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:22:22 UTC 2017

Modified Files:
src/bin/ksh: Makefile config.h sh.h
Removed Files:
src/bin/ksh: sigact.c sigact.h

Log Message:
ksh: Drop support for OSes without POSIX sigaction(2)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/ksh/config.h
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/sh.h
cvs rdiff -u -r1.7 -r0 src/bin/ksh/sigact.c
cvs rdiff -u -r1.3 -r0 src/bin/ksh/sigact.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.33 src/bin/ksh/Makefile:1.34
--- src/bin/ksh/Makefile:1.33	Wed Mar 16 23:02:23 2016
+++ src/bin/ksh/Makefile	Fri Jun 30 04:22:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2016/03/16 23:02:23 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2017/06/30 04:22:22 kamil Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -10,8 +10,8 @@ CPPFLAGS+=	-I.
 PROG=	ksh
 SRCS=	alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
 	eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
-	main.c misc.c path.c shf.c sigact.c syn.c table.c trap.c \
-	tree.c tty.c var.c version.c vi.c
+	main.c misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c \
+	var.c version.c vi.c
 DPSRCS=	emacs.out siglist.out
 .if (${MKMAN} != "no")
 DPSRCS+=ksh.1

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.52 src/bin/ksh/config.h:1.53
--- src/bin/ksh/config.h:1.52	Fri Jun 30 04:11:57 2017
+++ src/bin/ksh/config.h	Fri Jun 30 04:22:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.52 2017/06/30 04:11:57 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.53 2017/06/30 04:22:22 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -30,9 +30,6 @@
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
-/* Define to use the fake posix signal routines (sigact.[ch]) */
-/* #undef USE_FAKE_SIGACT */
-
 /* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
 /* #undef BSD_PGRP */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.31 src/bin/ksh/sh.h:1.32
--- src/bin/ksh/sh.h:1.31	Fri Jun 30 02:51:14 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:22:22 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $ */
+/* $Id: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -80,10 +80,6 @@
 
 typedef	RETSIGTYPE (*handler_t) ARGS((int));	/* signal handler */
 
-#ifdef USE_FAKE_SIGACT
-# include "sigact.h"			/* use sjg's fake sigaction() */
-#endif
-
 #ifdef HAVE_PATHS_H
 # include 
 #endif /* HAVE_PATHS_H */



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:11:57 UTC 2017

Modified Files:
src/bin/ksh: c_test.c config.h

Log Message:
ksh: Drop support for OSes that don't map /dev/fd


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/c_test.c
cvs rdiff -u -r1.51 -r1.52 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_test.c
diff -u src/bin/ksh/c_test.c:1.7 src/bin/ksh/c_test.c:1.8
--- src/bin/ksh/c_test.c:1.7	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_test.c	Fri Jun 30 04:11:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $	*/
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -11,7 +11,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $");
 #endif
 
 #include 
@@ -422,19 +422,11 @@ test_eval(te, op, opnd1, opnd2, do_eval)
 	return 1;
 }
 
-/* Nasty kludge to handle Korn's bizarre /dev/fd hack */
 static int
 test_stat(pathx, statb)
 	const char *pathx;
 	struct stat *statb;
 {
-#if !defined(HAVE_DEV_FD)
-	int fd;
-
-	if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, ))
-		return fstat(fd, statb);
-#endif /* !HAVE_DEV_FD */
-
 	return stat(pathx, statb);
 }
 
@@ -448,22 +440,6 @@ test_eaccess(pathx, mode)
 {
 	int res;
 
-#if !defined(HAVE_DEV_FD)
-	int fd;
-
-	/* Note: doesn't handle //dev/fd, etc.. (this is ok) */
-	if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, )) {
-		int flags;
-
-		if ((flags = fcntl(fd, F_GETFL, 0)) < 0
-		|| (mode & X_OK)
-		|| ((mode & W_OK) && (flags & O_ACCMODE) == O_RDONLY)
-		|| ((mode & R_OK) && (flags & O_ACCMODE) == O_WRONLY))
-			return -1;
-		return 0;
-	}
-#endif /* !HAVE_DEV_FD */
-
 	res = eaccess(pathx, mode);
 	/*
 	 * On most (all?) unixes, access() says everything is executable for

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.51 src/bin/ksh/config.h:1.52
--- src/bin/ksh/config.h:1.51	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/config.h	Fri Jun 30 04:11:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.51 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.52 2017/06/30 04:11:57 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -69,9 +69,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if your OS maps references to /dev/fd/n to file descriptor n */
-#define HAVE_DEV_FD 1
-
 /* Default PATH */
 #ifdef RESCUEDIR
 #define DEFAULT_PATH RESCUEDIR ":/bin:/usr/bin:/sbin:/usr/sbin"



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:01:48 UTC 2017

Modified Files:
src/bin/ksh: proto.h

Log Message:
ksh: Drop old hack fo SunOS 4.1.x (1990-1994)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/proto.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/proto.h
diff -u src/bin/ksh/proto.h:1.7 src/bin/ksh/proto.h:1.8
--- src/bin/ksh/proto.h:1.7	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/proto.h	Fri Jun 30 04:01:48 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: proto.h,v 1.7 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: proto.h,v 1.8 2017/06/30 04:01:48 kamil Exp $	*/
 
 /*
  * prototypes for PD-KSH
  * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
- * $Id: proto.h,v 1.7 2005/06/26 19:09:00 christos Exp $
+ * $Id: proto.h,v 1.8 2017/06/30 04:01:48 kamil Exp $
  */
 
 /* alloc.c */
@@ -273,26 +273,3 @@ char *	arrayname	ARGS((const char *));
 voidset_array	ARGS((const char *, int, char **));
 /* version.c */
 /* vi.c: see edit.h */
-
-
-/* Hack to avoid billions of compile warnings on SunOS 4.1.x */
-#if defined(MUN) && defined(sun) && !defined(__svr4__)
-extern void bcopy ARGS((const void *, void *, size_t));
-extern intclose ARGS((FILE *));
-extern intprintf ARGS((FILE *, const char *, ...));
-extern intread ARGS((void *, int, int, FILE *));
-extern int ioctl ARGS((int, int, void *));
-extern int killpg ARGS((int, int));
-extern int nice ARGS((int));
-extern int readlink ARGS((const char *, char *, int));
-extern int setpgrp ARGS((int, int));
-extern int strcasecmp ARGS((const char *, const char *));
-extern int tolower ARGS((int));
-extern int toupper ARGS((int));
-/*  Include files aren't included yet */
-extern int getrlimit ARGS(( /* int, struct rlimit * */ ));
-extern int getrusage ARGS(( /* int, struct rusage * */ ));
-extern int gettimeofday ARGS(( /* struct timeval *, struct timezone * */ ));
-extern int setrlimit ARGS(( /* int, struct rlimit * */ ));
-extern int lstat ARGS(( /* const char *, struct stat * */ ));
-#endif



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:56:12 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_test.c config.h edit.c emacs.c eval.c
exec.c history.c io.c jobs.c mail.c main.c path.c shf.c tty.c var.c
vi.c
Removed Files:
src/bin/ksh: ksh_stat.h

Log Message:
ksh: Drop support for systems without 

In future the order of includes will be normalized with KNF.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/c_sh.c src/bin/ksh/exec.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/c_test.c src/bin/ksh/mail.c
cvs rdiff -u -r1.50 -r1.51 src/bin/ksh/config.h
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/edit.c
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/emacs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/eval.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/history.c src/bin/ksh/io.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/jobs.c
cvs rdiff -u -r1.3 -r0 src/bin/ksh/ksh_stat.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/main.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/path.c src/bin/ksh/shf.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/tty.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/var.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.24 src/bin/ksh/c_ksh.c:1.25
--- src/bin/ksh/c_ksh.c:1.24	Thu Jun 22 19:41:07 2017
+++ src/bin/ksh/c_ksh.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,13 +6,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
-#include "sh.h"
-#include "ksh_stat.h"
+#include 
 #include 
 
+#include "sh.h"
+
 int
 c_cd(wp)
 	char	**wp;

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.21 src/bin/ksh/c_sh.c:1.22
--- src/bin/ksh/c_sh.c:1.21	Fri Jun 30 03:43:57 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,16 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
 #include 
 #include 
 #include 
 
 #include "sh.h"
-#include "ksh_stat.h" 	/* umask() */
-
 
 static	char *clocktos ARGS((clock_t t));
 
Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.21 src/bin/ksh/exec.c:1.22
--- src/bin/ksh/exec.c:1.21	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,14 +6,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
+#include 
 
 #include "sh.h"
 #include "c_test.h"
-#include 
-#include "ksh_stat.h"
 
 /* Does ps4 get parameter substitutions done? */
 #ifdef KSH

Index: src/bin/ksh/c_test.c
diff -u src/bin/ksh/c_test.c:1.6 src/bin/ksh/c_test.c:1.7
--- src/bin/ksh/c_test.c:1.6	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/c_test.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -11,12 +11,12 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
-#include "ksh_stat.h"
 #include "c_test.h"
 
 /* test(1) accepts the following grammar:
Index: src/bin/ksh/mail.c
diff -u src/bin/ksh/mail.c:1.6 src/bin/ksh/mail.c:1.7
--- src/bin/ksh/mail.c:1.6	Fri Jun 30 03:43:57 2017
+++ src/bin/ksh/mail.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $	*/
+/*	$NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -7,17 +7,17 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $");
+__RCSID("$NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
 #include "config.h"
 
 #ifdef KSH
+#include 
 #include 
 #include 
 
 #include "sh.h"
-#include "ksh_stat.h"
 
 #define MBMESSAGE	"You have mail in $_"
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.50 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:43:57 UTC 2017

Modified Files:
src/bin/ksh: c_sh.c c_ulimit.c config.h mail.c main.c var.c
Removed Files:
src/bin/ksh: ksh_time.h

Log Message:
ksh: Drop support for systems with broken  / 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/c_sh.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/c_ulimit.c
cvs rdiff -u -r1.49 -r1.50 src/bin/ksh/config.h
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_time.h
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/mail.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/main.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.20 src/bin/ksh/c_sh.c:1.21
--- src/bin/ksh/c_sh.c:1.20	Fri Jun 30 03:23:18 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,14 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
+#include 
 #include 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h" 	/* umask() */
-#include "ksh_time.h"
 
 
 static	char *clocktos ARGS((clock_t t));

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.15 src/bin/ksh/c_ulimit.c:1.16
--- src/bin/ksh/c_ulimit.c:1.15	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_ulimit.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.15 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.16 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
 	ulimit -- handle "ulimit" builtin
@@ -20,12 +20,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ulimit.c,v 1.15 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_ulimit.c,v 1.16 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
+#include 
+#include 
 
 #include "sh.h"
-#include "ksh_time.h"
 #ifdef HAVE_SYS_RESOURCE_H
 # include 
 #endif /* HAVE_SYS_RESOURCE_H */

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.49 src/bin/ksh/config.h:1.50
--- src/bin/ksh/config.h:1.49	Fri Jun 30 03:35:16 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.49 2017/06/30 03:35:16 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.50 2017/06/30 03:43:57 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -33,9 +33,6 @@
 /* Define if `sys_siglist' is declared by .  */
 #define SYS_SIGLIST_DECLARED 1
 
-/* Define if you can safely include both  and .  */
-#define TIME_WITH_SYS_TIME 1
-
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
@@ -57,9 +54,6 @@
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 
-/* Define if time() is declared in  */
-#define TIME_DECLARED 1
-
 /* Define if sys_errlist[] and sys_nerr are in the C library */
 #define HAVE_SYS_ERRLIST 1
 
@@ -196,9 +190,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_SYS_RESOURCE_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_SYS_TIME_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_ULIMIT_H
 

Index: src/bin/ksh/mail.c
diff -u src/bin/ksh/mail.c:1.5 src/bin/ksh/mail.c:1.6
--- src/bin/ksh/mail.c:1.5	Sun Jan 15 18:16:30 2006
+++ src/bin/ksh/mail.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail.c,v 1.5 2006/01/15 18:16:30 jschauma Exp $	*/
+/*	$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -7,16 +7,17 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: mail.c,v 1.5 2006/01/15 18:16:30 jschauma Exp $");
+__RCSID("$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
-
 #include "config.h"
 
 #ifdef KSH
+#include 
+#include 
+
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_time.h"
 
 #define MBMESSAGE	"You have mail in $_"
 

Index: src/bin/ksh/main.c
diff -u src/bin/ksh/main.c:1.18 src/bin/ksh/main.c:1.19
--- src/bin/ksh/main.c:1.18	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/main.c	Fri Jun 30 03:43:57 2017
@@ -1,13 +1,15 @@
-/*	$NetBSD: main.c,v 1.18 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * startup, main loop, environments and error handling
  */
 #include 
+#include 
 #include 
+#include 
 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.18 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
 
@@ -15,7 +17,6 @@ __RCSID("$NetBSD: main.c,v 1.18 2017/06/
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_time.h"
 
 extern char 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:35:16 UTC 2017

Modified Files:
src/bin/ksh: config.h ksh_stat.h

Log Message:
ksh: Drop support for systems without POSIX lstat(2)


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/ksh/config.h
cvs rdiff -u -r1.2 -r1.3 src/bin/ksh/ksh_stat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.48 src/bin/ksh/config.h:1.49
--- src/bin/ksh/config.h:1.48	Fri Jun 30 03:32:28 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:35:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.48 2017/06/30 03:32:28 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.49 2017/06/30 03:35:16 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -72,9 +72,6 @@
 /* Define if you have a sane  header file */
 #define HAVE_TERMIOS_H 1
 
-/* Define if you have a lstat() function in your C library */
-#define HAVE_LSTAT 1
-
 /* Define if you have a sane  header file */
 /* #undef HAVE_TERMIO_H */
 

Index: src/bin/ksh/ksh_stat.h
diff -u src/bin/ksh/ksh_stat.h:1.2 src/bin/ksh/ksh_stat.h:1.3
--- src/bin/ksh/ksh_stat.h:1.2	Sun Jan 12 19:12:00 1997
+++ src/bin/ksh/ksh_stat.h	Fri Jun 30 03:35:16 2017
@@ -1,15 +1,11 @@
-/*	$NetBSD: ksh_stat.h,v 1.2 1997/01/12 19:12:00 tls Exp $	*/
+/*	$NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $	*/
 
 /* Wrapper around the ugly sys/stat includes/ifdefs */
-/* $NetBSD: ksh_stat.h,v 1.2 1997/01/12 19:12:00 tls Exp $ */
+/* $NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $ */
 
 /* assumes  already included */
 #include 
 
-#ifndef HAVE_LSTAT
-# define lstat(path, buf)	stat(path, buf)
-#endif /* HAVE_LSTAT */
-
 #ifdef STAT_MACROS_BROKEN
 # undef S_ISREG
 # undef S_ISDIR



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:32:28 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without POSIX 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.47 src/bin/ksh/config.h:1.48
--- src/bin/ksh/config.h:1.47	Fri Jun 30 03:23:18 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:32:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.47 2017/06/30 03:23:18 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.48 2017/06/30 03:32:28 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -84,9 +84,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if you have a POSIX.1 compatible  */
-#define POSIX_SYS_WAIT 1
-
 /* Define if your OS maps references to /dev/fd/n to file descriptor n */
 #define HAVE_DEV_FD 1
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:23:18 UTC 2017

Modified Files:
src/bin/ksh: c_sh.c config.h jobs.c
Removed Files:
src/bin/ksh: ksh_times.h

Log Message:
ksh: Drop support for systems with broken times(3)

This fallback code wouldn't work anyway.

times(3) is an obsolete interface by getrusage(2) and gettimeofday(2).
In future it will be swiched to more modern interfaces.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/c_sh.c
cvs rdiff -u -r1.46 -r1.47 src/bin/ksh/config.h
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/jobs.c
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_times.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.19 src/bin/ksh/c_sh.c:1.20
--- src/bin/ksh/c_sh.c:1.19	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,14 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h" 	/* umask() */
 #include "ksh_time.h"
-#include "ksh_times.h"
+
 
 static	char *clocktos ARGS((clock_t t));
 
@@ -706,7 +707,7 @@ c_times(wp)
 {
 	struct tms all;
 
-	(void) ksh_times();
+	times();
 	shprintf("Shell: %8ss user ", clocktos(all.tms_utime));
 	shprintf("%8ss system\n", clocktos(all.tms_stime));
 	shprintf("Kids:  %8ss user ", clocktos(all.tms_cutime));
@@ -733,7 +734,7 @@ timex(t, f)
 	extern clock_t j_usrtime, j_systime; /* computed by j_wait */
 	char opts[1];
 
-	t0t = ksh_times();
+	t0t = times();
 	if (t->left) {
 		/*
 		 * Two ways of getting cpu usage of a command: just use t0
@@ -749,7 +750,7 @@ timex(t, f)
 		opts[0] = 0;
 		rv = execute(t->left, f | XTIME);
 		tf |= opts[0];
-		t1t = ksh_times();
+		t1t = times();
 	} else
 		tf = TF_NOARGS;
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.46 src/bin/ksh/config.h:1.47
--- src/bin/ksh/config.h:1.46	Fri Jun 30 02:51:14 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.46 2017/06/30 02:51:14 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.47 2017/06/30 03:23:18 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -78,9 +78,6 @@
 /* Define if you have a sane  header file */
 /* #undef HAVE_TERMIO_H */
 
-/* Define if you don't have times() or if it always returns 0 */
-/* #undef TIMES_BROKEN */
-
 /* Define if opendir() will open non-directory files */
 /* #undef OPENDIR_DOES_NONDIR */
 

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.16 src/bin/ksh/jobs.c:1.17
--- src/bin/ksh/jobs.c:1.16	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -21,14 +21,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include 
 #include 
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_times.h"
 #include "tty.h"
 
 /* Start of system configuration stuff */
@@ -1263,14 +1263,14 @@ j_sigchld(sig)
 			return RETSIGVAL;
 		}
 
-	ksh_times();
+	times();
 	do {
 		pid = waitpid(-1, , (WNOHANG|WUNTRACED));
 
 		if (pid <= 0)	/* return if would block (0) ... */
 			break;	/* ... or no children or interrupted (-1) */
 
-		ksh_times();
+		times();
 
 		/* find job and process structures for this pid */
 		for (j = job_list; j != (Job *) 0; j = j->next)



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:51:14 UTC 2017

Modified Files:
src/bin/ksh: config.h io.c lex.c sh.h shf.c tree.c

Log Message:
ksh: Assume ANSI C prototypes


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/bin/ksh/config.h
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/io.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/lex.c
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/sh.h
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/shf.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.45 src/bin/ksh/config.h:1.46
--- src/bin/ksh/config.h:1.45	Fri Jun 30 02:38:09 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.45 2017/06/30 02:38:09 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.46 2017/06/30 02:51:14 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -54,9 +54,6 @@
 /* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
 /* #undef NO_PGRP */
 
-/* Define if C compiler groks function prototypes */
-#define HAVE_PROTOTYPES 1
-
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 

Index: src/bin/ksh/io.c
diff -u src/bin/ksh/io.c:1.14 src/bin/ksh/io.c:1.15
--- src/bin/ksh/io.c:1.14	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/io.c	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * shell buffered IO and formatted output
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $");
+__RCSID("$NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $");
 #endif
 
 
@@ -23,13 +23,7 @@ static int initio_done;
 
 /* A shell error occurred (eg, syntax error, etc.) */
 void
-#ifdef HAVE_PROTOTYPES
 errorf(const char *fmt, ...)
-#else
-errorf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -48,14 +42,7 @@ errorf(fmt, va_alist)
 
 /* like errorf(), but no unwind is done */
 void
-#ifdef HAVE_PROTOTYPES
 warningf(int fileline, const char *fmt, ...)
-#else
-warningf(fileline, fmt, va_alist)
-	int fileline;
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -71,13 +58,7 @@ warningf(fileline, fmt, va_alist)
  * (also unwinds environments for special builtins).
  */
 void
-#ifdef HAVE_PROTOTYPES
 bi_errorf(const char *fmt, ...)
-#else
-bi_errorf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -108,14 +89,7 @@ bi_errorf(fmt, va_alist)
 
 /* Called when something that shouldn't happen does */
 void
-#ifdef HAVE_PROTOTYPES
 internal_errorf(int jump, const char *fmt, ...)
-#else
-internal_errorf(jump, fmt, va_alist)
-	int jump;
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -148,13 +122,7 @@ error_prefix(fileline)
 
 /* printf to shl_out (stderr) with flush */
 void
-#ifdef HAVE_PROTOTYPES
 shellf(const char *fmt, ...)
-#else
-shellf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -168,13 +136,7 @@ shellf(fmt, va_alist)
 
 /* printf to shl_stdout (stdout) */
 void
-#ifdef HAVE_PROTOTYPES
 shprintf(const char *fmt, ...)
-#else
-shprintf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -204,13 +166,7 @@ kshdebug_init_()
 
 /* print to debugging log */
 void
-# ifdef HAVE_PROTOTYPES
 kshdebug_printf_(const char *fmt, ...)
-# else
-kshdebug_printf_(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-# endif
 {
 	va_list va;
 

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.19 src/bin/ksh/lex.c:1.20
--- src/bin/ksh/lex.c:1.19	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/lex.c	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: lex.c,v 1.20 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $");
+__RCSID("$NetBSD: lex.c,v 1.20 2017/06/30 02:51:14 kamil Exp $");
 #endif
 
 
@@ -836,13 +836,7 @@ readhere(iop)
 }
 
 void
-#ifdef HAVE_PROTOTYPES
 yyerror(const char *fmt, ...)
-#else
-yyerror(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.30 src/bin/ksh/sh.h:1.31
--- src/bin/ksh/sh.h:1.30	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 02:51:14 2017
@@ -1,18 +1,14 @@
-/*	$NetBSD: sh.h,v 1.30 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.30 2017/06/30 02:38:10 kamil Exp $ */
+/* $Id: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $ */
 
 #include "config.h"	/* 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:38:10 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h exec.c jobs.c sh.h

Log Message:
ksh: Drop support for systems without functional waitpid(2)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.44 -r1.45 src/bin/ksh/config.h
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/exec.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/jobs.c
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.6 src/bin/ksh/conf-end.h:1.7
--- src/bin/ksh/conf-end.h:1.6	Fri Jun 30 02:20:47 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:38:09 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.7 2017/06/30 02:38:09 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.7 2017/06/30 02:38:09 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -22,15 +22,6 @@
 # define EASY_HISTORY			/* sjg's trivial history file */
 #endif
 
-/* Can we safely catch sigchld and wait for processes? */
-#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
-# define JOB_SIGS
-#endif
-
-#if !defined(JOB_SIGS) || !(defined(POSIX_PGRP) || defined(BSD_PGRP))
-# undef JOBS /* if no JOB_SIGS, no job control support */
-#endif
-
 #ifdef HAVE_GCC_FUNC_ATTR
 # define GCC_FUNC_ATTR(x)	__attribute__((x))
 # define GCC_FUNC_ATTR2(x,y)	__attribute__((x,y))

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.44 src/bin/ksh/config.h:1.45
--- src/bin/ksh/config.h:1.44	Fri Jun 30 02:20:47 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:38:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.44 2017/06/30 02:20:47 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.45 2017/06/30 02:38:09 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -187,12 +187,6 @@
 /* Define if you have the valloc function.  */
 #define HAVE_VALLOC 1
 
-/* Define if you have the wait3 function.  */
-#define HAVE_WAIT3 1
-
-/* Define if you have the waitpid function.  */
-#define HAVE_WAITPID 1
-
 /* Define if you have the  header file.  */
 #define HAVE_DIRENT_H 1
 

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.20 src/bin/ksh/exec.c:1.21
--- src/bin/ksh/exec.c:1.20	Fri Jun 30 02:06:59 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 02:38:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $");
 #endif
 
 
@@ -201,11 +201,8 @@ execute(t, flags)
 #ifdef KSH
 	  case TCOPROC:
 	  {
-# ifdef JOB_SIGS
 		sigset_t	omask;
-# endif /* JOB_SIGS */
 
-# ifdef JOB_SIGS
 		/* Block sigchild as we are using things changed in the
 		 * signal handler
 		 */
@@ -218,7 +215,7 @@ execute(t, flags)
 			unwind(i);
 			/*NOTREACHED*/
 		}
-# endif /* JOB_SIGS */
+
 		/* Already have a (live) co-process? */
 		if (coproc.job && coproc.write >= 0)
 			errorf("coprocess already exists");
@@ -249,10 +246,9 @@ execute(t, flags)
 			/* create new coprocess id */
 			++coproc.id;
 		}
-# ifdef JOB_SIGS
+
 		sigprocmask(SIG_SETMASK, , (sigset_t *) 0);
 		e->type = E_EXEC; /* no more need for error handler */
-# endif /* JOB_SIGS */
 
 		/* exchild() closes coproc.* in child after fork,
 		 * will also increment coproc.njobs when the

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.15 src/bin/ksh/jobs.c:1.16
--- src/bin/ksh/jobs.c:1.15	Fri Jun 30 01:52:34 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 02:38:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -14,11 +14,6 @@
  * work :)
  *
  * Notes regarding the copious ifdefs:
- *	- JOB_SIGS is independent of JOBS - it is defined if there are modern
- *	  signal and wait routines available.  This is preferred, even when
- *	  JOBS is not defined, since the shell will not otherwise notice when
- *	  background jobs die until the shell waits for a foreground process
- *	  to die.
  *	- TTY_PGRP defined iff JOBS is defined - defined if there are tty
  *	  process groups
  *	- NEED_PGRP_SYNC defined iff JOBS is defined - see comment below
@@ -26,7 +21,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $");
 #endif
 
 #include 
@@ -187,10 +182,8 @@ static int_least32_t	

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:20:47 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h

Log Message:
ksh: Drop support for systems without POSIX signal routines


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.43 -r1.44 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.5 src/bin/ksh/conf-end.h:1.6
--- src/bin/ksh/conf-end.h:1.5	Fri Jun 30 02:13:29 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:20:47 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -23,8 +23,7 @@
 #endif
 
 /* Can we safely catch sigchld and wait for processes? */
-#if (defined(HAVE_WAITPID) || defined(HAVE_WAIT3)) \
-&& (defined(POSIX_SIGNALS))
+#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
 # define JOB_SIGS
 #endif
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.43 src/bin/ksh/config.h:1.44
--- src/bin/ksh/config.h:1.43	Fri Jun 30 02:13:29 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:20:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.43 2017/06/30 02:13:29 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.44 2017/06/30 02:20:47 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -39,9 +39,6 @@
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
-/* Define if you have posix signal routines (sigaction(), et. al.) */
-#define POSIX_SIGNALS 1
-
 /* Define to use the fake posix signal routines (sigact.[ch]) */
 /* #undef USE_FAKE_SIGACT */
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:13:29 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h

Log Message:
ksh: Drop support for systems without implementation of EINTR

These systems weren't handled anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.42 -r1.43 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.4 src/bin/ksh/conf-end.h:1.5
--- src/bin/ksh/conf-end.h:1.4	Thu Jun 22 23:59:28 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:13:29 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -32,18 +32,6 @@
 # undef JOBS /* if no JOB_SIGS, no job control support */
 #endif
 
-/* pdksh assumes system calls return EINTR if a signal happened (this so
- * the signal handler doesn't have to longjmp()).  I don't know if this
- * happens (or can be made to happen) with sigset() et. al. (the bsd41 signal
- * routines), so, the autoconf stuff checks what they do and defines
- * SIGNALS_DONT_INTERRUPT if signals don't interrupt read().
- * If SIGNALS_DONT_INTERRUPT isn't defined and your compiler chokes on this,
- * delete the hash in front of the error (and file a bug report).
- */
-#ifdef SIGNALS_DONT_INTERRUPT
-  # error pdksh needs interruptable system calls.
-#endif /* SIGNALS_DONT_INTERRUPT */
-
 #ifdef HAVE_GCC_FUNC_ATTR
 # define GCC_FUNC_ATTR(x)	__attribute__((x))
 # define GCC_FUNC_ATTR2(x,y)	__attribute__((x,y))

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.42 src/bin/ksh/config.h:1.43
--- src/bin/ksh/config.h:1.42	Fri Jun 30 02:06:59 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:13:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.42 2017/06/30 02:06:59 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.43 2017/06/30 02:13:29 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -45,9 +45,6 @@
 /* Define to use the fake posix signal routines (sigact.[ch]) */
 /* #undef USE_FAKE_SIGACT */
 
-/* Define if signals don't interrupt read() */
-/* #undef SIGNALS_DONT_INTERRUPT */
-
 /* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
 /* #undef BSD_PGRP */
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:06:59 UTC 2017

Modified Files:
src/bin/ksh: config.h eval.c exec.c

Log Message:
ksh: Drop support for systems without handling shebang


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/ksh/config.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/eval.c src/bin/ksh/exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.41 src/bin/ksh/config.h:1.42
--- src/bin/ksh/config.h:1.41	Fri Jun 30 02:02:41 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.41 2017/06/30 02:02:41 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.42 2017/06/30 02:06:59 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -36,9 +36,6 @@
 /* Define if you can safely include both  and .  */
 #define TIME_WITH_SYS_TIME 1
 
-/* Define if your kernel doesn't handle scripts starting with #! */
-/* #undef SHARPBANG */
-
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.19 src/bin/ksh/eval.c:1.20
--- src/bin/ksh/eval.c:1.19	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/eval.c	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
 #endif
 
 #include 
@@ -95,17 +95,10 @@ eval(ap, f)
 		return ap;
 	XPinit(w, 32);
 	XPput(w, NULL);		/* space for shell name */
-#ifdef	SHARPBANG
-	XPput(w, NULL);		/* and space for one arg */
-#endif
 	while (*ap != NULL)
 		expand(*ap++, , f);
 	XPput(w, NULL);
-#ifdef	SHARPBANG
-	return (char **) XPclose(w) + 2;
-#else
 	return (char **) XPclose(w) + 1;
-#endif
 }
 
 /*
Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.19 src/bin/ksh/exec.c:1.20
--- src/bin/ksh/exec.c:1.19	Thu Jun 22 23:47:29 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
 #endif
 
 
@@ -764,53 +764,6 @@ scriptexec(tp, ap)
 		shellv = __UNCONST(EXECSHELL);
 
 	*tp->args-- = tp->str;
-#ifdef	SHARPBANG
-	{
-		char buf[LINE];
-		register char *cp;
-		register int fd, n;
-
-		buf[0] = '\0';
-		if ((fd = open(tp->str, O_RDONLY)) >= 0) {
-			if ((n = read(fd, buf, LINE - 1)) > 0)
-buf[n] = '\0';
-			(void) close(fd);
-		}
-		if ((buf[0] == '#' && buf[1] == '!' && (cp = [2]))
-		)
-		{
-			while (*cp && (*cp == ' ' || *cp == '\t'))
-cp++;
-			if (*cp && *cp != '\n') {
-char *a0 = cp, *a1 = (char *) 0;
-
-while (*cp && *cp != '\n' && *cp != ' '
-   && *cp != '\t')
-{
-	cp++;
-}
-if (*cp && *cp != '\n') {
-	*cp++ = '\0';
-	while (*cp
-	   && (*cp == ' ' || *cp == '\t'))
-		cp++;
-	if (*cp && *cp != '\n') {
-		a1 = cp;
-		/* all one argument */
-		while (*cp && *cp != '\n')
-			cp++;
-	}
-}
-if (*cp == '\n') {
-	*cp = '\0';
-	if (a1)
-		*tp->args-- = a1;
-	shellv = a0;
-}
-			}
-		}
-	}
-#endif	/* SHARPBANG */
 	*tp->args = shellv;
 
 	execve(tp->args[0], tp->args, ap);



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:02:41 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for OSes without POSIX types

Assume available: mode_t, off_t, pid_t, uid_t, rlim_t, sigset_t.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.40 src/bin/ksh/config.h:1.41
--- src/bin/ksh/config.h:1.40	Fri Jun 30 01:56:34 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:02:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.40 2017/06/30 01:56:34 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.41 2017/06/30 02:02:41 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -17,15 +17,6 @@
 /* Define if on MINIX.  */
 /* #undef _MINIX */
 
-/* Define to `int' if  doesn't define.  */
-/* #undef mode_t */
-
-/* Define to `long' if  doesn't define.  */
-/* #undef off_t */
-
-/* Define to `int' if  doesn't define.  */
-/* #undef pid_t */
-
 /* Define if the system does not provide POSIX.1 features except
with this defined.  */
 /* #undef _POSIX_1_SOURCE */
@@ -45,9 +36,6 @@
 /* Define if you can safely include both  and .  */
 #define TIME_WITH_SYS_TIME 1
 
-/* Define to `int' if  doesn't define.  */
-/* #undef uid_t */
-
 /* Define if your kernel doesn't handle scripts starting with #! */
 /* #undef SHARPBANG */
 
@@ -81,15 +69,9 @@
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 
-/* Define to the type of struct rlimit fields if the rlim_t type is missing */
-/* #undef rlim_t */
-
 /* Define if time() is declared in  */
 #define TIME_DECLARED 1
 
-/* Define to `unsigned' if  doesn't define */
-/* #undef sigset_t */
-
 /* Define if sys_errlist[] and sys_nerr are in the C library */
 #define HAVE_SYS_ERRLIST 1
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:56:34 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without 


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.39 src/bin/ksh/config.h:1.40
--- src/bin/ksh/config.h:1.39	Fri Jun 30 01:36:30 2017
+++ src/bin/ksh/config.h	Fri Jun 30 01:56:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.39 2017/06/30 01:36:30 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.40 2017/06/30 01:56:34 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -14,9 +14,6 @@
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 
-/* Define if you have  that is POSIX.1 compatible.  */
-#define HAVE_SYS_WAIT_H 1
-
 /* Define if on MINIX.  */
 /* #undef _MINIX */
 
@@ -247,9 +244,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_SYS_TIME_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_SYS_WAIT_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_ULIMIT_H
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:52:34 UTC 2017

Modified Files:
src/bin/ksh: jobs.c
Removed Files:
src/bin/ksh: ksh_wait.h

Log Message:
ksh: Drop ksh_wait.h that reinvents  (POSIX header)

Switch jobs.c to .

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/jobs.c
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_wait.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.14 src/bin/ksh/jobs.c:1.15
--- src/bin/ksh/jobs.c:1.14	Fri Jun 23 00:29:42 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 01:52:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -26,13 +26,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_wait.h"
 #include "ksh_times.h"
 #include "tty.h"
 
@@ -103,7 +103,7 @@ typedef struct proc	Proc;
 struct proc {
 	Proc	*next;		/* next process in pipeline (if any) */
 	int	state;
-	WAIT_T	status;		/* wait status */
+	int	status;		/* wait status */
 	pid_t	pid;		/* process id */
 	char	command[48];	/* process command string */
 };
@@ -469,7 +469,7 @@ exchild(t, flags, close_fd)
 	p = new_proc();
 	p->next = (Proc *) 0;
 	p->state = PRUNNING;
-	WSTATUS(p->status) = 0;
+	p->status = 0;
 	p->pid = 0;
 
 	/* link process into jobs list */
@@ -891,7 +891,7 @@ j_resume(cp, bg)
 	for (p = j->proc_list; p != (Proc *) 0; p = p->next) {
 		if (p->state == PSTOPPED) {
 			p->state = PRUNNING;
-			WSTATUS(p->status) = 0;
+			p->status = 0;
 			running = 1;
 		}
 		shprintf("%s%s", p->command, p->next ? "| " : null);
@@ -1212,7 +1212,7 @@ j_waitj(j, flags, where)
 	j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
 
 	if (j->flags & JF_FG) {
-		WAIT_T	status;
+		int	status;
 
 		j->flags &= ~JF_FG;
 #ifdef TTY_PGRP
@@ -1317,7 +1317,7 @@ j_sigchld(sig)
 	Job		*j;
 	Proc		UNINITIALIZED(*p);
 	int		pid;
-	WAIT_T		status;
+	int		status;
 	struct tms	t0, t1;
 
 #ifdef JOB_SIGS
@@ -1336,7 +1336,7 @@ j_sigchld(sig)
 	ksh_times();
 	do {
 #ifdef JOB_SIGS
-		pid = ksh_waitpid(-1, , (WNOHANG|WUNTRACED));
+		pid = waitpid(-1, , (WNOHANG|WUNTRACED));
 #else /* JOB_SIGS */
 		pid = wait();
 #endif /* JOB_SIGS */
@@ -1513,7 +1513,7 @@ j_print(j, how, shf)
 {
 	Proc	*p;
 	int	state;
-	WAIT_T	status;
+	int	status;
 	int	coredumped;
 	char	jobchar = ' ';
 	char	buf[64];
@@ -1556,7 +1556,7 @@ j_print(j, how, shf)
 	WEXITSTATUS(p->status));
 			break;
 		case PSIGNALLED:
-			if (WIFCORED(p->status))
+			if (WCOREDUMP(p->status))
 coredumped = 1;
 			/* kludge for not reporting `normal termination signals'
 			 * (ie, SIGINT, SIGPIPE)
@@ -1597,8 +1597,7 @@ j_print(j, how, shf)
 		state = p->state;
 		status = p->status;
 		p = p->next;
-		while (p && p->state == state
-		   && WSTATUS(p->status) == WSTATUS(status))
+		while (p && p->state == state && p->status == status)
 		{
 			if (how == JP_LONG)
 shf_fprintf(shf, "%s%5d %-20s %s%s", filler, p->pid,



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:36:30 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without gid_t


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.38 src/bin/ksh/config.h:1.39
--- src/bin/ksh/config.h:1.38	Fri Jun 23 00:35:20 2017
+++ src/bin/ksh/config.h	Fri Jun 30 01:36:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.38 2017/06/23 00:35:20 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.39 2017/06/30 01:36:30 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -11,9 +11,6 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
-/* Define to `int' if  doesn't define.  */
-/* #undef gid_t */
-
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 



CVS commit: src/sys/arch/arm/sunxi

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 21:34:50 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu.c

Log Message:
Print clocks with aprint_debug


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_ccu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_ccu.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.c:1.3 src/sys/arch/arm/sunxi/sunxi_ccu.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_ccu.c:1.3	Thu Jun 29 10:53:59 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu.c	Thu Jun 29 21:34:50 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.c,v 1.4 2017/06/29 21:34:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.4 2017/06/29 21:34:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -331,11 +331,13 @@ sunxi_ccu_print(struct sunxi_ccu_softc *
 		default:		type = "???"; break;
 		}
 
-	printf("  %-12s %2s %-12s %-7s ",
+	aprint_debug_dev(sc->sc_dev,
+		"%3d %-12s %2s %-12s %-7s %10d Hz\n",
+		i,
 	clk->base.name,
 	clkp_parent ? "<-" : "",
 	clkp_parent ? clkp_parent->name : "",
-	type);
-		printf("%10d Hz\n", clk_get_rate(>base));
+	type,
+		clk_get_rate(>base));
 	}
 }



CVS commit: src/sys/arch/arm/fdt

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 20:55:10 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: arm_fdt.c arm_fdtvar.h

Log Message:
Add arm_fdt_memory_dump helper for dumping physical addresses from ddb


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/fdt/arm_fdt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/arm_fdtvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/arm_fdt.c
diff -u src/sys/arch/arm/fdt/arm_fdt.c:1.3 src/sys/arch/arm/fdt/arm_fdt.c:1.4
--- src/sys/arch/arm/fdt/arm_fdt.c:1.3	Tue May 30 22:00:25 2017
+++ src/sys/arch/arm/fdt/arm_fdt.c	Thu Jun 29 20:55:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $ */
+/* $NetBSD: arm_fdt.c,v 1.4 2017/06/29 20:55:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.4 2017/06/29 20:55:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -143,3 +143,26 @@ arm_fdt_irq_handler(void *tf)
 {
 	_arm_fdt_irq_handler(tf);
 }
+
+void
+arm_fdt_memory_dump(paddr_t pa)
+{
+	const struct arm_platform *plat = arm_fdt_platform();
+	struct fdt_attach_args faa;
+	bus_space_tag_t bst;
+	bus_space_handle_t bsh;
+
+	plat->init_attach_args();
+
+	bst = faa.faa_bst;
+	bus_space_map(bst, pa, 0x100, 0, );
+
+	for (int i = 0; i < 0x100; i += 0x10) {
+printf("%" PRIxPTR ": %08x %08x %08x %08x\n",
+(uintptr_t)(pa + i),
+		bus_space_read_4(bst, bsh, i + 0),
+		bus_space_read_4(bst, bsh, i + 4),
+		bus_space_read_4(bst, bsh, i + 8),
+		bus_space_read_4(bst, bsh, i + 12));
+	}
+}

Index: src/sys/arch/arm/fdt/arm_fdtvar.h
diff -u src/sys/arch/arm/fdt/arm_fdtvar.h:1.5 src/sys/arch/arm/fdt/arm_fdtvar.h:1.6
--- src/sys/arch/arm/fdt/arm_fdtvar.h:1.5	Fri Jun  2 13:53:28 2017
+++ src/sys/arch/arm/fdt/arm_fdtvar.h	Thu Jun 29 20:55:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdtvar.h,v 1.5 2017/06/02 13:53:28 jmcneill Exp $ */
+/* $NetBSD: arm_fdtvar.h,v 1.6 2017/06/29 20:55:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -71,4 +71,6 @@ voidarm_fdt_cpu_hatch(struct cpu_inf
 void	arm_fdt_irq_set_handler(void (*)(void *));
 void	arm_fdt_irq_handler(void *);
 
+void	arm_fdt_memory_dump(paddr_t);
+
 #endif /* !_ARM_ARM_FDTVAR_H */



CVS commit: src/sys/arch/arm/fdt

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 20:54:28 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Don't allow sharing edge and level triggered interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/gic_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.5 src/sys/arch/arm/fdt/gic_fdt.c:1.6
--- src/sys/arch/arm/fdt/gic_fdt.c:1.5	Wed Jun 28 23:49:29 2017
+++ src/sys/arch/arm/fdt/gic_fdt.c	Thu Jun 29 20:54:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.5 2017/06/28 23:49:29 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.6 2017/06/29 20:54:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.5 2017/06/28 23:49:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.6 2017/06/29 20:54:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -77,6 +77,7 @@ struct gic_fdt_irq {
 	void			*intr_ih;
 	int			intr_refcnt;
 	int			intr_ipl;
+	int			intr_level;
 	TAILQ_HEAD(, gic_fdt_irqhandler) intr_handlers;
 };
 
@@ -183,6 +184,7 @@ gic_fdt_establish(device_t dev, u_int *s
 		firq->intr_sc = sc;
 		firq->intr_refcnt = 0;
 		firq->intr_ipl = ipl;
+		firq->intr_level = level;
 		TAILQ_INIT(>intr_handlers);
 		firq->intr_ih = intr_establish(irq, ipl, level | IST_MPSAFE,
 		gic_fdt_intr, firq);
@@ -197,6 +199,10 @@ gic_fdt_establish(device_t dev, u_int *s
 		device_printf(dev, "cannot share irq with different ipl\n");
 		return NULL;
 	}
+	if (firq->intr_level != level) {
+		device_printf(dev, "cannot share edge and level interrupts\n");
+		return NULL;
+	}
 
 	firq->intr_refcnt++;
 



CVS commit: src/sys/arch/arm/sunxi

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 20:54:03 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_usbphy.c

Log Message:
PHY registers start at index 1. Now USB works.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_usbphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_usbphy.c
diff -u src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.1 src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.1	Thu Jun 29 17:08:52 2017
+++ src/sys/arch/arm/sunxi/sunxi_usbphy.c	Thu Jun 29 20:54:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_usbphy.c,v 1.1 2017/06/29 17:08:52 jmcneill Exp $ */
+/* $NetBSD: sunxi_usbphy.c,v 1.2 2017/06/29 20:54:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.1 2017/06/29 17:08:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.2 2017/06/29 20:54:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ static const char * const compatible[] =
 	NULL
 };
 
-#define	SUNXI_MAXUSBPHY		5
+#define	SUNXI_MAXUSBPHY		4
 
 struct sunxi_usbphy {
 	u_int			phy_index;
@@ -69,6 +69,7 @@ struct sunxi_usbphy {
 struct sunxi_usbphy_softc {
 	device_t		sc_dev;
 	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh_phy_ctrl;
 
 	struct sunxi_usbphy	sc_phys[SUNXI_MAXUSBPHY];
 	u_int			sc_nphys;
@@ -181,8 +182,17 @@ sunxi_usbphy_attach(device_t parent, dev
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
 
+	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
+		aprint_error(": couldn't get phy ctrl registers\n");
+		return;
+	}
+	if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh_phy_ctrl) != 0) {
+		aprint_error(": couldn't map phy ctrl registers\n");
+		return;
+	}
+
 	for (sc->sc_nphys = 0; sc->sc_nphys < SUNXI_MAXUSBPHY; sc->sc_nphys++) {
-		if (fdtbus_get_reg(phandle, sc->sc_nphys, , ) != 0)
+		if (fdtbus_get_reg(phandle, sc->sc_nphys + 1, , ) != 0)
 			break;
 		phy = >sc_phys[sc->sc_nphys];
 		phy->phy_index = sc->sc_nphys;



CVS commit: src/sys/arch

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 19:38:25 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_rtc.c

Log Message:
Add RTC driver.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_rtc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.4 src/sys/arch/arm/sunxi/files.sunxi:1.5
--- src/sys/arch/arm/sunxi/files.sunxi:1.4	Thu Jun 29 19:16:08 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Thu Jun 29 19:38:24 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.4 2017/06/29 19:16:08 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.5 2017/06/29 19:38:24 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -57,6 +57,11 @@ device	sunxitwi: i2cbus, i2cexec, mvi2c
 attach	sunxitwi at fdt with sunxi_twi
 file	arch/arm/sunxi/sunxi_twi.c		sunxi_twi
 
+# RTC
+device	sunxirtc
+attach	sunxirtc at fdt with sunxi_rtc
+file	arch/arm/sunxi/sunxi_rtc.c		sunxi_rtc
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.5 src/sys/arch/evbarm/conf/SUNXI:1.6
--- src/sys/arch/evbarm/conf/SUNXI:1.5	Thu Jun 29 19:16:08 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Jun 29 19:38:24 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.5 2017/06/29 19:16:08 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.6 2017/06/29 19:38:24 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -90,6 +90,7 @@ options 	GTTWSI_ALLWINNER	# XXX this sho
 iic*		at sunxitwi?
 
 # RTC
+sunxirtc*	at fdt?			# RTC
 
 # SDMMC
 sunximmc*	at fdt?			# SDMMC

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_rtc.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_rtc.c:1.1
--- /dev/null	Thu Jun 29 19:38:25 2017
+++ src/sys/arch/arm/sunxi/sunxi_rtc.c	Thu Jun 29 19:38:24 2017
@@ -0,0 +1,174 @@
+/* $NetBSD: sunxi_rtc.c,v 1.1 2017/06/29 19:38:24 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2014-2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: sunxi_rtc.c,v 1.1 2017/06/29 19:38:24 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	RTC_YY_MM_DD_REG	0x10
+#define	 SUNXI_RTC_LEAP		__BIT(22)
+#define	 SUNXI_RTC_YEAR		__BITS(21,16)
+#define	 SUNXI_RTC_MONTH	__BITS(11,8)
+#define	 SUNXI_RTC_DAY		__BITS(4,0)
+#define	RTC_HH_MM_SS_REG	0x14
+#define	 SUNXI_RTC_WK_NO	__BITS(31,29)
+#define	 SUNXI_RTC_HOUR		__BITS(20,16)
+#define	 SUNXI_RTC_MINUTE	__BITS(13,8)
+#define	 SUNXI_RTC_SECOND	__BITS(5,0)
+
+#define	SUNXI_RTC_BASE_YEAR	2000
+
+static const char * const compatible[] = {
+	"allwinner,sun6i-a31-rtc",
+	NULL
+};
+
+struct sunxi_rtc_softc {
+	device_t sc_dev;
+	bus_space_tag_t sc_bst;
+	bus_space_handle_t sc_bsh;
+	struct todr_chip_handle sc_todr;
+};
+
+#define RTC_READ(sc, reg) \
+bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
+#define RTC_WRITE(sc, reg, val) \
+bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+
+static int	sunxi_rtc_match(device_t, cfdata_t, void *);
+static void	sunxi_rtc_attach(device_t, device_t, void *);
+
+static int	sunxi_rtc_gettime(todr_chip_handle_t, struct clock_ymdhms *);
+static int	sunxi_rtc_settime(todr_chip_handle_t, struct clock_ymdhms *);
+
+CFATTACH_DECL_NEW(sunxi_rtc, 

CVS commit: src/sys/arch

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 19:16:08 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_twi.c

Log Message:
Add i2c glue.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_twi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.3 src/sys/arch/arm/sunxi/files.sunxi:1.4
--- src/sys/arch/arm/sunxi/files.sunxi:1.3	Thu Jun 29 17:08:52 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Thu Jun 29 19:16:08 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.3 2017/06/29 17:08:52 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.4 2017/06/29 19:16:08 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -52,6 +52,11 @@ file	dev/fdt/ehci_fdt.c			ehci_fdt	
 attach	ohci at fdt with ohci_fdt
 file	dev/fdt/ohci_fdt.c			ohci_fdt
 
+# TWI
+device	sunxitwi: i2cbus, i2cexec, mvi2c
+attach	sunxitwi at fdt with sunxi_twi
+file	arch/arm/sunxi/sunxi_twi.c		sunxi_twi
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.4 src/sys/arch/evbarm/conf/SUNXI:1.5
--- src/sys/arch/evbarm/conf/SUNXI:1.4	Thu Jun 29 17:20:59 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Jun 29 19:16:08 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.4 2017/06/29 17:20:59 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.5 2017/06/29 19:16:08 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -85,8 +85,9 @@ com*		at fdt?			# UART
 options 	COM_AWIN		# XXX this should be a driver flag
 
 # I2C
-#sunxiiic*	at fdt?			# I2C
-#iic*		at sunxiiic?
+sunxitwi*	at fdt?			# TWI
+options 	GTTWSI_ALLWINNER	# XXX this should be a driver flag
+iic*		at sunxitwi?
 
 # RTC
 

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_twi.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_twi.c:1.1
--- /dev/null	Thu Jun 29 19:16:08 2017
+++ src/sys/arch/arm/sunxi/sunxi_twi.c	Thu Jun 29 19:16:08 2017
@@ -0,0 +1,151 @@
+/* $NetBSD: sunxi_twi.c,v 1.1 2017/06/29 19:16:08 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.1 2017/06/29 19:16:08 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+static int sunxi_twi_match(device_t, cfdata_t, void *);
+static void sunxi_twi_attach(device_t, device_t, void *);
+
+static const char * const compatible[] = {
+	"allwinner,sun6i-a31-i2c",
+	NULL
+};
+
+CFATTACH_DECL_NEW(sunxi_twi, sizeof(struct gttwsi_softc),
+	sunxi_twi_match, sunxi_twi_attach, NULL, NULL);
+
+static i2c_tag_t
+sunxi_twi_get_tag(device_t dev)
+{
+	struct gttwsi_softc * const sc = device_private(dev);
+
+	return >sc_i2c;
+}
+
+const struct fdtbus_i2c_controller_func sunxi_twi_funcs = {
+	.get_tag = sunxi_twi_get_tag,
+};
+
+static int
+sunxi_twi_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct fdt_attach_args * const faa = aux;
+
+	return of_match_compatible(faa->faa_phandle, compatible);
+}
+
+static void
+sunxi_twi_attach(device_t parent, device_t self, void *aux)
+{
+	struct gttwsi_softc * const sc = device_private(self);
+	struct fdt_attach_args * const faa = aux;
+	struct i2cbus_attach_args 

CVS commit: src/external/gpl3/gcc/lib

2017-06-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun 29 18:52:23 UTC 2017

Modified Files:
src/external/gpl3/gcc/lib/libasan: Makefile
src/external/gpl3/gcc/lib/libstdc++-v3: Makefile
src/external/gpl3/gcc/lib/libubsan: Makefile

Log Message:
Mark a few more things as not-for-clang. While the sanitizers would
likely build, there are ordering issues relative to the libc++ build
right now.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/gpl3/gcc/lib/libasan/Makefile
cvs rdiff -u -r1.26 -r1.27 src/external/gpl3/gcc/lib/libstdc++-v3/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/lib/libubsan/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/lib/libasan/Makefile
diff -u src/external/gpl3/gcc/lib/libasan/Makefile:1.17 src/external/gpl3/gcc/lib/libasan/Makefile:1.18
--- src/external/gpl3/gcc/lib/libasan/Makefile:1.17	Thu Jun  9 07:11:08 2016
+++ src/external/gpl3/gcc/lib/libasan/Makefile	Thu Jun 29 18:52:23 2017
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.17 2016/06/09 07:11:08 mrg Exp $
+# $NetBSD: Makefile,v 1.18 2017/06/29 18:52:23 joerg Exp $
+
+UNSUPPORTED_COMPILER.clang=	# defined
 
 .include 
 

Index: src/external/gpl3/gcc/lib/libstdc++-v3/Makefile
diff -u src/external/gpl3/gcc/lib/libstdc++-v3/Makefile:1.26 src/external/gpl3/gcc/lib/libstdc++-v3/Makefile:1.27
--- src/external/gpl3/gcc/lib/libstdc++-v3/Makefile:1.26	Sun Jan 15 21:27:38 2017
+++ src/external/gpl3/gcc/lib/libstdc++-v3/Makefile	Thu Jun 29 18:52:23 2017
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.26 2017/01/15 21:27:38 christos Exp $
+#	$NetBSD: Makefile,v 1.27 2017/06/29 18:52:23 joerg Exp $
 
 REQUIRETOOLS=	yes
 NOLINT=		# defined
+UNSUPPORTED_COMPILER.clang=	# defined
 
 .include 
 

Index: src/external/gpl3/gcc/lib/libubsan/Makefile
diff -u src/external/gpl3/gcc/lib/libubsan/Makefile:1.2 src/external/gpl3/gcc/lib/libubsan/Makefile:1.3
--- src/external/gpl3/gcc/lib/libubsan/Makefile:1.2	Thu Jun  9 07:11:08 2016
+++ src/external/gpl3/gcc/lib/libubsan/Makefile	Thu Jun 29 18:52:23 2017
@@ -1,4 +1,7 @@
-#	$NetBSD: Makefile,v 1.2 2016/06/09 07:11:08 mrg Exp $
+#	$NetBSD: Makefile,v 1.3 2017/06/29 18:52:23 joerg Exp $
+
+UNSUPPORTED_COMPILER.clang=	# defined
+
 .include 
 
 .include "../Makefile.inc"



CVS commit: src/sys/arch/evbarm/conf

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:20:59 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
Synopsys DesignWare APB UART needs "options COM_AWIN" for now.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.3 src/sys/arch/evbarm/conf/SUNXI:1.4
--- src/sys/arch/evbarm/conf/SUNXI:1.3	Thu Jun 29 17:08:52 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Jun 29 17:20:59 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.3 2017/06/29 17:08:52 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.4 2017/06/29 17:20:59 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -82,6 +82,7 @@ armgic0		at gic?
 
 # UART
 com*		at fdt?			# UART
+options 	COM_AWIN		# XXX this should be a driver flag
 
 # I2C
 #sunxiiic*	at fdt?			# I2C



CVS commit: src/sys/arch

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:08:52 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi sun8i_h3_ccu.c sunxi_ccu.h
sunxi_ccu_prediv.c
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_usbphy.c

Log Message:
Add USB stuff. Doesn't quite work yet.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c \
src/sys/arch/arm/sunxi/sunxi_ccu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_ccu_prediv.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_usbphy.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.2 src/sys/arch/arm/sunxi/files.sunxi:1.3
--- src/sys/arch/arm/sunxi/files.sunxi:1.2	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Thu Jun 29 17:08:52 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.2 2017/06/29 09:26:06 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.3 2017/06/29 17:08:52 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -39,6 +39,19 @@ device	sunximmc: sdmmcbus
 attach	sunximmc at fdt with sunxi_mmc
 file	arch/arm/sunxi/sunxi_mmc.c		sunxi_mmc
 
+# USB PHY
+device	sunxiusbphy
+attach	sunxiusbphy at fdt with sunxi_usbphy
+file	arch/arm/sunxi/sunxi_usbphy.c		sunxi_usbphy
+
+# EHCI
+attach	ehci at fdt with ehci_fdt
+file	dev/fdt/ehci_fdt.c			ehci_fdt	
+
+# OHCI
+attach	ohci at fdt with ohci_fdt
+file	dev/fdt/ohci_fdt.c			ohci_fdt
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI

Index: src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.3 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.4
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.3	Thu Jun 29 10:53:59 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Thu Jun 29 17:08:52 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.4 2017/06/29 17:08:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.4 2017/06/29 17:08:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,14 +41,6 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #include 
 #include 
 
-#define	USBPHY_CFG_REG		0x0cc
-#define	MBUS_RST_REG		0x0fc
-#define	BUS_SOFT_RST_REG0	0x2c0
-#define	BUS_SOFT_RST_REG1	0x2c4
-#define	BUS_SOFT_RST_REG2	0x2c8
-#define	BUS_SOFT_RST_REG3	0x2d0
-#define	BUS_SOFT_RST_REG4	0x2d8
-
 #define	PLL_PERIPH0_CTRL_REG	0x028
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
@@ -57,6 +49,13 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
+#define	USBPHY_CFG_REG		0x0cc
+#define	MBUS_RST_REG		0x0fc
+#define	BUS_SOFT_RST_REG0	0x2c0
+#define	BUS_SOFT_RST_REG1	0x2c4
+#define	BUS_SOFT_RST_REG2	0x2c8
+#define	BUS_SOFT_RST_REG3	0x2d0
+#define	BUS_SOFT_RST_REG4	0x2d8
 
 static int sun8i_h3_ccu_match(device_t, cfdata_t, void *);
 static void sun8i_h3_ccu_attach(device_t, device_t, void *);
@@ -133,6 +132,7 @@ static struct sunxi_ccu_reset sun8i_h3_c
 };
 
 static const char *ahb1_parents[] = { "losc", "hosc", "axi", "pll_periph0" };
+static const char *ahb2_parents[] = { "ahb1", "pll_periph0" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
 static const char *mod_parents[] = { "hosc", "pll_periph0", "pll_periph1" };
 
@@ -153,6 +153,13 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	__BITS(5,4),	/* div */
 	__BITS(13,12),	/* sel */
 	SUNXI_CCU_PREDIV_POWER_OF_TWO),
+	SUNXI_CCU_PREDIV(H3_CLK_AHB2, "ahb2", ahb2_parents,
+	APB2_CFG_REG,	/* reg */
+	0,			/* prediv */
+	__BIT(1),		/* prediv_sel */
+	0,			/* div */
+	__BITS(1,0),	/* sel */
+	SUNXI_CCU_PREDIV_DIVIDE_BY_TWO),
 
 	SUNXI_CCU_NM(H3_CLK_APB2, "apb2", apb2_parents,
 	APB2_CFG_REG,	/* reg */
@@ -178,9 +185,56 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	BUS_CLK_GATING_REG0, 9),
 	SUNXI_CCU_GATE(H3_CLK_BUS_MMC2, "bus-mmc2", "ahb1",
 	BUS_CLK_GATING_REG0, 10),
-
+	SUNXI_CCU_GATE(H3_CLK_BUS_OTG, "bus-otg", "ahb1",
+	BUS_CLK_GATING_REG0, 23),
+	SUNXI_CCU_GATE(H3_CLK_BUS_EHCI0, "bus-ehci0", "ahb1",
+	BUS_CLK_GATING_REG0, 24),
+	SUNXI_CCU_GATE(H3_CLK_BUS_EHCI1, "bus-ehci1", "ahb2",
+	BUS_CLK_GATING_REG0, 25),
+	SUNXI_CCU_GATE(H3_CLK_BUS_EHCI2, "bus-ehci2", "ahb2",
+	BUS_CLK_GATING_REG0, 26),
+	SUNXI_CCU_GATE(H3_CLK_BUS_EHCI3, "bus-ehci3", "ahb2",
+	BUS_CLK_GATING_REG0, 27),
+	SUNXI_CCU_GATE(H3_CLK_BUS_OHCI0, 

CVS commit: src/sys/arch/arm/sunxi

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:06:21 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu_gate.c

Log Message:
Support parents in different clock domains.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_ccu_gate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_ccu_gate.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_gate.c:1.1 src/sys/arch/arm/sunxi/sunxi_ccu_gate.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_ccu_gate.c:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu_gate.c	Thu Jun 29 17:06:21 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_gate.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_gate.c,v 1.2 2017/06/29 17:06:21 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_gate.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_gate.c,v 1.2 2017/06/29 17:06:21 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,13 +59,8 @@ const char *
 sunxi_ccu_gate_get_parent(struct sunxi_ccu_softc *sc, struct sunxi_ccu_clk *clk)
 {
 	struct sunxi_ccu_gate *gate = >u.gate;
-	struct sunxi_ccu_clk *clk_parent;
 
 	KASSERT(clk->type == SUNXI_CCU_GATE);
 
-	clk_parent = sunxi_ccu_clock_find(sc, gate->parent);
-	if (clk_parent == NULL)
-		return NULL;
-
-	return clk_parent->base.name;
+	return gate->parent;
 }



CVS commit: src/sys/dev/fdt

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:04:54 UTC 2017

Added Files:
src/sys/dev/fdt: ehci_fdt.c ohci_fdt.c

Log Message:
Add glue for generic ehci/ohci bindings.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/ehci_fdt.c src/sys/dev/fdt/ohci_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/dev/fdt/ehci_fdt.c
diff -u /dev/null src/sys/dev/fdt/ehci_fdt.c:1.1
--- /dev/null	Thu Jun 29 17:04:54 2017
+++ src/sys/dev/fdt/ehci_fdt.c	Thu Jun 29 17:04:53 2017
@@ -0,0 +1,170 @@
+/* $NetBSD: ehci_fdt.c,v 1.1 2017/06/29 17:04:53 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015-2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ehci_fdt.c,v 1.1 2017/06/29 17:04:53 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static int	ehci_fdt_match(device_t, cfdata_t, void *);
+static void	ehci_fdt_attach(device_t, device_t, void *);
+
+CFATTACH_DECL2_NEW(ehci_fdt, sizeof(struct ehci_softc),
+	ehci_fdt_match, ehci_fdt_attach, NULL,
+	ehci_activate, NULL, ehci_childdet);
+
+static void
+ehci_fdt_find_companions(struct ehci_softc *sc)
+{
+	const char * drivers[] = { "ohci", "uhci", NULL };
+	device_t comp_dev;
+	int unit, n;
+
+	/* XXX find an ohci or uhci with the same unit as us */
+	unit = device_unit(sc->sc_dev);
+
+	for (n = 0; drivers[n] != NULL; n++) {
+		comp_dev = device_find_by_driver_unit(drivers[n], unit);
+		if (comp_dev != NULL)
+			sc->sc_comps[sc->sc_ncomp++] = comp_dev;
+	}
+}
+
+static int
+ehci_fdt_match(device_t parent, cfdata_t cf, void *aux)
+{
+	const char * const compatible[] = {
+		"generic-ehci",
+		NULL
+	};
+	struct fdt_attach_args * const faa = aux;
+
+	return of_match_compatible(faa->faa_phandle, compatible);
+}
+
+static void
+ehci_fdt_attach(device_t parent, device_t self, void *aux)
+{
+	struct ehci_softc * const sc = device_private(self);
+	struct fdt_attach_args * const faa = aux;
+	const int phandle = faa->faa_phandle;
+	struct fdtbus_reset *rst;
+	struct fdtbus_phy *phy;
+	struct clk *clk;
+	char intrstr[128];
+	bus_addr_t addr;
+	bus_size_t size;
+	int error;
+	void *ih;
+	u_int n;
+
+	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
+		aprint_error(": couldn't get registers\n");
+		return;
+	}
+
+	/* Enable clocks */
+	for (n = 0; (clk = fdtbus_clock_get_index(phandle, n)) != NULL; n++)
+		if (clk_enable(clk) != 0) {
+			aprint_error(": couldn't enable clock #%d\n", n);
+			return;
+		}
+	/* De-assert resets */
+	for (n = 0; (rst = fdtbus_reset_get_index(phandle, n)) != NULL; n++)
+		if (fdtbus_reset_deassert(rst) != 0) {
+			aprint_error(": couldn't de-assert reset #%d\n", n);
+			return;
+		}
+
+	/* Enable optional phy */
+	phy = fdtbus_phy_get(phandle, "usb");
+	if (phy && fdtbus_phy_enable(phy, true) != 0) {
+		aprint_error(": couldn't enable phy\n");
+		return;
+	}
+
+	sc->sc_dev = self;
+	sc->sc_bus.ub_hcpriv = sc;
+	sc->sc_bus.ub_dmatag = faa->faa_dmat;
+	sc->sc_bus.ub_revision = USBREV_2_0;
+	if (of_hasprop(phandle, "has-transaction-translator"))
+		sc->sc_flags |= EHCIF_ETTF;
+	else
+		ehci_fdt_find_companions(sc);
+	sc->sc_id_vendor = 0;
+	strlcpy(sc->sc_vendor, "Generic", sizeof(sc->sc_vendor));
+	sc->sc_size = size;
+	sc->iot = faa->faa_bst;
+	if (bus_space_map(sc->iot, addr, size, 0, >ioh) != 0) {
+		aprint_error(": couldn't map registers\n");
+		return;
+	}
+
+	aprint_naive("\n");
+	aprint_normal(": EHCI\n");
+
+	/* Disable interrupts */
+	sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
+	

CVS commit: src/sys/arch/arm/sunxi

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:05:27 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_com.c

Log Message:
Rename a variable, NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_com.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_com.c
diff -u src/sys/arch/arm/sunxi/sunxi_com.c:1.1 src/sys/arch/arm/sunxi/sunxi_com.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_com.c:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/arm/sunxi/sunxi_com.c	Thu Jun 29 17:05:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_com.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */
+/* $NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -72,8 +72,8 @@ sunxi_com_match(device_t parent, cfdata_
 static void
 sunxi_com_attach(device_t parent, device_t self, void *aux)
 {
-	struct sunxi_com_softc * const tsc = device_private(self);
-	struct com_softc * const sc = >ssc_sc;
+	struct sunxi_com_softc * const ssc = device_private(self);
+	struct com_softc * const sc = >ssc_sc;
 	struct fdt_attach_args * const faa = aux;
 	bus_space_handle_t bsh;
 	bus_space_tag_t bst;
@@ -105,15 +105,15 @@ sunxi_com_attach(device_t parent, device
 
 	sc->sc_dev = self;
 
-	tsc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0);
-	tsc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
+	ssc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0);
+	ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
 
-	if (tsc->ssc_clk == NULL) {
+	if (ssc->ssc_clk == NULL) {
 		aprint_error(": couldn't get frequency\n");
 		return;
 	}
 
-	sc->sc_frequency = clk_get_rate(tsc->ssc_clk);
+	sc->sc_frequency = clk_get_rate(ssc->ssc_clk);
 	sc->sc_type = COM_TYPE_NORMAL;
 
 	error = bus_space_map(bst, addr, size, 0, );
@@ -132,9 +132,9 @@ sunxi_com_attach(device_t parent, device
 		return;
 	}
 
-	tsc->ssc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL,
+	ssc->ssc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL,
 	FDT_INTR_MPSAFE, comintr, sc);
-	if (tsc->ssc_ih == NULL) {
+	if (ssc->ssc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
 	}



CVS commit: src/sys/dev/fdt

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 17:04:17 UTC 2017

Modified Files:
src/sys/dev/fdt: fdtvar.h files.fdt
Added Files:
src/sys/dev/fdt: fdt_phy.c

Log Message:
Add FDT PHY interface.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_phy.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/files.fdt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.20 src/sys/dev/fdt/fdtvar.h:1.21
--- src/sys/dev/fdt/fdtvar.h:1.20	Fri Jun  2 13:53:29 2017
+++ src/sys/dev/fdt/fdtvar.h	Thu Jun 29 17:04:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.20 2017/06/02 13:53:29 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.21 2017/06/29 17:04:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -172,6 +172,19 @@ struct fdtbus_power_controller_func {
 	void	(*poweroff)(device_t);
 };
 
+struct fdtbus_phy_controller;
+
+struct fdtbus_phy {
+	struct fdtbus_phy_controller *phy_pc;
+	void *phy_priv;
+};
+
+struct fdtbus_phy_controller_func {
+	void *	(*acquire)(device_t, const void *, size_t);
+	void	(*release)(device_t, void *);
+	int	(*enable)(device_t, void *, bool);
+};
+
 struct fdt_console {
 	int	(*match)(int);
 	void	(*consinit)(struct fdt_attach_args *, u_int);
@@ -210,6 +223,8 @@ int		fdtbus_register_dma_controller(devi
 		const struct fdtbus_dma_controller_func *);
 int		fdtbus_register_power_controller(device_t, int,
 		const struct fdtbus_power_controller_func *);
+int		fdtbus_register_phy_controller(device_t, int,
+		const struct fdtbus_phy_controller_func *);
 
 int		fdtbus_get_reg(int, u_int, bus_addr_t *, bus_size_t *);
 int		fdtbus_get_reg64(int, u_int, uint64_t *, uint64_t *);
@@ -254,6 +269,11 @@ void		fdtbus_reset_put(struct fdtbus_res
 int		fdtbus_reset_assert(struct fdtbus_reset *);
 int		fdtbus_reset_deassert(struct fdtbus_reset *);
 
+struct fdtbus_phy *fdtbus_phy_get(int, const char *);
+struct fdtbus_phy *fdtbus_phy_get_index(int, u_int);
+void		fdtbus_phy_put(struct fdtbus_phy *);
+int		fdtbus_phy_enable(struct fdtbus_phy *, bool);
+
 int		fdtbus_todr_attach(device_t, int, todr_chip_handle_t);
 
 void		fdtbus_power_reset(void);

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.16 src/sys/dev/fdt/files.fdt:1.17
--- src/sys/dev/fdt/files.fdt:1.16	Sat Jun  3 14:48:03 2017
+++ src/sys/dev/fdt/files.fdt	Thu Jun 29 17:04:17 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.16 2017/06/03 14:48:03 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.17 2017/06/29 17:04:17 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -29,6 +29,7 @@ file	dev/fdt/fdt_dma.c			fdtbus
 file	dev/fdt/fdt_gpio.c			fdtbus
 file	dev/fdt/fdt_i2c.c			fdtbus
 file	dev/fdt/fdt_intr.c			fdtbus
+file	dev/fdt/fdt_phy.c			fdtbus
 file	dev/fdt/fdt_power.c			fdtbus
 file	dev/fdt/fdt_regulator.c			fdtbus
 file	dev/fdt/fdt_reset.c			fdtbus

Added files:

Index: src/sys/dev/fdt/fdt_phy.c
diff -u /dev/null src/sys/dev/fdt/fdt_phy.c:1.1
--- /dev/null	Thu Jun 29 17:04:17 2017
+++ src/sys/dev/fdt/fdt_phy.c	Thu Jun 29 17:04:17 2017
@@ -0,0 +1,181 @@
+/* $NetBSD: fdt_phy.c,v 1.1 2017/06/29 17:04:17 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015-2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: fdt_phy.c,v 1.1 2017/06/29 17:04:17 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct fdtbus_phy_controller {
+	device_t pc_dev;
+	int pc_phandle;
+	const struct 

CVS commit: [netbsd-7] src/doc

2017-06-29 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Jun 29 12:25:04 UTC 2017

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Ticket #1412


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-7.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.23 src/doc/CHANGES-7.2:1.1.2.24
--- src/doc/CHANGES-7.2:1.1.2.23	Wed Jun 21 17:27:15 2017
+++ src/doc/CHANGES-7.2	Thu Jun 29 12:25:04 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.23 2017/06/21 17:27:15 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.24 2017/06/29 12:25:04 sborrill Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2388,3 +2388,14 @@ external/mit/expat/dist/xmlwf/xmlwf.dsp 
 	Update expat to 2.2.1.
 	[spz, ticket #1437]
 
+sys/external/bsd/ipf/netinet/fil.c		1.20
+sys/external/bsd/ipf/netinet/ip_state.c		1.7
+sys/external/bsd/ipf/netinet/ip_frag.c		1.5
+
+	Disconnect maintaining fragment state from keeping session state.
+	The user now must specify keep frags along with keep state to have 
+	ipfilter do what it did before, as documented in ipf.conf.5.
+	Free the right fragment. This will cause use after free issues and
+	eventually panic.
+	[christos, ticket #1412]
+



CVS commit: [netbsd-7] src/sys/external/bsd/ipf/netinet

2017-06-29 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Thu Jun 29 12:24:10 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-7]: fil.c ip_frag.c ip_state.c

Log Message:
Pull up the following revisions(s) (requested by christos in ticket #1412):
sys/external/bsd/ipf/netinet/fil.c: revision 1.20
sys/external/bsd/ipf/netinet/ip_state.c:revision 1.7
sys/external/bsd/ipf/netinet/ip_frag.c: revision 1.5

Disconnect maintaining fragment state from keeping session state. The user
now must specify keep frags along with keep state to have ipfilter do what
it did before, as documented in ipf.conf.5.
Free the right fragment. This will cause use after free issues and eventually
panic.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.3 -r1.3.14.1 src/sys/external/bsd/ipf/netinet/ip_frag.c
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/external/bsd/ipf/netinet/ip_state.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.2 src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.3
--- src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.2	Fri Apr 29 19:00:40 2016
+++ src/sys/external/bsd/ipf/netinet/fil.c	Thu Jun 29 12:24:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.15.2.2 2016/04/29 19:00:40 snj Exp $	*/
+/*	$NetBSD: fil.c,v 1.15.2.3 2017/06/29 12:24:10 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.2 2016/04/29 19:00:40 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.3 2017/06/29 12:24:10 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -2689,7 +2689,7 @@ ipf_firewall(fr_info_t *fin, u_32_t *pas
 	 * If the rule has "keep frag" and the packet is actually a fragment,
 	 * then create a fragment state entry.
 	 */
-	if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) {
+	if (pass & FR_KEEPFRAG) {
 		if (fin->fin_flx & FI_FRAG) {
 			if (ipf_frag_new(softc, fin, pass) == -1) {
 LBUMP(ipf_stats[out].fr_bnfr);

Index: src/sys/external/bsd/ipf/netinet/ip_frag.c
diff -u src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3 src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3.14.1
--- src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3	Sun Jul 22 14:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_frag.c	Thu Jun 29 12:24:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_frag.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_frag.c,v 1.3.14.1 2017/06/29 12:24:10 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -87,7 +87,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.3.14.1 2017/06/29 12:24:10 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)ip_frag.c	1.11 3/24/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_frag.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -468,7 +468,7 @@ ipfr_frag_new(
 			  IPFR_CMPSZ)) {
 			RWLOCK_EXIT(lock);
 			FBUMPD(ifs_exists);
-			KFREE(fra);
+			KFREE(fran);
 			return NULL;
 		}
 

Index: src/sys/external/bsd/ipf/netinet/ip_state.c
diff -u src/sys/external/bsd/ipf/netinet/ip_state.c:1.6 src/sys/external/bsd/ipf/netinet/ip_state.c:1.6.4.1
--- src/sys/external/bsd/ipf/netinet/ip_state.c:1.6	Sat Sep 14 12:16:11 2013
+++ src/sys/external/bsd/ipf/netinet/ip_state.c	Thu Jun 29 12:24:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_state.c,v 1.6 2013/09/14 12:16:11 martin Exp $	*/
+/*	$NetBSD: ip_state.c,v 1.6.4.1 2017/06/29 12:24:10 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -100,7 +100,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.6 2013/09/14 12:16:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.6.4.1 2017/06/29 12:24:10 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)ip_state.c	1.8 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_state.c,v 1.1.1.2 2012/07/22 13:45:37 darrenr Exp";
@@ -3341,7 +3341,8 @@ ipf_state_check(fr_info_t *fin, u_32_t *
 	 * If this packet is a fragment and the rule says to track fragments,
 	 * then create a new fragment cache entry.
 	 */
-	if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass))
+	if (fin->fin_flx & FI_FRAG && FR_ISPASS(is->is_pass) &&
+	   is->is_pass & FR_KEEPFRAG)
 		(void) ipf_frag_new(softc, fin, is->is_pass);
 
 	/*



CVS commit: src/sys/arch/arm/sunxi

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 10:53:59 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun8i_h3_ccu.c sunxi_ccu.c sunxi_ccu.h
sunxi_ccu_nkmp.c sunxi_ccu_nm.c

Log Message:
SD/MMC clock fixes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c \
src/sys/arch/arm/sunxi/sunxi_ccu.c src/sys/arch/arm/sunxi/sunxi_ccu.h \
src/sys/arch/arm/sunxi/sunxi_ccu_nm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.2 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.3
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.2	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Thu Jun 29 10:53:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
 
 #include 
 #include 
@@ -138,8 +138,13 @@ static const char *mod_parents[] = { "ho
 
 static struct sunxi_ccu_clk sun8i_h3_ccu_clks[] = {
 	SUNXI_CCU_NKMP(H3_CLK_PLL_PERIPH0, "pll_periph0", "hosc",
-	PLL_PERIPH0_CTRL_REG, __BITS(12,8), __BITS(5,3), 0, __BITS(17,16), __BIT(31),
-	0),
+	PLL_PERIPH0_CTRL_REG,	/* reg */
+	__BITS(12,8),		/* n */
+	__BITS(5,4), 		/* k */
+	0,/* m */
+	__BITS(17,16),		/* p */
+	__BIT(31),			/* enable */
+	SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
 
 	SUNXI_CCU_PREDIV(H3_CLK_AHB1, "ahb1", ahb1_parents,
 	AHB1_APB1_CFG_REG,	/* reg */
Index: src/sys/arch/arm/sunxi/sunxi_ccu.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.c:1.2 src/sys/arch/arm/sunxi/sunxi_ccu.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_ccu.c:1.2	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu.c	Thu Jun 29 10:53:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
 
 #include 
 #include 
@@ -327,10 +327,11 @@ sunxi_ccu_print(struct sunxi_ccu_softc *
 		case SUNXI_CCU_GATE:	type = "gate"; break;
 		case SUNXI_CCU_NM:	type = "nm"; break;
 		case SUNXI_CCU_NKMP:	type = "nkmp"; break;
+		case SUNXI_CCU_PREDIV:	type = "prediv"; break;
 		default:		type = "???"; break;
 		}
 
-	printf("  %-12s %2s %-12s %-5s ",
+	printf("  %-12s %2s %-12s %-7s ",
 	clk->base.name,
 	clkp_parent ? "<-" : "",
 	clkp_parent ? clkp_parent->name : "",
Index: src/sys/arch/arm/sunxi/sunxi_ccu.h
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.h:1.2 src/sys/arch/arm/sunxi/sunxi_ccu.h:1.3
--- src/sys/arch/arm/sunxi/sunxi_ccu.h:1.2	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu.h	Thu Jun 29 10:53:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.h,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.h,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -94,6 +94,7 @@ struct sunxi_ccu_nkmp {
 	uint32_t	lock;
 	uint32_t	enable;
 	uint32_t	flags;
+#define	SUNXI_CCU_NKMP_DIVIDE_BY_TWO	__BIT(0)
 };
 
 int	sunxi_ccu_nkmp_enable(struct sunxi_ccu_softc *,
Index: src/sys/arch/arm/sunxi/sunxi_ccu_nm.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.2 src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.2	Thu Jun 29 09:26:06 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu_nm.c	Thu Jun 29 10:53:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_nm.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
 
 #include 
 #include 
@@ -146,6 +146,7 @@ sunxi_ccu_nm_set_rate(struct sunxi_ccu_s
 if (nm->flags & SUNXI_CCU_NM_ROUND_DOWN) {
 	const int diff = new_rate - rate;
 	if (diff >= 0 && rate > best_rate) {
+		best_diff = diff;
 		best_rate = rate;
 		best_n = n;
 		best_m = m;
@@ -154,6 +155,7 @@ sunxi_ccu_nm_set_rate(struct sunxi_ccu_s
 } else {
 	

CVS commit: src/sys/arch

2017-06-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 29 09:26:06 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi sun8i_h3_ccu.c sunxi_ccu.c
sunxi_ccu.h sunxi_ccu_nm.c
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_ccu_nkmp.c sunxi_ccu_prediv.c sunxi_mmc.c
sunxi_mmc.h

Log Message:
Add H3 MMC support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/files.sunxi \
src/sys/arch/arm/sunxi/sun8i_h3_ccu.c src/sys/arch/arm/sunxi/sunxi_ccu.c \
src/sys/arch/arm/sunxi/sunxi_ccu.h src/sys/arch/arm/sunxi/sunxi_ccu_nm.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c \
src/sys/arch/arm/sunxi/sunxi_ccu_prediv.c \
src/sys/arch/arm/sunxi/sunxi_mmc.c src/sys/arch/arm/sunxi/sunxi_mmc.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.1 src/sys/arch/arm/sunxi/files.sunxi:1.2
--- src/sys/arch/arm/sunxi/files.sunxi:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Thu Jun 29 09:26:06 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.1 2017/06/28 23:51:29 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.2 2017/06/29 09:26:06 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -22,7 +22,10 @@ define	sunxi_ccu
 file	arch/arm/sunxi/sunxi_ccu.c		sunxi_ccu
 file	arch/arm/sunxi/sunxi_ccu_gate.c		sunxi_ccu
 file	arch/arm/sunxi/sunxi_ccu_nm.c		sunxi_ccu
+file	arch/arm/sunxi/sunxi_ccu_nkmp.c		sunxi_ccu
+file	arch/arm/sunxi/sunxi_ccu_prediv.c	sunxi_ccu
 
+# CCU (H3)
 device	sun8ih3ccu: sunxi_ccu
 attach	sun8ih3ccu at fdt with sunxi_h3_ccu
 file	arch/arm/sunxi/sun8i_h3_ccu.c		sunxi_h3_ccu
@@ -31,6 +34,11 @@ file	arch/arm/sunxi/sun8i_h3_ccu.c		sunx
 attach	com at fdt with sunxi_com
 file	arch/arm/sunxi/sunxi_com.c		sunxi_com needs-flag
 
+# SD/MMC
+device	sunximmc: sdmmcbus
+attach	sunximmc at fdt with sunxi_mmc
+file	arch/arm/sunxi/sunxi_mmc.c		sunxi_mmc
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI
Index: src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.1 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.2
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Thu Jun 29 09:26:06 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
 
 #include 
 #include 
@@ -49,8 +49,14 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #define	BUS_SOFT_RST_REG3	0x2d0
 #define	BUS_SOFT_RST_REG4	0x2d8
 
+#define	PLL_PERIPH0_CTRL_REG	0x028
+#define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
+#define	BUS_CLK_GATING_REG0	0x060
 #define	BUS_CLK_GATING_REG3	0x06c
+#define	SDMMC0_CLK_REG		0x088
+#define	SDMMC1_CLK_REG		0x08c
+#define	SDMMC2_CLK_REG		0x090
 
 static int sun8i_h3_ccu_match(device_t, cfdata_t, void *);
 static void sun8i_h3_ccu_attach(device_t, device_t, void *);
@@ -126,13 +132,48 @@ static struct sunxi_ccu_reset sun8i_h3_c
 	SUNXI_CCU_RESET(H3_RST_BUS_SCR, BUS_SOFT_RST_REG4, 20),
 };
 
+static const char *ahb1_parents[] = { "losc", "hosc", "axi", "pll_periph0" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
+static const char *mod_parents[] = { "hosc", "pll_periph0", "pll_periph1" };
 
 static struct sunxi_ccu_clk sun8i_h3_ccu_clks[] = {
+	SUNXI_CCU_NKMP(H3_CLK_PLL_PERIPH0, "pll_periph0", "hosc",
+	PLL_PERIPH0_CTRL_REG, __BITS(12,8), __BITS(5,3), 0, __BITS(17,16), __BIT(31),
+	0),
+
+	SUNXI_CCU_PREDIV(H3_CLK_AHB1, "ahb1", ahb1_parents,
+	AHB1_APB1_CFG_REG,	/* reg */
+	__BITS(7,6),	/* prediv */
+	__BIT(3),		/* prediv_sel */
+	__BITS(5,4),	/* div */
+	__BITS(13,12),	/* sel */
+	SUNXI_CCU_PREDIV_POWER_OF_TWO),
+
 	SUNXI_CCU_NM(H3_CLK_APB2, "apb2", apb2_parents,
-	APB2_CFG_REG, __BITS(17,16), __BITS(4,0), __BITS(25,24),
+	APB2_CFG_REG,	/* reg */
+	__BITS(17,16),	/* n */
+	__BITS(4,0),	/* m */
+	__BITS(25,24),	/* sel */
+	0,			/* enable */
 	SUNXI_CCU_NM_POWER_OF_TWO),
 
+	SUNXI_CCU_NM(H3_CLK_MMC0, "mmc0", mod_parents,
+	SDMMC0_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
+	SUNXI_CCU_NM(H3_CLK_MMC1, "mmc1", mod_parents,
+	SDMMC1_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
+	

CVS commit: src/sys/rump/dev/lib/libopencrypto

2017-06-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Jun 29 08:51:27 UTC 2017

Modified Files:
src/sys/rump/dev/lib/libopencrypto: opencrypto_component.c

Log Message:
reduce rump waring message. pointed out by ozaki-r@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c
diff -u src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c:1.4 src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c:1.5
--- src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c:1.4	Tue Jan 26 23:12:15 2016
+++ src/sys/rump/dev/lib/libopencrypto/opencrypto_component.c	Thu Jun 29 08:51:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: opencrypto_component.c,v 1.4 2016/01/26 23:12:15 pooka Exp $ */
+/*	$NetBSD: opencrypto_component.c,v 1.5 2017/06/29 08:51:27 knakahara Exp $ */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: opencrypto_component.c,v 1.4 2016/01/26 23:12:15 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opencrypto_component.c,v 1.5 2017/06/29 08:51:27 knakahara Exp $");
 
 #include 
 #include 
@@ -64,5 +64,20 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV)
 	 */
 	crypto_init();
 	rump_pdev_add(cryptoattach, 1);
+#if 0
+	/*
+	 * rump defines "_MODULE" in spite of using built-in module
+	 * initialization(module_init_class()). So, swcryptoattach_internal()
+	 * is called by two functions, one is swcryptoattach() and the other is
+	 * swcrypto_modcmd().
+	 * That causes "builtin module `swcrypto' failed to init" WARNING message.
+	 * To suppress this warning, we let rump use swcrypto_modcmd() call-path
+	 * only.
+	 *
+	 * TODO:
+	 * There is still "crypto: unable to register devsw" message. it should
+	 * be suppressed.
+	 */
 	rump_pdev_add(swcryptoattach, 0);
+#endif
 }



CVS commit: src/usr.bin/netstat

2017-06-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jun 29 07:15:27 UTC 2017

Modified Files:
src/usr.bin/netstat: fast_ipsec.c

Log Message:
Tweak outputs of netstat -s for IPsec

- Get rid of "Fast"
- Use ipsec and ipsec6 for titles to clarify protocol
- Indent outputs of sub protocols

Original outputs were organized like this:

(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:
(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:

New outputs are organized like this:

ipsec:
ah:
esp:
ipip:
ipcomp:
ipsec6:
ah:
esp:
ipip:
ipcomp:


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/netstat/fast_ipsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/netstat/fast_ipsec.c
diff -u src/usr.bin/netstat/fast_ipsec.c:1.21 src/usr.bin/netstat/fast_ipsec.c:1.22
--- src/usr.bin/netstat/fast_ipsec.c:1.21	Thu Apr 13 16:38:32 2017
+++ src/usr.bin/netstat/fast_ipsec.c	Thu Jun 29 07:15:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fast_ipsec.c,v 1.21 2017/04/13 16:38:32 christos Exp $ */
+/*	$NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $ */
 /* 	$FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $ */
 
 /*-
@@ -33,7 +33,7 @@
 #include 
 #ifndef lint
 #ifdef __NetBSD__
-__RCSID("$NetBSD: fast_ipsec.c,v 1.21 2017/04/13 16:38:32 christos Exp $");
+__RCSID("$NetBSD: fast_ipsec.c,v 1.22 2017/06/29 07:15:27 ozaki-r Exp $");
 #endif
 #endif /* not lint*/
 
@@ -145,7 +145,7 @@ fast_ipsec_stats(u_long off, const char 
 	if (status < 0 && errno != ENOMEM)
 		err(1, "net.inet.ipip.ipip_stats");
 
-	printf("(Fast) IPsec:\n");
+	printf("%s:\n", name);
 
 #define	STAT(x,fmt)	if ((x) || sflag <= 1) printf("\t%"PRIu64" " fmt "\n", x)
 	if (ipsecstats[IPSEC_STAT_IN_POLVIO]+ipsecstats[IPSEC_STAT_OUT_POLVIO])
@@ -160,10 +160,9 @@ fast_ipsec_stats(u_long off, const char 
 	STAT(ipsecstats[IPSEC_STAT_SPDCACHELOOKUP], "SPD cache lookups");
 	STAT(ipsecstats[IPSEC_STAT_SPDCACHEMISS], "SPD cache misses");
 #undef STAT
-	printf("\n");
 	
-	printf("IPsec ah:\n");
-#define	AHSTAT(x,fmt)	if ((x) || sflag <= 1) printf("\t%"PRIu64" ah " fmt "\n", x)
+	printf("\tah:\n");
+#define	AHSTAT(x,fmt)	if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ah " fmt "\n", x)
 	AHSTAT(ahstats[AH_STAT_INPUT],   "input packets processed");
 	AHSTAT(ahstats[AH_STAT_OUTPUT],  "output packets processed");
 	AHSTAT(ahstats[AH_STAT_HDROPS],  "headers too short");
@@ -192,10 +191,9 @@ fast_ipsec_stats(u_long off, const char 
 	AHSTAT(ahstats[AH_STAT_IBYTES], "bytes received");
 	AHSTAT(ahstats[AH_STAT_OBYTES], "bytes transmitted");
 #undef AHSTAT
-	printf("\n");
 
-	printf("IPsec esp:\n");
-#define	ESPSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t%"PRIu64" esp " fmt "\n", x)
+	printf("\tesp:\n");
+#define	ESPSTAT(x,fmt) if ((x) || sflag <= 1) printf("\t\t%"PRIu64" esp " fmt "\n", x)
 	ESPSTAT(espstats[ESP_STAT_INPUT],"input packets processed");
 	ESPSTAT(espstats[ESP_STAT_OUTPUT],"output packets processed");
 	ESPSTAT(espstats[ESP_STAT_HDROPS],"headers too short");
@@ -224,10 +222,10 @@ fast_ipsec_stats(u_long off, const char 
 	ESPSTAT(espstats[ESP_STAT_IBYTES], "bytes received");
 	ESPSTAT(espstats[ESP_STAT_OBYTES], "bytes transmitted");
 #undef ESPSTAT
-	printf("IPsec ipip:\n");
+	printf("\tipip:\n");
 
 #define	IPIPSTAT(x,fmt) \
-	if ((x) || sflag <= 1) printf("\t%"PRIu64" ipip " fmt "\n", x)
+	if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ipip " fmt "\n", x)
 	IPIPSTAT(ipips[IPIP_STAT_IPACKETS],"total input packets");
 	IPIPSTAT(ipips[IPIP_STAT_OPACKETS],"total output packets");
 	IPIPSTAT(ipips[IPIP_STAT_HDROPS],"packets too short for header length");
@@ -240,9 +238,9 @@ fast_ipsec_stats(u_long off, const char 
 	IPIPSTAT(ipips[IPIP_STAT_OBYTES],"output bytes processed");
 #undef IPIPSTAT
 
-	printf("IPsec ipcomp:\n");
+	printf("\tipcomp:\n");
 #define	IPCOMP(x,fmt) \
-	if ((x) || sflag <= 1) printf("\t%"PRIu64" ipcomp " fmt "\n", x)
+	if ((x) || sflag <= 1) printf("\t\t%"PRIu64" ipcomp " fmt "\n", x)
 
 	IPCOMP(ipcs[IPCOMP_STAT_HDROPS],"packets too short for header length");
 	IPCOMP(ipcs[IPCOMP_STAT_NOPF],	"protocol family not supported");
@@ -260,7 +258,7 @@ fast_ipsec_stats(u_long off, const char 
 	IPCOMP(ipcs[IPCOMP_STAT_PDROPS],"packets blocked due to policy");
 	IPCOMP(ipcs[IPCOMP_STAT_CRYPTO],"failed crypto requests");
 
-	printf("\tIPcomp histogram:\n");
+	printf("\tipcomp histogram:\n");
 	for (i = 0; i < IPCOMP_ALG_MAX; i++)
 		if (ipcs[IPCOMP_STAT_HIST + i])
 			printf("\t\tIPcomp packets with %s: %"PRIu64"\n"



CVS commit: src/sys/netipsec

2017-06-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jun 29 07:13:41 UTC 2017

Modified Files:
src/sys/netipsec: xform_ah.c xform_esp.c xform_ipcomp.c xform_ipip.c
xform_tcp.c

Log Message:
Apply C99-style struct initialization to xformsw


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.55 -r1.56 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.38 -r1.39 src/sys/netipsec/xform_ipcomp.c
cvs rdiff -u -r1.49 -r1.50 src/sys/netipsec/xform_ipip.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netipsec/xform_tcp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.54 src/sys/netipsec/xform_ah.c:1.55
--- src/sys/netipsec/xform_ah.c:1.54	Thu May 11 05:55:14 2017
+++ src/sys/netipsec/xform_ah.c	Thu Jun 29 07:13:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.54 2017/05/11 05:55:14 ryo Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.55 2017/06/29 07:13:41 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.54 2017/05/11 05:55:14 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.55 2017/06/29 07:13:41 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1291,9 +1291,14 @@ bad:
 }
 
 static struct xformsw ah_xformsw = {
-	XF_AH,		XFT_AUTH,	"IPsec AH",
-	ah_init,	ah_zeroize,	ah_input,	ah_output,
-	NULL,
+	.xf_type	= XF_AH,
+	.xf_flags	= XFT_AUTH,
+	.xf_name	= "IPsec AH",
+	.xf_init	= ah_init,
+	.xf_zeroize	= ah_zeroize,
+	.xf_input	= ah_input,
+	.xf_output	= ah_output,
+	.xf_next	= NULL,
 };
 
 void

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.55 src/sys/netipsec/xform_esp.c:1.56
--- src/sys/netipsec/xform_esp.c:1.55	Thu May 11 05:55:14 2017
+++ src/sys/netipsec/xform_esp.c	Thu Jun 29 07:13:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.55 2017/05/11 05:55:14 ryo Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.56 2017/06/29 07:13:41 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.55 2017/05/11 05:55:14 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.56 2017/06/29 07:13:41 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1063,10 +1063,14 @@ bad:
 }
 
 static struct xformsw esp_xformsw = {
-	XF_ESP,		XFT_CONF|XFT_AUTH,	"IPsec ESP",
-	esp_init,	esp_zeroize,		esp_input,
-	esp_output,
-	NULL,
+	.xf_type	= XF_ESP,
+	.xf_flags	= XFT_CONF|XFT_AUTH,
+	.xf_name	= "IPsec ESP",
+	.xf_init	= esp_init,
+	.xf_zeroize	= esp_zeroize,
+	.xf_input	= esp_input,
+	.xf_output	= esp_output,
+	.xf_next	= NULL,
 };
 
 void

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.38 src/sys/netipsec/xform_ipcomp.c:1.39
--- src/sys/netipsec/xform_ipcomp.c:1.38	Thu May 11 05:55:14 2017
+++ src/sys/netipsec/xform_ipcomp.c	Thu Jun 29 07:13:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.38 2017/05/11 05:55:14 ryo Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.39 2017/06/29 07:13:41 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.38 2017/05/11 05:55:14 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.39 2017/06/29 07:13:41 ozaki-r Exp $");
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #if defined(_KERNEL_OPT)
@@ -658,10 +658,14 @@ bad:
 }
 
 static struct xformsw ipcomp_xformsw = {
-	XF_IPCOMP,		XFT_COMP,		"IPcomp",
-	ipcomp_init,		ipcomp_zeroize,		ipcomp_input,
-	ipcomp_output,
-	NULL,
+	.xf_type	= XF_IPCOMP,
+	.xf_flags	= XFT_COMP,
+	.xf_name	= "IPcomp",
+	.xf_init	= ipcomp_init,
+	.xf_zeroize	= ipcomp_zeroize,
+	.xf_input	= ipcomp_input,
+	.xf_output	= ipcomp_output,
+	.xf_next	= NULL,
 };
 
 void

Index: src/sys/netipsec/xform_ipip.c
diff -u src/sys/netipsec/xform_ipip.c:1.49 src/sys/netipsec/xform_ipip.c:1.50
--- src/sys/netipsec/xform_ipip.c:1.49	Thu May 11 05:55:14 2017
+++ src/sys/netipsec/xform_ipip.c	Thu Jun 29 07:13:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipip.c,v 1.49 2017/05/11 05:55:14 ryo Exp $	*/
+/*	$NetBSD: xform_ipip.c,v 1.50 2017/06/29 07:13:41 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.49 2017/05/11 05:55:14 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: