Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2013 16:08:09 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r246841 - in user/attilio/vmcontention: include lib lib/libc/net lib/libc/stdio lib/libldns sbin/fsck_ffs sbin/fsdb share/man/man5 share/mk sys/amd64/amd64 sys/cddl/contrib/opensolaris/...
Message-ID:  <201302151608.r1FG89YR008304@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Feb 15 16:08:08 2013
New Revision: 246841
URL: http://svnweb.freebsd.org/changeset/base/246841

Log:
  MFC

Added:
     - copied from r246840, head/contrib/ldns/
  user/attilio/vmcontention/lib/libldns/
     - copied from r246840, head/lib/libldns/
  user/attilio/vmcontention/tools/build/options/WITHOUT_LDNS
     - copied unchanged from r246840, head/tools/build/options/WITHOUT_LDNS
  user/attilio/vmcontention/tools/build/options/WITH_LDNS_UTILS
     - copied unchanged from r246840, head/tools/build/options/WITH_LDNS_UTILS
Directory Properties:
  user/attilio/vmcontention/contrib/ldns/   (props changed)
Modified:
  user/attilio/vmcontention/include/string.h
  user/attilio/vmcontention/lib/Makefile
  user/attilio/vmcontention/lib/libc/net/getaddrinfo.3
  user/attilio/vmcontention/lib/libc/net/getnameinfo.3
  user/attilio/vmcontention/lib/libc/stdio/setbuf.3
  user/attilio/vmcontention/sbin/fsck_ffs/fsck.h
  user/attilio/vmcontention/sbin/fsck_ffs/fsutil.c
  user/attilio/vmcontention/sbin/fsdb/fsdbutil.c
  user/attilio/vmcontention/share/man/man5/src.conf.5
  user/attilio/vmcontention/share/mk/bsd.libnames.mk
  user/attilio/vmcontention/share/mk/bsd.own.mk
  user/attilio/vmcontention/sys/amd64/amd64/pmap.c
  user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c
  user/attilio/vmcontention/sys/conf/options
  user/attilio/vmcontention/sys/dev/oce/oce_if.c
  user/attilio/vmcontention/sys/dev/oce/oce_if.h
  user/attilio/vmcontention/sys/kern/uipc_usrreq.c
  user/attilio/vmcontention/sys/kern/vfs_vnops.c
  user/attilio/vmcontention/sys/net/if_pfsync.h
  user/attilio/vmcontention/sys/net80211/ieee80211.h
  user/attilio/vmcontention/sys/netgraph/ng_parse.c
  user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c
  user/attilio/vmcontention/sys/vm/vm_phys.c
  user/attilio/vmcontention/sys/x86/acpica/srat.c
  user/attilio/vmcontention/usr.bin/csup/csup.1
  user/attilio/vmcontention/usr.sbin/bhyvectl/bhyvectl.c
  user/attilio/vmcontention/usr.sbin/jail/command.c
Directory Properties:
  user/attilio/vmcontention/   (props changed)
  user/attilio/vmcontention/lib/libc/   (props changed)
  user/attilio/vmcontention/sbin/   (props changed)
  user/attilio/vmcontention/sys/   (props changed)
  user/attilio/vmcontention/sys/cddl/contrib/opensolaris/   (props changed)
  user/attilio/vmcontention/sys/conf/   (props changed)
  user/attilio/vmcontention/usr.bin/csup/   (props changed)
  user/attilio/vmcontention/usr.sbin/bhyvectl/   (props changed)
  user/attilio/vmcontention/usr.sbin/jail/   (props changed)

