CVS commit: src/lib/libc/stdlib

2014-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 11:32:15 UTC 2014

Modified Files:
src/lib/libc/stdlib: jemalloc.c

Log Message:
Err on the safe side for small memory allocations and provide 4byte
alignment by default.  Override this to 8byte alignment for alpha and arm
eabi.

Someone (tm) can review this change once the standards and compiler(s)
have sorted themselves out.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/stdlib/jemalloc.c

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/stdlib/jemalloc.c
diff -u src/lib/libc/stdlib/jemalloc.c:1.29 src/lib/libc/stdlib/jemalloc.c:1.30
--- src/lib/libc/stdlib/jemalloc.c:1.29	Thu Sep 12 15:35:15 2013
+++ src/lib/libc/stdlib/jemalloc.c	Wed Feb  5 11:32:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: jemalloc.c,v 1.29 2013/09/12 15:35:15 joerg Exp $	*/
+/*	$NetBSD: jemalloc.c,v 1.30 2014/02/05 11:32:15 skrll Exp $	*/
 
 /*-
  * Copyright (C) 2006,2007 Jason Evans jas...@freebsd.org.
@@ -118,7 +118,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $); */ 
-__RCSID($NetBSD: jemalloc.c,v 1.29 2013/09/12 15:35:15 joerg Exp $);
+__RCSID($NetBSD: jemalloc.c,v 1.30 2014/02/05 11:32:15 skrll Exp $);
 
 #ifdef __FreeBSD__
 #include libc_private.h
@@ -228,6 +228,7 @@ __strerror_r(int e, char *s, size_t l)
 #ifdef __alpha__
 #  define QUANTUM_2POW_MIN	4
 #  define SIZEOF_PTR_2POW	3
+#  define TINY_MIN_2POW		3
 #  define NO_TLS
 #endif
 #ifdef __sparc64__
@@ -243,6 +244,9 @@ __strerror_r(int e, char *s, size_t l)
 #  define QUANTUM_2POW_MIN	3
 #  define SIZEOF_PTR_2POW	2
 #  define USE_BRK
+#  ifdef __ARM_EABI__
+#define TINY_MIN_2POW	3
+#  endif
 #  define NO_TLS
 #endif
 #ifdef __powerpc__
@@ -303,7 +307,9 @@ __strerror_r(int e, char *s, size_t l)
 #define	CACHELINE		((size_t)(1  CACHELINE_2POW))
 
 /* Smallest size class to support. */
