svn commit: r278110 - in projects/clang360-import: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid cddl/contrib/opensolaris/cmd/dtra...
Dimitry Andric
dim at FreeBSD.org
Mon Feb 2 20:18:58 UTC 2015
Author: dim
Date: Mon Feb 2 20:18:47 2015
New Revision: 278110
URL: https://svnweb.freebsd.org/changeset/base/278110
Log:
Merge ^/head r278005 through r278109.
Added:
projects/clang360-import/contrib/llvm/patches/patch-06-clang-add-mips-triples.diff
- copied, changed from r278109, head/contrib/llvm/patches/patch-29-clang-add-mips-triples.diff
Deleted:
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile
Modified:
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
projects/clang360-import/contrib/gcc/config/arm/unwind-arm.c
projects/clang360-import/contrib/gcc/config/arm/unwind-arm.h
projects/clang360-import/contrib/libcxxrt/exception.cc
projects/clang360-import/contrib/libcxxrt/typeinfo.cc
projects/clang360-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
projects/clang360-import/etc/rc.d/Makefile
projects/clang360-import/lib/libc/gen/ttyname.c
projects/clang360-import/lib/libc/rpc/crypt_client.c
projects/clang360-import/lib/libc/rpc/svc_vc.c
projects/clang360-import/release/doc/share/mk/doc.relnotes.mk
projects/clang360-import/sbin/Makefile
projects/clang360-import/sbin/ifconfig/af_inet6.c
projects/clang360-import/sbin/ifconfig/ifconfig.c
projects/clang360-import/sys/arm/arm/busdma_machdep-v6.c
projects/clang360-import/sys/arm/ti/am335x/am335x_prcm.c
projects/clang360-import/sys/boot/fdt/fdt_loader_cmd.c
projects/clang360-import/sys/boot/powerpc/kboot/host_syscall.S
projects/clang360-import/sys/boot/powerpc/kboot/host_syscall.h
projects/clang360-import/sys/boot/powerpc/kboot/hostdisk.c
projects/clang360-import/sys/cam/ctl/ctl.c
projects/clang360-import/sys/cam/ctl/ctl_frontend.c
projects/clang360-import/sys/cam/ctl/ctl_frontend.h
projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.c
projects/clang360-import/sys/cam/ctl/ctl_frontend_iscsi.h
projects/clang360-import/sys/cam/ctl/ctl_ioctl.h
projects/clang360-import/sys/cam/ctl/ctl_private.h
projects/clang360-import/sys/cam/ctl/ctl_tpc_local.c
projects/clang360-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
projects/clang360-import/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
projects/clang360-import/sys/conf/options
projects/clang360-import/sys/dev/ahci/ahci.h
projects/clang360-import/sys/dev/ahci/ahci_pci.c
projects/clang360-import/sys/dev/gpio/gpiobus.c
projects/clang360-import/sys/dev/gpio/gpiobusvar.h
projects/clang360-import/sys/dev/gpio/ofw_gpiobus.c
projects/clang360-import/sys/dev/iscsi/iscsi_proto.h
projects/clang360-import/sys/dev/usb/controller/xhci.c
projects/clang360-import/sys/dev/usb/usb_core.h
projects/clang360-import/sys/dev/usb/usb_msctest.c
projects/clang360-import/sys/dev/usb/usb_transfer.c
projects/clang360-import/sys/mips/atheros/if_argevar.h
projects/clang360-import/sys/netinet/ip_output.c
projects/clang360-import/sys/rpc/svc_vc.c
projects/clang360-import/tools/build/mk/OptionalObsoleteFiles.inc
projects/clang360-import/usr.sbin/ctladm/ctladm.8
projects/clang360-import/usr.sbin/ctladm/ctladm.c
projects/clang360-import/usr.sbin/ctld/ctl.conf.5
projects/clang360-import/usr.sbin/ctld/ctld.c
projects/clang360-import/usr.sbin/ctld/ctld.h
projects/clang360-import/usr.sbin/ctld/kernel.c
projects/clang360-import/usr.sbin/ctld/parse.y
Directory Properties:
projects/clang360-import/ (props changed)
projects/clang360-import/cddl/ (props changed)
projects/clang360-import/cddl/contrib/opensolaris/ (props changed)
projects/clang360-import/contrib/gcc/ (props changed)
projects/clang360-import/contrib/libcxxrt/ (props changed)
projects/clang360-import/contrib/llvm/ (props changed)
projects/clang360-import/etc/ (props changed)
projects/clang360-import/lib/libc/ (props changed)
projects/clang360-import/sbin/ (props changed)
projects/clang360-import/sys/ (props changed)
projects/clang360-import/sys/boot/ (props changed)
projects/clang360-import/sys/boot/powerpc/kboot/ (props changed)
projects/clang360-import/sys/cddl/contrib/opensolaris/ (props changed)
projects/clang360-import/sys/conf/ (props changed)
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -31,7 +31,6 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-CC=/usr/bin/gcc
CFLAGS=
doit()
@@ -47,7 +46,7 @@ void
main()
{}
EOF
- if $CC $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
+ if cc $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
$dtrace -xerrtags -C -s /dev/stdin \
>/dev/null 2>$errfile <<EOF
#include <sys/$file>
@@ -67,11 +66,6 @@ EOF
rm -f $cofile $cfile 2>/dev/null
}
-if [ ! -x $CC ]; then
- echo "$0: bad compiler: $CC" >& 2
- exit 1
-fi
-
concurrency=`psrinfo | wc -l`
let concurrency=concurrency*4
let i=0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d Mon Feb 2 20:18:47 2015 (r278110)
@@ -54,7 +54,7 @@ pid$1:a.out:go:
exit(1);
}
-syscall::rexit:entry
+syscall::exit:entry
/pid == $1/
{
exit(0);
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin <<EOF
proc:::signal-discard
/args[1]->p_pid == $child &&
- args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/
+ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
+ args[2] == SIGHUP/
{
exit(0);
}
@@ -48,7 +49,7 @@ killer()
{
while true; do
sleep 1
- /usr/bin/kill -HUP $child
+ kill -HUP $child
done
}
@@ -58,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
/usr/bin/nohup $longsleep &
child=$!
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -48,7 +48,7 @@ sleeper()
{
while true; do
$longsleep &
- /usr/bin/sleep 1
+ sleep 1
kill -9 $!
done
}
@@ -59,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
sleeper &
child=$!
@@ -67,9 +67,9 @@ child=$!
script
status=$?
-pstop $child
+kill -STOP $child
pkill -P $child
kill $child
-prun $child
+kill -CONT $child
exit $status
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin <<EOF
proc:::signal-send
/execname == "kill" && curpsinfo->pr_ppid == $child &&
- args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/
+ xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
+ args[2] == SIGUSR1/
{
/*
* This is guaranteed to not race with signal-handle.
@@ -58,7 +59,7 @@ sleeper()
while true; do
$longsleep &
sleep 1
- /usr/bin/kill -USR1 $!
+ kill -USR1 $!
done
}
@@ -68,7 +69,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/usr/bin/sleep 10000"
+longsleep="/bin/sleep 10000"
sleeper &
child=$!
@@ -76,9 +77,9 @@ child=$!
script
status=$?
-pstop $child
+kill -STOP $child
pkill -P $child
kill $child
-prun $child
+kill -CONT $child
exit $status
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -42,7 +42,7 @@ fi
dtrace=$1
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -43,7 +43,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@@ -77,7 +77,7 @@ fi
#Get the groupid of the calling process using ps
-groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -x -o pid,egid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -93,5 +93,5 @@ fi
#Cleanup leftovers
-/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -x -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@@ -75,12 +75,12 @@ fi
#Pass current pid (I mean parent pid for .d script).
-$dfilename $$ >/dev/null 2>&1
+$dfilename $$ #>/dev/null 2>&1
if [ $? -ne 0 ]; then
print -u2 "Error in executing $dfilename"
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-projectid=`ps -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+projectid=`ps -x -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-sessionid=`ps -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+sessionid=`ps -x -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get sid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-taskidval=`ps -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+taskidval=`ps -x -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
-userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
-#/bin/rm -f $dfilename
+rm -f $dfilename
exit 0
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -48,7 +48,7 @@ fi
dtrace="$1"
startdir="$PWD"
-dir=$(mktemp -td drtiXXXXXX)
+dir=$(mktemp -d -t drtiXXXXXX)
if (( $? != 0 )); then
print -u2 'Could not create safe temporary directory'
exit 2
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
Modified: projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
==============================================================================
--- projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh Mon Feb 2 20:18:47 2015 (r278110)
@@ -51,7 +51,7 @@ provider test_prov {
};
EOF
-gcc -c test.c
+cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
Modified: projects/clang360-import/contrib/gcc/config/arm/unwind-arm.c
==============================================================================
--- projects/clang360-import/contrib/gcc/config/arm/unwind-arm.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/contrib/gcc/config/arm/unwind-arm.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -25,6 +25,7 @@
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+#define __ARM_STATIC_INLINE
#include "unwind.h"
/* We add a prototype for abort here to avoid creating a dependency on
@@ -1089,4 +1090,11 @@ _Unwind_GetIPInfo (struct _Unwind_Contex
*ip_before_insn = 0;
return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1;
}
+
+void
+_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
+{
+ _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1));
+}
+
#endif
Modified: projects/clang360-import/contrib/gcc/config/arm/unwind-arm.h
==============================================================================
--- projects/clang360-import/contrib/gcc/config/arm/unwind-arm.h Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/contrib/gcc/config/arm/unwind-arm.h Mon Feb 2 20:18:47 2015 (r278110)
@@ -34,6 +34,10 @@
#define __ARM_EABI_UNWINDER__ 1
+#ifndef __ARM_STATIC_INLINE
+#define __ARM_STATIC_INLINE static inline
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -245,7 +249,7 @@ extern "C" {
return tmp;
}
- static inline _Unwind_Word
+ __ARM_STATIC_INLINE _Unwind_Word
_Unwind_GetGR (_Unwind_Context *context, int regno)
{
_uw val;
@@ -253,6 +257,12 @@ extern "C" {
return val;
}
+ __ARM_STATIC_INLINE void
+ _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
+ {
+ _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
+ }
+
#ifndef __FreeBSD__
/* Return the address of the instruction, not the actual IP value. */
#define _Unwind_GetIP(context) \
@@ -260,21 +270,16 @@ extern "C" {
#define _Unwind_GetIPInfo(context, ip_before_insn) \
(*ip_before_insn = 0, _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
-#else
- _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
- _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
-#endif
-
- static inline void
- _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
- {
- _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
- }
/* The dwarf unwinder doesn't understand arm/thumb state. We assume the
landing pad uses the same instruction set as the call site. */
#define _Unwind_SetIP(context, val) \
_Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
+#else
+ _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
+ _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+ void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
+#endif
#ifdef __cplusplus
} /* extern "C" */
Modified: projects/clang360-import/contrib/libcxxrt/exception.cc
==============================================================================
--- projects/clang360-import/contrib/libcxxrt/exception.cc Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/contrib/libcxxrt/exception.cc Mon Feb 2 20:18:47 2015 (r278110)
@@ -673,7 +673,7 @@ static _Unwind_Reason_Code trace(struct
* If the failure happened by falling off the end of the stack without finding
* a handler, prints a back trace before aborting.
*/
-#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
extern "C" void *__cxa_begin_catch(void *e) throw();
#else
extern "C" void *__cxa_begin_catch(void *e);
@@ -1191,7 +1191,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_persona
* pointer to the caught exception, which is either the adjusted pointer (for
* C++ exceptions) of the unadjusted pointer (for foreign exceptions).
*/
-#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
extern "C" void *__cxa_begin_catch(void *e) throw()
#else
extern "C" void *__cxa_begin_catch(void *e)
Modified: projects/clang360-import/contrib/libcxxrt/typeinfo.cc
==============================================================================
--- projects/clang360-import/contrib/libcxxrt/typeinfo.cc Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/contrib/libcxxrt/typeinfo.cc Mon Feb 2 20:18:47 2015 (r278110)
@@ -35,23 +35,15 @@ type_info::~type_info() {}
bool type_info::operator==(const type_info &other) const
{
-#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name == other.__type_name;
-#else
- return __type_name == other.__type_name || strcmp(__type_name, other.__type_name) == 0;
-#endif
}
bool type_info::operator!=(const type_info &other) const
{
- return !operator==(other);
+ return __type_name != other.__type_name;
}
bool type_info::before(const type_info &other) const
{
-#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name < other.__type_name;
-#else
- return strcmp(__type_name, other.__type_name) < 0;
-#endif
}
const char* type_info::name() const
{
Copied and modified: projects/clang360-import/contrib/llvm/patches/patch-06-clang-add-mips-triples.diff (from r278109, head/contrib/llvm/patches/patch-29-clang-add-mips-triples.diff)
==============================================================================
--- head/contrib/llvm/patches/patch-29-clang-add-mips-triples.diff Mon Feb 2 20:05:52 2015 (r278109, copy source)
+++ projects/clang360-import/contrib/llvm/patches/patch-06-clang-add-mips-triples.diff Mon Feb 2 20:18:47 2015 (r278110)
@@ -13,7 +13,7 @@ Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
-@@ -6592,6 +6592,17 @@ void freebsd::Link::ConstructJob(Compilation &C, c
+@@ -6651,6 +6651,17 @@ void freebsd::Link::ConstructJob(Compilation &C, c
CmdArgs.push_back("elf32ppc_fbsd");
}
Modified: projects/clang360-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
==============================================================================
--- projects/clang360-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -107,9 +107,6 @@ ATF_TC_BODY(ttyname_r_err, tc)
ATF_REQUIRE(rv == ERANGE);
}
-#ifdef __FreeBSD__
- atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936");
-#endif
rv = ttyname_r(-1, buf, ttymax);
ATF_REQUIRE(rv == EBADF);
Modified: projects/clang360-import/etc/rc.d/Makefile
==============================================================================
--- projects/clang360-import/etc/rc.d/Makefile Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/etc/rc.d/Makefile Mon Feb 2 20:18:47 2015 (r278110)
@@ -43,7 +43,6 @@ FILES= DAEMON \
growfs \
gssd \
${_hcsecd} \
- hostapd \
hostid \
hostid_save \
hostname \
@@ -137,7 +136,6 @@ FILES= DAEMON \
var \
virecover \
watchdogd \
- wpa_supplicant \
ypbind \
yppasswdd \
ypserv \
Modified: projects/clang360-import/lib/libc/gen/ttyname.c
==============================================================================
--- projects/clang360-import/lib/libc/gen/ttyname.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/lib/libc/gen/ttyname.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -65,7 +65,7 @@ ttyname_r(int fd, char *buf, size_t len)
/* Must be a terminal. */
if (!isatty(fd))
- return (ENOTTY);
+ return (errno);
/* Must have enough room */
if (len <= sizeof(_PATH_DEV))
return (ERANGE);
@@ -73,7 +73,7 @@ ttyname_r(int fd, char *buf, size_t len)
strcpy(buf, _PATH_DEV);
used = strlen(buf);
if (fdevname_r(fd, buf + used, len - used) == NULL)
- return (ENOTTY);
+ return (errno == EINVAL ? ERANGE : errno);
return (0);
}
Modified: projects/clang360-import/lib/libc/rpc/crypt_client.c
==============================================================================
--- projects/clang360-import/lib/libc/rpc/crypt_client.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/lib/libc/rpc/crypt_client.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -64,6 +64,7 @@ _des_crypt_call(buf, len, dparms)
}
if (nconf == NULL) {
warnx("getnetconfig: %s", nc_sperror());
+ endnetconfig(localhandle);
return(DESERR_HWERROR);
}
clnt = clnt_tp_create(NULL, CRYPT_PROG, CRYPT_VERS, nconf);
Modified: projects/clang360-import/lib/libc/rpc/svc_vc.c
==============================================================================
--- projects/clang360-import/lib/libc/rpc/svc_vc.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/lib/libc/rpc/svc_vc.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -128,7 +128,7 @@ svc_vc_create(fd, sendsize, recvsize)
u_int sendsize;
u_int recvsize;
{
- SVCXPRT *xprt;
+ SVCXPRT *xprt = NULL;
struct cf_rendezvous *r = NULL;
struct __rpc_sockinfo si;
struct sockaddr_storage sslocal;
Modified: projects/clang360-import/release/doc/share/mk/doc.relnotes.mk
==============================================================================
--- projects/clang360-import/release/doc/share/mk/doc.relnotes.mk Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/release/doc/share/mk/doc.relnotes.mk Mon Feb 2 20:18:47 2015 (r278110)
@@ -17,6 +17,7 @@ PROFILING+= --param profile.attribute "'
XSLTPROCFLAGS+= --param release.url "'${RELEASEURL}'"
XSLTPROCFLAGS+= --param release.branch "'${RELEASEBRANCH}'"
XSLTPROCFLAGS+= --param release.maillist "'${RELEASEMAILLIST}'"
+XSLTPROCFLAGS+= --param toc.section.depth "'3'"
# Find the RELNOTESng document catalogs
EXTRA_CATALOGS+= file://${RELN_ROOT}/${LANGCODE}/share/xml/catalog.xml \
Modified: projects/clang360-import/sbin/Makefile
==============================================================================
--- projects/clang360-import/sbin/Makefile Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/sbin/Makefile Mon Feb 2 20:18:47 2015 (r278110)
@@ -91,6 +91,11 @@ SUBDIR+= hastctl
SUBDIR+= hastd
.endif
+.if ${MK_INET6} != "no"
+SUBDIR+= ping6
+SUBDIR+= rtsol
+.endif
+
.if ${MK_IPFILTER} != "no"
SUBDIR+= ipf
.endif
@@ -114,15 +119,6 @@ SUBDIR+= pfctl
SUBDIR+= pflogd
.endif
-.if ${MK_INET6} != "no"
-SUBDIR+= ping6
-SUBDIR+= rtsol
-.endif
-
-.if ${MK_ISCSI} != "no"
-SUBDIR+= iscontrol
-.endif
-
.if ${MK_QUOTAS} != "no"
SUBDIR+= quotacheck
.endif
Modified: projects/clang360-import/sbin/ifconfig/af_inet6.c
==============================================================================
--- projects/clang360-import/sbin/ifconfig/af_inet6.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/sbin/ifconfig/af_inet6.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -58,8 +58,8 @@ static const char rcsid[] =
#include "ifconfig.h"
static struct in6_ifreq in6_ridreq;
-static struct in6_aliasreq in6_addreq =
- { .ifra_flags = 0,
+static struct in6_aliasreq in6_addreq =
+ { .ifra_flags = 0,
.ifra_lifetime = { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } };
static int ip6lifetime;
@@ -265,14 +265,16 @@ in6_status(int s __unused, const struct
printf("pltime ");
if (lifetime.ia6t_preferred) {
printf("%s ", lifetime.ia6t_preferred < now.tv_sec
- ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
+ ? "0" :
+ sec2str(lifetime.ia6t_preferred - now.tv_sec));
} else
printf("infty ");
printf("vltime ");
if (lifetime.ia6t_expire) {
printf("%s ", lifetime.ia6t_expire < now.tv_sec
- ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec));
+ ? "0" :
+ sec2str(lifetime.ia6t_expire - now.tv_sec));
} else
printf("infty ");
}
@@ -347,25 +349,25 @@ in6_getaddr(const char *s, int which)
static int
prefix(void *val, int size)
{
- u_char *name = (u_char *)val;
- int byte, bit, plen = 0;
+ u_char *name = (u_char *)val;
+ int byte, bit, plen = 0;
- for (byte = 0; byte < size; byte++, plen += 8)
- if (name[byte] != 0xff)
- break;
+ for (byte = 0; byte < size; byte++, plen += 8)
+ if (name[byte] != 0xff)
+ break;
if (byte == size)
return (plen);
for (bit = 7; bit != 0; bit--, plen++)
- if (!(name[byte] & (1 << bit)))
- break;
- for (; bit != 0; bit--)
- if (name[byte] & (1 << bit))
- return(0);
- byte++;
- for (; byte < size; byte++)
- if (name[byte])
- return(0);
- return (plen);
+ if (!(name[byte] & (1 << bit)))
+ break;
+ for (; bit != 0; bit--)
+ if (name[byte] & (1 << bit))
+ return(0);
+ byte++;
+ for (; byte < size; byte++)
+ if (name[byte])
+ return(0);
+ return (plen);
}
static char *
@@ -509,7 +511,11 @@ in6_Lopt_cb(const char *optarg __unused)
{
ip6lifetime++; /* print IPv6 address lifetime */
}
-static struct option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb };
+static struct option in6_Lopt = {
+ .opt = "L",
+ .opt_usage = "[-L]",
+ .cb = in6_Lopt_cb
+};
static __constructor void
inet6_ctor(void)
Modified: projects/clang360-import/sbin/ifconfig/ifconfig.c
==============================================================================
--- projects/clang360-import/sbin/ifconfig/ifconfig.c Mon Feb 2 20:05:52 2015 (r278109)
+++ projects/clang360-import/sbin/ifconfig/ifconfig.c Mon Feb 2 20:18:47 2015 (r278110)
@@ -47,6 +47,7 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/module.h>
#include <sys/linker.h>
+#include <sys/queue.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -110,6 +111,15 @@ static void af_other_status(int);
static struct option *opts = NULL;
+struct ifa_order_elt {
+ int if_order;
+ int af_orders[255];
+ struct ifaddrs *ifa;
+ TAILQ_ENTRY(ifa_order_elt) link;
+};
+
+TAILQ_HEAD(ifa_queue, ifa_order_elt);
+
void
opt_register(struct option *p)
{
@@ -141,16 +151,165 @@ usage(void)
exit(1);
}
+#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0])
+
+static int
+calcorders(struct ifaddrs *ifa, struct ifa_queue *q)
+{
+ struct ifaddrs *prev;
+ struct ifa_order_elt *cur;
+ unsigned int ord, af, ifa_ord;
+
+ prev = NULL;
+ cur = NULL;
+ ord = 0;
+ ifa_ord = 0;
+
+ while (ifa != NULL) {
+ if (prev == NULL ||
+ strcmp(ifa->ifa_name, prev->ifa_name) != 0) {
+ cur = calloc(1, sizeof(*cur));
+
+ if (cur == NULL)
+ return (-1);
+
+ TAILQ_INSERT_TAIL(q, cur, link);
+ cur->if_order = ifa_ord ++;
+ cur->ifa = ifa;
+ ord = 0;
+ }
+
+ if (ifa->ifa_addr) {
+ af = ifa->ifa_addr->sa_family;
+
+ if (af < ORDERS_SIZE(cur->af_orders) &&
+ cur->af_orders[af] == 0)
+ cur->af_orders[af] = ++ord;
+ }
+ prev = ifa;
+ ifa = ifa->ifa_next;
+ }
+
+ return (0);
+}
+
+static int
+cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q)
+{
+ struct ifa_order_elt *cur, *e1, *e2;
+ unsigned int af1, af2;
+ int ret;
+
+ e1 = e2 = NULL;
+
+ ret = strcmp(a->ifa_name, b->ifa_name);
+ if (ret != 0) {
+ TAILQ_FOREACH(cur, q, link) {
+ if (e1 && e2)
+ break;
+
+ if (strcmp(cur->ifa->ifa_name, a->ifa_name) == 0)
+ e1 = cur;
+ else if (strcmp(cur->ifa->ifa_name, b->ifa_name) == 0)
+ e2 = cur;
+ }
+
+ if (!e1 || !e2)
+ return (0);
+ else
+ return (e1->if_order - e2->if_order);
+
+ } else if (a->ifa_addr != NULL && b->ifa_addr != NULL) {
+ TAILQ_FOREACH(cur, q, link) {
+ if (strcmp(cur->ifa->ifa_name, a->ifa_name) == 0) {
+ e1 = cur;
+ break;
+ }
+ }
+
+ if (!e1)
+ return (0);
+
+ af1 = a->ifa_addr->sa_family;
+ af2 = b->ifa_addr->sa_family;
+
+ if (af1 < ORDERS_SIZE(e1->af_orders) &&
+ af2 < ORDERS_SIZE(e1->af_orders))
+ return (e1->af_orders[af1] - e1->af_orders[af2]);
+ }
+
+ return (0);
+}
+
+#undef ORDERS_SIZE
+
+static struct ifaddrs *
+sortifaddrs(struct ifaddrs *list,
+ int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *),
+ struct ifa_queue *q)
+{
+ struct ifaddrs *right, *temp, *last, *result, *next, *tail;
+
+ right = list;
+ temp = list;
+ last = list;
+ result = NULL;
+ next = NULL;
+ tail = NULL;
+
+ if (!list || !list->ifa_next)
+ return (list);
+
+ while (temp && temp->ifa_next) {
+ last = right;
+ right = right->ifa_next;
+ temp = temp->ifa_next->ifa_next;
+ }
+
+ last->ifa_next = NULL;
+
+ list = sortifaddrs(list, compare, q);
+ right = sortifaddrs(right, compare, q);
+
+ while (list || right) {
+
+ if (!right) {
+ next = list;
+ list = list->ifa_next;
+ } else if (!list) {
+ next = right;
+ right = right->ifa_next;
+ } else if (compare(list, right, q) <= 0) {
+ next = list;
+ list = list->ifa_next;
+ } else {
+ next = right;
+ right = right->ifa_next;
+ }
+
+ if (!result)
+ result = next;
+ else
+ tail->ifa_next = next;
+
+ tail = next;
+ }
+
+ return (result);
+}
+
int
main(int argc, char *argv[])
{
int c, all, namesonly, downonly, uponly;
const struct afswtch *afp = NULL;
int ifindex;
- struct ifaddrs *ifap, *ifa;
+ struct ifaddrs *ifap, *sifap, *ifa;
struct ifreq paifr;
const struct sockaddr_dl *sdl;
char options[1024], *cp, *namecp = NULL;
+ struct ifa_queue q = TAILQ_HEAD_INITIALIZER(q);
+ struct ifa_order_elt *cur, *tmp;
const char *ifname;
struct option *p;
size_t iflen;
@@ -285,9 +444,19 @@ main(int argc, char *argv[])
if (getifaddrs(&ifap) != 0)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list