Modified: user/attilio/vmcontention/include/string.h
==============================================================================
--- user/attilio/vmcontention/include/string.h	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/include/string.h	Fri Feb 15 16:08:08 2013	(r246841)
@@ -74,7 +74,7 @@ char	*strcasestr(const char *, const cha
 #endif
 char	*strcat(char * __restrict, const char * __restrict);
 char	*strchr(const char *, int) __pure;
-#if defined(_GNU_SOURCE)
+#if __BSD_VISIBLE
 char	*strchrnul(const char*, int) __pure;
 #endif
 int	 strcmp(const char *, const char *) __pure;

Modified: user/attilio/vmcontention/lib/Makefile
==============================================================================
--- user/attilio/vmcontention/lib/Makefile	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/lib/Makefile	Fri Feb 15 16:08:08 2013	(r246841)
@@ -82,6 +82,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	${_libipx} \
 	libjail \
 	libkiconv \
+	${_libldns} \
 	liblzma \
 	libmagic \
 	libmandoc \
@@ -177,6 +178,10 @@ _libiconv_modules=	libiconv_modules
 _libipx=	libipx
 .endif
 
+.if ${MK_LDNS} != "no"
+_libldns=	libldns
+.endif
+
 .if ${MK_LIBCPLUSPLUS} != "no"
 _libcxxrt=	libcxxrt
 _libcplusplus=	libc++

Modified: user/attilio/vmcontention/lib/libc/net/getaddrinfo.3
==============================================================================
--- user/attilio/vmcontention/lib/libc/net/getaddrinfo.3	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/lib/libc/net/getaddrinfo.3	Fri Feb 15 16:08:08 2013	(r246841)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2009
+.Dd February 14, 2013
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
@@ -339,7 +339,7 @@ hints.ai_socktype = SOCK_STREAM;
 error = getaddrinfo("www.kame.net", "http", &hints, &res0);
 if (error) {
 	errx(1, "%s", gai_strerror(error));
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 s = -1;
 for (res = res0; res; res = res->ai_next) {
@@ -361,7 +361,7 @@ for (res = res0; res; res = res->ai_next
 }
 if (s < 0) {
 	err(1, "%s", cause);
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 freeaddrinfo(res0);
 .Ed
@@ -383,7 +383,7 @@ hints.ai_flags = AI_PASSIVE;
 error = getaddrinfo(NULL, "http", &hints, &res0);
 if (error) {
 	errx(1, "%s", gai_strerror(error));
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 nsock = 0;
 for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
@@ -405,7 +405,7 @@ for (res = res0; res && nsock < MAXSOCK;
 }
 if (nsock == 0) {
 	err(1, "%s", cause);
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 freeaddrinfo(res0);
 .Ed

Modified: user/attilio/vmcontention/lib/libc/net/getnameinfo.3
==============================================================================
--- user/attilio/vmcontention/lib/libc/net/getnameinfo.3	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/lib/libc/net/getnameinfo.3	Fri Feb 15 16:08:08 2013	(r246841)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2007
+.Dd February 14, 2013
 .Dt GETNAMEINFO 3
 .Os
 .Sh NAME
@@ -157,7 +157,7 @@ char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
 if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
     sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) {
 	errx(1, "could not get numeric hostname");
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 printf("host=%s, serv=%s\en", hbuf, sbuf);
 .Ed
@@ -170,7 +170,7 @@ char hbuf[NI_MAXHOST];
 if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
     NI_NAMEREQD)) {
 	errx(1, "could not resolve hostname");
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 printf("host=%s\en", hbuf);
 .Ed

Modified: user/attilio/vmcontention/lib/libc/stdio/setbuf.3
==============================================================================
--- user/attilio/vmcontention/lib/libc/stdio/setbuf.3	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/lib/libc/stdio/setbuf.3	Fri Feb 15 16:08:08 2013	(r246841)
@@ -32,7 +32,7 @@
 .\"     @(#)setbuf.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd February 15, 2013
 .Dt SETBUF 3
 .Os
 .Sh NAME
@@ -195,19 +195,3 @@ and
 functions
 conform to
 .St -isoC .
-.Sh BUGS
-The
-.Fn setbuffer
-and
-.Fn setlinebuf
-functions are not portable to versions of
-.Bx
-before
-.Bx 4.2 .
-On
-.Bx 4.2
-and
-.Bx 4.3
-systems,
-.Fn setbuf
-always uses a suboptimal buffer size and should be avoided.

Modified: user/attilio/vmcontention/sbin/fsck_ffs/fsck.h
==============================================================================
--- user/attilio/vmcontention/sbin/fsck_ffs/fsck.h	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sbin/fsck_ffs/fsck.h	Fri Feb 15 16:08:08 2013	(r246841)
@@ -67,10 +67,13 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include <sys/queue.h>
+
 #define	MAXDUP		10	/* limit on dup blks (per inode) */
 #define	MAXBAD		10	/* limit on bad blks (per inode) */
-#define	MAXBUFSPACE	40*1024	/* maximum space to allocate to buffers */
-#define	INOBUFSIZE	56*1024	/* size of buffer to read inodes in pass1 */
+#define	MINBUFS		10	/* minimum number of buffers required */
+#define	MAXBUFS		40	/* maximum space to allocate to buffers */
+#define	INOBUFSIZE	64*1024	/* size of buffer to read inodes in pass1 */
 
 union dinode {
 	struct ufs1_dinode dp1;
@@ -130,8 +133,7 @@ struct inostatlist {
  * buffer cache structure.
  */
 struct bufarea {
-	struct bufarea *b_next;		/* free list queue */
-	struct bufarea *b_prev;		/* free list queue */
+	TAILQ_ENTRY(bufarea) b_list;		/* buffer list */
 	ufs2_daddr_t b_bno;
 	int b_size;
 	int b_errs;
@@ -159,10 +161,11 @@ struct bufarea {
 		(bp)->b_un.b_indir2[i] = (val); \
 	} while (0)
 
-#define	B_INUSE 1
+/*
+ * Buffer flags
+ */
+#define	B_INUSE 	0x00000001	/* Buffer is in use */
 
-#define	MINBUFS		5	/* minimum number of buffers required */
-struct bufarea bufhead;		/* head of list of other blks in filesys */
 struct bufarea sblk;		/* file system superblock */
 struct bufarea cgblk;		/* cylinder group blocks */
 struct bufarea *pdirbp;		/* current directory contents */

Modified: user/attilio/vmcontention/sbin/fsck_ffs/fsutil.c
==============================================================================
--- user/attilio/vmcontention/sbin/fsck_ffs/fsutil.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sbin/fsck_ffs/fsutil.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -67,6 +67,8 @@ long	diskreads, totalreads;	/* Disk cach
 struct timeval slowio_starttime;
 int slowio_delay_usec = 10000;	/* Initial IO delay for background fsck */
 int slowio_pollcnt;
+static TAILQ_HEAD(buflist, bufarea) bufhead;	/* head of buffer cache list */
+static int numbufs;				/* size of buffer cache */
 
 int
 ftypeok(union dinode *dp)
@@ -162,8 +164,8 @@ bufinit(void)
 		errx(EEXIT, "cannot allocate buffer pool");
 	cgblk.b_un.b_buf = bufp;
 	initbarea(&cgblk);
-	bufhead.b_next = bufhead.b_prev = &bufhead;
-	bufcnt = MAXBUFSPACE / sblock.fs_bsize;
+	TAILQ_INIT(&bufhead);
+	bufcnt = MAXBUFS;
 	if (bufcnt < MINBUFS)
 		bufcnt = MINBUFS;
 	for (i = 0; i < bufcnt; i++) {
@@ -175,13 +177,10 @@ bufinit(void)
 			errx(EEXIT, "cannot allocate buffer pool");
 		}
 		bp->b_un.b_buf = bufp;
-		bp->b_prev = &bufhead;
-		bp->b_next = bufhead.b_next;
-		bufhead.b_next->b_prev = bp;
-		bufhead.b_next = bp;
+		TAILQ_INSERT_HEAD(&bufhead, bp, b_list);
 		initbarea(bp);
 	}
-	bufhead.b_size = i;	/* save number of buffers */
+	numbufs = i;	/* save number of buffers */
 }
 
 /*
@@ -192,23 +191,19 @@ getdatablk(ufs2_daddr_t blkno, long size
 {
 	struct bufarea *bp;
 
-	for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next)
+	TAILQ_FOREACH(bp, &bufhead, b_list)
 		if (bp->b_bno == fsbtodb(&sblock, blkno))
 			goto foundit;
-	for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev)
+	TAILQ_FOREACH_REVERSE(bp, &bufhead, buflist, b_list)
 		if ((bp->b_flags & B_INUSE) == 0)
 			break;
-	if (bp == &bufhead)
+	if (bp == NULL)
 		errx(EEXIT, "deadlocked buffer pool");
 	getblk(bp, blkno, size);
 	/* fall through */
 foundit:
-	bp->b_prev->b_next = bp->b_next;
-	bp->b_next->b_prev = bp->b_prev;
-	bp->b_prev = &bufhead;
-	bp->b_next = bufhead.b_next;
-	bufhead.b_next->b_prev = bp;
-	bufhead.b_next = bp;
+	TAILQ_REMOVE(&bufhead, bp, b_list);
+	TAILQ_INSERT_HEAD(&bufhead, bp, b_list);
 	bp->b_flags |= B_INUSE;
 	return (bp);
 }
@@ -274,7 +269,7 @@ void
 ckfini(int markclean)
 {
 	struct bufarea *bp, *nbp;
-	int ofsmodified, cnt = 0;
+	int ofsmodified, cnt;
 
 	if (bkgrdflag) {
 		unlink(snapname);
@@ -295,6 +290,10 @@ ckfini(int markclean)
 			rerun = 1;
 		}
 	}
+	if (debug && totalreads > 0)
+		printf("cache with %d buffers missed %ld of %ld (%d%%)\n",
+		    numbufs, diskreads, totalreads,
+		    (int)(diskreads * 100 / totalreads));
 	if (fswritefd < 0) {
 		(void)close(fsreadfd);
 		return;
@@ -309,15 +308,16 @@ ckfini(int markclean)
 	}
 	flush(fswritefd, &cgblk);
 	free(cgblk.b_un.b_buf);
-	for (bp = bufhead.b_prev; bp && bp != &bufhead; bp = nbp) {
+	cnt = 0;
+	TAILQ_FOREACH_REVERSE_SAFE(bp, &bufhead, buflist, b_list, nbp) {
+		TAILQ_REMOVE(&bufhead, bp, b_list);
 		cnt++;
 		flush(fswritefd, bp);
-		nbp = bp->b_prev;
 		free(bp->b_un.b_buf);
 		free((char *)bp);
 	}
-	if (bufhead.b_size != cnt)
-		errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt);
+	if (numbufs != cnt)
+		errx(EEXIT, "panic: lost %d buffers", numbufs - cnt);
 	pbp = pdirbp = (struct bufarea *)0;
 	if (cursnapshot == 0 && sblock.fs_clean != markclean) {
 		if ((sblock.fs_clean = markclean) != 0) {
@@ -343,9 +343,6 @@ ckfini(int markclean)
 			rerun = 1;
 		}
 	}
-	if (debug && totalreads > 0)
-		printf("cache missed %ld of %ld (%d%%)\n", diskreads,
-		    totalreads, (int)(diskreads * 100 / totalreads));
 	(void)close(fsreadfd);
 	(void)close(fswritefd);
 }

Modified: user/attilio/vmcontention/sbin/fsdb/fsdbutil.c
==============================================================================
--- user/attilio/vmcontention/sbin/fsdb/fsdbutil.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sbin/fsdb/fsdbutil.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -239,7 +239,6 @@ printindir(ufs2_daddr_t blk, int level, 
 	/* for the final indirect level, don't use the cache */
 	bp = &buf;
 	bp->b_un.b_buf = bufp;
-	bp->b_prev = bp->b_next = bp;
 	initbarea(bp);
 
 	getblk(bp, blk, sblock.fs_bsize);

Modified: user/attilio/vmcontention/share/man/man5/src.conf.5
==============================================================================
--- user/attilio/vmcontention/share/man/man5/src.conf.5	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/share/man/man5/src.conf.5	Fri Feb 15 16:08:08 2013	(r246841)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 236279 2012-05-30 02:37:20Z gjb
 .\" $FreeBSD$
-.Dd February 2, 2013
+.Dd February 15, 2013
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -291,7 +291,7 @@ When set, it also enforces the following
 Set to not build the Clang C/C++ compiler.
 .Pp
 It is a default setting on
-arm/arm, arm/armeb, arm/armv6, arm/armv6eb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64.
+arm/armeb, arm/armv6eb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64.
 When set, it also enforces the following options:
 .Pp
 .Bl -item -compact
@@ -302,12 +302,6 @@ When set, it also enforces the following
 .It
 .Va WITHOUT_CLANG_IS_CC
 .El
-.It Va WITH_CLANG
-.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru
-Set to build the Clang C/C++ compiler.
-.Pp
-It is a default setting on
-amd64/amd64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITH_CLANG_EXTRAS
 .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim
 Set to build additional clang and llvm tools, such as bugpoint.
@@ -435,13 +429,6 @@ This includes the device tree compiler (
 .Pp
 It is a default setting on
 amd64/amd64, i386/i386, ia64/ia64, pc98/i386 and sparc64/sparc64.
-.It Va WITH_FDT
-.\" from FreeBSD: head/tools/build/options/WITH_FDT 221730 2011-05-10 11:14:40Z ru
-Set to build Flattened Device Tree support as part of the base system.
-This includes the device tree compiler (dtc) and libfdt support library.
-.Pp
-It is a default setting on
-arm/arm, arm/armeb, arm/armv6, arm/armv6eb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_FLOPPY
 .\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru
 Set to not build or install programs
@@ -659,6 +646,26 @@ When set, it also enforces the following
 Set to build some programs without optional
 .Nm libkvm
 support.
+.It Va WITHOUT_LDNS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LDNS 246827 2013-02-15 13:44:18Z des
+Setting this variable will prevent LDNS from being built.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_LDNS_UTILS
+.El
+.It Va WITH_LDNS_UTILS
+.\" from FreeBSD: head/tools/build/options/WITH_LDNS_UTILS 246830 2013-02-15 13:57:51Z des
+Setting this variable will enable the LDNS-based versions of
+.Xr dig 1
+and
+.Xr host 1 .
+When set, the following options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_BIND_UTILS
+.El
 .It Va WITHOUT_LEGACY_CONSOLE
 .\" from FreeBSD: head/tools/build/options/WITHOUT_LEGACY_CONSOLE 183242 2008-09-21 22:02:26Z sam
 Set to not build programs that support a legacy PC console; e.g.

Modified: user/attilio/vmcontention/share/mk/bsd.libnames.mk
==============================================================================
--- user/attilio/vmcontention/share/mk/bsd.libnames.mk	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/share/mk/bsd.libnames.mk	Fri Feb 15 16:08:08 2013	(r246841)
@@ -85,6 +85,9 @@ LIBKICONV?=	${DESTDIR}${LIBDIR}/libkicon
 LIBKRB5?=	${DESTDIR}${LIBDIR}/libkrb5.a
 LIBKVM?=	${DESTDIR}${LIBDIR}/libkvm.a
 LIBL?=		${DESTDIR}${LIBDIR}/libl.a
+.if ${MK_LDNS} != "no"
+LIBLDNS?=	${DESTDIR}${LIBDIR}/lib_ldns.a
+.endif
 LIBLN?=		"don't use LIBLN, use LIBL"
 .if ${MK_BIND} != "no"
 LIBLWRES?=	${DESTDIR}${LIBDIR}/liblwres.a

Modified: user/attilio/vmcontention/share/mk/bsd.own.mk
==============================================================================
--- user/attilio/vmcontention/share/mk/bsd.own.mk	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/share/mk/bsd.own.mk	Fri Feb 15 16:08:08 2013	(r246841)
@@ -295,6 +295,7 @@ __DEFAULT_YES_OPTIONS = \
     KERBEROS \
     KERNEL_SYMBOLS \
     KVM \
+    LDNS \
     LEGACY_CONSOLE \
     LIB32 \
     LIBPTHREAD \
@@ -370,6 +371,7 @@ __DEFAULT_NO_OPTIONS = \
     ICONV \
     IDEA \
     INSTALL_AS_USER \
+    LDNS_UTILS \
     NMTREE \
     NAND \
     OFED \
@@ -471,6 +473,14 @@ MK_BIND_NAMED:=	no
 MK_BIND_UTILS:=	no
 .endif
 
+.if ${MK_LDNS} == "no"
+MK_LDNS_UTILS:=	no
+.endif
+
+.if ${MK_LDNS_UTILS} != "no"
+MK_BIND_UTILS:=	no
+.endif
+
 .if ${MK_BIND_MTREE} == "no"
 MK_BIND_ETC:=	no
 .endif

Modified: user/attilio/vmcontention/sys/amd64/amd64/pmap.c
==============================================================================
--- user/attilio/vmcontention/sys/amd64/amd64/pmap.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/amd64/amd64/pmap.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -1482,6 +1482,7 @@ pmap_qremove(vm_offset_t sva, int count)
 
 	va = sva;
 	while (count-- > 0) {
+		KASSERT(va >= VM_MIN_KERNEL_ADDRESS, ("usermode va %lx", va));
 		pmap_kremove(va);
 		va += PAGE_SIZE;
 	}
@@ -4508,8 +4509,10 @@ pmap_remove_pages(pmap_t pmap)
 					pte = &pte[pmap_pte_index(pv->pv_va)];
 					tpte = *pte & ~PG_PTE_PAT;
 				}
-				if ((tpte & PG_V) == 0)
-					panic("bad pte");
+				if ((tpte & PG_V) == 0) {
+					panic("bad pte va %lx pte %lx",
+					    pv->pv_va, tpte);
+				}
 
 /*
  * We cannot remove wired pages from a process' mapping at this time

Modified: user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c
==============================================================================
--- user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -36,7 +36,6 @@
 
 static int real_LZ4_compress(const char *source, char *dest, int isize,
     int osize);
-static int real_LZ4_uncompress(const char *source, char *dest, int osize);
 static int LZ4_compressBound(int isize);
 static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
     int isize, int maxOutputSize);
@@ -104,16 +103,6 @@ lz4_decompress(void *s_start, void *d_st
  * 		situations (input data not compressible) worst case size
  * 		evaluation is provided by function LZ4_compressBound().
  *
- * real_LZ4_uncompress() :
- * 	osize  : is the output size, therefore the original size
- * 	return : the number of bytes read in the source buffer.
- * 		If the source stream is malformed, the function will stop
- * 		decoding and return a negative result, indicating the byte
- * 		position of the faulty instruction. This function never
- * 		writes beyond dest + osize, and is therefore protected
- * 		against malicious data packets.
- * 	note : destination buffer must be already allocated
- *
  * Advanced Functions
  *
  * LZ4_compressBound() :
@@ -137,7 +126,6 @@ lz4_decompress(void *s_start, void *d_st
  * 		maxOutputSize, and is therefore protected against malicious
  * 		data packets.
  * 	note   : Destination buffer must be already allocated.
- *		This version is slightly slower than real_LZ4_uncompress()
  *
  * LZ4_compressCtx() :
  * 	This function explicitly handles the CTX memory structure.
@@ -879,128 +867,16 @@ real_LZ4_compress(const char *source, ch
 /* Decompression functions */
 
 /*
- * Note: The decoding functions real_LZ4_uncompress() and
- *	LZ4_uncompress_unknownOutputSize() are safe against "buffer overflow"
- *	attack type. They will never write nor read outside of the provided
- *	output buffers. LZ4_uncompress_unknownOutputSize() also insures that
- *	it will never read outside of the input buffer. A corrupted input
- *	will produce an error result, a negative int, indicating the position
- *	of the error within input stream.
+ * Note: The decoding functionLZ4_uncompress_unknownOutputSize() is safe
+ *	against "buffer overflow" attack type. They will never write nor
+ *	read outside of the provided output buffers.
+ *	LZ4_uncompress_unknownOutputSize() also insures that it will never
+ *	read outside of the input buffer.  A corrupted input will produce
+ *	an error result, a negative int, indicating the position of the
+ *	error within input stream.
  */
 
 static int
-real_LZ4_uncompress(const char *source, char *dest, int osize)
-{
-	/* Local Variables */
-	const BYTE *restrict ip = (const BYTE *) source;
-	const BYTE *ref;
-
-	BYTE *op = (BYTE *) dest;
-	BYTE *const oend = op + osize;
-	BYTE *cpy;
-
-	unsigned token;
-
-	size_t length;
-	size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0};
-#if LZ4_ARCH64
-	size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3};
-#endif
-
-	/* Main Loop */
-	for (;;) {
-		/* get runlength */
-		token = *ip++;
-		if ((length = (token >> ML_BITS)) == RUN_MASK) {
-			size_t len;
-			for (; (len = *ip++) == 255; length += 255) {
-			}
-			length += len;
-		}
-		/* copy literals */
-		cpy = op + length;
-		if unlikely(cpy > oend - COPYLENGTH) {
-			if (cpy != oend)
-				/* Error: we must necessarily stand at EOF */
-				goto _output_error;
-			(void) memcpy(op, ip, length);
-			ip += length;
-			break;	/* EOF */
-			}
-		LZ4_WILDCOPY(ip, op, cpy);
-		ip -= (op - cpy);
-		op = cpy;
-
-		/* get offset */
-		LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip);
-		ip += 2;
-		if unlikely(ref < (BYTE * const) dest)
-			/*
-			 * Error: offset create reference outside destination
-			 * buffer
-			 */
-			goto _output_error;
-
-		/* get matchlength */
-		if ((length = (token & ML_MASK)) == ML_MASK) {
-			for (; *ip == 255; length += 255) {
-				ip++;
-			}
-			length += *ip++;
-		}
-		/* copy repeated sequence */
-		if unlikely(op - ref < STEPSIZE) {
-#if LZ4_ARCH64
-			size_t dec64 = dec64table[op-ref];
-#else
-			const int dec64 = 0;
-#endif
-			op[0] = ref[0];
-			op[1] = ref[1];
-			op[2] = ref[2];
-			op[3] = ref[3];
-			op += 4;
-			ref += 4;
-			ref -= dec32table[op-ref];
-			A32(op) = A32(ref);
-			op += STEPSIZE - 4;
-			ref -= dec64;
-		} else {
-			LZ4_COPYSTEP(ref, op);
-		}
-		cpy = op + length - (STEPSIZE - 4);
-		if (cpy > oend - COPYLENGTH) {
-			if (cpy > oend)
-				/*
-				 * Error: request to write beyond destination
-				 * buffer
-				 */
-				goto _output_error;
-			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
-			while (op < cpy)
-				*op++ = *ref++;
-			op = cpy;
-			if (op == oend)
-				/*
-				 * Check EOF (should never happen, since last
-				 * 5 bytes are supposed to be literals)
-				 */
-				goto _output_error;
-			continue;
-		}
-		LZ4_SECURECOPY(ref, op, cpy);
-		op = cpy;	/* correction */
-	}
-
-	/* end of decoding */
-	return (int)(((char *)ip) - source);
-
-	/* write overflow error detected */
-	_output_error:
-	return (int)(-(((char *)ip) - source));
-}
-
-static int
 LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize,
     int maxOutputSize)
 {

Modified: user/attilio/vmcontention/sys/conf/options
==============================================================================
--- user/attilio/vmcontention/sys/conf/options	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/conf/options	Fri Feb 15 16:08:08 2013	(r246841)
@@ -588,6 +588,7 @@ VFS_BIO_DEBUG		opt_global.h
 VM_KMEM_SIZE		opt_vm.h
 VM_KMEM_SIZE_SCALE	opt_vm.h
 VM_KMEM_SIZE_MAX	opt_vm.h
+VM_NDOMAIN		opt_vm.h
 VM_NRESERVLEVEL		opt_vm.h
 VM_LEVEL_0_ORDER	opt_vm.h
 NO_SWAPPING		opt_vm.h

Modified: user/attilio/vmcontention/sys/dev/oce/oce_if.c
==============================================================================
--- user/attilio/vmcontention/sys/dev/oce/oce_if.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/dev/oce/oce_if.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -1817,6 +1817,9 @@ oce_local_timer(void *arg)
 }
 
 
+/* NOTE : This should only be called holding
+ *        DEVICE_LOCK.
+*/
 static void
 oce_if_deactivate(POCE_SOFTC sc)
 {
@@ -1846,11 +1849,17 @@ oce_if_deactivate(POCE_SOFTC sc)
 	/* Stop intrs and finish any bottom halves pending */
 	oce_hw_intr_disable(sc);
 
+    /* Since taskqueue_drain takes a Giant Lock, We should not acquire
+       any other lock. So unlock device lock and require after
+       completing taskqueue_drain.
+    */
+    UNLOCK(&sc->dev_lock);
 	for (i = 0; i < sc->intr_count; i++) {
 		if (sc->intrs[i].tq != NULL) {
 			taskqueue_drain(sc->intrs[i].tq, &sc->intrs[i].task);
 		}
 	}
+    LOCK(&sc->dev_lock);
 
 	/* Delete RX queue in card with flush param */
 	oce_stop_rx(sc);

Modified: user/attilio/vmcontention/sys/dev/oce/oce_if.h
==============================================================================
--- user/attilio/vmcontention/sys/dev/oce/oce_if.h	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/dev/oce/oce_if.h	Fri Feb 15 16:08:08 2013	(r246841)
@@ -493,7 +493,7 @@ struct oce_lock {
 #define LOCK_CREATE(lock, desc) 		{ \
 	strncpy((lock)->name, (desc), MAX_LOCK_DESC_LEN); \
 	(lock)->name[MAX_LOCK_DESC_LEN] = '\0'; \
-	mtx_init(&(lock)->mutex, (lock)->name, MTX_NETWORK_LOCK, MTX_DEF); \
+	mtx_init(&(lock)->mutex, (lock)->name, NULL, MTX_DEF); \
 }
 #define LOCK_DESTROY(lock) 			\
 		if (mtx_initialized(&(lock)->mutex))\

Modified: user/attilio/vmcontention/sys/kern/uipc_usrreq.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/uipc_usrreq.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/kern/uipc_usrreq.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -1798,6 +1798,7 @@ unp_internalize(struct mbuf **controlp, 
 	struct mbuf *control = *controlp;
 	struct proc *p = td->td_proc;
 	struct filedesc *fdescp = p->p_fd;
+	struct bintime *bt;
 	struct cmsghdr *cm = mtod(control, struct cmsghdr *);
 	struct cmsgcred *cmcred;
 	struct file **rp;
@@ -1906,6 +1907,18 @@ unp_internalize(struct mbuf **controlp, 
 			microtime(tv);
 			break;
 
+		case SCM_BINTIME:
+			*controlp = sbcreatecontrol(NULL, sizeof(*bt),
+			    SCM_BINTIME, SOL_SOCKET);
+			if (*controlp == NULL) {
+				error = ENOBUFS;
+				goto out;
+			}
+			bt = (struct bintime *)
+			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
+			bintime(bt);
+			break;
+
 		default:
 			error = EINVAL;
 			goto out;

Modified: user/attilio/vmcontention/sys/kern/vfs_vnops.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/vfs_vnops.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/kern/vfs_vnops.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -872,8 +872,8 @@ static const int io_hold_cnt = 16;
 static int vn_io_fault_enable = 1;
 SYSCTL_INT(_debug, OID_AUTO, vn_io_fault_enable, CTLFLAG_RW,
     &vn_io_fault_enable, 0, "Enable vn_io_fault lock avoidance");
-static unsigned long vn_io_faults_cnt;
-SYSCTL_LONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD,
+static u_long vn_io_faults_cnt;
+SYSCTL_ULONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD,
     &vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers");
 
 /*

Modified: user/attilio/vmcontention/sys/net/if_pfsync.h
==============================================================================
--- user/attilio/vmcontention/sys/net/if_pfsync.h	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/net/if_pfsync.h	Fri Feb 15 16:08:08 2013	(r246841)
@@ -67,8 +67,6 @@
 #define	PFSYNC_ACT_EOF		12	/* end of frame */
 #define	PFSYNC_ACT_MAX		13
 
-#define	PFSYNC_HMAC_LEN	20
-
 /*
  * A pfsync frame is built from a header followed by several sections which
  * are all prefixed with their own subheaders. Frames must be terminated with
@@ -205,18 +203,8 @@ struct pfsync_tdb {
 	u_int8_t			_pad[2];
 } __packed;
 
-/*
- * EOF
- */
-
-struct pfsync_eof {
-	u_int8_t			hmac[PFSYNC_HMAC_LEN];
-} __packed;
-
 #define	PFSYNC_HDRLEN		sizeof(struct pfsync_header)
 
-
-
 /*
  * Names for PFSYNC sysctl objects
  */

Modified: user/attilio/vmcontention/sys/net80211/ieee80211.h
==============================================================================
--- user/attilio/vmcontention/sys/net80211/ieee80211.h	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/net80211/ieee80211.h	Fri Feb 15 16:08:08 2013	(r246841)
@@ -200,11 +200,11 @@ struct ieee80211_qosframe_addr4 {
 #define	IEEE80211_QOS_EOSP_S			4
 #define	IEEE80211_QOS_TID			0x0f
 /* qos[1] byte used for all frames sent by mesh STAs in a mesh BSS */
-#define IEEE80211_QOS_MC			0x10	/* Mesh control */
+#define IEEE80211_QOS_MC			0x01	/* Mesh control */
 /* Mesh power save level*/
-#define IEEE80211_QOS_MESH_PSL			0x20
+#define IEEE80211_QOS_MESH_PSL			0x02
 /* Mesh Receiver Service Period Initiated */
-#define IEEE80211_QOS_RSPI			0x40
+#define IEEE80211_QOS_RSPI			0x04
 /* bits 11 to 15 reserved */
 
 /* does frame have QoS sequence control data */

Modified: user/attilio/vmcontention/sys/netgraph/ng_parse.c
==============================================================================
--- user/attilio/vmcontention/sys/netgraph/ng_parse.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/netgraph/ng_parse.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -1236,6 +1236,7 @@ ng_parse_composite(const struct ng_parse
 		   distinguish name from values by seeing if the next
 		   token is an equals sign */
 		if (ctype != CT_STRUCT) {
+			u_long ul;
 			int len2, off2;
 			char *eptr;
 
@@ -1259,11 +1260,12 @@ ng_parse_composite(const struct ng_parse
 			}
 
 			/* Index was specified explicitly; parse it */
-			index = (u_int)strtoul(s + *off, &eptr, 0);
-			if (index < 0 || eptr - (s + *off) != len) {
+			ul = strtoul(s + *off, &eptr, 0);
+			if (ul == ULONG_MAX || eptr - (s + *off) != len) {
 				error = EINVAL;
 				goto done;
 			}
+			index = (u_int)ul;
 			nextIndex = index + 1;
 			*off += len + len2;
 		} else {			/* a structure field */

Modified: user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c
==============================================================================
--- user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/netpfil/pf/if_pfsync.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -99,8 +99,7 @@ __FBSDID("$FreeBSD$");
 #define PFSYNC_MINPKT ( \
 	sizeof(struct ip) + \
 	sizeof(struct pfsync_header) + \
-	sizeof(struct pfsync_subheader) + \
-	sizeof(struct pfsync_eof))
+	sizeof(struct pfsync_subheader) )
 
 struct pfsync_pkt {
 	struct ip *ip;

Modified: user/attilio/vmcontention/sys/vm/vm_phys.c
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_phys.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/vm/vm_phys.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -40,6 +40,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_ddb.h"
+#include "opt_vm.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: user/attilio/vmcontention/sys/x86/acpica/srat.c
==============================================================================
--- user/attilio/vmcontention/sys/x86/acpica/srat.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/sys/x86/acpica/srat.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -28,6 +28,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_vm.h"
+
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/kernel.h>

Copied: user/attilio/vmcontention/tools/build/options/WITHOUT_LDNS (from r246840, head/tools/build/options/WITHOUT_LDNS)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmcontention/tools/build/options/WITHOUT_LDNS	Fri Feb 15 16:08:08 2013	(r246841, copy of r246840, head/tools/build/options/WITHOUT_LDNS)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Setting this variable will prevent LDNS from being built.

Copied: user/attilio/vmcontention/tools/build/options/WITH_LDNS_UTILS (from r246840, head/tools/build/options/WITH_LDNS_UTILS)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmcontention/tools/build/options/WITH_LDNS_UTILS	Fri Feb 15 16:08:08 2013	(r246841, copy of r246840, head/tools/build/options/WITH_LDNS_UTILS)
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Setting this variable will enable the LDNS-based versions of
+.Xr dig 1
+and
+.Xr host 1 .

Modified: user/attilio/vmcontention/usr.bin/csup/csup.1
==============================================================================
--- user/attilio/vmcontention/usr.bin/csup/csup.1	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/usr.bin/csup/csup.1	Fri Feb 15 16:08:08 2013	(r246841)
@@ -24,7 +24,7 @@
 .\" $Id: cvsup.1,v 1.70 2003/03/04 18:23:46 jdp Exp $
 .\" $FreeBSD$
 .\"
-.Dd Feburary 8, 2013
+.Dd February 8, 2013
 .Dt CSUP 1
 .Os FreeBSD
 .Sh NAME

Modified: user/attilio/vmcontention/usr.sbin/bhyvectl/bhyvectl.c
==============================================================================
--- user/attilio/vmcontention/usr.sbin/bhyvectl/bhyvectl.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/usr.sbin/bhyvectl/bhyvectl.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -185,6 +185,7 @@ usage(void)
 	"       [--get-vmcs-interruptibility]\n"
 	"       [--set-x2apic-state=<state>]\n"
 	"       [--get-x2apic-state]\n"
+	"       [--unassign-pptdev=<bus/slot/func>]\n"
 	"       [--set-lowmem=<memory below 4GB in units of MB>]\n"
 	"       [--get-lowmem]\n"
 	"       [--set-highmem=<memory above 4GB in units of MB>]\n"
@@ -218,6 +219,7 @@ static int set_cs, set_ds, set_es, set_f
 static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr;
 static int set_x2apic_state, get_x2apic_state;
 enum x2apic_state x2apic_state;
+static int unassign_pptdev, bus, slot, func;
 static int run;
 
 /*
@@ -376,6 +378,7 @@ enum {
 	SET_VMCS_ENTRY_INTERRUPTION_INFO,
 	SET_CAP,
 	CAPNAME,
+	UNASSIGN_PPTDEV,
 };
 
 int
@@ -425,6 +428,7 @@ main(int argc, char *argv[])
 		{ "set-vmcs-entry-interruption-info",
 				REQ_ARG, 0, SET_VMCS_ENTRY_INTERRUPTION_INFO },
 		{ "capname",	REQ_ARG,	0,	CAPNAME },
+		{ "unassign-pptdev", REQ_ARG,	0,	UNASSIGN_PPTDEV },
 		{ "setcap",	REQ_ARG,	0,	SET_CAP },
 		{ "getcap",	NO_ARG,		&getcap,	1 },
 		{ "get-stats",	NO_ARG,		&get_stats,	1 },
@@ -672,6 +676,11 @@ main(int argc, char *argv[])
 		case CAPNAME:
 			capname = optarg;
 			break;
+		case UNASSIGN_PPTDEV:
+			unassign_pptdev = 1;
+			if (sscanf(optarg, "%d/%d/%d", &bus, &slot, &func) != 3)
+				usage();
+			break;
 		default:
 			usage();
 		}
@@ -805,6 +814,9 @@ main(int argc, char *argv[])
 	if (!error && set_x2apic_state)
 		error = vm_set_x2apic_state(ctx, vcpu, x2apic_state);
 
+	if (!error && unassign_pptdev)
+		error = vm_unassign_pptdev(ctx, bus, slot, func);
+
 	if (!error && set_exception_bitmap) {
 		error = vm_set_vmcs_field(ctx, vcpu, VMCS_EXCEPTION_BITMAP,
 					  exception_bitmap);

Modified: user/attilio/vmcontention/usr.sbin/jail/command.c
==============================================================================
--- user/attilio/vmcontention/usr.sbin/jail/command.c	Fri Feb 15 16:05:18 2013	(r246840)
+++ user/attilio/vmcontention/usr.sbin/jail/command.c	Fri Feb 15 16:08:08 2013	(r246841)
@@ -66,7 +66,7 @@ int paralimit = -1;
 extern char **environ;
 
 static int run_command(struct cfjail *j);
-static void add_proc(struct cfjail *j, pid_t pid);
+static int add_proc(struct cfjail *j, pid_t pid);
 static void clear_procs(struct cfjail *j);
 static struct cfjail *find_proc(pid_t pid);
 static int term_procs(struct cfjail *j);
@@ -542,13 +542,12 @@ run_command(struct cfjail *j)
 	if (pid < 0)
 		err(1, "fork");
 	if (pid > 0) {
-		if (bg) {
+		if (bg || !add_proc(j, pid)) {
 			free(j->comline);
 			j->comline = NULL;
 			return 0;
 		} else {
 			paralimit--;
-			add_proc(j, pid);
 			return 1;
 		}
 	}
@@ -622,7 +621,7 @@ run_command(struct cfjail *j)
 /*
  * Add a process to the hash, tied to a jail.
  */
-static void
+static int
 add_proc(struct cfjail *j, pid_t pid)
 {
 	struct kevent ke;
@@ -632,8 +631,11 @@ add_proc(struct cfjail *j, pid_t pid)
 	if (!kq && (kq = kqueue()) < 0)
 		err(1, "kqueue");
 	EV_SET(&ke, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
-	if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0)
+	if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
+		if (errno == ESRCH)
+			return 0;
 		err(1, "kevent");
+	}
 	ph = emalloc(sizeof(struct phash));
 	ph->j = j;
 	ph->pid = pid;
@@ -658,6 +660,7 @@ add_proc(struct cfjail *j, pid_t pid)
 			TAILQ_INSERT_TAIL(&sleeping, j, tq);
 		j->queue = &sleeping;
 	}
+	return 1;
 }
 
 /*
@@ -730,7 +733,7 @@ term_procs(struct cfjail *j)
 	for (i = 0; i < pcnt; i++)
 		if (ki[i].ki_jid == j->jid &&
 		    kill(ki[i].ki_pid, SIGTERM) == 0) {
-			add_proc(j, ki[i].ki_pid);
+			(void)add_proc(j, ki[i].ki_pid);
 			if (verbose > 0) {
 				if (!noted) {
 					noted = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302151608.r1FG89YR008304>