CVS commit: src/libexec/httpd

2015-12-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 31 04:39:16 UTC 2015

Modified Files:
src/libexec/httpd: cgi-bozo.c

Log Message:
redo the fix for rev 1.26 - instead of getting a new string wrong,
just delay the free until the parent has finished using them.
also, free query as well.

fixes PR#50374.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/libexec/httpd/cgi-bozo.c

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

Modified files:

Index: src/libexec/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.31 src/libexec/httpd/cgi-bozo.c:1.32
--- src/libexec/httpd/cgi-bozo.c:1.31	Tue Dec 29 04:21:46 2015
+++ src/libexec/httpd/cgi-bozo.c	Thu Dec 31 04:39:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgi-bozo.c,v 1.31 2015/12/29 04:21:46 mrg Exp $	*/
+/*	$NetBSD: cgi-bozo.c,v 1.32 2015/12/31 04:39:16 mrg Exp $	*/
 
 /*	$eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -248,8 +248,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	char	date[40];
 	bozoheaders_t *headp;
 	const char *type, *clen, *info, *cgihandler;
-	char	*query, *s, *t, *path, *env, *file, *url;
-	char	command[MAXPATHLEN];
+	char	*query, *s, *t, *path, *env, *command, *file, *url;
 	char	**envp, **curenvp, *argv[4];
 	char	*uri;
 	size_t	len;
@@ -275,8 +274,6 @@ bozo_process_cgi(bozo_httpreq_t *request
 		file = bozostrdup(httpd, request, uri);
 	else
 		bozoasprintf(httpd, , "/%s", uri);
-	if (file == NULL)
-		return 0;
 
 	if (request->hr_query && strlen(request->hr_query))
 		query = bozostrdup(httpd, request, request->hr_query);
@@ -287,13 +284,12 @@ bozo_process_cgi(bozo_httpreq_t *request
 		 file,
 		 query ? "?" : "",
 		 query ? query : "");
-	if (url == NULL)
-		goto out;
 	debug((httpd, DEBUG_NORMAL, "bozo_process_cgi: url `%s'", url));
 
 	path = NULL;
 	envp = NULL;
 	cgihandler = NULL;
+	command = NULL;
 	info = NULL;
 
 	len = strlen(url);
@@ -318,13 +314,12 @@ bozo_process_cgi(bozo_httpreq_t *request
 
 	ix = 0;
 	if (cgihandler) {
-		snprintf(command, sizeof(command), "%s", file + 1);
+		command = file + 1;
 		path = bozostrdup(httpd, request, cgihandler);
 		argv[ix++] = path;
 			/* argv[] = [ path, command, query, NULL ] */
 	} else {
-		snprintf(command, sizeof(command), "%s",
-		file + CGIBIN_PREFIX_LEN + 1);
+		command = file + CGIBIN_PREFIX_LEN + 1;
 		if ((s = strchr(command, '/')) != NULL) {
 			info = bozostrdup(httpd, request, s);
 			*s = '\0';
@@ -430,9 +425,6 @@ bozo_process_cgi(bozo_httpreq_t *request
 		bozo_setenv(httpd, "REDIRECT_STATUS", "200", curenvp++);
 	bozo_auth_cgi_setenv(request, );
 
-	free(file);
-	free(url);
-
 	debug((httpd, DEBUG_FAT, "bozo_process_cgi: going exec %s, %s %s %s",
 	path, argv[0], strornull(argv[1]), strornull(argv[2])));
 
@@ -466,6 +458,10 @@ bozo_process_cgi(bozo_httpreq_t *request
 		bozoerr(httpd, 1, "child execve returned?!");
 	}
 
+	free(query);
+	free(file);
+	free(url);
+
 	close(sv[1]);
 
 	/* parent: read from stdin (bozo_read()) write to sv[0] */



CVS commit: src/libexec/httpd

2015-12-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 31 04:39:16 UTC 2015

Modified Files:
src/libexec/httpd: cgi-bozo.c

Log Message:
redo the fix for rev 1.26 - instead of getting a new string wrong,
just delay the free until the parent has finished using them.
also, free query as well.

fixes PR#50374.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/libexec/httpd/cgi-bozo.c

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




CVS commit: src/libexec/httpd

2015-12-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 31 04:58:43 UTC 2015

Modified Files:
src/libexec/httpd: bozohttpd.c

Log Message:
bump the version; we have real fixes now.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/libexec/httpd/bozohttpd.c

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



CVS commit: src/libexec/httpd

2015-12-30 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 31 04:58:43 UTC 2015

Modified Files:
src/libexec/httpd: bozohttpd.c

Log Message:
bump the version; we have real fixes now.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/libexec/httpd/bozohttpd.c

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

Modified files:

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.76 src/libexec/httpd/bozohttpd.c:1.77
--- src/libexec/httpd/bozohttpd.c:1.76	Tue Dec 29 04:30:33 2015
+++ src/libexec/httpd/bozohttpd.c	Thu Dec 31 04:58:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.76 2015/12/29 04:30:33 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.77 2015/12/31 04:58:43 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -109,7 +109,7 @@
 #define INDEX_HTML		"index.html"
 #endif
 #ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE		"bozohttpd/20150501"
+#define SERVER_SOFTWARE		"bozohttpd/20151231"
 #endif
 #ifndef DIRECT_ACCESS_FILE
 #define DIRECT_ACCESS_FILE	".bzdirect"



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

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Thu Dec 31 03:50:34 UTC 2015

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
XU4 gpio - get rid of annoying printf


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_gpio.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/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.22 src/sys/arch/arm/samsung/exynos_gpio.c:1.23
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.22	Wed Dec 30 04:30:27 2015
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Thu Dec 31 03:50:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $");
 
 #include 
 #include 
@@ -392,7 +392,6 @@ exynos_gpio_fdt_acquire(device_t dev, co
 	if (bank == NULL)
 		return NULL;
 
-	printf("gpio pin %s-%d being acquired\n", bank->bank_name, pin);
 	gpin = kmem_alloc(sizeof(*gpin), KM_SLEEP);
 	gpin->pin_sc = bank->bank_sc;
 	gpin->pin_bank = bank;



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

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Thu Dec 31 03:50:34 UTC 2015

Modified Files:
src/sys/arch/arm/samsung: exynos_gpio.c

Log Message:
XU4 gpio - get rid of annoying printf


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_gpio.c

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



CVS commit: src/external/bsd/blacklist/lib

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 16:42:48 UTC 2015

Modified Files:
src/external/bsd/blacklist/lib: Makefile bl.c

Log Message:
Add a mutex to prevent races during initialization code from multiple threads.
Found in named.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/blacklist/lib/Makefile
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/blacklist/lib/bl.c

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

Modified files:

Index: src/external/bsd/blacklist/lib/Makefile
diff -u src/external/bsd/blacklist/lib/Makefile:1.3 src/external/bsd/blacklist/lib/Makefile:1.4
--- src/external/bsd/blacklist/lib/Makefile:1.3	Thu Jan 22 13:46:15 2015
+++ src/external/bsd/blacklist/lib/Makefile	Wed Dec 30 11:42:48 2015
@@ -1,7 +1,10 @@
-# $NetBSD: Makefile,v 1.3 2015/01/22 18:46:15 christos Exp $
+# $NetBSD: Makefile,v 1.4 2015/12/30 16:42:48 christos Exp $
 
 USE_SHLIBDIR=   yes
 
+CPPFLAGS+=-D_REENTRANT
+DPADD+=${LIBPTHREAD}
+LPADD+=-lpthread
 LIB=blacklist
 SRCS=bl.c blacklist.c
 MAN=libblacklist.3

Index: src/external/bsd/blacklist/lib/bl.c
diff -u src/external/bsd/blacklist/lib/bl.c:1.26 src/external/bsd/blacklist/lib/bl.c:1.27
--- src/external/bsd/blacklist/lib/bl.c:1.26	Wed May 27 21:01:37 2015
+++ src/external/bsd/blacklist/lib/bl.c	Wed Dec 30 11:42:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bl.c,v 1.26 2015/05/28 01:01:37 christos Exp $	*/
+/*	$NetBSD: bl.c,v 1.27 2015/12/30 16:42:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: bl.c,v 1.26 2015/05/28 01:01:37 christos Exp $");
+__RCSID("$NetBSD: bl.c,v 1.27 2015/12/30 16:42:48 christos Exp $");
 
 #include 
 #include 
@@ -53,6 +53,9 @@ __RCSID("$NetBSD: bl.c,v 1.26 2015/05/28
 #include 
 #include 
 #include 
+#ifdef _REENTRANT
+#include 
+#endif
 
 #include "bl.h"
 
@@ -66,6 +69,16 @@ typedef struct {
 } bl_message_t;
 
 struct blacklist {
+#ifdef _REENTRANT
+	pthread_mutex_t b_mutex;
+# define BL_INIT(b)	pthread_mutex_init(>b_mutex, NULL)
+# define BL_LOCK(b)	pthread_mutex_lock(>b_mutex)
+# define BL_UNLOCK(b)	pthread_mutex_unlock(>b_mutex)
+#else
+# define BL_INIT(b)	do {} while(/*CONSTCOND*/0)
+# define BL_LOCK(b)	BL_INIT(b)
+# define BL_UNLOCK(b)	BL_INIT(b)
+#endif
 	int b_fd;
 	int b_connected;
 	struct sockaddr_un b_sun;
@@ -88,13 +101,17 @@ bl_getfd(bl_t b)
 }
 
 static void
-bl_reset(bl_t b)
+bl_reset(bl_t b, bool locked)
 {
 	int serrno = errno;
+	if (!locked)
+		BL_LOCK(b);
 	close(b->b_fd);
 	errno = serrno;
 	b->b_fd = -1;
 	b->b_connected = -1;
+	if (!locked)
+		BL_UNLOCK(b);
 }
 
 static void
@@ -129,12 +146,15 @@ bl_init(bl_t b, bool srv)
 #define SOCK_NOSIGPIPE 0
 #endif
 
+	BL_LOCK(b);
+
 	if (b->b_fd == -1) {
 		b->b_fd = socket(PF_LOCAL,
 		SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_NOSIGPIPE, 0);
 		if (b->b_fd == -1) {
 			bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%m)",
 			__func__);
+			BL_UNLOCK(b);
 			return -1;
 		}
 #if SOCK_CLOEXEC == 0
@@ -153,9 +173,16 @@ bl_init(bl_t b, bool srv)
 #endif
 	}
 
