svn commit: r247288 - in user/adrian/net80211_tx: . bin/sh bin/test cddl/contrib/opensolaris/cmd/zinject cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sy...

Adrian Chadd adrian at FreeBSD.org
Mon Feb 25 22:51:53 UTC 2013


Author: adrian
Date: Mon Feb 25 22:51:49 2013
New Revision: 247288
URL: http://svnweb.freebsd.org/changeset/base/247288

Log:
  MFH

Added:
  user/adrian/net80211_tx/tools/regression/bin/sh/builtins/wait4.0
     - copied unchanged from r247287, head/tools/regression/bin/sh/builtins/wait4.0
  user/adrian/net80211_tx/tools/regression/bin/sh/builtins/wait5.0
     - copied unchanged from r247287, head/tools/regression/bin/sh/builtins/wait5.0
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/media.hlp
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/include/media.hlp
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/network_device.hlp
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/include/network_device.hlp
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/options.hlp
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/include/options.hlp
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/tcp.hlp
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/include/tcp.hlp
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/device.subr
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/share/device.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/media/
     - copied from r247287, head/usr.sbin/bsdconfig/share/media/
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/struct.subr
     - copied unchanged from r247287, head/usr.sbin/bsdconfig/share/struct.subr
Deleted:
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/include/tcp.hlp
Modified:
  user/adrian/net80211_tx/Makefile.inc1
  user/adrian/net80211_tx/bin/sh/eval.c
  user/adrian/net80211_tx/bin/sh/jobs.c
  user/adrian/net80211_tx/bin/sh/main.c
  user/adrian/net80211_tx/bin/sh/trap.c
  user/adrian/net80211_tx/bin/sh/trap.h
  user/adrian/net80211_tx/bin/test/test.1
  user/adrian/net80211_tx/bin/test/test.c
  user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/translate.c
  user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/zinject.c
  user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  user/adrian/net80211_tx/contrib/llvm/lib/Target/X86/X86InstrCompiler.td
  user/adrian/net80211_tx/etc/rc.d/rtadvd
  user/adrian/net80211_tx/lib/libc/gen/opendir.c
  user/adrian/net80211_tx/lib/libelf/elf_update.c
  user/adrian/net80211_tx/sbin/fsck_ffs/dir.c
  user/adrian/net80211_tx/sbin/fsck_ffs/ea.c
  user/adrian/net80211_tx/sbin/fsck_ffs/fsck.h
  user/adrian/net80211_tx/sbin/fsck_ffs/fsutil.c
  user/adrian/net80211_tx/sbin/fsck_ffs/inode.c
  user/adrian/net80211_tx/sbin/fsck_ffs/main.c
  user/adrian/net80211_tx/sbin/fsck_ffs/setup.c
  user/adrian/net80211_tx/sbin/fsdb/fsdbutil.c
  user/adrian/net80211_tx/sbin/hastctl/hastctl.c
  user/adrian/net80211_tx/sbin/hastd/control.c
  user/adrian/net80211_tx/sbin/hastd/hast.h
  user/adrian/net80211_tx/sbin/hastd/primary.c
  user/adrian/net80211_tx/sbin/hastd/secondary.c
  user/adrian/net80211_tx/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h
  user/adrian/net80211_tx/sys/arm/ti/ti_gpio.c
  user/adrian/net80211_tx/sys/boot/common/bootstrap.h
  user/adrian/net80211_tx/sys/boot/common/module.c
  user/adrian/net80211_tx/sys/boot/fdt/dts/bcm2835-rpi-b.dts
  user/adrian/net80211_tx/sys/boot/fdt/fdt_loader_cmd.c
  user/adrian/net80211_tx/sys/cddl/compat/opensolaris/sys/time.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ah.h
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5210/ar5210.h
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5210/ar5210_misc.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5211/ar5211.h
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5211/ar5211_misc.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5212/ar5212.h
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5416/ar5416.h
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  user/adrian/net80211_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
  user/adrian/net80211_tx/sys/dev/ath/if_ath.c
  user/adrian/net80211_tx/sys/dev/ath/if_ath_tx_ht.c
  user/adrian/net80211_tx/sys/dev/ath/if_athvar.h
  user/adrian/net80211_tx/sys/dev/ciss/ciss.c
  user/adrian/net80211_tx/sys/dev/fdt/fdt_common.h
  user/adrian/net80211_tx/sys/dev/isp/isp.c
  user/adrian/net80211_tx/sys/dev/mxge/if_mxge.c
  user/adrian/net80211_tx/sys/dev/sym/sym_hipd.c
  user/adrian/net80211_tx/sys/dev/usb/usb_pf.c
  user/adrian/net80211_tx/sys/dev/usb/usbdevs
  user/adrian/net80211_tx/sys/ia64/ia64/pmap.c
  user/adrian/net80211_tx/sys/ia64/include/vmparam.h
  user/adrian/net80211_tx/sys/kern/kern_descrip.c
  user/adrian/net80211_tx/tools/regression/bin/test/regress.sh
  user/adrian/net80211_tx/usr.bin/systat/systat.1
  user/adrian/net80211_tx/usr.sbin/bhyve/pci_emul.h
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/Makefile
  user/adrian/net80211_tx/usr.sbin/bsdconfig/include/messages.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/devices
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/include/Makefile
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/common.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/device.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/hostname.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/ipaddr.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/netmask.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/resolv.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/networking/share/routing.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/Makefile
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/common.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/script.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/strings.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/share/variable.subr
  user/adrian/net80211_tx/usr.sbin/bsdconfig/startup/rcvar
  user/adrian/net80211_tx/usr.sbin/rtadvd/rtadvd.8
  user/adrian/net80211_tx/usr.sbin/rtadvd/rtadvd.c