-#define	TINY_MIN_2POW		1
+#ifndef TINY_MIN_2POW
+#define	TINY_MIN_2POW		2
+#endif
 
 /*
  * Maximum size class that is a multiple of the quantum, but not (necessarily)



CVS commit: othersrc/external/bsd/multigest/dist

2014-02-05 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Feb  5 17:43:17 UTC 2014

Modified Files:
othersrc/external/bsd/multigest/dist: multigest.c

Log Message:
give correct results when running the digest when an mmap(2) fails but
read(2) succeeds


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/multigest/dist/multigest.c

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

Modified files:

Index: othersrc/external/bsd/multigest/dist/multigest.c
diff -u othersrc/external/bsd/multigest/dist/multigest.c:1.6 othersrc/external/bsd/multigest/dist/multigest.c:1.7
--- othersrc/external/bsd/multigest/dist/multigest.c:1.6	Thu Aug 22 01:08:10 2013
+++ othersrc/external/bsd/multigest/dist/multigest.c	Wed Feb  5 17:43:17 2014
@@ -669,6 +669,7 @@ uint8_t *
 multigest_file(const char *alg, const char *f, uint8_t *raw, const char *pat, const char *repl)
 {
 	struct stat	 st;
+	multigest_t	 m;
 	ssize_t		 rc;
 	size_t		 size;
 	size_t		 cc;
@@ -676,6 +677,9 @@ multigest_file(const char *alg, const ch
 	FILE		*fp;
 
 	if (f  alg  raw) {
+memset(m, 0x0, sizeof(m));
+multigest_init(m, alg);
+multigest_add_subst(m, pat, repl);
 		if ((fp = fopen(f, r)) == NULL) {
 			fprintf(stderr, can't open '%s'\n, f);
 			return 0;
@@ -689,14 +693,16 @@ multigest_file(const char *alg, const ch
 if ((rc = read(fileno(fp), mapped, MB(1))) = 0) {
 	break;
 }
-multigest_data(alg, mapped, (size_t)rc, raw, pat, repl);
+multigest_update(m, mapped, (size_t)rc);
 			}
 			free(mapped);
 		} else {
-			multigest_data(alg, mapped, size, raw, pat, repl);
+			multigest_update(m, mapped, (size_t)size);
 			munmap(mapped, size);
 		}
 		fclose(fp);
+multigest_final(m, raw);
+multigest_free(m);
 		return raw;
 	}
 	return NULL;



CVS commit: src/sys/arch

2014-02-05 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Wed Feb  5 18:52:22 UTC 2014

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64
src/sys/arch/i386/conf: Makefile.i386

Log Message:
Change the compiler options to explicitly specify:
  -mno-mmx -mno-sse -mno-avx -mno-80387 -mno-fp-ret-in-387
Since no-sse implies no-sse2 that should ensure that the compiler really
  doesn't emit any instructions that might trap trying to use the FPU.
On amd64 at least some of those are needed to stop the compiler
  saving the registers to stack on every varargs function.
It might be that -mno-sse did that before.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/i386/conf/Makefile.i386

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/amd64/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.42 src/sys/arch/amd64/conf/Makefile.amd64:1.43
--- src/sys/arch/amd64/conf/Makefile.amd64:1.42	Wed Jan 15 22:25:22 2014
+++ src/sys/arch/amd64/conf/Makefile.amd64	Wed Feb  5 18:52:22 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.42 2014/01/15 22:25:22 joerg Exp $
+#	$NetBSD: Makefile.amd64,v 1.43 2014/02/05 18:52:22 dsl Exp $
 
 # Makefile for NetBSD
 #
@@ -36,7 +36,10 @@ GENASSYM_CONF=	${AMD64}/amd64/genassym.c
 DEFCOPTS=	-O2
 CPPFLAGS+=	-Damd64 -Dx86_64
 CFLAGS+=	-mcmodel=kernel
-CFLAGS+=	-mno-red-zone -mno-sse -mno-sse2 -mno-sse3
+# -mno-sse implies -mno-sse2 (etc) but doesn't stop avx.
+CFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx
+# make absolutely sure we don't get x87 registers used as well
+CFLAGS+=	-mno-80387 -mno-fp-ret-in-387
 
 ##
 ## (3) libkern and compat

Index: src/sys/arch/i386/conf/Makefile.i386
diff -u src/sys/arch/i386/conf/Makefile.i386:1.179 src/sys/arch/i386/conf/Makefile.i386:1.180
--- src/sys/arch/i386/conf/Makefile.i386:1.179	Wed Jan 15 22:25:22 2014
+++ src/sys/arch/i386/conf/Makefile.i386	Wed Feb  5 18:52:22 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.i386,v 1.179 2014/01/15 22:25:22 joerg Exp $
+#	$NetBSD: Makefile.i386,v 1.180 2014/02/05 18:52:22 dsl Exp $
 
 # Makefile for NetBSD
 #
@@ -34,7 +34,9 @@ GENASSYM_CONF=	${I386}/i386/genassym.cf
 ## (2) compile settings
 ##
 CPPFLAGS+=	-Di386
-CFLAGS+=	-mno-sse -mno-sse2 -mno-sse3
+CFLAGS+=-mno-80387 -mno-fp-ret-in-387
+## no-sse implies no-sse2 but not no-avx
+CFLAGS+=	-mno-mmx -mno-sse -mno-avx
 
 ##
 ## (3) libkern and compat



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

2014-02-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  5 19:03:45 UTC 2014

Modified Files:
src/sys/arch/arm/xscale: becc_intr.h

Log Message:
put back line accidentally deleted before (hi matt)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/xscale/becc_intr.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/xscale/becc_intr.h
diff -u src/sys/arch/arm/xscale/becc_intr.h:1.5 src/sys/arch/arm/xscale/becc_intr.h:1.6
--- src/sys/arch/arm/xscale/becc_intr.h:1.5	Tue Feb  4 13:51:16 2014
+++ src/sys/arch/arm/xscale/becc_intr.h	Wed Feb  5 14:03:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: becc_intr.h,v 1.5 2014/02/04 18:51:16 matt Exp $	*/
+/*	$NetBSD: becc_intr.h,v 1.6 2014/02/05 19:03:45 christos Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -103,6 +103,7 @@ becc_spllower(int ipl)
 	becc_splx(becc_imask[ipl]);
 	return (old);
 }
+#endif /* __PROG32 */
 
 #if !defined(EVBARM_SPL_NOINLINE)
 



CVS commit: src/sys/arch/emips/stand/common