-	if (bl_isconnected(b))
+	if (bl_isconnected(b)) {
+		BL_UNLOCK(b);
 		return 0;
+	}
 
+	/*
+	 * We try to connect anyway even when we are a server to verify
+	 * that no other server is listening to the socket. If we succeed
+	 * to connect and we are a server, someone else owns it.
+	 */
 	rv = connect(b->b_fd, (const void *)sun, (socklen_t)sizeof(*sun));
 	if (rv == 0) {
 		if (srv) {
@@ -177,6 +204,7 @@ bl_init(bl_t b, bool srv)
 __func__, sun->sun_path);
 b->b_connected = 1;
 			}
+			BL_UNLOCK(b);
 			return -1;
 		}
 		bl_log(b->b_fun, LOG_DEBUG, "Connected to blacklist server",
@@ -237,9 +265,11 @@ bl_init(bl_t b, bool srv)
 	}
 #endif
 
+	BL_UNLOCK(b);
 	return 0;
 out:
-	bl_reset(b);
+	bl_reset(b, true);
+	BL_UNLOCK(b);
 	return -1;
 }
 
@@ -252,6 +282,7 @@ bl_create(bool srv, const char *path, vo
 	b->b_fun = fun == NULL ? vsyslog : fun;
 	b->b_fd = -1;
 	b->b_connected = -1;
+	BL_INIT(b);
 
 	memset(>b_sun, 0, sizeof(b->b_sun));
 	b->b_sun.sun_family = AF_LOCAL;
@@ -272,7 +303,7 @@ out:
 void
 bl_destroy(bl_t b)
 {
-	bl_reset(b);
+	bl_reset(b, false);
 	free(b);
 }
 
@@ -377,7 +408,7 @@ again:
 		return -1;
 
 	if ((sendmsg(b->b_fd, , 0) == -1) && tried++ < NTRIES) {
-		bl_reset(b);
+		bl_reset(b, false);
 		goto again;
 	}
 	return tried >= NTRIES ? -1 : 0;



CVS commit: src/external/bsd/blacklist/lib

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 16:42:48 UTC 2015

Modified Files:
src/external/bsd/blacklist/lib: Makefile bl.c

Log Message:
Add a mutex to prevent races during initialization code from multiple threads.
Found in named.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/blacklist/lib/Makefile
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/blacklist/lib/bl.c

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



CVS commit: src/usr.bin/fstat

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 18:15:38 UTC 2015

Modified Files:
src/usr.bin/fstat: misc.c

Log Message:
Add rnd ops.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/fstat/misc.c

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



CVS commit: src/usr.bin/fstat

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 18:15:38 UTC 2015

Modified Files:
src/usr.bin/fstat: misc.c

Log Message:
Add rnd ops.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/fstat/misc.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/fstat/misc.c
diff -u src/usr.bin/fstat/misc.c:1.14 src/usr.bin/fstat/misc.c:1.15
--- src/usr.bin/fstat/misc.c:1.14	Sun Aug 10 12:44:37 2014
+++ src/usr.bin/fstat/misc.c	Wed Dec 30 13:15:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.14 2014/08/10 16:44:37 tls Exp $	*/
+/*	$NetBSD: misc.c,v 1.15 2015/12/30 18:15:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: misc.c,v 1.14 2014/08/10 16:44:37 tls Exp $");
+__RCSID("$NetBSD: misc.c,v 1.15 2015/12/30 18:15:38 christos Exp $");
 
 #define _KMEMUSER
 #include 
@@ -87,19 +87,21 @@ static struct nlist nl[] = {
 { .n_name = "pipeops" },
 #define NL_PUTTER	9
 { .n_name = "putter_fileops", },
-#define NL_SEM		10
+#define NL_RND		10
+{ .n_name = "rnd_fileops", },
+#define NL_SEM		11
 { .n_name = "semops", },
-#define NL_SOCKET	11
+#define NL_SOCKET	12
 { .n_name = "socketops" },
-#define NL_SVR4_NET	12
+#define NL_SVR4_NET	13
 { .n_name = "svr4_netops" },
-#define NL_SVR4_32_NET	13
+#define NL_SVR4_32_NET	14
 { .n_name = "svr4_32_netops" },
-#define NL_TAP		14
+#define NL_TAP		15
 { .n_name = "tap_fileops", },
-#define NL_VNOPS	15
+#define NL_VNOPS	16
 { .n_name = "vnops" },
-#define NL_XENEVT	16
+#define NL_XENEVT	17
 { .n_name = "xenevt_fileops" },
 #define NL_MAX		18
 { .n_name = NULL }
@@ -182,6 +184,34 @@ p_mqueue(struct file *f)
 }
 
 static int
+p_rnd(struct file *f)
+{
+	struct cprng_strong {
+		char cs_name[16];
+		int  cs_flags;
+		/*...*/
+	} str;
+	struct rnd_ctx {
+		struct cprng_strong *rc_cprng;
+		bool rc_hard;
+	} ctx;
+	char buf[1024];
+
+	if (!KVM_READ(f->f_data, , sizeof(ctx))) {
+		dprintf("can't read rnd_ctx at %p for pid %d", f->f_data, Pid);
+		return 0;
+	}
+	if (!KVM_READ(ctx.rc_cprng, , sizeof(str))) {
+		dprintf("can't read cprng_strong at %p for pid %d", f->f_data,\
+		Pid);
+		return 0;
+	}
+	snprintb(buf, sizeof(buf), CPRNG_FMT, str.cs_flags);
+	(void)printf("* rnd \"%s\" flags %s\n", str.cs_name, buf);
+	return 0;
+}
+
+static int
 p_kqueue(struct file *f)
 {
 	struct kqueue kq;
@@ -225,6 +255,8 @@ pmisc(struct file *f, const char *name)
 		return p_mqueue(f);
 	case NL_KQUEUE:
 		return p_kqueue(f);
+	case NL_RND:
+		return p_rnd(f);
 	case NL_SEM:
 		return p_sem(f);
 	case NL_TAP:



CVS commit: src/external/bsd/blacklist/lib

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 17:57:20 UTC 2015

Modified Files:
src/external/bsd/blacklist/lib: Makefile

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/blacklist/lib/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/bsd/blacklist/lib/Makefile
diff -u src/external/bsd/blacklist/lib/Makefile:1.4 src/external/bsd/blacklist/lib/Makefile:1.5
--- src/external/bsd/blacklist/lib/Makefile:1.4	Wed Dec 30 11:42:48 2015
+++ src/external/bsd/blacklist/lib/Makefile	Wed Dec 30 12:57:20 2015
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.4 2015/12/30 16:42:48 christos Exp $
+# $NetBSD: Makefile,v 1.5 2015/12/30 17:57:20 christos Exp $
 
 USE_SHLIBDIR=   yes
 
 CPPFLAGS+=-D_REENTRANT
 DPADD+=${LIBPTHREAD}
-LPADD+=-lpthread
+LDADD+=-lpthread
 LIB=blacklist
 SRCS=bl.c blacklist.c
 MAN=libblacklist.3



CVS commit: src/external/bsd/blacklist/lib

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 17:57:20 UTC 2015

Modified Files:
src/external/bsd/blacklist/lib: Makefile

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/blacklist/lib/Makefile

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



CVS commit: src/lib/libc/sys

2015-12-30 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Dec 30 16:47:24 UTC 2015

Modified Files:
src/lib/libc/sys: nanosleep.2

Log Message:
point to more information about clock_id


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/sys/nanosleep.2

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



CVS commit: src/lib/libc/sys

2015-12-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Dec 30 16:51:31 UTC 2015

Modified Files:
src/lib/libc/sys: nanosleep.2

Log Message:
Fix xrefs.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/sys/nanosleep.2

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



CVS commit: src/lib/libc/sys

2015-12-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Dec 30 16:51:31 UTC 2015

Modified Files:
src/lib/libc/sys: nanosleep.2

Log Message:
Fix xrefs.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/sys/nanosleep.2

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

Modified files:

Index: src/lib/libc/sys/nanosleep.2
diff -u src/lib/libc/sys/nanosleep.2:1.18 src/lib/libc/sys/nanosleep.2:1.19
--- src/lib/libc/sys/nanosleep.2:1.18	Wed Dec 30 16:47:24 2015
+++ src/lib/libc/sys/nanosleep.2	Wed Dec 30 16:51:31 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: nanosleep.2,v 1.18 2015/12/30 16:47:24 plunky Exp $
+.\"	$NetBSD: nanosleep.2,v 1.19 2015/12/30 16:51:31 wiz Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -99,7 +99,7 @@ is described in
 The
 .Fa clock_id
 specified is the time source, which is described in
-.Xr clock_gettime 3 .
+.Xr clock_gettime 2 .
 .Sh RETURN VALUES
 If the
 .Fn clock_nanosleep
@@ -158,7 +158,7 @@ the clock specified in the
 argument is not supported.
 .El
 .Sh SEE ALSO
-.Xr clock_gettime 3 ,
+.Xr clock_gettime 2 ,
 .Xr sleep 3 ,
 .Xr timespec 3
 .Sh STANDARDS



CVS commit: src/lib/libc/sys

2015-12-30 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Dec 30 16:47:24 UTC 2015

Modified Files:
src/lib/libc/sys: nanosleep.2

Log Message:
point to more information about clock_id


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/sys/nanosleep.2

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

Modified files:

Index: src/lib/libc/sys/nanosleep.2
diff -u src/lib/libc/sys/nanosleep.2:1.17 src/lib/libc/sys/nanosleep.2:1.18
--- src/lib/libc/sys/nanosleep.2:1.17	Fri Oct  2 19:52:49 2015
+++ src/lib/libc/sys/nanosleep.2	Wed Dec 30 16:47:24 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: nanosleep.2,v 1.17 2015/10/02 19:52:49 christos Exp $
+.\"	$NetBSD: nanosleep.2,v 1.18 2015/12/30 16:47:24 plunky Exp $
 .\"
 .\" Copyright (c) 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)sleep.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd October 2, 2015
+.Dd December 30, 2015
 .Dt NANOSLEEP 2
 .Os
 .Sh NAME
@@ -98,7 +98,8 @@ is described in
 .Xr timespec 3 .
 The
 .Fa clock_id
-specified is the time source.
+specified is the time source, which is described in
+.Xr clock_gettime 3 .
 .Sh RETURN VALUES
 If the
 .Fn clock_nanosleep
@@ -157,6 +158,7 @@ the clock specified in the
 argument is not supported.
 .El
 .Sh SEE ALSO
+.Xr clock_gettime 3 ,
 .Xr sleep 3 ,
 .Xr timespec 3
 .Sh STANDARDS



CVS commit: src/external/bsd/atf/dist/atf-sh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:23:02 UTC 2015

Modified Files:
src/external/bsd/atf/dist/atf-sh: libatf-sh.subr

Log Message:
Work around ksh bug


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-sh/libatf-sh.subr

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

Modified files:

Index: src/external/bsd/atf/dist/atf-sh/libatf-sh.subr
diff -u src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.3 src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.4
--- src/external/bsd/atf/dist/atf-sh/libatf-sh.subr:1.3	Thu Jan  9 20:39:32 2014
+++ src/external/bsd/atf/dist/atf-sh/libatf-sh.subr	Wed Dec 30 17:23:02 2015
@@ -526,7 +526,10 @@ _atf_list_tcs()
 
 echo "ident: $(atf_get ident)"
 for _var in ${Test_Case_Vars}; do
+	# Elide ksh bug!
+	set +e
 [ "${_var}" != "ident" ] && echo "${_var}: $(atf_get ${_var})"
+	set -e
 done
 
 [ ${#} -gt 1 ] && echo



CVS commit: src/external/bsd/atf/dist/tools

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:23:38 UTC 2015

Modified Files:
src/external/bsd/atf/dist/tools: process.cpp process.hpp
test-program.cpp

Log Message:
Print symbolically why the process exited.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/process.cpp
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/process.hpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/test-program.cpp

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

Modified files:

Index: src/external/bsd/atf/dist/tools/process.cpp
diff -u src/external/bsd/atf/dist/tools/process.cpp:1.3 src/external/bsd/atf/dist/tools/process.cpp:1.4
--- src/external/bsd/atf/dist/tools/process.cpp:1.3	Tue Feb 11 13:13:45 2014
+++ src/external/bsd/atf/dist/tools/process.cpp	Wed Dec 30 17:23:38 2015
@@ -360,6 +360,25 @@ impl::status::~status(void)
 {
 }
 
+std::string
+impl::status::str(void)
+ const
+{
+int mutable_status = m_status;
+std::stringstream rv;
+if (WIFEXITED(mutable_status))
+	rv << "exit("  << WEXITSTATUS(mutable_status);
+else if (WIFSTOPPED(mutable_status))
+	rv << "stopped("  << WSTOPSIG(mutable_status);
+else if (WIFSIGNALED(mutable_status))
+	rv << "terminated("  << WTERMSIG(mutable_status);
+if (WCOREDUMP(mutable_status))
+	rv << "/core)";
+else
+	rv << ")";
+return rv.str();
+}
+
 bool
 impl::status::exited(void)
 const

Index: src/external/bsd/atf/dist/tools/process.hpp
diff -u src/external/bsd/atf/dist/tools/process.hpp:1.1.1.1 src/external/bsd/atf/dist/tools/process.hpp:1.2
--- src/external/bsd/atf/dist/tools/process.hpp:1.1.1.1	Sat Feb  8 14:11:33 2014
+++ src/external/bsd/atf/dist/tools/process.hpp	Wed Dec 30 17:23:38 2015
@@ -207,6 +207,8 @@ class status {
 public:
 ~status(void);
 
+std::string str(void) const;
+
 bool exited(void) const;
 int exitstatus(void) const;
 

Index: src/external/bsd/atf/dist/tools/test-program.cpp
diff -u src/external/bsd/atf/dist/tools/test-program.cpp:1.2 src/external/bsd/atf/dist/tools/test-program.cpp:1.3
--- src/external/bsd/atf/dist/tools/test-program.cpp:1.2	Tue Feb 11 11:31:38 2014
+++ src/external/bsd/atf/dist/tools/test-program.cpp	Wed Dec 30 17:23:38 2015
@@ -664,7 +664,7 @@ impl::get_metadata(const tools::fs::path
 const tools::process::status status = child.wait();
 if (!status.exited() || status.exitstatus() != EXIT_SUCCESS)
 throw tools::parser::format_error("Test program returned failure "
-"exit status for test case list");
+	"exit status " + status.str() + " for test case list");
 
 return metadata(parser.get_tcs());
 }



CVS commit: src/external/bsd/atf/dist/tools

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:23:38 UTC 2015

Modified Files:
src/external/bsd/atf/dist/tools: process.cpp process.hpp
test-program.cpp

Log Message:
Print symbolically why the process exited.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/process.cpp
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/process.hpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/test-program.cpp

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



CVS commit: src/tests/bin/sh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:24:44 UTC 2015

Modified Files:
src/tests/bin/sh: t_ulimit.sh

Log Message:
more robust ulimit test that works with most variants of bourne shells.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/sh/t_ulimit.sh

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



CVS commit: src/bin/ksh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:26:26 UTC 2015

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
We don't have RLIMIT_SWAP


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/ksh.Man

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



CVS commit: src/tests/bin/sh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:24:44 UTC 2015

Modified Files:
src/tests/bin/sh: t_ulimit.sh

Log Message:
more robust ulimit test that works with most variants of bourne shells.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/bin/sh/t_ulimit.sh

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

Modified files:

Index: src/tests/bin/sh/t_ulimit.sh
diff -u src/tests/bin/sh/t_ulimit.sh:1.1 src/tests/bin/sh/t_ulimit.sh:1.2
--- src/tests/bin/sh/t_ulimit.sh:1.1	Mon Jun 11 14:32:59 2012
+++ src/tests/bin/sh/t_ulimit.sh	Wed Dec 30 17:24:44 2015
@@ -1,4 +1,4 @@
-# $NetBSD: t_ulimit.sh,v 1.1 2012/06/11 18:32:59 njoly Exp $
+# $NetBSD: t_ulimit.sh,v 1.2 2015/12/30 22:24:44 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,10 +31,21 @@ atf_test_case limits
 limits_head() {
 	atf_set "descr" "Checks for limits flags"
 }
+
+get_ulimits() {
+	local limits=$(ulimit -a |
+	sed -e 's/.*\(-[A-Za-z0-9]\)[^A-Za-z0-9].*/\1/' | sort -u)
+	if [ -z "$limits" ]; then
+		# grr ksh
+		limits="-a -b -c -d -f -l -m -n -p -r -s -t -v"
+	fi
+	echo "$limits"
+}
+
 limits_body() {
 	atf_check -s eq:0 -o ignore -e empty \
 	/bin/sh -c "ulimit -a"
-	for l in $(ulimit -a | sed 's,^.*(,,;s, .*$,,');
+	for l in $(get_ulimits)
 	do
 	atf_check -s eq:0 -o ignore -e empty \
 	/bin/sh -c "ulimit $l"



CVS commit: src/bin/ksh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:26:26 UTC 2015

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
We don't have RLIMIT_SWAP


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/ksh.Man

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/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.24 src/bin/ksh/ksh.Man:1.25
--- src/bin/ksh/ksh.Man:1.24	Sun Apr 12 13:05:03 2015
+++ src/bin/ksh/ksh.Man	Wed Dec 30 17:26:26 2015
@@ -1,5 +1,5 @@
 '\" t
-.\" $NetBSD: ksh.Man,v 1.24 2015/04/12 17:05:03 jmcneill Exp $
+.\" $NetBSD: ksh.Man,v 1.25 2015/12/30 22:26:26 christos Exp $
 .\"{{{}}}
 .\"{{{  Notes about man page
 .\" - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -2653,6 +2653,7 @@ on some systems this is the maximum allo
 not kbytes).
 .IP \fB\-w\fP
 Impose a limit of \fIn\fP kbytes on the amount of swap space used.
+(Not supported on NetBSD)
 .PP
 As far as \fBulimit\fP is concerned, a block is 512 bytes.
 .RE



CVS commit: src/usr.bin/msgs

2015-12-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Dec 31 01:16:47 UTC 2015

Modified Files:
src/usr.bin/msgs: msgs.c

Log Message:
Avoid leaking a file handle on error opening the next file. From
David Binderman in PR 50577.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/msgs/msgs.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/msgs/msgs.c
diff -u src/usr.bin/msgs/msgs.c:1.23 src/usr.bin/msgs/msgs.c:1.24
--- src/usr.bin/msgs/msgs.c:1.23	Fri Oct 18 20:47:06 2013
+++ src/usr.bin/msgs/msgs.c	Thu Dec 31 01:16:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: msgs.c,v 1.23 2013/10/18 20:47:06 christos Exp $	*/
+/*	$NetBSD: msgs.c,v 1.24 2015/12/31 01:16:47 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)msgs.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: msgs.c,v 1.23 2013/10/18 20:47:06 christos Exp $");
+__RCSID("$NetBSD: msgs.c,v 1.24 2015/12/31 01:16:47 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -800,6 +800,7 @@ ask(const char *prompt)
 			perror(fname);
 			mailing = NO;
 			fseek(newmsg, oldpos, 0);
+			fclose(cpfrom);
 			ask(prompt);
 			return;
 		}



CVS commit: src/usr.bin/msgs

2015-12-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Dec 31 01:16:47 UTC 2015

Modified Files:
src/usr.bin/msgs: msgs.c

Log Message:
Avoid leaking a file handle on error opening the next file. From
David Binderman in PR 50577.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/msgs/msgs.c

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



CVS commit: src/sys/dev/fdt

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Wed Dec 30 04:23:39 UTC 2015

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

Log Message:
FDT pinctrl

Add a pinctrl bus to FDT.  This works against exynos, but someone(tm) needs
to think about whether it is general enough or too specific to exynos.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.6 -r1.7 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.



CVS commit: src/sys/dev/fdt

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Wed Dec 30 04:23:39 UTC 2015

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

Log Message:
FDT pinctrl

Add a pinctrl bus to FDT.  This works against exynos, but someone(tm) needs
to think about whether it is general enough or too specific to exynos.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.6 -r1.7 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.4 src/sys/dev/fdt/fdtvar.h:1.5
--- src/sys/dev/fdt/fdtvar.h:1.4	Tue Dec 22 22:19:07 2015
+++ src/sys/dev/fdt/fdtvar.h	Wed Dec 30 04:23:39 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.4 2015/12/22 22:19:07 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.5 2015/12/30 04:23:39 marty Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -76,6 +76,20 @@ struct fdtbus_gpio_controller_func {
 	void	(*write)(device_t, void *, int, bool);
 };
 
+struct fdtbus_pinctrl_controller;
+
+struct fdtbus_pinctrl_pin {
+	struct fdtbus_pinctrl_controller *pp_pc;
+	void *pp_priv;
+};
+
+struct fdtbus_pinctrl_controller_func {
+	void *	(*acquire)(device_t, const char *);
+	void	(*release)(device_t, void *);
+	void	(*get)(struct fdtbus_pinctrl_pin *, void *);
+	void	(*set)(struct fdtbus_pinctrl_pin *, void *);
+};
+
 struct fdtbus_regulator_controller;
 
 struct fdtbus_regulator {
@@ -112,6 +126,8 @@ int		fdtbus_register_i2c_controller(devi
 		const struct fdtbus_i2c_controller_func *);
 int		fdtbus_register_gpio_controller(device_t, int,
 		const struct fdtbus_gpio_controller_func *);
+int		fdtbus_register_pinctrl_controller(device_t, int,
+		const struct fdtbus_pinctrl_controller_func *);
 int		fdtbus_register_regulator_controller(device_t, int,
 		const struct fdtbus_regulator_controller_func *);
 int		fdtbus_register_clock_controller(device_t, int,
@@ -133,6 +149,10 @@ int		fdtbus_gpio_read(struct fdtbus_gpio
 void		fdtbus_gpio_write(struct fdtbus_gpio_pin *, int);
 int		fdtbus_gpio_read_raw(struct fdtbus_gpio_pin *);
 void		fdtbus_gpio_write_raw(struct fdtbus_gpio_pin *, int);
+struct fdtbus_pinctrl_pin *fdtbus_pinctrl_acquire(int, const char *);
+void		fdtbus_pinctrl_release(struct fdtbus_pinctrl_pin *);
+void		fdtbus_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *, void *);
+void		fdtbus_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *, void *);
 struct fdtbus_regulator *fdtbus_regulator_acquire(int, const char *);
 void		fdtbus_regulator_release(struct fdtbus_regulator *);
 int		fdtbus_regulator_enable(struct fdtbus_regulator *);

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.6 src/sys/dev/fdt/files.fdt:1.7
--- src/sys/dev/fdt/files.fdt:1.6	Wed Dec 23 11:31:45 2015
+++ src/sys/dev/fdt/files.fdt	Wed Dec 30 04:23:39 2015
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.6 2015/12/23 11:31:45 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.7 2015/12/30 04:23:39 marty Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -30,3 +30,4 @@ file	dev/fdt/fdt_i2c.c			fdtbus
 file	dev/fdt/fdt_intr.c			fdtbus
 file	dev/fdt/fdt_regulator.c			fdtbus
 file	dev/fdt/fdt_reset.c			fdtbus
+file	dev/fdt/fdt_pinctrl.c			fdtbus

Added files:

Index: src/sys/dev/fdt/fdt_pinctrl.c
diff -u /dev/null src/sys/dev/fdt/fdt_pinctrl.c:1.1
--- /dev/null	Wed Dec 30 04:23:39 2015
+++ src/sys/dev/fdt/fdt_pinctrl.c	Wed Dec 30 04:23:39 2015
@@ -0,0 +1,111 @@
+/* $NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. 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) 

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

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Wed Dec 30 04:30:27 UTC 2015

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c exynos_gpio.c exynos_i2c.c
exynos_pinctrl.c exynos_var.h

Log Message:
XU4 i2c, gpio & pinctrl changes

modify exynos_gpio.c to support the new pinctrl model.
set up the new pinctrl model in exynos_pinctrl.c

Flesh out exynos_i2c.c and set it up to use the new pinctrl model.  NOTE:
exynos_i2c.c is still incomplete.  I need to figure out what to set the
prescaler and scaler to.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_combiner.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_var.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/samsung/exynos_combiner.c
diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.3 src/sys/arch/arm/samsung/exynos_combiner.c:1.4
--- src/sys/arch/arm/samsung/exynos_combiner.c:1.3	Thu Dec 24 21:20:17 2015
+++ src/sys/arch/arm/samsung/exynos_combiner.c	Wed Dec 30 04:30:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $ */
+/*	$NetBSD: exynos_combiner.c,v 1.4 2015/12/30 04:30:27 marty Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.4 2015/12/30 04:30:27 marty Exp $");
 
 #include 
 #include 
@@ -197,7 +197,7 @@ exynos_combiner_intrstr(device_t dev, in
 
 	kmem_free(interrupts, len);
 
-	snprintf(buf, buflen, "LIC irq %d", irq);
+	snprintf(buf, buflen, "combiner irq %d", irq);
 
 	return true;
 }

Index: src/sys/arch/arm/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.21 src/sys/arch/arm/samsung/exynos_gpio.c:1.22
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.21	Sun Dec 27 12:42:14 2015
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Wed Dec 30 04:30:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.21 2015/12/27 12:42:14 jmcneill Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.21 2015/12/27 12:42:14 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $");
 
 #include 
 #include 
@@ -53,16 +53,6 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_gpio.
 
 #include 
 
-struct exynos_gpio_pin_cfg {
-	uint32_t cfg;
-	uint32_t pud;
-	uint32_t drv;
-	uint32_t conpwd;
-	uint32_t pudpwd;
-};
-
-struct exynos_gpio_softc;
-
 struct exynos_gpio_bank {
 	const char		bank_name[6];
 	device_t		bank_dev;
@@ -80,12 +70,6 @@ struct exynos_gpio_bank {
 	struct exynos_gpio_bank * bank_next;
 };
 
-struct exynos_gpio_softc {
-	device_t		sc_dev;
-	bus_space_tag_t		sc_bst;
-	bus_space_handle_t	sc_bsh;
-};
-
 struct exynos_gpio_pin {
 	struct exynos_gpio_softc *pin_sc;
 	int			  pin_no;
@@ -144,7 +128,7 @@ static struct exynos_gpio_bank exynos5_b
 	GPIO_GRP(5, MUXD, 0x00E0, gpb4, 2),
 	GPIO_GRP(5, MUXD, 0x0100, gph0, 4),
 
-	GPIO_GRP(5, MUXE, 0x, gpz0, 7),
+	GPIO_GRP(5, MUXE, 0x, gpz, 7),
 
 };
 
@@ -159,7 +143,6 @@ static void exynos_gpio_fdt_release(devi
 
 static int exynos_gpio_fdt_read(device_t, void *, bool);
 static void exynos_gpio_fdt_write(device_t, void *, int, bool);
-static struct exynos_gpio_bank *exynos_gpio_bank_lookup(const char *);
 static int exynos_gpio_cfprint(void *, const char *);
 
 struct fdtbus_gpio_controller_func exynos_gpio_funcs = {
@@ -279,7 +262,27 @@ exynos_gpio_pin_ctl(void *cookie, int pi
 	exynos_gpio_update_cfg_regs(bank, );
 }
 
-void
+void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *bank,
+			  struct exynos_gpio_pin_cfg *cfg)
+{
+	cfg->cfg = GPIO_READ(bank, EXYNOS_GPIO_CON);
+	cfg->pud = GPIO_READ(bank, EXYNOS_GPIO_PUD);
+	cfg->drv = GPIO_READ(bank, EXYNOS_GPIO_DRV);
+	cfg->conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
+	cfg->pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
+}
+
+void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *bank,
+			   const struct exynos_gpio_pin_cfg *cfg)
+{
+		GPIO_WRITE(bank, EXYNOS_GPIO_CON, cfg->cfg);
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUD, cfg->pud);
+		GPIO_WRITE(bank, EXYNOS_GPIO_DRV, cfg->drv);
+		GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, cfg->conpwd);
+		GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, cfg->pudpwd);
+}
+
+struct exynos_gpio_softc *
 exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent,
 			const struct fdt_attach_args *faa, int node)
 {
@@ -294,13 +297,14 @@ exynos_gpio_bank_config(struct 

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

2015-12-30 Thread Marty Fouts
Module Name:src
Committed By:   marty
Date:   Wed Dec 30 04:30:27 UTC 2015

Modified Files:
src/sys/arch/arm/samsung: exynos_combiner.c exynos_gpio.c exynos_i2c.c
exynos_pinctrl.c exynos_var.h

Log Message:
XU4 i2c, gpio & pinctrl changes

modify exynos_gpio.c to support the new pinctrl model.
set up the new pinctrl model in exynos_pinctrl.c

Flesh out exynos_i2c.c and set it up to use the new pinctrl model.  NOTE:
exynos_i2c.c is still incomplete.  I need to figure out what to set the
prescaler and scaler to.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_combiner.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_var.h

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



CVS commit: src/sys/arch/sparc64/sparc64

2015-12-30 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Dec 30 09:16:17 UTC 2015

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.

See also the mail thread starting at:
  http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/sparc64/ofw_machdep.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2015-12-30 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Dec 30 09:16:17 UTC 2015

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
Restrict the check for fully specified interrupts to machines with psycho
controllers only, and adjust comments to note this.

See also the mail thread starting at:
  http://mail-index.NetBSD.org/port-sparc64/2015/12/03/msg002488.html


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/sparc64/ofw_machdep.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/sparc64/sparc64/ofw_machdep.c
diff -u src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.44 src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.45
--- src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.44	Mon Mar  2 14:17:06 2015
+++ src/sys/arch/sparc64/sparc64/ofw_machdep.c	Wed Dec 30 09:16:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.44 2015/03/02 14:17:06 nakayama Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.45 2015/12/30 09:16:17 jdc Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.44 2015/03/02 14:17:06 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.45 2015/12/30 09:16:17 jdc Exp $");
 
 #include 
 #include 
@@ -738,22 +738,22 @@ OF_mapintr(int node, int *interrupt, int
 	int phc_node;
 	int rc = -1;
 
+	phc_node = find_pci_host_node(node);
+
 	/* 
-	 * Don't try to map interrupts for onboard devices, or if the
-	 * interrupt is already fully specified.
-	 * XXX This should be done differently (i.e. by matching
-	 * the node name) - but we need access to a machine where
-	 * a change is testable - hence the printf below.
+	 * On machines with psycho PCI controllers, we don't need to map
+	 * interrupts if they are already fully specified (0x20 to 0x3f
+	 * for onboard devices and IGN 0x7c0 for psycho0/psycho1).
 	 */
 	if (*interrupt & 0x20 || *interrupt & 0x7c0) {
-		char name[40];
-
-		OF_getprop(node, "name", , sizeof(name));
-		printf("\nATTENTION: if you see this message, please mail "
-		"the output of \"dmesg\" and \"ofctl -p\" to "
-		"port-spar...@netbsd.org!\n"
-		"Not mapping interrupt for node %s (%x)\n", name, node);
-		return validlen;
+		char model[40];
+		
+		if (OF_getprop(phc_node, "model", , sizeof(model)) > 10
+		&& !strcmp(model, "SUNW,psycho")) {
+			DPRINTF(("OF_mapintr: interrupt %x already mapped\n",
+			*interrupt));
+			return validlen;
+		}
 	}
 
 	/*
@@ -775,8 +775,6 @@ OF_mapintr(int node, int *interrupt, int
 		return (-1);
 	}
 
-	phc_node = find_pci_host_node(node);
-
 	while (node) {
 #ifdef DEBUG
 		char name[40];



CVS commit: src/sys/net

2015-12-30 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Dec 29 21:49:58 UTC 2015

Modified Files:
src/sys/net: bpfjit.c

Log Message:
Replace the nsaveds() function with #define NSAVEDS 3. No functional change.

Patch from Michael McConville.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/net/bpfjit.c

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



CVS commit: src/sys/net

2015-12-30 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Dec 29 21:49:58 UTC 2015

Modified Files:
src/sys/net: bpfjit.c

Log Message:
Replace the nsaveds() function with #define NSAVEDS 3. No functional change.

Patch from Michael McConville.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/net/bpfjit.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/net/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.43 src/sys/net/bpfjit.c:1.44
--- src/sys/net/bpfjit.c:1.43	Sat Feb 14 21:32:46 2015
+++ src/sys/net/bpfjit.c	Tue Dec 29 21:49:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2011-2015 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include 
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.43 2015/02/14 21:32:46 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.44 2015/12/29 21:49:58 alnsn Exp $");
 #endif
 
 #include 
@@ -76,6 +76,11 @@ __RCSID("$NetBSD: bpfjit.c,v 1.43 2015/0
 #endif
 
 /*
+ * Number of saved registers to pass to sljit_emit_enter() function.
+ */
+#define NSAVEDS		3
+
+/*
  * Arguments of generated bpfjit_func_t.
  * The first argument is reassigned upon entry
  * to a more frequently used buf argument.
@@ -273,18 +278,6 @@ nscratches(bpfjit_hint_t hints)
 	return rv;
 }
 
-/*
- * Return a number of saved registers to pass
- * to sljit_emit_enter() function.
- */
-static sljit_si
-nsaveds(bpfjit_hint_t hints)
-{
-	sljit_si rv = 3;
-
-	return rv;
-}
-
 static uint32_t
 read_width(const struct bpf_insn *pc)
 {
@@ -2192,7 +2185,7 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 #endif
 
 	status = sljit_emit_enter(compiler,
-	2, nscratches(hints), nsaveds(hints), sizeof(struct bpfjit_stack));
+	2, nscratches(hints), NSAVEDS, sizeof(struct bpfjit_stack));
 	if (status != SLJIT_SUCCESS)
 		goto fail;