Directory Properties:
  user/adrian/net80211_tx/   (props changed)
  user/adrian/net80211_tx/cddl/contrib/opensolaris/   (props changed)
  user/adrian/net80211_tx/contrib/llvm/   (props changed)
  user/adrian/net80211_tx/lib/libc/   (props changed)
  user/adrian/net80211_tx/sbin/   (props changed)
  user/adrian/net80211_tx/sys/   (props changed)
  user/adrian/net80211_tx/sys/boot/   (props changed)
  user/adrian/net80211_tx/sys/cddl/contrib/opensolaris/   (props changed)
  user/adrian/net80211_tx/usr.sbin/bhyve/   (props changed)
  user/adrian/net80211_tx/usr.sbin/rtadvd/   (props changed)

Modified: user/adrian/net80211_tx/Makefile.inc1
==============================================================================
--- user/adrian/net80211_tx/Makefile.inc1	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/Makefile.inc1	Mon Feb 25 22:51:49 2013	(r247288)
@@ -1132,7 +1132,8 @@ _lex=		usr.bin/lex
 .endif
 
 .if ${BOOTSTRAPPING} < 1000013
-_yacc=		usr.bin/yacc
+_yacc=		lib/liby \
+		usr.bin/yacc
 .endif
 
 .if ${BOOTSTRAPPING} < 1000026

Modified: user/adrian/net80211_tx/bin/sh/eval.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/eval.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/sh/eval.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -301,7 +301,7 @@ evaltree(union node *n, int flags)
 	} while (n != NULL);
 out:
 	popstackmark(&smark);
-	if (pendingsigs)
+	if (pendingsig)
 		dotrap();
 	if (eflag && exitstatus != 0 && do_etest)
 		exitshell(exitstatus);

Modified: user/adrian/net80211_tx/bin/sh/jobs.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/jobs.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/sh/jobs.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -521,7 +521,7 @@ waitcmd(int argc, char **argv)
 	} while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1);
 	in_waitcmd--;
 
-	return 0;
+	return pendingsig + 128;
 }
 
 

Modified: user/adrian/net80211_tx/bin/sh/main.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/main.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/sh/main.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -196,7 +196,7 @@ cmdloop(int top)
 	TRACE(("cmdloop(%d) called\n", top));
 	setstackmark(&smark);
 	for (;;) {
-		if (pendingsigs)
+		if (pendingsig)
 			dotrap();
 		inter = 0;
 		if (iflag && top) {

Modified: user/adrian/net80211_tx/bin/sh/trap.c
==============================================================================
--- user/adrian/net80211_tx/bin/sh/trap.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/sh/trap.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
 
 
 MKINIT char sigmode[NSIG];	/* current value of signal */
-int pendingsigs;		/* indicates some signal received */
+volatile sig_atomic_t pendingsig;	/* indicates some signal received */
 int in_dotrap;			/* do we execute in a trap handler? */
 static char *volatile trap[NSIG];	/* trap handler commands */
 static volatile sig_atomic_t gotsig[NSIG];
@@ -388,22 +388,25 @@ onsig(int signo)
 		return;
 	}
 
-	if (signo != SIGCHLD || !ignore_sigchld)
-		gotsig[signo] = 1;
-	pendingsigs++;
-
 	/* If we are currently in a wait builtin, prepare to break it */
-	if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0)
-		breakwaitcmd = 1;
-	/*
-	 * If a trap is set, not ignored and not the null command, we need
-	 * to make sure traps are executed even when a child blocks signals.
-	 */
-	if (Tflag &&
-	    trap[signo] != NULL &&
-	    ! (trap[signo][0] == '\0') &&
-	    ! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
+	if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) {
 		breakwaitcmd = 1;
+		pendingsig = signo;
+	}
+
+	if (trap[signo] != NULL && trap[signo][0] != '\0' &&
+	    (signo != SIGCHLD || !ignore_sigchld)) {
+		gotsig[signo] = 1;
+		pendingsig = signo;
+
+		/*
+		 * If a trap is set, not ignored and not the null command, we
+		 * need to make sure traps are executed even when a child
+		 * blocks signals.
+		 */
+		if (Tflag && !(trap[signo][0] == ':' && trap[signo][1] == '\0'))
+			breakwaitcmd = 1;
+	}
 
 #ifndef NO_HISTORY
 	if (signo == SIGWINCH)