2014-02-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  5 19:07:16 UTC 2014

Modified Files:
src/sys/arch/emips/stand/common: ace.c

Log Message:
make this compile.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/emips/stand/common/ace.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/emips/stand/common/ace.c
diff -u src/sys/arch/emips/stand/common/ace.c:1.2 src/sys/arch/emips/stand/common/ace.c:1.3
--- src/sys/arch/emips/stand/common/ace.c:1.2	Sun Jul 17 16:54:39 2011
+++ src/sys/arch/emips/stand/common/ace.c	Wed Feb  5 14:07:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ace.c,v 1.2 2011/07/17 20:54:39 joerg Exp $	*/
+/*	$NetBSD: ace.c,v 1.3 2014/02/05 19:07:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@
 
 #include common.h
 #include ace.h
+#include start.h
 
 #define NSAC 2
 #define SAC0 ((struct _Sac  *)IDE_DEFAULT_ADDRESS)
@@ -618,7 +619,7 @@ aceopen(struct open_file *f, ...)
 	int i;
 	char *msg;
 	char buf[DEV_BSIZE];
-	int cnt;
+	size_t cnt;
 	va_list ap;
 
 	va_start(ap, f);



CVS commit: src/sys/arch/mips/mips

2014-02-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  5 19:09:06 UTC 2014

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
fix incorrect variable; (hi matt)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/mips/bus_dma.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/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.29 src/sys/arch/mips/mips/bus_dma.c:1.30
--- src/sys/arch/mips/mips/bus_dma.c:1.29	Mon Feb  3 14:18:59 2014
+++ src/sys/arch/mips/mips/bus_dma.c	Wed Feb  5 14:09:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.29 2014/02/03 19:18:59 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.30 2014/02/05 19:09:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.29 2014/02/03 19:18:59 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.30 2014/02/05 19:09:06 christos Exp $);
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -641,7 +641,7 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 			kva = (void *)MIPS_PHYS_TO_XKPHYS_UNCACHED(segs-ds_addr);
 		}
 #else
-		if (ds-ds_addr = MIPS_PHYS_MASK)
+		if (segs-ds_addr = MIPS_PHYS_MASK)
 			return EFBIG;
 		if (cached_p) {
 			kva = (void *)MIPS_PHYS_TO_KSEG0(segs-ds_addr);



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

2014-02-05 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Wed Feb  5 23:10:41 UTC 2014

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64

Log Message:
Apparantly clang doesn't like -mno-80387 or -mno-fp-ret-in-387
-msoft-float is equivalent to the former, the latter is probably unlikely
to stop anything not picked up elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/conf/Makefile.amd64

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/amd64/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.43 src/sys/arch/amd64/conf/Makefile.amd64:1.44
--- src/sys/arch/amd64/conf/Makefile.amd64:1.43	Wed Feb  5 18:52:22 2014
+++ src/sys/arch/amd64/conf/Makefile.amd64	Wed Feb  5 23:10:41 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.43 2014/02/05 18:52:22 dsl Exp $
+#	$NetBSD: Makefile.amd64,v 1.44 2014/02/05 23:10:41 dsl Exp $
 
 # Makefile for NetBSD
 #
@@ -36,10 +36,12 @@ GENASSYM_CONF=	${AMD64}/amd64/genassym.c
 DEFCOPTS=	-O2
 CPPFLAGS+=	-Damd64 -Dx86_64
 CFLAGS+=	-mcmodel=kernel
-# -mno-sse implies -mno-sse2 (etc) but doesn't stop avx.
+# -mno-sse implies -mno-sse2 (etc), explicitly disable avx to be extra sure
 CFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx
 # make absolutely sure we don't get x87 registers used as well
-CFLAGS+=	-mno-80387 -mno-fp-ret-in-387
+CFLAGS+=	-msoft-float
+# For gcc we might need this, but other compilers barf
+# CFLAGS+=	-mno-fp-ret-in-387
 
 ##
 ## (3) libkern and compat



CVS commit: src

2014-02-05 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu Feb  6 02:51:28 UTC 2014

Modified Files:
src/lib/libnpf: npf.c npf.h
src/sys/net/npf: npf.h npf_ctl.c npf_impl.h npf_tableset.c
src/usr.sbin/npf/npfctl: npf.conf.5 npf_build.c npf_parse.y npf_scan.l
src/usr.sbin/npf/npftest: npftest.c npftest.h
src/usr.sbin/npf/npftest/libnpftest: npf_table_test.c npf_test.h

Log Message:
Add support for CDB based NPF tables.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libnpf/npf.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libnpf/npf.h
cvs rdiff -u -r1.34 -r1.35 src/sys/net/npf/npf.h
cvs rdiff -u -r1.32 -r1.33 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.45 -r1.46 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.20 -r1.21 src/sys/net/npf/npf_tableset.c
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/npf/npftest/npftest.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npftest/npftest.h
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npftest/libnpftest/npf_table_test.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/npf/npftest/libnpftest/npf_test.h

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

Modified files:

Index: src/lib/libnpf/npf.c
diff -u src/lib/libnpf/npf.c:1.25 src/lib/libnpf/npf.c:1.26
--- src/lib/libnpf/npf.c:1.25	Mon Feb  3 02:21:52 2014
+++ src/lib/libnpf/npf.c	Thu Feb  6 02:51:28 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf.c,v 1.25 2014/02/03 02:21:52 rmind Exp $	*/
+/*	$NetBSD: npf.c,v 1.26 2014/02/06 02:51:28 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2010-2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010-2014 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This material is based upon work partially supported by The
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.25 2014/02/03 02:21:52 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.26 2014/02/06 02:51:28 rmind Exp $);
 
 #include sys/types.h
 #include netinet/in_systm.h
@@ -961,6 +961,20 @@ npf_table_add_entry(nl_table_t *tl, int 
 	return 0;
 }
 
+int
+npf_table_setdata(nl_table_t *tl, const void *blob, size_t len)
+{
+	prop_dictionary_t tldict = tl-ntl_dict;
+	prop_data_t bobj;
+
+	if ((bobj = prop_data_create_data(blob, len)) == NULL) {
+		return ENOMEM;
+	}
+	prop_dictionary_set(tldict, data, bobj);
+	prop_object_release(bobj);
+	return 0;
+}
+
 static bool
 _npf_table_exists_p(nl_config_t *ncf, const char *name)
 {

Index: src/lib/libnpf/npf.h
diff -u src/lib/libnpf/npf.h:1.22 src/lib/libnpf/npf.h:1.23
--- src/lib/libnpf/npf.h:1.22	Mon Feb  3 02:21:52 2014
+++ src/lib/libnpf/npf.h	Thu Feb  6 02:51:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.22 2014/02/03 02:21:52 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.23 2014/02/06 02:51:28 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@ int		npf_nat_insert(nl_config_t *, nl_na
 nl_table_t *	npf_table_create(const char *, u_int, int);
 int		npf_table_add_entry(nl_table_t *, int,
 		const npf_addr_t *, const npf_netmask_t);
+int		npf_table_setdata(nl_table_t *, const void *, size_t);
 int		npf_table_insert(nl_config_t *, nl_table_t *);
 void		npf_table_destroy(nl_table_t *);
 

Index: src/sys/net/npf/npf.h
diff -u src/sys/net/npf/npf.h:1.34 src/sys/net/npf/npf.h:1.35
--- src/sys/net/npf/npf.h:1.34	Fri Dec  6 01:33:37 2013
+++ src/sys/net/npf/npf.h	Thu Feb  6 02:51:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.34 2013/12/06 01:33:37 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.35 2014/02/06 02:51:28 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -239,6 +239,7 @@ bool		npf_autounload_p(void);
 /* Table types. */
 #define	NPF_TABLE_HASH			1
 #define	NPF_TABLE_TREE			2
