svn commit: r287681 - in projects/clang370-import: etc/rc.d games/fortune/datfiles lib/libc/gen lib/libc/net lib/libc/posix1e lib/libc/tests/sys lib/libthr/thread release/amd64 release/i386 release...
Dimitry Andric
dim at FreeBSD.org
Fri Sep 11 17:20:12 UTC 2015
Author: dim
Date: Fri Sep 11 17:20:03 2015
New Revision: 287681
URL: https://svnweb.freebsd.org/changeset/base/287681
Log:
Merge ^/head r287527 through r287679.
Added:
projects/clang370-import/sys/cam/ctl/ctl_ha.c
- copied unchanged from r287679, head/sys/cam/ctl/ctl_ha.c
projects/clang370-import/sys/x86/include/stack.h
- copied unchanged from r287679, head/sys/x86/include/stack.h
projects/clang370-import/sys/x86/x86/stack_machdep.c
- copied unchanged from r287679, head/sys/x86/x86/stack_machdep.c
Replaced:
- copied from r287679, head/contrib/libc++/
Directory Properties:
projects/clang370-import/contrib/libc++/ (props changed)
Deleted:
projects/clang370-import/sys/amd64/amd64/stack_machdep.c
projects/clang370-import/sys/i386/i386/stack_machdep.c
Modified:
projects/clang370-import/etc/rc.d/bgfsck
projects/clang370-import/etc/rc.d/jail
projects/clang370-import/etc/rc.d/netif
projects/clang370-import/games/fortune/datfiles/freebsd-tips
projects/clang370-import/lib/libc/gen/sysctl.3
projects/clang370-import/lib/libc/net/getnameinfo.c
projects/clang370-import/lib/libc/net/if_nametoindex.c
projects/clang370-import/lib/libc/posix1e/acl_entry.c
projects/clang370-import/lib/libc/tests/sys/Makefile
projects/clang370-import/lib/libthr/thread/thr_once.c
projects/clang370-import/release/amd64/mkisoimages.sh
projects/clang370-import/release/i386/mkisoimages.sh
projects/clang370-import/release/pc98/mkisoimages.sh
projects/clang370-import/release/powerpc/mkisoimages.sh
projects/clang370-import/release/sparc64/mkisoimages.sh
projects/clang370-import/sbin/ifconfig/ifgif.c
projects/clang370-import/sbin/rtsol/Makefile
projects/clang370-import/share/dtrace/nfsattrstats
projects/clang370-import/share/dtrace/nfsclienttime
projects/clang370-import/share/man/man4/blackhole.4
projects/clang370-import/share/man/man4/gif.4
projects/clang370-import/share/man/man9/stack.9
projects/clang370-import/share/mk/local.meta.sys.mk
projects/clang370-import/sys/amd64/amd64/trap.c
projects/clang370-import/sys/amd64/include/stack.h
projects/clang370-import/sys/arm/arm/stack_machdep.c
projects/clang370-import/sys/arm/arm/trap-v6.c
projects/clang370-import/sys/arm/arm/trap.c
projects/clang370-import/sys/arm64/arm64/copyinout.S
projects/clang370-import/sys/arm64/arm64/locore.S
projects/clang370-import/sys/arm64/arm64/pmap.c
projects/clang370-import/sys/arm64/arm64/stack_machdep.c
projects/clang370-import/sys/arm64/arm64/swtch.S
projects/clang370-import/sys/arm64/arm64/trap.c
projects/clang370-import/sys/boot/efi/loader/arch/amd64/framebuffer.c
projects/clang370-import/sys/cam/ctl/README.ctl.txt
projects/clang370-import/sys/cam/ctl/ctl.c
projects/clang370-import/sys/cam/ctl/ctl.h
projects/clang370-import/sys/cam/ctl/ctl_backend.h
projects/clang370-import/sys/cam/ctl/ctl_backend_block.c
projects/clang370-import/sys/cam/ctl/ctl_backend_ramdisk.c
projects/clang370-import/sys/cam/ctl/ctl_cmd_table.c
projects/clang370-import/sys/cam/ctl/ctl_error.c
projects/clang370-import/sys/cam/ctl/ctl_error.h
projects/clang370-import/sys/cam/ctl/ctl_frontend.c
projects/clang370-import/sys/cam/ctl/ctl_frontend.h
projects/clang370-import/sys/cam/ctl/ctl_frontend_cam_sim.c
projects/clang370-import/sys/cam/ctl/ctl_frontend_ioctl.c
projects/clang370-import/sys/cam/ctl/ctl_frontend_iscsi.c
projects/clang370-import/sys/cam/ctl/ctl_ha.h
projects/clang370-import/sys/cam/ctl/ctl_io.h
projects/clang370-import/sys/cam/ctl/ctl_ioctl.h
projects/clang370-import/sys/cam/ctl/ctl_private.h
projects/clang370-import/sys/cam/ctl/ctl_scsi_all.c
projects/clang370-import/sys/cam/ctl/ctl_tpc.c
projects/clang370-import/sys/cam/ctl/ctl_tpc_local.c
projects/clang370-import/sys/cam/ctl/ctl_util.c
projects/clang370-import/sys/cam/ctl/ctl_util.h
projects/clang370-import/sys/cam/ctl/scsi_ctl.c
projects/clang370-import/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
projects/clang370-import/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
projects/clang370-import/sys/cddl/dev/dtrace/amd64/dtrace_isa.c
projects/clang370-import/sys/conf/files
projects/clang370-import/sys/conf/files.amd64
projects/clang370-import/sys/conf/files.i386
projects/clang370-import/sys/conf/files.pc98
projects/clang370-import/sys/conf/options
projects/clang370-import/sys/contrib/ipfilter/netinet/ip_state.c
projects/clang370-import/sys/dev/cxgbe/tom/t4_ddp.c
projects/clang370-import/sys/dev/drm2/radeon/radeon_device.c
projects/clang370-import/sys/dev/drm2/ttm/ttm_bo.c
projects/clang370-import/sys/dev/isci/isci.c
projects/clang370-import/sys/dev/isci/isci_interrupt.c
projects/clang370-import/sys/dev/netmap/netmap.c
projects/clang370-import/sys/dev/rccgpio/rccgpio.c
projects/clang370-import/sys/dev/uart/uart_cpu_fdt.c
projects/clang370-import/sys/dev/usb/serial/u3g.c
projects/clang370-import/sys/dev/usb/usbdevs
projects/clang370-import/sys/dev/usb/wlan/if_run.c
projects/clang370-import/sys/dev/usb/wlan/if_runvar.h
projects/clang370-import/sys/dev/usb/wlan/if_urtwnreg.h
projects/clang370-import/sys/i386/i386/trap.c
projects/clang370-import/sys/i386/include/stack.h
projects/clang370-import/sys/kern/imgact_elf.c
projects/clang370-import/sys/kern/kern_descrip.c
projects/clang370-import/sys/kern/kern_exec.c
projects/clang370-import/sys/kern/kern_proc.c
projects/clang370-import/sys/kern/subr_param.c
projects/clang370-import/sys/kern/uipc_usrreq.c
projects/clang370-import/sys/kern/vfs_bio.c
projects/clang370-import/sys/kern/vfs_vnops.c
projects/clang370-import/sys/mips/mips/stack_machdep.c
projects/clang370-import/sys/mips/mips/trap.c
projects/clang370-import/sys/modules/ctl/Makefile
projects/clang370-import/sys/modules/zfs/Makefile
projects/clang370-import/sys/net/if_gif.c
projects/clang370-import/sys/net/if_gif.h
projects/clang370-import/sys/netgraph/ng_pppoe.c
projects/clang370-import/sys/netgraph/ng_pppoe.h
projects/clang370-import/sys/netinet/sctp_constants.h
projects/clang370-import/sys/netinet/sctp_indata.c
projects/clang370-import/sys/netinet/sctp_input.c
projects/clang370-import/sys/netinet/sctp_output.c
projects/clang370-import/sys/netinet/sctp_sysctl.h
projects/clang370-import/sys/netinet6/in6.c
projects/clang370-import/sys/netinet6/in6_ifattach.c
projects/clang370-import/sys/netinet6/in6_var.h
projects/clang370-import/sys/netinet6/nd6.c
projects/clang370-import/sys/powerpc/include/spr.h
projects/clang370-import/sys/powerpc/powerpc/stack_machdep.c
projects/clang370-import/sys/powerpc/powerpc/trap.c
projects/clang370-import/sys/sparc64/sparc64/stack_machdep.c
projects/clang370-import/sys/sparc64/sparc64/trap.c
projects/clang370-import/sys/sys/conf.h
projects/clang370-import/sys/sys/exec.h
projects/clang370-import/sys/sys/filedesc.h
projects/clang370-import/sys/sys/random.h
projects/clang370-import/sys/sys/stack.h
projects/clang370-import/sys/sys/vmmeter.h
projects/clang370-import/sys/vm/swap_pager.c
projects/clang370-import/sys/vm/vm_map.c
projects/clang370-import/sys/vm/vm_meter.c
projects/clang370-import/sys/vm/vm_page.c
projects/clang370-import/sys/vm/vm_pageout.c
projects/clang370-import/sys/vm/vm_param.h
projects/clang370-import/sys/x86/include/apicvar.h
projects/clang370-import/sys/x86/x86/local_apic.c
projects/clang370-import/sys/x86/x86/mp_x86.c
projects/clang370-import/tests/sys/kern/ptrace_test.c
projects/clang370-import/usr.bin/login/login.c
projects/clang370-import/usr.bin/login/login_fbtab.c
projects/clang370-import/usr.bin/netstat/flowtable.c
projects/clang370-import/usr.bin/netstat/if.c
projects/clang370-import/usr.bin/netstat/inet.c
projects/clang370-import/usr.bin/netstat/inet6.c
projects/clang370-import/usr.bin/netstat/main.c
projects/clang370-import/usr.bin/netstat/mbuf.c
projects/clang370-import/usr.bin/netstat/mroute.c
projects/clang370-import/usr.bin/netstat/mroute6.c
projects/clang370-import/usr.bin/netstat/netstat.h
projects/clang370-import/usr.bin/netstat/sctp.c
projects/clang370-import/usr.bin/systat/iostat.c
projects/clang370-import/usr.bin/systat/netstat.c
projects/clang370-import/usr.bin/systat/pigs.c
projects/clang370-import/usr.bin/systat/vmstat.c
projects/clang370-import/usr.bin/vmstat/vmstat.c
projects/clang370-import/usr.bin/w/Makefile
projects/clang370-import/usr.bin/w/w.c
projects/clang370-import/usr.sbin/bluetooth/hccontrol/le.c
projects/clang370-import/usr.sbin/ctladm/ctladm.8
projects/clang370-import/usr.sbin/ctladm/ctladm.c
projects/clang370-import/usr.sbin/ctld/ctl.conf.5
projects/clang370-import/usr.sbin/ctld/ctld.c
projects/clang370-import/usr.sbin/ctld/ctld.h
projects/clang370-import/usr.sbin/ctld/parse.y
projects/clang370-import/usr.sbin/ctld/token.l
projects/clang370-import/usr.sbin/gstat/gstat.c
projects/clang370-import/usr.sbin/pkg/Makefile
projects/clang370-import/usr.sbin/pkg/config.c
projects/clang370-import/usr.sbin/pkg/config.h
projects/clang370-import/usr.sbin/pkg/pkg.c
projects/clang370-import/usr.sbin/rtsold/Makefile
projects/clang370-import/usr.sbin/rtsold/if.c
projects/clang370-import/usr.sbin/rtsold/rtsold.c
projects/clang370-import/usr.sbin/service/service.sh
projects/clang370-import/usr.sbin/wpa/hostapd/Makefile
projects/clang370-import/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
projects/clang370-import/ (props changed)
projects/clang370-import/etc/ (props changed)
projects/clang370-import/lib/libc/ (props changed)
projects/clang370-import/sbin/ (props changed)
projects/clang370-import/share/ (props changed)
projects/clang370-import/share/man/man4/ (props changed)
projects/clang370-import/sys/ (props changed)
projects/clang370-import/sys/boot/ (props changed)
projects/clang370-import/sys/cddl/contrib/opensolaris/ (props changed)
projects/clang370-import/sys/conf/ (props changed)
projects/clang370-import/sys/contrib/ipfilter/ (props changed)
projects/clang370-import/usr.sbin/rtsold/ (props changed)
Modified: projects/clang370-import/etc/rc.d/bgfsck
==============================================================================
--- projects/clang370-import/etc/rc.d/bgfsck Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/etc/rc.d/bgfsck Fri Sep 11 17:20:03 2015 (r287681)
@@ -12,17 +12,24 @@
name="background_fsck"
rcvar="background_fsck"
start_cmd="bgfsck_start"
+start_precmd="bgfsck_start_precmd"
stop_cmd=":"
+bgfsck_start_precmd()
+{
+ if [ $($ID -u) != 0 ]; then
+ err 1 "Must be root."
+ fi
+}
+
bgfsck_start()
{
- if [ -z "${rc_force}" ]; then
- background_fsck_delay=${background_fsck_delay:-0}
- else
+ : ${background_fsck_delay=0}
+ if [ -n "${rc_force}" ]; then
background_fsck_delay=0
fi
if [ ${background_fsck_delay} -lt 0 ]; then
- echo "Background file system checks delayed indefinitely"
+ warn "Background file system checks delayed indefinitely"
return 0
fi
Modified: projects/clang370-import/etc/rc.d/jail
==============================================================================
--- projects/clang370-import/etc/rc.d/jail Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/etc/rc.d/jail Fri Sep 11 17:20:03 2015 (r287681)
@@ -419,7 +419,7 @@ jail_status()
jail_start()
{
- local _j _jid _jl
+ local _j _jid _jl _id _name
if [ $# = 0 ]; then
return
@@ -432,10 +432,9 @@ jail_start()
command_args="-f $jail_conf -c"
_tmp=`mktemp -t jail` || exit 3
if $command $rc_flags $command_args >> $_tmp 2>&1; then
- $jail_jls jid name | while read IN; do
- set -- $IN
- echo -n " $2"
- echo $1 > /var/run/jail_$2.id
+ $jail_jls jid name | while read _id _name; do
+ echo -n " $_name"
+ echo $_id > /var/run/jail_${_name}.id
done
else
tail -1 $_tmp
Modified: projects/clang370-import/etc/rc.d/netif
==============================================================================
--- projects/clang370-import/etc/rc.d/netif Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/etc/rc.d/netif Fri Sep 11 17:20:03 2015 (r287681)
@@ -88,7 +88,7 @@ netif_start()
fi
if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
for _if in $cmdifn; do
- /etc/rc.d/routing start any $_if
+ /etc/rc.d/routing static any $_if
done
fi
}
Modified: projects/clang370-import/games/fortune/datfiles/freebsd-tips
==============================================================================
--- projects/clang370-import/games/fortune/datfiles/freebsd-tips Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/games/fortune/datfiles/freebsd-tips Fri Sep 11 17:20:03 2015 (r287681)
@@ -234,7 +234,7 @@ To erase a line you've written at the co
To find the hostname associated with an IP address, use
drill -x IP_address
- -- Allan Jude <allanjude at freebsd.org>
+ -- Allan Jude <allanjude at FreeBSD.org>
%
To obtain a neat PostScript rendering of a manual page, use ``-t'' switch
of the man(1) utility: ``man -t <topic>''. For example:
Modified: projects/clang370-import/lib/libc/gen/sysctl.3
==============================================================================
--- projects/clang370-import/lib/libc/gen/sysctl.3 Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libc/gen/sysctl.3 Fri Sep 11 17:20:03 2015 (r287681)
@@ -28,7 +28,7 @@
.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
.\" $FreeBSD$
.\"
-.Dd May 17, 2013
+.Dd September 10, 2015
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -736,8 +736,6 @@ privilege may change the value.
.It "VM_LOADAVG struct loadavg no"
.It "VM_TOTAL struct vmtotal no"
.It "VM_SWAPPING_ENABLED integer maybe"
-.It "VM_V_CACHE_MAX integer yes"
-.It "VM_V_CACHE_MIN integer yes"
.It "VM_V_FREE_MIN integer yes"
.It "VM_V_FREE_RESERVED integer yes"
.It "VM_V_FREE_TARGET integer yes"
@@ -757,12 +755,6 @@ The returned data consists of a
1 if process swapping is enabled or 0 if disabled.
This variable is
permanently set to 0 if the kernel was built with swapping disabled.
-.It Li VM_V_CACHE_MAX
-Maximum desired size of the cache queue.
-.It Li VM_V_CACHE_MIN
-Minimum desired size of the cache queue.
-If the cache queue size
-falls very far below this value, the pageout daemon is awakened.
.It Li VM_V_FREE_MIN
Minimum amount of memory (cache memory plus free memory)
required to be available before a process waiting on memory will be
Modified: projects/clang370-import/lib/libc/net/getnameinfo.c
==============================================================================
--- projects/clang370-import/lib/libc/net/getnameinfo.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libc/net/getnameinfo.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -78,6 +78,8 @@ getnameinfo(const struct sockaddr *sa, s
char *host, size_t hostlen, char *serv, size_t servlen,
int flags)
{
+ if (sa == NULL)
+ return (EAI_FAIL);
switch (sa->sa_family) {
case AF_INET:
@@ -124,25 +126,19 @@ getnameinfo_inet(const struct sockaddr *
struct servent *sp;
struct hostent *hp;
u_short port;
- int family, i;
const char *addr;
u_int32_t v4a;
int h_error;
char numserv[512];
char numaddr[512];
- if (sa == NULL)
- return EAI_FAIL;
-
- family = sa->sa_family;
- for (i = 0; afdl[i].a_af; i++)
- if (afdl[i].a_af == family) {
- afd = &afdl[i];
- goto found;
- }
- return EAI_FAMILY;
+ for (afd = &afdl[0]; afd->a_af > 0; afd++) {
+ if (afd->a_af == sa->sa_family)
+ break;
+ }
+ if (afd->a_af == 0)
+ return (EAI_FAMILY);
- found:
if (salen != afd->a_socklen)
return EAI_FAIL;
Modified: projects/clang370-import/lib/libc/net/if_nametoindex.c
==============================================================================
--- projects/clang370-import/lib/libc/net/if_nametoindex.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libc/net/if_nametoindex.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -70,9 +70,7 @@ if_nametoindex(const char *ifname)
s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (s != -1) {
-#ifdef PURIFY
memset(&ifr, 0, sizeof(ifr));
-#endif
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) {
_close(s);
Modified: projects/clang370-import/lib/libc/posix1e/acl_entry.c
==============================================================================
--- projects/clang370-import/lib/libc/posix1e/acl_entry.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libc/posix1e/acl_entry.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -91,7 +91,7 @@ acl_create_entry_np(acl_t *acl_p, acl_en
return (-1);
}
- if (offset < 0 || offset >= acl_int->acl_cnt) {
+ if (offset < 0 || offset > acl_int->acl_cnt) {
errno = EINVAL;
return (-1);
}
Modified: projects/clang370-import/lib/libc/tests/sys/Makefile
==============================================================================
--- projects/clang370-import/lib/libc/tests/sys/Makefile Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libc/tests/sys/Makefile Fri Sep 11 17:20:03 2015 (r287681)
@@ -25,10 +25,7 @@ NETBSD_ATF_TESTS_C+= kevent_test
NETBSD_ATF_TESTS_C+= kill_test
NETBSD_ATF_TESTS_C+= link_test
NETBSD_ATF_TESTS_C+= listen_test
-# On arm64 triggers panic ARM64TODO: pmap_mincore (PR202307).
-.if ${MACHINE_CPUARCH} != "aarch64"
NETBSD_ATF_TESTS_C+= mincore_test
-.endif
NETBSD_ATF_TESTS_C+= mkdir_test
NETBSD_ATF_TESTS_C+= mkfifo_test
NETBSD_ATF_TESTS_C+= mknod_test
Modified: projects/clang370-import/lib/libthr/thread/thr_once.c
==============================================================================
--- projects/clang370-import/lib/libthr/thread/thr_once.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/lib/libthr/thread/thr_once.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -50,9 +50,11 @@ __weak_reference(_pthread_once, pthread_
static void
once_cancel_handler(void *arg)
{
- pthread_once_t *once_control = arg;
+ pthread_once_t *once_control;
- if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_NEVER_DONE))
+ once_control = arg;
+ if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS,
+ ONCE_NEVER_DONE))
return;
atomic_store_rel_int(&once_control->state, ONCE_NEVER_DONE);
_thr_umtx_wake(&once_control->state, INT_MAX, 0);
@@ -68,16 +70,22 @@ _pthread_once(pthread_once_t *once_contr
for (;;) {
state = once_control->state;
- if (state == ONCE_DONE)
+ if (state == ONCE_DONE) {
+ atomic_thread_fence_acq();
return (0);
+ }
if (state == ONCE_NEVER_DONE) {
- if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_IN_PROGRESS))
+ if (atomic_cmpset_int(&once_control->state, state,
+ ONCE_IN_PROGRESS))
break;
} else if (state == ONCE_IN_PROGRESS) {
- if (atomic_cmpset_acq_int(&once_control->state, state, ONCE_WAIT))
- _thr_umtx_wait_uint(&once_control->state, ONCE_WAIT, NULL, 0);
+ if (atomic_cmpset_int(&once_control->state, state,
+ ONCE_WAIT))
+ _thr_umtx_wait_uint(&once_control->state,
+ ONCE_WAIT, NULL, 0);
} else if (state == ONCE_WAIT) {
- _thr_umtx_wait_uint(&once_control->state, state, NULL, 0);
+ _thr_umtx_wait_uint(&once_control->state, state,
+ NULL, 0);
} else
return (EINVAL);
}
@@ -86,7 +94,8 @@ _pthread_once(pthread_once_t *once_contr
THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control);
init_routine();
THR_CLEANUP_POP(curthread, 0);
- if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_DONE))
+ if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS,
+ ONCE_DONE))
return (0);
atomic_store_rel_int(&once_control->state, ONCE_DONE);
_thr_umtx_wake(&once_control->state, INT_MAX, 0);
@@ -94,6 +103,6 @@ _pthread_once(pthread_once_t *once_contr
}
void
-_thr_once_init()
+_thr_once_init(void)
{
}
Modified: projects/clang370-import/release/amd64/mkisoimages.sh
==============================================================================
--- projects/clang370-import/release/amd64/mkisoimages.sh Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/release/amd64/mkisoimages.sh Fri Sep 11 17:20:03 2015 (r287681)
@@ -34,7 +34,7 @@ if [ "x$1" = "x-b" ]; then
mkdir efi
mount -t msdosfs /dev/$device efi
mkdir -p efi/efi/boot
- cp ${4}/boot/loader.efi efi/efi/boot/bootx64.efi
+ cp "$4/boot/loader.efi" efi/efi/boot/bootx64.efi
umount efi
rmdir efi
mdconfig -d -u $device
@@ -46,15 +46,15 @@ else
fi
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
+ echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
exit 1
fi
-LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
-NAME=$1; shift
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
-echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
-rm $1/etc/fstab
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
+makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
+rm "$1/etc/fstab"
rm -f efiboot.img
Modified: projects/clang370-import/release/i386/mkisoimages.sh
==============================================================================
--- projects/clang370-import/release/i386/mkisoimages.sh Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/release/i386/mkisoimages.sh Fri Sep 11 17:20:03 2015 (r287681)
@@ -32,14 +32,14 @@ else
fi
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
+ echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
exit 1
fi
-LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
-NAME=$1; shift
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
-echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
-rm $1/etc/fstab
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
+makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
+rm "$1/etc/fstab"
Modified: projects/clang370-import/release/pc98/mkisoimages.sh
==============================================================================
--- projects/clang370-import/release/pc98/mkisoimages.sh Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/release/pc98/mkisoimages.sh Fri Sep 11 17:20:03 2015 (r287681)
@@ -32,14 +32,14 @@ else
fi
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
+ echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
exit 1
fi
-LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
-NAME=$1; shift
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
-echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
-rm $1/etc/fstab
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
+makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
+rm "$1/etc/fstab"
Modified: projects/clang370-import/release/powerpc/mkisoimages.sh
==============================================================================
--- projects/clang370-import/release/powerpc/mkisoimages.sh Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/release/powerpc/mkisoimages.sh Fri Sep 11 17:20:03 2015 (r287681)
@@ -25,18 +25,18 @@
if [ "x$1" = "x-b" ]; then
# Apple boot code
- uudecode -o /tmp/hfs-boot-block.bz2 `dirname $0`/hfs-boot.bz2.uu
+ uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
bzip2 -d /tmp/hfs-boot-block.bz2
OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ')
OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}')
- dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
+ dd if="$4/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot"
# pSeries/PAPR boot code
- mkdir -p $4/ppc/chrp
- cp $4/boot/loader $4/ppc/chrp
- cat > $4/ppc/bootinfo.txt << EOF
+ mkdir -p "$4/ppc/chrp"
+ cp "$4/boot/loader" "$4/ppc/chrp"
+ cat > "$4/ppc/bootinfo.txt" << EOF
<chrp-boot>
<description>FreeBSD Install</description>
<os-name>FreeBSD</os-name>
@@ -46,7 +46,7 @@ EOF
bootable="$bootable -o chrp-boot"
# Playstation 3 boot code
- echo "FreeBSD Install='/boot/loader.ps3'" > $4/etc/kboot.conf
+ echo "FreeBSD Install='/boot/loader.ps3'" > "$4/etc/kboot.conf"
shift
else
@@ -54,16 +54,16 @@ else
fi
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
+ echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]"
exit 1
fi
-LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
-NAME=$1; shift
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
-echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
-rm $1/etc/fstab
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
+makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
+rm "$1/etc/fstab"
rm /tmp/hfs-boot-block
-rm -rf $1/ppc
+rm -rf "$1/ppc"
Modified: projects/clang370-import/release/sparc64/mkisoimages.sh
==============================================================================
--- projects/clang370-import/release/sparc64/mkisoimages.sh Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/release/sparc64/mkisoimages.sh Fri Sep 11 17:20:03 2015 (r287681)
@@ -23,62 +23,62 @@
# extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image.
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > /dev/stderr
+ echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" > /dev/stderr
exit 1
fi
-case $1 in
--b) BOPT=$1; shift ;;
+case "$1" in
+-b) BOPT="$1"; shift ;;
esac
-LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
-NAME=$1; shift
-BASEBITSDIR=$1
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
+BASEBITSDIR="$1"
# Create an ISO image
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
-echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "${BASEBITSDIR}/etc/fstab"
-makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" ${NAME}.tmp $*
-rm "${BASEBITSDIR}/etc/fstab"
+echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab"
+makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME.tmp" "$@"
+rm "$BASEBITSDIR/etc/fstab"
if [ "x$BOPT" != "x-b" ]; then
- mv ${NAME}.tmp ${NAME}
+ mv "$NAME.tmp" "$NAME"
exit 0
fi
TMPIMGDIR=`mktemp -d /tmp/bootfs.XXXXXXXX` || exit 1
-BOOTFSDIR="${TMPIMGDIR}/bootfs"
-BOOTFSIMG="${TMPIMGDIR}/bootfs.img"
+BOOTFSDIR="$TMPIMGDIR/bootfs"
+BOOTFSIMG="$TMPIMGDIR/bootfs.img"
# Create a boot filesystem
-mkdir -p "${BOOTFSDIR}/boot"
-cp -p "${BASEBITSDIR}/boot/loader" "${BOOTFSDIR}/boot"
-makefs -t ffs -B be -M 512k "${BOOTFSIMG}" "${BOOTFSDIR}"
-dd if="${BASEBITSDIR}/boot/boot1" of="${BOOTFSIMG}" bs=512 conv=notrunc,sync
+mkdir -p "$BOOTFSDIR/boot"
+cp -p "$BASEBITSDIR/boot/loader" "$BOOTFSDIR/boot"
+makefs -t ffs -B be -M 512k "$BOOTFSIMG" "$BOOTFSDIR"
+dd if="$BASEBITSDIR/boot/boot1" of="$BOOTFSIMG" bs=512 conv=notrunc,sync
# Create a boot ISO image
: ${CYLSIZE:=640}
-ISOSIZE=$(stat -f %z ${NAME}.tmp)
-ISOBLKS=$(((${ISOSIZE} + 511) / 512))
-ISOCYLS=$(((${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE}))
-
-BOOTFSSIZE=$(stat -f %z "${BOOTFSIMG}")
-BOOTFSBLKS=$(((${BOOTFSSIZE} + 511) / 512))
-BOOTFSCYLS=$(((${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE}))
+ISOSIZE=$(stat -f %z "$NAME.tmp")
+ISOBLKS=$((($ISOSIZE + 511) / 512))
+ISOCYLS=$((($ISOBLKS + ($CYLSIZE - 1)) / $CYLSIZE))
+
+BOOTFSSIZE=$(stat -f %z "$BOOTFSIMG")
+BOOTFSBLKS=$((($BOOTFSSIZE + 511) / 512))
+BOOTFSCYLS=$((($BOOTFSBLKS + ($CYLSIZE - 1)) / $CYLSIZE))
-ENDCYL=$((${ISOCYLS} + ${BOOTFSCYLS}))
-NSECTS=$((${ENDCYL} * 1 * ${CYLSIZE}))
+ENDCYL=$(($ISOCYLS + $BOOTFSCYLS))
+NSECTS=$(($ENDCYL * 1 * $CYLSIZE))
-dd if=${NAME}.tmp of=${NAME} bs=${CYLSIZE}b conv=notrunc,sync
-dd if=${BOOTFSIMG} of=${NAME} bs=${CYLSIZE}b seek=${ISOCYLS} conv=notrunc,sync
+dd if="$NAME.tmp" of="$NAME" bs="${CYLSIZE}b" conv=notrunc,sync
+dd if="$BOOTFSIMG" of="$NAME" bs="${CYLSIZE}b" seek=$ISOCYLS conv=notrunc,sync
# The number of alternative cylinders is always 2.
-dd if=/dev/zero of=${NAME} bs=${CYLSIZE}b seek=${ENDCYL} count=2 conv=notrunc,sync
-rm -rf ${NAME}.tmp ${TMPIMGDIR}
+dd if=/dev/zero of="$NAME" bs="${CYLSIZE}b" seek=$ENDCYL count=2 conv=notrunc,sync
+rm -rf "$NAME.tmp" "$TMPIMGDIR"
# Write VTOC8 label to boot ISO image
-MD=`mdconfig -a -t vnode -S 512 -y 1 -x ${CYLSIZE} -f ${NAME}`
-gpart create -s VTOC8 ${MD}
+MD=`mdconfig -a -t vnode -S 512 -y 1 -x "$CYLSIZE" -f "$NAME"`
+gpart create -s VTOC8 $MD
# !4: usr, for ISO image part
-gpart add -i 1 -s $((${ISOCYLS} * ${CYLSIZE} * 512))b -t \!4 ${MD}
+gpart add -i 1 -s "$(($ISOCYLS * $CYLSIZE * 512))b" -t \!4 $MD
# !2: root, for bootfs part.
-gpart add -i 6 -s $((${BOOTFSCYLS} * ${CYLSIZE} * 512))b -t \!2 ${MD}
+gpart add -i 6 -s "$(($BOOTFSCYLS * $CYLSIZE * 512))b" -t \!2 $MD
mdconfig -d -u ${MD#md}
Modified: projects/clang370-import/sbin/ifconfig/ifgif.c
==============================================================================
--- projects/clang370-import/sbin/ifconfig/ifgif.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sbin/ifconfig/ifgif.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -51,7 +51,7 @@ static const char rcsid[] =
#include "ifconfig.h"
-#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER"
+#define GIFBITS "\020\2IGNORE_SOURCE"
static void gif_status(int);
@@ -70,8 +70,7 @@ gif_status(int s)
}
static void
-setgifopts(const char *val,
- int d, int s, const struct afswtch *afp)
+setgifopts(const char *val, int d, int s, const struct afswtch *afp)
{
int opts;
@@ -93,12 +92,8 @@ setgifopts(const char *val,
}
static struct cmd gif_cmds[] = {
- DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts),
- DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts),
DEF_CMD("ignore_source", GIF_IGNORE_SOURCE, setgifopts),
DEF_CMD("-ignore_source", -GIF_IGNORE_SOURCE, setgifopts),
- DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts),
- DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts),
};
static struct afswtch af_gif = {
@@ -110,11 +105,9 @@ static struct afswtch af_gif = {
static __constructor void
gif_ctor(void)
{
-#define N(a) (sizeof(a) / sizeof(a[0]))
size_t i;
- for (i = 0; i < N(gif_cmds); i++)
+ for (i = 0; i < nitems(gif_cmds); i++)
cmd_register(&gif_cmds[i]);
af_register(&af_gif);
-#undef N
}
Modified: projects/clang370-import/sbin/rtsol/Makefile
==============================================================================
--- projects/clang370-import/sbin/rtsol/Makefile Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sbin/rtsol/Makefile Fri Sep 11 17:20:03 2015 (r287681)
@@ -14,15 +14,13 @@
#
# $FreeBSD$
-SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold
-
-.PATH: ${SRCDIR}
+.PATH: ${.CURDIR}/../../usr.sbin/rtsold
PROG= rtsol
SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
MAN=
WARNS?= 3
-CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL
+CFLAGS+= -DHAVE_ARC4RANDOM -DSMALL
.include <bsd.prog.mk>
Modified: projects/clang370-import/share/dtrace/nfsattrstats
==============================================================================
--- projects/clang370-import/share/dtrace/nfsattrstats Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/dtrace/nfsattrstats Fri Sep 11 17:20:03 2015 (r287681)
@@ -56,7 +56,7 @@ syscall:::return
self->syscallname = "";
}
-nfsclient:::
+nfscl:::
/self->syscallname != 0 && self->syscallname != ""/
{
@@ -64,7 +64,7 @@ nfsclient:::
self->syscallname);
}
-nfsclient:::
+nfscl:::
/self->syscallname == 0 || self->syscallname == ""/
{
Modified: projects/clang370-import/share/dtrace/nfsclienttime
==============================================================================
--- projects/clang370-import/share/dtrace/nfsclienttime Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/dtrace/nfsclienttime Fri Sep 11 17:20:03 2015 (r287681)
@@ -53,13 +53,13 @@ syscall:::entry
self->count = 0;
}
-nfsclient:nfs3::start
+nfscl:nfs3::start
{
self->timestamp = timestamp;
}
-nfsclient:nfs3::done
+nfscl:nfs3::done
{
self->count += (timestamp - self->timestamp);
Modified: projects/clang370-import/share/man/man4/blackhole.4
==============================================================================
--- projects/clang370-import/share/man/man4/blackhole.4 Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/man/man4/blackhole.4 Fri Sep 11 17:20:03 2015 (r287681)
@@ -12,25 +12,35 @@
.\"
.\"
.\" $FreeBSD$
-.Dd January 1, 2007
+.Dd September 6, 2015
.Dt BLACKHOLE 4
.Os
.Sh NAME
.Nm blackhole
.Nd a
.Xr sysctl 8
-MIB for manipulating behaviour in respect of refused TCP or UDP connection
+MIB for manipulating behaviour in respect of refused SCTP, TCP, or UDP connection
attempts
.Sh SYNOPSIS
-.Cd sysctl net.inet.tcp.blackhole[=[0 | 1 | 2]]
-.Cd sysctl net.inet.udp.blackhole[=[0 | 1]]
+.Cd sysctl net.inet.sctp.blackhole Ns Op = Ns Brq "0 | 1 | 2"
+.Cd sysctl net.inet.tcp.blackhole Ns Op = Ns Brq "0 | 1 | 2"
+.Cd sysctl net.inet.udp.blackhole Ns Op = Ns Brq "0 | 1"
.Sh DESCRIPTION
The
.Nm
.Xr sysctl 8
MIB is used to control system behaviour when connection requests
-are received on TCP or UDP ports where there is no socket listening.
+are received on SCTP, TCP, or UDP ports where there is no socket listening.
.Pp
+The blackhole behaviour is useful to slow down an attacker who is port-scanning
+a system in an attempt to detect vulnerable services.
+It might also slow down an attempted denial of service attack.
+.Ss SCTP
+Setting the SCTP blackhole MIB to a numeric value of one
+will prevent sending an ABORT packet in response to an incoming INIT.
+A MIB value of two will do the same, but will also prevent sending an ABORT packet
+when unexpected packets are received.
+.Ss TCP
Normal behaviour, when a TCP SYN segment is received on a port where
there is no socket accepting connections, is for the system to return
a RST segment, and drop the connection.
@@ -44,20 +54,15 @@ as a blackhole.
By setting the MIB value to two, any segment arriving
on a closed port is dropped without returning a RST.
This provides some degree of protection against stealth port scans.
-.Pp
-In the UDP instance, enabling blackhole behaviour turns off the sending
+.Ss UDP
+Enabling blackhole behaviour turns off the sending
of an ICMP port unreachable message in response to a UDP datagram which
arrives on a port where there is no socket listening.
It must be noted that this behaviour will prevent remote systems from running
.Xr traceroute 8
to a system.
-.Pp
-The blackhole behaviour is useful to slow down anyone who is port scanning
-a system, attempting to detect vulnerable services on a system.
-It could potentially also slow down someone who is attempting a denial
-of service attack.
.Sh WARNING
-The TCP and UDP blackhole features should not be regarded as a replacement
+The SCTP, TCP, and UDP blackhole features should not be regarded as a replacement
for firewall solutions.
Better security would consist of the
.Nm
@@ -68,6 +73,7 @@ This mechanism is not a substitute for s
It should be used together with other security mechanisms.
.Sh SEE ALSO
.Xr ip 4 ,
+.Xr sctp 4 ,
.Xr tcp 4 ,
.Xr udp 4 ,
.Xr ipf 8 ,
@@ -80,5 +86,10 @@ The TCP and UDP
MIBs
first appeared in
.Fx 4.0 .
+.Pp
+The SCTP
+.Nm
+MIB first appeared in
+.Fx 9.1 .
.Sh AUTHORS
.An Geoffrey M. Rehmet
Modified: projects/clang370-import/share/man/man4/gif.4
==============================================================================
--- projects/clang370-import/share/man/man4/gif.4 Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/man/man4/gif.4 Fri Sep 11 17:20:03 2015 (r287681)
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 14, 2014
+.Dd September 10, 2015
.Dt GIF 4
.Os
.Sh NAME
@@ -246,32 +246,3 @@ had a multi-destination behavior, config
.Dv IFF_LINK0
flag.
The behavior is obsolete and is no longer supported.
-.Pp
-On
-.Fx
-6.1, 6.2, 6.3, 7.0, 7.1, and 7.2
-the
-.Nm
-sends and receives incorrect EtherIP packets with reversed version
-field when
-.Xr if_bridge 4
-is used together. As a workaround on this interoperability issue, the
-following two
-.Xr ifconfig 8
-flags can be used:
-.Bl -tag -width "accept_rev_ethip_ver" -offset indent
-.It accept_rev_ethip_ver
-accepts both correct EtherIP packets and ones with reversed version
-field, if enabled. If disabled, the
-.Nm
-accepts the correct packets only. This flag is enabled by default.
-.It send_rev_ethip_ver
-sends EtherIP packets with reversed version field intentionally, if
-enabled. If disabled, the
-.Nm
-sends the correct packets only. This flag is disabled by default.
-.El
-.Pp
-If interoperability with the older
-.Fx
-machines is needed, both of these two flags must be enabled.
Modified: projects/clang370-import/share/man/man9/stack.9
==============================================================================
--- projects/clang370-import/share/man/man9/stack.9 Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/man/man9/stack.9 Fri Sep 11 17:20:03 2015 (r287681)
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 16, 2011
+.Dd September 10, 2015
.Dt STACK 9
.Os
.Sh NAME
@@ -36,9 +36,11 @@
.Sh SYNOPSIS
.In sys/param.h
.In sys/stack.h
+.Pp
In the kernel configuration file:
.Cd "options DDB"
.Cd "options STACK"
+.Pp
.Ft struct stack *
.Fn stack_create "void"
.Ft void
@@ -63,6 +65,10 @@ In the kernel configuration file:
.Fn stack_sbuf_print_ddb "struct sbuf sb*" "const struct stack *st"
.Ft void
.Fn stack_save "struct stack *st"
+.Ft void
+.Fn stack_save_td "struct stack *st" "struct thread *td"
+.Ft int
+.Fn stack_save_td_running "struct stack *st" "struct thread *td"
.Sh DESCRIPTION
The
.Nm
@@ -86,6 +92,16 @@ Memory associated with a trace is freed
.Pp
A trace of the current kernel thread's call stack may be captured using
.Fn stack_save .
+.Fn stack_save_td
+and
+.Fn stack_save_td_running
+can also be used to capture the stack of a caller-specified thread.
+Callers of these functions must own the thread lock of the specified thread.
+.Fn stack_save_td
+can capture the stack of a kernel thread that is not running or
+swapped out at the time of the call.
+.Fn stack_save_td_running
+can capture the stack of a running kernel thread.
.Pp
.Fn stack_print
and
@@ -130,6 +146,23 @@ The utility functions
and
.Nm stack_put
may be used to manipulate stack data structures directly.
+.Sh RETURN VALUES
+.Fn stack_put
+returns 0 on success.
+Otherwise the
+.Dv struct stack
+does not contain space to record additional frames, and a non-zero value is
+returned.
+.Pp
+.Fn stack_save_td_running
+returns 0 when the stack capture was successful and a non-zero error number
+otherwise.
+In particular,
+.Er EAGAIN
+is returned if the thread was running in user mode at the time that the
+capture was attempted, and
+.Er EOPNOTSUPP
+is returned if the operation is not implemented.
.Sh SEE ALSO
.Xr ddb 4 ,
.Xr printf 9 ,
Modified: projects/clang370-import/share/mk/local.meta.sys.mk
==============================================================================
--- projects/clang370-import/share/mk/local.meta.sys.mk Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/share/mk/local.meta.sys.mk Fri Sep 11 17:20:03 2015 (r287681)
@@ -13,11 +13,14 @@ MK_INSTALL_AS_USER= yes
.warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR...
# put things approximately where they want
OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/
+MAKEOBJDIRPREFIX=
+.export MAKEOBJDIRPREFIX
+.endif
+.if empty(MAKEOBJDIR) || ${MAKEOBJDIR:M*/*} == ""
# OBJTOP set below
MAKEOBJDIR=$${.CURDIR:S,$${SRCTOP},$${OBJTOP},}
-MAKEOBJDIRPREFIX=
# export but do not track
-.export-env MAKEOBJDIRPREFIX MAKEOBJDIR
+.export-env MAKEOBJDIR
# now for our own use
MAKEOBJDIR= ${.CURDIR:S,${SRCTOP},${OBJTOP},}
.endif
Modified: projects/clang370-import/sys/amd64/amd64/trap.c
==============================================================================
--- projects/clang370-import/sys/amd64/amd64/trap.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sys/amd64/amd64/trap.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include "opt_hwpmc_hooks.h"
#include "opt_isa.h"
#include "opt_kdb.h"
+#include "opt_stack.h"
#include <sys/param.h>
#include <sys/bus.h>
@@ -91,6 +92,7 @@ PMC_SOFT_DEFINE( , , page_fault, write);
#ifdef SMP
#include <machine/smp.h>
#endif
+#include <machine/stack.h>
#include <machine/tss.h>
#ifdef KDTRACE_HOOKS
@@ -202,17 +204,24 @@ trap(struct trapframe *frame)
goto out;
}
-#ifdef HWPMC_HOOKS
- /*
- * CPU PMCs interrupt using an NMI. If the PMC module is
- * active, pass the 'rip' value to the PMC module's interrupt
- * handler. A return value of '1' from the handler means that
- * the NMI was handled by it and we can return immediately.
- */
- if (type == T_NMI && pmc_intr &&
- (*pmc_intr)(PCPU_GET(cpuid), frame))
- goto out;
+ if (type == T_NMI) {
+#ifdef HWPMC_HOOKS
+ /*
+ * CPU PMCs interrupt using an NMI. If the PMC module is
+ * active, pass the 'rip' value to the PMC module's interrupt
+ * handler. A non-zero return value from the handler means that
+ * the NMI was consumed by it and we can return immediately.
+ */
+ if (pmc_intr != NULL &&
+ (*pmc_intr)(PCPU_GET(cpuid), frame) != 0)
+ goto out;
+#endif
+
+#ifdef STACK
+ if (stack_nmi_handler(frame) != 0)
+ goto out;
#endif
+ }
if (type == T_MCHK) {
mca_intr();
@@ -625,7 +634,6 @@ trap_pfault(frame, usermode)
int usermode;
{
vm_offset_t va;
- struct vmspace *vm;
vm_map_t map;
int rv = 0;
vm_prot_t ftype;
@@ -687,14 +695,7 @@ trap_pfault(frame, usermode)
map = kernel_map;
} else {
- /*
- * This is a fault on non-kernel virtual memory. If either
- * p or p->p_vmspace is NULL, then the fault is fatal.
- */
- if (p == NULL || (vm = p->p_vmspace) == NULL)
- goto nogo;
-
- map = &vm->vm_map;
+ map = &p->p_vmspace->vm_map;
/*
* When accessing a usermode address, kernel must be
@@ -729,28 +730,8 @@ trap_pfault(frame, usermode)
else
ftype = VM_PROT_READ;
- if (map != kernel_map) {
- /*
- * Keep swapout from messing with us during this
- * critical time.
- */
- PROC_LOCK(p);
- ++p->p_lock;
- PROC_UNLOCK(p);
-
- /* Fault in the user page: */
- rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
-
- PROC_LOCK(p);
- --p->p_lock;
- PROC_UNLOCK(p);
- } else {
- /*
- * Don't have to worry about process locking or stacks in the
- * kernel.
- */
- rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
- }
+ /* Fault in the page. */
+ rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
if (rv == KERN_SUCCESS) {
#ifdef HWPMC_HOOKS
if (ftype == VM_PROT_READ || ftype == VM_PROT_WRITE) {
Modified: projects/clang370-import/sys/amd64/include/stack.h
==============================================================================
--- projects/clang370-import/sys/amd64/include/stack.h Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sys/amd64/include/stack.h Fri Sep 11 17:20:03 2015 (r287681)
@@ -1,42 +1,6 @@
-/*-
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution at CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_STACK_H_
-#define _MACHINE_STACK_H_
-
/*
- * Stack trace.
+ * This file is in the public domain.
*/
+/* $FreeBSD$ */
-struct amd64_frame {
- struct amd64_frame *f_frame;
- long f_retaddr;
- long f_arg0;
-};
-
-#endif /* !_MACHINE_STACK_H_ */
+#include <x86/stack.h>
Modified: projects/clang370-import/sys/arm/arm/stack_machdep.c
==============================================================================
--- projects/clang370-import/sys/arm/arm/stack_machdep.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sys/arm/arm/stack_machdep.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -71,6 +71,13 @@ stack_save_td(struct stack *st, struct t
stack_capture(st, frame);
}
+int
+stack_save_td_running(struct stack *st, struct thread *td)
+{
+
+ return (EOPNOTSUPP);
+}
+
void
stack_save(struct stack *st)
{
Modified: projects/clang370-import/sys/arm/arm/trap-v6.c
==============================================================================
--- projects/clang370-import/sys/arm/arm/trap-v6.c Fri Sep 11 17:19:24 2015 (r287680)
+++ projects/clang370-import/sys/arm/arm/trap-v6.c Fri Sep 11 17:20:03 2015 (r287681)
@@ -500,28 +500,9 @@ abort_handler(struct trapframe *tf, int
onfault = pcb->pcb_onfault;
pcb->pcb_onfault = NULL;
#endif
- if (map != kernel_map) {
- /*
- * Keep swapout from messing with us during this
- * critical time.
- */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list