@@ -424,7 +427,7 @@ dotrap(void)
 
 	in_dotrap++;
 	for (;;) {
-		pendingsigs = 0;
+		pendingsig = 0;
 		for (i = 1; i < NSIG; i++) {
 			if (gotsig[i]) {
 				gotsig[i] = 0;

Modified: user/adrian/net80211_tx/bin/sh/trap.h
==============================================================================
--- user/adrian/net80211_tx/bin/sh/trap.h	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/sh/trap.h	Mon Feb 25 22:51:49 2013	(r247288)
@@ -33,7 +33,7 @@
  * $FreeBSD$
  */
 
-extern int pendingsigs;
+extern volatile sig_atomic_t pendingsig;
 extern int in_dotrap;
 extern volatile sig_atomic_t gotwinch;
 

Modified: user/adrian/net80211_tx/bin/test/test.1
==============================================================================
--- user/adrian/net80211_tx/bin/test/test.1	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/test/test.1	Mon Feb 25 22:51:49 2013	(r247288)
@@ -169,15 +169,65 @@ True if
 .Ar file
 exists and is a socket.
 .It Ar file1 Fl nt Ar file2
-True if
+True if both
+.Ar file1
+and
+.Ar file2
+exist and
+.Ar file1
+is newer than
+.Ar file2 .
+.It Ar file1 Fl nt Ns Ar X Ns Ar Y Ar file2
+True if both
+.Ar file1
+and
+.Ar file2
+exist and
 .Ar file1
-exists and is newer than
+has a more recent last access time
+.Pq Ar X Ns = Ns Cm a ,
+inode creation time
+.Pq Ar X Ns = Ns Cm b ,
+change time
+.Pq Ar X Ns = Ns Cm c ,
+or modification time
+.Pq Ar X Ns = Ns Cm m
+than the last access time
+.Pq Ar Y Ns = Ns Cm a ,
+inode creation time
+.Pq Ar Y Ns = Ns Cm b ,
+change time
+.Pq Ar Y Ns = Ns Cm c ,
+or modification time
+.Pq Ar Y Ns = Ns Cm m
+of
 .Ar file2 .
+Note that
+.Ic -ntmm
+is equivalent to
+.Ic -nt .
 .It Ar file1 Fl ot Ar file2
-True if
+True if both
+.Ar file1
+and
+.Ar file2
+exist and
 .Ar file1
-exists and is older than
+is older than
 .Ar file2 .
+Note that
+.Ar file1
+.Ic -ot
+.Ar file2
+is equivalent to
+.Ar file2
+.Ic -nt
+.Ar file1
+.It Ar file1 Fl ot Ns Ar X Ns Ar Y Ar file2
+Equivalent to
+.Ar file2
+.Ic -nt Ns Ar Y Ns Ar X
+.Ar file1 .
 .It Ar file1 Fl ef Ar file2
 True if
 .Ar file1

Modified: user/adrian/net80211_tx/bin/test/test.c
==============================================================================
--- user/adrian/net80211_tx/bin/test/test.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/bin/test/test.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -63,7 +63,7 @@ error(const char *msg, ...)
 		"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
 
 	binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
-			"-nt"|"-ot"|"-ef";
+			"-nt"|"-nt[abcm][abcm]"|"-ot"|"-ot[abcm][abcm])"|"-ef";
 	operand ::= <any legal UNIX file name>
 */
 
@@ -85,8 +85,38 @@ enum token {
 	FILSUID,
 	FILSGID,
 	FILSTCK,
-	FILNT,
-	FILOT,
+	FILNTAA,
+	FILNTAB,
+	FILNTAC,
+	FILNTAM,
+	FILNTBA,
+	FILNTBB,
+	FILNTBC,
+	FILNTBM,
+	FILNTCA,
+	FILNTCB,
+	FILNTCC,
+	FILNTCM,
+	FILNTMA,
+	FILNTMB,
+	FILNTMC,
+	FILNTMM,
+	FILOTAA,
+	FILOTAB,
+	FILOTAC,
+	FILOTAM,
+	FILOTBA,
+	FILOTBB,
+	FILOTBC,
+	FILOTBM,
+	FILOTCA,
+	FILOTCB,
+	FILOTCC,
+	FILOTCM,
+	FILOTMA,
+	FILOTMB,
+	FILOTMC,
+	FILOTMM,
 	FILEQ,
 	FILUID,
 	FILGID,
@@ -118,9 +148,16 @@ enum token_types {
 	PAREN
 };
 
+enum time_types {
+	ATIME,
+	BTIME,
+	CTIME,
+	MTIME
+};
+
 static struct t_op {
-	char op_text[4];
-	short op_num, op_type;
+	char op_text[6];
+	char op_num, op_type;
 } const ops [] = {
 	{"-r",	FILRD,	UNOP},
 	{"-w",	FILWR,	UNOP},
@@ -154,8 +191,40 @@ static struct t_op {
 	{"-gt",	INTGT,	BINOP},
 	{"-le",	INTLE,	BINOP},
 	{"-lt",	INTLT,	BINOP},
-	{"-nt",	FILNT,	BINOP},
-	{"-ot",	FILOT,	BINOP},
+	{"-nt",	FILNTMM,	BINOP},
+	{"-ntaa",	FILNTAA,	BINOP},
+	{"-ntab",	FILNTAB,	BINOP},
+	{"-ntac",	FILNTAC,	BINOP},
+	{"-ntam",	FILNTAM,	BINOP},
+	{"-ntba",	FILNTBA,	BINOP},
+	{"-ntbb",	FILNTBB,	BINOP},
+	{"-ntbc",	FILNTBC,	BINOP},
+	{"-ntbm",	FILNTBM,	BINOP},
+	{"-ntca",	FILNTCA,	BINOP},
+	{"-ntcb",	FILNTCB,	BINOP},
+	{"-ntcc",	FILNTCC,	BINOP},
+	{"-ntcm",	FILNTCM,	BINOP},
+	{"-ntma",	FILNTMA,	BINOP},
+	{"-ntmb",	FILNTMB,	BINOP},
+	{"-ntmc",	FILNTMC,	BINOP},
+	{"-ntmm",	FILNTMM,	BINOP},
+	{"-ot",	FILOTMM,	BINOP},
+	{"-otaa",	FILOTAA,	BINOP},
+	{"-otab",	FILOTBB,	BINOP},
+	{"-otac",	FILOTAC,	BINOP},
+	{"-otam",	FILOTAM,	BINOP},
+	{"-otba",	FILOTBA,	BINOP},
+	{"-otbb",	FILOTBB,	BINOP},
+	{"-otbc",	FILOTBC,	BINOP},
+	{"-otbm",	FILOTBM,	BINOP},
+	{"-otca",	FILOTCA,	BINOP},
+	{"-otcb",	FILOTCB,	BINOP},
+	{"-otcc",	FILOTCC,	BINOP},
+	{"-otcm",	FILOTCM,	BINOP},
+	{"-otma",	FILOTMA,	BINOP},
+	{"-otmb",	FILOTMB,	BINOP},
+	{"-otmc",	FILOTMC,	BINOP},
+	{"-otmm",	FILOTMM,	BINOP},
 	{"-ef",	FILEQ,	BINOP},
 	{"!",	UNOT,	BUNOP},
 	{"-a",	BAND,	BBINOP},
@@ -180,10 +249,10 @@ static int	intcmp(const char *, const ch
 static int	isunopoperand(void);
 static int	islparenoperand(void);
 static int	isrparenoperand(void);
-static int	newerf(const char *, const char *);
+static int	newerf(const char *, const char *, enum time_types,
+		       enum time_types);
 static int	nexpr(enum token);
 static int	oexpr(enum token);
-static int	olderf(const char *, const char *);
 static int	primary(enum token);
 static void	syntax(const char *, const char *);
 static enum	token t_lex(char *);
@@ -353,10 +422,70 @@ binop(void)
 		return intcmp(opnd1, opnd2) <= 0;
 	case INTLT:
 		return intcmp(opnd1, opnd2) < 0;
-	case FILNT:
-		return newerf (opnd1, opnd2);
-	case FILOT:
-		return olderf (opnd1, opnd2);
+	case FILNTAA:
+		return newerf(opnd1, opnd2, ATIME, ATIME);
+	case FILNTAB:
+		return newerf(opnd1, opnd2, ATIME, BTIME);
+	case FILNTAC:
+		return newerf(opnd1, opnd2, ATIME, CTIME);
+	case FILNTAM:
+		return newerf(opnd1, opnd2, ATIME, MTIME);
+	case FILNTBA:
+		return newerf(opnd1, opnd2, BTIME, ATIME);
+	case FILNTBB:
+		return newerf(opnd1, opnd2, BTIME, BTIME);
+	case FILNTBC:
+		return newerf(opnd1, opnd2, BTIME, CTIME);
+	case FILNTBM:
+		return newerf(opnd1, opnd2, BTIME, MTIME);
+	case FILNTCA:
+		return newerf(opnd1, opnd2, CTIME, ATIME);
+	case FILNTCB:
+		return newerf(opnd1, opnd2, CTIME, BTIME);
+	case FILNTCC:
+		return newerf(opnd1, opnd2, CTIME, CTIME);
+	case FILNTCM:
+		return newerf(opnd1, opnd2, CTIME, MTIME);
+	case FILNTMA:
+		return newerf(opnd1, opnd2, MTIME, ATIME);
+	case FILNTMB:
+		return newerf(opnd1, opnd2, MTIME, BTIME);
+	case FILNTMC:
+		return newerf(opnd1, opnd2, MTIME, CTIME);
+	case FILNTMM:
+		return newerf(opnd1, opnd2, MTIME, MTIME);
+	case FILOTAA:
+		return newerf(opnd2, opnd1, ATIME, ATIME);
+	case FILOTAB:
+		return newerf(opnd2, opnd1, BTIME, ATIME);
+	case FILOTAC:
+		return newerf(opnd2, opnd1, CTIME, ATIME);
+	case FILOTAM:
+		return newerf(opnd2, opnd1, MTIME, ATIME);
+	case FILOTBA:
+		return newerf(opnd2, opnd1, ATIME, BTIME);
+	case FILOTBB:
+		return newerf(opnd2, opnd1, BTIME, BTIME);
+	case FILOTBC:
+		return newerf(opnd2, opnd1, CTIME, BTIME);
+	case FILOTBM:
+		return newerf(opnd2, opnd1, MTIME, BTIME);
+	case FILOTCA:
+		return newerf(opnd2, opnd1, ATIME, CTIME);
+	case FILOTCB:
+		return newerf(opnd2, opnd1, BTIME, CTIME);
+	case FILOTCC:
+		return newerf(opnd2, opnd1, CTIME, CTIME);
+	case FILOTCM:
+		return newerf(opnd2, opnd1, MTIME, CTIME);
+	case FILOTMA:
+		return newerf(opnd2, opnd1, ATIME, MTIME);
+	case FILOTMB:
+		return newerf(opnd2, opnd1, BTIME, MTIME);
+	case FILOTMC:
+		return newerf(opnd2, opnd1, CTIME, MTIME);
+	case FILOTMM:
+		return newerf(opnd2, opnd1, MTIME, MTIME);
 	case FILEQ:
 		return equalf (opnd1, opnd2);
 	default:
@@ -570,25 +699,34 @@ intcmp (const char *s1, const char *s2)
 }
 
 static int
-newerf (const char *f1, const char *f2)
+newerf (const char *f1, const char *f2, enum time_types t1, enum time_types t2)
 {
 	struct stat b1, b2;
+	struct timespec *ts1, *ts2;
 
 	if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
 		return 0;
 
-	if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec)
+	switch (t1) {
+	case ATIME:	ts1 = &b1.st_atim;	break;
+	case BTIME:	ts1 = &b1.st_birthtim;	break;
+	case CTIME:	ts1 = &b1.st_ctim;	break;
+	default:	ts1 = &b1.st_mtim;	break;
+	}
+
+	switch (t2) {
+	case ATIME:	ts2 = &b2.st_atim;	break;
+	case BTIME:	ts2 = &b2.st_birthtim;	break;
+	case CTIME:	ts2 = &b2.st_ctim;	break;
+	default:	ts2 = &b2.st_mtim;	break;
+	}
+
+	if (ts1->tv_sec > ts2->tv_sec)
 		return 1;
-	if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec)
+	if (ts1->tv_sec < ts2->tv_sec)
 		return 0;
 
-       return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec);
-}
-
-static int
-olderf (const char *f1, const char *f2)
-{
-	return (newerf(f2, f1));
+       return (ts1->tv_nsec > ts2->tv_nsec);
 }
 
 static int

Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/translate.c
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/translate.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/translate.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 #include <libzfs.h>
@@ -455,6 +456,20 @@ translate_device(const char *pool, const
 		    &record->zi_guid) == 0);
 	}
 
+	/*
+	 * Device faults can take on three different forms:
+	 * 1). delayed or hanging I/O
+	 * 2). zfs label faults
+	 * 3). generic disk faults
+	 */
+	if (record->zi_timer != 0) {
+		record->zi_cmd = ZINJECT_DELAY_IO;
+	} else if (label_type != TYPE_INVAL) {
+		record->zi_cmd = ZINJECT_LABEL_FAULT;
+	} else {
+		record->zi_cmd = ZINJECT_DEVICE_FAULT;
+	}
+
 	switch (label_type) {
 	case TYPE_LABEL_UBERBLOCK:
 		record->zi_start = offsetof(vdev_label_t, vl_uberblock[0]);

Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/zinject.c
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/zinject.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/cmd/zinject/zinject.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 /*
@@ -603,7 +604,7 @@ main(int argc, char **argv)
 	}
 
 	while ((c = getopt(argc, argv,
-	    ":aA:b:d:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) {
+	    ":aA:b:d:D:f:Fg:qhIc:t:T:l:mr:s:e:uL:p:")) != -1) {
 		switch (c) {
 		case 'a':
 			flags |= ZINJECT_FLUSH_ARC;
@@ -629,6 +630,15 @@ main(int argc, char **argv)
 		case 'd':
 			device = optarg;
 			break;
+		case 'D':
+			record.zi_timer = strtoull(optarg, &end, 10);
+			if (errno != 0 || *end != '\0') {
+				(void) fprintf(stderr, "invalid i/o delay "
+				    "value: '%s'\n", optarg);
+				usage();
+				return (1);
+			}
+			break;
 		case 'e':
 			if (strcasecmp(optarg, "io") == 0) {
 				error = EIO;
@@ -693,6 +703,7 @@ main(int argc, char **argv)
 		case 'p':
 			(void) strlcpy(record.zi_func, optarg,
 			    sizeof (record.zi_func));
+			record.zi_cmd = ZINJECT_PANIC;
 			break;
 		case 'q':
 			quiet = 1;
@@ -766,13 +777,15 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
+	if (record.zi_duration != 0)
+		record.zi_cmd = ZINJECT_IGNORED_WRITES;
+
 	if (cancel != NULL) {
 		/*
 		 * '-c' is invalid with any other options.
 		 */
 		if (raw != NULL || range != NULL || type != TYPE_INVAL ||
-		    level != 0 || record.zi_func[0] != '\0' ||
-		    record.zi_duration != 0) {
+		    level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) {
 			(void) fprintf(stderr, "cancel (-c) incompatible with "
 			    "any other options\n");
 			usage();
@@ -804,8 +817,7 @@ main(int argc, char **argv)
 		 * for doing injection, so handle it separately here.
 		 */
 		if (raw != NULL || range != NULL || type != TYPE_INVAL ||
-		    level != 0 || record.zi_func[0] != '\0' ||
-		    record.zi_duration != 0) {
+		    level != 0 || record.zi_cmd != ZINJECT_UNINITIALIZED) {
 			(void) fprintf(stderr, "device (-d) incompatible with "
 			    "data error injection\n");
 			usage();
@@ -839,7 +851,7 @@ main(int argc, char **argv)
 
 	} else if (raw != NULL) {
 		if (range != NULL || type != TYPE_INVAL || level != 0 ||
-		    record.zi_func[0] != '\0' || record.zi_duration != 0) {
+		    record.zi_cmd != ZINJECT_UNINITIALIZED) {
 			(void) fprintf(stderr, "raw (-b) format with "
 			    "any other options\n");
 			usage();
@@ -862,13 +874,14 @@ main(int argc, char **argv)
 			return (1);
 		}
 
+		record.zi_cmd = ZINJECT_DATA_FAULT;
 		if (translate_raw(raw, &record) != 0)
 			return (1);
 		if (!error)
 			error = EIO;
-	} else if (record.zi_func[0] != '\0') {
+	} else if (record.zi_cmd == ZINJECT_PANIC) {
 		if (raw != NULL || range != NULL || type != TYPE_INVAL ||
-		    level != 0 || device != NULL || record.zi_duration != 0) {
+		    level != 0 || device != NULL) {
 			(void) fprintf(stderr, "panic (-p) incompatible with "
 			    "other options\n");
 			usage();
@@ -886,7 +899,7 @@ main(int argc, char **argv)
 		if (argv[1] != NULL)
 			record.zi_type = atoi(argv[1]);
 		dataset[0] = '\0';
-	} else if (record.zi_duration != 0) {
+	} else if (record.zi_cmd == ZINJECT_IGNORED_WRITES) {
 		if (nowrites == 0) {
 			(void) fprintf(stderr, "-s or -g meaningless "
 			    "without -I (ignore writes)\n");
@@ -940,6 +953,7 @@ main(int argc, char **argv)
 			return (1);
 		}
 
+		record.zi_cmd = ZINJECT_DATA_FAULT;
 		if (translate_record(type, argv[0], range, level, &record, pool,
 		    dataset) != 0)
 			return (1);

Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -45,6 +45,9 @@ int aok;
 uint64_t physmem;
 vnode_t *rootdir = (vnode_t *)0xabcd1234;
 char hw_serial[HW_HOSTID_LEN];
+#ifdef illumos
+kmutex_t cpu_lock;
+#endif
 
 struct utsname utsname = {
 	"userland", "libzpool", "1", "1", "na"
@@ -842,6 +845,28 @@ ddi_strtoull(const char *str, char **npt
 	return (0);
 }
 
+#ifdef illumos
+/* ARGSUSED */
+cyclic_id_t
+cyclic_add(cyc_handler_t *hdlr, cyc_time_t *when)
+{
+	return (1);
+}
+
+/* ARGSUSED */
+void
+cyclic_remove(cyclic_id_t id)
+{
+}
+
+/* ARGSUSED */
+int
+cyclic_reprogram(cyclic_id_t id, hrtime_t expiration)
+{
+	return (1);
+}
+#endif
+
 /*
  * =========================================================================
  * kernel emulation setup & teardown
@@ -875,6 +900,10 @@ kernel_init(int mode)
 
 	system_taskq_init();
 
+#ifdef illumos
+	mutex_init(&cpu_lock, NULL, MUTEX_DEFAULT, NULL);
+#endif
+
 	spa_init(mode);
 }
 

Modified: user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
==============================================================================
--- user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h	Mon Feb 25 22:51:49 2013	(r247288)
@@ -457,6 +457,9 @@ extern vnode_t *rootdir;
 
 extern void delay(clock_t ticks);
 
+#define	SEC_TO_TICK(sec)	((sec) * hz)
+#define	NSEC_TO_TICK(usec)	((usec) / (NANOSEC / hz))
+
 #define	gethrestime_sec() time(NULL)
 #define	gethrestime(t) \
 	do {\
@@ -624,6 +627,36 @@ typedef	uint32_t	idmap_rid_t;
 #define	ERESTART	(-1)
 #endif
 
+#ifdef illumos
+/*
+ * Cyclic information
+ */
+extern kmutex_t cpu_lock;
+
+typedef uintptr_t cyclic_id_t;
+typedef uint16_t cyc_level_t;
+typedef void (*cyc_func_t)(void *);
+
+#define	CY_LOW_LEVEL	0
+#define	CY_INFINITY	INT64_MAX
+#define	CYCLIC_NONE	((cyclic_id_t)0)
+
+typedef struct cyc_time {
+	hrtime_t cyt_when;
+	hrtime_t cyt_interval;
+} cyc_time_t;
+
+typedef struct cyc_handler {
+	cyc_func_t cyh_func;
+	void *cyh_arg;
+	cyc_level_t cyh_level;
+} cyc_handler_t;
+
+extern cyclic_id_t cyclic_add(cyc_handler_t *, cyc_time_t *);
+extern void cyclic_remove(cyclic_id_t);
+extern int cyclic_reprogram(cyclic_id_t, hrtime_t);
+#endif	/* illumos */
+
 #ifdef	__cplusplus
 }
 #endif

Modified: user/adrian/net80211_tx/contrib/llvm/lib/Target/X86/X86InstrCompiler.td
==============================================================================
--- user/adrian/net80211_tx/contrib/llvm/lib/Target/X86/X86InstrCompiler.td	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/contrib/llvm/lib/Target/X86/X86InstrCompiler.td	Mon Feb 25 22:51:49 2013	(r247288)
@@ -1076,12 +1076,14 @@ def : Pat<(X86cmp GR64:$src1, 0),
 // inverted.
 multiclass CMOVmr<PatLeaf InvertedCond, Instruction Inst16, Instruction Inst32,
                   Instruction Inst64> {
-  def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, InvertedCond, EFLAGS),
-            (Inst16 GR16:$src2, addr:$src1)>;
-  def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, InvertedCond, EFLAGS),
-            (Inst32 GR32:$src2, addr:$src1)>;
-  def : Pat<(X86cmov (loadi64 addr:$src1), GR64:$src2, InvertedCond, EFLAGS),
-            (Inst64 GR64:$src2, addr:$src1)>;
+  let Predicates = [HasCMov] in {
+    def : Pat<(X86cmov (loadi16 addr:$src1), GR16:$src2, InvertedCond, EFLAGS),
+              (Inst16 GR16:$src2, addr:$src1)>;
+    def : Pat<(X86cmov (loadi32 addr:$src1), GR32:$src2, InvertedCond, EFLAGS),
+              (Inst32 GR32:$src2, addr:$src1)>;
+    def : Pat<(X86cmov (loadi64 addr:$src1), GR64:$src2, InvertedCond, EFLAGS),
+              (Inst64 GR64:$src2, addr:$src1)>;
+  }
 }
 
 defm : CMOVmr<X86_COND_B , CMOVAE16rm, CMOVAE32rm, CMOVAE64rm>;

Modified: user/adrian/net80211_tx/etc/rc.d/rtadvd
==============================================================================
--- user/adrian/net80211_tx/etc/rc.d/rtadvd	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/etc/rc.d/rtadvd	Mon Feb 25 22:51:49 2013	(r247288)
@@ -46,6 +46,8 @@ rtadvd_precmd()
 			fi
 		done
 		;;
+	[Nn][Oo][Nn][Ee])
+		;;
 	*)
 		command_args="${rtadvd_interfaces}"
 		;;

Modified: user/adrian/net80211_tx/lib/libc/gen/opendir.c
==============================================================================
--- user/adrian/net80211_tx/lib/libc/gen/opendir.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/lib/libc/gen/opendir.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 #include "gen-private.h"
 #include "telldir.h"
 
-static DIR * __opendir_common(int, const char *, int);
+static DIR * __opendir_common(int, int);
 
 /*
  * Open a directory.
@@ -78,7 +78,7 @@ fdopendir(int fd)
 	}
 	if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
 		return (NULL);
-	return (__opendir_common(fd, NULL, DTF_HIDEW|DTF_NODUP));
+	return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP));
 }
 
 DIR *
@@ -92,7 +92,7 @@ __opendir2(const char *name, int flags)
 	    O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1)
 		return (NULL);
 
-	dir = __opendir_common(fd, name, flags);
+	dir = __opendir_common(fd, flags);
 	if (dir == NULL) {
 		saved_errno = errno;
 		_close(fd);
@@ -113,7 +113,7 @@ opendir_compar(const void *p1, const voi
  * Common routine for opendir(3), __opendir2(3) and fdopendir(3).
  */
 static DIR *
-__opendir_common(int fd, const char *name, int flags)
+__opendir_common(int fd, int flags)
 {
 	DIR *dirp;
 	int incr;
@@ -121,6 +121,8 @@ __opendir_common(int fd, const char *nam
 	int unionstack;
 	int fd2;
 
+	fd2 = -1;
+
 	if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
 		return (NULL);
 
@@ -165,7 +167,22 @@ __opendir_common(int fd, const char *nam
 		 * entries into a buffer, sort the buffer, and
 		 * remove duplicate entries by setting the inode
 		 * number to zero.
+		 *
+		 * We reopen the directory because _getdirentries()
+		 * on a MNT_UNION mount modifies the open directory,
+		 * making it refer to the lower directory after the
+		 * upper directory's entries are exhausted.
+		 * This would otherwise break software that uses
+		 * the directory descriptor for fchdir or *at
+		 * functions, such as fts.c.
 		 */
+		if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) {
+			saved_errno = errno;
+			free(buf);
+			free(dirp);
+			errno = saved_errno;
+			return (NULL);
+		}
 
 		do {
 			/*
@@ -181,7 +198,7 @@ __opendir_common(int fd, const char *nam
 				ddptr = buf + (len - space);
 			}
 
-			n = _getdirentries(fd, ddptr, space, &dirp->dd_seek);
+			n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek);
 			if (n > 0) {
 				ddptr += n;
 				space -= n;
@@ -191,25 +208,8 @@ __opendir_common(int fd, const char *nam
 		ddeptr = ddptr;
 		flags |= __DTF_READALL;
 
-		/*
-		 * Re-open the directory.
-		 * This has the effect of rewinding back to the
-		 * top of the union stack and is needed by
-		 * programs which plan to fchdir to a descriptor
-		 * which has also been read -- see fts.c.
-		 */
-		if (flags & DTF_REWIND) {
-			if ((fd2 = _open(name, O_RDONLY | O_DIRECTORY |
-			    O_CLOEXEC)) == -1) {
-				saved_errno = errno;
-				free(buf);
-				free(dirp);
-				errno = saved_errno;
-				return (NULL);
-			}
-			(void)_dup2(fd2, fd);
-			_close(fd2);
-		}
+		_close(fd2);
+		fd2 = -1;
 
 		/*
 		 * There is now a buffer full of (possibly) duplicate
@@ -293,7 +293,6 @@ __opendir_common(int fd, const char *nam
 		if (dirp->dd_buf == NULL)
 			goto fail;
 		dirp->dd_seek = 0;
-		flags &= ~DTF_REWIND;
 	}
 
 	dirp->dd_loc = 0;
@@ -310,6 +309,8 @@ __opendir_common(int fd, const char *nam
 
 fail:
 	saved_errno = errno;
+	if (fd2 != -1)
+		_close(fd2);
 	free(dirp);
 	errno = saved_errno;
 	return (NULL);

Modified: user/adrian/net80211_tx/lib/libelf/elf_update.c
==============================================================================
--- user/adrian/net80211_tx/lib/libelf/elf_update.c	Mon Feb 25 22:45:02 2013	(r247287)
+++ user/adrian/net80211_tx/lib/libelf/elf_update.c	Mon Feb 25 22:51:49 2013	(r247288)
@@ -41,89 +41,79 @@ __FBSDID("$FreeBSD$");
 #include "_libelf.h"
 
 /*
- * Update the internal data structures associated with an ELF object.
- * Returns the size in bytes the ELF object would occupy in its file
- * representation.
+ * Layout strategy:
  *
- * After a successful call to this function, the following structures
- * are updated:
+ * - Case 1: ELF_F_LAYOUT is asserted
+ *     In this case the application has full control over where the
+ *     section header table, program header table, and section data
+ *     will reside.   The library only perform error checks.
  *
- * - The ELF header is updated.
- * - All sections are sorted in order of ascending addresses and their
- *   section header table entries updated.   An error is signalled
- *   if an overlap was detected among sections.
- * - All data descriptors associated with a section are sorted in order
- *   of ascending addresses.  Overlaps, if detected, are signalled as
- *   errors.  Other sanity checks for alignments, section types etc. are
- *   made.
+ * - Case 2: ELF_F_LAYOUT is not asserted
  *
- * After a resync_elf() successfully returns, the ELF descriptor is
- * ready for being handed over to _libelf_write_elf().
+ *     The library will do the object layout using the following
+ *     ordering:
+ *     - The executable header is placed first, are required by the
+ *     	 ELF specification.
+ *     - The program header table is placed immediately following the
+ *       executable header.
+ *     - Section data, if any, is placed after the program header
+ *       table, aligned appropriately.
+ *     - The section header table, if needed, is placed last.
  *
- * File alignments:
- * PHDR - Addr
- * SHDR - Addr
+ *     There are two sub-cases to be taken care of:
  *
- * XXX: how do we handle 'flags'.
+ *     - Case 2a: e->e_cmd == ELF_C_READ or ELF_C_RDWR
+ *
+ *       In this sub-case, the underlying ELF object may already have
+ *       content in it, which the application may have modified.  The
+ *       library will retrieve content from the existing object as
+ *       needed.
+ *
+ *     - Case 2b: e->e_cmd == ELF_C_WRITE
+ *
+ *       The ELF object is being created afresh in this sub-case;
+ *       there is no pre-existing content in the underlying ELF
+ *       object.
  */
 
 /*
  * Compute the extents of a section, by looking at the data
- * descriptors associated with it.  The function returns zero if an
- * error was detected.  `*rc' holds the maximum file extent seen so
- * far.
+ * descriptors associated with it.  The function returns 1 if
+ * successful, or zero if an error was detected.
  */
 static int
-_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t *rc)
+_libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t rc)
 {
 	int ec;
-	Elf_Data *d, *td;
+	size_t fsz, msz;
+	Elf_Data *d;
+	Elf32_Shdr *shdr32;
+	Elf64_Shdr *shdr64;
 	unsigned int elftype;
 	uint32_t sh_type;
 	uint64_t d_align;
 	uint64_t sh_align, sh_entsize, sh_offset, sh_size;
 	uint64_t scn_size, scn_alignment;
 
-	/*
-	 * We need to recompute library private data structures if one
-	 * or more of the following is true:
-	 * - The underlying Shdr structure has been marked `dirty'.  Significant
-	 *   fields include: `sh_offset', `sh_type', `sh_size', `sh_addralign'.
-	 * - The Elf_Data structures part of this section have been marked
-	 *   `dirty'.  Affected members include `d_align', `d_offset', `d_type',
-	 *   and `d_size'.
-	 * - The section as a whole is `dirty', e.g., it has been allocated
-	 *   using elf_newscn(), or if a new Elf_Data structure was added using
-	 *   elf_newdata().
-	 *
-	 * Each of these conditions would result in the ELF_F_DIRTY bit being
-	 * set on the section descriptor's `s_flags' field.
-	 */
-
 	ec = e->e_class;
 
+	shdr32 = &s->s_shdr.s_shdr32;
+	shdr64 = &s->s_shdr.s_shdr64;
 	if (ec == ELFCLASS32) {
-		sh_type    = s->s_shdr.s_shdr32.sh_type;
-		sh_align   = (uint64_t) s->s_shdr.s_shdr32.sh_addralign;
-		sh_entsize = (uint64_t) s->s_shdr.s_shdr32.sh_entsize;
-		sh_offset  = (uint64_t) s->s_shdr.s_shdr32.sh_offset;
-		sh_size    = (uint64_t) s->s_shdr.s_shdr32.sh_size;
+		sh_type    = shdr32->sh_type;
+		sh_align   = (uint64_t) shdr32->sh_addralign;
+		sh_entsize = (uint64_t) shdr32->sh_entsize;
+		sh_offset  = (uint64_t) shdr32->sh_offset;
+		sh_size    = (uint64_t) shdr32->sh_size;
 	} else {
-		sh_type    = s->s_shdr.s_shdr64.sh_type;
-		sh_align   = s->s_shdr.s_shdr64.sh_addralign;
-		sh_entsize = s->s_shdr.s_shdr64.sh_entsize;
-		sh_offset  = s->s_shdr.s_shdr64.sh_offset;
-		sh_size    = s->s_shdr.s_shdr64.sh_size;
+		sh_type    = shdr64->sh_type;
+		sh_align   = shdr64->sh_addralign;
+		sh_entsize = shdr64->sh_entsize;
+		sh_offset  = shdr64->sh_offset;
+		sh_size    = shdr64->sh_size;
 	}
 
-	if (sh_type == SHT_NULL || sh_type == SHT_NOBITS)
-		return (1);
-
-	if ((s->s_flags & ELF_F_DIRTY) == 0) {
-		if ((size_t) *rc < sh_offset + sh_size)
-			*rc = sh_offset + sh_size;
-		return (1);
-	}
+	assert(sh_type != SHT_NULL && sh_type != SHT_NOBITS);
 
 	elftype = _libelf_xlate_shtype(sh_type);
 	if (elftype > ELF_T_LAST) {
@@ -131,15 +121,52 @@ _libelf_compute_section_extents(Elf *e, 
 		return (0);
 	}
 
-	/*
-	 * Compute the extent of the data descriptors associated with
-	 * this section.
-	 */
-	scn_alignment = 0;
 	if (sh_align == 0)
 		sh_align = _libelf_falign(elftype, ec);
 
-	/* Compute the section alignment. */
+	/*
+	 * Check the section's data buffers for sanity and compute the
+	 * section's alignment.
+	 * Compute the section's size and alignment using the data
+	 * descriptors associated with the section.
+	 */
+	if (STAILQ_EMPTY(&s->s_data)) {
+		/*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list