+#define	NPF_TABLE_CDB			3
 
 #define	NPF_TABLE_MAXNAMELEN		32
 

Index: src/sys/net/npf/npf_ctl.c
diff -u src/sys/net/npf/npf_ctl.c:1.32 src/sys/net/npf/npf_ctl.c:1.33
--- src/sys/net/npf/npf_ctl.c:1.32	Tue Nov 12 00:46:34 2013
+++ src/sys/net/npf/npf_ctl.c	Thu Feb  6 02:51:28 2014
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf_ctl.c,v 1.32 2013/11/12 00:46:34 rmind Exp $	*/
+/*	$NetBSD: npf_ctl.c,v 1.33 2014/02/06 02:51:28 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This material is based upon work partially supported by The
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_ctl.c,v 1.32 2013/11/12 00:46:34 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_ctl.c,v 1.33 2014/02/06 02:51:28 rmind Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -77,6 +77,34 @@ npfctl_switch(void *data)
 }
 
 static int __noinline

CVS commit: src/sys/kern

2014-02-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb  6 03:47:16 UTC 2014

Modified Files:
src/sys/kern: subr_pcq.c

Log Message:
__HAVE_ATOMIC_AS_MEMBAR is spelled with two leading underscores.

This underscores the need to replace this error-prone cpp API by
unconditionally defined {pre,post}atomic_membar_*.

This change should only remove unnecessary membar_producers on x86.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_pcq.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/kern/subr_pcq.c
diff -u src/sys/kern/subr_pcq.c:1.6 src/sys/kern/subr_pcq.c:1.7
--- src/sys/kern/subr_pcq.c:1.6	Tue Jan 31 20:40:09 2012
+++ src/sys/kern/subr_pcq.c	Thu Feb  6 03:47:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pcq.c,v 1.6 2012/01/31 20:40:09 alnsn Exp $	*/
+/*	$NetBSD: subr_pcq.c,v 1.7 2014/02/06 03:47:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_pcq.c,v 1.6 2012/01/31 20:40:09 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_pcq.c,v 1.7 2014/02/06 03:47:16 riastradh Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -115,7 +115,7 @@ pcq_put(pcq_t *pcq, void *item)
 	 * that the caller made to the data item are globally visible
 	 * before we put it onto the list.
 	 */
-#ifndef _HAVE_ATOMIC_AS_MEMBAR
+#ifndef __HAVE_ATOMIC_AS_MEMBAR
 	membar_producer();
 #endif
 	pcq-pcq_items[op] = item;
@@ -180,7 +180,7 @@ pcq_get(pcq_t *pcq)
 	 * after it, we could in theory wipe out a modification made
 	 * to pcq_items[] by pcq_put().
 	 */
-#ifndef _HAVE_ATOMIC_AS_MEMBAR
+#ifndef __HAVE_ATOMIC_AS_MEMBAR
 	membar_producer();
 #endif
 	while (__predict_false(atomic_cas_32(pcq-pcq_pc, v, nv) != v)) {



CVS commit: othersrc/external/bsd/jetlib

2014-02-05 Thread David A. Holland
Module Name:othersrc
Committed By:   dholland
Date:   Thu Feb  6 04:57:02 UTC 2014

Added Files:
othersrc/external/bsd/jetlib: README TODO
othersrc/external/bsd/jetlib/lib/libjet: Makefile jetfromtext.c
jetlib.c jetlib.h jettobin.c jettotext.c

Log Message:
Import a copy of jetlib in othersrc. This is exactly the same as the
version I've had posted on my web page the last five years; it is from
October 17, 2008 and was written in a day or so after irritation at
one of the endless proplib flamewars boiled over.

This should be considered a straw man only; it is not quite finished
and there are some unresolved issues to sort out (particularly
pertaining to iteration) before it can be used for real. There are
also probably things I'd do differently if I wrote it again now, and I
haven't attended to any of those or even looked at the thing in any
detail.

Also IIRC it's never actually been run.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/jetlib/README \
othersrc/external/bsd/jetlib/TODO
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/jetlib/lib/libjet/Makefile \
othersrc/external/bsd/jetlib/lib/libjet/jetfromtext.c \
othersrc/external/bsd/jetlib/lib/libjet/jetlib.c \
othersrc/external/bsd/jetlib/lib/libjet/jetlib.h \
othersrc/external/bsd/jetlib/lib/libjet/jettobin.c \
othersrc/external/bsd/jetlib/lib/libjet/jettotext.c

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

Added files:

Index: othersrc/external/bsd/jetlib/README
diff -u /dev/null othersrc/external/bsd/jetlib/README:1.1
--- /dev/null	Thu Feb  6 04:57:02 2014
+++ othersrc/external/bsd/jetlib/README	Thu Feb  6 04:57:02 2014
@@ -0,0 +1,6 @@
+This is like proplib, but better.
+
+or at least that's the idea.
+
+The name is obviously an in joke and would want to be changed before
+going into any kind of production.
Index: othersrc/external/bsd/jetlib/TODO
diff -u /dev/null othersrc/external/bsd/jetlib/TODO:1.1
--- /dev/null	Thu Feb  6 04:57:02 2014
+++ othersrc/external/bsd/jetlib/TODO	Thu Feb  6 04:57:02 2014
@@ -0,0 +1,12 @@
+todo:
+   COW for values, or at least large/expensive ones
+   other half of the bin transport
+   non-xml text transport
+   test it
+
+some plist urls:
+   http://en.wikipedia.org/wiki/Property_list
+   http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html
+
+some broader things:
+   should be able to specify the backend allocator

Index: othersrc/external/bsd/jetlib/lib/libjet/Makefile
diff -u /dev/null othersrc/external/bsd/jetlib/lib/libjet/Makefile:1.1
--- /dev/null	Thu Feb  6 04:57:02 2014
+++ othersrc/external/bsd/jetlib/lib/libjet/Makefile	Thu Feb  6 04:57:02 2014
@@ -0,0 +1,7 @@
+WARNS=4
+LIB=jet
+SRCS=jetlib.c jettotext.c jetfromtext.c jettobin.c
+
+NOLINT=1  # lint is currently too stupid
+
+.include bsd.lib.mk
Index: othersrc/external/bsd/jetlib/lib/libjet/jetfromtext.c
diff -u /dev/null othersrc/external/bsd/jetlib/lib/libjet/jetfromtext.c:1.1
--- /dev/null	Thu Feb  6 04:57:02 2014
+++ othersrc/external/bsd/jetlib/lib/libjet/jetfromtext.c	Thu Feb  6 04:57:02 2014
@@ -0,0 +1,449 @@
+#include stdlib.h
+#include string.h
+#include errno.h
+#include math.h
+#include jetlib.h
+
+struct jetparse_context {
+	const char *text;
+};
+
+
+// utils
+
+static
+bool
+jetparse_match(struct jetparse_context *ctx, const char *str)
+{
+	size_t len;
+
+	len = strlen(str);
+	if (!strncmp(ctx-text, str, len)) {
+		ctx-text += len;
+		return true;
+	}
+	errno = EFTYPE;
+	return false;
+}
+
+static
+inline
+int
+is_hexdigit(unsigned char ch)
+{
+	return (ch = '0'  ch = '9') || 
+		(ch != 0  strchr(abcdefABCDEF, ch) != NULL);
+}
+
+static
+inline
+int
+get_hexdigit(unsigned char ch)
+{
+	const char *x, *y;
+
+	if (ch = '0'  ch = '9') {
+		return ch - '0';
+	}
+
+	x = abcdef;
+	y = strchr(x, ch);
+	if (y != NULL) {
+		return 10 + y-x;
+	}
+	x = ABCDEF;
+	y = strchr(x, ch);
+	if (y != NULL) {
+		return 10 + y-x;
+	}
+	return -1;
+}
+
+static
+int
+jetparse_getint(struct jetparse_context *ctx, uintmax_t *retval)
+{
+	/* Why isn't there a strtouimax? */
+	uintmax_t val = 0;
+	unsigned d;
+	bool ok = false;
+
+	while (is_hexdigit(*ctx-text)) {
+		d = get_hexdigit(*ctx-text);
+		ctx-text++;
+		ok = true;
+		val = val*16 + d;
+		if (val  UINTMAX_MAX  4) {
+			/* next digit would overflow */
+			break;
+		}
+	}
+	if (!ok) {
+		/* no digits */
+		return -1;
+	}
+	*retval = val;
+	return 0;
+}
+
+static
+int
+jetparse_getdouble(struct jetparse_context *ctx, double *retval)
+{
+	char *t;
+	double val;
+
+	val = strtod(ctx-text, t);
+	if (val == 0  t == ctx-text) {
+		/* no conversion */
+		return -1;
+	}
+	if ((val == HUGE_VAL || val == -HUGE_VAL)  errno == ERANGE) {
+		/* overflow */
+		return -1;
+	}
+	if (val == 0  errno == ERANGE) {
+		/* underflow */
+		return -1;
+	}
+
+	ctx-text = t;
+	*retval = 

CVS commit: src/usr.sbin/npf/npfctl

2014-02-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb  6 07:36:36 UTC 2014

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Update count. Add serial comma.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.36 src/usr.sbin/npf/npfctl/npf.conf.5:1.37
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.36	Thu Feb  6 02:51:28 2014
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Thu Feb  6 07:36:36 2014
@@ -1,4 +1,4 @@
-.\$NetBSD: npf.conf.5,v 1.36 2014/02/06 02:51:28 rmind Exp $
+.\$NetBSD: npf.conf.5,v 1.37 2014/02/06 07:36:36 wiz Exp $
 .\
 .\ Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -85,7 +85,7 @@ The following is an example of table def
 table black type hash dynamic
 .Pp
 .Ed
-Currently, tables support two storage types: hash, tree or cdb.
+Currently, tables support three storage types: hash, tree, or cdb.
 They can also be dynamic or static i.e. loaded from the specified file.
 .Pp
 The file should contain a list of IP addresses and/or networks in the form of: