summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-03-13 10:27:25 -0300
committerRenato Botelho <renato@netgate.com>2017-03-13 10:27:25 -0300
commitf391165890a47339ab36ad68ac2e8a7ac318a2f4 (patch)
treebb32a2782e69e28e5b16c4baa2891da7f2193c37
parent01a697b38d55406857d04f6b92d9aaf15e492384 (diff)
parentf5b4bf3db9bb31ce466c39af8ee4b81aa991c7a6 (diff)
downloadFreeBSD-src-f391165890a47339ab36ad68ac2e8a7ac318a2f4.zip
FreeBSD-src-f391165890a47339ab36ad68ac2e8a7ac318a2f4.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
-rw-r--r--Makefile.inc139
-rw-r--r--bin/sh/expand.c7
-rw-r--r--bin/sh/tests/expansion/Makefile5
-rw-r--r--bin/sh/tests/expansion/cmdsubst18.06
-rw-r--r--bin/sh/tests/expansion/cmdsubst19.05
-rw-r--r--bin/sh/tests/expansion/cmdsubst20.06
-rw-r--r--bin/sh/tests/expansion/cmdsubst21.06
-rw-r--r--bin/sh/tests/expansion/cmdsubst22.06
-rw-r--r--cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c1
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c8
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c4
-rw-r--r--cddl/usr.sbin/zfsd/case_file.cc7
-rw-r--r--contrib/atf/atf-c++/atf-c++-api.3632
-rw-r--r--contrib/atf/atf-c++/atf-c++.312
-rw-r--r--contrib/atf/atf-c/atf-c-api.3772
-rw-r--r--contrib/atf/atf-c/atf-c.310
-rw-r--r--contrib/atf/atf-sh/atf-check.118
-rw-r--r--contrib/atf/atf-sh/atf-sh-api.3340
-rw-r--r--contrib/atf/atf-sh/atf-sh.111
-rw-r--r--contrib/atf/atf-sh/atf-sh.38
-rw-r--r--contrib/atf/doc/atf-test-case.46
-rw-r--r--contrib/binutils/gas/config/tc-mips.c1
-rw-r--r--contrib/blacklist/bin/blacklistd.c22
-rw-r--r--contrib/blacklist/libexec/blacklistd-helper7
-rw-r--r--contrib/gcc/config/mips/mips.c1
-rw-r--r--contrib/gcc/config/mips/mips.h5
-rw-r--r--contrib/ipfilter/lib/rwlock_emul.c21
-rw-r--r--contrib/ipfilter/lib/save_v2trap.c4
-rw-r--r--contrib/libc-vis/vis.c11
-rw-r--r--contrib/libucl/ChangeLog.md2
-rw-r--r--contrib/libucl/README.md18
-rw-r--r--contrib/libucl/configure.ac1
-rw-r--r--contrib/libucl/include/ucl.h44
-rw-r--r--contrib/libucl/lua/lua_ucl.c73
-rw-r--r--contrib/libucl/src/ucl_emitter_utils.c8
-rw-r--r--contrib/libucl/src/ucl_internal.h31
-rw-r--r--contrib/libucl/src/ucl_parser.c21
-rw-r--r--contrib/libucl/src/ucl_util.c57
-rw-r--r--contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td3
-rw-r--r--contrib/llvm/tools/clang/include/clang/Sema/Overload.h6
-rw-r--r--contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp33
-rw-r--r--contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue2069
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_3des.c4
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_aes.c4
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c4
-rwxr-xr-xcontrib/netbsd-tests/dev/clock_subr/clock_subr_test_data_gen.sh25
-rw-r--r--contrib/netbsd-tests/dev/clock_subr/t_clock_subr.c309
-rw-r--r--contrib/netbsd-tests/dev/scsipi/t_cd.c4
-rw-r--r--contrib/netbsd-tests/dev/sysmon/t_swwdog.c4
-rw-r--r--contrib/netbsd-tests/fs/common/h_fsmacros.h4
-rw-r--r--contrib/netbsd-tests/fs/ffs/h_quota2_tests.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_fifos.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_mount.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_quota2_1.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_quota2_remount.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_snapshot.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_snapshot_log.c4
-rw-r--r--contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c4
-rw-r--r--contrib/netbsd-tests/fs/hfs/t_pathconvert.c4
-rw-r--r--contrib/netbsd-tests/fs/kernfs/t_basic.c4
-rw-r--r--contrib/netbsd-tests/fs/lfs/t_pr.c4
-rw-r--r--contrib/netbsd-tests/fs/msdosfs/t_snapshot.c4
-rw-r--r--contrib/netbsd-tests/fs/nfs/t_mountd.c4
-rw-r--r--contrib/netbsd-tests/fs/nullfs/t_basic.c4
-rw-r--r--contrib/netbsd-tests/fs/ptyfs/t_nullpts.c4
-rw-r--r--contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c4
-rw-r--r--contrib/netbsd-tests/fs/puffs/t_basic.c4
-rw-r--r--contrib/netbsd-tests/fs/puffs/t_fuzz.c4
-rw-r--r--contrib/netbsd-tests/fs/puffs/t_io.c4
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_mknod.sh16
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_readdir.sh8
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/t_renamerace.c4
-rw-r--r--contrib/netbsd-tests/fs/umapfs/t_basic.c4
-rw-r--r--contrib/netbsd-tests/fs/union/t_pr.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_full.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_io.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c86
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_renamerace.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_ro.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_rwtoro.c233
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_union.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_unpriv.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_vfsops.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_vnops.c4
-rw-r--r--contrib/netbsd-tests/include/sys/t_socket.c4
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait.c1606
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait3.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait4.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait6.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitid.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitpid.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait.c141
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait3.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait4.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait6.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitid.c30
-rw-r--r--contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitpid.c30
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_file.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_file2.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_ioctl.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc1.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc2.c9
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc3.c9
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_sig.c9
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_vnode.c3
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_extent.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_filedesc.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_lock.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_mqueue.c17
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait.c1636
-rw-r--r--contrib/netbsd-tests/kernel/t_pty.c6
-rw-r--r--contrib/netbsd-tests/kernel/t_rnd.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c17
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/db/t_db.sh8
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c90
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c1
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_glob.c18
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_sleep.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/h_hash.c20
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/t_hmac.c127
-rw-r--r--contrib/netbsd-tests/lib/libc/hash/t_sha2.c14
-rw-r--r--contrib/netbsd-tests/lib/libc/locale/t_io.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/debug.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/t_exhaust.c24
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/t_regex_att.c23
-rw-r--r--contrib/netbsd-tests/lib/libc/rpc/t_rpc.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/ssp/h_memset.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/ssp/h_read.c21
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c21
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strlen.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c15
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_connect.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_dup.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getcontext.c23
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getrusage.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_kevent.c29
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_link.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_listen.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mincore.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mlock.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mmap.c13
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgctl.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_msync.c29
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_pipe.c8
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_pipe2.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_revoke.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_select.c18
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigaction.c16
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c36
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_socketpair.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_stat.c13
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_timer_create.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_truncate.c15
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_umask.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_unlink.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_write.c16
-rw-r--r--contrib/netbsd-tests/lib/libm/t_ilogb.c12
-rw-r--r--contrib/netbsd-tests/lib/libm/t_pow.c22
-rw-r--r--contrib/netbsd-tests/lib/libm/t_precision.c5
-rw-r--r--contrib/netbsd-tests/lib/libm/t_scalbn.c10
-rw-r--r--contrib/netbsd-tests/lib/libposix/t_rename.c6
-rw-r--r--contrib/netbsd-tests/lib/libpthread/h_common.h8
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_condwait.c14
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_detach.c21
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_fork.c12
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_fpu.c27
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_join.c4
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_mutex.c10
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_once.c7
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_sem.c9
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_swapcontext.c16
-rw-r--r--contrib/netbsd-tests/lib/libpthread_dbg/h_common.h128
-rw-r--r--contrib/netbsd-tests/lib/libpthread_dbg/t_dummy.c131
-rw-r--r--contrib/netbsd-tests/lib/libpthread_dbg/t_threads.c719
-rw-r--r--contrib/netbsd-tests/lib/librefuse/t_refuse_opt.c418
-rw-r--r--contrib/netbsd-tests/lib/librt/t_sem.c24
-rw-r--r--contrib/netbsd-tests/lib/librumpclient/t_fd.c4
-rw-r--r--contrib/netbsd-tests/lib/semaphore/sem.c4
-rw-r--r--contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c4
-rw-r--r--contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c4
-rw-r--r--contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c4
-rw-r--r--contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c4
-rw-r--r--contrib/netbsd-tests/modules/t_builtin.c4
-rw-r--r--contrib/netbsd-tests/net/bpf/t_bpf.c40
-rw-r--r--contrib/netbsd-tests/net/bpf/t_mbuf.c6
-rw-r--r--contrib/netbsd-tests/net/bpfilter/t_bpfilter.c6
-rw-r--r--contrib/netbsd-tests/net/bpfjit/t_bpfjit.c6
-rw-r--r--contrib/netbsd-tests/net/bpfjit/t_cop.c6
-rw-r--r--contrib/netbsd-tests/net/bpfjit/t_extmem.c6
-rw-r--r--contrib/netbsd-tests/net/bpfjit/t_mbuf.c6
-rw-r--r--contrib/netbsd-tests/net/carp/t_basic.c221
-rwxr-xr-xcontrib/netbsd-tests/net/carp/t_basic.sh165
-rw-r--r--contrib/netbsd-tests/net/config/netconfig.c6
-rw-r--r--contrib/netbsd-tests/net/icmp/t_forward.c6
-rw-r--r--contrib/netbsd-tests/net/icmp/t_ping.c6
-rwxr-xr-xcontrib/netbsd-tests/net/if/t_ifconfig.sh4
-rw-r--r--contrib/netbsd-tests/net/if_loop/t_pr.c6
-rwxr-xr-xcontrib/netbsd-tests/net/if_tun/t_tun.sh138
-rwxr-xr-xcontrib/netbsd-tests/net/if_vlan/t_vlan.sh115
-rwxr-xr-xcontrib/netbsd-tests/net/ndp/t_ra.sh80
-rw-r--r--contrib/netbsd-tests/net/net/t_raw.c4
-rw-r--r--contrib/netbsd-tests/rump/modautoload/t_modautoload.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_kern.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_lwproc.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_modcmd.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_signals.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_threads.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_tsleep.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_vm.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpvfs/t_basic.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpvfs/t_etfs.c4
-rw-r--r--contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c4
-rw-r--r--contrib/netbsd-tests/sys/uvm/t_uvm_physseg.c2377
-rw-r--r--contrib/netbsd-tests/sys/uvm/t_uvm_physseg_load.c740
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/grep/t_grep.sh23
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/mixerctl/t_mixerctl.sh51
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_basic.in4
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_basic.out3
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_counts.out6
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_input.in7
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_show_duplicates.out1
-rw-r--r--contrib/netbsd-tests/usr.bin/uniq/d_show_uniques.out5
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/uniq/t_uniq.sh97
-rwxr-xr-xcontrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh2
-rw-r--r--contrib/tzcode/stdtime/localtime.c9
-rw-r--r--etc/mtree/BSD.tests.dist4
-rw-r--r--etc/ntp.conf52
-rwxr-xr-xetc/rc.d/ntpdate2
-rw-r--r--gnu/usr.bin/cc/cc_tools/freebsd-native.h2
-rw-r--r--lib/libc/aarch64/Makefile.inc2
-rw-r--r--lib/libc/amd64/Makefile.inc2
-rw-r--r--lib/libc/amd64/string/Makefile.inc13
-rw-r--r--lib/libc/arm/Makefile.inc2
-rw-r--r--lib/libc/arm/string/Makefile.inc15
-rw-r--r--lib/libc/gen/tcsendbreak.333
-rw-r--r--lib/libc/i386/Makefile.inc2
-rw-r--r--lib/libc/i386/string/Makefile.inc25
-rw-r--r--lib/libc/mips/Makefile.inc2
-rw-r--r--lib/libc/mips/gdtoa/Makefile.inc4
-rw-r--r--lib/libc/mips/gdtoa/arith.h10
-rw-r--r--lib/libc/mips/string/Makefile.inc17
-rw-r--r--lib/libc/net/nsdispatch.c30
-rw-r--r--lib/libc/powerpc/Makefile.inc2
-rw-r--r--lib/libc/powerpc64/Makefile.inc2
-rw-r--r--lib/libc/riscv/Makefile.inc2
-rw-r--r--lib/libc/sparc64/Makefile.inc2
-rw-r--r--lib/libc/sparc64/string/Makefile.inc1
-rw-r--r--lib/libc/sys/kenv.2112
-rw-r--r--lib/libc/tests/hash/Makefile3
-rw-r--r--lib/libc/tests/nss/getgr_test.c17
-rw-r--r--lib/libc/tests/regex/Makefile3
-rw-r--r--lib/libcam/scsi_cmdparse.c57
-rw-r--r--lib/libclang_rt/profile/Makefile3
-rw-r--r--lib/libcxxrt/Version.map23
-rw-r--r--lib/libpam/modules/pam_krb5/pam_krb5.c2
-rw-r--r--lib/libutil/Makefile10
-rw-r--r--lib/msun/tests/Makefile2
-rw-r--r--lib/msun/tests/cexp_test.c28
-rw-r--r--lib/msun/tests/conj_test.c4
-rw-r--r--lib/msun/tests/csqrt_test.c16
-rw-r--r--lib/msun/tests/ctrig_test.c115
-rw-r--r--lib/msun/tests/exponential_test.c8
-rw-r--r--lib/msun/tests/fenv_test.c237
-rw-r--r--lib/msun/tests/fma_test.c6
-rw-r--r--lib/msun/tests/fmaxmin_test.c8
-rw-r--r--lib/msun/tests/invctrig_test.c23
-rw-r--r--lib/msun/tests/invtrig_test.c5
-rw-r--r--lib/msun/tests/logarithm_test.c19
-rw-r--r--lib/msun/tests/lrint_test.c4
-rw-r--r--lib/msun/tests/nan_test.c10
-rw-r--r--lib/msun/tests/nearbyint_test.c21
-rw-r--r--lib/msun/tests/next_test.c2
-rw-r--r--lib/msun/tests/rem_test.c2
-rw-r--r--lib/msun/tests/test-utils.h14
-rw-r--r--lib/msun/tests/trig_test.c4
-rw-r--r--release/Makefile.vagrant23
-rw-r--r--release/Makefile.vm4
-rw-r--r--release/packages/runtime.ucl1
-rw-r--r--release/tools/vagrant-virtualbox.conf4
-rw-r--r--rescue/rescue/Makefile16
-rw-r--r--sbin/camcontrol/attrib.c5
-rw-r--r--sbin/camcontrol/camcontrol.818
-rw-r--r--sbin/camcontrol/camcontrol.c247
-rw-r--r--sbin/camcontrol/camcontrol.h39
-rw-r--r--sbin/camcontrol/fwdownload.c14
-rw-r--r--sbin/camcontrol/modeedit.c44
-rw-r--r--sbin/camcontrol/persist.c7
-rw-r--r--sbin/camcontrol/timestamp.c35
-rw-r--r--sbin/camcontrol/zone.c10
-rw-r--r--sbin/devd/devd.cc22
-rw-r--r--sbin/md5/md5.124
-rw-r--r--share/man/man4/Makefile2
-rw-r--r--share/man/man4/ctl.49
-rw-r--r--share/man/man4/da.42
-rw-r--r--share/man/man4/ddb.440
-rw-r--r--share/man/man4/tty.413
-rw-r--r--share/man/man4/wpi.44
-rw-r--r--share/misc/pci_vendors144
-rw-r--r--sys/amd64/amd64/amd64_mem.c754
-rw-r--r--sys/amd64/amd64/machdep.c1
-rw-r--r--sys/amd64/amd64/pmap.c20
-rw-r--r--sys/amd64/linux/Makefile5
-rw-r--r--sys/amd64/linux/linux_dummy.c3
-rw-r--r--sys/amd64/linux32/Makefile5
-rw-r--r--sys/amd64/linux32/linux.h3
-rw-r--r--sys/amd64/linux32/linux32_dummy.c3
-rw-r--r--sys/amd64/linux32/linux32_machdep.c2
-rw-r--r--sys/arm/allwinner/a10_common.c4
-rw-r--r--sys/arm/allwinner/aw_machdep.c13
-rw-r--r--sys/arm/allwinner/aw_wdog.c2
-rw-r--r--sys/arm/altera/socfpga/socfpga_common.c12
-rw-r--r--sys/arm/altera/socfpga/socfpga_machdep.c15
-rw-r--r--sys/arm/altera/socfpga/socfpga_rstmgr.c8
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_identsoc.c2
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_machdep.c21
-rw-r--r--sys/arm/amlogic/aml8726/aml8726_wdt.c2
-rw-r--r--sys/arm/annapurna/alpine/alpine_machdep.c15
-rw-r--r--sys/arm/annapurna/alpine/common.c3
-rw-r--r--sys/arm/arm/bus_space_asm_generic.S1
-rw-r--r--sys/arm/arm/busdma_machdep-v6.c43
-rw-r--r--sys/arm/arm/cpufunc.c5
-rw-r--r--sys/arm/arm/cpuinfo.c5
-rw-r--r--sys/arm/arm/db_trace.c2
-rw-r--r--sys/arm/arm/identcpu-v4.c (renamed from sys/arm/arm/identcpu.c)243
-rw-r--r--sys/arm/arm/identcpu-v6.c360
-rw-r--r--sys/arm/arm/locore-v4.S1
-rw-r--r--sys/arm/arm/locore-v6.S1
-rw-r--r--sys/arm/arm/physmem.c2
-rw-r--r--sys/arm/arm/platform.c1
-rw-r--r--sys/arm/arm/pmap-v6.c5
-rw-r--r--sys/arm/arm/stack_machdep.c2
-rw-r--r--sys/arm/arm/trap-v4.c4
-rw-r--r--sys/arm/arm/undefined.c2
-rw-r--r--sys/arm/at91/at91_common.c4
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_common.c4
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_fb.c6
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_machdep.c23
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_wdog.c2
-rw-r--r--sys/arm/conf/ALLWINNER1
-rw-r--r--sys/arm/conf/ALPINE1
-rw-r--r--sys/arm/conf/AML87261
-rw-r--r--sys/arm/conf/ARMADA38X2
-rw-r--r--sys/arm/conf/ARMADAXP1
-rw-r--r--sys/arm/conf/BEAGLEBONE1
-rw-r--r--sys/arm/conf/EXYNOS5.common1
-rw-r--r--sys/arm/conf/IMX53-QSB2
-rw-r--r--sys/arm/conf/IMX61
-rw-r--r--sys/arm/conf/PANDABOARD1
-rw-r--r--sys/arm/conf/RK31881
-rw-r--r--sys/arm/conf/RPI-B1
-rw-r--r--sys/arm/conf/RPI21
-rw-r--r--sys/arm/conf/SOCKIT.common1
-rw-r--r--sys/arm/conf/TEGRA1241
-rw-r--r--sys/arm/conf/VERSATILEPB1
-rw-r--r--sys/arm/conf/VIRT3
-rw-r--r--sys/arm/conf/VYBRID1
-rw-r--r--sys/arm/freescale/imx/files.imx52
-rw-r--r--sys/arm/freescale/imx/files.imx62
-rw-r--r--sys/arm/freescale/imx/imx51_ipuv3.c5
-rw-r--r--sys/arm/freescale/imx/imx51_ipuv3_fbd.c4
-rw-r--r--sys/arm/freescale/imx/imx6_anatop.c2
-rw-r--r--sys/arm/freescale/imx/imx6_machdep.c4
-rw-r--r--sys/arm/freescale/imx/imx6_src.c2
-rw-r--r--sys/arm/freescale/imx/imx6_ssi.c8
-rw-r--r--sys/arm/freescale/imx/imx6_usbphy.c4
-rw-r--r--sys/arm/freescale/imx/imx_common.c4
-rw-r--r--sys/arm/freescale/imx/imx_gpio.c2
-rw-r--r--sys/arm/freescale/imx/imx_machdep.c22
-rw-r--r--sys/arm/freescale/vybrid/vf_common.c12
-rw-r--r--sys/arm/freescale/vybrid/vf_dcu4.c31
-rw-r--r--sys/arm/freescale/vybrid/vf_edma.c5
-rw-r--r--sys/arm/freescale/vybrid/vf_iomuxc.c6
-rw-r--r--sys/arm/freescale/vybrid/vf_machdep.c15
-rw-r--r--sys/arm/freescale/vybrid/vf_sai.c17
-rw-r--r--sys/arm/include/atomic.h3
-rw-r--r--sys/arm/include/bus_dma.h2
-rw-r--r--sys/arm/include/cpuconf.h192
-rw-r--r--sys/arm/include/cpufunc.h1
-rw-r--r--sys/arm/include/cpuinfo.h7
-rw-r--r--sys/arm/include/pcpu.h2
-rw-r--r--sys/arm/include/pmap-v4.h25
-rw-r--r--sys/arm/lpc/lpc_fb.c4
-rw-r--r--sys/arm/lpc/lpc_gpio.c2
-rw-r--r--sys/arm/lpc/lpc_intc.c4
-rw-r--r--sys/arm/lpc/lpc_timer.c5
-rw-r--r--sys/arm/mv/gpio.c22
-rw-r--r--sys/arm/mv/mv_machdep.c18
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_machdep.c19
-rw-r--r--sys/arm/nvidia/tegra_efuse.c2
-rw-r--r--sys/arm/qemu/virt_common.c4
-rw-r--r--sys/arm/qemu/virt_machdep.c15
-rw-r--r--sys/arm/rockchip/rk30xx_common.c4
-rw-r--r--sys/arm/rockchip/rk30xx_gpio.c14
-rw-r--r--sys/arm/rockchip/rk30xx_machdep.c15
-rw-r--r--sys/arm/rockchip/rk30xx_wdog.c2
-rw-r--r--sys/arm/samsung/exynos/exynos5_common.c4
-rw-r--r--sys/arm/samsung/exynos/exynos5_machdep.c15
-rw-r--r--sys/arm/ti/am335x/am335x_dmtpps.c14
-rw-r--r--sys/arm/ti/am335x/am335x_dmtreg.h2
-rw-r--r--sys/arm/ti/am335x/am335x_lcd.c4
-rw-r--r--sys/arm/ti/am335x/am335x_lcd_syscons.c12
-rw-r--r--sys/arm/ti/ti_adc.c20
-rw-r--r--sys/arm/ti/ti_common.c4
-rw-r--r--sys/arm/ti/ti_machdep.c15
-rw-r--r--sys/arm/ti/ti_sdhci.c60
-rw-r--r--sys/arm/versatile/sp804.c5
-rw-r--r--sys/arm/versatile/versatile_common.c4
-rw-r--r--sys/arm/versatile/versatile_machdep.c17
-rw-r--r--sys/arm/xilinx/zy7_machdep.c21
-rw-r--r--sys/arm/xilinx/zy7_slcr.c11
-rw-r--r--sys/arm/xscale/pxa/pxa_gpio.c2
-rw-r--r--sys/arm/xscale/pxa/pxa_icu.c14
-rw-r--r--sys/arm/xscale/pxa/pxa_space.c2
-rw-r--r--sys/arm/xscale/pxa/pxa_timer.c8
-rw-r--r--sys/boot/arm/uboot/Makefile3
-rw-r--r--sys/boot/fdt/dts/arm/rpi.dts3
-rw-r--r--sys/boot/fdt/dts/arm/rpi2.dts3
-rw-r--r--sys/boot/powerpc/kboot/Makefile3
-rw-r--r--sys/boot/powerpc/ofw/Makefile3
-rw-r--r--sys/boot/powerpc/ps3/Makefile3
-rw-r--r--sys/boot/powerpc/uboot/Makefile3
-rw-r--r--sys/boot/userboot/userboot/Makefile3
-rw-r--r--sys/cam/ctl/ctl.c248
-rw-r--r--sys/cam/ctl/ctl_error.c15
-rw-r--r--sys/cam/ctl/ctl_frontend.c2
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c12
-rw-r--r--sys/cam/ctl/ctl_private.h6
-rw-r--r--sys/cam/ctl/ctl_tpc.c40
-rw-r--r--sys/cam/ctl/scsi_ctl.c462
-rw-r--r--sys/cam/scsi/scsi_all.h2
-rw-r--r--sys/cam/scsi/scsi_low.c9
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c47
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c20
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c31
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h1
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c3
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c11
-rw-r--r--sys/cddl/dev/dtrace/amd64/dtrace_subr.c11
-rw-r--r--sys/cddl/dev/dtrace/i386/dtrace_subr.c11
-rw-r--r--sys/compat/cloudabi/cloudabi_mem.c88
-rw-r--r--sys/compat/freebsd32/Makefile5
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c49
-rw-r--r--sys/compat/linux/linux_file.c56
-rw-r--r--sys/compat/linux/linux_misc.c21
-rw-r--r--sys/compat/linux/linux_mmap.c61
-rw-r--r--sys/compat/svr4/Makefile4
-rw-r--r--sys/conf/files1
-rw-r--r--sys/conf/files.amd643
-rw-r--r--sys/conf/files.arm3
-rw-r--r--sys/conf/files.i3865
-rw-r--r--sys/conf/files.powerpc2
-rw-r--r--sys/conf/kern.post.mk2
-rw-r--r--sys/conf/options.i3863
-rw-r--r--sys/contrib/ipfilter/netinet/ip_compat.h4
-rw-r--r--sys/contrib/ipfilter/netinet/ip_frag.c3
-rw-r--r--sys/contrib/ipfilter/netinet/ip_nat.c4
-rw-r--r--sys/contrib/ipfilter/netinet/ip_nat6.c4
-rw-r--r--sys/contrib/vchiq/interface/compat/vchi_bsd.h2
-rw-r--r--sys/dev/acpica/acpi_cpu.c9
-rw-r--r--sys/dev/acpica/acpi_package.c2
-rw-r--r--sys/dev/advansys/advansys.c4
-rw-r--r--sys/dev/aha/aha.c4
-rw-r--r--sys/dev/ahci/ahci.c4
-rw-r--r--sys/dev/aic7xxx/aic79xx.c3
-rw-r--r--sys/dev/aic7xxx/aic7xxx.c3
-rw-r--r--sys/dev/arcmsr/arcmsr.c7
-rw-r--r--sys/dev/ata/ata-all.c4
-rw-r--r--sys/dev/atkbdc/psm.c2
-rw-r--r--sys/dev/buslogic/bt.c4
-rw-r--r--sys/dev/chromebook_platform/chromebook_platform.c2
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/cm.c234
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/cq.c12
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h3
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/mem.c3
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/qp.c73
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/t4.h2
-rw-r--r--sys/dev/e1000/if_igb.c2
-rw-r--r--sys/dev/ffec/if_ffecreg.h21
-rw-r--r--sys/dev/firewire/sbp.c5
-rw-r--r--sys/dev/firewire/sbp_targ.c3
-rw-r--r--sys/dev/gpio/ofw_gpiobus.c5
-rw-r--r--sys/dev/hpt27xx/hpt27xx_osm_bsd.c2
-rw-r--r--sys/dev/hpt27xx/ldm.h4
-rw-r--r--sys/dev/hptmv/entry.c4
-rw-r--r--sys/dev/hptnr/hptnr_osm_bsd.c2
-rw-r--r--sys/dev/hptnr/ldm.h3
-rw-r--r--sys/dev/hptrr/hptrr_osm_bsd.c2
-rw-r--r--sys/dev/hptrr/ldm.h4
-rw-r--r--sys/dev/intel/spi.c533
-rw-r--r--sys/dev/ioat/ioat_test.c4
-rw-r--r--sys/dev/iscsi/icl_soft.c97
-rw-r--r--sys/dev/iscsi/iscsi.c27
-rw-r--r--sys/dev/isp/isp.c11
-rw-r--r--sys/dev/isp/isp_freebsd.c926
-rw-r--r--sys/dev/isp/isp_freebsd.h65
-rw-r--r--sys/dev/isp/isp_target.c13
-rw-r--r--sys/dev/iwi/if_iwi.c2
-rw-r--r--sys/dev/iwn/if_iwn.c1
-rw-r--r--sys/dev/jedec_ts/jedec_ts.c2
-rw-r--r--sys/dev/mpr/mpi/mpi2_ioc.h5
-rw-r--r--sys/dev/mpr/mpr_sas_lsi.c19
-rw-r--r--sys/dev/mpr/mpr_table.c6
-rw-r--r--sys/dev/mpr/mprvar.h2
-rw-r--r--sys/dev/mvs/mvs.c4
-rw-r--r--sys/dev/ncr/ncr.c4
-rw-r--r--sys/dev/ofw/ofw_fdt.c13
-rw-r--r--sys/dev/qlxgbe/ql_os.c1
-rw-r--r--sys/dev/ral/rt2661.c2
-rw-r--r--sys/dev/sdhci/fsl_sdhci.c (renamed from sys/arm/freescale/imx/imx_sdhci.c)291
-rw-r--r--sys/dev/sdhci/sdhci_acpi.c4
-rw-r--r--sys/dev/sdhci/sdhci_fdt_gpio.c257
-rw-r--r--sys/dev/sdhci/sdhci_fdt_gpio.h69
-rw-r--r--sys/dev/siis/siis.c4
-rw-r--r--sys/dev/sym/sym_hipd.c5
-rw-r--r--sys/dev/trm/trm.c162
-rw-r--r--sys/dev/usb/controller/ehci_imx.c3
-rw-r--r--sys/dev/usb/serial/u3g.c1
-rw-r--r--sys/dev/usb/serial/uark.c1
-rw-r--r--sys/dev/usb/serial/ubsa.c16
-rw-r--r--sys/dev/usb/serial/uchcom.c1
-rw-r--r--sys/dev/usb/serial/ufoma.c1
-rw-r--r--sys/dev/usb/serial/uftdi.c18
-rw-r--r--sys/dev/usb/serial/umcs.c21
-rw-r--r--sys/dev/usb/serial/umct.c25
-rw-r--r--sys/dev/usb/serial/umodem.c1
-rw-r--r--sys/dev/usb/serial/umoscom.c8
-rw-r--r--sys/dev/usb/serial/uplcom.c1
-rw-r--r--sys/dev/usb/serial/usb_serial.c23
-rw-r--r--sys/dev/usb/serial/usb_serial.h9
-rw-r--r--sys/dev/usb/serial/uslcom.c1
-rw-r--r--sys/dev/usb/wlan/if_zyd.c2
-rw-r--r--sys/dev/vxge/vxge.c2
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-config.c9
-rw-r--r--sys/fs/devfs/devfs_vnops.c6
-rw-r--r--sys/fs/ext2fs/ext2_htree.c1
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c21
-rw-r--r--sys/fs/nfsserver/nfs_nfsdkrpc.c3
-rw-r--r--sys/i386/conf/DEFAULTS3
-rw-r--r--sys/i386/conf/NOTES16
-rw-r--r--sys/i386/i386/elf_machdep.c8
-rw-r--r--sys/i386/i386/exception.s1
-rw-r--r--sys/i386/i386/initcpu.c6
-rw-r--r--sys/i386/i386/machdep.c44
-rw-r--r--sys/i386/i386/mp_machdep.c3
-rw-r--r--sys/i386/i386/pmap.c12
-rw-r--r--sys/i386/i386/ptrace_machdep.c10
-rw-r--r--sys/i386/i386/support.s2
-rw-r--r--sys/i386/i386/swtch.s3
-rw-r--r--sys/i386/i386/trap.c13
-rw-r--r--sys/i386/i386/vm86bios.s4
-rw-r--r--sys/i386/i386/vm_machdep.c16
-rw-r--r--sys/i386/ibcs2/Makefile8
-rw-r--r--sys/i386/include/atomic.h29
-rw-r--r--sys/i386/isa/npx.c80
-rw-r--r--sys/i386/linux/Makefile5
-rw-r--r--sys/i386/linux/linux_dummy.c3
-rw-r--r--sys/i386/linux/linux_ptrace.c12
-rw-r--r--sys/kern/Makefile6
-rw-r--r--sys/kern/imgact_elf.c40
-rw-r--r--sys/kern/kern_clocksource.c1
-rw-r--r--sys/kern/kern_descrip.c3
-rw-r--r--sys/kern/kern_exit.c3
-rw-r--r--sys/kern/kern_racct.c5
-rw-r--r--sys/kern/kern_thread.c2
-rw-r--r--sys/kern/sched_ule.c6
-rw-r--r--sys/kern/subr_sleepqueue.c115
-rw-r--r--sys/kern/subr_trap.c6
-rw-r--r--sys/kern/subr_uio.c9
-rw-r--r--sys/kern/sys_generic.c3
-rw-r--r--sys/kern/tty.c102
-rw-r--r--sys/kern/tty_inq.c8
-rw-r--r--sys/kern/tty_outq.c8
-rw-r--r--sys/kern/uipc_mqueue.c2
-rw-r--r--sys/kern/vfs_aio.c10
-rw-r--r--sys/kern/vfs_vnops.c71
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/bytgpio/Makefile2
-rw-r--r--sys/modules/dtb/imx6/Makefile3
-rw-r--r--sys/modules/geom/geom_uzip/Makefile1
-rw-r--r--sys/modules/intelspi/Makefile8
-rw-r--r--sys/modules/mem/Makefile7
-rw-r--r--sys/modules/nvme/Makefile1
-rw-r--r--sys/netinet6/frag6.c9
-rw-r--r--sys/netpfil/ipfw/ip_fw2.c10
-rw-r--r--sys/netpfil/ipfw/ip_fw_sockopt.c9
-rw-r--r--sys/netpfil/pf/pf_lb.c2
-rw-r--r--sys/netpfil/pf/pf_osfp.c15
-rw-r--r--sys/ofed/drivers/infiniband/core/cma.c2
-rw-r--r--sys/ofed/drivers/infiniband/core/iwcm.c27
-rw-r--r--sys/powerpc/mpc85xx/fsl_sdhc.c1303
-rw-r--r--sys/powerpc/mpc85xx/fsl_sdhc.h297
-rw-r--r--sys/sys/cdefs.h3
-rw-r--r--sys/sys/file.h1
-rw-r--r--sys/sys/proc.h9
-rw-r--r--sys/sys/resource.h4
-rw-r--r--sys/sys/signalvar.h2
-rw-r--r--sys/sys/syscallsubr.h9
-rw-r--r--sys/sys/sysent.h2
-rw-r--r--sys/sys/systm.h3
-rw-r--r--sys/sys/tty.h1
-rw-r--r--sys/sys/ttyqueue.h4
-rw-r--r--sys/ufs/ffs/ffs_softdep.c10
-rw-r--r--sys/vm/uma_core.c4
-rw-r--r--sys/vm/vm_extern.h1
-rw-r--r--sys/vm/vm_fault.c9
-rw-r--r--sys/vm/vm_kern.c8
-rw-r--r--sys/vm/vm_mmap.c184
-rw-r--r--sys/vm/vm_pageout.c9
-rw-r--r--sys/vm/vm_pageout.h6
-rw-r--r--sys/x86/acpica/acpi_wakeup.c7
-rw-r--r--sys/x86/x86/cpu_machdep.c1
-rw-r--r--sys/x86/x86/identcpu.c6
-rw-r--r--sys/x86/x86/local_apic.c2
-rw-r--r--sys/x86/x86/mca.c12
-rw-r--r--sys/x86/x86/tsc.c2
-rw-r--r--sys/x86/x86/x86_mem.c (renamed from sys/i386/i386/i686_mem.c)280
-rw-r--r--tests/sys/fs/tmpfs/Makefile5
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc11
-rw-r--r--usr.bin/cmp/special.c2
-rw-r--r--usr.bin/cmp/tests/Makefile1
-rwxr-xr-xusr.bin/cmp/tests/cmp_test2.sh67
-rw-r--r--usr.bin/ctlstat/ctlstat.c31
-rw-r--r--usr.bin/dc/bcode.c41
-rw-r--r--usr.bin/dc/dc.c4
-rw-r--r--usr.bin/dc/stack.c23
-rw-r--r--usr.bin/sockstat/sockstat.c149
-rw-r--r--usr.bin/tail/Makefile6
-rw-r--r--usr.bin/tail/reverse.c144
-rw-r--r--usr.bin/tail/tests/Makefile7
-rwxr-xr-xusr.bin/tail/tests/tail_test.sh233
-rw-r--r--usr.bin/timeout/timeout.16
-rw-r--r--usr.bin/uniq/Makefile6
-rw-r--r--usr.bin/uniq/tests/Makefile16
-rw-r--r--usr.bin/uniq/tests/Makefile.depend11
-rw-r--r--usr.bin/vi/catalog/Makefile6
-rw-r--r--usr.sbin/camdd/camdd.c37
-rw-r--r--usr.sbin/ntp/doc/ntp.conf.54
-rw-r--r--usr.sbin/ntp/doc/ntp.keys.54
-rw-r--r--usr.sbin/route6d/route6d.c2
-rw-r--r--usr.sbin/syslogd/Makefile4
-rw-r--r--usr.sbin/syslogd/syslogd.c10
663 files changed, 17035 insertions, 10933 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index ca049ea..797140a 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -245,8 +245,6 @@ _REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
.for _DIR in ${LOCAL_LIB_DIRS}
.if empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
SUBDIR+= ${_DIR}
-.else
-.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121.
.endif
.endfor
@@ -1479,11 +1477,11 @@ sign-packages: _pkgbootstrap .PHONY
# Run test suite on installed world.
#
checkworld: .PHONY
- @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \
+ @if [ ! -x "${LOCALBASE}/bin/kyua" ]; then \
echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \
exit 1; \
fi
- ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile
+ ${_+_}PATH="$$PATH:${LOCALBASE}/bin" kyua test -k ${TESTSBASE}/Kyuafile
#
#
@@ -1492,7 +1490,7 @@ checkworld: .PHONY
# Build the API documentation with doxygen
#
doxygen: .PHONY
- @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \
+ @if [ ! -x "${LOCALBASE}/bin/doxygen" ]; then \
echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
exit 1; \
fi
@@ -1920,6 +1918,7 @@ native-xtools: .PHONY
usr.bin/mktemp \
usr.bin/mt \
usr.bin/patch \
+ usr.bin/readelf \
usr.bin/sed \
usr.bin/sort \
usr.bin/tar \
@@ -2462,16 +2461,35 @@ CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
INSTALL="sh ${.CURDIR}/tools/install.sh"
CDENV= ${CDBENV} \
TOOLS_PREFIX=${XDTP}
-CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
- --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \
- -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
-CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
+
+.if ${WANT_COMPILER_TYPE} == gcc || \
+ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
+# GCC requires -isystem and -L when using a cross-compiler. --sysroot
+# won't set header path and -L is used to ensure the base library path
+# is added before the port PREFIX library path.
+CD2CFLAGS+= -isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib
+# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler
+# combined with --sysroot.
+CD2CFLAGS+= -B${XDDESTDIR}/usr/lib
+# Force using libc++ for external GCC.
+# XXX: This should be checking MK_GNUCXX == no
+.if ${X_COMPILER_VERSION} >= 40800
+CD2CXXFLAGS+= -isystem ${XDDESTDIR}/usr/include/c++/v1 -std=c++11 \
+ -nostdinc++
+.endif
+.endif
+CD2CFLAGS+= --sysroot=${XDDESTDIR}/
+CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CXXFLAGS} ${CD2CFLAGS}" \
CPP="${CPP} ${CD2CFLAGS}" \
MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
+.if ${MK_META_MODE} != "no"
+# Don't rebuild build-tools targets during normal build.
+CD2MAKE+= BUILD_TOOLS_META=.NOMETA_CMP
+.endif
XDDESTDIR=${DESTDIR}/${XDTP}
.if !defined(OSREL)
OSREL!= uname -r | sed -e 's/[-(].*//'
@@ -2491,7 +2509,8 @@ _xb-worldtmp: .PHONY
_xb-bootstrap-tools: .PHONY
.for _tool in \
${_clang_tblgen} \
- ${_gperf}
+ ${_gperf} \
+ ${_yacc}
${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ obj; \
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index fe72c49..8de5141 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -460,7 +460,6 @@ expbackq(union node *cmd, int quoted, int flag, struct worddest *dst)
p = grabstackstr(dest);
evalbackcmd(cmd, &in);
ungrabstackstr(p, dest);
- argbackq = saveargbackq;
p = in.buf;
nnl = 0;
@@ -513,12 +512,16 @@ expbackq(union node *cmd, int quoted, int flag, struct worddest *dst)
close(in.fd);
if (in.buf)
ckfree(in.buf);
- if (in.jp)
+ if (in.jp) {
+ p = grabstackstr(dest);
exitstatus = waitforjob(in.jp, (int *)NULL);
+ ungrabstackstr(p, dest);
+ }
TRACE(("expbackq: size=%td: \"%.*s\"\n",
((dest - stackblock()) - startloc),
(int)((dest - stackblock()) - startloc),
stackblock() + startloc));
+ argbackq = saveargbackq;
expdest = dest;
INTON;
}
diff --git a/bin/sh/tests/expansion/Makefile b/bin/sh/tests/expansion/Makefile
index eccf239..c062232 100644
--- a/bin/sh/tests/expansion/Makefile
+++ b/bin/sh/tests/expansion/Makefile
@@ -39,6 +39,11 @@ ${PACKAGE}FILES+= cmdsubst14.0
${PACKAGE}FILES+= cmdsubst15.0
${PACKAGE}FILES+= cmdsubst16.0
${PACKAGE}FILES+= cmdsubst17.0
+${PACKAGE}FILES+= cmdsubst18.0
+${PACKAGE}FILES+= cmdsubst19.0
+${PACKAGE}FILES+= cmdsubst20.0
+${PACKAGE}FILES+= cmdsubst21.0
+${PACKAGE}FILES+= cmdsubst22.0
${PACKAGE}FILES+= export1.0
${PACKAGE}FILES+= export2.0
${PACKAGE}FILES+= export3.0
diff --git a/bin/sh/tests/expansion/cmdsubst18.0 b/bin/sh/tests/expansion/cmdsubst18.0
new file mode 100644
index 0000000..a9791b3
--- /dev/null
+++ b/bin/sh/tests/expansion/cmdsubst18.0
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+x=X
+unset n
+r=${x+$(echo a)}${x-$(echo b)}${n+$(echo c)}${n-$(echo d)}$(echo e)
+[ "$r" = aXde ]
diff --git a/bin/sh/tests/expansion/cmdsubst19.0 b/bin/sh/tests/expansion/cmdsubst19.0
new file mode 100644
index 0000000..ae6619a
--- /dev/null
+++ b/bin/sh/tests/expansion/cmdsubst19.0
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+b=200 c=30 d=5 x=4
+r=$(echo a)$(($(echo b) + ${x+$(echo c)} + ${x-$(echo d)}))$(echo e)
+[ "$r" = a234e ]
diff --git a/bin/sh/tests/expansion/cmdsubst20.0 b/bin/sh/tests/expansion/cmdsubst20.0
new file mode 100644
index 0000000..3393248
--- /dev/null
+++ b/bin/sh/tests/expansion/cmdsubst20.0
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+set -T
+trapped=''
+trap "trapped=x$trapped" USR1
+[ "x$(kill -USR1 $$)y" = xy ] && [ "$trapped" = x ]
diff --git a/bin/sh/tests/expansion/cmdsubst21.0 b/bin/sh/tests/expansion/cmdsubst21.0
new file mode 100644
index 0000000..87ff6a9
--- /dev/null
+++ b/bin/sh/tests/expansion/cmdsubst21.0
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+set -T
+trapped=''
+trap "trapped=x$trapped" TERM
+[ "x$($SH -c "kill $$")y" = xy ] && [ "$trapped" = x ]
diff --git a/bin/sh/tests/expansion/cmdsubst22.0 b/bin/sh/tests/expansion/cmdsubst22.0
new file mode 100644
index 0000000..97c6c98
--- /dev/null
+++ b/bin/sh/tests/expansion/cmdsubst22.0
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+set -T
+trapped=''
+trap "trapped=x$trapped" TERM
+[ "x$(:; kill $$)y" = xy ] && [ "$trapped" = x ]
diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
index b9f512d..f0842c1 100644
--- a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
+++ b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
@@ -346,6 +346,7 @@ ctf_fdopen(int fd, int *errp)
if ((sp32 = malloc(nbytes)) == NULL || pread64(fd,
sp32, nbytes, hdr.e64.e_shoff) != nbytes) {
free(sp);
+ free(sp32);
return (ctf_set_open_errno(errp, errno));
}
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index ac0524b..653f2b2 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -933,9 +933,11 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
* reallocate it. We normally won't need to do this
* because providers aren't being loaded all the time.
*/
- if ((p = realloc(p_providers,len)) == NULL)
+ if ((p = realloc(p_providers,len)) == NULL) {
+ free(p_providers);
/* How do we report errors here? */
return;
+ }
p_providers = p;
} else
break;
@@ -1150,8 +1152,10 @@ dt_vopen(int version, int flags, int *errp,
(void) fcntl(ftfd, F_SETFD, FD_CLOEXEC);
alloc:
- if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL)
+ if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL) {
+ dt_provmod_destroy(&provmod);
return (set_open_errno(dtp, errp, EDT_NOMEM));
+ }
bzero(dtp, sizeof (dtrace_hdl_t));
dtp->dt_oflags = flags;
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
index 21669c8..a735b66 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
@@ -256,8 +256,10 @@ dt_strtab_insert(dt_strtab_t *sp, const char *str)
* Now copy the string data into our buffer list, and then update
* the global counts of strings and bytes. Return str's byte offset.
*/
- if (dt_strtab_copyin(sp, str, len + 1) == -1)
+ if (dt_strtab_copyin(sp, str, len + 1) == -1) {
+ free(hp);
return (-1L);
+ }
sp->str_nstrs++;
sp->str_size += len + 1;
diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index 86c74b1..0cd6596 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -656,8 +656,11 @@ CaseFile::DeSerializeFile(const char *fileName)
uint64_t vdevGUID;
nvlist_t *vdevConf;
- sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case",
- &poolGUID, &vdevGUID);
+ if (sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case",
+ &poolGUID, &vdevGUID) != 2) {
+ throw ZfsdException("CaseFile::DeSerialize: "
+ "Unintelligible CaseFile filename %s.\n", fileName);
+ }
existingCaseFile = Find(Guid(poolGUID), Guid(vdevGUID));
if (existingCaseFile != NULL) {
/*
diff --git a/contrib/atf/atf-c++/atf-c++-api.3 b/contrib/atf/atf-c++/atf-c++-api.3
deleted file mode 100644
index da1441e..0000000
--- a/contrib/atf/atf-c++/atf-c++-api.3
+++ /dev/null
@@ -1,632 +0,0 @@
-.\"
-.\" Automated Testing Framework (atf)
-.\"
-.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
-.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
-.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd March 2, 2014
-.Dt ATF-C++-API 3
-.Os
-.Sh NAME
-.Nm atf-c++-api ,
-.Nm ATF_ADD_TEST_CASE ,
-.Nm ATF_CHECK_ERRNO ,
-.Nm ATF_FAIL ,
-.Nm ATF_INIT_TEST_CASES ,
-.Nm ATF_PASS ,
-.Nm ATF_REQUIRE ,
-.Nm ATF_REQUIRE_EQ ,
-.Nm ATF_REQUIRE_ERRNO ,
-.Nm ATF_REQUIRE_IN ,
-.Nm ATF_REQUIRE_MATCH ,
-.Nm ATF_REQUIRE_NOT_IN ,
-.Nm ATF_REQUIRE_THROW ,
-.Nm ATF_REQUIRE_THROW_RE ,
-.Nm ATF_SKIP ,
-.Nm ATF_TEST_CASE ,
-.Nm ATF_TEST_CASE_BODY ,
-.Nm ATF_TEST_CASE_CLEANUP ,
-.Nm ATF_TEST_CASE_HEAD ,
-.Nm ATF_TEST_CASE_NAME ,
-.Nm ATF_TEST_CASE_USE ,
-.Nm ATF_TEST_CASE_WITH_CLEANUP ,
-.Nm ATF_TEST_CASE_WITHOUT_HEAD ,
-.Nm atf::utils::cat_file ,
-.Nm atf::utils::compare_file ,
-.Nm atf::utils::copy_file ,
-.Nm atf::utils::create_file ,
-.Nm atf::utils::file_exists ,
-.Nm atf::utils::fork ,
-.Nm atf::utils::grep_collection ,
-.Nm atf::utils::grep_file ,
-.Nm atf::utils::grep_string ,
-.Nm atf::utils::redirect ,
-.Nm atf::utils::wait
-.Nd C++ API to write ATF-based test programs
-.Sh SYNOPSIS
-.In atf-c++.hpp
-.Fn ATF_ADD_TEST_CASE "tcs" "name"
-.Fn ATF_CHECK_ERRNO "exp_errno" "bool_expression"
-.Fn ATF_FAIL "reason"
-.Fn ATF_INIT_TEST_CASES "tcs"
-.Fn ATF_PASS
-.Fn ATF_REQUIRE "expression"
-.Fn ATF_REQUIRE_EQ "expression_1" "expression_2"
-.Fn ATF_REQUIRE_ERRNO "exp_errno" "bool_expression"
-.Fn ATF_REQUIRE_IN "element" "collection"
-.Fn ATF_REQUIRE_MATCH "regexp" "string_expression"
-.Fn ATF_REQUIRE_NOT_IN "element" "collection"
-.Fn ATF_REQUIRE_THROW "expected_exception" "statement"
-.Fn ATF_REQUIRE_THROW_RE "expected_exception" "regexp" "statement"
-.Fn ATF_SKIP "reason"
-.Fn ATF_TEST_CASE "name"
-.Fn ATF_TEST_CASE_BODY "name"
-.Fn ATF_TEST_CASE_CLEANUP "name"
-.Fn ATF_TEST_CASE_HEAD "name"
-.Fn ATF_TEST_CASE_NAME "name"
-.Fn ATF_TEST_CASE_USE "name"
-.Fn ATF_TEST_CASE_WITH_CLEANUP "name"
-.Fn ATF_TEST_CASE_WITHOUT_HEAD "name"
-.Ft void
-.Fo atf::utils::cat_file
-.Fa "const std::string& path"
-.Fa "const std::string& prefix"
-.Fc
-.Ft bool
-.Fo atf::utils::compare_file
-.Fa "const std::string& path"
-.Fa "const std::string& contents"
-.Fc
-.Ft void
-.Fo atf::utils::copy_file
-.Fa "const std::string& source"
-.Fa "const std::string& destination"
-.Fc
-.Ft void
-.Fo atf::utils::create_file
-.Fa "const std::string& path"
-.Fa "const std::string& contents"
-.Fc
-.Ft void
-.Fo atf::utils::file_exists
-.Fa "const std::string& path"
-.Fc
-.Ft pid_t
-.Fo atf::utils::fork
-.Fa "void"
-.Fc
-.Ft bool
-.Fo atf::utils::grep_collection
-.Fa "const std::string& regexp"
-.Fa "const Collection& collection"
-.Fc
-.Ft bool
-.Fo atf::utils::grep_file
-.Fa "const std::string& regexp"
-.Fa "const std::string& path"
-.Fc
-.Ft bool
-.Fo atf::utils::grep_string
-.Fa "const std::string& regexp"
-.Fa "const std::string& path"
-.Fc
-.Ft void
-.Fo atf::utils::redirect
-.Fa "const int fd"
-.Fa "const std::string& path"
-.Fc
-.Ft void
-.Fo atf::utils::wait
-.Fa "const pid_t pid"
-.Fa "const int expected_exit_status"
-.Fa "const std::string& expected_stdout"
-.Fa "const std::string& expected_stderr"
-.Fc
-.Sh DESCRIPTION
-ATF provides a C++ programming interface to implement test programs.
-C++-based test programs follow this template:
-.Bd -literal -offset indent
-extern "C" {
-.Ns ... C-specific includes go here ...
-}
-
-.Ns ... C++-specific includes go here ...
-
-#include <atf-c++.hpp>
-
-ATF_TEST_CASE(tc1);
-ATF_TEST_CASE_HEAD(tc1)
-{
- ... first test case's header ...
-}
-ATF_TEST_CASE_BODY(tc1)
-{
- ... first test case's body ...
-}
-
-ATF_TEST_CASE_WITH_CLEANUP(tc2);
-ATF_TEST_CASE_HEAD(tc2)
-{
- ... second test case's header ...
-}
-ATF_TEST_CASE_BODY(tc2)
-{
- ... second test case's body ...
-}
-ATF_TEST_CASE_CLEANUP(tc2)
-{
- ... second test case's cleanup ...
-}
-
-ATF_TEST_CASE(tc3);
-ATF_TEST_CASE_BODY(tc3)
-{
- ... third test case's body ...
-}
-
-.Ns ... additional test cases ...
-
-ATF_INIT_TEST_CASES(tcs)
-{
- ATF_ADD_TEST_CASE(tcs, tc1);
- ATF_ADD_TEST_CASE(tcs, tc2);
- ATF_ADD_TEST_CASE(tcs, tc3);
- ... add additional test cases ...
-}
-.Ed
-.Ss Definition of test cases
-Test cases have an identifier and are composed of three different parts:
-the header, the body and an optional cleanup routine, all of which are
-described in
-.Xr atf-test-case 4 .
-To define test cases, one can use the
-.Fn ATF_TEST_CASE ,
-.Fn ATF_TEST_CASE_WITH_CLEANUP
-or the
-.Fn ATF_TEST_CASE_WITHOUT_HEAD
-macros, which take a single parameter specifiying the test case's
-name.
-.Fn ATF_TEST_CASE ,
-requires to define a head and a body for the test case,
-.Fn ATF_TEST_CASE_WITH_CLEANUP
-requires to define a head, a body and a cleanup for the test case and
-.Fn ATF_TEST_CASE_WITHOUT_HEAD
-requires only a body for the test case.
-It is important to note that these
-.Em do not
-set the test case up for execution when the program is run.
-In order to do so, a later registration is needed through the
-.Fn ATF_ADD_TEST_CASE
-macro detailed in
-.Sx Program initialization .
-.Pp
-Later on, one must define the three parts of the body by means of three
-functions.
-Their headers are given by the
-.Fn ATF_TEST_CASE_HEAD ,
-.Fn ATF_TEST_CASE_BODY
-and
-.Fn ATF_TEST_CASE_CLEANUP
-macros, all of which take the test case's name.
-Following each of these, a block of code is expected, surrounded by the
-opening and closing brackets.
-.Pp
-Additionally, the
-.Fn ATF_TEST_CASE_NAME
-macro can be used to obtain the name of the class corresponding to a
-particular test case, as the name is internally manged by the library to
-prevent clashes with other user identifiers.
-Similarly, the
-.Fn ATF_TEST_CASE_USE
-macro can be executed on a particular test case to mark it as "used" and
-thus prevent compiler warnings regarding unused symbols.
-Note that
-.Em you should never have to use these macros during regular operation.
-.Ss Program initialization
-The library provides a way to easily define the test program's
-.Fn main
-function.
-You should never define one on your own, but rely on the
-library to do it for you.
-This is done by using the
-.Fn ATF_INIT_TEST_CASES
-macro, which is passed the name of the list that will hold the test cases.
-This name can be whatever you want as long as it is a valid variable value.
-.Pp
-After the macro, you are supposed to provide the body of a function, which
-should only use the
-.Fn ATF_ADD_TEST_CASE
-macro to register the test cases the test program will execute.
-The first parameter of this macro matches the name you provided in the
-former call.
-.Ss Header definitions
-The test case's header can define the meta-data by using the
-.Fn set_md_var
-method, which takes two parameters: the first one specifies the
-meta-data variable to be set and the second one specifies its value.
-Both of them are strings.
-.Ss Configuration variables
-The test case has read-only access to the current configuration variables
-by means of the
-.Ft bool
-.Fn has_config_var
-and the
-.Ft std::string
-.Fn get_config_var
-methods, which can be called in any of the three parts of a test case.
-.Ss Access to the source directory
-It is possible to get the path to the test case's source directory from any
-of its three components by querying the
-.Sq srcdir
-configuration variable.
-.Ss Requiring programs
-Aside from the
-.Va require.progs
-meta-data variable available in the header only, one can also check for
-additional programs in the test case's body by using the
-.Fn require_prog
-function, which takes the base name or full path of a single binary.
-Relative paths are forbidden.
-If it is not found, the test case will be automatically skipped.
-.Ss Test case finalization
-The test case finalizes either when the body reaches its end, at which
-point the test is assumed to have
-.Em passed ,
-or at any explicit call to
-.Fn ATF_PASS ,
-.Fn ATF_FAIL
-or
-.Fn ATF_SKIP .
-These three macros terminate the execution of the test case immediately.
-The cleanup routine will be processed afterwards in a completely automated
-way, regardless of the test case's termination reason.
-.Pp
-.Fn ATF_PASS
-does not take any parameters.
-.Fn ATF_FAIL
-and
-.Fn ATF_SKIP
-take a single string that describes why the test case failed or
-was skipped, respectively.
-It is very important to provide a clear error message in both cases so that
-the user can quickly know why the test did not pass.
-.Ss Expectations
-Everything explained in the previous section changes when the test case
-expectations are redefined by the programmer.
-.Pp
-Each test case has an internal state called
-.Sq expect
-that describes what the test case expectations are at any point in time.
-The value of this property can change during execution by any of:
-.Bl -tag -width indent
-.It Fn expect_death "reason"
-Expects the test case to exit prematurely regardless of the nature of the
-exit.
-.It Fn expect_exit "exitcode" "reason"
-Expects the test case to exit cleanly.
-If
-.Va exitcode
-is not
-.Sq -1 ,
-the runtime engine will validate that the exit code of the test case
-matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn expect_fail "reason"
-Any failure (be it fatal or non-fatal) raised in this mode is recorded.
-However, such failures do not report the test case as failed; instead, the
-test case finalizes cleanly and is reported as
-.Sq expected failure ;
-this report includes the provided
-.Fa reason
-as part of it.
-If no error is raised while running in this mode, then the test case is
-reported as
-.Sq failed .
-.Pp
-This mode is useful to reproduce actual known bugs in tests.
-Whenever the developer fixes the bug later on, the test case will start
-reporting a failure, signaling the developer that the test case must be
-adjusted to the new conditions.
-In this situation, it is useful, for example, to set
-.Fa reason
-as the bug number for tracking purposes.
-.It Fn expect_pass
-This is the normal mode of execution.
-In this mode, any failure is reported as such to the user and the test case
-is marked as
-.Sq failed .
-.It Fn expect_race "reason"
-Any failure or timeout during the execution of the test case will be
-considered as if a race condition has been triggered and reported as such.
-If no problems arise, the test will continue execution as usual.
-.It Fn expect_signal "signo" "reason"
-Expects the test case to terminate due to the reception of a signal.
-If
-.Va signo
-is not
-.Sq -1 ,
-the runtime engine will validate that the signal that terminated the test
-case matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn expect_timeout "reason"
-Expects the test case to execute for longer than its timeout.
-.El
-.Ss Helper macros for common checks
-The library provides several macros that are very handy in multiple
-situations.
-These basically check some condition after executing a given statement or
-processing a given expression and, if the condition is not met, they
-automatically call
-.Fn ATF_FAIL
-with an appropriate error message.
-.Pp
-.Fn ATF_REQUIRE
-takes an expression and raises a failure if it evaluates to false.
-.Pp
-.Fn ATF_REQUIRE_EQ
-takes two expressions and raises a failure if the two do not evaluate to
-the same exact value.
-.Pp
-.Fn ATF_REQUIRE_IN
-takes an element and a collection and validates that the element is present in
-the collection.
-.Pp
-.Fn ATF_REQUIRE_MATCH
-takes a regular expression and a string and raises a failure if the regular
-expression does not match the string.
-.Pp
-.Fn ATF_REQUIRE_NOT_IN
-takes an element and a collection and validates that the element is not present
-in the collection.
-.Pp
-.Fn ATF_REQUIRE_THROW
-takes the name of an exception and a statement and raises a failure if
-the statement does not throw the specified exception.
-.Fn ATF_REQUIRE_THROW_RE
-takes the name of an exception, a regular expresion and a statement and raises a
-failure if the statement does not throw the specified exception and if the
-message of the exception does not match the regular expression.
-.Pp
-.Fn ATF_CHECK_ERRNO
-and
-.Fn ATF_REQUIRE_ERRNO
-take, first, the error code that the check is expecting to find in the
-.Va errno
-variable and, second, a boolean expression that, if evaluates to true,
-means that a call failed and
-.Va errno
-has to be checked against the first value.
-.Ss Utility functions
-The following functions are provided as part of the
-.Nm
-API to simplify the creation of a variety of tests.
-In particular, these are useful to write tests for command-line interfaces.
-.Pp
-.Ft void
-.Fo atf::utils::cat_file
-.Fa "const std::string& path"
-.Fa "const std::string& prefix"
-.Fc
-.Bd -ragged -offset indent
-Prints the contents of
-.Fa path
-to the standard output, prefixing every line with the string in
-.Fa prefix .
-.Ed
-.Pp
-.Ft bool
-.Fo atf::utils::compare_file
-.Fa "const std::string& path"
-.Fa "const std::string& contents"
-.Fc
-.Bd -ragged -offset indent
-Returns true if the given
-.Fa path
-matches exactly the expected inlined
-.Fa contents .
-.Ed
-.Pp
-.Ft void
-.Fo atf::utils::copy_file
-.Fa "const std::string& source"
-.Fa "const std::string& destination"
-.Fc
-.Bd -ragged -offset indent
-Copies the file
-.Fa source
-to
-.Fa destination .
-The permissions of the file are preserved during the code.
-.Ed
-.Pp
-.Ft void
-.Fo atf::utils::create_file
-.Fa "const std::string& path"
-.Fa "const std::string& contents"
-.Fc
-.Bd -ragged -offset indent
-Creates
-.Fa file
-with the text given in
-.Fa contents .
-.Ed
-.Pp
-.Ft void
-.Fo atf::utils::file_exists
-.Fa "const std::string& path"
-.Fc
-.Bd -ragged -offset indent
-Checks if
-.Fa path
-exists.
-.Ed
-.Pp
-.Ft pid_t
-.Fo atf::utils::fork
-.Fa "void"
-.Fc
-.Bd -ragged -offset indent
-Forks a process and redirects the standard output and standard error of the
-child to files for later validation with
-.Fn atf::utils::wait .
-Fails the test case if the fork fails, so this does not return an error.
-.Ed
-.Pp
-.Ft bool
-.Fo atf::utils::grep_collection
-.Fa "const std::string& regexp"
-.Fa "const Collection& collection"
-.Fc
-.Bd -ragged -offset indent
-Searches for the regular expression
-.Fa regexp
-in any of the strings contained in the
-.Fa collection .
-This is a template that accepts any one-dimensional container of strings.
-.Ed
-.Pp
-.Ft bool
-.Fo atf::utils::grep_file
-.Fa "const std::string& regexp"
-.Fa "const std::string& path"
-.Fc
-.Bd -ragged -offset indent
-Searches for the regular expression
-.Fa regexp
-in the file
-.Fa path .
-The variable arguments are used to construct the regular expression.
-.Ed
-.Pp
-.Ft bool
-.Fo atf::utils::grep_string
-.Fa "const std::string& regexp"
-.Fa "const std::string& str"
-.Fc
-.Bd -ragged -offset indent
-Searches for the regular expression
-.Fa regexp
-in the string
-.Fa str .
-.Ed
-.Ft void
-.Fo atf::utils::redirect
-.Fa "const int fd"
-.Fa "const std::string& path"
-.Fc
-.Bd -ragged -offset indent
-Redirects the given file descriptor
-.Fa fd
-to the file
-.Fa path .
-This function exits the process in case of an error and does not properly mark
-the test case as failed.
-As a result, it should only be used in subprocesses of the test case; specially
-those spawned by
-.Fn atf::utils::fork .
-.Ed
-.Pp
-.Ft void
-.Fo atf::utils::wait
-.Fa "const pid_t pid"
-.Fa "const int expected_exit_status"
-.Fa "const std::string& expected_stdout"
-.Fa "const std::string& expected_stderr"
-.Fc
-.Bd -ragged -offset indent
-Waits and validates the result of a subprocess spawned with
-.Fn atf::utils::wait .
-The validation involves checking that the subprocess exited cleanly and returned
-the code specified in
-.Fa expected_exit_status
-and that its standard output and standard error match the strings given in
-.Fa expected_stdout
-and
-.Fa expected_stderr .
-.Pp
-If any of the
-.Fa expected_stdout
-or
-.Fa expected_stderr
-strings are prefixed with
-.Sq save: ,
-then they specify the name of the file into which to store the stdout or stderr
-of the subprocess, and no comparison is performed.
-.Ed
-.Sh EXAMPLES
-The following shows a complete test program with a single test case that
-validates the addition operator:
-.Bd -literal -offset indent
-#include <atf-c++.hpp>
-
-ATF_TEST_CASE(addition);
-ATF_TEST_CASE_HEAD(addition)
-{
- set_md_var("descr", "Sample tests for the addition operator");
-}
-ATF_TEST_CASE_BODY(addition)
-{
- ATF_REQUIRE_EQ(0 + 0, 0);
- ATF_REQUIRE_EQ(0 + 1, 1);
- ATF_REQUIRE_EQ(1 + 0, 1);
-
- ATF_REQUIRE_EQ(1 + 1, 2);
-
- ATF_REQUIRE_EQ(100 + 200, 300);
-}
-
-ATF_TEST_CASE(open_failure);
-ATF_TEST_CASE_HEAD(open_failure)
-{
- set_md_var("descr", "Sample tests for the open function");
-}
-ATF_TEST_CASE_BODY(open_failure)
-{
- ATF_REQUIRE_ERRNO(ENOENT, open("non-existent", O_RDONLY) == -1);
-}
-
-ATF_TEST_CASE(known_bug);
-ATF_TEST_CASE_HEAD(known_bug)
-{
- set_md_var("descr", "Reproduces a known bug");
-}
-ATF_TEST_CASE_BODY(known_bug)
-{
- expect_fail("See bug number foo/bar");
- ATF_REQUIRE_EQ(3, 1 + 1);
- expect_pass();
- ATF_REQUIRE_EQ(3, 1 + 2);
-}
-
-ATF_INIT_TEST_CASES(tcs)
-{
- ATF_ADD_TEST_CASE(tcs, addition);
- ATF_ADD_TEST_CASE(tcs, open_failure);
- ATF_ADD_TEST_CASE(tcs, known_bug);
-}
-.Ed
-.Sh SEE ALSO
-.Xr atf-test-program 1 ,
-.Xr atf-test-case 4
diff --git a/contrib/atf/atf-c++/atf-c++.3 b/contrib/atf/atf-c++/atf-c++.3
index 984ec93..601efaf 100644
--- a/contrib/atf/atf-c++/atf-c++.3
+++ b/contrib/atf/atf-c++/atf-c++.3
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd October 13, 2014
+.Dd March 6, 2017
.Dt ATF-C++ 3
.Os
.Sh NAME
@@ -145,10 +145,10 @@ ATF provides a C++ programming interface to implement test programs.
C++-based test programs follow this template:
.Bd -literal -offset indent
extern "C" {
-.Ns ... C-specific includes go here ...
+\&... C-specific includes go here ...
}
-.Ns ... C++-specific includes go here ...
+\&... C++-specific includes go here ...
#include <atf-c++.hpp>
@@ -182,7 +182,7 @@ ATF_TEST_CASE_BODY(tc3)
... third test case's body ...
}
-.Ns ... additional test cases ...
+\&... additional test cases ...
ATF_INIT_TEST_CASES(tcs)
{
@@ -202,7 +202,7 @@ To define test cases, one can use the
.Fn ATF_TEST_CASE_WITH_CLEANUP
or the
.Fn ATF_TEST_CASE_WITHOUT_HEAD
-macros, which take a single parameter specifiying the test case's
+macros, which take a single parameter specifying the test case's
name.
.Fn ATF_TEST_CASE ,
requires to define a head and a body for the test case,
@@ -232,7 +232,7 @@ opening and closing brackets.
Additionally, the
.Fn ATF_TEST_CASE_NAME
macro can be used to obtain the name of the class corresponding to a
-particular test case, as the name is internally manged by the library to
+particular test case, as the name is internally managed by the library to
prevent clashes with other user identifiers.
Similarly, the
.Fn ATF_TEST_CASE_USE
diff --git a/contrib/atf/atf-c/atf-c-api.3 b/contrib/atf/atf-c/atf-c-api.3
deleted file mode 100644
index b3b3086..0000000
--- a/contrib/atf/atf-c/atf-c-api.3
+++ /dev/null
@@ -1,772 +0,0 @@
-.\"
-.\" Automated Testing Framework (atf)
-.\"
-.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
-.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
-.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd March 2, 2014
-.Dt ATF-C-API 3
-.Os
-.Sh NAME
-.Nm atf-c-api ,
-.Nm ATF_CHECK ,
-.Nm ATF_CHECK_MSG ,
-.Nm ATF_CHECK_EQ ,
-.Nm ATF_CHECK_EQ_MSG ,
-.Nm ATF_CHECK_MATCH ,
-.Nm ATF_CHECK_MATCH_MSG ,
-.Nm ATF_CHECK_STREQ ,
-.Nm ATF_CHECK_STREQ_MSG ,
-.Nm ATF_CHECK_ERRNO ,
-.Nm ATF_REQUIRE ,
-.Nm ATF_REQUIRE_MSG ,
-.Nm ATF_REQUIRE_EQ ,
-.Nm ATF_REQUIRE_EQ_MSG ,
-.Nm ATF_REQUIRE_MATCH ,
-.Nm ATF_REQUIRE_MATCH_MSG ,
-.Nm ATF_REQUIRE_STREQ ,
-.Nm ATF_REQUIRE_STREQ_MSG ,
-.Nm ATF_REQUIRE_ERRNO ,
-.Nm ATF_TC ,
-.Nm ATF_TC_BODY ,
-.Nm ATF_TC_BODY_NAME ,
-.Nm ATF_TC_CLEANUP ,
-.Nm ATF_TC_CLEANUP_NAME ,
-.Nm ATF_TC_HEAD ,
-.Nm ATF_TC_HEAD_NAME ,
-.Nm ATF_TC_NAME ,
-.Nm ATF_TC_WITH_CLEANUP ,
-.Nm ATF_TC_WITHOUT_HEAD ,
-.Nm ATF_TP_ADD_TC ,
-.Nm ATF_TP_ADD_TCS ,
-.Nm atf_tc_get_config_var ,
-.Nm atf_tc_get_config_var_wd ,
-.Nm atf_tc_get_config_var_as_bool ,
-.Nm atf_tc_get_config_var_as_bool_wd ,
-.Nm atf_tc_get_config_var_as_long ,
-.Nm atf_tc_get_config_var_as_long_wd ,
-.Nm atf_no_error ,
-.Nm atf_tc_expect_death ,
-.Nm atf_tc_expect_exit ,
-.Nm atf_tc_expect_fail ,
-.Nm atf_tc_expect_pass ,
-.Nm atf_tc_expect_signal ,
-.Nm atf_tc_expect_timeout ,
-.Nm atf_tc_fail ,
-.Nm atf_tc_fail_nonfatal ,
-.Nm atf_tc_pass ,
-.Nm atf_tc_skip ,
-.Nm atf_utils_cat_file ,
-.Nm atf_utils_compare_file ,
-.Nm atf_utils_copy_file ,
-.Nm atf_utils_create_file ,
-.Nm atf_utils_file_exists ,
-.Nm atf_utils_fork ,
-.Nm atf_utils_free_charpp ,
-.Nm atf_utils_grep_file ,
-.Nm atf_utils_grep_string ,
-.Nm atf_utils_readline ,
-.Nm atf_utils_redirect ,
-.Nm atf_utils_wait
-.Nd C API to write ATF-based test programs
-.Sh SYNOPSIS
-.In atf-c.h
-.Fn ATF_CHECK "expression"
-.Fn ATF_CHECK_MSG "expression" "fail_msg_fmt" ...
-.Fn ATF_CHECK_EQ "expression_1" "expression_2"
-.Fn ATF_CHECK_EQ_MSG "expression_1" "expression_2" "fail_msg_fmt" ...
-.Fn ATF_CHECK_MATCH "regexp" "string"
-.Fn ATF_CHECK_MATCH_MSG "regexp" "string" "fail_msg_fmt" ...
-.Fn ATF_CHECK_STREQ "string_1" "string_2"
-.Fn ATF_CHECK_STREQ_MSG "string_1" "string_2" "fail_msg_fmt" ...
-.Fn ATF_CHECK_ERRNO "exp_errno" "bool_expression"
-.Fn ATF_REQUIRE "expression"
-.Fn ATF_REQUIRE_MSG "expression" "fail_msg_fmt" ...
-.Fn ATF_REQUIRE_EQ "expression_1" "expression_2"
-.Fn ATF_REQUIRE_EQ_MSG "expression_1" "expression_2" "fail_msg_fmt" ...
-.Fn ATF_REQUIRE_MATCH "regexp" "string"
-.Fn ATF_REQUIRE_MATCH_MSG "regexp" "string" "fail_msg_fmt" ...
-.Fn ATF_REQUIRE_STREQ "string_1" "string_2"
-.Fn ATF_REQUIRE_STREQ_MSG "string_1" "string_2" "fail_msg_fmt" ...
-.Fn ATF_REQUIRE_ERRNO "exp_errno" "bool_expression"
-.Fn ATF_TC "name"
-.Fn ATF_TC_BODY "name" "tc"
-.Fn ATF_TC_BODY_NAME "name"
-.Fn ATF_TC_CLEANUP "name" "tc"
-.Fn ATF_TC_CLEANUP_NAME "name"
-.Fn ATF_TC_HEAD "name" "tc"
-.Fn ATF_TC_HEAD_NAME "name"
-.Fn ATF_TC_NAME "name"
-.Fn ATF_TC_WITH_CLEANUP "name"
-.Fn ATF_TC_WITHOUT_HEAD "name"
-.Fn ATF_TP_ADD_TC "tp_name" "tc_name"
-.Fn ATF_TP_ADD_TCS "tp_name"
-.Fn atf_tc_get_config_var "tc" "varname"
-.Fn atf_tc_get_config_var_wd "tc" "variable_name" "default_value"
-.Fn atf_tc_get_config_var_as_bool "tc" "variable_name"
-.Fn atf_tc_get_config_var_as_bool_wd "tc" "variable_name" "default_value"
-.Fn atf_tc_get_config_var_as_long "tc" "variable_name"
-.Fn atf_tc_get_config_var_as_long_wd "tc" "variable_name" "default_value"
-.Fn atf_no_error
-.Fn atf_tc_expect_death "reason" "..."
-.Fn atf_tc_expect_exit "exitcode" "reason" "..."
-.Fn atf_tc_expect_fail "reason" "..."
-.Fn atf_tc_expect_pass
-.Fn atf_tc_expect_signal "signo" "reason" "..."
-.Fn atf_tc_expect_timeout "reason" "..."
-.Fn atf_tc_fail "reason"
-.Fn atf_tc_fail_nonfatal "reason"
-.Fn atf_tc_pass
-.Fn atf_tc_skip "reason"
-.Ft void
-.Fo atf_utils_cat_file
-.Fa "const char *file"
-.Fa "const char *prefix"
-.Fc
-.Ft bool
-.Fo atf_utils_compare_file
-.Fa "const char *file"
-.Fa "const char *contents"
-.Fc
-.Ft void
-.Fo atf_utils_copy_file
-.Fa "const char *source"
-.Fa "const char *destination"
-.Fc
-.Ft void
-.Fo atf_utils_create_file
-.Fa "const char *file"
-.Fa "const char *contents"
-.Fa "..."
-.Fc
-.Ft void
-.Fo atf_utils_file_exists
-.Fa "const char *file"
-.Fc
-.Ft pid_t
-.Fo atf_utils_fork
-.Fa "void"
-.Fc
-.Ft void
-.Fo atf_utils_free_charpp
-.Fa "char **argv"
-.Fc
-.Ft bool
-.Fo atf_utils_grep_file
-.Fa "const char *regexp"
-.Fa "const char *file"
-.Fa "..."
-.Fc
-.Ft bool
-.Fo atf_utils_grep_string
-.Fa "const char *regexp"
-.Fa "const char *str"
-.Fa "..."
-.Fc
-.Ft char *
-.Fo atf_utils_readline
-.Fa "int fd"
-.Fc
-.Ft void
-.Fo atf_utils_redirect
-.Fa "const int fd"
-.Fa "const char *file"
-.Fc
-.Ft void
-.Fo atf_utils_wait
-.Fa "const pid_t pid"
-.Fa "const int expected_exit_status"
-.Fa "const char *expected_stdout"
-.Fa "const char *expected_stderr"
-.Fc
-.Sh DESCRIPTION
-ATF provides a C programming interface to implement test programs.
-C-based test programs follow this template:
-.Bd -literal -offset indent
-.Ns ... C-specific includes go here ...
-
-#include <atf-c.h>
-
-ATF_TC(tc1);
-ATF_TC_HEAD(tc1, tc)
-{
- ... first test case's header ...
-}
-ATF_TC_BODY(tc1, tc)
-{
- ... first test case's body ...
-}
-
-ATF_TC_WITH_CLEANUP(tc2);
-ATF_TC_HEAD(tc2, tc)
-{
- ... second test case's header ...
-}
-ATF_TC_BODY(tc2, tc)
-{
- ... second test case's body ...
-}
-ATF_TC_CLEANUP(tc2, tc)
-{
- ... second test case's cleanup ...
-}
-
-ATF_TC_WITHOUT_HEAD(tc3);
-ATF_TC_BODY(tc3, tc)
-{
- ... third test case's body ...
-}
-
-.Ns ... additional test cases ...
-
-ATF_TP_ADD_TCS(tp)
-{
- ATF_TP_ADD_TC(tcs, tc1);
- ATF_TP_ADD_TC(tcs, tc2);
- ATF_TP_ADD_TC(tcs, tc3);
- ... add additional test cases ...
-
- return atf_no_error();
-}
-.Ed
-.Ss Definition of test cases
-Test cases have an identifier and are composed of three different parts:
-the header, the body and an optional cleanup routine, all of which are
-described in
-.Xr atf-test-case 4 .
-To define test cases, one can use the
-.Fn ATF_TC ,
-.Fn ATF_TC_WITH_CLEANUP
-or the
-.Fn ATF_TC_WITHOUT_HEAD
-macros, which take a single parameter specifiying the test case's name.
-.Fn ATF_TC ,
-requires to define a head and a body for the test case,
-.Fn ATF_TC_WITH_CLEANUP
-requires to define a head, a body and a cleanup for the test case and
-.Fn ATF_TC_WITHOUT_HEAD
-requires only a body for the test case.
-It is important to note that these
-.Em do not
-set the test case up for execution when the program is run.
-In order to do so, a later registration is needed with the
-.Fn ATF_TP_ADD_TC
-macro detailed in
-.Sx Program initialization .
-.Pp
-Later on, one must define the three parts of the body by means of three
-functions.
-Their headers are given by the
-.Fn ATF_TC_HEAD ,
-.Fn ATF_TC_BODY
-and
-.Fn ATF_TC_CLEANUP
-macros, all of which take the test case name provided to the
-.Fn ATF_TC
-.Fn ATF_TC_WITH_CLEANUP ,
-or
-.Fn ATF_TC_WITHOUT_HEAD
-macros and the name of the variable that will hold a pointer to the
-test case data.
-Following each of these, a block of code is expected, surrounded by the
-opening and closing brackets.
-.Ss Program initialization
-The library provides a way to easily define the test program's
-.Fn main
-function.
-You should never define one on your own, but rely on the
-library to do it for you.
-This is done by using the
-.Fn ATF_TP_ADD_TCS
-macro, which is passed the name of the object that will hold the test
-cases; i.e. the test program instance.
-This name can be whatever you want as long as it is a valid variable
-identifier.
-.Pp
-After the macro, you are supposed to provide the body of a function, which
-should only use the
-.Fn ATF_TP_ADD_TC
-macro to register the test cases the test program will execute and return
-a success error code.
-The first parameter of this macro matches the name you provided in the
-former call.
-The success status can be returned using the
-.Fn atf_no_error
-function.
-.Ss Header definitions
-The test case's header can define the meta-data by using the
-.Fn atf_tc_set_md_var
-method, which takes three parameters: the first one points to the test
-case data, the second one specifies the meta-data variable to be set
-and the third one specifies its value.
-Both of them are strings.
-.Ss Configuration variables
-The test case has read-only access to the current configuration variables
-by means of the
-.Ft bool
-.Fn atf_tc_has_config_var ,
-.Ft const char *
-.Fn atf_tc_get_config_var ,
-.Ft const char *
-.Fn atf_tc_get_config_var_wd ,
-.Ft bool
-.Fn atf_tc_get_config_var_as_bool ,
-.Ft bool
-.Fn atf_tc_get_config_var_as_bool_wd ,
-.Ft long
-.Fn atf_tc_get_config_var_as_long ,
-and the
-.Ft long
-.Fn atf_tc_get_config_var_as_long_wd
-functions, which can be called in any of the three parts of a test case.
-.Pp
-The
-.Sq _wd
-variants take a default value for the variable which is returned if the
-variable is not defined.
-The other functions without the
-.Sq _wd
-suffix
-.Em require
-the variable to be defined.
-.Ss Access to the source directory
-It is possible to get the path to the test case's source directory from any
-of its three components by querying the
-.Sq srcdir
-configuration variable.
-.Ss Requiring programs
-Aside from the
-.Va require.progs
-meta-data variable available in the header only, one can also check for
-additional programs in the test case's body by using the
-.Fn atf_tc_require_prog
-function, which takes the base name or full path of a single binary.
-Relative paths are forbidden.
-If it is not found, the test case will be automatically skipped.
-.Ss Test case finalization
-The test case finalizes either when the body reaches its end, at which
-point the test is assumed to have
-.Em passed ,
-unless any non-fatal errors were raised using
-.Fn atf_tc_fail_nonfatal ,
-or at any explicit call to
-.Fn atf_tc_pass ,
-.Fn atf_tc_fail
-or
-.Fn atf_tc_skip .
-These three functions terminate the execution of the test case immediately.
-The cleanup routine will be processed afterwards in a completely automated
-way, regardless of the test case's termination reason.
-.Pp
-.Fn atf_tc_pass
-does not take any parameters.
-.Fn atf_tc_fail ,
-.Fn atf_tc_fail_nonfatal
-and
-.Fn atf_tc_skip
-take a format string and a variable list of parameters, which describe, in
-a user-friendly manner, why the test case failed or was skipped,
-respectively.
-It is very important to provide a clear error message in both cases so that
-the user can quickly know why the test did not pass.
-.Ss Expectations
-Everything explained in the previous section changes when the test case
-expectations are redefined by the programmer.
-.Pp
-Each test case has an internal state called
-.Sq expect
-that describes what the test case expectations are at any point in time.
-The value of this property can change during execution by any of:
-.Bl -tag -width indent
-.It Fn atf_tc_expect_death "reason" "..."
-Expects the test case to exit prematurely regardless of the nature of the
-exit.
-.It Fn atf_tc_expect_exit "exitcode" "reason" "..."
-Expects the test case to exit cleanly.
-If
-.Va exitcode
-is not
-.Sq -1 ,
-the runtime engine will validate that the exit code of the test case
-matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn atf_tc_expect_fail "reason" "..."
-Any failure (be it fatal or non-fatal) raised in this mode is recorded.
-However, such failures do not report the test case as failed; instead, the
-test case finalizes cleanly and is reported as
-.Sq expected failure ;
-this report includes the provided
-.Fa reason
-as part of it.
-If no error is raised while running in this mode, then the test case is
-reported as
-.Sq failed .
-.Pp
-This mode is useful to reproduce actual known bugs in tests.
-Whenever the developer fixes the bug later on, the test case will start
-reporting a failure, signaling the developer that the test case must be
-adjusted to the new conditions.
-In this situation, it is useful, for example, to set
-.Fa reason
-as the bug number for tracking purposes.
-.It Fn atf_tc_expect_pass
-This is the normal mode of execution.
-In this mode, any failure is reported as such to the user and the test case
-is marked as
-.Sq failed .
-.It Fn atf_tc_expect_signal "signo" "reason" "..."
-Expects the test case to terminate due to the reception of a signal.
-If
-.Va signo
-is not
-.Sq -1 ,
-the runtime engine will validate that the signal that terminated the test
-case matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn atf_tc_expect_timeout "reason" "..."
-Expects the test case to execute for longer than its timeout.
-.El
-.Ss Helper macros for common checks
-The library provides several macros that are very handy in multiple
-situations.
-These basically check some condition after executing a given statement or
-processing a given expression and, if the condition is not met, they
-report the test case as failed.
-.Pp
-The
-.Sq REQUIRE
-variant of the macros immediately abort the test case as soon as an error
-condition is detected by calling the
-.Fn atf_tc_fail
-function.
-Use this variant whenever it makes no sense to continue the execution of a
-test case when the checked condition is not met.
-The
-.Sq CHECK
-variant, on the other hand, reports a failure as soon as it is encountered
-using the
-.Fn atf_tc_fail_nonfatal
-function, but the execution of the test case continues as if nothing had
-happened.
-Use this variant whenever the checked condition is important as a result of
-the test case, but there are other conditions that can be subsequently
-checked on the same run without aborting.
-.Pp
-Additionally, the
-.Sq MSG
-variants take an extra set of parameters to explicitly specify the failure
-message.
-This failure message is formatted according to the
-.Xr printf 3
-formatters.
-.Pp
-.Fn ATF_CHECK ,
-.Fn ATF_CHECK_MSG ,
-.Fn ATF_REQUIRE
-and
-.Fn ATF_REQUIRE_MSG
-take an expression and fail if the expression evaluates to false.
-.Pp
-.Fn ATF_CHECK_EQ ,
-.Fn ATF_CHECK_EQ_MSG ,
-.Fn ATF_REQUIRE_EQ
-and
-.Fn ATF_REQUIRE_EQ_MSG
-take two expressions and fail if the two evaluated values are not equal.
-.Pp
-.Fn ATF_CHECK_MATCH ,
-.Fn ATF_CHECK_MATCH_MSG ,
-.Fn ATF_REQUIRE_MATCH
-and
-.Fn ATF_REQUIRE_MATCH_MSG
-take a regular expression and a string and fail if the regular expression does
-not match the given string.
-Note that the regular expression is not anchored, so it will match anywhere in
-the string.
-.Pp
-.Fn ATF_CHECK_STREQ ,
-.Fn ATF_CHECK_STREQ_MSG ,
-.Fn ATF_REQUIRE_STREQ
-and
-.Fn ATF_REQUIRE_STREQ_MSG
-take two strings and fail if the two are not equal character by character.
-.Pp
-.Fn ATF_CHECK_ERRNO
-and
-.Fn ATF_REQUIRE_ERRNO
-take, first, the error code that the check is expecting to find in the
-.Va errno
-variable and, second, a boolean expression that, if evaluates to true,
-means that a call failed and
-.Va errno
-has to be checked against the first value.
-.Ss Utility functions
-The following functions are provided as part of the
-.Nm
-API to simplify the creation of a variety of tests.
-In particular, these are useful to write tests for command-line interfaces.
-.Pp
-.Ft void
-.Fo atf_utils_cat_file
-.Fa "const char *file"
-.Fa "const char *prefix"
-.Fc
-.Bd -ragged -offset indent
-Prints the contents of
-.Fa file
-to the standard output, prefixing every line with the string in
-.Fa prefix .
-.Ed
-.Pp
-.Ft bool
-.Fo atf_utils_compare_file
-.Fa "const char *file"
-.Fa "const char *contents"
-.Fc
-.Bd -ragged -offset indent
-Returns true if the given
-.Fa file
-matches exactly the expected inlined
-.Fa contents .
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_copy_file
-.Fa "const char *source"
-.Fa "const char *destination"
-.Fc
-.Bd -ragged -offset indent
-Copies the file
-.Fa source
-to
-.Fa destination .
-The permissions of the file are preserved during the code.
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_create_file
-.Fa "const char *file"
-.Fa "const char *contents"
-.Fa "..."
-.Fc
-.Bd -ragged -offset indent
-Creates
-.Fa file
-with the text given in
-.Fa contents ,
-which is a formatting string that uses the rest of the variable arguments.
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_file_exists
-.Fa "const char *file"
-.Fc
-.Bd -ragged -offset indent
-Checks if
-.Fa file
-exists.
-.Ed
-.Pp
-.Ft pid_t
-.Fo atf_utils_fork
-.Fa "void"
-.Fc
-.Bd -ragged -offset indent
-Forks a process and redirects the standard output and standard error of the
-child to files for later validation with
-.Fn atf_utils_wait .
-Fails the test case if the fork fails, so this does not return an error.
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_free_charpp
-.Fa "char **argv"
-.Fc
-.Bd -ragged -offset indent
-Frees a dynamically-allocated array of dynamically-allocated strings.
-.Ed
-.Pp
-.Ft bool
-.Fo atf_utils_grep_file
-.Fa "const char *regexp"
-.Fa "const char *file"
-.Fa "..."
-.Fc
-.Bd -ragged -offset indent
-Searches for the
-.Fa regexp ,
-which is a formatting string representing the regular expression,
-in the
-.Fa file .
-The variable arguments are used to construct the regular expression.
-.Ed
-.Pp
-.Ft bool
-.Fo atf_utils_grep_string
-.Fa "const char *regexp"
-.Fa "const char *str"
-.Fa "..."
-.Fc
-.Bd -ragged -offset indent
-Searches for the
-.Fa regexp ,
-which is a formatting string representing the regular expression,
-in the literal string
-.Fa str .
-The variable arguments are used to construct the regular expression.
-.Ed
-.Pp
-.Ft char *
-.Fo atf_utils_readline
-.Fa "int fd"
-.Fc
-.Bd -ragged -offset indent
-Reads a line from the file descriptor
-.Fa fd .
-The line, if any, is returned as a dynamically-allocated buffer that must be
-released with
-.Xr free 3 .
-If there was nothing to read, returns
-.Sq NULL .
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_redirect
-.Fa "const int fd"
-.Fa "const char *file"
-.Fc
-.Bd -ragged -offset indent
-Redirects the given file descriptor
-.Fa fd
-to
-.Fa file .
-This function exits the process in case of an error and does not properly mark
-the test case as failed.
-As a result, it should only be used in subprocesses of the test case; specially
-those spawned by
-.Fn atf_utils_fork .
-.Ed
-.Pp
-.Ft void
-.Fo atf_utils_wait
-.Fa "const pid_t pid"
-.Fa "const int expected_exit_status"
-.Fa "const char *expected_stdout"
-.Fa "const char *expected_stderr"
-.Fc
-.Bd -ragged -offset indent
-Waits and validates the result of a subprocess spawned with
-.Fn atf_utils_wait .
-The validation involves checking that the subprocess exited cleanly and returned
-the code specified in
-.Fa expected_exit_status
-and that its standard output and standard error match the strings given in
-.Fa expected_stdout
-and
-.Fa expected_stderr .
-.Pp
-If any of the
-.Fa expected_stdout
-or
-.Fa expected_stderr
-strings are prefixed with
-.Sq save: ,
-then they specify the name of the file into which to store the stdout or stderr
-of the subprocess, and no comparison is performed.
-.Ed
-.Sh EXAMPLES
-The following shows a complete test program with a single test case that
-validates the addition operator:
-.Bd -literal -offset indent
-#include <atf-c.h>
-
-ATF_TC(addition);
-ATF_TC_HEAD(addition, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Sample tests for the addition operator");
-}
-ATF_TC_BODY(addition, tc)
-{
- ATF_CHECK_EQ(0 + 0, 0);
- ATF_CHECK_EQ(0 + 1, 1);
- ATF_CHECK_EQ(1 + 0, 1);
-
- ATF_CHECK_EQ(1 + 1, 2);
-
- ATF_CHECK_EQ(100 + 200, 300);
-}
-
-ATF_TC(string_formatting);
-ATF_TC_HEAD(string_formatting, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Sample tests for the snprintf");
-}
-ATF_TC_BODY(string_formatting, tc)
-{
- char buf[1024];
- snprintf(buf, sizeof(buf), "a %s", "string");
- ATF_CHECK_STREQ_MSG("a string", buf, "%s is not working");
-}
-
-ATF_TC(open_failure);
-ATF_TC_HEAD(open_failure, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Sample tests for the open function");
-}
-ATF_TC_BODY(open_failure, tc)
-{
- ATF_CHECK_ERRNO(ENOENT, open("non-existent", O_RDONLY) == -1);
-}
-
-ATF_TC(known_bug);
-ATF_TC_HEAD(known_bug, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Reproduces a known bug");
-}
-ATF_TC_BODY(known_bug, tc)
-{
- atf_tc_expect_fail("See bug number foo/bar");
- ATF_CHECK_EQ(3, 1 + 1);
- atf_tc_expect_pass();
- ATF_CHECK_EQ(3, 1 + 2);
-}
-
-ATF_TP_ADD_TCS(tp)
-{
- ATF_TP_ADD_TC(tp, addition);
- ATF_TP_ADD_TC(tp, string_formatting);
- ATF_TP_ADD_TC(tp, open_failure);
- ATF_TP_ADD_TC(tp, known_bug);
-
- return atf_no_error();
-}
-.Ed
-.Sh SEE ALSO
-.Xr atf-test-program 1 ,
-.Xr atf-test-case 4
diff --git a/contrib/atf/atf-c/atf-c.3 b/contrib/atf/atf-c/atf-c.3
index edb7207..d3e6b90 100644
--- a/contrib/atf/atf-c/atf-c.3
+++ b/contrib/atf/atf-c/atf-c.3
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd October 13, 2014
+.Dd March 6, 2017
.Dt ATF-C 3
.Os
.Sh NAME
@@ -203,7 +203,7 @@
ATF provides a C programming interface to implement test programs.
C-based test programs follow this template:
.Bd -literal -offset indent
-.Ns ... C-specific includes go here ...
+\&... C-specific includes go here ...
#include <atf-c.h>
@@ -237,7 +237,7 @@ ATF_TC_BODY(tc3, tc)
... third test case's body ...
}
-.Ns ... additional test cases ...
+\&... additional test cases ...
ATF_TP_ADD_TCS(tp)
{
@@ -259,7 +259,7 @@ To define test cases, one can use the
.Fn ATF_TC_WITH_CLEANUP
or the
.Fn ATF_TC_WITHOUT_HEAD
-macros, which take a single parameter specifiying the test case's name.
+macros, which take a single parameter specifying the test case's name.
.Fn ATF_TC ,
requires to define a head and a body for the test case,
.Fn ATF_TC_WITH_CLEANUP
@@ -299,7 +299,7 @@ library to do it for you.
This is done by using the
.Fn ATF_TP_ADD_TCS
macro, which is passed the name of the object that will hold the test
-cases; i.e. the test program instance.
+cases, i.e., the test program instance.
This name can be whatever you want as long as it is a valid variable
identifier.
.Pp
diff --git a/contrib/atf/atf-sh/atf-check.1 b/contrib/atf/atf-sh/atf-check.1
index a3bd379..a423e3a 100644
--- a/contrib/atf/atf-sh/atf-check.1
+++ b/contrib/atf/atf-sh/atf-check.1
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd October 5, 2014
+.Dd March 6, 2017
.Dt ATF-CHECK 1
.Os
.Sh NAME
@@ -40,10 +40,12 @@
executes a given command and analyzes its results, including
exit code, stdout and stderr.
.Pp
-.Em Test cases must use
-.Em Xr atf-sh 3 Ns ' Ns s
-.Em Nm atf_check
-.Em builtin function instead of calling this utility directly.
+.Bf Em
+Test cases must use
+.Xr atf-sh 3 Ns ' Ns s
+.Nm atf_check
+builtin function instead of calling this utility directly.
+.Ef
.Pp
In the first synopsis form,
.Nm
@@ -119,9 +121,6 @@ as a shell command line, executing it with the system shell defined by
You should avoid using this flag if at all possible to prevent shell quoting
issues.
.El
-.Sh EXIT STATUS
-.Nm
-exits 0 on success, and other (unspecified) value on failure.
.Sh ENVIRONMENT
.Bl -tag -width ATFXSHELLXX -compact
.It Va ATF_SHELL
@@ -129,6 +128,9 @@ Path to the system shell to be used when the
.Fl x
is given to run commands.
.El
+.Sh EXIT STATUS
+.Nm
+exits 0 on success, and other (unspecified) value on failure.
.Sh EXAMPLES
The following are sample invocations from within a test case.
Note that we use the
diff --git a/contrib/atf/atf-sh/atf-sh-api.3 b/contrib/atf/atf-sh/atf-sh-api.3
deleted file mode 100644
index a30aee7..0000000
--- a/contrib/atf/atf-sh/atf-sh-api.3
+++ /dev/null
@@ -1,340 +0,0 @@
-.\"
-.\" Automated Testing Framework (atf)
-.\"
-.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
-.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
-.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd March 2, 2014
-.Dt ATF-SH-API 3
-.Os
-.Sh NAME
-.Nm atf_add_test_case ,
-.Nm atf_check ,
-.Nm atf_check_equal ,
-.Nm atf_config_get ,
-.Nm atf_config_has ,
-.Nm atf_expect_death ,
-.Nm atf_expect_exit ,
-.Nm atf_expect_fail ,
-.Nm atf_expect_pass ,
-.Nm atf_expect_signal ,
-.Nm atf_expect_timeout ,
-.Nm atf_fail ,
-.Nm atf_get ,
-.Nm atf_get_srcdir ,
-.Nm atf_pass ,
-.Nm atf_require_prog ,
-.Nm atf_set ,
-.Nm atf_skip ,
-.Nm atf_test_case
-.Nd POSIX shell API to write ATF-based test programs
-.Sh SYNOPSIS
-.Fn atf_add_test_case "name"
-.Fn atf_check "command"
-.Fn atf_check_equal "expr1" "expr2"
-.Fn atf_config_get "var_name"
-.Fn atf_config_has "var_name"
-.Fn atf_expect_death "reason" "..."
-.Fn atf_expect_exit "exitcode" "reason" "..."
-.Fn atf_expect_fail "reason" "..."
-.Fn atf_expect_pass
-.Fn atf_expect_signal "signo" "reason" "..."
-.Fn atf_expect_timeout "reason" "..."
-.Fn atf_fail "reason"
-.Fn atf_get "var_name"
-.Fn atf_get_srcdir
-.Fn atf_pass
-.Fn atf_require_prog "prog_name"
-.Fn atf_set "var_name" "value"
-.Fn atf_skip "reason"
-.Fn atf_test_case "name" "cleanup"
-.Sh DESCRIPTION
-ATF
-provides a simple but powerful interface to easily write test programs in
-the POSIX shell language.
-These are extremely helpful given that they are trivial to write due to the
-language simplicity and the great deal of available external tools, so they
-are often ideal to test other applications at the user level.
-.Pp
-Test programs written using this library must be run using the
-.Xr atf-sh 1
-interpreter by putting the following on their very first line:
-.Bd -literal -offset indent
-#! /usr/bin/env atf-sh
-.Ed
-.Pp
-Shell-based test programs always follow this template:
-.Bd -literal -offset indent
-atf_test_case tc1
-tc1_head() {
- ... first test case's header ...
-}
-tc1_body() {
- ... first test case's body ...
-}
-
-atf_test_case tc2 cleanup
-tc2_head() {
- ... second test case's header ...
-}
-tc2_body() {
- ... second test case's body ...
-}
-tc2_cleanup() {
- ... second test case's cleanup ...
-}
-
-.Ns ... additional test cases ...
-
-atf_init_test_cases() {
- atf_add_test_case tc1
- atf_add_test_case tc2
- ... add additional test cases ...
-}
-.Ed
-.Ss Definition of test cases
-Test cases have an identifier and are composed of three different parts:
-the header, the body and an optional cleanup routine, all of which are
-described in
-.Xr atf-test-case 4 .
-To define test cases, one can use the
-.Fn atf_test_case
-function, which takes a first parameter specifiying the test case's
-name and instructs the library to set things up to accept it as a valid
-test case.
-The second parameter is optional and, if provided, must be
-.Sq cleanup ;
-providing this parameter allows defining a cleanup routine for the test
-case.
-It is important to note that this function
-.Em does not
-set the test case up for execution when the program is run.
-In order to do so, a later registration is needed through the
-.Fn atf_add_test_case
-function detailed in
-.Sx Program initialization .
-.Pp
-Later on, one must define the three parts of the body by providing two
-or three functions (remember that the cleanup routine is optional).
-These functions are named after the test case's identifier, and are
-.Fn <id>_head ,
-.Fn <id>_body
-and
-.Fn <id>_cleanup.
-None of these take parameters when executed.
-.Ss Program initialization
-The test program must define an
-.Fn atf_init_test_cases
-function, which is in charge of registering the test cases that will be
-executed at run time by using the
-.Fn atf_add_test_case
-function, which takes the name of a test case as its single parameter.
-This main function should not do anything else, except maybe sourcing
-auxiliary source files that define extra variables and functions.
-.Ss Configuration variables
-The test case has read-only access to the current configuration variables
-through the
-.Fn atf_config_has
-and
-.Fn atf_config_get
-methods.
-The former takes a single parameter specifying a variable name and returns
-a boolean indicating whether the variable is defined or not.
-The latter can take one or two parameters.
-If it takes only one, it specifies the variable from which to get the
-value, and this variable must be defined.
-If it takes two, the second one specifies a default value to be returned
-if the variable is not available.
-.Ss Access to the source directory
-It is possible to get the path to the test case's source directory from
-anywhere in the test program by using the
-.Fn atf_get_srcdir
-function.
-It is interesting to note that this can be used inside
-.Fn atf_init_test_cases
-to silently include additional helper files from the source directory.
-.Ss Requiring programs
-Aside from the
-.Va require.progs
-meta-data variable available in the header only, one can also check for
-additional programs in the test case's body by using the
-.Fn atf_require_prog
-function, which takes the base name or full path of a single binary.
-Relative paths are forbidden.
-If it is not found, the test case will be automatically skipped.
-.Ss Test case finalization
-The test case finalizes either when the body reaches its end, at which
-point the test is assumed to have
-.Em passed ,
-or at any explicit call to
-.Fn atf_pass ,
-.Fn atf_fail
-or
-.Fn atf_skip .
-These three functions terminate the execution of the test case immediately.
-The cleanup routine will be processed afterwards in a completely automated
-way, regardless of the test case's termination reason.
-.Pp
-.Fn atf_pass
-does not take any parameters.
-.Fn atf_fail
-and
-.Fn atf_skip
-take a single string parameter that describes why the test case failed or
-was skipped, respectively.
-It is very important to provide a clear error message in both cases so that
-the user can quickly know why the test did not pass.
-.Ss Expectations
-Everything explained in the previous section changes when the test case
-expectations are redefined by the programmer.
-.Pp
-Each test case has an internal state called
-.Sq expect
-that describes what the test case expectations are at any point in time.
-The value of this property can change during execution by any of:
-.Bl -tag -width indent
-.It Fn atf_expect_death "reason" "..."
-Expects the test case to exit prematurely regardless of the nature of the
-exit.
-.It Fn atf_expect_exit "exitcode" "reason" "..."
-Expects the test case to exit cleanly.
-If
-.Va exitcode
-is not
-.Sq -1 ,
-the runtime engine will validate that the exit code of the test case
-matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn atf_expect_fail "reason"
-Any failure raised in this mode is recorded, but such failures do not report
-the test case as failed; instead, the test case finalizes cleanly and is
-reported as
-.Sq expected failure ;
-this report includes the provided
-.Fa reason
-as part of it.
-If no error is raised while running in this mode, then the test case is
-reported as
-.Sq failed .
-.Pp
-This mode is useful to reproduce actual known bugs in tests.
-Whenever the developer fixes the bug later on, the test case will start
-reporting a failure, signaling the developer that the test case must be
-adjusted to the new conditions.
-In this situation, it is useful, for example, to set
-.Fa reason
-as the bug number for tracking purposes.
-.It Fn atf_expect_pass
-This is the normal mode of execution.
-In this mode, any failure is reported as such to the user and the test case
-is marked as
-.Sq failed .
-.It Fn atf_expect_signal "signo" "reason" "..."
-Expects the test case to terminate due to the reception of a signal.
-If
-.Va signo
-is not
-.Sq -1 ,
-the runtime engine will validate that the signal that terminated the test
-case matches the one provided in this call.
-Otherwise, the exact value will be ignored.
-.It Fn atf_expect_timeout "reason" "..."
-Expects the test case to execute for longer than its timeout.
-.El
-.Ss Helper functions for common checks
-.Fn atf_check [options] command [args]
-.Pp
-This function wraps the execution of the
-.Nm atf-check
-tool and makes the test case fail if the tool reports failure.
-You should always use this function instead of the tool in your scripts.
-For more details on the parameters of this function, refer to
-.Xr atf-check 1 .
-.Pp
-.Fn atf_check_equal expr1 expr2
-.Pp
-This function takes two expressions, evaluates them and, if their
-results differ, aborts the test case with an appropriate failure message.
-.Sh EXAMPLES
-The following shows a complete test program with a single test case that
-validates the addition operator:
-.Bd -literal -offset indent
-atf_test_case addition
-addition_head() {
- atf_set "descr" "Sample tests for the addition operator"
-}
-addition_body() {
- atf_check_equal $((0 + 0)) 0
- atf_check_equal $((0 + 1)) 1
- atf_check_equal $((1 + 0)) 0
-
- atf_check_equal $((1 + 1)) 2
-
- atf_check_equal $((100 + 200)) 300
-}
-
-atf_init_test_cases() {
- atf_add_test_case addition
-}
-.Ed
-.Pp
-This other example shows how to include a file with extra helper functions
-in the test program:
-.Bd -literal -offset indent
-.Ns ... definition of test cases ...
-
-atf_init_test_cases() {
- . $(atf_get_srcdir)/helper_functions.sh
-
- atf_add_test_case foo1
- atf_add_test_case foo2
-}
-.Ed
-.Pp
-This example demonstrates the use of the very useful
-.Fn atf_check
-function:
-.Bd -literal -offset indent
-# Check for silent output
-atf_check -s exit:0 -o empty -e empty 'true'
-
-# Check for silent output and failure
-atf_check -s exit:1 -o empty -e empty 'false'
-
-# Check for known stdout and silent stderr
-echo foo >expout
-atf_check -s exit:0 -o file:expout -e empty 'echo foo'
-
-# Generate a file for later inspection
-atf_check -s exit:0 -o save:stdout -e empty 'ls'
-grep foo ls || atf_fail "foo file not found in listing"
-
-# Or just do the match along the way
-atf_check -s exit:0 -o match:"^foo$" -e empty 'ls'
-.Ed
-.Sh SEE ALSO
-.Xr atf-sh 1 ,
-.Xr atf-test-program 1 ,
-.Xr atf-test-case 4
diff --git a/contrib/atf/atf-sh/atf-sh.1 b/contrib/atf/atf-sh/atf-sh.1
index ac4a135..b81bd18 100644
--- a/contrib/atf/atf-sh/atf-sh.1
+++ b/contrib/atf/atf-sh/atf-sh.1
@@ -22,15 +22,15 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd September 27, 2014
+.Dd March 6, 2017
.Dt ATF-SH 1
.Os
.Sh NAME
.Nm atf-sh
-.Op Fl s Ar shell
.Nd interpreter for shell-based test programs
.Sh SYNOPSIS
.Nm
+.Op Fl s Ar shell
.Ar script
.Sh DESCRIPTION
.Nm
@@ -75,6 +75,8 @@ Should not be overridden other than for testing purposes.
Path to the system shell to be used in the generated scripts.
Scripts must not rely on this variable being set to select a specific
interpreter.
+.It Va ATF_SHELL
+Path to the system shell to be used in the generated scripts.
.El
.Sh EXAMPLES
Scripts using
@@ -98,10 +100,5 @@ option afterwards as a
.Bd -literal -offset indent
#! /path/to/bin/atf-sh -s/bin/bash
.Ed
-.Sh ENVIRONMENT
-.Bl -tag -width ATFXSHELLXX -compact
-.It Va ATF_SHELL
-Path to the system shell to be used in the generated scripts.
-.El
.Sh SEE ALSO
.Xr atf-sh 3
diff --git a/contrib/atf/atf-sh/atf-sh.3 b/contrib/atf/atf-sh/atf-sh.3
index be56539..0d0db2f7 100644
--- a/contrib/atf/atf-sh/atf-sh.3
+++ b/contrib/atf/atf-sh/atf-sh.3
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd October 13, 2014
+.Dd March 6, 2017
.Dt ATF-SH 3
.Os
.Sh NAME
@@ -129,7 +129,7 @@ tc2_cleanup() {
... second test case's cleanup ...
}
-.Ns ... additional test cases ...
+\&... additional test cases ...
atf_init_test_cases() {
atf_add_test_case tc1
@@ -144,7 +144,7 @@ described in
.Xr atf-test-case 4 .
To define test cases, one can use the
.Nm atf_test_case
-function, which takes a first parameter specifiying the test case's
+function, which takes a first parameter specifying the test case's
name and instructs the library to set things up to accept it as a valid
test case.
The second parameter is optional and, if provided, must be
@@ -334,7 +334,7 @@ atf_init_test_cases() {
This other example shows how to include a file with extra helper functions
in the test program:
.Bd -literal -offset indent
-.Ns ... definition of test cases ...
+\&... definition of test cases ...
atf_init_test_cases() {
. $(atf_get_srcdir)/helper_functions.sh
diff --git a/contrib/atf/doc/atf-test-case.4 b/contrib/atf/doc/atf-test-case.4
index 3025411..34f5e1b 100644
--- a/contrib/atf/doc/atf-test-case.4
+++ b/contrib/atf/doc/atf-test-case.4
@@ -22,7 +22,7 @@
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.Dd October 5, 2014
+.Dd March 6, 2017
.Dt ATF-TEST-CASE 4
.Os
.Sh NAME
@@ -79,8 +79,8 @@ Upon termination, a test case reports a status and, optionally, a textual
reason describing why the test reported such status.
The caller must ensure that the test case really performed the task that its
status describes, as the test program may be bogus and therefore providing a
-misleading result (e.g. providing a result that indicates success but the
-error code of the program says otherwise).
+misleading result, e.g., providing a result that indicates success but the
+error code of the program says otherwise.
.Pp
The possible exit status of a test case are one of the following:
.Bl -tag -width expectedXfailureXX
diff --git a/contrib/binutils/gas/config/tc-mips.c b/contrib/binutils/gas/config/tc-mips.c
index 80fdfd0..d1f745e 100644
--- a/contrib/binutils/gas/config/tc-mips.c
+++ b/contrib/binutils/gas/config/tc-mips.c
@@ -15156,6 +15156,7 @@ static const struct mips_cpu_info mips_cpu_info_table[] =
/* Cavium Networks Octeon CPU core */
{ "octeon", 0, ISA_MIPS64R2, CPU_OCTEON },
+ { "octeon+", 0, ISA_MIPS64R2, CPU_OCTEON },
/* End marker */
{ NULL, 0, 0, 0 }
diff --git a/contrib/blacklist/bin/blacklistd.c b/contrib/blacklist/bin/blacklistd.c
index a497f9d..256ae68 100644
--- a/contrib/blacklist/bin/blacklistd.c
+++ b/contrib/blacklist/bin/blacklistd.c
@@ -207,7 +207,7 @@ process(bl_t bl)
if (debug) {
char b1[128], b2[128];
- (*lfun)(LOG_DEBUG, "%s: db state info for %s: count=%d/%d "
+ (*lfun)(LOG_DEBUG, "%s: initial db state for %s: count=%d/%d "
"last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
fmttime(b1, sizeof(b1), dbi.last),
fmttime(b2, sizeof(b2), ts.tv_sec));
@@ -246,15 +246,24 @@ process(bl_t bl)
case BL_DELETE:
if (dbi.last == 0)
goto out;
+ dbi.count = 0;
dbi.last = 0;
break;
default:
(*lfun)(LOG_ERR, "unknown message %d", bi->bi_type);
}
- if (state_put(state, &c, &dbi) == -1)
- goto out;
+ state_put(state, &c, &dbi);
+
out:
close(bi->bi_fd);
+
+ if (debug) {
+ char b1[128], b2[128];
+ (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d "
+ "last=%s now=%s", __func__, rbuf, dbi.count, c.c_nfail,
+ fmttime(b1, sizeof(b1), dbi.last),
+ fmttime(b2, sizeof(b2), ts.tv_sec));
+ }
}
static void
@@ -393,7 +402,7 @@ rules_restore(void)
int
main(int argc, char *argv[])
{
- int c, tout, flags, flush, restore;
+ int c, tout, flags, flush, restore, ret;
const char *spath, *blsock;
setprogname(argv[0]);
@@ -512,7 +521,10 @@ main(int argc, char *argv[])
readconf = 0;
conf_parse(configfile);
}
- switch (poll(pfd, (nfds_t)nfd, tout)) {
+ ret = poll(pfd, (nfds_t)nfd, tout);
+ if (debug)
+ (*lfun)(LOG_DEBUG, "received %d from poll()", ret);
+ switch (ret) {
case -1:
if (errno == EINTR)
continue;
diff --git a/contrib/blacklist/libexec/blacklistd-helper b/contrib/blacklist/libexec/blacklistd-helper
index b5932f6..37f94a6 100644
--- a/contrib/blacklist/libexec/blacklistd-helper
+++ b/contrib/blacklist/libexec/blacklistd-helper
@@ -63,8 +63,11 @@ add)
tname="port$6"
/sbin/ipfw table $tname create type addr 2>/dev/null
/sbin/ipfw -q table $tname add "$addr/$mask"
- /sbin/ipfw -q add $rule drop $3 from "table("$tname")" to \
- any dst-port $6 && echo OK
+ # if rule number $rule does not already exist, create it
+ /sbin/ipfw show $rule >/dev/null 2>&1 || \
+ /sbin/ipfw add $rule drop $3 from \
+ table"("$tname")" to any dst-port $6 >/dev/null && \
+ echo OK
;;
npf)
/sbin/npfctl rule "$2" add block in final $proto from \
diff --git a/contrib/gcc/config/mips/mips.c b/contrib/gcc/config/mips/mips.c
index faa4e46..5a7792c 100644
--- a/contrib/gcc/config/mips/mips.c
+++ b/contrib/gcc/config/mips/mips.c
@@ -765,6 +765,7 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
/* MIPS64R2 */
{ "octeon", PROCESSOR_OCTEON, 65 },
+ { "octeon+", PROCESSOR_OCTEON, 65 },
/* End marker */
{ 0, 0, 0 }
diff --git a/contrib/gcc/config/mips/mips.h b/contrib/gcc/config/mips/mips.h
index 1ba1402..cba35a2 100644
--- a/contrib/gcc/config/mips/mips.h
+++ b/contrib/gcc/config/mips/mips.h
@@ -285,7 +285,10 @@ extern const struct mips_rtx_cost_data *mips_cost;
\
macro = concat ((PREFIX), "_", (INFO)->name, NULL); \
for (p = macro; *p != 0; p++) \
- *p = TOUPPER (*p); \
+ if (*p == '+') \
+ *p = 'P'; \
+ else \
+ *p = TOUPPER (*p); \
\
builtin_define (macro); \
builtin_define_with_value ((PREFIX), (INFO)->name, 1); \
diff --git a/contrib/ipfilter/lib/rwlock_emul.c b/contrib/ipfilter/lib/rwlock_emul.c
index 24d00a5..f2f2ed1 100644
--- a/contrib/ipfilter/lib/rwlock_emul.c
+++ b/contrib/ipfilter/lib/rwlock_emul.c
@@ -56,6 +56,27 @@ void eMrwlock_write_enter(rw, file, line)
}
+void eMrwlock_try_upgrade(rw, file, line)
+ eMrwlock_t *rw;
+ char *file;
+ int line;
+{
+ if (rw->eMrw_magic != EMM_MAGIC) {
+ fprintf(stderr, "%s:eMrwlock_write_enter(%p): bad magic: %#x\n",
+ rw->eMrw_owner, rw, rw->eMrw_magic);
+ abort();
+ }
+ if (rw->eMrw_read != 0 || rw->eMrw_write != 0) {
+ fprintf(stderr,
+ "%s:eMrwlock_try_upgrade(%p): already locked: %d/%d\n",
+ rw->eMrw_owner, rw, rw->eMrw_read, rw->eMrw_write);
+ abort();
+ }
+ rw->eMrw_write++;
+ rw->eMrw_heldin = file;
+ rw->eMrw_heldat = line;
+}
+
void eMrwlock_downgrade(rw, file, line)
eMrwlock_t *rw;
char *file;
diff --git a/contrib/ipfilter/lib/save_v2trap.c b/contrib/ipfilter/lib/save_v2trap.c
index 78e76f6..0507be9 100644
--- a/contrib/ipfilter/lib/save_v2trap.c
+++ b/contrib/ipfilter/lib/save_v2trap.c
@@ -124,8 +124,10 @@ snmpv2_parse(char **strings)
str = strdup(*strings);
ctx = calloc(1, sizeof(*ctx));
- if (ctx == NULL)
+ if (ctx == NULL) {
+ free(str);
return NULL;
+ }
ctx->fd = -1;
diff --git a/contrib/libc-vis/vis.c b/contrib/libc-vis/vis.c
index b4a5f32..aeae86c 100644
--- a/contrib/libc-vis/vis.c
+++ b/contrib/libc-vis/vis.c
@@ -353,12 +353,14 @@ makeextralist(int flags, const char *src)
wchar_t *dst, *d;
size_t len;
const wchar_t *s;
+ mbstate_t mbstate;
+ bzero(&mbstate, sizeof(mbstate));
len = strlen(src);
if ((dst = calloc(len + MAXEXTRAS, sizeof(*dst))) == NULL)
return NULL;
- if ((flags & VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) {
+ if ((flags & VIS_NOLOCALE) || mbsrtowcs(dst, &src, len, &mbstate) == (size_t)-1) {
size_t i;
for (i = 0; i < len; i++)
dst[i] = (wchar_t)(u_char)src[i];
@@ -400,6 +402,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
int clen = 0, cerr, error = -1, i, shft;
char *mbdst, *mdst;
ssize_t mbslength, maxolen;
+ mbstate_t mbstate;
_DIAGASSERT(mbdstp != NULL);
_DIAGASSERT(mbsrc != NULL || mblength == 0);
@@ -456,10 +459,11 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
*/
if (mbslength == 1)
mbslength++;
+ bzero(&mbstate, sizeof(mbstate));
while (mbslength > 0) {
/* Convert one multibyte character to wchar_t. */
if (!cerr)
- clen = mbtowc(src, mbsrc, MB_LEN_MAX);
+ clen = mbrtowc(src, mbsrc, MB_LEN_MAX, &mbstate);
if (cerr || clen < 0) {
/* Conversion error, process as a byte instead. */
*src = (wint_t)(u_char)*mbsrc;
@@ -530,9 +534,10 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
len = wcslen(start);
maxolen = dlen ? *dlen : (wcslen(start) * MB_LEN_MAX + 1);
olen = 0;
+ bzero(&mbstate, sizeof(mbstate));
for (dst = start; len > 0; len--) {
if (!cerr)
- clen = wctomb(mbdst, *dst);
+ clen = wcrtomb(mbdst, *dst, &mbstate);
if (cerr || clen < 0) {
/*
* Conversion error, process as a byte(s) instead.
diff --git a/contrib/libucl/ChangeLog.md b/contrib/libucl/ChangeLog.md
index e432f84..e4c1263 100644
--- a/contrib/libucl/ChangeLog.md
+++ b/contrib/libucl/ChangeLog.md
@@ -35,7 +35,7 @@
### Libucl 0.7.3
-- Fixed a bug with macroes that come after an empty object
+- Fixed a bug with macros that come after an empty object
- Fixed a bug in include processing when an incorrect variable has been destroyed (use-after-free)
### Libucl 0.8.0
diff --git a/contrib/libucl/README.md b/contrib/libucl/README.md
index 453a7ad..44983c5 100644
--- a/contrib/libucl/README.md
+++ b/contrib/libucl/README.md
@@ -1,6 +1,8 @@
# LIBUCL
-[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl)[![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138)[![Coverage Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master)
+[![Build Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl)
+[![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138)
+[![Coverage Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master)
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
@@ -217,8 +219,8 @@ Multiline comments may be nested:
UCL supports external macros both multiline and single line ones:
```nginx
-.macro "sometext";
-.macro {
+.macro_name "sometext";
+.macro_name {
Some long text
....
};
@@ -229,12 +231,12 @@ arguments themselves are the UCL object that is parsed and passed to a macro as
options:
```nginx
-.macro(param=value) "something";
-.macro(param={key=value}) "something";
-.macro(.include "params.conf") "something";
-.macro(#this is multiline macro
+.macro_name(param=value) "something";
+.macro_name(param={key=value}) "something";
+.macro_name(.include "params.conf") "something";
+.macro_name(#this is multiline macro
param = [value1, value2]) "something";
-.macro(key="()") "something";
+.macro_name(key="()") "something";
```
UCL also provide a convenient `include` macro to load content from another files
diff --git a/contrib/libucl/configure.ac b/contrib/libucl/configure.ac
index 722def8..6457268 100644
--- a/contrib/libucl/configure.ac
+++ b/contrib/libucl/configure.ac
@@ -39,6 +39,7 @@ AC_CHECK_HEADERS_ONCE([stdarg.h])
AC_CHECK_HEADERS_ONCE([stdbool.h])
AC_CHECK_HEADERS_ONCE([stdint.h])
AC_CHECK_HEADERS_ONCE([string.h])
+AC_CHECK_HEADERS_ONCE([strings.h])
AC_CHECK_HEADERS_ONCE([unistd.h])
AC_CHECK_HEADERS_ONCE([ctype.h])
AC_CHECK_HEADERS_ONCE([errno.h])
diff --git a/contrib/libucl/include/ucl.h b/contrib/libucl/include/ucl.h
index 304d329..fccf6fc 100644
--- a/contrib/libucl/include/ucl.h
+++ b/contrib/libucl/include/ucl.h
@@ -154,7 +154,8 @@ typedef enum ucl_parser_flags {
UCL_PARSER_NO_TIME = (1 << 2), /**< Do not parse time and treat time values as strings */
UCL_PARSER_NO_IMPLICIT_ARRAYS = (1 << 3), /** Create explicit arrays instead of implicit ones */
UCL_PARSER_SAVE_COMMENTS = (1 << 4), /** Save comments in the parser context */
- UCL_PARSER_DISABLE_MACRO = (1 << 5) /** Treat macros as comments */
+ UCL_PARSER_DISABLE_MACRO = (1 << 5), /** Treat macros as comments */
+ UCL_PARSER_NO_FILEVARS = (1 << 6) /** Do not set file vars */
} ucl_parser_flags_t;
/**
@@ -205,7 +206,8 @@ enum ucl_duplicate_strategy {
enum ucl_parse_type {
UCL_PARSE_UCL = 0, /**< Default ucl format */
UCL_PARSE_MSGPACK, /**< Message pack input format */
- UCL_PARSE_CSEXP /**< Canonical S-expressions */
+ UCL_PARSE_CSEXP, /**< Canonical S-expressions */
+ UCL_PARSE_AUTO /**< Try to detect parse type */
};
/**
@@ -227,7 +229,7 @@ typedef struct ucl_object_s {
const char *key; /**< Key of an object */
struct ucl_object_s *next; /**< Array handle */
struct ucl_object_s *prev; /**< Array handle */
- uint32_t keylen; /**< Lenght of a key */
+ uint32_t keylen; /**< Length of a key */
uint32_t len; /**< Size of an object */
uint32_t ref; /**< Reference count */
uint16_t flags; /**< Object flags */
@@ -831,10 +833,29 @@ UCL_EXTERN ucl_object_iter_t ucl_object_iterate_reset (ucl_object_iter_t it,
* Get the next object from the `obj`. This fucntion iterates over arrays, objects
* and implicit arrays
* @param iter safe iterator
+ * @param expand_values expand explicit arrays and objects
* @return the next object in sequence
*/
UCL_EXTERN const ucl_object_t* ucl_object_iterate_safe (ucl_object_iter_t iter,
bool expand_values);
+/**
+ * Iteration type enumerator
+ */
+enum ucl_iterate_type {
+ UCL_ITERATE_EXPLICIT = 1 << 0, /**< Iterate just explicit arrays and objects */
+ UCL_ITERATE_IMPLICIT = 1 << 1, /**< Iterate just implicit arrays */
+ UCL_ITERATE_BOTH = (1 << 0) | (1 << 1), /**< Iterate both explicit and implicit arrays*/
+};
+
+/**
+ * Get the next object from the `obj`. This fucntion iterates over arrays, objects
+ * and implicit arrays if needed
+ * @param iter safe iterator
+ * @param
+ * @return the next object in sequence
+ */
+UCL_EXTERN const ucl_object_t* ucl_object_iterate_full (ucl_object_iter_t iter,
+ enum ucl_iterate_type type);
/**
* Free memory associated with the safe iterator
@@ -1016,6 +1037,7 @@ UCL_EXTERN bool ucl_parser_add_string_priority (struct ucl_parser *parser,
* Load and add data from a file
* @param parser parser structure
* @param filename the name of file
+ * @param err if *err is NULL it is set to parser error
* @return true if chunk has been added and false in case of error
*/
UCL_EXTERN bool ucl_parser_add_file (struct ucl_parser *parser,
@@ -1025,6 +1047,7 @@ UCL_EXTERN bool ucl_parser_add_file (struct ucl_parser *parser,
* Load and add data from a file
* @param parser parser structure
* @param filename the name of file
+ * @param err if *err is NULL it is set to parser error
* @param priority the desired priority of a chunk (only 4 least significant bits
* are considered for this parameter)
* @return true if chunk has been added and false in case of error
@@ -1069,6 +1092,21 @@ UCL_EXTERN bool ucl_parser_add_fd_priority (struct ucl_parser *parser,
int fd, unsigned priority);
/**
+ * Load and add data from a file descriptor
+ * @param parser parser structure
+ * @param filename the name of file
+ * @param err if *err is NULL it is set to parser error
+ * @param priority the desired priority of a chunk (only 4 least significant bits
+ * are considered for this parameter)
+ * @param strat Merge strategy to use while parsing this file
+ * @param parse_type Parser type to use while parsing this file
+ * @return true if chunk has been added and false in case of error
+ */
+UCL_EXTERN bool ucl_parser_add_fd_full (struct ucl_parser *parser, int fd,
+ unsigned priority, enum ucl_duplicate_strategy strat,
+ enum ucl_parse_type parse_type);
+
+/**
* Provide a UCL_ARRAY of paths to search for include files. The object is
* copied so caller must unref the object.
* @param parser parser structure
diff --git a/contrib/libucl/lua/lua_ucl.c b/contrib/libucl/lua/lua_ucl.c
index bf80810..62b0652 100644
--- a/contrib/libucl/lua/lua_ucl.c
+++ b/contrib/libucl/lua/lua_ucl.c
@@ -29,7 +29,6 @@
#include "ucl_internal.h"
#include "lua_ucl.h"
#include <strings.h>
-#include <zconf.h>
/***
* @module ucl
@@ -187,6 +186,8 @@ ucl_object_lua_push_array (lua_State *L, const ucl_object_t *obj)
lua_rawseti (L, -2, i);
i ++;
}
+
+ ucl_object_iterate_free (it);
}
else {
/* Optimize allocation by preallocation of table */
@@ -482,7 +483,7 @@ static int
lua_ucl_parser_init (lua_State *L)
{
struct ucl_parser *parser, **pparser;
- int flags = 0;
+ int flags = UCL_PARSER_NO_FILEVARS;
if (lua_gettop (L) >= 1) {
flags = lua_tonumber (L, 1);
@@ -524,6 +525,27 @@ lua_ucl_push_opaque (lua_State *L, ucl_object_t *obj)
lua_setmetatable (L, -2);
}
+static inline enum ucl_parse_type
+lua_ucl_str_to_parse_type (const char *str)
+{
+ enum ucl_parse_type type = UCL_PARSE_UCL;
+
+ if (str != NULL) {
+ if (strcasecmp (str, "msgpack") == 0) {
+ type = UCL_PARSE_MSGPACK;
+ }
+ else if (strcasecmp (str, "sexp") == 0 ||
+ strcasecmp (str, "csexp") == 0) {
+ type = UCL_PARSE_CSEXP;
+ }
+ else if (strcasecmp (str, "auto") == 0) {
+ type = UCL_PARSE_AUTO;
+ }
+ }
+
+ return type;
+}
+
/***
* @method parser:parse_file(name)
* Parse UCL object from file.
@@ -579,13 +601,19 @@ lua_ucl_parser_parse_string (lua_State *L)
struct ucl_parser *parser;
const char *string;
size_t llen;
+ enum ucl_parse_type type = UCL_PARSE_UCL;
int ret = 2;
parser = lua_ucl_parser_get (L, 1);
string = luaL_checklstring (L, 2, &llen);
+ if (lua_type (L, 3) == LUA_TSTRING) {
+ type = lua_ucl_str_to_parse_type (lua_tostring (L, 3));
+ }
+
if (parser != NULL && string != NULL) {
- if (ucl_parser_add_chunk (parser, (const unsigned char *)string, llen)) {
+ if (ucl_parser_add_chunk_full (parser, (const unsigned char *)string,
+ llen, 0, UCL_DUPLICATE_APPEND, type)) {
lua_pushboolean (L, true);
ret = 1;
}
@@ -761,6 +789,28 @@ lua_ucl_object_unwrap (lua_State *L)
return 1;
}
+static inline enum ucl_emitter
+lua_ucl_str_to_emit_type (const char *strtype)
+{
+ enum ucl_emitter format = UCL_EMIT_JSON_COMPACT;
+
+ if (strcasecmp (strtype, "json") == 0) {
+ format = UCL_EMIT_JSON;
+ }
+ else if (strcasecmp (strtype, "json-compact") == 0) {
+ format = UCL_EMIT_JSON_COMPACT;
+ }
+ else if (strcasecmp (strtype, "yaml") == 0) {
+ format = UCL_EMIT_YAML;
+ }
+ else if (strcasecmp (strtype, "config") == 0 ||
+ strcasecmp (strtype, "ucl") == 0) {
+ format = UCL_EMIT_CONFIG;
+ }
+
+ return format;
+}
+
/***
* @method object:tostring(type)
* Unwraps opaque ucl object to string (json by default). Optionally you can
@@ -787,19 +837,7 @@ lua_ucl_object_tostring (lua_State *L)
if (lua_type (L, 2) == LUA_TSTRING) {
const char *strtype = lua_tostring (L, 2);
- if (strcasecmp (strtype, "json") == 0) {
- format = UCL_EMIT_JSON;
- }
- else if (strcasecmp (strtype, "json-compact") == 0) {
- format = UCL_EMIT_JSON_COMPACT;
- }
- else if (strcasecmp (strtype, "yaml") == 0) {
- format = UCL_EMIT_YAML;
- }
- else if (strcasecmp (strtype, "config") == 0 ||
- strcasecmp (strtype, "ucl") == 0) {
- format = UCL_EMIT_CONFIG;
- }
+ format = lua_ucl_str_to_emit_type (strtype);
}
}
@@ -1088,6 +1126,9 @@ lua_ucl_to_format (lua_State *L)
strcasecmp (strtype, "ucl") == 0) {
format = UCL_EMIT_CONFIG;
}
+ else if (strcasecmp (strtype, "msgpack") == 0) {
+ format = UCL_EMIT_MSGPACK;
+ }
}
}
diff --git a/contrib/libucl/src/ucl_emitter_utils.c b/contrib/libucl/src/ucl_emitter_utils.c
index 95ac9a5..3559eb6 100644
--- a/contrib/libucl/src/ucl_emitter_utils.c
+++ b/contrib/libucl/src/ucl_emitter_utils.c
@@ -102,7 +102,7 @@ ucl_elt_string_write_json (const char *str, size_t size,
func->ucl_emitter_append_character ('"', 1, func->ud);
while (size) {
- if (ucl_test_character (*p, UCL_CHARACTER_JSON_UNSAFE)) {
+ if (ucl_test_character (*p, UCL_CHARACTER_JSON_UNSAFE|UCL_CHARACTER_DENIED)) {
if (len > 0) {
func->ucl_emitter_append_len (c, len, func->ud);
}
@@ -128,6 +128,10 @@ ucl_elt_string_write_json (const char *str, size_t size,
case '"':
func->ucl_emitter_append_len ("\\\"", 2, func->ud);
break;
+ default:
+ /* Emit unicode unknown character */
+ func->ucl_emitter_append_len ("\\uFFFD", 5, func->ud);
+ break;
}
len = 0;
c = ++p;
@@ -138,9 +142,11 @@ ucl_elt_string_write_json (const char *str, size_t size,
}
size --;
}
+
if (len > 0) {
func->ucl_emitter_append_len (c, len, func->ud);
}
+
func->ucl_emitter_append_character ('"', 1, func->ud);
}
diff --git a/contrib/libucl/src/ucl_internal.h b/contrib/libucl/src/ucl_internal.h
index 37871eb..9ae5250 100644
--- a/contrib/libucl/src/ucl_internal.h
+++ b/contrib/libucl/src/ucl_internal.h
@@ -87,6 +87,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
#include "utlist.h"
#include "utstring.h"
@@ -127,19 +130,19 @@ enum ucl_parser_state {
};
enum ucl_character_type {
- UCL_CHARACTER_DENIED = 0,
- UCL_CHARACTER_KEY = 1,
- UCL_CHARACTER_KEY_START = 1 << 1,
- UCL_CHARACTER_WHITESPACE = 1 << 2,
- UCL_CHARACTER_WHITESPACE_UNSAFE = 1 << 3,
- UCL_CHARACTER_VALUE_END = 1 << 4,
- UCL_CHARACTER_VALUE_STR = 1 << 5,
- UCL_CHARACTER_VALUE_DIGIT = 1 << 6,
- UCL_CHARACTER_VALUE_DIGIT_START = 1 << 7,
- UCL_CHARACTER_ESCAPE = 1 << 8,
- UCL_CHARACTER_KEY_SEP = 1 << 9,
- UCL_CHARACTER_JSON_UNSAFE = 1 << 10,
- UCL_CHARACTER_UCL_UNSAFE = 1 << 11
+ UCL_CHARACTER_DENIED = (1 << 0),
+ UCL_CHARACTER_KEY = (1 << 1),
+ UCL_CHARACTER_KEY_START = (1 << 2),
+ UCL_CHARACTER_WHITESPACE = (1 << 3),
+ UCL_CHARACTER_WHITESPACE_UNSAFE = (1 << 4),
+ UCL_CHARACTER_VALUE_END = (1 << 5),
+ UCL_CHARACTER_VALUE_STR = (1 << 6),
+ UCL_CHARACTER_VALUE_DIGIT = (1 << 7),
+ UCL_CHARACTER_VALUE_DIGIT_START = (1 << 8),
+ UCL_CHARACTER_ESCAPE = (1 << 9),
+ UCL_CHARACTER_KEY_SEP = (1 << 10),
+ UCL_CHARACTER_JSON_UNSAFE = (1 << 11),
+ UCL_CHARACTER_UCL_UNSAFE = (1 << 12)
};
struct ucl_macro {
@@ -568,4 +571,6 @@ bool ucl_parser_process_object_element (struct ucl_parser *parser,
*/
bool ucl_parse_msgpack (struct ucl_parser *parser);
+bool ucl_parse_csexp (struct ucl_parser *parser);
+
#endif /* UCL_INTERNAL_H_ */
diff --git a/contrib/libucl/src/ucl_parser.c b/contrib/libucl/src/ucl_parser.c
index 0f029ea..9f44de1 100644
--- a/contrib/libucl/src/ucl_parser.c
+++ b/contrib/libucl/src/ucl_parser.c
@@ -2469,8 +2469,10 @@ ucl_parser_new (int flags)
parser->comments = ucl_object_typed_new (UCL_OBJECT);
}
- /* Initial assumption about filevars */
- ucl_parser_set_filevars (parser, NULL, false);
+ if (!(flags & UCL_PARSER_NO_FILEVARS)) {
+ /* Initial assumption about filevars */
+ ucl_parser_set_filevars (parser, NULL, false);
+ }
return parser;
}
@@ -2617,6 +2619,19 @@ ucl_parser_add_chunk_full (struct ucl_parser *parser, const unsigned char *data,
return false;
}
+ if (parse_type == UCL_PARSE_AUTO && len > 0) {
+ /* We need to detect parse type by the first symbol */
+ if ((*data & 0x80) == 0x80 && (*data >= 0xdc && *data <= 0xdf)) {
+ parse_type = UCL_PARSE_MSGPACK;
+ }
+ else if (*data == '(') {
+ parse_type = UCL_PARSE_CSEXP;
+ }
+ else {
+ parse_type = UCL_PARSE_UCL;
+ }
+ }
+
chunk->begin = data;
chunk->remain = len;
chunk->pos = chunk->begin;
@@ -2643,6 +2658,8 @@ ucl_parser_add_chunk_full (struct ucl_parser *parser, const unsigned char *data,
return ucl_state_machine (parser);
case UCL_PARSE_MSGPACK:
return ucl_parse_msgpack (parser);
+ case UCL_PARSE_CSEXP:
+ return ucl_parse_csexp (parser);
}
}
else {
diff --git a/contrib/libucl/src/ucl_util.c b/contrib/libucl/src/ucl_util.c
index ccc4373..299e0bc 100644
--- a/contrib/libucl/src/ucl_util.c
+++ b/contrib/libucl/src/ucl_util.c
@@ -26,11 +26,17 @@
#include "ucl_internal.h"
#include "ucl_chartable.h"
#include "kvec.h"
+#include <limits.h>
#include <stdarg.h>
#include <stdio.h> /* for snprintf */
#ifndef _WIN32
#include <glob.h>
+#include <sys/param.h>
+#else
+#ifndef NBBY
+#define NBBY 8
+#endif
#endif
#ifdef HAVE_LIBGEN_H
@@ -81,11 +87,6 @@ typedef kvec_t(ucl_object_t *) ucl_array_t;
#define MAP_FAILED ((void *) -1)
#endif
-#ifdef _WIN32
-#include <limits.h>
-#define NBBY CHAR_BIT
-#endif
-
static void *ucl_mmap(char *addr, size_t length, int prot, int access, int fd, off_t offset)
{
void *map = NULL;
@@ -1854,9 +1855,11 @@ ucl_parser_add_file (struct ucl_parser *parser, const char *filename)
UCL_PARSE_UCL);
}
+
bool
-ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
- unsigned priority)
+ucl_parser_add_fd_full (struct ucl_parser *parser, int fd,
+ unsigned priority, enum ucl_duplicate_strategy strat,
+ enum ucl_parse_type parse_type)
{
unsigned char *buf;
size_t len;
@@ -1882,7 +1885,8 @@ ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
}
parser->cur_file = NULL;
len = st.st_size;
- ret = ucl_parser_add_chunk_priority (parser, buf, len, priority);
+ ret = ucl_parser_add_chunk_full (parser, buf, len, priority, strat,
+ parse_type);
if (len > 0) {
ucl_munmap (buf, len);
@@ -1892,6 +1896,18 @@ ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
}
bool
+ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
+ unsigned priority)
+{
+ if (parser == NULL) {
+ return false;
+ }
+
+ return ucl_parser_add_fd_full(parser, fd, parser->default_priority,
+ UCL_DUPLICATE_APPEND, UCL_PARSE_UCL);
+}
+
+bool
ucl_parser_add_fd (struct ucl_parser *parser, int fd)
{
if (parser == NULL) {
@@ -2488,6 +2504,10 @@ ucl_object_iterate_reset (ucl_object_iter_t it, const ucl_object_t *obj)
UCL_SAFE_ITER_CHECK (rit);
+ if (rit->expl_it != NULL) {
+ UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
+ }
+
rit->impl_it = obj;
rit->expl_it = NULL;
@@ -2497,6 +2517,13 @@ ucl_object_iterate_reset (ucl_object_iter_t it, const ucl_object_t *obj)
const ucl_object_t*
ucl_object_iterate_safe (ucl_object_iter_t it, bool expand_values)
{
+ return ucl_object_iterate_full (it, expand_values ? UCL_ITERATE_BOTH :
+ UCL_ITERATE_IMPLICIT);
+}
+
+const ucl_object_t*
+ucl_object_iterate_full (ucl_object_iter_t it, enum ucl_iterate_type type)
+{
struct ucl_object_safe_iter *rit = UCL_SAFE_ITER (it);
const ucl_object_t *ret = NULL;
@@ -2509,21 +2536,23 @@ ucl_object_iterate_safe (ucl_object_iter_t it, bool expand_values)
if (rit->impl_it->type == UCL_OBJECT || rit->impl_it->type == UCL_ARRAY) {
ret = ucl_object_iterate (rit->impl_it, &rit->expl_it, true);
- if (ret == NULL) {
+ if (ret == NULL && (type & UCL_ITERATE_IMPLICIT)) {
/* Need to switch to another implicit object in chain */
rit->impl_it = rit->impl_it->next;
rit->expl_it = NULL;
- return ucl_object_iterate_safe (it, expand_values);
+
+ return ucl_object_iterate_safe (it, type);
}
}
else {
/* Just iterate over the implicit array */
ret = rit->impl_it;
rit->impl_it = rit->impl_it->next;
- if (expand_values) {
+
+ if (type & UCL_ITERATE_EXPLICIT) {
/* We flatten objects if need to expand values */
if (ret->type == UCL_OBJECT || ret->type == UCL_ARRAY) {
- return ucl_object_iterate_safe (it, expand_values);
+ return ucl_object_iterate_safe (it, type);
}
}
}
@@ -2538,6 +2567,10 @@ ucl_object_iterate_free (ucl_object_iter_t it)
UCL_SAFE_ITER_CHECK (rit);
+ if (rit->expl_it != NULL) {
+ UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
+ }
+
UCL_FREE (sizeof (*rit), it);
}
diff --git a/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 98b687b..c49adc3 100644
--- a/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3180,6 +3180,9 @@ def note_ovl_candidate : Note<"candidate "
def note_ovl_candidate_inherited_constructor : Note<
"constructor from base class %0 inherited here">;
+def note_ovl_candidate_inherited_constructor_slice : Note<
+ "candidate %select{constructor|template}0 ignored: "
+ "inherited constructor cannot be used to %select{copy|move}1 object">;
def note_ovl_candidate_illegal_constructor : Note<
"candidate %select{constructor|template}0 ignored: "
"instantiation %select{takes|would take}0 its own class type by value">;
diff --git a/contrib/llvm/tools/clang/include/clang/Sema/Overload.h b/contrib/llvm/tools/clang/include/clang/Sema/Overload.h
index d0f21cd..898b12e 100644
--- a/contrib/llvm/tools/clang/include/clang/Sema/Overload.h
+++ b/contrib/llvm/tools/clang/include/clang/Sema/Overload.h
@@ -586,7 +586,11 @@ namespace clang {
ovl_fail_enable_if,
/// This candidate was not viable because its address could not be taken.
- ovl_fail_addr_not_available
+ ovl_fail_addr_not_available,
+
+ /// This inherited constructor is not viable because it would slice the
+ /// argument.
+ ovl_fail_inhctor_slice,
};
/// OverloadCandidate - A single candidate in an overload set (C++ 13.3).
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
index 40d6e91..f148c2d 100644
--- a/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
+++ b/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
@@ -5783,6 +5783,28 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
Candidate.FailureKind = ovl_fail_illegal_constructor;
return;
}
+
+ // C++ [over.match.funcs]p8: (proposed DR resolution)
+ // A constructor inherited from class type C that has a first parameter
+ // of type "reference to P" (including such a constructor instantiated
+ // from a template) is excluded from the set of candidate functions when
+ // constructing an object of type cv D if the argument list has exactly
+ // one argument and D is reference-related to P and P is reference-related
+ // to C.
+ auto *Shadow = dyn_cast<ConstructorUsingShadowDecl>(FoundDecl.getDecl());
+ if (Shadow && Args.size() == 1 && Constructor->getNumParams() >= 1 &&
+ Constructor->getParamDecl(0)->getType()->isReferenceType()) {
+ QualType P = Constructor->getParamDecl(0)->getType()->getPointeeType();
+ QualType C = Context.getRecordType(Constructor->getParent());
+ QualType D = Context.getRecordType(Shadow->getParent());
+ SourceLocation Loc = Args.front()->getExprLoc();
+ if ((Context.hasSameUnqualifiedType(P, C) || IsDerivedFrom(Loc, P, C)) &&
+ (Context.hasSameUnqualifiedType(D, P) || IsDerivedFrom(Loc, D, P))) {
+ Candidate.Viable = false;
+ Candidate.FailureKind = ovl_fail_inhctor_slice;
+ return;
+ }
+ }
}
unsigned NumParams = Proto->getNumParams();
@@ -9750,6 +9772,17 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
case ovl_fail_enable_if:
return DiagnoseFailedEnableIfAttr(S, Cand);
+ case ovl_fail_inhctor_slice:
+ // It's generally not interesting to note copy/move constructors here.
+ if (cast<CXXConstructorDecl>(Fn)->isCopyOrMoveConstructor())
+ return;
+ S.Diag(Fn->getLocation(),
+ diag::note_ovl_candidate_inherited_constructor_slice)
+ << (Fn->getPrimaryTemplate() ? 1 : 0)
+ << Fn->getParamDecl(0)->getType()->isRValueReferenceType();
+ MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl);
+ return;
+
case ovl_fail_addr_not_available: {
bool Available = checkAddressOfCandidateIsAvailable(S, Cand->Function);
(void)Available;
diff --git a/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue b/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue
index 969ad9c..e0cbf52 100644
--- a/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue
+++ b/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue
@@ -1,1040 +1,1035 @@
begin 644 t_pad_output.bz2
-M0EIH.3%!629360S39&D`<XA_____________________________________
-M________X)S;?=A%%?,RM9MH`$E-`-;8#;;8#6E)9>>;SS,K;%2@`2::%N=I
-MVR86:*KOO>O99MMM-XP&76N]W/6T=[SW@<[G'3H:Z'K1F?=WON]WO>]S=WN^
-ML]W>^WN[[W;V\VW>[OMN^WW;;3+3/=TK*Y5E4LVE#-E5H:"S530#1IB5LS:V
-MJHK6!JVA2M9LR*V:MFUJ55JBM:Q4*EL,5$`50)L6M11:P55:V%+55:U5C!I3
-M1L,BU5-5JV-%F55-5EL;:@5:K+%5:S--;5-;:M5MJVZZ[:V]>[:7NTN>][;>
-M[O/MO-M[NYOM]WN^[K69ON\^][WO(Q/N8ZZ![N''=O3VP[V/>RCRX[0VJ7FW
-M-FQJ%7-G0R;9MB*N\G'>PTM*5H%``-LF2NKF=-LQFU*50444`446P`&FV06V
-MUE17-HDJB[#--!MBC$-1L#;!MF@JALFIM-IE3-30"JH#2D`$`!,F$R83(830
-M--,AD!H&AH`R#$9`:&AHR`Q-`,":8)D8C`3)@FF":8@P"9,$,"&)D#0)@$&D
-MD$TPF@`)@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&!#SW2:6[Y^;U]$`L=*VKPP^`RN*A\MXZ5_/@01"&AD%9,)S+Q5H
+M[C&K)6627,NVK!>B=Y3_+D`+9HN<X;^)MYCER:>UI(3Y)?WY8H@4)9\3#D?1
+ME0HX7U@GG=GN>YD"%P_W6DC^W0[CPOFE:5H[3-<HG6&\,/#;+2TL_[X704P"
+M5N_X8K>12VMKJFO[EK8`"G=AT[Z2SPX,E9?G4#KR&08@0H5]\U8GT'Q\>UV[
+M*"(9J/D)1WDZL;[+[[FL,#D]$[I8%A^,KX>O2+K``0VKJXS-/!G$U/#XG(0O
+M"OJ_&SOB`$`QJDECIERVTTTSVI6G-&2C?GU8O)+<?EYA*1`,3UN*#8.LXK,'
+MSS"VJ/C+D%P*X0C_GO0<?=-O?5O_7CX/VW24`$KV^69,;6U&EYSKR-Y/A(8&
+M:U4X7.@G,RS:DZ1$N.F5<*8VE!?!X&@06^5.MQFH&%XO1*12_,O7;_<M)3)[
+ME-.&T^'E=Y#JSGS+Z+4KJV?ZQRPKMS`A9R(@U&,#?8X"O;K;+=%RB!Y^CL'?
+M*Y:3@'DEU84+R:3Y<19NOD(1+-C;8V2V*V.THJ_/U_"5/H5PJ&)7*L[30_CX
+M=YYO]+U+ZVXW:\=.P)"MXVVQ_J:AF<923F?X'PF6N4J6H97$<2ZP$9C5?;?)
+AOE[3]=PE4E9R<92Z_X:N7V3I;?Y7_XNY(IPH2$BTXA\`
`
end
diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c b/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
index 91e81f4..a79ac74 100644
--- a/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
+++ b/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $ */
+/* $NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -48,7 +48,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define SECSIZE 512
diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c b/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
index 9416333..edda1eb 100644
--- a/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
+++ b/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $ */
+/* $NetBSD: t_cgd_aes.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -49,7 +49,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define SECSIZE 512
diff --git a/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c b/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
index 958ebac..93aa834 100644
--- a/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
+++ b/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $ */
+/* $NetBSD: t_cgd_blowfish.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -48,7 +48,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define SECSIZE 512
diff --git a/contrib/netbsd-tests/dev/clock_subr/clock_subr_test_data_gen.sh b/contrib/netbsd-tests/dev/clock_subr/clock_subr_test_data_gen.sh
new file mode 100755
index 0000000..2da21a8
--- /dev/null
+++ b/contrib/netbsd-tests/dev/clock_subr/clock_subr_test_data_gen.sh
@@ -0,0 +1,25 @@
+#!/bin/ksh
+
+export TZ=Etc/Universal
+
+datesub() {
+ gdate "$@" '+ FILL(%_11s,%_4Y,%_m,%_d,%w,%_H,%_M,%_S), // %a %b %e %H:%M:%S %Z %Y'
+}
+
+(
+ datesub -d '1970/01/01 00:00:00'
+ datesub -d '1981/04/12 12:00:03'
+ datesub -d '2011/07/21 09:57:00'
+ datesub -d @2147483647
+ datesub -d @2147483648
+ datesub -d '2063/04/05 00:00:00'
+ for year in `seq 1970 1 2030`; do
+ datesub -d "${year}/01/01 00:00:00"
+ datesub -d "${year}/07/01 00:00:00"
+ done
+ for year in `seq 2000 25 2600`; do
+ datesub -d "$((${year} - 1))/12/31 23:59:59"
+ datesub -d "$((${year} + 0))/01/01 00:00:00"
+ datesub -d "$((${year} + 1))/01/01 00:00:00"
+ done
+)|sort -u
diff --git a/contrib/netbsd-tests/dev/clock_subr/t_clock_subr.c b/contrib/netbsd-tests/dev/clock_subr/t_clock_subr.c
new file mode 100644
index 0000000..bb03c68
--- /dev/null
+++ b/contrib/netbsd-tests/dev/clock_subr/t_clock_subr.c
@@ -0,0 +1,309 @@
+/* $NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
+
+/*
+ * Copyright (c) 2016 Jonathan A. Kollasch
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2016\
+ Jonathan A. Kollasch. All rights reserved.");
+__RCSID("$NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $");
+
+#include <sys/types.h>
+#include <dev/clock_subr.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+#include "h_macros.h"
+
+#define FILL(ti,ye,mo,da,wd,ho,mi,se) \
+{ .time = (ti), .clock = { .dt_year = (ye), .dt_mon = (mo), .dt_day = (da), \
+ .dt_wday = (wd), .dt_hour = (ho), .dt_min = (mi), .dt_sec = (se), } }
+
+static struct clock_test {
+ time_t time;
+ struct clock_ymdhms clock;
+} const clock_tests[] = {
+ FILL( 0,1970, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1970
+ FILL( 15638400,1970, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1970
+ FILL( 31536000,1971, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1971
+ FILL( 47174400,1971, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1971
+ FILL( 63072000,1972, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1972
+ FILL( 78796800,1972, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1972
+ FILL( 94694400,1973, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1973
+ FILL( 110332800,1973, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1973
+ FILL( 126230400,1974, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1974
+ FILL( 141868800,1974, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1974
+ FILL( 157766400,1975, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1975
+ FILL( 173404800,1975, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1975
+ FILL( 189302400,1976, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1976
+ FILL( 205027200,1976, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1976
+ FILL( 220924800,1977, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1977
+ FILL( 236563200,1977, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1977
+ FILL( 252460800,1978, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1978
+ FILL( 268099200,1978, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1978
+ FILL( 283996800,1979, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1979
+ FILL( 299635200,1979, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1979
+ FILL( 315532800,1980, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1980
+ FILL( 331257600,1980, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1980
+ FILL( 347155200,1981, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1981
+ FILL( 355924803,1981, 4,12,0,12, 0, 3), // Sun Apr 12 12:00:03 UTC 1981
+ FILL( 362793600,1981, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1981
+ FILL( 378691200,1982, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1982
+ FILL( 394329600,1982, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1982
+ FILL( 410227200,1983, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1983
+ FILL( 425865600,1983, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1983
+ FILL( 441763200,1984, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1984
+ FILL( 457488000,1984, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1984
+ FILL( 473385600,1985, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1985
+ FILL( 489024000,1985, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1985
+ FILL( 504921600,1986, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1986
+ FILL( 520560000,1986, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1986
+ FILL( 536457600,1987, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1987
+ FILL( 552096000,1987, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1987
+ FILL( 567993600,1988, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1988
+ FILL( 583718400,1988, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1988
+ FILL( 599616000,1989, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1989
+ FILL( 615254400,1989, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1989
+ FILL( 631152000,1990, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1990
+ FILL( 646790400,1990, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1990
+ FILL( 662688000,1991, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1991
+ FILL( 678326400,1991, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1991
+ FILL( 694224000,1992, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1992
+ FILL( 709948800,1992, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1992
+ FILL( 725846400,1993, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1993
+ FILL( 741484800,1993, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1993
+ FILL( 757382400,1994, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1994
+ FILL( 773020800,1994, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1994
+ FILL( 788918400,1995, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1995
+ FILL( 804556800,1995, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1995
+ FILL( 820454400,1996, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1996
+ FILL( 836179200,1996, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1996
+ FILL( 852076800,1997, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1997
+ FILL( 867715200,1997, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1997
+ FILL( 883612800,1998, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1998
+ FILL( 899251200,1998, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1998
+ FILL( 915148800,1999, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1999
+ FILL( 930787200,1999, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1999
+ FILL( 946684799,1999,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 1999
+ FILL( 946684800,2000, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2000
+ FILL( 962409600,2000, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2000
+ FILL( 978307200,2001, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2001
+ FILL( 993945600,2001, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2001
+ FILL( 1009843200,2002, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2002
+ FILL( 1025481600,2002, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2002
+ FILL( 1041379200,2003, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2003
+ FILL( 1057017600,2003, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2003
+ FILL( 1072915200,2004, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2004
+ FILL( 1088640000,2004, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2004
+ FILL( 1104537600,2005, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2005
+ FILL( 1120176000,2005, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2005
+ FILL( 1136073600,2006, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2006
+ FILL( 1151712000,2006, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2006
+ FILL( 1167609600,2007, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2007
+ FILL( 1183248000,2007, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2007
+ FILL( 1199145600,2008, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2008
+ FILL( 1214870400,2008, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2008
+ FILL( 1230768000,2009, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2009
+ FILL( 1246406400,2009, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2009
+ FILL( 1262304000,2010, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2010
+ FILL( 1277942400,2010, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2010
+ FILL( 1293840000,2011, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2011
+ FILL( 1309478400,2011, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2011
+ FILL( 1311242220,2011, 7,21,4, 9,57, 0), // Thu Jul 21 09:57:00 UTC 2011
+ FILL( 1325376000,2012, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2012
+ FILL( 1341100800,2012, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2012
+ FILL( 1356998400,2013, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2013
+ FILL( 1372636800,2013, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2013
+ FILL( 1388534400,2014, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2014
+ FILL( 1404172800,2014, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2014
+ FILL( 1420070400,2015, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2015
+ FILL( 1435708800,2015, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2015
+ FILL( 1451606400,2016, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2016
+ FILL( 1467331200,2016, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2016
+ FILL( 1483228800,2017, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2017
+ FILL( 1498867200,2017, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2017
+ FILL( 1514764800,2018, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2018
+ FILL( 1530403200,2018, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2018
+ FILL( 1546300800,2019, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2019
+ FILL( 1561939200,2019, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2019
+ FILL( 1577836800,2020, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2020
+ FILL( 1593561600,2020, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2020
+ FILL( 1609459200,2021, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2021
+ FILL( 1625097600,2021, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2021
+ FILL( 1640995200,2022, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2022
+ FILL( 1656633600,2022, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2022
+ FILL( 1672531200,2023, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2023
+ FILL( 1688169600,2023, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2023
+ FILL( 1704067200,2024, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2024
+ FILL( 1719792000,2024, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2024
+ FILL( 1735689599,2024,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2024
+ FILL( 1735689600,2025, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2025
+ FILL( 1751328000,2025, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2025
+ FILL( 1767225600,2026, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2026
+ FILL( 1782864000,2026, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2026
+ FILL( 1798761600,2027, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2027
+ FILL( 1814400000,2027, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2027
+ FILL( 1830297600,2028, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2028
+ FILL( 1846022400,2028, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2028
+ FILL( 1861920000,2029, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2029
+ FILL( 1877558400,2029, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2029
+ FILL( 1893456000,2030, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2030
+ FILL( 1909094400,2030, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2030
+ FILL( 2147483647,2038, 1,19,2, 3,14, 7), // Tue Jan 19 03:14:07 UTC 2038
+ FILL( 2147483648,2038, 1,19,2, 3,14, 8), // Tue Jan 19 03:14:08 UTC 2038
+ FILL( 2524607999,2049,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2049
+ FILL( 2524608000,2050, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2050
+ FILL( 2556144000,2051, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2051
+ FILL( 2942956800,2063, 4, 5,4, 0, 0, 0), // Thu Apr 5 00:00:00 UTC 2063
+ FILL( 3313526399,2074,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2074
+ FILL( 3313526400,2075, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2075
+ FILL( 3345062400,2076, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2076
+ FILL( 4102444799,2099,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2099
+ FILL( 4102444800,2100, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2100
+ FILL( 4133980800,2101, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2101
+ FILL( 4891363199,2124,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2124
+ FILL( 4891363200,2125, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2125
+ FILL( 4922899200,2126, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2126
+ FILL( 5680281599,2149,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2149
+ FILL( 5680281600,2150, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2150
+ FILL( 5711817600,2151, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2151
+ FILL( 6469199999,2174,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2174
+ FILL( 6469200000,2175, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2175
+ FILL( 6500736000,2176, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2176
+ FILL( 7258118399,2199,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2199
+ FILL( 7258118400,2200, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2200
+ FILL( 7289654400,2201, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2201
+ FILL( 8047036799,2224,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2224
+ FILL( 8047036800,2225, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2225
+ FILL( 8078572800,2226, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2226
+ FILL( 8835955199,2249,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2249
+ FILL( 8835955200,2250, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2250
+ FILL( 8867491200,2251, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2251
+ FILL( 9624873599,2274,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2274
+ FILL( 9624873600,2275, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2275
+ FILL( 9656409600,2276, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2276
+ FILL(10413791999,2299,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2299
+ FILL(10413792000,2300, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2300
+ FILL(10445328000,2301, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2301
+ FILL(11202710399,2324,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2324
+ FILL(11202710400,2325, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2325
+ FILL(11234246400,2326, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2326
+ FILL(11991628799,2349,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2349
+ FILL(11991628800,2350, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2350
+ FILL(12023164800,2351, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2351
+ FILL(12780547199,2374,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2374
+ FILL(12780547200,2375, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2375
+ FILL(12812083200,2376, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2376
+ FILL(13569465599,2399,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2399
+ FILL(13569465600,2400, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2400
+ FILL(13601088000,2401, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2401
+ FILL(14358470399,2424,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2424
+ FILL(14358470400,2425, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2425
+ FILL(14390006400,2426, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2426
+ FILL(15147388799,2449,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2449
+ FILL(15147388800,2450, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2450
+ FILL(15178924800,2451, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2451
+ FILL(15936307199,2474,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2474
+ FILL(15936307200,2475, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2475
+ FILL(15967843200,2476, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2476
+ FILL(16725225599,2499,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2499
+ FILL(16725225600,2500, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2500
+ FILL(16756761600,2501, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2501
+ FILL(17514143999,2524,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2524
+ FILL(17514144000,2525, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2525
+ FILL(17545680000,2526, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2526
+ FILL(18303062399,2549,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2549
+ FILL(18303062400,2550, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2550
+ FILL(18334598400,2551, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2551
+ FILL(19091980799,2574,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2574
+ FILL(19091980800,2575, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2575
+ FILL(19123516800,2576, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2576
+ FILL(19880899199,2599,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2599
+ FILL(19880899200,2600, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2600
+ FILL(19912435200,2601, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2601
+};
+#undef FILL
+
+ATF_TC(ymdhms_to_secs);
+ATF_TC_HEAD(ymdhms_to_secs, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "check clock_ymdhms_to_secs");
+}
+ATF_TC_BODY(ymdhms_to_secs, tc)
+{
+ time_t secs;
+ size_t i;
+
+ for (i = 0; i < __arraycount(clock_tests); i++) {
+ secs = clock_ymdhms_to_secs(__UNCONST(&clock_tests[i].clock));
+ ATF_CHECK_EQ_MSG(clock_tests[i].time, secs, "%jd != %jd",
+ (intmax_t)clock_tests[i].time, (intmax_t)secs);
+ }
+}
+
+ATF_TC(secs_to_ymdhms);
+ATF_TC_HEAD(secs_to_ymdhms, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "check clock_secs_to_ymdhms");
+}
+ATF_TC_BODY(secs_to_ymdhms, tc)
+{
+ struct clock_ymdhms ymdhms;
+ size_t i;
+
+#define CHECK_FIELD(f) \
+ ATF_CHECK_EQ_MSG(ymdhms.dt_##f, clock_tests[i].clock.dt_##f, \
+ "%jd != %jd for %jd", (intmax_t)ymdhms.dt_##f, \
+ (intmax_t)clock_tests[i].clock.dt_##f, \
+ (intmax_t)clock_tests[i].time)
+
+ for (i = 0; i < __arraycount(clock_tests); i++) {
+ clock_secs_to_ymdhms(clock_tests[i].time, &ymdhms);
+ CHECK_FIELD(year);
+ CHECK_FIELD(mon);
+ CHECK_FIELD(day);
+ CHECK_FIELD(wday);
+ CHECK_FIELD(hour);
+ CHECK_FIELD(min);
+ CHECK_FIELD(sec);
+ }
+#undef CHECK_FIELD
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, ymdhms_to_secs);
+ ATF_TP_ADD_TC(tp, secs_to_ymdhms);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/dev/scsipi/t_cd.c b/contrib/netbsd-tests/dev/scsipi/t_cd.c
index 58e61a5..6e856de 100644
--- a/contrib/netbsd-tests/dev/scsipi/t_cd.c
+++ b/contrib/netbsd-tests/dev/scsipi/t_cd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cd.c,v 1.7 2014/04/25 00:24:39 pooka Exp $ */
+/* $NetBSD: t_cd.c,v 1.8 2017/01/13 21:30:39 christos Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -39,7 +39,7 @@
#include "scsitest.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(noisyeject);
ATF_TC_HEAD(noisyeject, tc)
diff --git a/contrib/netbsd-tests/dev/sysmon/t_swwdog.c b/contrib/netbsd-tests/dev/sysmon/t_swwdog.c
index 1635884..5e5fd99 100644
--- a/contrib/netbsd-tests/dev/sysmon/t_swwdog.c
+++ b/contrib/netbsd-tests/dev/sysmon/t_swwdog.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swwdog.c,v 1.6 2015/04/23 04:49:37 pgoyette Exp $ */
+/* $NetBSD: t_swwdog.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -43,7 +43,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static volatile sig_atomic_t tcount;
diff --git a/contrib/netbsd-tests/fs/common/h_fsmacros.h b/contrib/netbsd-tests/fs/common/h_fsmacros.h
index b295cf2..eb83768 100644
--- a/contrib/netbsd-tests/fs/common/h_fsmacros.h
+++ b/contrib/netbsd-tests/fs/common/h_fsmacros.h
@@ -1,4 +1,4 @@
-/* $NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $ */
+/* $NetBSD: h_fsmacros.h,v 1.41 2017/01/13 21:30:39 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <rump/rump.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define FSPROTOS(_fs_) \
int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \
diff --git a/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c b/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c
index 59f3ea3..71cf3b4 100644
--- a/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c
+++ b/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_quota2_tests.c,v 1.4 2012/09/30 21:26:57 bouyer Exp $ */
+/* $NetBSD: h_quota2_tests.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* rump server for advanced quota tests
@@ -22,7 +22,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
int background = 0;
diff --git a/contrib/netbsd-tests/fs/ffs/t_fifos.c b/contrib/netbsd-tests/fs/ffs/t_fifos.c
index fe1d425..10b50bb 100644
--- a/contrib/netbsd-tests/fs/ffs/t_fifos.c
+++ b/contrib/netbsd-tests/fs/ffs/t_fifos.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fifos.c,v 1.5 2010/11/07 17:51:17 jmmv Exp $ */
+/* $NetBSD: t_fifos.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <ufs/ufs/ufsmount.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC_WITH_CLEANUP(fifos);
ATF_TC_HEAD(fifos, tc)
diff --git a/contrib/netbsd-tests/fs/ffs/t_mount.c b/contrib/netbsd-tests/fs/ffs/t_mount.c
index 6a8f74f..2096095 100644
--- a/contrib/netbsd-tests/fs/ffs/t_mount.c
+++ b/contrib/netbsd-tests/fs/ffs/t_mount.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mount.c,v 1.13 2012/11/27 16:01:49 jakllsch Exp $ */
+/* $NetBSD: t_mount.c,v 1.14 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for mounting
@@ -25,7 +25,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(48Kimage);
ATF_TC_HEAD(48Kimage, tc)
diff --git a/contrib/netbsd-tests/fs/ffs/t_quota2_1.c b/contrib/netbsd-tests/fs/ffs/t_quota2_1.c
index 333f3c7..22cd5d2 100644
--- a/contrib/netbsd-tests/fs/ffs/t_quota2_1.c
+++ b/contrib/netbsd-tests/fs/ffs/t_quota2_1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_quota2_1.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */
+/* $NetBSD: t_quota2_1.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for quota2
@@ -18,7 +18,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log)
diff --git a/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c b/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c
index f648856..d843cf8 100644
--- a/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c
+++ b/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_quota2_remount.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */
+/* $NetBSD: t_quota2_remount.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */
/*
* Basic tests for quota2
@@ -19,7 +19,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log)
diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot.c b/contrib/netbsd-tests/fs/ffs/t_snapshot.c
index 180a8cc..f661bec 100644
--- a/contrib/netbsd-tests/fs/ffs/t_snapshot.c
+++ b/contrib/netbsd-tests/fs/ffs/t_snapshot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snapshot.c,v 1.6 2013/02/06 09:05:01 hannken Exp $ */
+/* $NetBSD: t_snapshot.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 " IMGNAME
diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c b/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c
index e1ce17e..31b28e5 100644
--- a/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c
+++ b/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snapshot_log.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */
+/* $NetBSD: t_snapshot_log.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 " IMGNAME
diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c b/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c
index 393f3d4..b27929c 100644
--- a/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c
+++ b/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snapshot_v2.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */
+/* $NetBSD: t_snapshot_v2.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -15,7 +15,7 @@
#include <string.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define IMGNAME "ffs.img"
#define NEWFS "newfs -F -s 10000 -O 2 " IMGNAME
diff --git a/contrib/netbsd-tests/fs/hfs/t_pathconvert.c b/contrib/netbsd-tests/fs/hfs/t_pathconvert.c
index 307de70..056726a 100644
--- a/contrib/netbsd-tests/fs/hfs/t_pathconvert.c
+++ b/contrib/netbsd-tests/fs/hfs/t_pathconvert.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pathconvert.c,v 1.5 2011/02/25 20:54:18 martin Exp $ */
+/* $NetBSD: t_pathconvert.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -18,7 +18,7 @@
#include <fs/hfs/hfs.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(colonslash);
ATF_TC_HEAD(colonslash, tc)
diff --git a/contrib/netbsd-tests/fs/kernfs/t_basic.c b/contrib/netbsd-tests/fs/kernfs/t_basic.c
index e5ba4a7..77acd11 100644
--- a/contrib/netbsd-tests/fs/kernfs/t_basic.c
+++ b/contrib/netbsd-tests/fs/kernfs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.3 2010/05/31 23:44:54 pooka Exp $ */
+/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -20,7 +20,7 @@
#include <miscfs/kernfs/kernfs.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(getdents);
ATF_TC_HEAD(getdents, tc)
diff --git a/contrib/netbsd-tests/fs/lfs/t_pr.c b/contrib/netbsd-tests/fs/lfs/t_pr.c
index 97cb1db..ed676d8 100644
--- a/contrib/netbsd-tests/fs/lfs/t_pr.c
+++ b/contrib/netbsd-tests/fs/lfs/t_pr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka Exp $ */
+/* $NetBSD: t_pr.c,v 1.7 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <ufs/ufs/ufsmount.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(mknod);
ATF_TC_HEAD(mknod, tc)
diff --git a/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c b/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c
index 8b5708f..449e625 100644
--- a/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c
+++ b/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snapshot.c,v 1.3 2014/06/10 13:15:18 martin Exp $ */
+/* $NetBSD: t_snapshot.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <string.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define IMGNAME "msdosfs.img"
#define NEWFS "newfs_msdos -C 5M " IMGNAME
diff --git a/contrib/netbsd-tests/fs/nfs/t_mountd.c b/contrib/netbsd-tests/fs/nfs/t_mountd.c
index b6c1528..6272587 100644
--- a/contrib/netbsd-tests/fs/nfs/t_mountd.c
+++ b/contrib/netbsd-tests/fs/nfs/t_mountd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mountd.c,v 1.5 2012/02/24 13:53:46 joerg Exp $ */
+/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../common/h_fsmacros.h"
ATF_TC(mountdhup);
diff --git a/contrib/netbsd-tests/fs/nullfs/t_basic.c b/contrib/netbsd-tests/fs/nullfs/t_basic.c
index 21dfccd..d54f773 100644
--- a/contrib/netbsd-tests/fs/nullfs/t_basic.c
+++ b/contrib/netbsd-tests/fs/nullfs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.3 2010/06/09 08:37:16 pooka Exp $ */
+/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -18,7 +18,7 @@
#include <miscfs/nullfs/null.h>
#include <fs/tmpfs/tmpfs_args.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(basic);
ATF_TC_HEAD(basic, tc)
diff --git a/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c b/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c
index 9265f32..fcc7e47 100644
--- a/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c
+++ b/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_nullpts.c,v 1.5 2011/01/10 11:11:04 hannken Exp $ */
+/* $NetBSD: t_nullpts.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -19,7 +19,7 @@
#include <fs/ptyfs/ptyfs.h>
#include <miscfs/nullfs/null.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
mountptyfs(const char *mp, int flags)
diff --git a/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
index 90001b9..108c344 100644
--- a/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
+++ b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */
+/* $NetBSD: t_ptyfs.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <fs/ptyfs/ptyfs.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
mountptyfs(const char *mp, int flags)
diff --git a/contrib/netbsd-tests/fs/puffs/t_basic.c b/contrib/netbsd-tests/fs/puffs/t_basic.c
index 735108d..4b5b7b8 100644
--- a/contrib/netbsd-tests/fs/puffs/t_basic.c
+++ b/contrib/netbsd-tests/fs/puffs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */
+/* $NetBSD: t_basic.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -20,7 +20,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../common/h_fsmacros.h"
/*
diff --git a/contrib/netbsd-tests/fs/puffs/t_fuzz.c b/contrib/netbsd-tests/fs/puffs/t_fuzz.c
index 1d249c0..b2e000d 100644
--- a/contrib/netbsd-tests/fs/puffs/t_fuzz.c
+++ b/contrib/netbsd-tests/fs/puffs/t_fuzz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fuzz.c,v 1.5 2012/04/21 01:03:46 manu Exp $ */
+/* $NetBSD: t_fuzz.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define ITERATIONS 100
diff --git a/contrib/netbsd-tests/fs/puffs/t_io.c b/contrib/netbsd-tests/fs/puffs/t_io.c
index 37c386c..72b5d85 100644
--- a/contrib/netbsd-tests/fs/puffs/t_io.c
+++ b/contrib/netbsd-tests/fs/puffs/t_io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_io.c,v 1.1 2010/11/12 17:33:28 pooka Exp $ */
+/* $NetBSD: t_io.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -20,7 +20,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../common/h_fsmacros.h"
#define MAKEOPTS(...) \
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
index 037dc16..62c7cce 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
@@ -106,15 +106,7 @@ pipe_body() {
test_mount
umask 022
- # Begin FreeBSD
- if true; then
- atf_check -s eq:0 -o empty -e empty mkfifo pipe
- else
- # End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod pipe p
- # Begin FreeBSD
- fi
- # End FreeBSD
eval $(stat -s pipe)
[ ${st_mode} = 010644 ] || atf_fail "Invalid mode"
@@ -132,15 +124,7 @@ pipe_kqueue_body() {
umask 022
atf_check -s eq:0 -o empty -e empty mkdir dir
- # Begin FreeBSD
- if true; then
- echo 'mkfifo dir/pipe' | kqueue_monitor 1 dir
- else
- # End FreeBSD
echo 'mknod dir/pipe p' | kqueue_monitor 1 dir
- # Begin FreeBSD
- fi
- # End FreeBSD
kqueue_check dir NOTE_WRITE
test_unmount
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
index 272c749..6f5dc3e 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
@@ -59,15 +59,7 @@ types_body() {
atf_check -s eq:0 -o empty -e empty ln -s reg lnk
atf_check -s eq:0 -o empty -e empty mknod blk b 0 0
atf_check -s eq:0 -o empty -e empty mknod chr c 0 0
- # Begin FreeBSD
- if true; then
- atf_check -s eq:0 -o empty -e empty mkfifo fifo
- else
- # End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod fifo p
- # Begin FreeBSD
- fi
- # End FreeBSD
atf_check -s eq:0 -o empty -e empty \
$(atf_get_srcdir)/h_tools sockets sock
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c b/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c
index 044937a..d7c10e4 100644
--- a/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c
+++ b/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_renamerace.c,v 1.13 2011/08/18 21:44:55 riastradh Exp $ */
+/* $NetBSD: t_renamerace.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */
/*
* Modified for rump and atf from a program supplied
@@ -23,7 +23,7 @@
#include <fs/tmpfs/tmpfs_args.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(renamerace2);
ATF_TC_HEAD(renamerace2, tc)
diff --git a/contrib/netbsd-tests/fs/umapfs/t_basic.c b/contrib/netbsd-tests/fs/umapfs/t_basic.c
index 259f6fe..c9b2d9b 100644
--- a/contrib/netbsd-tests/fs/umapfs/t_basic.c
+++ b/contrib/netbsd-tests/fs/umapfs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.4 2010/07/19 15:35:39 pooka Exp $ */
+/* $NetBSD: t_basic.c,v 1.5 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/param.h>
@@ -20,7 +20,7 @@
#include <fs/tmpfs/tmpfs_args.h>
#include <miscfs/umapfs/umap.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(basic);
ATF_TC_HEAD(basic, tc)
diff --git a/contrib/netbsd-tests/fs/union/t_pr.c b/contrib/netbsd-tests/fs/union/t_pr.c
index 2d0c0c8..fc70bca 100644
--- a/contrib/netbsd-tests/fs/union/t_pr.c
+++ b/contrib/netbsd-tests/fs/union/t_pr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pr.c,v 1.8 2011/08/10 06:27:02 hannken Exp $ */
+/* $NetBSD: t_pr.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <miscfs/union/union.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(multilayer);
ATF_TC_HEAD(multilayer, tc)
diff --git a/contrib/netbsd-tests/fs/vfs/t_full.c b/contrib/netbsd-tests/fs/vfs/t_full.c
index f338a02..51347de 100644
--- a/contrib/netbsd-tests/fs/vfs/t_full.c
+++ b/contrib/netbsd-tests/fs/vfs/t_full.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_full.c,v 1.8 2013/03/16 05:45:37 jmmv Exp $ */
+/* $NetBSD: t_full.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
/*
* Write this much over the image size. This is to force an NFS commit,
diff --git a/contrib/netbsd-tests/fs/vfs/t_io.c b/contrib/netbsd-tests/fs/vfs/t_io.c
index 23c3a15..b7f6529 100644
--- a/contrib/netbsd-tests/fs/vfs/t_io.c
+++ b/contrib/netbsd-tests/fs/vfs/t_io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $ */
+/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
#define TESTSTR "this is a string. collect enough and you'll have Em"
#define TESTSZ sizeof(TESTSTR)
diff --git a/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c b/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c
new file mode 100644
index 0000000..bb07609
--- /dev/null
+++ b/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__COPYRIGHT("@(#) Copyright (c) 2013\
+ The NetBSD Foundation, inc. All rights reserved.");
+__RCSID("$NetBSD: t_mtime_otrunc.c,v 1.1 2017/02/02 22:07:05 martin Exp $");
+
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <atf-c.h>
+
+#include <rump/rump_syscalls.h>
+#include <rump/rump.h>
+
+#include "../common/h_fsmacros.h"
+
+#define LOCKFILE "lock"
+
+static time_t
+lock_it(void)
+{
+ struct stat st;
+
+ if (rump_sys_stat(LOCKFILE, &st) != 0)
+ st.st_mtime = 0;
+
+ int f = rump_sys_open(LOCKFILE, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+ if (f == -1) return 0;
+ rump_sys_close(f);
+
+ return st.st_mtime;
+}
+
+static void
+otrunc_mtime_update(const atf_tc_t *tc, const char *path)
+{
+ time_t last_ts = 0;
+ int res;
+
+ /* atf_tc_expect_fail("PR kern/51762"); */
+
+ res = rump_sys_chdir(path);
+ if (res == -1)
+ atf_tc_fail("chdir failed");
+
+ for (int i = 0; i < 5; i++) {
+ time_t l = lock_it();
+ printf("last lock: %ld\n", (long)l);
+ ATF_REQUIRE_MSG(i == 0 || l > last_ts,
+ "iteration %d: lock time did not increase, old time %lu, "
+ "new time %lu", i,
+ (unsigned long)last_ts, (unsigned long)l);
+ last_ts = l;
+ sleep(2);
+ }
+ rump_sys_chdir("/");
+}
+
+ATF_FSAPPLY(otrunc_mtime_update, "Checks for mtime updates by open(O_TRUNC) (PR kern/51762)");
diff --git a/contrib/netbsd-tests/fs/vfs/t_renamerace.c b/contrib/netbsd-tests/fs/vfs/t_renamerace.c
index 809c380..63cfb44 100644
--- a/contrib/netbsd-tests/fs/vfs/t_renamerace.c
+++ b/contrib/netbsd-tests/fs/vfs/t_renamerace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_renamerace.c,v 1.33 2016/05/04 08:30:22 dholland Exp $ */
+/* $NetBSD: t_renamerace.c,v 1.34 2017/01/13 21:30:40 christos Exp $ */
/*
* Modified for rump and atf from a program supplied
@@ -34,7 +34,7 @@
#define FSTEST_IMGSIZE (50000 * 512)
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
static volatile int quittingtime;
pid_t wrkpid;
diff --git a/contrib/netbsd-tests/fs/vfs/t_ro.c b/contrib/netbsd-tests/fs/vfs/t_ro.c
index b1e1179..f7f4581 100644
--- a/contrib/netbsd-tests/fs/vfs/t_ro.c
+++ b/contrib/netbsd-tests/fs/vfs/t_ro.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ro.c,v 1.5 2011/02/22 21:23:19 yamt Exp $ */
+/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
#define AFILE "testfile"
#define ADIR "testdir"
diff --git a/contrib/netbsd-tests/fs/vfs/t_rwtoro.c b/contrib/netbsd-tests/fs/vfs/t_rwtoro.c
new file mode 100644
index 0000000..ca8af07
--- /dev/null
+++ b/contrib/netbsd-tests/fs/vfs/t_rwtoro.c
@@ -0,0 +1,233 @@
+/* $NetBSD: t_rwtoro.c,v 1.1 2017/01/27 10:45:11 hannken Exp $ */
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+
+#include <atf-c.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <rump/rump_syscalls.h>
+#include <rump/rump.h>
+
+#include <miscfs/nullfs/null.h>
+#include <fs/tmpfs/tmpfs_args.h>
+
+#include "../common/h_fsmacros.h"
+#include "../../h_macros.h"
+
+static const char *unsupported = "fs does not support r/o remount";
+static char file_path[MAXPATHLEN];
+static int file_fd;
+
+/*
+ * Remount the filesystem read-only and test errno.
+ * Skip filesystems that don't implement read-write -> read-only.
+ */
+static void
+remount_ro(const atf_tc_t *tc, const char *mp, int expected_errno)
+{
+ int error;
+ union {
+ struct tmpfs_args tmpfs;
+ char data[4095];
+ } mount_args;
+ int mount_args_length;
+ struct statvfs sbuf;
+
+ if (FSTYPE_ZFS(tc))
+ atf_tc_skip("%s", unsupported);
+
+ /* Prepare mount arguments. */
+ RL(rump_sys_statvfs1(mp, &sbuf, ST_WAIT));
+ mount_args_length = sizeof(mount_args);
+ memset(&mount_args, 0, mount_args_length);
+ if (FSTYPE_TMPFS(tc))
+ mount_args.tmpfs.ta_version = TMPFS_ARGS_VERSION;
+ mount_args_length = rump_sys_mount(sbuf.f_fstypename, mp, MNT_GETARGS,
+ &mount_args, mount_args_length);
+ ATF_CHECK(mount_args_length >= 0);
+
+ /* Remount and test result. */
+ error = rump_sys_mount(sbuf.f_fstypename, mp, MNT_UPDATE | MNT_RDONLY,
+ &mount_args, mount_args_length);
+ if (errno == EOPNOTSUPP)
+ atf_tc_skip("%s", unsupported);
+ if (expected_errno == 0)
+ ATF_CHECK(error == 0);
+ else
+ ATF_CHECK_ERRNO(expected_errno, error == -1);
+}
+
+static void
+open_file_ro(const char *prefix)
+{
+
+ snprintf(file_path, sizeof(file_path), "%s/file", prefix);
+ RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
+ RL(rump_sys_close(file_fd));
+ RL(file_fd = rump_sys_open(file_path, O_RDONLY));
+}
+
+static void
+open_file_ro_unlink(const char *prefix)
+{
+
+ snprintf(file_path, sizeof(file_path), "%s/file", prefix);
+ RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
+ RL(rump_sys_close(file_fd));
+ RL(file_fd = rump_sys_open(file_path, O_RDONLY));
+ RL(rump_sys_unlink(file_path));
+}
+
+static void
+open_file_rw(const char *prefix)
+{
+
+ snprintf(file_path, sizeof(file_path), "%s/file", prefix);
+ RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777));
+}
+
+static void
+close_file(const char *unused)
+{
+
+ RL(rump_sys_close(file_fd));
+}
+
+static void
+basic_test(const atf_tc_t *tc, const char *mp, int expected_errno,
+ bool use_layer, void (*pre)(const char *), void (*post)(const char *))
+{
+ const char *null_mount = "/nullm";
+ struct null_args nargs;
+
+ if (use_layer) {
+ RL(rump_sys_mkdir(null_mount, 0777));
+ memset(&nargs, 0, sizeof(nargs));
+ nargs.nulla_target = __UNCONST(mp);;
+ RL(rump_sys_mount(MOUNT_NULL, null_mount, 0,
+ &nargs, sizeof(nargs)));
+ }
+ if (pre)
+ (*pre)(use_layer ? null_mount : mp);
+ remount_ro(tc, mp, expected_errno);
+ if (post)
+ (*post)(use_layer ? null_mount : mp);
+ if (use_layer)
+ RL(rump_sys_unmount(null_mount, 0));
+}
+
+static void
+noneopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, 0, false, NULL, NULL);
+}
+
+static void
+readopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, 0, false, open_file_ro, close_file);
+}
+
+static void
+writeopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, EBUSY, false, open_file_rw, close_file);
+}
+
+static void
+read_unlinked(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, EBUSY, false, open_file_ro_unlink, close_file);
+}
+
+static void
+layer_noneopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, 0, true, NULL, NULL);
+}
+
+static void
+layer_readopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, 0, true, open_file_ro, close_file);
+}
+
+static void
+layer_writeopen(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, EBUSY, true, open_file_rw, close_file);
+}
+
+static void
+layer_read_unlinked(const atf_tc_t *tc, const char *mp)
+{
+
+ basic_test(tc, mp, EBUSY, true, open_file_ro_unlink, close_file);
+}
+
+ATF_TC_FSAPPLY(noneopen, "remount r/o with no file open");
+ATF_TC_FSAPPLY(readopen, "remount r/o with file open for reading");
+ATF_TC_FSAPPLY(writeopen, "remount r/o with file open for writing");
+ATF_TC_FSAPPLY(read_unlinked,
+ "remount r/o with unlinked file open for reading");
+ATF_TC_FSAPPLY(layer_noneopen, "remount r/o with no file open on layer");
+ATF_TC_FSAPPLY(layer_readopen,
+ "remount r/o with file open for reading on layer");
+ATF_TC_FSAPPLY(layer_writeopen,
+ "remount r/o with file open for writing on layer");
+ATF_TC_FSAPPLY(layer_read_unlinked,
+ "remount r/o with unlinked file open for reading on layer");
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_FSAPPLY(noneopen);
+ ATF_TP_FSAPPLY(readopen);
+ ATF_TP_FSAPPLY(writeopen);
+ ATF_TP_FSAPPLY(read_unlinked);
+ ATF_TP_FSAPPLY(layer_noneopen);
+ ATF_TP_FSAPPLY(layer_readopen);
+ ATF_TP_FSAPPLY(layer_writeopen);
+ ATF_TP_FSAPPLY(layer_read_unlinked);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/fs/vfs/t_union.c b/contrib/netbsd-tests/fs/vfs/t_union.c
index bdcef93..5da1ea1 100644
--- a/contrib/netbsd-tests/fs/vfs/t_union.c
+++ b/contrib/netbsd-tests/fs/vfs/t_union.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_union.c,v 1.8 2011/08/07 06:01:51 hannken Exp $ */
+/* $NetBSD: t_union.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -17,7 +17,7 @@
#include <miscfs/union/union.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../common/h_fsmacros.h"
#define MSTR "magic bus"
diff --git a/contrib/netbsd-tests/fs/vfs/t_unpriv.c b/contrib/netbsd-tests/fs/vfs/t_unpriv.c
index 6da771b4..6536c21 100644
--- a/contrib/netbsd-tests/fs/vfs/t_unpriv.c
+++ b/contrib/netbsd-tests/fs/vfs/t_unpriv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unpriv.c,v 1.12 2015/04/09 19:51:13 riastradh Exp $ */
+/* $NetBSD: t_unpriv.c,v 1.13 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
#define USES_OWNER \
if (FSTYPE_MSDOS(tc)) \
diff --git a/contrib/netbsd-tests/fs/vfs/t_vfsops.c b/contrib/netbsd-tests/fs/vfs/t_vfsops.c
index 1bcee89..bbed9f9 100644
--- a/contrib/netbsd-tests/fs/vfs/t_vfsops.c
+++ b/contrib/netbsd-tests/fs/vfs/t_vfsops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vfsops.c,v 1.11 2011/04/04 19:16:58 hannken Exp $ */
+/* $NetBSD: t_vfsops.c,v 1.12 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
tmount(const atf_tc_t *tc, const char *path)
diff --git a/contrib/netbsd-tests/fs/vfs/t_vnops.c b/contrib/netbsd-tests/fs/vfs/t_vnops.c
index 978fadb..7da53c8 100644
--- a/contrib/netbsd-tests/fs/vfs/t_vnops.c
+++ b/contrib/netbsd-tests/fs/vfs/t_vnops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */
+/* $NetBSD: t_vnops.c,v 1.59 2017/01/13 21:30:40 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
#include <rump/rump.h>
#include "../common/h_fsmacros.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
#define TESTFILE "afile"
diff --git a/contrib/netbsd-tests/include/sys/t_socket.c b/contrib/netbsd-tests/include/sys/t_socket.c
index f60941c..9db2247 100644
--- a/contrib/netbsd-tests/include/sys/t_socket.c
+++ b/contrib/netbsd-tests/include/sys/t_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_socket.c,v 1.4 2015/02/27 08:30:30 martin Exp $ */
+/* $NetBSD: t_socket.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -18,7 +18,7 @@
#include <unistd.h>
#include <util.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(cmsg_sendfd_bounds);
ATF_TC_HEAD(cmsg_sendfd_bounds, tc)
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait.c
new file mode 100644
index 0000000..09c17e1
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait.c
@@ -0,0 +1,1606 @@
+/* $NetBSD: t_ptrace_wait.c,v 1.11 2017/01/18 05:14:34 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.11 2017/01/18 05:14:34 kamil Exp $");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <sys/wait.h>
+#include <machine/reg.h>
+#include <x86/dbregs.h>
+#include <err.h>
+#include <errno.h>
+#include <sched.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+#include "h_macros.h"
+
+#include "../../t_ptrace_wait.h"
+
+
+#if defined(HAVE_GPREGS)
+ATF_TC(regs1);
+ATF_TC_HEAD(regs1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_GETREGS and iterate over General Purpose registers");
+}
+
+ATF_TC_BODY(regs1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ struct reg r;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Call GETREGS for the child process\n");
+ ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
+
+ printf("RAX=%#" PRIxREGISTER "\n", r.regs[_REG_RAX]);
+ printf("RBX=%#" PRIxREGISTER "\n", r.regs[_REG_RBX]);
+ printf("RCX=%#" PRIxREGISTER "\n", r.regs[_REG_RCX]);
+ printf("RDX=%#" PRIxREGISTER "\n", r.regs[_REG_RDX]);
+
+ printf("RDI=%#" PRIxREGISTER "\n", r.regs[_REG_RDI]);
+ printf("RSI=%#" PRIxREGISTER "\n", r.regs[_REG_RSI]);
+
+ printf("GS=%#" PRIxREGISTER "\n", r.regs[_REG_GS]);
+ printf("FS=%#" PRIxREGISTER "\n", r.regs[_REG_FS]);
+ printf("ES=%#" PRIxREGISTER "\n", r.regs[_REG_ES]);
+ printf("DS=%#" PRIxREGISTER "\n", r.regs[_REG_DS]);
+ printf("CS=%#" PRIxREGISTER "\n", r.regs[_REG_CS]);
+ printf("SS=%#" PRIxREGISTER "\n", r.regs[_REG_SS]);
+
+ printf("RSP=%#" PRIxREGISTER "\n", r.regs[_REG_RSP]);
+ printf("RIP=%#" PRIxREGISTER "\n", r.regs[_REG_RIP]);
+
+ printf("RFLAGS=%#" PRIxREGISTER "\n", r.regs[_REG_RFLAGS]);
+
+ printf("R8=%#" PRIxREGISTER "\n", r.regs[_REG_R8]);
+ printf("R9=%#" PRIxREGISTER "\n", r.regs[_REG_R9]);
+ printf("R10=%#" PRIxREGISTER "\n", r.regs[_REG_R10]);
+ printf("R11=%#" PRIxREGISTER "\n", r.regs[_REG_R11]);
+ printf("R12=%#" PRIxREGISTER "\n", r.regs[_REG_R12]);
+ printf("R13=%#" PRIxREGISTER "\n", r.regs[_REG_R13]);
+ printf("R14=%#" PRIxREGISTER "\n", r.regs[_REG_R14]);
+ printf("R15=%#" PRIxREGISTER "\n", r.regs[_REG_R15]);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_count);
+ATF_TC_HEAD(watchpoint_count, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and assert four available watchpoints");
+}
+
+ATF_TC_BODY(watchpoint_count, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ int N;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Call GETREGS for the child process\n");
+ ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1);
+ printf("Reported %d watchpoints\n", N);
+
+ ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_read);
+ATF_TC_HEAD(watchpoint_read, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and assert four available watchpoints");
+}
+
+ATF_TC_BODY(watchpoint_read, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ int i, N;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Call GETREGS for the child process\n");
+ ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1);
+
+ ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N);
+
+ for (i = 0; i < N; i++) {
+ printf("Before reading watchpoint %d\n", i);
+ pw.pw_index = i;
+ ATF_REQUIRE(ptrace(PT_READ_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+ }
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_write_unmodified);
+ATF_TC_HEAD(watchpoint_write_unmodified, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and assert functional write of "
+ "unmodified data");
+}
+
+ATF_TC_BODY(watchpoint_write_unmodified, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ int i, N;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Call GETREGS for the child process\n");
+ ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1);
+
+ ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N);
+
+ for (i = 0; i < N; i++) {
+ printf("Before reading watchpoint %d\n", i);
+ pw.pw_index = i;
+ ATF_REQUIRE(ptrace(PT_READ_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d (unmodified)\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len)
+ != -1);
+ }
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_code0);
+ATF_TC_HEAD(watchpoint_trap_code0, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 0");
+}
+
+ATF_TC_BODY(watchpoint_trap_code0, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 0;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_lwpid = 0;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = (void *)check_happy;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 0);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ pw.pw_md.md_address = NULL;
+ printf("Before writing watchpoint %d (disable it)\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_code1);
+ATF_TC_HEAD(watchpoint_trap_code1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 1");
+}
+
+ATF_TC_BODY(watchpoint_trap_code1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 1;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_lwpid = 0;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = (void *)check_happy;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%d\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 1);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ pw.pw_md.md_address = NULL;
+ printf("Before writing watchpoint %d (disable it)\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_code2);
+ATF_TC_HEAD(watchpoint_trap_code2, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 2");
+}
+
+ATF_TC_BODY(watchpoint_trap_code2, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 2;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_lwpid = 0;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = (void *)check_happy;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 2);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ pw.pw_md.md_address = NULL;
+ printf("Before writing watchpoint %d (disable it)\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_code3);
+ATF_TC_HEAD(watchpoint_trap_code3, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 3");
+}
+
+ATF_TC_BODY(watchpoint_trap_code3, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 3;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("check_happy(%d)=%d\n", watchme, check_happy(watchme));
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_lwpid = 0;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = (void *)check_happy;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 3);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ pw.pw_md.md_address = NULL;
+ printf("Before writing watchpoint %d (disable it)\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_write0);
+ATF_TC_HEAD(watchpoint_trap_data_write0, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 0");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_write0, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 0;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ ++watchme;
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = 0;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 0);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_write1);
+ATF_TC_HEAD(watchpoint_trap_data_write1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 1");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_write1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 1;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ ++watchme;
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 1);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_write2);
+ATF_TC_HEAD(watchpoint_trap_data_write2, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 2");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_write2, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 2;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ ++watchme;
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 2);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_write3);
+ATF_TC_HEAD(watchpoint_trap_data_write3, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 3");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_write3, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 3;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ ++watchme;
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 3);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_rw0);
+ATF_TC_HEAD(watchpoint_trap_data_rw0, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 0");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_rw0, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 0;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("watchme=%d\n", watchme);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 0);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_rw1);
+ATF_TC_HEAD(watchpoint_trap_data_rw1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 1");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_rw1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 1;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("watchme=%d\n", watchme);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 1);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_rw2);
+ATF_TC_HEAD(watchpoint_trap_data_rw2, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 2");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_rw2, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 2;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("watchme=%d\n", watchme);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 2);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(__HAVE_PTRACE_WATCHPOINTS)
+ATF_TC(watchpoint_trap_data_rw3);
+ATF_TC_HEAD(watchpoint_trap_data_rw3, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 3");
+}
+
+ATF_TC_BODY(watchpoint_trap_data_rw3, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ const int i = 3;
+ struct ptrace_watchpoint pw;
+ int len = sizeof(pw);
+ int watchme = 1234;
+ struct ptrace_siginfo info;
+ memset(&info, 0, sizeof(info));
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("watchme=%d\n", watchme);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Preparing code watchpoint trap %d\n", i);
+
+ pw.pw_index = i;
+ pw.pw_type = PTRACE_PW_TYPE_DBREGS;
+ pw.pw_md.md_address = &watchme;
+ pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE;
+ pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE;
+
+ printf("struct ptrace {\n");
+ printf("\t.pw_index=%d\n", pw.pw_index);
+ printf("\t.pw_lwpid=%d\n", pw.pw_lwpid);
+ printf("\t.pw_type=%#x\n", pw.pw_type);
+ printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address);
+ printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition);
+ printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length);
+ printf("}\n");
+
+ printf("Before writing watchpoint %d\n", i);
+ ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1);
+
+ printf("Before resuming the child process where it left off "
+ "and without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+ ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1);
+
+ printf("Signal traced to lwpid=%d\n", info.psi_lwpid);
+ printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+ info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+ info.psi_siginfo.si_errno);
+
+ printf("Before checking siginfo_t\n");
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_HWWPT);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap2, 3);
+ ATF_REQUIRE_EQ(info.psi_siginfo.si_trap3, X86_HW_WATCHPOINT_EVENT_FIRED);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+ATF_TP_ADD_TCS(tp)
+{
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+
+ ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
+
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_count);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_read);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_write_unmodified);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code0);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code1);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code2);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code3);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write0);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write1);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write2);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write3);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw0);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw1);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw2);
+ ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw3);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait3.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait3.c
new file mode 100644
index 0000000..c5dfe73
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait3.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT3
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait4.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait4.c
new file mode 100644
index 0000000..7e1fed9
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait4.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT4
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait6.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait6.c
new file mode 100644
index 0000000..601efe3
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_wait6.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT6
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitid.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitid.c
new file mode 100644
index 0000000..5ec17a9
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitid.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAITID
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitpid.c b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitpid.c
new file mode 100644
index 0000000..78b341c
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/amd64/t_ptrace_waitpid.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAITPID
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait.c
new file mode 100644
index 0000000..698573b
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait.c
@@ -0,0 +1,141 @@
+/* $NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+#include <sys/wait.h>
+#include <machine/reg.h>
+#include <err.h>
+#include <errno.h>
+#include <sched.h>
+#include <signal.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+#include "h_macros.h"
+
+#include "../../t_ptrace_wait.h"
+
+
+#if defined(HAVE_GPREGS)
+ATF_TC(regs1);
+ATF_TC_HEAD(regs1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Call PT_GETREGS and iterate over General Purpose registers");
+}
+
+ATF_TC_BODY(regs1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ struct reg r;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Call GETREGS for the child process\n");
+ ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1);
+
+ printf("EAX=%#" PRIxREGISTER "\n", r.r_eax);
+ printf("EBX=%#" PRIxREGISTER "\n", r.r_ebx);
+ printf("ECX=%#" PRIxREGISTER "\n", r.r_ecx);
+ printf("EDX=%#" PRIxREGISTER "\n", r.r_edx);
+
+ printf("ESP=%#" PRIxREGISTER "\n", r.r_esp);
+ printf("EBP=%#" PRIxREGISTER "\n", r.r_ebp);
+
+ printf("ESI=%#" PRIxREGISTER "\n", r.r_esi);
+ printf("EDI=%#" PRIxREGISTER "\n", r.r_edi);
+
+ printf("EIP=%#" PRIxREGISTER "\n", r.r_eip);
+
+ printf("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags);
+
+ printf("CS=%#" PRIxREGISTER "\n", r.r_cs);
+ printf("SS=%#" PRIxREGISTER "\n", r.r_ss);
+ printf("DS=%#" PRIxREGISTER "\n", r.r_ds);
+ printf("ES=%#" PRIxREGISTER "\n", r.r_es);
+ printf("FS=%#" PRIxREGISTER "\n", r.r_fs);
+ printf("GS=%#" PRIxREGISTER "\n", r.r_gs);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+ATF_TP_ADD_TCS(tp)
+{
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+
+ ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait3.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait3.c
new file mode 100644
index 0000000..56dda8e
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait3.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT3
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait4.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait4.c
new file mode 100644
index 0000000..5fbdb53
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait4.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT4
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait6.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait6.c
new file mode 100644
index 0000000..117c844
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_wait6.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAIT6
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitid.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitid.c
new file mode 100644
index 0000000..274e8bd
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitid.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAITID
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitpid.c b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitpid.c
new file mode 100644
index 0000000..2fe5c57
--- /dev/null
+++ b/contrib/netbsd-tests/kernel/arch/i386/t_ptrace_waitpid.c
@@ -0,0 +1,30 @@
+/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TWAIT_WAITPID
+#include "t_ptrace_wait.c"
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c b/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
index 19c7b02..1f40ada 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
+/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
+__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/stat.h>
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
#define FIFONAME "fifo"
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_file.c b/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
index 80479af..f4669d2 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
+/* $NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
+__RCSID("$NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/event.h>
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
#define FILENAME "file"
#define NLINES 5
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_file2.c b/contrib/netbsd-tests/kernel/kqueue/read/t_file2.c
index c77d283..733caeb 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_file2.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_file2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
+/* $NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
+__RCSID("$NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
@@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
ATF_TC(file2);
ATF_TC_HEAD(file2, tc)
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c b/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
index 2cdd015..56cb037 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
+/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
+__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
@@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
ATF_TC(pipe);
ATF_TC_HEAD(pipe, tc)
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c b/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
index 57ccf92..3703829 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
+/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
+__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
static void
h_check(bool check_master)
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c b/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c
index d996fdf..78b0587 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
+/* $NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
+__RCSID("$NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/ioctl.h>
@@ -42,7 +42,7 @@ __RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(kfilter_byfilter);
ATF_TC_HEAD(kfilter_byfilter, tc)
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc1.c b/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
index aa806ba..5f8c2a4 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
+/* $NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
+__RCSID("$NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
/*
* this also used to trigger problem fixed in
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static int
child(void)
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
index 2d8d7f7..2d905ed 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
+/* $NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,11 +32,8 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
+__RCSID("$NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -50,7 +47,7 @@ __RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static void
child_two(void)
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
index eac2f9c..6def409 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */
+/* $NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,11 +30,8 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
+__RCSID("$NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -48,7 +45,7 @@ __RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(proc3);
ATF_TC_HEAD(proc3, tc)
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_sig.c b/contrib/netbsd-tests/kernel/kqueue/t_sig.c
index ebbd76e..12e3d61 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_sig.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_sig.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */
+/* $NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,11 +32,8 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
+__RCSID("$NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#endif
#include <sys/event.h>
#include <sys/ioctl.h>
#include <sys/param.h>
@@ -51,7 +48,7 @@ __RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#define NSIGNALS 5
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
index 06ef683..e87c2b2 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
@@ -1,6 +1,3 @@
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#endif
#include <sys/event.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c b/contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c
index 82b256c..fe375b8 100644
--- a/contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c
+++ b/contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */
+/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
+__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/stat.h>
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
#define FIFONAME "fifo"
diff --git a/contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c b/contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c
index 459a1f7..5b2ca8c 100644
--- a/contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c
+++ b/contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
+/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
+__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@@ -44,7 +44,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
ATF_TC(pipe1);
ATF_TC_HEAD(pipe1, tc)
diff --git a/contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c b/contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c
index 6983910..45a6750 100644
--- a/contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c
+++ b/contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $ */
+/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $");
+__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/event.h>
#include <sys/wait.h>
@@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
static void
h_check(bool check_master)
diff --git a/contrib/netbsd-tests/kernel/t_extent.c b/contrib/netbsd-tests/kernel/t_extent.c
index faefafa..57dfc2b 100644
--- a/contrib/netbsd-tests/kernel/t_extent.c
+++ b/contrib/netbsd-tests/kernel/t_extent.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $ */
+/* $NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $");
+__RCSID("$NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $");
#include <atf-c.h>
-#include "../h_macros.h"
+#include "h_macros.h"
static int ret;
static struct extent *ex;
diff --git a/contrib/netbsd-tests/kernel/t_filedesc.c b/contrib/netbsd-tests/kernel/t_filedesc.c
index 6b367ee..a938d6f 100644
--- a/contrib/netbsd-tests/kernel/t_filedesc.c
+++ b/contrib/netbsd-tests/kernel/t_filedesc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $ */
+/* $NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $");
+__RCSID("$NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
@@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../h_macros.h"
+#include "h_macros.h"
ATF_TC(getfilerace);
ATF_TC_HEAD(getfilerace, tc)
diff --git a/contrib/netbsd-tests/kernel/t_lock.c b/contrib/netbsd-tests/kernel/t_lock.c
index 3704afb..bd83abe 100644
--- a/contrib/netbsd-tests/kernel/t_lock.c
+++ b/contrib/netbsd-tests/kernel/t_lock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
+/* $NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
+__RCSID("$NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/time.h>
@@ -38,7 +38,7 @@ __RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include <atf-c.h>
-#include "../h_macros.h"
+#include "h_macros.h"
__cpu_simple_lock_t lk;
volatile int handled = 0;
diff --git a/contrib/netbsd-tests/kernel/t_mqueue.c b/contrib/netbsd-tests/kernel/t_mqueue.c
index 485269f..7edbbc9 100644
--- a/contrib/netbsd-tests/kernel/t_mqueue.c
+++ b/contrib/netbsd-tests/kernel/t_mqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mqueue.c,v 1.5 2017/01/10 22:10:22 christos Exp $ */
+/* $NetBSD: t_mqueue.c,v 1.6 2017/01/14 20:57:24 christos Exp $ */
/*
* Test for POSIX message queue priority handling.
@@ -6,23 +6,20 @@
* This file is in the Public Domain.
*/
-#ifdef __FreeBSD__
#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "freebsd_test_suite/macros.h"
-#endif
#include <atf-c.h>
-#include <sys/stat.h>
-
+#include <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <unistd.h>
-#include <mqueue.h>
+#ifdef __FreeBSD__
+#include "freebsd_test_suite/macros.h"
+#endif
#define MQ_PRIO_BASE 24
diff --git a/contrib/netbsd-tests/kernel/t_ptrace.c b/contrib/netbsd-tests/kernel/t_ptrace.c
index 074a953..dc0bbdb 100644
--- a/contrib/netbsd-tests/kernel/t_ptrace.c
+++ b/contrib/netbsd-tests/kernel/t_ptrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $ */
+/* $NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $");
#include <atf-c.h>
-#include "../h_macros.h"
+#include "h_macros.h"
/*
* A child process cannot call atf functions and expect them to magically
diff --git a/contrib/netbsd-tests/kernel/t_ptrace_wait.c b/contrib/netbsd-tests/kernel/t_ptrace_wait.c
index e502a03..9d08c0e 100644
--- a/contrib/netbsd-tests/kernel/t_ptrace_wait.c
+++ b/contrib/netbsd-tests/kernel/t_ptrace_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $ */
+/* $NetBSD: t_ptrace_wait.c,v 1.69 2017/01/27 16:43:07 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.69 2017/01/27 16:43:07 kamil Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -37,8 +37,10 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $");
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <machine/reg.h>
+#include <elf.h>
#include <err.h>
#include <errno.h>
+#include <lwp.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
@@ -48,7 +50,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $");
#include <atf-c.h>
-#include "../h_macros.h"
+#include "h_macros.h"
#include "t_ptrace_wait.h"
#include "msg.h"
@@ -65,6 +67,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $");
#define PARENT_FROM_CHILD(info, fds, msg) \
ATF_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0)
+
ATF_TC(traceme1);
ATF_TC_HEAD(traceme1, tc)
{
@@ -1071,6 +1074,228 @@ ATF_TC_BODY(eventmask2, tc)
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
}
+ATF_TC(eventmask3);
+ATF_TC_HEAD(eventmask3, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that PTRACE_VFORK in EVENT_MASK is preserved");
+}
+
+ATF_TC_BODY(eventmask3, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_event_t set_event, get_event;
+ const int len = sizeof(ptrace_event_t);
+
+ atf_tc_expect_fail("PR kern/51630");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ set_event.pe_set_event = PTRACE_VFORK;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
+ ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
+ ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(eventmask4);
+ATF_TC_HEAD(eventmask4, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that PTRACE_VFORK_DONE in EVENT_MASK is preserved");
+}
+
+ATF_TC_BODY(eventmask4, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_event_t set_event, get_event;
+ const int len = sizeof(ptrace_event_t);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ set_event.pe_set_event = PTRACE_VFORK_DONE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
+ ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
+ ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(eventmask5);
+ATF_TC_HEAD(eventmask5, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that PTRACE_LWP_CREATE in EVENT_MASK is preserved");
+}
+
+ATF_TC_BODY(eventmask5, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_event_t set_event, get_event;
+ const int len = sizeof(ptrace_event_t);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ set_event.pe_set_event = PTRACE_LWP_CREATE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
+ ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
+ ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(eventmask6);
+ATF_TC_HEAD(eventmask6, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that PTRACE_LWP_EXIT in EVENT_MASK is preserved");
+}
+
+ATF_TC_BODY(eventmask6, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_event_t set_event, get_event;
+ const int len = sizeof(ptrace_event_t);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ set_event.pe_set_event = PTRACE_LWP_EXIT;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1);
+ ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1);
+ ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
#if defined(TWAIT_HAVE_PID)
ATF_TC(fork1);
ATF_TC_HEAD(fork1, tc)
@@ -1296,12 +1521,6 @@ ATF_TC_BODY(vfork1, tc)
ptrace_event_t event;
const int elen = sizeof(event);
- /*
- * ptrace(2) command PT_SET_EVENT_MASK: option PTRACE_VFORK unsupported
- */
-#ifndef PTRACE_VFORK
-#define PTRACE_VFORK 0
-#endif
atf_tc_expect_fail("PR kern/51630");
printf("Before forking process PID=%d\n", getpid());
@@ -1483,6 +1702,197 @@ ATF_TC_BODY(vfork2, tc)
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
}
+ATF_TC(vforkdone1);
+ATF_TC_HEAD(vforkdone1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK "
+ "set to PTRACE_VFORK_DONE");
+}
+
+ATF_TC_BODY(vforkdone1, tc)
+{
+ const int exitval = 5;
+ const int exitval2 = 15;
+ const int sigval = SIGSTOP;
+ pid_t child, child2, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT((child2 = vfork()) != 1);
+
+ if (child2 == 0)
+ _exit(exitval2);
+
+ FORKEE_REQUIRE_SUCCESS
+ (wpid = TWAIT_GENERIC(child2, &status, 0), child2);
+
+ forkee_status_exited(status, exitval2);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Enable PTRACE_VFORK_DONE in EVENT_MASK for the child %d\n",
+ child);
+ event.pe_set_event = PTRACE_VFORK_DONE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK_DONE);
+
+ child2 = state.pe_other_pid;
+ printf("Reported PTRACE_VFORK_DONE event with forkee %d\n", child2);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGCHLD\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGCHLD);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(vforkdone2);
+ATF_TC_HEAD(vforkdone2, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK "
+ "set to PTRACE_FORK | PTRACE_VFORK_DONE");
+}
+
+ATF_TC_BODY(vforkdone2, tc)
+{
+ const int exitval = 5;
+ const int exitval2 = 15;
+ const int sigval = SIGSTOP;
+ pid_t child, child2, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT((child2 = vfork()) != 1);
+
+ if (child2 == 0)
+ _exit(exitval2);
+
+ FORKEE_REQUIRE_SUCCESS
+ (wpid = TWAIT_GENERIC(child2, &status, 0), child2);
+
+ forkee_status_exited(status, exitval2);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_FORK | PTRACE_VFORK_DONE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK_DONE);
+
+ child2 = state.pe_other_pid;
+ printf("Reported PTRACE_VFORK_DONE event with forkee %d\n", child2);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGCHLD\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGCHLD);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
ATF_TC(io_read_d1);
ATF_TC_HEAD(io_read_d1, tc)
{
@@ -1999,6 +2409,72 @@ ATF_TC_BODY(io_write_d4, tc)
TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
}
+ATF_TC(io_read_auxv1);
+ATF_TC_HEAD(io_read_auxv1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify PT_READ_AUXV called for tracee");
+}
+
+ATF_TC_BODY(io_read_auxv1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ AuxInfo ai[100], *aip;
+ struct ptrace_io_desc io = {
+ .piod_op = PIOD_READ_AUXV,
+ .piod_offs = 0,
+ .piod_addr = ai,
+ .piod_len = sizeof(ai)
+ };
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Read new AUXV from tracee (PID=%d) by tracer (PID=%d)\n",
+ child, getpid());
+ ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1);
+
+ printf("Asserting that AUXV length (%zu) is > 0\n", io.piod_len);
+ ATF_REQUIRE(io.piod_len > 0);
+
+ for (aip = ai; aip->a_type != AT_NULL; aip++)
+ printf("a_type=%#llx a_v=%#llx\n",
+ (long long int)aip->a_type, (long long int)aip->a_v);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
ATF_TC(read_d1);
ATF_TC_HEAD(read_d1, tc)
{
@@ -4989,6 +5465,1124 @@ ATF_TC_BODY(siginfo6, tc)
}
#endif
+volatile lwpid_t the_lwp_id = 0;
+
+static void
+lwp_main_func(void *arg)
+{
+ the_lwp_id = _lwp_self();
+ _lwp_exit();
+}
+
+ATF_TC(lwp_create1);
+ATF_TC_HEAD(lwp_create1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that 1 LWP creation is intercepted by ptrace(2) with "
+ "EVENT_MASK set to PTRACE_LWP_CREATE");
+}
+
+ATF_TC_BODY(lwp_create1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+ ucontext_t uc;
+ lwpid_t lid;
+ static const size_t ssize = 16*1024;
+ void *stack;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before allocating memory for stack in child\n");
+ FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
+
+ printf("Before making context for new lwp in child\n");
+ _lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
+
+ printf("Before creating new in child\n");
+ FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
+
+ printf("Before waiting for lwp %d to exit\n", lid);
+ FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
+
+ printf("Before verifying that reported %d and running lid %d "
+ "are the same\n", lid, the_lwp_id);
+ FORKEE_ASSERT_EQ(lid, the_lwp_id);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Set empty EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_LWP_CREATE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGTRAP\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_CREATE);
+
+ lid = state.pe_lwp;
+ printf("Reported PTRACE_LWP_CREATE event with lid %d\n", lid);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(lwp_exit1);
+ATF_TC_HEAD(lwp_exit1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that 1 LWP creation is intercepted by ptrace(2) with "
+ "EVENT_MASK set to PTRACE_LWP_EXIT");
+}
+
+ATF_TC_BODY(lwp_exit1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+ ucontext_t uc;
+ lwpid_t lid;
+ static const size_t ssize = 16*1024;
+ void *stack;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before allocating memory for stack in child\n");
+ FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
+
+ printf("Before making context for new lwp in child\n");
+ _lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
+
+ printf("Before creating new in child\n");
+ FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
+
+ printf("Before waiting for lwp %d to exit\n", lid);
+ FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
+
+ printf("Before verifying that reported %d and running lid %d "
+ "are the same\n", lid, the_lwp_id);
+ FORKEE_ASSERT_EQ(lid, the_lwp_id);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Set empty EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_LWP_EXIT;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGTRAP\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_EXIT);
+
+ lid = state.pe_lwp;
+ printf("Reported PTRACE_LWP_EXIT event with lid %d\n", lid);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(signal1);
+ATF_TC_HEAD(signal1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking single unrelated signal does not stop tracer "
+ "from catching other signals");
+}
+
+ATF_TC_BODY(signal1, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ const int signotmasked = SIGINT;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before raising %s from child\n",
+ strsignal(signotmasked));
+ FORKEE_ASSERT(raise(signotmasked) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, signotmasked);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(signal2);
+ATF_TC_HEAD(signal2, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee stops tracer from "
+ "catching this raised signal");
+}
+
+ATF_TC_BODY(signal2, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before raising %s breakpoint from child\n",
+ strsignal(sigmasked));
+ FORKEE_ASSERT(raise(sigmasked) == 0);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(signal3);
+ATF_TC_HEAD(signal3, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching software breakpoints");
+}
+
+ATF_TC_BODY(signal3, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before raising software breakpoint from child\n");
+#if defined(__x86_64__)
+ __asm__ __volatile__ ("int3\n;");
+#else
+ /* port me */
+#endif
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+#if defined(PT_STEP)
+ATF_TC(signal4);
+ATF_TC_HEAD(signal4, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching single step trap");
+}
+
+ATF_TC_BODY(signal4, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ int happy;
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ happy = check_happy(100);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT_EQ(happy, check_happy(100));
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+ATF_TC(signal5);
+ATF_TC_HEAD(signal5, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching exec() breakpoint");
+}
+
+ATF_TC_BODY(signal5, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before calling execve(2) from child\n");
+ execlp("/bin/echo", "/bin/echo", NULL);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+#if defined(TWAIT_HAVE_PID)
+ATF_TC(signal6);
+ATF_TC_HEAD(signal6, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching PTRACE_FORK breakpoint");
+}
+
+ATF_TC_BODY(signal6, tc)
+{
+ const int exitval = 5;
+ const int exitval2 = 15;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, child2, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT((child2 = fork()) != 1);
+
+ if (child2 == 0)
+ _exit(exitval2);
+
+ FORKEE_REQUIRE_SUCCESS
+ (wpid = TWAIT_GENERIC(child2, &status, 0), child2);
+
+ forkee_status_exited(status, exitval2);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Enable PTRACE_FORK in EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_FORK;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK);
+
+ child2 = state.pe_other_pid;
+ printf("Reported PTRACE_FORK event with forkee %d\n", child2);
+
+ printf("Before calling %s() for the child2\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0),
+ child2);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK);
+ ATF_REQUIRE_EQ(state.pe_other_pid, child);
+
+ printf("Before resuming the forkee process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the forkee - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0),
+ child2);
+
+ validate_status_exited(status, exitval2);
+
+ printf("Before calling %s() for the forkee - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD,
+ wpid = TWAIT_GENERIC(child2, &status, 0));
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGCHLD\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGCHLD);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+#if defined(TWAIT_HAVE_PID)
+ATF_TC(signal7);
+ATF_TC_HEAD(signal7, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching PTRACE_VFORK breakpoint");
+}
+
+ATF_TC_BODY(signal7, tc)
+{
+ const int exitval = 5;
+ const int exitval2 = 15;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, child2, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+
+ atf_tc_expect_fail("PR kern/51918 PR kern/51630");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT((child2 = fork()) != 1);
+
+ if (child2 == 0)
+ _exit(exitval2);
+
+ FORKEE_REQUIRE_SUCCESS
+ (wpid = TWAIT_GENERIC(child2, &status, 0), child2);
+
+ forkee_status_exited(status, exitval2);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_VFORK;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK);
+
+ child2 = state.pe_other_pid;
+ printf("Reported PTRACE_VFORK event with forkee %d\n", child2);
+
+ printf("Before calling %s() for the child2\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0),
+ child2);
+
+ validate_status_stopped(status, SIGTRAP);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK);
+ ATF_REQUIRE_EQ(state.pe_other_pid, child);
+
+ printf("Before resuming the forkee process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the forkee - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0),
+ child2);
+
+ validate_status_exited(status, exitval2);
+
+ printf("Before calling %s() for the forkee - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD,
+ wpid = TWAIT_GENERIC(child2, &status, 0));
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGCHLD\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGCHLD);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+#endif
+
+ATF_TC(signal8);
+ATF_TC_HEAD(signal8, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching PTRACE_VFORK_DONE breakpoint");
+}
+
+ATF_TC_BODY(signal8, tc)
+{
+ const int exitval = 5;
+ const int exitval2 = 15;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, child2, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ FORKEE_ASSERT((child2 = vfork()) != 1);
+
+ if (child2 == 0)
+ _exit(exitval2);
+
+ FORKEE_REQUIRE_SUCCESS
+ (wpid = TWAIT_GENERIC(child2, &status, 0), child2);
+
+ forkee_status_exited(status, exitval2);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Enable PTRACE_VFORK_DONE in EVENT_MASK for the child %d\n",
+ child);
+ event.pe_set_event = PTRACE_VFORK_DONE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK_DONE);
+
+ child2 = state.pe_other_pid;
+ printf("Reported PTRACE_VFORK_DONE event with forkee %d\n", child2);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGCHLD\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, SIGCHLD);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(signal9);
+ATF_TC_HEAD(signal9, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching PTRACE_LWP_CREATE breakpoint");
+}
+
+ATF_TC_BODY(signal9, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+ ucontext_t uc;
+ lwpid_t lid;
+ static const size_t ssize = 16*1024;
+ void *stack;
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before allocating memory for stack in child\n");
+ FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
+
+ printf("Before making context for new lwp in child\n");
+ _lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
+
+ printf("Before creating new in child\n");
+ FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
+
+ printf("Before waiting for lwp %d to exit\n", lid);
+ FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
+
+ printf("Before verifying that reported %d and running lid %d "
+ "are the same\n", lid, the_lwp_id);
+ FORKEE_ASSERT_EQ(lid, the_lwp_id);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Set empty EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_LWP_CREATE;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGTRAP\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_CREATE);
+
+ lid = state.pe_lwp;
+ printf("Reported PTRACE_LWP_CREATE event with lid %d\n", lid);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
+ATF_TC(signal10);
+ATF_TC_HEAD(signal10, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify that masking SIGTRAP in tracee does not stop tracer from "
+ "catching PTRACE_LWP_EXIT breakpoint");
+}
+
+ATF_TC_BODY(signal10, tc)
+{
+ const int exitval = 5;
+ const int sigval = SIGSTOP;
+ const int sigmasked = SIGTRAP;
+ pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+ int status;
+#endif
+ sigset_t intmask;
+ ptrace_state_t state;
+ const int slen = sizeof(state);
+ ptrace_event_t event;
+ const int elen = sizeof(event);
+ ucontext_t uc;
+ lwpid_t lid;
+ static const size_t ssize = 16*1024;
+ void *stack;
+
+ atf_tc_expect_fail("PR kern/51918");
+
+ printf("Before forking process PID=%d\n", getpid());
+ ATF_REQUIRE((child = fork()) != -1);
+ if (child == 0) {
+ printf("Before calling PT_TRACE_ME from child %d\n", getpid());
+ FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+ sigemptyset(&intmask);
+ sigaddset(&intmask, sigmasked);
+ sigprocmask(SIG_BLOCK, &intmask, NULL);
+
+ printf("Before raising %s from child\n", strsignal(sigval));
+ FORKEE_ASSERT(raise(sigval) == 0);
+
+ printf("Before allocating memory for stack in child\n");
+ FORKEE_ASSERT((stack = malloc(ssize)) != NULL);
+
+ printf("Before making context for new lwp in child\n");
+ _lwp_makecontext(&uc, lwp_main_func, NULL, NULL, stack, ssize);
+
+ printf("Before creating new in child\n");
+ FORKEE_ASSERT(_lwp_create(&uc, 0, &lid) == 0);
+
+ printf("Before waiting for lwp %d to exit\n", lid);
+ FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0);
+
+ printf("Before verifying that reported %d and running lid %d "
+ "are the same\n", lid, the_lwp_id);
+ FORKEE_ASSERT_EQ(lid, the_lwp_id);
+
+ printf("Before exiting of the child process\n");
+ _exit(exitval);
+ }
+ printf("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+ printf("Before calling %s() for the child\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigval);
+
+ printf("Set empty EVENT_MASK for the child %d\n", child);
+ event.pe_set_event = PTRACE_LWP_EXIT;
+ ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected stopped "
+ "SIGTRAP\n", TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_stopped(status, sigmasked);
+
+ ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1);
+
+ ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_LWP_EXIT);
+
+ lid = state.pe_lwp;
+ printf("Reported PTRACE_LWP_EXIT event with lid %d\n", lid);
+
+ printf("Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+ printf("Before calling %s() for the child - expected exited\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child);
+
+ validate_status_exited(status, exitval);
+
+ printf("Before calling %s() for the child - expected no process\n",
+ TWAIT_FNAME);
+ TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0));
+}
+
ATF_TP_ADD_TCS(tp)
{
setvbuf(stdout, NULL, _IONBF, 0);
@@ -5008,6 +6602,10 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, eventmask1);
ATF_TP_ADD_TC(tp, eventmask2);
+ ATF_TP_ADD_TC(tp, eventmask3);
+ ATF_TP_ADD_TC(tp, eventmask4);
+ ATF_TP_ADD_TC(tp, eventmask5);
+ ATF_TP_ADD_TC(tp, eventmask6);
ATF_TP_ADD_TC_HAVE_PID(tp, fork1);
ATF_TP_ADD_TC(tp, fork2);
@@ -5015,6 +6613,9 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC_HAVE_PID(tp, vfork1);
ATF_TP_ADD_TC(tp, vfork2);
+ ATF_TP_ADD_TC(tp, vforkdone1);
+ ATF_TP_ADD_TC(tp, vforkdone2);
+
ATF_TP_ADD_TC(tp, io_read_d1);
ATF_TP_ADD_TC(tp, io_read_d2);
ATF_TP_ADD_TC(tp, io_read_d3);
@@ -5051,6 +6652,8 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, read_i3);
ATF_TP_ADD_TC(tp, read_i4);
+ ATF_TP_ADD_TC(tp, io_read_auxv1);
+
ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1);
ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs2);
ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs3);
@@ -5078,5 +6681,20 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC_HAVE_PID(tp, siginfo5);
ATF_TP_ADD_TC_PT_STEP(tp, siginfo6);
+ ATF_TP_ADD_TC(tp, lwp_create1);
+
+ ATF_TP_ADD_TC(tp, lwp_exit1);
+
+ ATF_TP_ADD_TC(tp, signal1);
+ ATF_TP_ADD_TC(tp, signal2);
+ ATF_TP_ADD_TC(tp, signal3);
+ ATF_TP_ADD_TC_PT_STEP(tp, signal4);
+ ATF_TP_ADD_TC(tp, signal5);
+ ATF_TP_ADD_TC_HAVE_PID(tp, signal6);
+ ATF_TP_ADD_TC_HAVE_PID(tp, signal7);
+ ATF_TP_ADD_TC(tp, signal8);
+ ATF_TP_ADD_TC(tp, signal9);
+ ATF_TP_ADD_TC(tp, signal10);
+
return atf_no_error();
}
diff --git a/contrib/netbsd-tests/kernel/t_pty.c b/contrib/netbsd-tests/kernel/t_pty.c
index fccfc17b..3b079ef 100644
--- a/contrib/netbsd-tests/kernel/t_pty.c
+++ b/contrib/netbsd-tests/kernel/t_pty.c
@@ -1,4 +1,4 @@
-/* $Id: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $ */
+/* $Id: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*
* Allocates a pty(4) device, and sends the specified number of packets of the
@@ -9,7 +9,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $");
+__RCSID("$NetBSD: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <errno.h>
#include <err.h>
@@ -35,7 +35,7 @@ static __dead void usage(const char *);
static void parse_args(int, char **);
#else
#include <atf-c.h>
-#include "../h_macros.h"
+#include "h_macros.h"
#endif
static int pty_open(void);
diff --git a/contrib/netbsd-tests/kernel/t_rnd.c b/contrib/netbsd-tests/kernel/t_rnd.c
index 8646130..ae9ef55 100644
--- a/contrib/netbsd-tests/kernel/t_rnd.c
+++ b/contrib/netbsd-tests/kernel/t_rnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $ */
+/* $NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/fcntl.h>
@@ -39,7 +39,7 @@ __RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../h_macros.h"
+#include "h_macros.h"
ATF_TC(RNDADDDATA);
ATF_TC_HEAD(RNDADDDATA, tc)
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
index 5c496c8..4f91afd 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
+/* $NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -55,13 +55,11 @@ ATF_TC_HEAD(mkfifoat_fd, tc)
ATF_TC_BODY(mkfifoat_fd, tc)
{
int dfd;
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
- ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
(void)close(dfd);
}
@@ -74,12 +72,10 @@ ATF_TC_HEAD(mkfifoat_fdcwd, tc)
}
ATF_TC_BODY(mkfifoat_fdcwd, tc)
{
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
}
@@ -91,10 +87,9 @@ ATF_TC_HEAD(mkfifoat_fdcwderr, tc)
}
ATF_TC_BODY(mkfifoat_fdcwderr, tc)
{
- int fd;
mode_t mode = 0600;
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
}
ATF_TC(mkfifoat_fderr);
@@ -110,7 +105,7 @@ ATF_TC_BODY(mkfifoat_fderr, tc)
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
ATF_REQUIRE(close(fd) == 0);
- ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/db/t_db.sh b/contrib/netbsd-tests/lib/libc/db/t_db.sh
index 6858e36..93a7b1e 100755
--- a/contrib/netbsd-tests/lib/libc/db/t_db.sh
+++ b/contrib/netbsd-tests/lib/libc/db/t_db.sh
@@ -42,18 +42,10 @@ dict()
elif [ -f /usr/dict/words ]; then
echo /usr/dict/words
else
- echo ""
atf_fail "no dictionary found"
fi
}
-# Begin FreeBSD
-dict()
-{
- echo /usr/share/dict/words
-}
-# End FreeBSD
-
SEVEN_SEVEN="abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg|abcdefg"
atf_test_case small_btree
diff --git a/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c b/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c
new file mode 100644
index 0000000..4c85e4b
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libc/gen/exect/t_exect.c
@@ -0,0 +1,90 @@
+/* $NetBSD: t_exect.c,v 1.6 2016/12/12 10:34:55 joerg Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <atf-c.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <unistd.h>
+
+ATF_TC(t_exect_null);
+
+ATF_TC_HEAD(t_exect_null, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Tests an empty exect(2) executing");
+}
+
+static volatile sig_atomic_t caught = 0;
+
+static void
+sigtrap_handler(int sig, siginfo_t *info, void *ctx)
+{
+ ATF_REQUIRE_EQ(sig, SIGTRAP);
+ ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE);
+
+ ++caught;
+}
+
+ATF_TC_BODY(t_exect_null, tc)
+{
+ struct sigaction act;
+
+ /*
+ * Currently exect(3) is misdesigned -- see PR port-amd64/51700 and it
+ * needs to be redone from scratch.
+ *
+ * This test affects amd64 releng machines causing tests to hang or
+ * fail. As there is little point to test interface that is still not,
+ * designed and implemented and is breaking tests - skip it
+ * unconditionally for all ports.
+ */
+ /* Prevent static analysis from requiring t_exec_null to be __dead. */
+ if (!caught)
+ atf_tc_skip("exect(3) misdesigned and hangs - PR port-amd64/51700");
+
+ ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0);
+ act.sa_sigaction = sigtrap_handler;
+ act.sa_flags = SA_SIGINFO;
+
+ ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0);
+
+ ATF_REQUIRE_ERRNO(EFAULT, exect(NULL, NULL, NULL) == -1);
+
+ ATF_REQUIRE_EQ_MSG(caught, 1, "expected caught (1) != received (%d)",
+ (int)caught);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, t_exect_null);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
index 2085b9e..8e4d30d 100644
--- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
+++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
@@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <atf-c.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_glob.c b/contrib/netbsd-tests/lib/libc/gen/t_glob.c
index 0572a42..c53e183 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_glob.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_glob.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $ */
+/* $NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
+__RCSID("$NetBSD: t_glob.c,v 1.5 2017/01/14 20:47:41 christos Exp $");
#include <atf-c.h>
@@ -46,13 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
#include <string.h>
#include <errno.h>
-#ifdef __FreeBSD__
#include "h_macros.h"
-#define __gl_stat_t struct stat
-#define _S_IFDIR S_IFDIR
-#else
-#include "../../../h_macros.h"
-#endif
#ifdef DEBUG
@@ -91,7 +85,7 @@ static struct gl_dir d[] = {
{ "a/b", b, __arraycount(b), 0 },
};
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
static const char *glob_star[] = {
"a/1", "a/3", "a/4", "a/b", "a/b/w", "a/b/x", "a/b/y", "a/b/z",
};
@@ -158,7 +152,7 @@ gl_stat(const char *name , __gl_stat_t *st)
memset(st, 0, sizeof(*st));
if (strcmp(buf, "a") == 0 || strcmp(buf, "a/b") == 0) {
- st->st_mode |= _S_IFDIR;
+ st->st_mode |= S_IFDIR;
return 0;
}
@@ -225,7 +219,7 @@ run(const char *p, int flags, const char **res, size_t len)
}
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
ATF_TC(glob_star);
ATF_TC_HEAD(glob_star, tc)
{
@@ -274,7 +268,7 @@ ATF_TC_BODY(glob_nocheck, tc)
ATF_TP_ADD_TCS(tp)
{
-#ifndef __FreeBSD__
+#ifdef GLOB_STAR
ATF_TP_ADD_TC(tp, glob_star);
#endif
ATF_TP_ADD_TC(tp, glob_star_not);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
index 17eac87..54d798f 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
@@ -34,11 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef __FreeBSD__
-#include <libutil.h>
-#else
#include <util.h>
-#endif
const struct hnopts {
size_t ho_len;
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
index e85867a..d4bd271 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
@@ -26,10 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef __FreeBSD__
-/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */
-#include <sys/types.h>
-#endif
#include <sys/cdefs.h>
#include <sys/event.h>
#include <sys/signal.h>
diff --git a/contrib/netbsd-tests/lib/libc/hash/h_hash.c b/contrib/netbsd-tests/lib/libc/hash/h_hash.c
index 6e20a48..33b9f9a 100644
--- a/contrib/netbsd-tests/lib/libc/hash/h_hash.c
+++ b/contrib/netbsd-tests/lib/libc/hash/h_hash.c
@@ -35,13 +35,8 @@
#include <unistd.h>
#include <string.h>
#include <md5.h>
-#ifdef __NetBSD__
#include <sha1.h>
-#endif
-#ifdef __FreeBSD__
-#include <sha.h>
-#endif
int mflag, rflag, sflag, tflag;
@@ -107,32 +102,17 @@ regress(void)
MD5Final(out, &ctx);
outlen = 16;
} else {
-#ifdef __FreeBSD__
- SHA_CTX ctx;
-
- SHA1_Init(&ctx);
- SHA1_Update(&ctx, buf, len);
-#else
SHA1_CTX ctx;
SHA1Init(&ctx);
SHA1Update(&ctx, buf, len);
-#endif
while (!last &&
fgets((char *)buf, sizeof(buf), stdin) != NULL) {
len = strlen((char *)buf);
CHOMP(buf, len, last);
-#ifdef __FreeBSD__
- SHA1_Update(&ctx, buf, len);
-#else
SHA1Update(&ctx, buf, len);
-#endif
}
-#ifdef __FreeBSD__
- SHA1_Final(out, &ctx);
-#else
SHA1Final(out, &ctx);
-#endif
outlen = 20;
}
hexdump(out, outlen);
diff --git a/contrib/netbsd-tests/lib/libc/hash/t_hmac.c b/contrib/netbsd-tests/lib/libc/hash/t_hmac.c
new file mode 100644
index 0000000..3dcbea9
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libc/hash/t_hmac.c
@@ -0,0 +1,127 @@
+/* $NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $");
+
+#include <atf-c.h>
+#include <string.h>
+#include <stdlib.h>
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+
+static void
+test(void)
+{
+ uint8_t tmp1[EVP_MAX_MD_SIZE];
+ uint8_t tmp2[EVP_MAX_MD_SIZE];
+ uint8_t key[256];
+ uint8_t data[4096];
+ unsigned int tmp1len;
+ size_t tmp2len;
+ int stop;
+ void *e1;
+ const void *evps[] = {
+ EVP_md2(),
+ EVP_md4(),
+ EVP_md5(),
+ EVP_ripemd160(),
+ EVP_sha1(),
+ EVP_sha224(),
+ EVP_sha256(),
+ EVP_sha384(),
+ EVP_sha512(),
+ };
+ const char *names[] = {
+ "md2",
+ "md4",
+ "md5",
+ "rmd160",
+ "sha1",
+ "sha224",
+ "sha256",
+ "sha384",
+ "sha512",
+ };
+
+ for (size_t k = 0; k < sizeof(key); k++)
+ key[k] = k;
+ for (size_t d = 0; d < sizeof(data); d++)
+ data[d] = d % 256;
+
+ for (size_t t = 0; t < __arraycount(names); t++)
+ for (size_t i = 1; i < sizeof(key); i += 9)
+ for (size_t j = 3; j < sizeof(data); j += 111) {
+ stop = 0;
+#ifdef DEBUG
+ printf("%s: keysize = %zu datasize = %zu\n", names[t],
+ i, j);
+#endif
+ memset(tmp1, 0, sizeof(tmp1));
+ memset(tmp2, 0, sizeof(tmp2));
+ e1 = HMAC(evps[t], key, i, data, j, tmp1, &tmp1len);
+ ATF_REQUIRE(e1 != NULL);
+ tmp2len = hmac(names[t], key, i, data, j, tmp2,
+ sizeof(tmp2));
+ ATF_REQUIRE_MSG(tmp1len == tmp2len, "hash %s len %u "
+ "!= %zu", names[t], tmp1len, tmp2len);
+ for (size_t k = 0; k < tmp2len; k++)
+ if (tmp1[k] != tmp2[k]) {
+#ifdef DEBUG
+ printf("%zu %.2x %.2x\n",
+ k, tmp1[k], tmp2[k]);
+#endif
+ stop = 1;
+ break;
+ }
+ ATF_REQUIRE_MSG(!stop, "hash %s failed for "
+ "keylen=%zu, datalen=%zu", names[t], i, j);
+ }
+}
+
+ATF_TC(t_hmac);
+
+ATF_TC_HEAD(t_hmac, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test hmac functions for consistent results");
+}
+
+ATF_TC_BODY(t_hmac, tc)
+{
+ test();
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, t_hmac);
+ return atf_no_error();
+}
+
diff --git a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
index ce2c80d..a45e82a 100644
--- a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
+++ b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
@@ -36,23 +36,9 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $");
#include <atf-c.h>
#include <sys/types.h>
-#ifdef __NetBSD__
#include <sha2.h>
-#endif
#include <string.h>
-#ifdef __FreeBSD__
-#include <openssl/sha.h>
-typedef SHA512_CTX SHA384_CTX;
-/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */
-#define SHA256_DIGEST_LENGTH 32
-#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
-#define SHA384_DIGEST_LENGTH 48
-#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
-#define SHA512_DIGEST_LENGTH 64
-#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
-#endif
-
ATF_TC(t_sha256);
ATF_TC(t_sha384);
ATF_TC(t_sha512);
diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c
index 86029e9..8c7f371 100644
--- a/contrib/netbsd-tests/lib/libc/locale/t_io.c
+++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c
@@ -57,11 +57,9 @@ ATF_TC_BODY(bad_big5_wprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
-
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
setlocale(LC_CTYPE, "zh_TW.Big5");
-
ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0);
ATF_REQUIRE(ferror(stdout));
}
@@ -78,12 +76,10 @@ ATF_TC_BODY(bad_big5_swprintf, tc)
atf_tc_skip("does not fail as expected (may be implementation "
"specific issue with the test)");
#endif
-
/* XXX implementation detail knowledge (wchar_t encoding) */
wchar_t ibuf[] = { 0xcf10, 0 };
wchar_t obuf[20];
setlocale(LC_CTYPE, "zh_TW.Big5");
-
ATF_REQUIRE_ERRNO(EILSEQ,
swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0);
}
diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
index 7816260..e366344 100644
--- a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
+++ b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
@@ -137,16 +137,9 @@ ATF_TC_BODY(mbtowc, tc)
h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B");
h_mbtowc("ja_JP.SJIS", "\202", "\202\240");
h_mbtowc("ja_JP.eucJP", "\244", "\244\242");
-#ifndef __FreeBSD__
- /* Moved last as it fails */
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
-#endif
h_mbtowc("zh_TW.Big5", "\241", "\241@");
h_mbtowc("zh_TW.eucTW", "\241", "\241\241");
-#ifdef __FreeBSD__
- atf_tc_expect_fail("zh_CN.GB18030");
- h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/regex/debug.c b/contrib/netbsd-tests/lib/libc/regex/debug.c
index 22f0b90..18ab6ea 100644
--- a/contrib/netbsd-tests/lib/libc/regex/debug.c
+++ b/contrib/netbsd-tests/lib/libc/regex/debug.c
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $ */
+/* $NetBSD: debug.c,v 1.3 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -26,18 +26,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
#include <ctype.h>
#include <limits.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <sys/types.h>
-#ifdef __FreeBSD__
#include <wchar.h>
#include <wctype.h>
-#endif
/* Don't sort these! */
#include "utils.h"
diff --git a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
index 0670e51..f9bd276 100644
--- a/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
+++ b/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $ */
+/* $NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,17 +37,15 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");
+__RCSID("$NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $");
-#include <stdio.h>
+#include <sys/resource.h>
+#include <atf-c.h>
+#include <err.h>
#include <regex.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <err.h>
-#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <sys/resource.h>
-#endif
+#include <string.h>
#ifndef REGEX_MAXSIZE
#define REGEX_MAXSIZE 9999
@@ -179,25 +177,17 @@ ATF_TC_HEAD(regcomp_too_big, tc)
" crash, but return a proper error code");
// libtre needs it.
atf_tc_set_md_var(tc, "timeout", "600");
-#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.memory", "64M");
-#else
- atf_tc_set_md_var(tc, "require.memory", "120M");
-#endif
}
ATF_TC_BODY(regcomp_too_big, tc)
{
regex_t re;
-#ifdef __FreeBSD__
struct rlimit limit;
-#endif
int e;
-#ifdef __FreeBSD__
limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
-#endif
for (size_t i = 0; i < __arraycount(tests); i++) {
char *d = (*tests[i].pattern)(REGEX_MAXSIZE);
e = regcomp(&re, d, tests[i].type);
diff --git a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
index 0ca44b4..dd5b818 100644
--- a/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
+++ b/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $ */
+/* $NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -37,20 +37,18 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $");
+__RCSID("$NetBSD: t_regex_att.c,v 1.3 2017/01/14 20:59:23 christos Exp $");
#include <sys/param.h>
-#include <stdio.h>
+#include <atf-c.h>
+#include <ctype.h>
#include <regex.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <util.h>
#include <vis.h>
-#include <ctype.h>
-#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <libutil.h>
-#endif
static const char sep[] = "\r\n\t";
static const char delim[3] = "\\\\\0";
@@ -377,11 +375,7 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm,
" cur=%d, max=%zu", res, l, len - off);
off += l;
}
-#ifdef __FreeBSD__
ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
-#else
- ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
-#endif
free(res);
}
@@ -580,9 +574,6 @@ ATF_TC_BODY(leftassoc, tc)
* any explation. Mark as broken here, but I don't know why. */
atf_tc_expect_fail("Reason for breakage unknown");
#endif
-#ifdef __FreeBSD__
- atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD");
-#endif
att_test(tc, "leftassoc");
}
diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
index bce3633..e5d4321 100644
--- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
+++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
@@ -24,13 +24,6 @@ __RCSID("$NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $");
return ev; \
} while(/*CONSTCOND*/0)
-#ifdef __FreeBSD__
-#define SKIPXI(ev, msg, ...) do { \
- atf_tc_skip(msg, __VA_ARGS__); \
- return ev; \
-} while(/*CONSTCOND*/0)
-#endif
-
#else
#define ERRX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__)
#define SKIPX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__)
@@ -196,7 +189,7 @@ regtest(const char *hostname, const char *transp, const char *arg, int p)
#endif
if (!svc_create(server, PROGNUM, VERSNUM, transp))
{
- SKIPXI(EXIT_FAILURE, "Cannot create server %d", num);
+ SKIPX(EXIT_FAILURE, "Cannot create server %d", num);
}
switch ((pid = fork())) {
diff --git a/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c b/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
index 34fd5cc..1f0f1ed 100644
--- a/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
+++ b/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $ */
+/* $NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_setjmp.c,v 1.1 2010/12/27 19:35:31 pgoyette Exp $");
+__RCSID("$NetBSD: t_setjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
#include <sys/types.h>
diff --git a/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c b/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
index 2014470..44d7555 100644
--- a/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
+++ b/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $ */
+/* $NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_threadjmp.c,v 1.1 2011/04/21 18:58:20 martin Exp $");
+__RCSID("$NetBSD: t_threadjmp.c,v 1.2 2017/01/14 21:08:17 christos Exp $");
#include <sys/types.h>
diff --git a/contrib/netbsd-tests/lib/libc/ssp/h_memset.c b/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
index c5ab607..f1acbbd 100644
--- a/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
+++ b/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+/* $NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+__RCSID("$NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $");
#include <stdio.h>
#include <string.h>
@@ -41,9 +41,5 @@ main(int argc, char *argv[])
char b[10];
size_t len = atoi(argv[1]);
(void)memset(b, 0, len);
-#ifdef __FreeBSD__
return b[0]; /* keeps optimizer from zapping the call to memset() */
-#else
- return 0;
-#endif
}
diff --git a/contrib/netbsd-tests/lib/libc/ssp/h_read.c b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
index c25cfeb..046ac62 100644
--- a/contrib/netbsd-tests/lib/libc/ssp/h_read.c
+++ b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
@@ -1,4 +1,4 @@
-/* $NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+/* $NetBSD: h_read.c,v 1.2 2017/01/16 16:35:57 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,17 +29,15 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+__RCSID("$NetBSD: h_read.c,v 1.2 2017/01/16 16:35:57 christos Exp $");
#include <sys/param.h>
+#include <fcntl.h>
+#include <paths.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#ifdef __FreeBSD__
-#include <fcntl.h>
-#include <paths.h>
-
int
main(int argc, char *argv[])
{
@@ -54,14 +52,3 @@ main(int argc, char *argv[])
(void)printf("%s\n", b);
return (0);
}
-#else
-int
-main(int argc, char *argv[])
-{
- char b[MAXPATHLEN];
- size_t len = atoi(argv[1]);
-
- (void)printf("%s\n", b);
- return 0;
-}
-#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
index ec2b9bb..d53d2d9 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
@@ -35,6 +35,10 @@
#include <unistd.h>
#include <err.h>
#ifdef __FreeBSD__
+/*
+ * Needed to avoid libutil.h pollution in stdio.h, which causes grief with
+ * with hexdump(3) in lib/libc/db/h_hash.c
+ */
#include <libutil.h>
#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
index 2293e2c..c7cd83e 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
@@ -37,6 +37,10 @@
#include <stdlib.h>
#include <unistd.h>
#ifdef __FreeBSD__
+/*
+ * Needed to avoid libutil.h pollution in stdio.h, which causes grief with
+ * with hexdump(3) in lib/libc/db/h_hash.c
+ */
#include <libutil.h>
#endif
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
index a0e77d3..5a13250 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
@@ -75,7 +75,6 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014/07/20 20:17:21 christos Exp $");
#define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno))
-#ifdef __NetBSD__
ATF_TC(hsearch_basic);
ATF_TC_HEAD(hsearch_basic, tc)
{
@@ -122,9 +121,12 @@ ATF_TC_BODY(hsearch_basic, tc)
ATF_REQUIRE_EQ((intptr_t)ep->data, i);
}
+#ifdef __NetBSD__
hdestroy1(free, NULL);
-}
+#else
+ hdestroy();
#endif
+}
ATF_TC(hsearch_duplicate);
ATF_TC_HEAD(hsearch_duplicate, tc)
@@ -232,7 +234,6 @@ ATF_TC_BODY(hsearch_two, tc)
}
#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
-#ifdef __NetBSD__
ATF_TC(hsearch_r_basic);
ATF_TC_HEAD(hsearch_r_basic, tc)
{
@@ -278,10 +279,15 @@ ATF_TC_BODY(hsearch_r_basic, tc)
ATF_REQUIRE_EQ((intptr_t)ep->data, i);
}
+#ifdef __NetBSD__
hdestroy1_r(&t, free, NULL);
+#else
+ hdestroy_r(&t);
+#endif
}
#endif
+#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
ATF_TC(hsearch_r_duplicate);
ATF_TC_HEAD(hsearch_r_duplicate, tc)
{
@@ -332,6 +338,9 @@ ATF_TC_BODY(hsearch_r_nonexistent, tc)
REQUIRE_ERRNO(hcreate_r(16, &t));
+#ifdef __FreeBSD__
+ atf_tc_expect_fail("behavior doesn't match docs; see bug # 216872");
+#endif
e.key = __UNCONST("A");
ATF_REQUIRE(hsearch_r(e, FIND, &ep, &t) == 1);
ATF_REQUIRE_EQ(ep, NULL);
@@ -391,17 +400,13 @@ ATF_TC_BODY(hsearch_r_two, tc)
ATF_TP_ADD_TCS(tp)
{
-#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_basic);
-#endif
ATF_TP_ADD_TC(tp, hsearch_duplicate);
ATF_TP_ADD_TC(tp, hsearch_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_two);
-
+
#if defined(__FreeBSD__) && 1100027 <= __FreeBSD_version
-#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_r_basic);
-#endif
ATF_TP_ADD_TC(tp, hsearch_r_duplicate);
ATF_TP_ADD_TC(tp, hsearch_r_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_r_two);
diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
index 06f2de0..4835e5d 100644
--- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
+++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
@@ -218,9 +218,7 @@ ATF_TC_BODY(strtold_nan, tc)
volatile long double ld = strtold(nan_string, &end);
ATF_REQUIRE(isnan(ld) != 0);
-#ifdef __FreeBSD__
- ATF_REQUIRE(strcmp(end, "y") == 0);
-#else
+#ifndef __FreeBSD__
ATF_REQUIRE(__isnanl(ld) != 0);
#endif
ATF_REQUIRE(strcmp(end, "y") == 0);
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strlen.c b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
index 7483dc6..9899e6d 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strlen.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strlen.c,v 1.5 2011/07/14 07:33:20 jruoho Exp $ */
+/* $NetBSD: t_strlen.c,v 1.6 2017/01/14 20:49:24 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@acorntoolworks.com>
@@ -40,9 +40,7 @@ ATF_TC_HEAD(strlen_basic, tc)
ATF_TC_BODY(strlen_basic, tc)
{
-#ifdef __FreeBSD__
void *dl_handle;
-#endif
/* try to trick the compiler */
size_t (*strlen_fn)(const char *);
@@ -110,12 +108,8 @@ ATF_TC_BODY(strlen_basic, tc)
* During testing it is useful have the rest of the program
* use a known good version!
*/
-#ifdef __FreeBSD__
dl_handle = dlopen(NULL, RTLD_LAZY);
strlen_fn = dlsym(dl_handle, "test_strlen");
-#else
- strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
-#endif
if (!strlen_fn)
strlen_fn = strlen;
@@ -142,9 +136,7 @@ ATF_TC_BODY(strlen_basic, tc)
}
}
}
-#ifdef __FreeBSD__
(void)dlclose(dl_handle);
-#endif
}
ATF_TC(strlen_huge);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
index 229c343..a319b09 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $ */
+/* $NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,30 +58,23 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
+__RCSID("$NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
-#ifdef __NetBSD__
-#include <machine/int_limits.h>
-#endif
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
-#ifdef __NetBSD__
-#include "../../../h_macros.h"
-#else
-#include <limits.h>
-#include <stdint.h>
#include "h_macros.h"
-#endif
#define MINPOSDIFF 15000000 /* 15 ms for now */
#define TIMEOUT 5
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_connect.c b/contrib/netbsd-tests/lib/libc/sys/t_connect.c
index 672a022..a920d3d 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_connect.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_connect.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_connect.c,v 1.2 2015/04/05 23:17:41 rtr Exp $ */
+/* $NetBSD: t_connect.c,v 1.3 2017/01/13 20:09:48 christos Exp $ */
/*
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -26,6 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/socket.h>
#include <err.h>
#include <errno.h>
#include <string.h>
@@ -36,10 +37,6 @@
#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <sys/socket.h>
-#endif
-
ATF_TC(connect_low_port);
ATF_TC_HEAD(connect_low_port, tc)
{
@@ -56,10 +53,8 @@ ATF_TC_BODY(connect_low_port, tc)
slist = socket(AF_INET, SOCK_STREAM, 0);
sd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef __FreeBSD__
ATF_REQUIRE(sd > 0);
ATF_REQUIRE(slist > 0);
-#endif
/* bind listening socket */
memset(&sinlist, 0, sizeof(sinlist));
@@ -97,9 +92,7 @@ ATF_TC_BODY(connect_low_port, tc)
ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX);
close(sd);
-#ifdef __FreeBSD__
close(slist);
-#endif
}
ATF_TC(connect_foreign_family);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_dup.c b/contrib/netbsd-tests/lib/libc/sys/t_dup.c
index d8125ab..b1924e4 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_dup.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_dup.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $ */
+/* $NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $");
+__RCSID("$NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $");
#include <sys/resource.h>
#include <sys/stat.h>
@@ -39,16 +39,13 @@ __RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $");
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sysexits.h>
-#ifdef __FreeBSD__
-#include <stdbool.h>
-#endif
-
static char path[] = "dup";
#ifdef __NetBSD__
static void check_mode(bool, bool, bool);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
index 20a9e42..102c79f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
@@ -51,10 +51,16 @@ run(int n, ...)
ATF_REQUIRE_EQ(n, DEPTH - calls - 1);
va_start(va, n);
-#if defined(__FreeBSD__) && defined(__amd64__)
+#ifdef __FreeBSD__
+#if defined(__amd64__)
for (i = 0; i < 5; i++) {
-#elif defined(__FreeBSD__) && defined(__aarch64__)
+#elif defined(__aarch64__)
for (i = 0; i < 7; i++) {
+#elif defined(__mips__)
+ for (i = 0; i < 5; i++) {
+#else
+ for (i = 0; i < 9; i++) {
+#endif
#else
for (i = 0; i < 9; i++) {
#endif
@@ -114,14 +120,23 @@ ATF_TC_BODY(setcontext_link, tc)
uc[i].uc_stack.ss_size = STACKSZ;
uc[i].uc_link = (i > 0) ? &uc[i - 1] : &save;
-#if defined(__FreeBSD__) && defined(__amd64__)
+#ifdef __FreeBSD__
+#if defined(__amd64__)
/* FreeBSD/amd64 only permits up to 6 arguments. */
makecontext(&uc[i], (void *)run, 6, i,
0, 1, 2, 3, 4);
-#elif defined(__FreeBSD__) && defined(__aarch64__)
+#elif defined(__aarch64__)
/* FreeBSD/arm64 only permits up to 8 arguments. */
makecontext(&uc[i], (void *)run, 8, i,
0, 1, 2, 3, 4, 5, 6);
+#elif defined(__mips__)
+ /* FreeBSD/mips only permits up to 6 arguments. */
+ makecontext(&uc[i], (void *)run, 6, i,
+ 0, 1, 2, 3, 4);
+#else
+ makecontext(&uc[i], (void *)run, 10, i,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8);
+#endif
#else
makecontext(&uc[i], (void *)run, 10, i,
0, 1, 2, 3, 4, 5, 6, 7, 8);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
index f4ee96b..273fd83 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $ */
+/* $NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $");
+__RCSID("$NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $");
#include <sys/resource.h>
#include <sys/time.h>
@@ -47,11 +47,7 @@ static void sighandler(int);
static const size_t maxiter = 2000;
static void
-#ifdef __FreeBSD__
sighandler(int signo __unused)
-#else
-sighandler(int signo)
-#endif
{
/* Nothing. */
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
index 8a20d63..5bddea5 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
@@ -45,16 +45,14 @@ __RCSID("$NetBSD: t_kevent.c,v 1.7 2015/02/05 13:55:37 isaki Exp $");
#include <err.h>
#ifdef __NetBSD__
#include <sys/drvctlio.h>
+#else
+#define DRVCTLDEV "/nonexistent"
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/wait.h>
-#ifdef __FreeBSD__
-#define DRVCTLDEV "/nonexistent"
-#endif
-
ATF_TC(kevent_zerotimer);
ATF_TC_HEAD(kevent_zerotimer, tc)
{
@@ -117,15 +115,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
if (recvmsg(s[1], &m, 0) == -1)
err(1, "child: could not recvmsg");
-#ifdef __FreeBSD__
- bcopy(CMSG_DATA(msg), &kq, sizeof(kq));
- printf("child (pid %d): received kq fd %d\n", getpid(), kq);
- _exit(0);
-#else
kq = *(int *)CMSG_DATA(msg);
printf("child (pid %d): received kq fd %d\n", getpid(), kq);
exit(0);
-#endif
}
close(s[1]);
@@ -133,17 +125,14 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
iov.iov_base = &storage;
iov.iov_len = sizeof(int);
+#ifdef __FreeBSD__
+ msg = CMSG_FIRSTHDR(&m);
+#endif
msg->cmsg_level = SOL_SOCKET;
msg->cmsg_type = SCM_RIGHTS;
msg->cmsg_len = CMSG_LEN(sizeof(int));
-#ifdef __FreeBSD__
- /*
- * What is should have been
- * bcopy(&s[0], CMSG_DATA(msg), sizeof(kq));
- */
- bcopy(&kq, CMSG_DATA(msg), sizeof(kq));
-#else
+#ifdef __NetBSD__
*(int *)CMSG_DATA(msg) = kq;
#endif
@@ -152,14 +141,8 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
printf("parent (pid %d): sending kq fd %d\n", getpid(), kq);
if (sendmsg(s[0], &m, 0) == -1) {
-#ifdef __NetBSD__
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
atf_tc_skip("PR kern/46523");
-#endif
-#ifdef __FreeBSD__
- ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
- close(s[0]);
-#endif
}
close(kq);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_link.c b/contrib/netbsd-tests/lib/libc/sys/t_link.c
index b8dcacc..a6d894c 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_link.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_link.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $ */
+/* $NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $");
+__RCSID("$NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -37,14 +37,11 @@ __RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $");
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static const char *getpath(void);
static char path[] = "link";
static const char *pathl;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_listen.c b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
index a9ee733..9f3f9b8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_listen.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_listen.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_listen.c,v 1.5 2017/01/13 20:41:50 christos Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -26,6 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/socket.h>
#include <atf-c.h>
#include <err.h>
#include <errno.h>
@@ -36,10 +37,6 @@
#include <arpa/inet.h>
#include <netinet/in.h>
-#ifdef __FreeBSD__
-#include <sys/socket.h>
-#endif
-
static const char *path = "listen";
ATF_TC_WITH_CLEANUP(listen_err);
@@ -110,9 +107,7 @@ ATF_TC_BODY(listen_low_port, tc)
int sd, val;
sd = socket(AF_INET, SOCK_STREAM, 0);
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
-#endif
val = IP_PORTRANGE_LOW;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
index ab8c33f..da6cafe 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_mincore.c,v 1.10 2017/01/14 20:51:13 christos Exp $");
#include <sys/mman.h>
#include <sys/stat.h>
@@ -141,9 +141,7 @@ ATF_TC_WITH_CLEANUP(mincore_resid);
ATF_TC_HEAD(mincore_resid, tc)
{
atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)");
-#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.user", "root");
-#endif
}
ATF_TC_BODY(mincore_resid, tc)
@@ -155,13 +153,11 @@ ATF_TC_BODY(mincore_resid, tc)
struct rlimit rlim;
ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
-#ifdef __FreeBSD__
/*
* Bump the mlock limit to unlimited so the rest of the testcase
* passes instead of failing on the mlock call.
*/
rlim.rlim_max = RLIM_INFINITY;
-#endif
rlim.rlim_cur = rlim.rlim_max;
ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
@@ -276,9 +272,7 @@ ATF_TC_BODY(mincore_resid, tc)
(void)munmap(addr2, npgs * page);
(void)munmap(addr3, npgs * page);
(void)unlink(path);
-#ifdef __FreeBSD__
free(buf);
-#endif
}
ATF_TC_CLEANUP(mincore_resid, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
index 75048b3..cd9ad55 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
@@ -32,7 +32,7 @@
__RCSID("$NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $");
#ifdef __FreeBSD__
-#include <sys/types.h>
+#include <sys/param.h> /* NetBSD requires sys/param.h for sysctl(3), unlike FreeBSD */
#endif
#include <sys/mman.h>
#include <sys/resource.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
index b35b2ae..8839aea 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_mmap.c,v 1.12 2017/01/16 16:31:05 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,9 +55,10 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.12 2017/01/16 16:31:05 christos Exp $");
#include <sys/param.h>
+#include <sys/disklabel.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/socket.h>
@@ -73,12 +74,7 @@ __RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
#include <string.h>
#include <unistd.h>
#include <paths.h>
-#ifdef __NetBSD__
-#include <machine/disklabel.h>
-#endif
-
#ifdef __FreeBSD__
-#include <sys/disklabel.h>
#include <stdint.h>
#endif
@@ -453,6 +449,7 @@ ATF_TC_BODY(mmap_truncate, tc)
ATF_REQUIRE(ftruncate(fd, page / 12) == 0);
ATF_REQUIRE(ftruncate(fd, page / 64) == 0);
+ (void)munmap(map, page);
ATF_REQUIRE(close(fd) == 0);
}
@@ -509,6 +506,8 @@ ATF_TC_BODY(mmap_truncate_signal, tc)
prevent the access to be optimized out */
ATF_REQUIRE(i == 0);
ATF_REQUIRE(sta == 0);
+ (void)munmap(map, page);
+ (void)close(fd);
return;
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
index b9b3067..9f99980 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $ */
+/* $NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
+__RCSID("$NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -46,10 +47,6 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 12345689
#define MSG_MTYPE_1 0x41
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
index 70f8906..522ceb8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $ */
+/* $NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
+__RCSID("$NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 1234
#define MSG_MTYPE_1 0x41
#define MSG_MTYPE_2 0x42
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
index d30cb7b..5988821 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $ */
+/* $NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
+__RCSID("$NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
#include <time.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
#define MSG_KEY 1234
#define MSG_MTYPE_1 0x41
#define MSG_MTYPE_2 0x42
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msync.c b/contrib/netbsd-tests/lib/libc/sys/t_msync.c
index 70d0ccf..d1fdbe0 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_msync.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_msync.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $ */
+/* $NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msync.c,v 1.2 2012/03/16 06:15:17 matt Exp $");
+__RCSID("$NetBSD: t_msync.c,v 1.3 2017/01/14 20:52:42 christos Exp $");
#include <sys/mman.h>
@@ -52,8 +52,7 @@ msync_sync(const char *garbage, int flags)
{
char *buf, *map = MAP_FAILED;
const char *str = NULL;
- size_t i, len;
- ssize_t tot;
+ size_t len;
int fd, rv;
/*
@@ -65,29 +64,17 @@ msync_sync(const char *garbage, int flags)
if (buf == NULL)
return NULL;
- for (i = 0; i < (size_t)page; i++)
- buf[i] = 'x';
+ memset(buf, 'x', page);
fd = open(path, O_RDWR | O_CREAT, 0700);
if (fd < 0) {
- str = "failed to open";
- goto out;
+ free(buf);
+ return "failed to open";
}
- tot = 0;
-
- while (tot < page) {
-
- rv = write(fd, buf, sizeof(buf));
-
- if (rv < 0) {
- str = "failed to write";
- goto out;
- }
-
- tot += rv;
- }
+ ATF_REQUIRE_MSG(write(fd, buf, page) != -1, "write(2) failed: %s",
+ strerror(errno));
map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_FILE|MAP_PRIVATE,
fd, 0);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c b/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
index b4d9f8a..1ad6661 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $ */
+/* $NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
+__RCSID("$NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $");
#include <sys/time.h>
#include <sys/wait.h>
@@ -45,11 +45,7 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $");
#include <unistd.h>
static void
-#ifdef __FreeBSD__
handler(int signo __unused)
-#else
-handler(int signo)
-#endif
{
/* Nothing. */
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
index 32beecc..df8f1ed 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $ */
+/* $NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $");
+__RCSID("$NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/wait.h>
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
static pid_t pid;
static int nsiginfo = 0;
@@ -153,9 +153,7 @@ ATF_TC_BODY(pipe_restart, tc)
ATF_REQUIRE_EQ(WEXITSTATUS(st), 0);
}
-#ifdef __FreeBSD__
free(f);
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
index 8208cf7..48f9734 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $ */
+/* $NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $");
+__RCSID("$NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $");
#include <atf-c.h>
#include <fcntl.h>
@@ -56,7 +56,8 @@ run(int flags)
#ifdef __FreeBSD__
closefrom(3);
#else
- ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+ ATF_REQUIRE_MSG(closefrom(3) != -1, "closefrom failed: %s",
+ strerror(errno));
#endif
ATF_REQUIRE(pipe2(fd, flags) == 0);
@@ -116,13 +117,13 @@ ATF_TC_BODY(pipe2_consume, tc)
{
struct rlimit rl;
int err, filedes[2];
-#ifdef __FreeBSD__
int old;
+#ifdef __FreeBSD__
closefrom(4);
#else
- err = fcntl(4, F_CLOSEM);
- ATF_REQUIRE(err == 0);
+ ATF_REQUIRE_MSG(closefrom(4) != -1, "closefrom failed: %s",
+ strerror(errno));
#endif
err = getrlimit(RLIMIT_NOFILE, &rl);
@@ -132,19 +133,15 @@ ATF_TC_BODY(pipe2_consume, tc)
* file descriptor limit in the middle of a pipe2() call - i.e.
* before the call only a single descriptor may be openend.
*/
-#ifdef __FreeBSD__
old = rl.rlim_cur;
-#endif
rl.rlim_cur = 4;
err = setrlimit(RLIMIT_NOFILE, &rl);
ATF_REQUIRE(err == 0);
err = pipe2(filedes, O_CLOEXEC);
ATF_REQUIRE(err == -1);
-#ifdef __FreeBSD__
rl.rlim_cur = old;
err = setrlimit(RLIMIT_NOFILE, &rl);
-#endif
}
ATF_TC(pipe2_nonblock);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c b/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
index da4e746..813bfb8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $ */
+/* $NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $");
+__RCSID("$NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $");
#include <sys/fcntl.h>
@@ -68,7 +68,7 @@ __RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $");
#include <atf-c.h>
-#include "../../../h_macros.h"
+#include "h_macros.h"
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
index 8e4c2a3..ec225b9 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $");
+__RCSID("$NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $");
#include <sys/resource.h>
#include <sys/wait.h>
@@ -176,9 +176,7 @@ ATF_TC_BODY(revoke_perm, tc)
if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS)
atf_tc_fail("revoke(2) did not obey permissions");
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
ATF_REQUIRE(unlink(path) == 0);
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_select.c b/contrib/netbsd-tests/lib/libc/sys/t_select.c
index 437b67b..04a684a 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_select.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_select.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_select.c,v 1.3 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_select.c,v 1.4 2017/01/13 21:18:33 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -47,21 +47,13 @@
static sig_atomic_t keep_going = 1;
static void
-#ifdef __FreeBSD__
sig_handler(int signum __unused)
-#else
-sig_handler(int signum)
-#endif
{
keep_going = 0;
}
static void
-#ifdef __FreeBSD__
sigchld(int signum __unused)
-#else
-sigchld(int signum)
-#endif
{
}
@@ -90,7 +82,7 @@ prmask(const sigset_t *m, char *buf, size_t len)
return buf;
}
-static void
+static __dead void
child(const struct timespec *ts)
{
struct sigaction sa;
@@ -135,9 +127,7 @@ child(const struct timespec *ts)
"after timeout %s != %s",
prmask(&nset, nbuf, sizeof(nbuf)),
prmask(&oset, obuf, sizeof(obuf)));
-#ifdef __FreeBSD__
_exit(0);
-#endif
}
ATF_TC(pselect_sigmask);
@@ -157,9 +147,7 @@ ATF_TC_BODY(pselect_sigmask, tc)
switch (pid = fork()) {
case 0:
child(NULL);
-#ifdef __FreeBSD__
- break;
-#endif
+ /*NOTREACHED*/
case -1:
err(1, "fork");
default:
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
index f1100bf..7bef590 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $ */
+/* $NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $");
+__RCSID("$NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $");
#include <sys/resource.h>
#include <sys/mman.h>
@@ -124,9 +124,7 @@ out:
if (lim != 0)
atf_tc_fail("failed to set limit (%d)", lim);
-#ifdef __FreeBSD__
free(buf);
-#endif
}
ATF_TC(setrlimit_current);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c b/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
index 23ca36a..4bbf421 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $ */
+/* $NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $");
+__RCSID("$NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $");
#include <sys/wait.h>
@@ -41,20 +41,12 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $");
#include <atf-c.h>
-#ifdef __NetBSD__
-#include "../../../h_macros.h"
-#else
#include "h_macros.h"
-#endif
static bool handler_called = false;
static void
-#ifdef __FreeBSD__
handler(int signo __unused)
-#else
-handler(int signo)
-#endif
{
handler_called = true;
}
@@ -87,11 +79,7 @@ wait_and_check_child(const pid_t pid, const char *fail_message)
}
static void
-#ifdef __FreeBSD__
catch(int sig __unused)
-#else
-catch(int sig)
-#endif
{
return;
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
index e911d42..af560f8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $ */
+/* $NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,31 +30,24 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $");
+__RCSID("$NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $");
#include <atf-c.h>
+#include <err.h>
#include <errno.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sched.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <err.h>
-#include <stdio.h>
-#endif
-
static void handler(int, siginfo_t *, void *);
#define VALUE (int)0xc001dad1
static int value;
static void
-#ifdef __FreeBSD__
-handler(int signo __unused, siginfo_t *info __unused, void *data __unused)
-#else
-handler(int signo, siginfo_t *info, void *data)
-#endif
+handler(int signo __unused, siginfo_t *info, void *data __unused)
{
value = info->si_value.sival_int;
kill(0, SIGINFO);
@@ -123,12 +116,10 @@ static sig_atomic_t count = 0;
static int delivered[CNT];
static void
-myhandler(int signo, siginfo_t *info, void *context)
+myhandler(int signo, siginfo_t *info, void *context __unused)
{
delivered[count++] = signo;
-#ifdef __FreeBSD__
printf("Signal #%zu: signo: %d\n", (size_t)count, signo);
-#endif
}
static int
@@ -213,12 +204,8 @@ ATF_TC_BODY(sigqueue_rt, tc)
sigset_t mask, orig;
sigemptyset(&mask);
for (size_t i = 0; i < CNT; i++)
-#ifdef __FreeBSD__
if (sigaddset(&mask, signals[i]) == -1)
warn("sigaddset");
-#else
- sigaddset(&mask, signals[i]);
-#endif
ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1);
@@ -227,23 +214,16 @@ ATF_TC_BODY(sigqueue_rt, tc)
ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1);
sleep(1);
-#ifdef __FreeBSD__
ATF_CHECK_MSG((size_t)count == ndelivered,
"count %zu != ndelivered %zu", (size_t)count, ndelivered);
-#else
- ATF_REQUIRE_MSG((size_t)count == ndelivered,
- "count %zu != ndelivered %zu", (size_t)count, ndelivered);
-#endif
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE_MSG(ordered[i] == delivered[i],
"%zu: ordered %d != delivered %d",
i, ordered[i], delivered[i]);
-#ifdef __FreeBSD__
- if (count > ndelivered)
- for (size_t i = ndelivered; i < count; i++)
+ if ((size_t)count > ndelivered)
+ for (size_t i = ndelivered; i < (size_t)count; i++)
printf("Undelivered signal #%zu: %d\n", i, ordered[i]);
-#endif
for (size_t i = 0; i < ndelivered; i++)
ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
index 9da7861..7a0cc20 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $ */
+/* $NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $");
+__RCSID("$NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $");
#include <atf-c.h>
#include <fcntl.h>
@@ -66,7 +66,7 @@ run(int flags)
#ifdef __FreeBSD__
closefrom(3);
#else
- ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1);
+ ATF_REQUIRE(closefrom(3) != -1);
#endif
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
index 300c6e8..adb32bb 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $ */
+/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $");
+__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $");
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
+#include <netinet/in.h>
#include <atf-c.h>
#include <errno.h>
@@ -47,10 +48,6 @@ __RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $");
#include <stdio.h>
-#ifdef __FreeBSD__
-#include <netinet/in.h>
-#endif
-
static const char *path = "stat";
ATF_TC_WITH_CLEANUP(stat_chflags);
@@ -396,11 +393,9 @@ ATF_TC_BODY(stat_symlink, tc)
if (sa.st_mode == sb.st_mode)
atf_tc_fail("inconsistencies between stat(2) and lstat(2)");
+ (void)close(fd);
ATF_REQUIRE(unlink(path) == 0);
ATF_REQUIRE(unlink(pathlink) == 0);
-#ifdef __FreeBSD__
- (void)close(fd);
-#endif
}
ATF_TC_CLEANUP(stat_symlink, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c b/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
index cc85307..e8a6acd 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_timer_create.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $ */
+/* $NetBSD: t_timer_create.c,v 1.5 2017/01/16 16:32:13 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -38,11 +38,7 @@ static timer_t t;
static bool fail = true;
static void
-#ifdef __FreeBSD__
timer_signal_handler(int signo, siginfo_t *si, void *osi __unused)
-#else
-timer_signal_handler(int signo, siginfo_t *si, void *osi)
-#endif
{
timer_t *tp;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
index 59193a9..5b96a20 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $ */
+/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,21 +29,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $");
+__RCSID("$NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $");
#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static const char path[] = "truncate";
static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 };
@@ -153,9 +150,7 @@ ATF_TC_HEAD(truncate_err, tc)
ATF_TC_BODY(truncate_err, tc)
{
-#ifndef __NetBSD__
char buf[PATH_MAX];
-#endif
errno = 0;
ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
@@ -167,13 +162,9 @@ ATF_TC_BODY(truncate_err, tc)
ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
errno = 0;
-#ifdef __NetBSD__
- ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1);
-#else
snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned",
atf_tc_get_config_var(tc, "srcdir"));
ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
-#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_umask.c b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
index 7a65574..fb3e405b 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_umask.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */
+/* $NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $");
+__RCSID("$NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $");
#include <sys/stat.h>
#include <sys/wait.h>
@@ -129,9 +129,7 @@ ATF_TC_BODY(umask_open, tc)
if (fd < 0)
continue;
-#ifdef __FreeBSD__
(void)close(fd);
-#endif
(void)memset(&st, 0, sizeof(struct stat));
if (stat(path, &st) != 0) {
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
index b504bb0..cda9c16 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $ */
+/* $NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $");
+__RCSID("$NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <sys/stat.h>
@@ -111,15 +111,8 @@ ATF_TC_HEAD(unlink_fifo, tc)
ATF_TC_BODY(unlink_fifo, tc)
{
-#ifdef __FreeBSD__
- int fd;
- ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
- "mkfifo failed: %s", strerror(errno));
- (void)close(fd);
-#else
ATF_REQUIRE(mkfifo(path, 0666) == 0);
-#endif
ATF_REQUIRE(unlink(path) == 0);
errno = 0;
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait.c b/contrib/netbsd-tests/lib/libc/sys/t_wait.c
index 8653265..91bbaf1f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_wait.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */
+/* $NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,25 +29,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
#include <sys/wait.h>
#include <sys/resource.h>
-#include <stdio.h>
#include <errno.h>
+#include <inttypes.h>
#include <limits.h>
#include <pwd.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <atf-c.h>
-#ifdef __FreeBSD__
-#define wrusage __wrusage
-#endif
-
ATF_TC(wait6_invalid);
ATF_TC_HEAD(wait6_invalid, tc)
{
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
index e5ddcbd..c529f17 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
@@ -29,9 +29,6 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $");
-#ifdef __FreeBSD__
-#include <sys/param.h> /* For NBBY -- it's in sys/types.h on NetBSD */
-#endif
#include <sys/wait.h>
#include <sys/resource.h>
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_write.c b/contrib/netbsd-tests/lib/libc/sys/t_write.c
index a3783cb..576ce7e 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_write.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_write.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $ */
+/* $NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,37 +29,27 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $");
#include <sys/uio.h>
-#ifdef __NetBSD__
-#include <sys/syslimits.h>
-#endif
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
-
static void sighandler(int);
static bool fail = false;
static const char *path = "write";
static void
-#ifdef __FreeBSD__
sighandler(int signo __unused)
-#else
-sighandler(int signo)
-#endif
{
fail = false;
}
diff --git a/contrib/netbsd-tests/lib/libm/t_ilogb.c b/contrib/netbsd-tests/lib/libm/t_ilogb.c
index b3c2126..1d35cb6 100644
--- a/contrib/netbsd-tests/lib/libm/t_ilogb.c
+++ b/contrib/netbsd-tests/lib/libm/t_ilogb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ilogb.c,v 1.6 2016/08/26 08:01:55 christos Exp $ */
+/* $NetBSD: t_ilogb.c,v 1.7 2017/01/13 19:23:40 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -28,18 +28,18 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_ilogb.c,v 1.7 2017/01/13 19:23:40 christos Exp $");
-#ifdef __FreeBSD__
-#include <limits.h>
-#endif
#include <atf-c.h>
#include <fenv.h>
+#include <limits.h>
#include <math.h>
#ifndef __HAVE_FENV
-# define ATF_CHECK_RAISED_INVALID
-# define ATF_CHECK_RAISED_NOTHING
+# define ATF_CHECK_RAISED_INVALID
+# define ATF_CHECK_RAISED_NOTHING
#else
# define ATF_CHECK_RAISED_INVALID do { \
diff --git a/contrib/netbsd-tests/lib/libm/t_pow.c b/contrib/netbsd-tests/lib/libm/t_pow.c
index fbdb984..7afee9f 100644
--- a/contrib/netbsd-tests/lib/libm/t_pow.c
+++ b/contrib/netbsd-tests/lib/libm/t_pow.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $ */
+/* $NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,15 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $");
+__RCSID("$NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $");
#include <atf-c.h>
#include <math.h>
-#ifdef __FreeBSD__
-#define isinff isinf
-#endif
-
/*
* pow(3)
*/
@@ -383,12 +379,12 @@ ATF_TC_BODY(powf_inf_neg_x, tc)
*/
z = powf(x, 3.0);
- if (isinff(z) == 0 || signbit(z) == 0)
+ if (isinf(z) == 0 || signbit(z) == 0)
atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf");
z = powf(x, 4.0);
- if (isinff(z) == 0 || signbit(z) != 0)
+ if (isinf(z) == 0 || signbit(z) != 0)
atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf");
/*
@@ -425,7 +421,7 @@ ATF_TC_BODY(powf_inf_neg_y, tc)
*/
z = powf(0.1, y);
- if (isinff(z) == 0 || signbit(z) != 0)
+ if (isinf(z) == 0 || signbit(z) != 0)
atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf");
z = powf(1.1, y);
@@ -456,7 +452,7 @@ ATF_TC_BODY(powf_inf_pos_x, tc)
z = powf(x, 2.0);
- if (isinff(z) == 0 || signbit(z) != 0)
+ if (isinf(z) == 0 || signbit(z) != 0)
atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf");
}
@@ -482,7 +478,7 @@ ATF_TC_BODY(powf_inf_pos_y, tc)
z = powf(1.1, y);
- if (isinff(z) == 0 || signbit(z) != 0)
+ if (isinf(z) == 0 || signbit(z) != 0)
atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf");
}
@@ -500,8 +496,8 @@ ATF_TC_BODY(powf_one_neg_x, tc)
/*
* If x is -1.0, and y is +-Inf, 1.0 shall be returned.
*/
- ATF_REQUIRE(isinff(infp) != 0);
- ATF_REQUIRE(isinff(infn) != 0);
+ ATF_REQUIRE(isinf(infp) != 0);
+ ATF_REQUIRE(isinf(infn) != 0);
if (powf(-1.0, infp) != 1.0) {
atf_tc_expect_fail("PR lib/45372");
diff --git a/contrib/netbsd-tests/lib/libm/t_precision.c b/contrib/netbsd-tests/lib/libm/t_precision.c
index df2d8a3..eb8e295 100644
--- a/contrib/netbsd-tests/lib/libm/t_precision.c
+++ b/contrib/netbsd-tests/lib/libm/t_precision.c
@@ -51,6 +51,11 @@ volatile long double y = 1;
ATF_TC_BODY(t_precision, tc)
{
+#ifdef __FreeBSD__
+#ifdef __i386__
+ atf_tc_expect_fail("the __HAVE_LONG_DOUBLE checks fail on i386");
+#endif
+#endif
x += DBL_EPSILON;
ATF_CHECK(x != 1.0);
x -= 1;
diff --git a/contrib/netbsd-tests/lib/libm/t_scalbn.c b/contrib/netbsd-tests/lib/libm/t_scalbn.c
index fe70b3c..4bf00c3 100644
--- a/contrib/netbsd-tests/lib/libm/t_scalbn.c
+++ b/contrib/netbsd-tests/lib/libm/t_scalbn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_scalbn.c,v 1.11 2014/03/03 10:39:08 martin Exp $ */
+/* $NetBSD: t_scalbn.c,v 1.14 2017/01/13 21:09:12 agc Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_scalbn.c,v 1.11 2014/03/03 10:39:08 martin Exp $");
+__RCSID("$NetBSD: t_scalbn.c,v 1.14 2017/01/13 21:09:12 agc Exp $");
#include <math.h>
#include <limits.h>
@@ -81,9 +81,7 @@ ATF_TC_BODY(scalbn_val, tc)
double rv;
for (i = 0; i < tcnt; i++) {
-#ifdef __FreeBSD__
errno = 0;
-#endif
rv = scalbn(tests[i].inval, tests[i].exp);
ATF_CHECK_EQ_MSG(errno, tests[i].error,
"test %zu: errno %d instead of %d", i, errno,
@@ -225,9 +223,7 @@ ATF_TC_BODY(scalbnf_val, tc)
double rv;
for (i = 0; i < tcnt; i++) {
-#ifdef __FreeBSD__
errno = 0;
-#endif
rv = scalbnf(tests[i].inval, tests[i].exp);
ATF_CHECK_EQ_MSG(errno, tests[i].error,
"test %zu: errno %d instead of %d", i, errno,
@@ -372,9 +368,7 @@ ATF_TC_BODY(scalbnl_val, tc)
long double rv;
for (i = 0; i < tcnt; i++) {
-#ifdef __FreeBSD__
errno = 0;
-#endif
rv = scalbnl(tests[i].inval, tests[i].exp);
ATF_CHECK_EQ_MSG(errno, tests[i].error,
"test %zu: errno %d instead of %d", i, errno,
diff --git a/contrib/netbsd-tests/lib/libposix/t_rename.c b/contrib/netbsd-tests/lib/libposix/t_rename.c
index 85b2b95..8c18ec5 100644
--- a/contrib/netbsd-tests/lib/libposix/t_rename.c
+++ b/contrib/netbsd-tests/lib/libposix/t_rename.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $ */
+/* $NetBSD: t_rename.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */
/*
* Copyright (c) 2001, 2008, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $");
+__RCSID("$NetBSD: t_rename.c,v 1.3 2017/01/13 21:30:41 christos Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -43,7 +43,7 @@ __RCSID("$NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $");
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(rename);
ATF_TC_HEAD(rename, tc)
diff --git a/contrib/netbsd-tests/lib/libpthread/h_common.h b/contrib/netbsd-tests/lib/libpthread/h_common.h
index 2e8b0a1..261b07f 100644
--- a/contrib/netbsd-tests/lib/libpthread/h_common.h
+++ b/contrib/netbsd-tests/lib/libpthread/h_common.h
@@ -5,14 +5,14 @@
#define PTHREAD_REQUIRE(x) \
do { \
- int ret = (x); \
- ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \
+ int _ret = (x); \
+ ATF_REQUIRE_MSG(_ret == 0, "%s: %s", #x, strerror(_ret)); \
} while (0)
#define PTHREAD_REQUIRE_STATUS(x, v) \
do { \
- int ret = (x); \
- ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \
+ int _ret = (x); \
+ ATF_REQUIRE_MSG(_ret == (v), "%s: %s", #x, strerror(_ret)); \
} while (0)
#endif // H_COMMON_H
diff --git a/contrib/netbsd-tests/lib/libpthread/t_condwait.c b/contrib/netbsd-tests/lib/libpthread/t_condwait.c
index 99793d0..58b4a8b 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_condwait.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_condwait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $ */
+/* $NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $ */
/*
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -26,8 +26,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $");
+__RCSID("$NetBSD: t_condwait.c,v 1.5 2017/01/16 16:29:19 christos Exp $");
+#include <sys/time.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
@@ -40,11 +41,7 @@ __RCSID("$NetBSD: t_condwait.c,v 1.4 2013/04/12 17:18:11 christos Exp $");
#include "isqemu.h"
-#ifdef __FreeBSD__
-#include <sys/time.h>
-
#include "h_common.h"
-#endif
#define WAITTIME 2 /* Timeout wait secound */
@@ -62,13 +59,8 @@ run(void *param)
clck = *(clockid_t *)param;
-#ifdef __FreeBSD__
PTHREAD_REQUIRE(pthread_condattr_init(&attr));
PTHREAD_REQUIRE(pthread_condattr_setclock(&attr, clck));
-#else
- pthread_condattr_init(&attr);
- pthread_condattr_setclock(&attr, clck); /* MONOTONIC or MONOTONIC */
-#endif
pthread_cond_init(&cond, &attr);
ATF_REQUIRE_EQ((ret = pthread_mutex_lock(&m)), 0);
diff --git a/contrib/netbsd-tests/lib/libpthread/t_detach.c b/contrib/netbsd-tests/lib/libpthread/t_detach.c
index b3357bc..b30cb02 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_detach.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_detach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_detach.c,v 1.1 2011/03/24 13:52:04 jruoho Exp $ */
+/* $NetBSD: t_detach.c,v 1.2 2017/01/16 16:29:54 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,27 +29,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_detach.c,v 1.1 2011/03/24 13:52:04 jruoho Exp $");
+__RCSID("$NetBSD: t_detach.c,v 1.2 2017/01/16 16:29:54 christos Exp $");
-#include <pthread.h>
#include <errno.h>
+#include <pthread.h>
+#include <time.h>
#include <atf-c.h>
#include "h_common.h"
-#ifdef __FreeBSD__
-#include <time.h>
-#endif
-
static void *func(void *);
static void *
func(void *arg)
{
-#ifdef __FreeBSD__
sleep(2);
-#endif
return NULL;
}
@@ -79,25 +74,17 @@ ATF_TC_BODY(pthread_detach, tc)
*/
PTHREAD_REQUIRE(pthread_detach(t));
-#ifdef __FreeBSD__
sleep(1);
-#endif
rv = pthread_join(t, NULL);
ATF_REQUIRE(rv == EINVAL);
-#ifdef __FreeBSD__
sleep(3);
-#endif
/*
* As usual, ESRCH should follow if
* we try to detach an invalid thread.
*/
-#ifdef __NetBSD__
- rv = pthread_cancel(NULL);
-#else
rv = pthread_cancel(t);
-#endif
ATF_REQUIRE(rv == ESRCH);
}
diff --git a/contrib/netbsd-tests/lib/libpthread/t_fork.c b/contrib/netbsd-tests/lib/libpthread/t_fork.c
index a58c1a6..936c7de 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_fork.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_fork.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fork.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
+/* $NetBSD: t_fork.c,v 1.2 2017/01/16 16:28:27 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_fork.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
+__RCSID("$NetBSD: t_fork.c,v 1.2 2017/01/16 16:28:27 christos Exp $");
/*
* Written by Love Hörnquist Åstrand <lha@NetBSD.org>, March 2003.
@@ -61,11 +61,7 @@ print_pid(void *arg)
thread_survived = 1;
if (parent != getpid()) {
-#ifdef __FreeBSD__
_exit(1);
-#else
- exit(1);
-#endif
}
return NULL;
}
@@ -99,11 +95,7 @@ ATF_TC_BODY(fork, tc)
ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), 0, "thread survived in child");
} else {
sleep(5);
-#ifdef __FreeBSD__
_exit(thread_survived ? 1 : 0);
-#else
- exit(thread_survived ? 1 : 0);
-#endif
}
}
diff --git a/contrib/netbsd-tests/lib/libpthread/t_fpu.c b/contrib/netbsd-tests/lib/libpthread/t_fpu.c
index 6a385d9..dd47fb8 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_fpu.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_fpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $ */
+/* $NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
+__RCSID("$NetBSD: t_fpu.c,v 1.3 2017/01/16 16:27:43 christos Exp $");
/*
* This is adapted from part of csw/cstest of the MPD implementation by
@@ -49,20 +49,17 @@ __RCSID("$NetBSD: t_fpu.c,v 1.2 2013/01/27 14:47:37 mbalmer Exp $");
* <is@netbsd.org>.
*/
+#include <errno.h>
#include <math.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <errno.h>
-#include <string.h>
-#endif
-
#include "h_common.h"
#define N_RECURSE 10
@@ -82,24 +79,16 @@ stir(void *p)
for (;;) {
x = sin ((y = cos (x + y + .4)) - (z = cos (x + z + .6)));
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(sched_yield() == 0,
"sched_yield failed: %s", strerror(errno));
-#else
- PTHREAD_REQUIRE(sched_yield());
-#endif
}
}
static double
mul3(double x, double y, double z)
{
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(sched_yield() == 0,
"sched_yield failed: %s", strerror(errno));
-#else
- PTHREAD_REQUIRE(sched_yield());
-#endif
return x * y * z;
}
@@ -129,11 +118,7 @@ bar(void *p)
static void
recurse(void) {
pthread_t s2;
-#ifdef __FreeBSD__
PTHREAD_REQUIRE(pthread_create(&s2, 0, bar, 0));
-#else
- pthread_create(&s2, 0, bar, 0);
-#endif
sleep(20); /* XXX must be long enough for our slowest machine */
}
@@ -153,11 +138,7 @@ ATF_TC_BODY(fpu, tc)
PTHREAD_REQUIRE(pthread_mutex_init(&recursion_depth_lock, 0));
-#ifdef __FreeBSD__
PTHREAD_REQUIRE(pthread_create(&s5, 0, stir, stirseed));
-#else
- pthread_create(&s5, 0, stir, stirseed);
-#endif
recurse();
atf_tc_fail("exiting from main");
diff --git a/contrib/netbsd-tests/lib/libpthread/t_join.c b/contrib/netbsd-tests/lib/libpthread/t_join.c
index 71b6775..1c57910 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_join.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_join.c
@@ -37,10 +37,6 @@ __RCSID("$NetBSD: t_join.c,v 1.8 2012/03/12 20:17:16 joerg Exp $");
#include <atf-c.h>
-#ifdef __FreeBSD__
-#include <pthread_np.h>
-#endif
-
#include "h_common.h"
#ifdef CHECK_STACK_ALIGNMENT
diff --git a/contrib/netbsd-tests/lib/libpthread/t_mutex.c b/contrib/netbsd-tests/lib/libpthread/t_mutex.c
index b8d60e6..bcb8540 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_mutex.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_mutex.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $ */
+/* $NetBSD: t_mutex.c,v 1.15 2017/01/16 16:23:41 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,12 +29,10 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.15 2017/01/16 16:23:41 christos Exp $");
-#ifdef __FreeBSD__
#include <sys/time.h> /* For timespecadd */
#include <inttypes.h> /* For UINT16_MAX */
-#endif
#include <pthread.h>
#include <stdio.h>
#include <string.h>
@@ -594,20 +592,16 @@ ATF_TC_BODY(mutexattr2, tc)
int min_prio = sched_get_priority_min(SCHED_FIFO);
for (int i = min_prio; i <= max_prio; i++) {
int prioceiling;
-#ifdef __FreeBSD__
int protocol;
PTHREAD_REQUIRE(pthread_mutexattr_getprotocol(&mattr,
&protocol));
printf("priority: %d\nprotocol: %d\n", i, protocol);
-#endif
PTHREAD_REQUIRE(pthread_mutexattr_setprioceiling(&mattr, i));
PTHREAD_REQUIRE(pthread_mutexattr_getprioceiling(&mattr,
&prioceiling));
-#ifdef __FreeBSD__
printf("prioceiling: %d\n", prioceiling);
-#endif
ATF_REQUIRE_EQ(i, prioceiling);
}
}
diff --git a/contrib/netbsd-tests/lib/libpthread/t_once.c b/contrib/netbsd-tests/lib/libpthread/t_once.c
index e879077..e2f209b 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_once.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_once.c
@@ -31,6 +31,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_once.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
+#ifdef __FreeBSD__
+#include <sys/time.h> /* For itimer*, etc. */
+#endif
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
@@ -46,10 +49,6 @@ static int x;
#define NTHREADS 25
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#endif
-
static void
ofunc(void)
{
diff --git a/contrib/netbsd-tests/lib/libpthread/t_sem.c b/contrib/netbsd-tests/lib/libpthread/t_sem.c
index 5bb7ae7..3d15edd 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_sem.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_sem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sem.c,v 1.8 2014/11/04 00:20:19 justin Exp $ */
+/* $NetBSD: t_sem.c,v 1.9 2017/01/16 16:22:22 christos Exp $ */
/*
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -86,8 +86,9 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sem.c,v 1.8 2014/11/04 00:20:19 justin Exp $");
+__RCSID("$NetBSD: t_sem.c,v 1.9 2017/01/16 16:22:22 christos Exp $");
+#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
@@ -111,10 +112,6 @@ __RCSID("$NetBSD: t_sem.c,v 1.8 2014/11/04 00:20:19 justin Exp $");
static sem_t sem;
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#endif
-
ATF_TC(named);
ATF_TC_HEAD(named, tc)
{
diff --git a/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c b/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
index a18ac2f..677c51f 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.2 2014/08/25 16:31:15 bouyer Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.3 2017/01/16 16:27:06 christos Exp $ */
/*
* Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -28,15 +28,13 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD");
-#ifdef __FreeBSD__
#include <sys/types.h>
#include <errno.h>
-#include <string.h>
-#endif
#include <pthread.h>
-#include <ucontext.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
#include <atf-c.h>
@@ -82,12 +80,8 @@ threadfunc(void *arg)
oself = (void *)pthread_self();
printf("before swapcontext self = %p\n", oself);
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s",
strerror(errno));
-#else
- PTHREAD_REQUIRE(swapcontext(&octx, &nctx));
-#endif
/* NOTREACHED */
return NULL;
@@ -109,12 +103,8 @@ ATF_TC_BODY(swapcontext1, tc)
printf("Testing if swapcontext() alters pthread_self()\n");
-#ifdef __FreeBSD__
ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s",
strerror(errno));
-#else
- PTHREAD_REQUIRE(getcontext(&nctx));
-#endif
PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
PTHREAD_REQUIRE(pthread_join(thread, NULL));
}
diff --git a/contrib/netbsd-tests/lib/libpthread_dbg/h_common.h b/contrib/netbsd-tests/lib/libpthread_dbg/h_common.h
new file mode 100644
index 0000000..0a02b96
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libpthread_dbg/h_common.h
@@ -0,0 +1,128 @@
+/* $NetBSD: h_common.h,v 1.2 2016/11/19 02:30:54 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef H_COMMON_H
+#define H_COMMON_H
+
+#include <sys/cdefs.h>
+#include <dlfcn.h>
+#include <pthread_dbg.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+#define PTHREAD_REQUIRE(x) \
+ do { \
+ int ret = (x); \
+ ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \
+ } while (0)
+
+#define PTHREAD_REQUIRE_STATUS(x, v) \
+ do { \
+ int ret = (x); \
+ ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \
+ } while (0)
+
+static int __used
+dummy_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_lookup(void *arg, const char *sym, caddr_t *addr)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_regsize(void *arg, int regset, size_t *size)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_getregs(void *arg, int regset, int lwp, void *buf)
+{
+ return TD_ERR_ERR;
+}
+
+static int __used
+dummy_proc_setregs(void *arg, int regset, int lwp, void *buf)
+{
+ return TD_ERR_ERR;
+}
+
+/* Minimalistic basic implementation */
+
+static int __used
+basic_proc_read(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ memcpy(buf, addr, size);
+
+ return TD_ERR_OK;
+}
+
+static int __used
+basic_proc_write(void *arg, caddr_t addr, void *buf, size_t size)
+{
+ memcpy(addr, buf, size);
+
+ return TD_ERR_OK;
+}
+
+static int __used
+basic_proc_lookup(void *arg, const char *sym, caddr_t *addr)
+{
+ void *handle;
+ void *symbol;
+
+ ATF_REQUIRE_MSG((handle = dlopen(NULL, RTLD_LOCAL | RTLD_LAZY))
+ != NULL, "dlopen(3) failed: %s", dlerror());
+
+ symbol = dlsym(handle, sym);
+
+ ATF_REQUIRE_MSG(dlclose(handle) == 0, "dlclose(3) failed: %s",
+ dlerror());
+
+ if (!symbol)
+ return TD_ERR_NOSYM;
+
+ *addr = (caddr_t)(uintptr_t)symbol;
+
+ return TD_ERR_OK;
+}
+
+#endif // H_COMMON_H
diff --git a/contrib/netbsd-tests/lib/libpthread_dbg/t_dummy.c b/contrib/netbsd-tests/lib/libpthread_dbg/t_dummy.c
new file mode 100644
index 0000000..367443c
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libpthread_dbg/t_dummy.c
@@ -0,0 +1,131 @@
+/* $NetBSD: t_dummy.c,v 1.6 2016/11/19 15:13:46 kamil Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_dummy.c,v 1.6 2016/11/19 15:13:46 kamil Exp $");
+
+#include "h_common.h"
+#include <pthread_dbg.h>
+#include <stdio.h>
+
+#include <atf-c.h>
+
+
+ATF_TC(dummy1);
+ATF_TC_HEAD(dummy1, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that dummy lookup functions stop td_open() with failure");
+}
+
+ATF_TC_BODY(dummy1, tc)
+{
+
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+
+ dummy_callbacks.proc_read = dummy_proc_read;
+ dummy_callbacks.proc_write = dummy_proc_write;
+ dummy_callbacks.proc_lookup = dummy_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_ERR);
+}
+
+ATF_TC(dummy2);
+ATF_TC_HEAD(dummy2, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that td_open() for basic proc_{read,write,lookup} works");
+}
+
+ATF_TC_BODY(dummy2, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+}
+
+ATF_TC(dummy3);
+ATF_TC_HEAD(dummy3, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that calling twice td_open() for the same process fails");
+}
+
+ATF_TC_BODY(dummy3, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta1;
+ td_proc_t *main_ta2;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ printf("Calling td_open(3) for the first time - expecting success\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta1) == TD_ERR_OK);
+
+ printf("Calling td_open(3) for the first time - expecting in-use\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta2) ==
+ TD_ERR_INUSE);
+
+ printf("Calling td_close(3) for the first successful call\n");
+ ATF_REQUIRE(td_close(main_ta1) == TD_ERR_OK);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, dummy1);
+ ATF_TP_ADD_TC(tp, dummy2);
+ ATF_TP_ADD_TC(tp, dummy3);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/lib/libpthread_dbg/t_threads.c b/contrib/netbsd-tests/lib/libpthread_dbg/t_threads.c
new file mode 100644
index 0000000..f22bbc9
--- /dev/null
+++ b/contrib/netbsd-tests/lib/libpthread_dbg/t_threads.c
@@ -0,0 +1,719 @@
+/* $NetBSD: t_threads.c,v 1.9 2017/01/13 05:18:22 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_threads.c,v 1.9 2017/01/13 05:18:22 christos Exp $");
+
+#include <dlfcn.h>
+#include <pthread.h>
+#include <pthread_dbg.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+#include "h_common.h"
+
+#define MAX_THREADS (size_t)10
+
+ATF_TC(threads1);
+ATF_TC_HEAD(threads1, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that td_thr_iter() call without extra logic works");
+}
+
+static volatile int exiting1;
+
+static void *
+busyFunction1(void *arg)
+{
+
+ while (exiting1 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads1(td_thread_t *thread, void *arg)
+{
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads1, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction1, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads1, NULL) == TD_ERR_OK);
+
+ exiting1 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+}
+
+ATF_TC(threads2);
+ATF_TC_HEAD(threads2, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that td_thr_iter() call is executed for each thread once");
+}
+
+static volatile int exiting2;
+
+static void *
+busyFunction2(void *arg)
+{
+
+ while (exiting2 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads2(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads2, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction2, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads2, &count) == TD_ERR_OK);
+
+ exiting2 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads3);
+ATF_TC_HEAD(threads3, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that for each td_thr_iter() call td_thr_info() is valid");
+}
+
+static volatile int exiting3;
+
+static void *
+busyFunction3(void *arg)
+{
+
+ while (exiting3 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads3(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+ td_thread_info_t info;
+
+ ATF_REQUIRE(td_thr_info(thread, &info) == TD_ERR_OK);
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads3, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction3, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads3, &count) == TD_ERR_OK);
+
+ exiting3 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads4);
+ATF_TC_HEAD(threads4, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that for each td_thr_iter() call td_thr_getname() is "
+ "valid");
+}
+
+static volatile int exiting4;
+
+static void *
+busyFunction4(void *arg)
+{
+
+ while (exiting4 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads4(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+ char name[PTHREAD_MAX_NAMELEN_NP];
+
+ ATF_REQUIRE(td_thr_getname(thread, name, sizeof(name)) == TD_ERR_OK);
+
+ printf("Thread name: %s\n", name);
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads4, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction4, NULL));
+ }
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ PTHREAD_REQUIRE
+ (pthread_setname_np(threads[i], "test_%d", (void*)i));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads4, &count) == TD_ERR_OK);
+
+ exiting4 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads5);
+ATF_TC_HEAD(threads5, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that td_thr_getname() handles shorter buffer parameter "
+ "and the result is properly truncated");
+}
+
+static volatile int exiting5;
+
+static void *
+busyFunction5(void *arg)
+{
+
+ while (exiting5 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads5(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+ /* Arbitrarily short string buffer */
+ char name[3];
+
+ ATF_REQUIRE(td_thr_getname(thread, name, sizeof(name)) == TD_ERR_OK);
+
+ printf("Thread name: %s\n", name);
+
+ /* strlen(3) does not count including a '\0' character */
+ ATF_REQUIRE(strlen(name) < sizeof(name));
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads5, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction5, NULL));
+ }
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ PTHREAD_REQUIRE
+ (pthread_setname_np(threads[i], "test_%d", (void*)i));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads5, &count) == TD_ERR_OK);
+
+ exiting5 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads6);
+ATF_TC_HEAD(threads6, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that pthread_t can be translated with td_map_pth2thr() "
+ "to td_thread_t -- and assert earlier that td_thr_iter() call is "
+ "valid");
+}
+
+static volatile int exiting6;
+
+static void *
+busyFunction6(void *arg)
+{
+
+ while (exiting6 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads6(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads6, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction6, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads6, &count) == TD_ERR_OK);
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ td_thread_t *td_thread;
+ ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread)
+ == TD_ERR_OK);
+ }
+
+ exiting6 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads7);
+ATF_TC_HEAD(threads7, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that pthread_t can be translated with td_map_pth2thr() "
+ "to td_thread_t -- and assert later that td_thr_iter() call is "
+ "valid");
+}
+
+static volatile int exiting7;
+
+static void *
+busyFunction7(void *arg)
+{
+
+ while (exiting7 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads7(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads7, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction7, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ td_thread_t *td_thread;
+ ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread)
+ == TD_ERR_OK);
+ }
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads7, &count) == TD_ERR_OK);
+
+ exiting7 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads8);
+ATF_TC_HEAD(threads8, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that pthread_t can be translated with td_map_pth2thr() "
+ "to td_thread_t -- compare thread's name of pthread_t and "
+ "td_thread_t");
+}
+
+static volatile int exiting8;
+
+static void *
+busyFunction8(void *arg)
+{
+
+ while (exiting8 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads8(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads8, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction8, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads8, &count) == TD_ERR_OK);
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ td_thread_t *td_thread;
+ char td_threadname[PTHREAD_MAX_NAMELEN_NP];
+ char pth_threadname[PTHREAD_MAX_NAMELEN_NP];
+ ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread)
+ == TD_ERR_OK);
+ ATF_REQUIRE(td_thr_getname(td_thread, td_threadname,
+ sizeof(td_threadname)) == TD_ERR_OK);
+ PTHREAD_REQUIRE(pthread_getname_np(threads[i], pth_threadname,
+ sizeof(pth_threadname)));
+ ATF_REQUIRE(strcmp(td_threadname, pth_threadname) == 0);
+ }
+
+ exiting8 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TC(threads9);
+ATF_TC_HEAD(threads9, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr",
+ "Asserts that pthread_t can be translated with td_map_pth2thr() "
+ "to td_thread_t -- assert that thread is in the TD_STATE_RUNNING "
+ "state");
+}
+
+static volatile int exiting9;
+
+static void *
+busyFunction9(void *arg)
+{
+
+ while (exiting9 == 0)
+ usleep(50000);
+
+ return NULL;
+}
+
+static int
+iterateThreads9(td_thread_t *thread, void *arg)
+{
+ int *counter = (int *)arg;
+
+ ++(*counter);
+
+ return TD_ERR_OK;
+}
+
+ATF_TC_BODY(threads9, tc)
+{
+ struct td_proc_callbacks_t dummy_callbacks;
+ td_proc_t *main_ta;
+ size_t i;
+ pthread_t threads[MAX_THREADS];
+ int count = 0;
+
+ dummy_callbacks.proc_read = basic_proc_read;
+ dummy_callbacks.proc_write = basic_proc_write;
+ dummy_callbacks.proc_lookup = basic_proc_lookup;
+ dummy_callbacks.proc_regsize = dummy_proc_regsize;
+ dummy_callbacks.proc_getregs = dummy_proc_getregs;
+ dummy_callbacks.proc_setregs = dummy_proc_setregs;
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ printf("Creating thread %zu\n", i);
+ PTHREAD_REQUIRE
+ (pthread_create(&threads[i], NULL, busyFunction9, NULL));
+ }
+
+ printf("Calling td_open(3)\n");
+ ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK);
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ td_thread_t *td_thread;
+ td_thread_info_t info;
+ ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread)
+ == TD_ERR_OK);
+ ATF_REQUIRE(td_thr_info(td_thread, &info) == TD_ERR_OK);
+ ATF_REQUIRE_EQ(info.thread_state, TD_STATE_RUNNING);
+ }
+
+ ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads9, &count) == TD_ERR_OK);
+
+ exiting9 = 1;
+
+ printf("Calling td_close(3)\n");
+ ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK);
+
+ ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1,
+ "counted threads (%d) != expected threads (%zu)",
+ count, MAX_THREADS + 1);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, threads1);
+ ATF_TP_ADD_TC(tp, threads2);
+ ATF_TP_ADD_TC(tp, threads3);
+ ATF_TP_ADD_TC(tp, threads4);
+ ATF_TP_ADD_TC(tp, threads5);
+ ATF_TP_ADD_TC(tp, threads6);
+ ATF_TP_ADD_TC(tp, threads7);
+ ATF_TP_ADD_TC(tp, threads8);
+ ATF_TP_ADD_TC(tp, threads9);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/lib/librefuse/t_refuse_opt.c b/contrib/netbsd-tests/lib/librefuse/t_refuse_opt.c
new file mode 100644
index 0000000..23c2803
--- /dev/null
+++ b/contrib/netbsd-tests/lib/librefuse/t_refuse_opt.c
@@ -0,0 +1,418 @@
+/* $NetBSD: t_refuse_opt.c,v 1.8 2017/01/13 21:30:41 christos Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_refuse_opt.c,v 1.8 2017/01/13 21:30:41 christos Exp $");
+
+#define _KERNTYPES
+#include <sys/types.h>
+
+#include <atf-c.h>
+
+#include <fuse.h>
+
+#include "h_macros.h"
+
+ATF_TC(t_fuse_opt_add_arg);
+ATF_TC_HEAD(t_fuse_opt_add_arg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_arg(3) works");
+}
+
+ATF_TC_BODY(t_fuse_opt_add_arg, tc)
+{
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+
+ RZ(fuse_opt_add_arg(&args, "foo"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+
+ ATF_REQUIRE_EQ(args.argc, 2);
+ ATF_CHECK_STREQ(args.argv[0], "foo");
+ ATF_CHECK_STREQ(args.argv[1], "bar");
+ ATF_CHECK(args.allocated != 0);
+}
+
+ATF_TC(t_fuse_opt_insert_arg);
+ATF_TC_HEAD(t_fuse_opt_insert_arg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_insert_arg(3) works");
+}
+
+ATF_TC_BODY(t_fuse_opt_insert_arg, tc)
+{
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+
+ RZ(fuse_opt_insert_arg(&args, 0, "foo"));
+ RZ(fuse_opt_insert_arg(&args, 0, "bar"));
+
+ ATF_REQUIRE_EQ(args.argc, 2);
+ ATF_CHECK_STREQ(args.argv[0], "bar");
+ ATF_CHECK_STREQ(args.argv[1], "foo");
+ ATF_CHECK(args.allocated != 0);
+}
+
+ATF_TC(t_fuse_opt_add_opt);
+ATF_TC_HEAD(t_fuse_opt_add_opt, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_opt(3) works");
+}
+
+ATF_TC_BODY(t_fuse_opt_add_opt, tc)
+{
+ char* opt = NULL;
+
+ RZ(fuse_opt_add_opt(&opt, "fo\\o"));
+ ATF_CHECK_STREQ(opt, "fo\\o");
+
+ RZ(fuse_opt_add_opt(&opt, "ba,r"));
+ ATF_CHECK_STREQ(opt, "fo\\o,ba,r");
+}
+
+ATF_TC(t_fuse_opt_add_opt_escaped);
+ATF_TC_HEAD(t_fuse_opt_add_opt_escaped, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_opt_escaped(3) works");
+}
+
+ATF_TC_BODY(t_fuse_opt_add_opt_escaped, tc)
+{
+ char* opt = NULL;
+
+ RZ(fuse_opt_add_opt_escaped(&opt, "fo\\o"));
+ ATF_CHECK_STREQ(opt, "fo\\\\o");
+
+ RZ(fuse_opt_add_opt_escaped(&opt, "ba,r"));
+ ATF_CHECK_STREQ(opt, "fo\\\\o,ba\\,r");
+}
+
+ATF_TC(t_fuse_opt_match);
+ATF_TC_HEAD(t_fuse_opt_match, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_match(3) works"
+ " for every form of templates");
+}
+
+ATF_TC_BODY(t_fuse_opt_match, tc)
+{
+ struct fuse_opt o1[] = { FUSE_OPT_KEY("-x" , 0), FUSE_OPT_END };
+ struct fuse_opt o2[] = { FUSE_OPT_KEY("foo" , 0), FUSE_OPT_END };
+ struct fuse_opt o3[] = { FUSE_OPT_KEY("foo=" , 0), FUSE_OPT_END };
+ struct fuse_opt o4[] = { FUSE_OPT_KEY("foo=%s", 0), FUSE_OPT_END };
+ struct fuse_opt o5[] = { FUSE_OPT_KEY("-x " , 0), FUSE_OPT_END };
+ struct fuse_opt o6[] = { FUSE_OPT_KEY("-x %s" , 0), FUSE_OPT_END };
+
+ ATF_CHECK(fuse_opt_match(o1, "-x") == 1);
+ ATF_CHECK(fuse_opt_match(o1, "x") == 0);
+
+ ATF_CHECK(fuse_opt_match(o2, "foo") == 1);
+ ATF_CHECK(fuse_opt_match(o2, "-foo") == 0);
+
+ ATF_CHECK(fuse_opt_match(o3, "foo=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o3, "foo" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o4, "foo=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o4, "foo" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o5, "-xbar" ) == 1);
+ ATF_CHECK(fuse_opt_match(o5, "-x" ) == 1);
+ ATF_CHECK(fuse_opt_match(o5, "-x=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o5, "bar" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o6, "-xbar" ) == 1);
+ ATF_CHECK(fuse_opt_match(o6, "-x" ) == 1);
+ ATF_CHECK(fuse_opt_match(o6, "-x=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o6, "bar" ) == 0);
+}
+
+struct foofs_config {
+ int number;
+ char *string;
+ char* nonopt;
+};
+
+#define FOOFS_OPT(t, p, v) { t, offsetof(struct foofs_config, p), v }
+
+static struct fuse_opt foofs_opts[] = {
+ FOOFS_OPT("number=%i" , number, 0),
+ FOOFS_OPT("-n %i" , number, 0),
+ FOOFS_OPT("string=%s" , string, 0),
+ FOOFS_OPT("number1" , number, 1),
+ FOOFS_OPT("number2" , number, 2),
+ FOOFS_OPT("--number=three", number, 3),
+ FOOFS_OPT("--number=four" , number, 4),
+ FUSE_OPT_END
+};
+
+static int foo_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) {
+ struct foofs_config *config = data;
+
+ if (key == FUSE_OPT_KEY_NONOPT && config->nonopt == NULL) {
+ config->nonopt = strdup(arg);
+ return 0;
+ }
+ else {
+ return 1;
+ }
+}
+
+ATF_TC(t_fuse_opt_parse_null_args);
+ATF_TC_HEAD(t_fuse_opt_parse_null_args, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "NULL args means an empty arguments vector");
+}
+
+ATF_TC_BODY(t_fuse_opt_parse_null_args, tc)
+{
+ struct foofs_config config;
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(NULL, &config, NULL, NULL) == 0);
+ ATF_CHECK_EQ(config.number, 0);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+}
+
+ATF_TC(t_fuse_opt_parse_null_opts);
+ATF_TC_HEAD(t_fuse_opt_parse_null_opts, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "NULL opts means an opts array which only has FUSE_OPT_END");
+}
+
+ATF_TC_BODY(t_fuse_opt_parse_null_opts, tc)
+{
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+ struct foofs_config config;
+
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "number=1,string=foo"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, NULL, NULL) == 0);
+ ATF_CHECK_EQ(config.number, 0);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 4);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+ ATF_CHECK_STREQ(args.argv[1], "-o");
+ ATF_CHECK_STREQ(args.argv[2], "number=1,string=foo");
+ ATF_CHECK_STREQ(args.argv[3], "bar");
+}
+
+ATF_TC(t_fuse_opt_parse_null_proc);
+ATF_TC_HEAD(t_fuse_opt_parse_null_proc, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "NULL proc means a processor function always returning 1,"
+ " i.e. keep the argument");
+}
+
+ATF_TC_BODY(t_fuse_opt_parse_null_proc, tc)
+{
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+ struct foofs_config config;
+
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "number=1,string=foo"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, NULL) == 0);
+ ATF_CHECK_EQ(config.number, 1);
+ ATF_CHECK_STREQ(config.string, "foo");
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 2);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+ ATF_CHECK_STREQ(args.argv[1], "bar");
+}
+
+ATF_TC(t_fuse_opt_parse);
+ATF_TC_HEAD(t_fuse_opt_parse, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_parse(3) fully works");
+}
+
+ATF_TC_BODY(t_fuse_opt_parse, tc)
+{
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+ struct foofs_config config;
+
+ /* Standard form */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "number=1,string=foo"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 1);
+ ATF_CHECK_STREQ(config.string, "foo");
+ ATF_CHECK_STREQ(config.nonopt, "bar");
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+
+ /* Concatenated -o */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-onumber=1,unknown,string=foo"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 1);
+ ATF_CHECK_STREQ(config.string, "foo");
+ ATF_CHECK_STREQ(config.nonopt, "bar");
+ ATF_CHECK_EQ(args.argc, 3);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+ ATF_CHECK_STREQ(args.argv[1], "-o");
+ ATF_CHECK_STREQ(args.argv[2], "unknown");
+
+ /* Sparse -o */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "bar"));
+ RZ(fuse_opt_add_arg(&args, "baz"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "number=1"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "unknown"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "string=foo"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 1);
+ ATF_CHECK_STREQ(config.string, "foo");
+ ATF_CHECK_STREQ(config.nonopt, "bar");
+ ATF_CHECK_EQ(args.argc, 4);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+ ATF_CHECK_STREQ(args.argv[1], "-o");
+ ATF_CHECK_STREQ(args.argv[2], "unknown");
+ ATF_CHECK_STREQ(args.argv[3], "baz");
+
+ /* Separate -n %i */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-n"));
+ RZ(fuse_opt_add_arg(&args, "3"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 3);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+
+ /* Concatenated -n %i */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-n3"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 3);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+
+ /* -o constant */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "-o"));
+ RZ(fuse_opt_add_arg(&args, "number2"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 2);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+
+ /* -x constant */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "--number=four"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 4);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_EQ(config.nonopt, NULL);
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+
+ /* end-of-options "--" marker */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "--"));
+ RZ(fuse_opt_add_arg(&args, "-onumber=1"));
+ RZ(fuse_opt_add_arg(&args, "-ostring=foo"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 0);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_STREQ(config.nonopt, "-onumber=1");
+ ATF_CHECK_EQ(args.argc, 3);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+ ATF_CHECK_STREQ(args.argv[1], "--");
+ ATF_CHECK_STREQ(args.argv[2], "-ostring=foo");
+
+ /* The "--" marker at the last of outargs should be removed */
+ fuse_opt_free_args(&args);
+ RZ(fuse_opt_add_arg(&args, "foofs"));
+ RZ(fuse_opt_add_arg(&args, "--"));
+ RZ(fuse_opt_add_arg(&args, "-onumber=1"));
+
+ memset(&config, 0, sizeof(config));
+ ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0);
+ ATF_CHECK_EQ(config.number, 0);
+ ATF_CHECK_EQ(config.string, NULL);
+ ATF_CHECK_STREQ(config.nonopt, "-onumber=1");
+ ATF_CHECK_EQ(args.argc, 1);
+ ATF_CHECK_STREQ(args.argv[0], "foofs");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, t_fuse_opt_add_arg);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_insert_arg);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_add_opt);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_add_opt_escaped);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_match);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_args);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_opts);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_proc);
+ ATF_TP_ADD_TC(tp, t_fuse_opt_parse);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c
index e76cd52..0541ae5 100644
--- a/contrib/netbsd-tests/lib/librt/t_sem.c
+++ b/contrib/netbsd-tests/lib/librt/t_sem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $ */
+/* $NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $ */
/*
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $");
+__RCSID("$NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $");
#include <sys/wait.h>
@@ -72,7 +72,7 @@ __RCSID("$NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $");
#define NCHILDREN 10
-ATF_TC(basic);
+ATF_TC_WITH_CLEANUP(basic);
ATF_TC_HEAD(basic, tc)
{
atf_tc_set_md_var(tc, "descr", "Checks basic functionality of POSIX "
@@ -86,9 +86,6 @@ ATF_TC_BODY(basic, tc)
if (sysconf(_SC_SEMAPHORES) == -1)
atf_tc_skip("POSIX semaphores not supported");
-#ifdef __FreeBSD__
- sem_unlink("/sem_b");
-#endif
sem_b = sem_open("/sem_b", O_CREAT | O_EXCL, 0644, 0);
ATF_REQUIRE(sem_b != SEM_FAILED);
@@ -111,8 +108,12 @@ ATF_TC_BODY(basic, tc)
ATF_REQUIRE_EQ(sem_close(sem_b), 0);
ATF_REQUIRE_EQ(sem_unlink("/sem_b"), 0);
}
+ATF_TC_CLEANUP(basic, tc)
+{
+ (void)sem_unlink("/sem_b");
+}
-ATF_TC(child);
+ATF_TC_WITH_CLEANUP(child);
ATF_TC_HEAD(child, tc)
{
atf_tc_set_md_var(tc, "descr", "Checks using semaphores to synchronize "
@@ -127,12 +128,9 @@ ATF_TC_BODY(child, tc)
pid_t pid;
- if (sysconf(_SC_SEMAPHORES) == -1)
+ if (sysconf(_SC_SEMAPHORES) == -1)
atf_tc_skip("POSIX semaphores not supported");
-#ifdef __FreeBSD__
- sem_unlink("/sem_a");
-#endif
sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0);
ATF_REQUIRE(sem_a != SEM_FAILED);
@@ -170,6 +168,10 @@ ATF_TC_BODY(child, tc)
ATF_REQUIRE_EQ(sem_close(sem_a), 0);
ATF_REQUIRE_EQ(sem_unlink("/sem_a"), 0);
}
+ATF_TC_CLEANUP(child, tc)
+{
+ (void)sem_unlink("/sem_a");
+}
ATF_TP_ADD_TCS(tp)
{
diff --git a/contrib/netbsd-tests/lib/librumpclient/t_fd.c b/contrib/netbsd-tests/lib/librumpclient/t_fd.c
index 6e6d947..70182ab 100644
--- a/contrib/netbsd-tests/lib/librumpclient/t_fd.c
+++ b/contrib/netbsd-tests/lib/librumpclient/t_fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fd.c,v 1.5 2016/08/10 21:10:18 kre Exp $ */
+/* $NetBSD: t_fd.c,v 1.6 2017/01/13 21:30:41 christos Exp $ */
/*
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
#include <rump/rumpclient.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC_WITH_CLEANUP(bigenough);
ATF_TC_HEAD(bigenough, tc)
diff --git a/contrib/netbsd-tests/lib/semaphore/sem.c b/contrib/netbsd-tests/lib/semaphore/sem.c
index 5967b88..6af9b0d 100644
--- a/contrib/netbsd-tests/lib/semaphore/sem.c
+++ b/contrib/netbsd-tests/lib/semaphore/sem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.10 2012/03/09 14:25:34 joerg Exp $ */
+/* $NetBSD: sem.c,v 1.11 2017/01/13 21:30:42 christos Exp $ */
/*
* Common code for semaphore tests. This can be included both into
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(postwait);
ATF_TC_HEAD(postwait, tc)
diff --git a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c
index 03940c2..47c7f55 100644
--- a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c
+++ b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dlerror-cleared.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */
+/* $NetBSD: t_dlerror-cleared.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <dlfcn.h>
#include <link_elf.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(rtld_dlerror_cleared);
ATF_TC_HEAD(rtld_dlerror_cleared, tc)
diff --git a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c
index 8b80c26..31b96e8 100644
--- a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c
+++ b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dlerror-false.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */
+/* $NetBSD: t_dlerror-false.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <dlfcn.h>
#include <link_elf.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(rtld_dlerror_false);
ATF_TC_HEAD(rtld_dlerror_false, tc)
diff --git a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c
index a15ba5d..7b12528 100644
--- a/contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c
+++ b/contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dlinfo.c,v 1.4 2011/03/25 14:47:31 pooka Exp $ */
+/* $NetBSD: t_dlinfo.c,v 1.5 2017/01/13 21:30:42 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <dlfcn.h>
#include <link_elf.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(rtld_dlinfo_linkmap_self);
ATF_TC_HEAD(rtld_dlinfo_linkmap_self, tc)
diff --git a/contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c b/contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c
index 1c85672..68468d4 100644
--- a/contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c
+++ b/contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ifunc.c,v 1.1 2014/08/25 20:40:53 joerg Exp $ */
+/* $NetBSD: t_ifunc.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
/*
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <dlfcn.h>
#include <util.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(rtld_ifunc);
diff --git a/contrib/netbsd-tests/modules/t_builtin.c b/contrib/netbsd-tests/modules/t_builtin.c
index 0d9a3f0..79845b8 100644
--- a/contrib/netbsd-tests/modules/t_builtin.c
+++ b/contrib/netbsd-tests/modules/t_builtin.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_builtin.c,v 1.2 2010/11/03 16:10:23 christos Exp $ */
+/* $NetBSD: t_builtin.c,v 1.3 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. All rights reserved.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../h_macros.h"
+#include "h_macros.h"
#define MYMP "/mnt"
#define HZFILE MYMP "/hz"
diff --git a/contrib/netbsd-tests/net/bpf/t_bpf.c b/contrib/netbsd-tests/net/bpf/t_bpf.c
index 95ca2fc..cf8aa82 100644
--- a/contrib/netbsd-tests/net/bpf/t_bpf.c
+++ b/contrib/netbsd-tests/net/bpf/t_bpf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $ */
+/* $NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $ */
/*-
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -25,7 +25,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $");
+__RCSID("$NetBSD: t_bpf.c,v 1.7 2017/02/01 08:04:49 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../config/netconfig.c"
ATF_TC(bpfwriteleak);
@@ -166,6 +166,39 @@ ATF_TC_BODY(bpfwritetrunc, tc)
}
#endif /* #if (SIZE_MAX > UINT_MAX) */
+ATF_TC(bpf_ioctl_BLEN);
+ATF_TC_HEAD(bpf_ioctl_BLEN, tc)
+{
+
+ atf_tc_set_md_var(tc, "descr", "Checks behaviors of BIOCGBLEN and "
+ "BIOCSBLEN");
+}
+
+ATF_TC_BODY(bpf_ioctl_BLEN, tc)
+{
+ struct ifreq ifr;
+ int ifnum, bpfd;
+ u_int blen = 0;
+
+ RZ(rump_init());
+ RZ(rump_pub_shmif_create(NULL, &ifnum));
+ sprintf(ifr.ifr_name, "shmif%d", ifnum);
+
+ RL(bpfd = rump_sys_open("/dev/bpf", O_RDWR));
+
+ RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen));
+ ATF_REQUIRE(blen != 0);
+ blen = 100;
+ RL(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen));
+ RL(rump_sys_ioctl(bpfd, BIOCGBLEN, &blen));
+ ATF_REQUIRE_EQ(blen, 100);
+
+ RL(rump_sys_ioctl(bpfd, BIOCSETIF, &ifr));
+
+ ATF_REQUIRE_EQ_MSG(rump_sys_ioctl(bpfd, BIOCSBLEN, &blen), -1,
+ "Don't allow to change buflen after binding bpf to an interface");
+}
+
ATF_TP_ADD_TCS(tp)
{
@@ -173,5 +206,6 @@ ATF_TP_ADD_TCS(tp)
#if (SIZE_MAX > UINT_MAX)
ATF_TP_ADD_TC(tp, bpfwritetrunc);
#endif
+ ATF_TP_ADD_TC(tp, bpf_ioctl_BLEN);
return atf_no_error();
}
diff --git a/contrib/netbsd-tests/net/bpf/t_mbuf.c b/contrib/netbsd-tests/net/bpf/t_mbuf.c
index 965dd02..2076dc2 100644
--- a/contrib/netbsd-tests/net/bpf/t_mbuf.c
+++ b/contrib/netbsd-tests/net/bpf/t_mbuf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $ */
+/* $NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2014 Alexander Nasonov.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $");
+__RCSID("$NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static bool
test_ldb_abs(size_t split)
diff --git a/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c b/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c
index 460b43e..15a9ab6 100644
--- a/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c
+++ b/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $ */
+/* $NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -25,7 +25,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $");
+__RCSID("$NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -53,7 +53,7 @@ __RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../config/netconfig.c"
diff --git a/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c b/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c
index 58db1e0..06c3d97 100644
--- a/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c
+++ b/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $ */
+/* $NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2011-2012, 2014-2015 Alexander Nasonov.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $");
+__RCSID("$NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static uint8_t deadbeef_at_5[16] = {
diff --git a/contrib/netbsd-tests/net/bpfjit/t_cop.c b/contrib/netbsd-tests/net/bpfjit/t_cop.c
index 5a007e6..502c588 100644
--- a/contrib/netbsd-tests/net/bpfjit/t_cop.c
+++ b/contrib/netbsd-tests/net/bpfjit/t_cop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $ */
+/* $NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2014 Alexander Nasonov.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $");
+__RCSID("$NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $");
#include <stdint.h>
#include <string.h>
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static uint32_t retA(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
static uint32_t retBL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
diff --git a/contrib/netbsd-tests/net/bpfjit/t_extmem.c b/contrib/netbsd-tests/net/bpfjit/t_extmem.c
index 915c436..51761ec 100644
--- a/contrib/netbsd-tests/net/bpfjit/t_extmem.c
+++ b/contrib/netbsd-tests/net/bpfjit/t_extmem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $ */
+/* $NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2014 Alexander Nasonov.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $");
+__RCSID("$NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $");
#include <stdint.h>
#include <string.h>
@@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static uint32_t retM(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A);
diff --git a/contrib/netbsd-tests/net/bpfjit/t_mbuf.c b/contrib/netbsd-tests/net/bpfjit/t_mbuf.c
index 489ef80..d3a2b99 100644
--- a/contrib/netbsd-tests/net/bpfjit/t_mbuf.c
+++ b/contrib/netbsd-tests/net/bpfjit/t_mbuf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $ */
+/* $NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2014 Alexander Nasonov.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $");
+__RCSID("$NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $");
#undef m_data
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
static bool
test_ldb_abs(size_t split)
diff --git a/contrib/netbsd-tests/net/carp/t_basic.c b/contrib/netbsd-tests/net/carp/t_basic.c
deleted file mode 100644
index fe2e6b5..0000000
--- a/contrib/netbsd-tests/net/carp/t_basic.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* $NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $ */
-
-/*-
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
- * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__RCSID("$NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $");
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip_carp.h>
-
-#include <rump/rump.h>
-#include <rump/rump_syscalls.h>
-
-#include <atf-c.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "../config/netconfig.c"
-#include "../../h_macros.h"
-
-static bool oknow = false;
-
-static void
-sighnd(int sig)
-{
-
- ATF_REQUIRE_EQ(sig, SIGCHLD);
- if (oknow)
- return;
-
- atf_tc_fail("child died unexpectedly");
-}
-
-ATF_TC(handover);
-ATF_TC_HEAD(handover, tc)
-{
-
- atf_tc_set_md_var(tc, "descr", "check that carp handover works if "
- "the master dies");
-}
-
-#define THEBUS "buuuuuuus,etherbus"
-
-static void
-child(bool master)
-{
- char ifname[IFNAMSIZ];
- struct carpreq cr;
- struct ifreq ifr;
- const char *carpif;
- int s;
-
- /* helps reading carp debug output */
- if (master)
- carpif = "carp0";
- else
- carpif = "carp1";
-
- /*
- * Should use sysctl, bug debug is dabug.
- */
- {
- //extern int rumpns_carp_opts[]; /* XXX */
- //rumpns_carp_opts[CARPCTL_LOG] = 1;
- }
-
-
- rump_init();
-
- memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, carpif, sizeof(ifr.ifr_name));
-
- RL(s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0));
- RL(rump_sys_ioctl(s, SIOCIFCREATE, &ifr));
-
- netcfg_rump_makeshmif(THEBUS, ifname);
-
- if (master)
- netcfg_rump_if(ifname, "10.1.1.1", "255.255.255.0");
- else
- netcfg_rump_if(ifname, "10.1.1.2", "255.255.255.0");
-
- /* configure the carp interface */
- ifr.ifr_data = &cr;
- RL(rump_sys_ioctl(s, SIOCGVH, &ifr));
-
- strlcpy(cr.carpr_carpdev, ifname, sizeof(cr.carpr_carpdev));
- cr.carpr_vhid = 175;
- if (master)
- cr.carpr_advskew = 0;
- else
- cr.carpr_advskew = 200;
- cr.carpr_advbase = 1;
- strcpy((char *)cr.carpr_key, "s3cret");
-
- RL(rump_sys_ioctl(s, SIOCSVH, &ifr));
- netcfg_rump_if(carpif, "10.1.1.100", "255.255.255.0");
-
- /* tassa pause()en enka muuta voi */
- pause();
-}
-
-ATF_TC_BODY(handover, tc)
-{
- char ifname[IFNAMSIZ];
- pid_t mpid, cpid;
- int i, status;
-
- signal(SIGCHLD, sighnd);
-
- /* fork master */
- switch (mpid = fork()) {
- case -1:
- atf_tc_fail_errno("fork failed");
- /*NOTREACHED*/
- case 0:
- child(true);
- /*NOTREACHED*/
- default:
- break;
- }
-
- usleep(500000);
-
- /* fork backup */
- switch (cpid = fork()) {
- case -1:
- kill(mpid, SIGKILL);
- atf_tc_fail_errno("fork failed");
- /*NOTREACHED*/
- case 0:
- child(false);
- /*NOTREACHED*/
- default:
- break;
- }
-
- usleep(500000);
-
- rump_init();
- netcfg_rump_makeshmif(THEBUS, ifname);
- netcfg_rump_if(ifname, "10.1.1.240", "255.255.255.0");
-
- /* check that the primary addresses are up */
- ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.1", 1000), true);
- ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.2", 1000), true);
-
- /* give carp a while to croak */
- sleep(4);
-
- /* check that the shared IP works */
- ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.100", 500), true);
-
- /* KILLING SPREE */
- oknow = true;
- kill(mpid, SIGKILL);
- wait(&status);
- usleep(10000); /* just in case */
- oknow = false;
-
- /* check that primary is now dead */
- ATF_REQUIRE_EQ(netcfg_rump_pingtest("10.1.1.1", 100), false);
-
- /* do it in installments. carp will cluck meanwhile */
- for (i = 0; i < 5; i++) {
- if (netcfg_rump_pingtest("10.1.1.100", 1000) == true)
- break;
- }
- if (i == 5)
- atf_tc_fail("failed to failover");
-
- /* to kill the child */
- oknow = true;
- kill(cpid, SIGKILL);
-
- /* clean & done */
-}
-
-ATF_TP_ADD_TCS(tp)
-{
-
- ATF_TP_ADD_TC(tp, handover);
-
- return atf_no_error();
-}
diff --git a/contrib/netbsd-tests/net/carp/t_basic.sh b/contrib/netbsd-tests/net/carp/t_basic.sh
new file mode 100755
index 0000000..94ada1c
--- /dev/null
+++ b/contrib/netbsd-tests/net/carp/t_basic.sh
@@ -0,0 +1,165 @@
+# $NetBSD: t_basic.sh,v 1.1 2017/01/16 08:18:11 ozaki-r Exp $
+#
+# Copyright (c) 2017 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+SOCK_CLIENT=unix://carp_client
+SOCK_MASTER=unix://carp_master
+SOCK_BACKUP=unix://carp_backup
+BUS=bus_carp
+IP_CLIENT=10.1.1.240
+IP_MASTER=10.1.1.1
+IP_BACKUP=10.1.1.2
+IP_CARP=10.1.1.100
+TIMEOUT=3
+
+atf_test_case carp_handover cleanup
+
+carp_handover_head()
+{
+
+ atf_set "descr" "Tests for CARP handover"
+ atf_set "require.progs" "rump_server"
+}
+
+setup_carp()
+{
+ local sock=$1
+ local master=$2
+ local carpif= ip= advskew=
+
+ if $master; then
+ carpif=carp0
+ ip=$IP_MASTER
+ advskew=0
+ else
+ carpif=carp1
+ ip=$IP_BACKUP
+ advskew=200
+ fi
+
+ export RUMP_SERVER=$sock
+ atf_check -s exit:0 rump.ifconfig $carpif create
+ atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
+ atf_check -s exit:0 rump.ifconfig $carpif \
+ vhid 175 advskew $advskew advbase 1 pass s3cret \
+ $IP_CARP netmask 255.255.255.0
+ atf_check -s exit:0 rump.ifconfig -w 10
+}
+
+wait_handover()
+{
+ local i=0
+
+ export RUMP_SERVER=$SOCK_CLIENT
+
+ while [ $i -ne 5 ]; do
+ $DEBUG && echo "Trying ping $IP_CARP"
+ rump.ping -n -w 1 -c 1 $IP_CARP >/dev/null
+ if [ $? = 0 ]; then
+ $DEBUG && echo "Passed ping $IP_CARP"
+ break;
+ fi
+ $DEBUG && echo "Failed ping $IP_CARP"
+ i=$((i + 1))
+ done
+
+ if [ $i -eq 5 ]; then
+ atf_fail "Failed to failover (5 sec)"
+ fi
+}
+
+carp_handover_body()
+{
+
+ rump_server_start $SOCK_CLIENT
+ rump_server_start $SOCK_MASTER
+ rump_server_start $SOCK_BACKUP
+
+ rump_server_add_iface $SOCK_CLIENT shmif0 $BUS
+ rump_server_add_iface $SOCK_MASTER shmif0 $BUS
+ rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
+
+ setup_carp $SOCK_MASTER true
+ setup_carp $SOCK_BACKUP false
+
+ export RUMP_SERVER=$SOCK_CLIENT
+ atf_check -s exit:0 rump.ifconfig shmif0 $IP_CLIENT/24 up
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ # Check that the primary addresses are up
+ atf_check -s exit:0 -o ignore \
+ rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+ atf_check -s exit:0 -o ignore \
+ rump.ping -n -w $TIMEOUT -c 1 $IP_BACKUP
+
+ # Give carp a while to croak
+ sleep 4
+
+ # Check state
+ export RUMP_SERVER=$SOCK_MASTER
+ $DEBUG && rump.ifconfig
+ atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
+ rump.ifconfig carp0
+ export RUMP_SERVER=$SOCK_BACKUP
+ $DEBUG && rump.ifconfig
+ atf_check -s exit:0 -o match:'carp: BACKUP carpdev shmif0' \
+ rump.ifconfig carp1
+ export RUMP_SERVER=$SOCK_CLIENT
+
+ # Check that the shared IP works
+ atf_check -s exit:0 -o ignore \
+ rump.ping -n -w $TIMEOUT -c 1 $IP_CARP
+
+ # KILLING SPREE
+ env RUMP_SERVER=$SOCK_MASTER rump.halt
+ sleep 1
+
+ # Check that primary is now dead
+ atf_check -s not-exit:0 -o ignore \
+ rump.ping -n -w $TIMEOUT -c 1 $IP_MASTER
+
+ # Do it in installments. carp will cluck meanwhile
+ wait_handover
+
+ # Check state
+ export RUMP_SERVER=$SOCK_BACKUP
+ $DEBUG && rump.ifconfig
+ atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
+ rump.ifconfig carp1
+}
+
+carp_handover_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case carp_handover
+}
diff --git a/contrib/netbsd-tests/net/config/netconfig.c b/contrib/netbsd-tests/net/config/netconfig.c
index c2f9dd4..6fe37cc 100644
--- a/contrib/netbsd-tests/net/config/netconfig.c
+++ b/contrib/netbsd-tests/net/config/netconfig.c
@@ -1,4 +1,4 @@
-/* $NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $ */
+/* $NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $");
+__RCSID("$NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -53,7 +53,7 @@ __RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
int noatf;
diff --git a/contrib/netbsd-tests/net/icmp/t_forward.c b/contrib/netbsd-tests/net/icmp/t_forward.c
index d418027..346614c 100644
--- a/contrib/netbsd-tests/net/icmp/t_forward.c
+++ b/contrib/netbsd-tests/net/icmp/t_forward.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $ */
+/* $NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $");
+__RCSID("$NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -57,7 +57,7 @@ __RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $");
#include <string.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../config/netconfig.c"
/*
diff --git a/contrib/netbsd-tests/net/icmp/t_ping.c b/contrib/netbsd-tests/net/icmp/t_ping.c
index 68a00c7..b3327e1 100644
--- a/contrib/netbsd-tests/net/icmp/t_ping.c
+++ b/contrib/netbsd-tests/net/icmp/t_ping.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $ */
+/* $NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -52,7 +52,7 @@ __RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $");
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../config/netconfig.c"
ATF_TC(simpleping);
diff --git a/contrib/netbsd-tests/net/if/t_ifconfig.sh b/contrib/netbsd-tests/net/if/t_ifconfig.sh
index a610017..21c877c 100755
--- a/contrib/netbsd-tests/net/if/t_ifconfig.sh
+++ b/contrib/netbsd-tests/net/if/t_ifconfig.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.14 2016/10/01 22:15:04 kre Exp $
+# $NetBSD: t_ifconfig.sh,v 1.15 2017/01/20 08:35:33 ozaki-r Exp $
#
# Copyright (c) 2015 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -181,7 +181,7 @@ ifconfig_options_body()
# ifconfig -C
# -C shows all of the interface cloners available on the system
- atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C
+ atf_check -s exit:0 -o match:'shmif carp lo' rump.ifconfig -C
unset RUMP_SERVER
}
diff --git a/contrib/netbsd-tests/net/if_loop/t_pr.c b/contrib/netbsd-tests/net/if_loop/t_pr.c
index a22953f..ee4f684 100644
--- a/contrib/netbsd-tests/net/if_loop/t_pr.c
+++ b/contrib/netbsd-tests/net/if_loop/t_pr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $ */
+/* $NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $");
+__RCSID("$NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $");
#include <unistd.h>
#include "../config/netconfig.c"
-#include "../../h_macros.h"
+#include "h_macros.h"
/*
* Prepare rump, configure interface and route to cause fragmentation
diff --git a/contrib/netbsd-tests/net/if_tun/t_tun.sh b/contrib/netbsd-tests/net/if_tun/t_tun.sh
new file mode 100755
index 0000000..87df39a
--- /dev/null
+++ b/contrib/netbsd-tests/net/if_tun/t_tun.sh
@@ -0,0 +1,138 @@
+# $NetBSD: t_tun.sh,v 1.4 2016/11/07 05:25:37 ozaki-r Exp $
+#
+# Copyright (c) 2016 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6"
+RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tun -lrumpdev"
+
+BUS=bus
+SOCK_LOCAL=unix://commsock1
+SOCK_REMOTE=unix://commsock2
+IP_LOCAL=10.0.0.1
+IP_REMOTE=10.0.0.2
+
+DEBUG=${DEBUG:-true}
+
+atf_test_case tun_create_destroy cleanup
+tun_create_destroy_head()
+{
+
+ atf_set "descr" "tests of creation and deletion of tun interface"
+ atf_set "require.progs" "rump_server"
+}
+
+tun_create_destroy_body()
+{
+
+ atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL}
+
+ export RUMP_SERVER=${SOCK_LOCAL}
+
+ atf_check -s exit:0 rump.ifconfig tun0 create
+ atf_check -s exit:0 rump.ifconfig tun0 up
+ atf_check -s exit:0 rump.ifconfig tun0 down
+ atf_check -s exit:0 rump.ifconfig tun0 destroy
+}
+
+tun_create_destroy_cleanup()
+{
+
+ RUMP_SERVER=${SOCK_LOCAL} rump.halt
+}
+
+atf_test_case tun_setup cleanup
+tun_setup_head()
+{
+
+ atf_set "descr" "tests of setting up a tunnel"
+ atf_set "require.progs" "rump_server"
+}
+
+check_route_entry()
+{
+ local ip=$(echo $1 |sed 's/\./\\./g')
+ local gw=$2
+ local flags=$3
+ local iface=$4
+
+ atf_check -s exit:0 -o match:" $flags " -e ignore -x \
+ "rump.netstat -rn -f inet | grep ^'$ip'"
+ atf_check -s exit:0 -o match:" $gw " -e ignore -x \
+ "rump.netstat -rn -f inet | grep ^'$ip'"
+ atf_check -s exit:0 -o match:" $iface" -e ignore -x \
+ "rump.netstat -rn -f inet | grep ^'$ip'"
+}
+
+tun_setup_body()
+{
+
+ atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL}
+ atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE}
+
+ export RUMP_SERVER=${SOCK_LOCAL}
+
+ atf_check -s exit:0 rump.ifconfig shmif0 create
+ atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS
+ atf_check -s exit:0 rump.ifconfig shmif0 ${IP_LOCAL}/24 up
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ export RUMP_SERVER=${SOCK_REMOTE}
+
+ atf_check -s exit:0 rump.ifconfig shmif0 create
+ atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS
+ atf_check -s exit:0 rump.ifconfig shmif0 ${IP_REMOTE}/24 up
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ export RUMP_SERVER=${SOCK_LOCAL}
+ atf_check -s exit:0 rump.ifconfig tun0 create
+ atf_check -s exit:0 rump.ifconfig tun0 ${IP_LOCAL} ${IP_REMOTE} up
+ atf_check -s exit:0 \
+ -o match:"inet ${IP_LOCAL}/32 -> ${IP_REMOTE}" rump.ifconfig tun0
+ $DEBUG && rump.netstat -nr -f inet
+ check_route_entry ${IP_REMOTE} ${IP_LOCAL} UH tun0
+
+ export RUMP_SERVER=${SOCK_REMOTE}
+ atf_check -s exit:0 rump.ifconfig tun0 create
+ atf_check -s exit:0 rump.ifconfig tun0 ${IP_REMOTE} ${IP_LOCAL} up
+ atf_check -s exit:0 \
+ -o match:"inet ${IP_REMOTE}/32 -> ${IP_LOCAL}" rump.ifconfig tun0
+ $DEBUG && rump.netstat -nr -f inet
+ check_route_entry ${IP_LOCAL} ${IP_REMOTE} UH tun0
+}
+
+tun_setup_cleanup()
+{
+
+ RUMP_SERVER=${SOCK_LOCAL} rump.halt
+ RUMP_SERVER=${SOCK_REMOTE} rump.halt
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case tun_create_destroy
+ atf_add_test_case tun_setup
+}
diff --git a/contrib/netbsd-tests/net/if_vlan/t_vlan.sh b/contrib/netbsd-tests/net/if_vlan/t_vlan.sh
new file mode 100755
index 0000000..a6902fb1
--- /dev/null
+++ b/contrib/netbsd-tests/net/if_vlan/t_vlan.sh
@@ -0,0 +1,115 @@
+# $NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $
+#
+# Copyright (c) 2016 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+BUS=bus
+SOCK_LOCAL=unix://commsock1
+SOCK_REMOTE=unix://commsock2
+IP_LOCAL=10.0.0.1
+IP_REMOTE=10.0.0.2
+
+DEBUG=${DEBUG:-false}
+
+atf_test_case vlan_create_destroy cleanup
+vlan_create_destroy_head()
+{
+
+ atf_set "descr" "tests of creation and deletion of vlan interface"
+ atf_set "require.progs" "rump_server"
+}
+
+vlan_create_destroy_body()
+{
+
+ rump_server_start $SOCK_LOCAL vlan
+
+ export RUMP_SERVER=${SOCK_LOCAL}
+
+ atf_check -s exit:0 rump.ifconfig vlan0 create
+ atf_check -s exit:0 rump.ifconfig vlan0 up
+ atf_check -s exit:0 rump.ifconfig vlan0 down
+ atf_check -s exit:0 rump.ifconfig vlan0 destroy
+}
+
+vlan_create_destroy_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_test_case vlan_basic cleanup
+vlan_basic_head()
+{
+
+ atf_set "descr" "tests of communications over vlan interfaces"
+ atf_set "require.progs" "rump_server"
+}
+
+vlan_basic_body()
+{
+
+ rump_server_start $SOCK_LOCAL vlan
+ rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
+ rump_server_start $SOCK_REMOTE vlan
+ rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
+
+ export RUMP_SERVER=$SOCK_LOCAL
+ atf_check -s exit:0 rump.ifconfig shmif0 up
+ export RUMP_SERVER=$SOCK_REMOTE
+ atf_check -s exit:0 rump.ifconfig shmif0 up
+
+ export RUMP_SERVER=$SOCK_LOCAL
+ atf_check -s exit:0 rump.ifconfig vlan0 create
+ atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+ atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24
+ atf_check -s exit:0 rump.ifconfig vlan0 up
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ export RUMP_SERVER=$SOCK_REMOTE
+ atf_check -s exit:0 rump.ifconfig vlan0 create
+ atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+ atf_check -s exit:0 rump.ifconfig vlan0 $IP_REMOTE/24
+ atf_check -s exit:0 rump.ifconfig vlan0 up
+ atf_check -s exit:0 rump.ifconfig -w 10
+
+ export RUMP_SERVER=$SOCK_LOCAL
+ atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE
+}
+
+vlan_basic_cleanup()
+{
+
+ $DEBUG && dump
+ cleanup
+}
+
+atf_init_test_cases()
+{
+
+ atf_add_test_case vlan_create_destroy
+ atf_add_test_case vlan_basic
+}
diff --git a/contrib/netbsd-tests/net/ndp/t_ra.sh b/contrib/netbsd-tests/net/ndp/t_ra.sh
index b234570..69f227a 100755
--- a/contrib/netbsd-tests/net/ndp/t_ra.sh
+++ b/contrib/netbsd-tests/net/ndp/t_ra.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $
+# $NetBSD: t_ra.sh,v 1.24 2017/01/13 08:11:01 ozaki-r Exp $
#
# Copyright (c) 2015 Internet Initiative Japan Inc.
# All rights reserved.
@@ -127,7 +127,8 @@ check_entries()
-o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \
rump.ndp -n -a
atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a
- atf_check -s exit:0 -o match:"$addr_prefix.+<AUTOCONF>" \
+ atf_check -s exit:0 \
+ -o match:"$addr_prefix.+<(TENTATIVE,)?AUTOCONF>" \
rump.ifconfig shmif0 inet6
unset RUMP_SERVER
}
@@ -603,60 +604,75 @@ ra_temporary_address_head()
atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig"
}
+check_echo_request_pkt()
+{
+ local pkt="$2 > $3: .+ echo request"
+
+ extract_new_packets $1 > ./out
+ $DEBUG && echo $pkt
+ $DEBUG && cat ./out
+ atf_check -s exit:0 -o match:"$pkt" cat ./out
+}
+
ra_temporary_address_body()
{
+ local ip_auto= ip_temp=
rump_server_fs_start $RUMPSRV netinet6
rump_server_start $RUMPCLI netinet6
- setup_shmif0 ${RUMPSRV} ${IP6SRV}
+ setup_shmif0 $RUMPSRV $IP6SRV
init_server $RUMPSRV
+ setup_shmif0 $RUMPCLI $IP6CLI
- setup_shmif0 ${RUMPCLI} ${IP6CLI}
- export RUMP_SERVER=${RUMPCLI}
- $DEBUG && rump.ndp -n -a
- atf_check -s exit:0 -o match:'= 0' \
- rump.sysctl net.inet6.ip6.accept_rtadv
- atf_check -s exit:0 -o match:'= 0' \
- rump.sysctl net.inet6.ip6.use_tempaddr
- unset RUMP_SERVER
-
- create_rtadvdconfig
- start_rtadvd $RUMPSRV $PIDFILE
- sleep $WAITTIME
-
- export RUMP_SERVER=${RUMPCLI}
- atf_check -s exit:0 -o empty rump.ndp -r
- atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p
- atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0
- atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a
- atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a
- atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
- unset RUMP_SERVER
-
- atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
- wait_term ${PIDFILE}
-
- export RUMP_SERVER=${RUMPCLI}
+ export RUMP_SERVER=$RUMPCLI
atf_check -s exit:0 -o match:'0.->.1' \
rump.sysctl -w net.inet6.ip6.accept_rtadv=1
atf_check -s exit:0 -o match:'0.->.1' \
rump.sysctl -w net.inet6.ip6.use_tempaddr=1
unset RUMP_SERVER
+ create_rtadvdconfig
start_rtadvd $RUMPSRV $PIDFILE
sleep $WAITTIME
check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
+ export RUMP_SERVER=$RUMPCLI
+
# Check temporary address
- export RUMP_SERVER=${RUMPCLI}
- atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+<AUTOCONF,TEMPORARY>" \
+ atf_check -s exit:0 \
+ -o match:"$IP6SRV_PREFIX.+<(TENTATIVE,)?AUTOCONF,TEMPORARY>" \
rump.ifconfig shmif0 inet6
+
+ #
+ # Testing net.inet6.ip6.prefer_tempaddr
+ #
+ atf_check -s exit:0 rump.ifconfig -w 10
+ $DEBUG && rump.ifconfig shmif0
+ ip_auto=$(rump.ifconfig shmif0 |awk '/<AUTOCONF>/ {sub(/\/[0-9]*/, ""); print $2;}')
+ ip_temp=$(rump.ifconfig shmif0 |awk '/<AUTOCONF,TEMPORARY>/ {sub(/\/[0-9]*/, ""); print $2;}')
+ $DEBUG && echo $ip_auto $ip_temp
+
+ # Ignore old packets
+ extract_new_packets bus1 > /dev/null
+
+ atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV
+ # autoconf (non-temporal) address should be used as the source address
+ check_echo_request_pkt bus1 $ip_auto $IP6SRV
+
+ # Enable net.inet6.ip6.prefer_tempaddr
+ atf_check -s exit:0 -o match:'0.->.1' \
+ rump.sysctl -w net.inet6.ip6.prefer_tempaddr=1
+
+ atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV
+ # autoconf, temporal address should be used as the source address
+ check_echo_request_pkt bus1 $ip_temp $IP6SRV
+
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
- wait_term ${PIDFILE}
+ wait_term $PIDFILE
rump_server_destroy_ifaces
}
diff --git a/contrib/netbsd-tests/net/net/t_raw.c b/contrib/netbsd-tests/net/net/t_raw.c
index ef3262d..5c483a1 100644
--- a/contrib/netbsd-tests/net/net/t_raw.c
+++ b/contrib/netbsd-tests/net/net/t_raw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_raw.c,v 1.1 2011/01/11 10:51:45 pooka Exp $ */
+/* $NetBSD: t_raw.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */
#include <sys/socket.h>
#include <sys/stat.h>
@@ -12,7 +12,7 @@
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(PRU_SENSE);
ATF_TC_HEAD(PRU_SENSE, tc)
diff --git a/contrib/netbsd-tests/rump/modautoload/t_modautoload.c b/contrib/netbsd-tests/rump/modautoload/t_modautoload.c
index 2c21a90..b45dae5 100644
--- a/contrib/netbsd-tests/rump/modautoload/t_modautoload.c
+++ b/contrib/netbsd-tests/rump/modautoload/t_modautoload.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_modautoload.c,v 1.5 2016/09/14 03:19:11 ozaki-r Exp $ */
+/* $NetBSD: t_modautoload.c,v 1.6 2017/01/13 21:30:42 christos Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -20,7 +20,7 @@
#include <miscfs/kernfs/kernfs.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(modautoload);
ATF_TC_HEAD(modautoload, tc)
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_kern.c b/contrib/netbsd-tests/rump/rumpkern/t_kern.c
index fcaf1f8..15b2586 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_kern.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_kern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_kern.c,v 1.3 2012/01/30 13:05:52 njoly Exp $ */
+/* $NetBSD: t_kern.c,v 1.4 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../kernspace/kernspace.h"
#define LOCKFUN(_name_, _descr_,_needld_, _expect_) \
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c b/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c
index 6e78d02..f319979 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_lwproc.c,v 1.8 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_lwproc.c,v 1.9 2017/01/13 21:30:43 christos Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
#include <unistd.h>
#include <util.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(makelwp);
ATF_TC_HEAD(makelwp, tc)
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_modcmd.c b/contrib/netbsd-tests/rump/rumpkern/t_modcmd.c
index 032e312..e48bcb5 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_modcmd.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_modcmd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_modcmd.c,v 1.9 2010/05/31 23:51:28 pooka Exp $ */
+/* $NetBSD: t_modcmd.c,v 1.10 2017/01/13 21:30:43 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
#include <unistd.h>
#include <util.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
/*
* We verify that modules can be loaded and unloaded.
* tmpfs was chosen because it does not depend on an image.
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c b/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c
index a4d34bb..7d725dc 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_modlinkset.c,v 1.2 2009/11/06 15:26:54 pooka Exp $ */
+/* $NetBSD: t_modlinkset.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <errno.h>
#include <string.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(modlinkset);
ATF_TC_HEAD(modlinkset, tc)
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_signals.c b/contrib/netbsd-tests/rump/rumpkern/t_signals.c
index e113af2..ba0c0ea 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_signals.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_signals.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_signals.c,v 1.2 2011/02/20 19:45:45 pooka Exp $ */
+/* $NetBSD: t_signals.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <rump/rump.h>
#include "../kernspace/kernspace.h"
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(sigraise);
ATF_TC_HEAD(sigraise, tc)
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_threads.c b/contrib/netbsd-tests/rump/rumpkern/t_threads.c
index 24155ec..2931fa6 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_threads.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_threads.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_threads.c,v 1.1 2010/05/31 23:36:12 pooka Exp $ */
+/* $NetBSD: t_threads.c,v 1.2 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../kernspace/kernspace.h"
ATF_TC(threadjoin);
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_tsleep.c b/contrib/netbsd-tests/rump/rumpkern/t_tsleep.c
index efd9f4c..126a89d 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_tsleep.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_tsleep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tsleep.c,v 1.1 2010/05/31 23:36:12 pooka Exp $ */
+/* $NetBSD: t_tsleep.c,v 1.2 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <atf-c.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../kernspace/kernspace.h"
ATF_TC(tsleep);
diff --git a/contrib/netbsd-tests/rump/rumpkern/t_vm.c b/contrib/netbsd-tests/rump/rumpkern/t_vm.c
index 4445983..ddb005c 100644
--- a/contrib/netbsd-tests/rump/rumpkern/t_vm.c
+++ b/contrib/netbsd-tests/rump/rumpkern/t_vm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vm.c,v 1.3 2012/03/17 18:00:28 hannken Exp $ */
+/* $NetBSD: t_vm.c,v 1.4 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
#include "../kernspace/kernspace.h"
ATF_TC(busypage);
diff --git a/contrib/netbsd-tests/rump/rumpvfs/t_basic.c b/contrib/netbsd-tests/rump/rumpvfs/t_basic.c
index c136558..278d99e 100644
--- a/contrib/netbsd-tests/rump/rumpvfs/t_basic.c
+++ b/contrib/netbsd-tests/rump/rumpvfs/t_basic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_basic.c,v 1.2 2011/02/22 13:25:18 pooka Exp $ */
+/* $NetBSD: t_basic.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(lseekrv);
ATF_TC_HEAD(lseekrv, tc)
diff --git a/contrib/netbsd-tests/rump/rumpvfs/t_etfs.c b/contrib/netbsd-tests/rump/rumpvfs/t_etfs.c
index 787f5e6..5935bea 100644
--- a/contrib/netbsd-tests/rump/rumpvfs/t_etfs.c
+++ b/contrib/netbsd-tests/rump/rumpvfs/t_etfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_etfs.c,v 1.10 2014/05/12 15:33:12 christos Exp $ */
+/* $NetBSD: t_etfs.c,v 1.11 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(reregister_reg);
ATF_TC_HEAD(reregister_reg, tc)
diff --git a/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c b/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c
index c94e5e1..ec2423c 100644
--- a/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c
+++ b/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_p2kifs.c,v 1.5 2016/01/25 11:45:57 pooka Exp $ */
+/* $NetBSD: t_p2kifs.c,v 1.6 2017/01/13 21:30:43 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "../../h_macros.h"
+#include "h_macros.h"
ATF_TC(makecn);
ATF_TC_HEAD(makecn, tc)
diff --git a/contrib/netbsd-tests/sys/uvm/t_uvm_physseg.c b/contrib/netbsd-tests/sys/uvm/t_uvm_physseg.c
new file mode 100644
index 0000000..a5f2fa9
--- /dev/null
+++ b/contrib/netbsd-tests/sys/uvm/t_uvm_physseg.c
@@ -0,0 +1,2377 @@
+/* $NetBSD: t_uvm_physseg.c,v 1.2 2016/12/22 08:15:20 cherry Exp $ */
+
+/*-
+ * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Santhosh N. Raju <santhosh.raju@gmail.com> and
+ * by Cherry G. Mathew
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_uvm_physseg.c,v 1.2 2016/12/22 08:15:20 cherry Exp $");
+
+/*
+ * If this line is commented out tests related to uvm_physseg_get_pmseg()
+ * wont run.
+ *
+ * Have a look at machine/uvm_physseg.h for more details.
+ */
+#define __HAVE_PMAP_PHYSSEG
+
+/*
+ * This is a dummy struct used for testing purposes
+ *
+ * In reality this struct would exist in the MD part of the code residing in
+ * machines/vmparam.h
+ */
+
+#ifdef __HAVE_PMAP_PHYSSEG
+struct pmap_physseg {
+ int dummy_variable; /* Dummy variable use for testing */
+};
+#endif
+
+/* Testing API - assumes userland */
+/* Provide Kernel API equivalents */
+#include <assert.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <string.h> /* memset(3) et. al */
+#include <stdio.h> /* printf(3) */
+#include <stdlib.h> /* malloc(3) */
+#include <stdarg.h>
+#include <stddef.h>
+
+#define PRIxPADDR "lx"
+#define PRIxPSIZE "lx"
+#define PRIuPSIZE "lu"
+#define PRIxVADDR "lx"
+#define PRIxVSIZE "lx"
+#define PRIuVSIZE "lu"
+
+#define UVM_HOTPLUG /* Enable hotplug with rbtree. */
+#define PMAP_STEAL_MEMORY
+#define DEBUG /* Enable debug functionality. */
+
+typedef unsigned long vaddr_t;
+typedef unsigned long paddr_t;
+typedef unsigned long psize_t;
+typedef unsigned long vsize_t;
+
+#include <uvm/uvm_physseg.h>
+#include <uvm/uvm_page.h>
+
+#ifndef DIAGNOSTIC
+#define KASSERTMSG(e, msg, ...) /* NOTHING */
+#define KASSERT(e) /* NOTHING */
+#else
+#define KASSERT(a) assert(a)
+#define KASSERTMSG(exp, ...) printf(__VA_ARGS__); assert((exp))
+#endif
+
+#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
+
+#define VM_NFREELIST 4
+#define VM_FREELIST_DEFAULT 0
+#define VM_FREELIST_FIRST16 3
+#define VM_FREELIST_FIRST1G 2
+#define VM_FREELIST_FIRST4G 1
+
+/*
+ * Used in tests when Array implementation is tested
+ */
+#if !defined(VM_PHYSSEG_MAX)
+#define VM_PHYSSEG_MAX 1
+#endif
+
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (PAGE_SIZE - 1)
+#define atop(x) (((paddr_t)(x)) >> PAGE_SHIFT)
+#define ptoa(x) (((paddr_t)(x)) << PAGE_SHIFT)
+
+#define mutex_enter(l)
+#define mutex_exit(l)
+
+psize_t physmem;
+
+struct uvmexp uvmexp; /* decl */
+
+/*
+ * uvm structure borrowed from uvm.h
+ *
+ * Remember this is a dummy structure used within the ATF Tests and
+ * uses only necessary fields from the original uvm struct.
+ * See uvm/uvm.h for the full struct.
+ */
+
+struct uvm {
+ /* vm_page related parameters */
+
+ bool page_init_done; /* TRUE if uvm_page_init() finished */
+} uvm;
+
+#include <sys/kmem.h>
+
+void *
+kmem_alloc(size_t size, km_flag_t flags)
+{
+ return malloc(size);
+}
+
+void *
+kmem_zalloc(size_t size, km_flag_t flags)
+{
+ void *ptr;
+ ptr = malloc(size);
+
+ memset(ptr, 0, size);
+
+ return ptr;
+}
+
+void
+kmem_free(void *mem, size_t size)
+{
+ free(mem);
+}
+
+static void
+panic(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ printf("\n");
+ va_end(ap);
+ KASSERT(false);
+
+ /*NOTREACHED*/
+}
+
+static void
+uvm_pagefree(struct vm_page *pg)
+{
+ return;
+}
+
+#if defined(UVM_HOTPLUG)
+static void
+uvmpdpol_reinit(void)
+{
+ return;
+}
+#endif /* UVM_HOTPLUG */
+
+/* end - Provide Kernel API equivalents */
+
+
+#include "uvm/uvm_physseg.c"
+
+#include <atf-c.h>
+
+#define SIXTYFOUR_KILO (64 * 1024)
+#define ONETWENTYEIGHT_KILO (128 * 1024)
+#define TWOFIFTYSIX_KILO (256 * 1024)
+#define FIVEONETWO_KILO (512 * 1024)
+#define ONE_MEGABYTE (1024 * 1024)
+#define TWO_MEGABYTE (2 * 1024 * 1024)
+
+/* Sample Page Frame Numbers */
+#define VALID_START_PFN_1 atop(0)
+#define VALID_END_PFN_1 atop(ONE_MEGABYTE)
+#define VALID_AVAIL_START_PFN_1 atop(0)
+#define VALID_AVAIL_END_PFN_1 atop(ONE_MEGABYTE)
+
+#define VALID_START_PFN_2 atop(ONE_MEGABYTE + 1)
+#define VALID_END_PFN_2 atop(ONE_MEGABYTE * 2)
+#define VALID_AVAIL_START_PFN_2 atop(ONE_MEGABYTE + 1)
+#define VALID_AVAIL_END_PFN_2 atop(ONE_MEGABYTE * 2)
+
+#define VALID_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1)
+#define VALID_END_PFN_3 atop(ONE_MEGABYTE * 3)
+#define VALID_AVAIL_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1)
+#define VALID_AVAIL_END_PFN_3 atop(ONE_MEGABYTE * 3)
+
+#define VALID_START_PFN_4 atop((ONE_MEGABYTE * 3) + 1)
+#define VALID_END_PFN_4 atop(ONE_MEGABYTE * 4)
+#define VALID_AVAIL_START_PFN_4 atop((ONE_MEGABYTE * 3) + 1)
+#define VALID_AVAIL_END_PFN_4 atop(ONE_MEGABYTE * 4)
+
+/*
+ * Total number of pages (of 4K size each) should be 256 for 1MB of memory.
+ */
+#define PAGE_COUNT_1M 256
+
+/*
+ * A debug fucntion to print the content of upm.
+ */
+ static inline void
+ uvm_physseg_dump_seg(uvm_physseg_t upm)
+ {
+#if defined(DEBUG)
+ printf("%s: seg->start == %ld\n", __func__,
+ uvm_physseg_get_start(upm));
+ printf("%s: seg->end == %ld\n", __func__,
+ uvm_physseg_get_end(upm));
+ printf("%s: seg->avail_start == %ld\n", __func__,
+ uvm_physseg_get_avail_start(upm));
+ printf("%s: seg->avail_end == %ld\n", __func__,
+ uvm_physseg_get_avail_end(upm));
+
+ printf("====\n\n");
+#else
+ return;
+#endif /* DEBUG */
+ }
+
+/*
+ * Private accessor that gets the value of uvm_physseg_graph.nentries
+ */
+static int
+uvm_physseg_get_entries(void)
+{
+#if defined(UVM_HOTPLUG)
+ return uvm_physseg_graph.nentries;
+#else
+ return vm_nphysmem;
+#endif /* UVM_HOTPLUG */
+}
+
+#if !defined(UVM_HOTPLUG)
+static void *
+uvm_physseg_alloc(size_t sz)
+{
+ return &vm_physmem[vm_nphysseg++];
+}
+#endif
+
+/*
+ * Test Fixture SetUp().
+ */
+static void
+setup(void)
+{
+ /* Prerequisites for running certain calls in uvm_physseg */
+ uvmexp.pagesize = PAGE_SIZE;
+ uvmexp.npages = 0;
+ uvm.page_init_done = false;
+ uvm_physseg_init();
+}
+
+
+/* <---- Tests for Internal functions ----> */
+#if defined(UVM_HOTPLUG)
+ATF_TC(uvm_physseg_alloc_atboot_mismatch);
+ATF_TC_HEAD(uvm_physseg_alloc_atboot_mismatch, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_alloc() sanity"
+ "size mismatch alloc() test.");
+}
+
+ATF_TC_BODY(uvm_physseg_alloc_atboot_mismatch, tc)
+{
+ uvm.page_init_done = false;
+
+ atf_tc_expect_signal(SIGABRT, "size mismatch alloc()");
+
+ uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1);
+}
+
+ATF_TC(uvm_physseg_alloc_atboot_overrun);
+ATF_TC_HEAD(uvm_physseg_alloc_atboot_overrun, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_alloc() sanity"
+ "array overrun alloc() test.");
+}
+
+ATF_TC_BODY(uvm_physseg_alloc_atboot_overrun, tc)
+{
+ uvm.page_init_done = false;
+
+ atf_tc_expect_signal(SIGABRT, "array overrun alloc()");
+
+ uvm_physseg_alloc((VM_PHYSSEG_MAX + 1) * sizeof(struct uvm_physseg));
+
+}
+
+ATF_TC(uvm_physseg_alloc_sanity);
+ATF_TC_HEAD(uvm_physseg_alloc_sanity, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "further uvm_physseg_alloc() sanity checks");
+}
+
+ATF_TC_BODY(uvm_physseg_alloc_sanity, tc)
+{
+
+ /* At boot time */
+ uvm.page_init_done = false;
+
+ /* Correct alloc */
+ ATF_REQUIRE(uvm_physseg_alloc(VM_PHYSSEG_MAX * sizeof(struct uvm_physseg)));
+
+ /* Retry static alloc()s as dynamic - we expect them to pass */
+ uvm.page_init_done = true;
+ ATF_REQUIRE(uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1));
+ ATF_REQUIRE(uvm_physseg_alloc(2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg)));
+}
+
+ATF_TC(uvm_physseg_free_atboot_mismatch);
+ATF_TC_HEAD(uvm_physseg_free_atboot_mismatch, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_free() sanity"
+ "size mismatch free() test.");
+}
+
+ATF_TC_BODY(uvm_physseg_free_atboot_mismatch, tc)
+{
+ uvm.page_init_done = false;
+
+ atf_tc_expect_signal(SIGABRT, "size mismatch free()");
+
+ uvm_physseg_free(&uvm_physseg[0], sizeof(struct uvm_physseg) - 1);
+}
+
+ATF_TC(uvm_physseg_free_sanity);
+ATF_TC_HEAD(uvm_physseg_free_sanity, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "further uvm_physseg_free() sanity checks");
+}
+
+ATF_TC_BODY(uvm_physseg_free_sanity, tc)
+{
+
+ /* At boot time */
+ uvm.page_init_done = false;
+
+ struct uvm_physseg *seg;
+
+#if VM_PHYSSEG_MAX > 1
+ /*
+ * Note: free()ing the entire array is considered to be an
+ * error. Thus VM_PHYSSEG_MAX - 1.
+ */
+
+ seg = uvm_physseg_alloc((VM_PHYSSEG_MAX - 1) * sizeof(*seg));
+ uvm_physseg_free(seg, (VM_PHYSSEG_MAX - 1) * sizeof(struct uvm_physseg));
+#endif
+
+ /* Retry static alloc()s as dynamic - we expect them to pass */
+ uvm.page_init_done = true;
+
+ seg = uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1);
+ uvm_physseg_free(seg, sizeof(struct uvm_physseg) - 1);
+
+ seg = uvm_physseg_alloc(2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg));
+
+ uvm_physseg_free(seg, 2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg));
+}
+
+#if VM_PHYSSEG_MAX > 1
+ATF_TC(uvm_physseg_atboot_free_leak);
+ATF_TC_HEAD(uvm_physseg_atboot_free_leak, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "does free() leak at boot ?\n"
+ "This test needs VM_PHYSSEG_MAX > 1)");
+}
+
+ATF_TC_BODY(uvm_physseg_atboot_free_leak, tc)
+{
+
+ /* At boot time */
+ uvm.page_init_done = false;
+
+ /* alloc to array size */
+ struct uvm_physseg *seg;
+ seg = uvm_physseg_alloc(VM_PHYSSEG_MAX * sizeof(*seg));
+
+ uvm_physseg_free(seg, sizeof(*seg));
+
+ atf_tc_expect_signal(SIGABRT, "array overrun on alloc() after leak");
+
+ ATF_REQUIRE(uvm_physseg_alloc(sizeof(struct uvm_physseg)));
+}
+#endif /* VM_PHYSSEG_MAX */
+#endif /* UVM_HOTPLUG */
+
+/*
+ * Note: This function replicates verbatim what happens in
+ * uvm_page.c:uvm_page_init().
+ *
+ * Please track any changes that happen there.
+ */
+static void
+uvm_page_init_fake(struct vm_page *pagearray, psize_t pagecount)
+{
+ uvm_physseg_t bank;
+ size_t n;
+
+ for (bank = uvm_physseg_get_first(),
+ uvm_physseg_seg_chomp_slab(bank, pagearray, pagecount);
+ uvm_physseg_valid_p(bank);
+ bank = uvm_physseg_get_next(bank)) {
+
+ n = uvm_physseg_get_end(bank) - uvm_physseg_get_start(bank);
+ uvm_physseg_seg_alloc_from_slab(bank, n);
+ uvm_physseg_init_seg(bank, pagearray);
+
+ /* set up page array pointers */
+ pagearray += n;
+ pagecount -= n;
+ }
+
+ uvm.page_init_done = true;
+}
+
+ATF_TC(uvm_physseg_plug);
+ATF_TC_HEAD(uvm_physseg_plug, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test plug functionality.");
+}
+/* Note: We only do the second boot time plug if VM_PHYSSEG_MAX > 1 */
+ATF_TC_BODY(uvm_physseg_plug, tc)
+{
+ int nentries = 0; /* Count of entries via plug done so far */
+ uvm_physseg_t upm1;
+#if VM_PHYSSEG_MAX > 2
+ uvm_physseg_t upm2;
+#endif
+
+#if VM_PHYSSEG_MAX > 1
+ uvm_physseg_t upm3;
+#endif
+ uvm_physseg_t upm4;
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+ psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2);
+ psize_t npages3 = (VALID_END_PFN_3 - VALID_START_PFN_3);
+ psize_t npages4 = (VALID_END_PFN_4 - VALID_START_PFN_4);
+ struct vm_page *pgs, *slab = malloc(sizeof(struct vm_page) * (npages1
+#if VM_PHYSSEG_MAX > 2
+ + npages2
+#endif
+ + npages3));
+
+ /* Fake early boot */
+
+ setup();
+
+ /* Vanilla plug x 2 */
+ ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_1, npages1, &upm1), true);
+ ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries());
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+#if VM_PHYSSEG_MAX > 2
+ ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_2, npages2, &upm2), true);
+ ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries());
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+#endif
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2 + npages3);
+
+ ATF_CHECK_EQ(npages1
+#if VM_PHYSSEG_MAX > 2
+ + npages2
+#endif
+ , uvmexp.npages);
+#if VM_PHYSSEG_MAX > 1
+ /* Scavenge plug - goes into the same slab */
+ ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_3, npages3, &upm3), true);
+ ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries());
+ ATF_REQUIRE_EQ(npages1
+#if VM_PHYSSEG_MAX > 2
+ + npages2
+#endif
+ + npages3, uvmexp.npages);
+
+ /* Scavenge plug should fit right in the slab */
+ pgs = uvm_physseg_get_pg(upm3, 0);
+ ATF_REQUIRE(pgs > slab && pgs < (slab + npages1 + npages2 + npages3));
+#endif
+ /* Hot plug - goes into a brand new slab */
+ ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_4, npages4, &upm4), true);
+ /* The hot plug slab should have nothing to do with the original slab */
+ pgs = uvm_physseg_get_pg(upm4, 0);
+ ATF_REQUIRE(pgs < slab || pgs > (slab + npages1
+#if VM_PHYSSEG_MAX > 2
+ + npages2
+#endif
+ + npages3));
+
+}
+ATF_TC(uvm_physseg_unplug);
+ATF_TC_HEAD(uvm_physseg_unplug, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test unplug functionality.");
+}
+ATF_TC_BODY(uvm_physseg_unplug, tc)
+{
+ paddr_t pa = 0;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+ psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2);
+ psize_t npages3 = (VALID_END_PFN_3 - VALID_START_PFN_3);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2 + npages3));
+
+ uvm_physseg_t upm;
+
+ /* Boot time */
+ setup();
+
+ /* We start with zero segments */
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(atop(0), atop(ONE_MEGABYTE), NULL));
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+ /* Do we have an arbitrary offset in there ? */
+ uvm_physseg_find(atop(TWOFIFTYSIX_KILO), &pa);
+ ATF_REQUIRE_EQ(pa, atop(TWOFIFTYSIX_KILO));
+ ATF_REQUIRE_EQ(0, uvmexp.npages); /* Boot time sanity */
+
+#if VM_PHYSSEG_MAX == 1
+ /*
+ * This is the curious case at boot time, of having one
+ * extent(9) static entry per segment, which means that a
+ * fragmenting unplug will fail.
+ */
+ atf_tc_expect_signal(SIGABRT, "fragmenting unplug for single segment");
+
+ /*
+ * In order to test the fragmenting cases, please set
+ * VM_PHYSSEG_MAX > 1
+ */
+#endif
+ /* Now let's unplug from the middle */
+ ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(TWOFIFTYSIX_KILO), atop(FIVEONETWO_KILO)));
+ /* verify that a gap exists at TWOFIFTYSIX_KILO */
+ pa = 0; /* reset */
+ uvm_physseg_find(atop(TWOFIFTYSIX_KILO), &pa);
+ ATF_REQUIRE_EQ(pa, 0);
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2 + npages3);
+ /* Account for the unplug */
+ ATF_CHECK_EQ(atop(FIVEONETWO_KILO), uvmexp.npages);
+
+ /* Original entry should fragment into two */
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ upm = uvm_physseg_find(atop(TWOFIFTYSIX_KILO + FIVEONETWO_KILO), NULL);
+
+ ATF_REQUIRE(uvm_physseg_valid_p(upm));
+
+ /* Now unplug the tail fragment - should swallow the complete entry */
+ ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(TWOFIFTYSIX_KILO + FIVEONETWO_KILO), atop(TWOFIFTYSIX_KILO)));
+
+ /* The "swallow" above should have invalidated the handle */
+ ATF_REQUIRE_EQ(false, uvm_physseg_valid_p(upm));
+
+ /* Only the first one is left now */
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Unplug from the back */
+ ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(ONETWENTYEIGHT_KILO), atop(ONETWENTYEIGHT_KILO)));
+ /* Shouldn't change the number of segments */
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Unplug from the front */
+ ATF_REQUIRE_EQ(true, uvm_physseg_unplug(0, atop(SIXTYFOUR_KILO)));
+ /* Shouldn't change the number of segments */
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Unplugging the final fragment should fail */
+ atf_tc_expect_signal(SIGABRT, "Unplugging the last segment");
+ ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(SIXTYFOUR_KILO), atop(SIXTYFOUR_KILO)));
+}
+
+
+/* <---- end Tests for Internal functions ----> */
+
+/* Tests for functions exported via uvm_physseg.h */
+ATF_TC(uvm_physseg_init);
+ATF_TC_HEAD(uvm_physseg_init, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_init() call\
+ initializes the vm_physmem struct which holds the rb_tree.");
+}
+ATF_TC_BODY(uvm_physseg_init, tc)
+{
+ uvm_physseg_init();
+
+ ATF_REQUIRE_EQ(0, uvm_physseg_get_entries());
+}
+
+ATF_TC(uvm_page_physload_preload);
+ATF_TC_HEAD(uvm_page_physload_preload, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \
+ call works without a panic() in a preload scenario.");
+}
+ATF_TC_BODY(uvm_page_physload_preload, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Should return a valid handle */
+ ATF_REQUIRE(uvm_physseg_valid_p(upm));
+
+ /* No pages should be allocated yet */
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* After the first call one segment should exist */
+ ATF_CHECK_EQ(1, uvm_physseg_get_entries());
+
+ /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ /* Should return a valid handle */
+ ATF_REQUIRE(uvm_physseg_valid_p(upm));
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* After the second call two segments should exist */
+ ATF_CHECK_EQ(2, uvm_physseg_get_entries());
+#endif
+}
+
+ATF_TC(uvm_page_physload_postboot);
+ATF_TC_HEAD(uvm_page_physload_postboot, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \
+ panic()s in a post boot scenario.");
+}
+ATF_TC_BODY(uvm_page_physload_postboot, tc)
+{
+ uvm_physseg_t upm;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+ psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2));
+
+ setup();
+
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Should return a valid handle */
+ ATF_REQUIRE(uvm_physseg_valid_p(upm));
+
+ /* No pages should be allocated yet */
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* After the first call one segment should exist */
+ ATF_CHECK_EQ(1, uvm_physseg_get_entries());
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2);
+
+ atf_tc_expect_signal(SIGABRT,
+ "uvm_page_physload() called post boot");
+
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ /* Should return a valid handle */
+ ATF_REQUIRE(uvm_physseg_valid_p(upm));
+
+ ATF_REQUIRE_EQ(npages1 + npages2, uvmexp.npages);
+
+ /* After the second call two segments should exist */
+ ATF_CHECK_EQ(2, uvm_physseg_get_entries());
+}
+
+ATF_TC(uvm_physseg_handle_immutable);
+ATF_TC_HEAD(uvm_physseg_handle_immutable, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the uvm_physseg_t handle is \
+ immutable.");
+}
+ATF_TC_BODY(uvm_physseg_handle_immutable, tc)
+{
+ uvm_physseg_t upm;
+
+ /* We insert the segments in out of order */
+
+ setup();
+
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY, uvm_physseg_get_prev(upm));
+
+ /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */
+#if VM_PHYSSEG_MAX > 1
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ /* Fetch Previous, we inserted a lower value */
+ upm = uvm_physseg_get_prev(upm);
+
+#if !defined(UVM_HOTPLUG)
+ /*
+ * This test is going to fail for the Array Implementation but is
+ * expected to pass in the RB Tree implementation.
+ */
+ /* Failure can be expected iff there are more than one handles */
+ atf_tc_expect_fail("Mutable handle in static array impl.");
+#endif
+ ATF_CHECK(UVM_PHYSSEG_TYPE_INVALID_EMPTY != upm);
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_seg_chomp_slab);
+ATF_TC_HEAD(uvm_physseg_seg_chomp_slab, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "The slab import code.()");
+
+}
+ATF_TC_BODY(uvm_physseg_seg_chomp_slab, tc)
+{
+ int err;
+ size_t i;
+ struct uvm_physseg *seg;
+ struct vm_page *slab, *pgs;
+ const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */
+
+ setup();
+
+ /* This is boot time */
+ slab = malloc(sizeof(struct vm_page) * npages * 2);
+
+ seg = uvm_physseg_alloc(sizeof(struct uvm_physseg));
+
+ uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2);
+
+ /* Should be able to allocate two 128 * sizeof(*slab) */
+ ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs));
+ err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO);
+
+#if VM_PHYSSEG_MAX == 1
+ /*
+ * free() needs an extra region descriptor, but we only have
+ * one! The classic alloc() at free() problem
+ */
+
+ ATF_REQUIRE_EQ(ENOMEM, err);
+#else
+ /* Try alloc/free at static time */
+ for (i = 0; i < npages; i++) {
+ ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs));
+ err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO);
+ ATF_REQUIRE_EQ(0, err);
+ }
+#endif
+
+ /* Now setup post boot */
+ uvm.page_init_done = true;
+
+ uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2);
+
+ /* Try alloc/free after uvm_page.c:uvm_page_init() as well */
+ for (i = 0; i < npages; i++) {
+ ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs));
+ err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO);
+ ATF_REQUIRE_EQ(0, err);
+ }
+
+}
+
+ATF_TC(uvm_physseg_alloc_from_slab);
+ATF_TC_HEAD(uvm_physseg_alloc_from_slab, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "The slab alloc code.()");
+
+}
+ATF_TC_BODY(uvm_physseg_alloc_from_slab, tc)
+{
+ struct uvm_physseg *seg;
+ struct vm_page *slab, *pgs;
+ const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */
+
+ setup();
+
+ /* This is boot time */
+ slab = malloc(sizeof(struct vm_page) * npages * 2);
+
+ seg = uvm_physseg_alloc(sizeof(struct uvm_physseg));
+
+ uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2);
+
+ pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages);
+
+ ATF_REQUIRE(pgs != NULL);
+
+ /* Now setup post boot */
+ uvm.page_init_done = true;
+
+#if VM_PHYSSEG_MAX > 1
+ pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages);
+ ATF_REQUIRE(pgs != NULL);
+#endif
+ atf_tc_expect_fail("alloc beyond extent");
+
+ pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages);
+ ATF_REQUIRE(pgs != NULL);
+}
+
+ATF_TC(uvm_physseg_init_seg);
+ATF_TC_HEAD(uvm_physseg_init_seg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if uvm_physseg_init_seg adds pages to"
+ "uvmexp.npages");
+}
+ATF_TC_BODY(uvm_physseg_init_seg, tc)
+{
+ struct uvm_physseg *seg;
+ struct vm_page *slab, *pgs;
+ const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */
+
+ setup();
+
+ /* This is boot time */
+ slab = malloc(sizeof(struct vm_page) * npages * 2);
+
+ seg = uvm_physseg_alloc(sizeof(struct uvm_physseg));
+
+ uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2);
+
+ pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ seg->start = 0;
+ seg->end = npages;
+
+ seg->avail_start = 0;
+ seg->avail_end = npages;
+
+ uvm_physseg_init_seg(PHYSSEG_NODE_TO_HANDLE(seg), pgs);
+
+ ATF_REQUIRE_EQ(npages, uvmexp.npages);
+}
+
+#if 0
+ATF_TC(uvm_physseg_init_seg);
+ATF_TC_HEAD(uvm_physseg_init_seg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \
+ call works without a panic() after Segment is inited.");
+}
+ATF_TC_BODY(uvm_physseg_init_seg, tc)
+{
+ uvm_physseg_t upm;
+ psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1);
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(0, uvmexp.npages);
+
+ /*
+ * Boot time physplug needs explicit external init,
+ * Duplicate what uvm_page.c:uvm_page_init() does.
+ * Note: not everything uvm_page_init() does gets done here.
+ * Read the source.
+ */
+ /* suck in backing slab, initialise extent. */
+ uvm_physseg_seg_chomp_slab(upm, pgs, npages);
+
+ /*
+ * Actual pgs[] allocation, from extent.
+ */
+ uvm_physseg_alloc_from_slab(upm, npages);
+
+ /* Now we initialize the segment */
+ uvm_physseg_init_seg(upm, pgs);
+
+ /* Done with boot simulation */
+ extent_init();
+ uvm.page_init_done = true;
+
+ /* We have total memory of 1MB */
+ ATF_CHECK_EQ(PAGE_COUNT_1M, uvmexp.npages);
+
+ upm =uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ /* We added another 1MB so PAGE_COUNT_1M + PAGE_COUNT_1M */
+ ATF_CHECK_EQ(PAGE_COUNT_1M + PAGE_COUNT_1M, uvmexp.npages);
+
+}
+#endif
+
+ATF_TC(uvm_physseg_get_start);
+ATF_TC_HEAD(uvm_physseg_get_start, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the start PFN is returned \
+ correctly from a segment created via uvm_page_physload().");
+}
+ATF_TC_BODY(uvm_physseg_get_start, tc)
+{
+ uvm_physseg_t upm;
+
+ /* Fake early boot */
+ setup();
+
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_start_invalid);
+ATF_TC_HEAD(uvm_physseg_get_start_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_start() is called with invalid \
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_start_invalid, tc)
+{
+ /* Check for pgs == NULL */
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ /* Invalid uvm_physseg_t */
+ ATF_CHECK_EQ((paddr_t) -1,
+ uvm_physseg_get_start(UVM_PHYSSEG_TYPE_INVALID));
+}
+
+ATF_TC(uvm_physseg_get_end);
+ATF_TC_HEAD(uvm_physseg_get_end, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the end PFN is returned \
+ correctly from a segment created via uvm_page_physload().");
+}
+ATF_TC_BODY(uvm_physseg_get_end, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_end_invalid);
+ATF_TC_HEAD(uvm_physseg_get_end_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_end() is called with invalid \
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_end_invalid, tc)
+{
+ /* Check for pgs == NULL */
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ /* Invalid uvm_physseg_t */
+ ATF_CHECK_EQ((paddr_t) -1,
+ uvm_physseg_get_end(UVM_PHYSSEG_TYPE_INVALID));
+}
+
+ATF_TC(uvm_physseg_get_avail_start);
+ATF_TC_HEAD(uvm_physseg_get_avail_start, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the avail_start PFN is \
+ returned correctly from a segment created via uvm_page_physload().");
+}
+ATF_TC_BODY(uvm_physseg_get_avail_start, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_avail_start_invalid);
+ATF_TC_HEAD(uvm_physseg_get_avail_start_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_avail_start() is called with invalid\
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_avail_start_invalid, tc)
+{
+ /* Check for pgs == NULL */
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ /* Invalid uvm_physseg_t */
+ ATF_CHECK_EQ((paddr_t) -1,
+ uvm_physseg_get_avail_start(UVM_PHYSSEG_TYPE_INVALID));
+}
+
+ATF_TC(uvm_physseg_get_avail_end);
+ATF_TC_HEAD(uvm_physseg_get_avail_end, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the avail_end PFN is \
+ returned correctly from a segment created via uvm_page_physload().");
+}
+ATF_TC_BODY(uvm_physseg_get_avail_end, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_avail_end_invalid);
+ATF_TC_HEAD(uvm_physseg_get_avail_end_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_avail_end() is called with invalid\
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_avail_end_invalid, tc)
+{
+ /* Check for pgs == NULL */
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ /* Invalid uvm_physseg_t */
+ ATF_CHECK_EQ((paddr_t) -1,
+ uvm_physseg_get_avail_end(UVM_PHYSSEG_TYPE_INVALID));
+}
+
+ATF_TC(uvm_physseg_get_next);
+ATF_TC_HEAD(uvm_physseg_get_next, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer values for next \
+ segment using the uvm_physseg_get_next() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_next, tc)
+{
+ uvm_physseg_t upm;
+#if VM_PHYSSEG_MAX > 1
+ uvm_physseg_t upm_next;
+#endif
+
+ /* We insert the segments in ascending order */
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_OVERFLOW,
+ uvm_physseg_get_next(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm_next = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ upm = uvm_physseg_get_next(upm); /* Fetch Next */
+
+ ATF_CHECK_EQ(upm_next, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ upm_next = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(3, uvm_physseg_get_entries());
+
+ upm = uvm_physseg_get_next(upm); /* Fetch Next */
+
+ ATF_CHECK_EQ(upm_next, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_3, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_3, uvm_physseg_get_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_next_invalid);
+ATF_TC_HEAD(uvm_physseg_get_next_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_next() is called with invalid \
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_next_invalid, tc)
+{
+ uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID;
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, uvm_physseg_get_next(upm));
+}
+
+ATF_TC(uvm_physseg_get_prev);
+ATF_TC_HEAD(uvm_physseg_get_prev, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer values for previous \
+ segment using the uvm_physseg_get_prev() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_prev, tc)
+{
+#if VM_PHYSSEG_MAX > 1
+ uvm_physseg_t upm;
+#endif
+ uvm_physseg_t upm_prev;
+
+
+ setup();
+ upm_prev = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY,
+ uvm_physseg_get_prev(upm_prev));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ /* Fetch Previous, we inserted a lower value */
+ upm = uvm_physseg_get_prev(upm);
+
+ ATF_CHECK_EQ(upm_prev, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(3, uvm_physseg_get_entries());
+
+ /*
+ * This will return a UVM_PHYSSEG_TYPE_INVALID_EMPTY we are at the
+ * lowest
+ */
+ upm = uvm_physseg_get_prev(upm);
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY, upm);
+#endif
+}
+
+ATF_TC(uvm_physseg_get_prev_invalid);
+ATF_TC_HEAD(uvm_physseg_get_prev_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \
+ correctly when uvm_physseg_get_prev() is called with invalid \
+ parameter values.");
+}
+ATF_TC_BODY(uvm_physseg_get_prev_invalid, tc)
+{
+ uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID;
+
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, uvm_physseg_get_prev(upm));
+}
+
+ATF_TC(uvm_physseg_get_first);
+ATF_TC_HEAD(uvm_physseg_get_first, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer values for first \
+ segment (lowest node) using the uvm_physseg_get_first() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_first, tc)
+{
+ uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID_EMPTY;
+ uvm_physseg_t upm_first;
+
+ /* Fake early boot */
+ setup();
+
+ /* No nodes exist */
+ ATF_CHECK_EQ(upm, uvm_physseg_get_first());
+
+ upm_first = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Pointer to first should be the least valued node */
+ upm = uvm_physseg_get_first();
+ ATF_CHECK_EQ(upm_first, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ /* Insert a node of lesser value */
+ upm_first = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_CHECK_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ /* Pointer to first should be the least valued node */
+ upm = uvm_physseg_get_first();
+ ATF_CHECK_EQ(upm_first, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm));
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ /* Insert a node of higher value */
+ upm_first =uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT);
+
+ ATF_CHECK_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(3, uvm_physseg_get_entries());
+
+ /* Pointer to first should be the least valued node */
+ upm = uvm_physseg_get_first();
+ ATF_CHECK(upm_first != upm);
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_last);
+ATF_TC_HEAD(uvm_physseg_get_last, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer values for last \
+ segment using the uvm_physseg_get_last() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_last, tc)
+{
+ uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID_EMPTY;
+ uvm_physseg_t upm_last;
+
+ setup();
+
+ /* No nodes exist */
+ ATF_CHECK_EQ(upm, uvm_physseg_get_last());
+
+ upm_last = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Pointer to last should be the most valued node */
+ upm = uvm_physseg_get_last();
+ ATF_CHECK_EQ(upm_last, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ /* Insert node of greater value */
+ upm_last = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ /* Pointer to last should be the most valued node */
+ upm = uvm_physseg_get_last();
+ ATF_CHECK_EQ(upm_last, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ /* Insert node of greater value */
+ upm_last = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(3, uvm_physseg_get_entries());
+
+ /* Pointer to last should be the most valued node */
+ upm = uvm_physseg_get_last();
+ ATF_CHECK_EQ(upm_last, upm);
+ ATF_CHECK_EQ(VALID_START_PFN_3, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_3, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_3, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3, uvm_physseg_get_avail_end(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_valid);
+ATF_TC_HEAD(uvm_physseg_valid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer value for current \
+ segment is valid using the uvm_physseg_valid_p() call.");
+}
+ATF_TC_BODY(uvm_physseg_valid, tc)
+{
+ psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages);
+
+ ATF_CHECK_EQ(true, uvm_physseg_valid_p(upm));
+}
+
+ATF_TC(uvm_physseg_valid_invalid);
+ATF_TC_HEAD(uvm_physseg_valid_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests the pointer value for current \
+ segment is invalid using the uvm_physseg_valid_p() call.");
+}
+ATF_TC_BODY(uvm_physseg_valid_invalid, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ /* Invalid uvm_physseg_t */
+ ATF_CHECK_EQ(false, uvm_physseg_valid_p(UVM_PHYSSEG_TYPE_INVALID));
+
+ /*
+ * Without any pages initialized for segment, it is considered
+ * invalid
+ */
+ ATF_CHECK_EQ(false, uvm_physseg_valid_p(upm));
+}
+
+ATF_TC(uvm_physseg_get_highest);
+ATF_TC_HEAD(uvm_physseg_get_highest, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned PFN matches \
+ the highest PFN in use by the system.");
+}
+ATF_TC_BODY(uvm_physseg_get_highest, tc)
+{
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Only one segment so highest is the current */
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1 - 1, uvm_physseg_get_highest_frame());
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT);
+
+ /* PFN_3 > PFN_1 */
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3 - 1, uvm_physseg_get_highest_frame());
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ /* PFN_3 > PFN_2 */
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3 - 1, uvm_physseg_get_highest_frame());
+#endif
+}
+
+ATF_TC(uvm_physseg_get_free_list);
+ATF_TC_HEAD(uvm_physseg_get_free_list, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned Free List type \
+ of a segment matches the one returned from \
+ uvm_physseg_get_free_list() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_free_list, tc)
+{
+ uvm_physseg_t upm;
+
+ /* Fake early boot */
+ setup();
+
+ /* Insertions are made in ascending order */
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_CHECK_EQ(VM_FREELIST_DEFAULT, uvm_physseg_get_free_list(upm));
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_FIRST16);
+
+ ATF_CHECK_EQ(VM_FREELIST_FIRST16, uvm_physseg_get_free_list(upm));
+#endif
+
+ /* This test will be triggered only if there are 3 or more segments. */
+#if VM_PHYSSEG_MAX > 2
+ upm = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3,
+ VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_FIRST1G);
+
+ ATF_CHECK_EQ(VM_FREELIST_FIRST1G, uvm_physseg_get_free_list(upm));
+#endif
+}
+
+ATF_TC(uvm_physseg_get_start_hint);
+ATF_TC_HEAD(uvm_physseg_get_start_hint, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned start_hint value \
+ of a segment matches the one returned from \
+ uvm_physseg_get_start_hint() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_start_hint, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Will be Zero since no specific value is set during init */
+ ATF_CHECK_EQ(0, uvm_physseg_get_start_hint(upm));
+}
+
+ATF_TC(uvm_physseg_set_start_hint);
+ATF_TC_HEAD(uvm_physseg_set_start_hint, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned start_hint value \
+ of a segment matches the one set by the \
+ uvm_physseg_set_start_hint() call.");
+}
+ATF_TC_BODY(uvm_physseg_set_start_hint, tc)
+{
+ psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_CHECK_EQ(true, uvm_physseg_set_start_hint(upm, atop(128)));
+
+ /* Will be atop(128) since no specific value is set above */
+ ATF_CHECK_EQ(atop(128), uvm_physseg_get_start_hint(upm));
+}
+
+ATF_TC(uvm_physseg_set_start_hint_invalid);
+ATF_TC_HEAD(uvm_physseg_set_start_hint_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned value is false \
+ when an invalid segment matches the one trying to set by the \
+ uvm_physseg_set_start_hint() call.");
+}
+ATF_TC_BODY(uvm_physseg_set_start_hint_invalid, tc)
+{
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ /* Force other check conditions */
+ uvm.page_init_done = true;
+
+ ATF_REQUIRE_EQ(true, uvm.page_init_done);
+
+ ATF_CHECK_EQ(false, uvm_physseg_set_start_hint(upm, atop(128)));
+
+ /*
+ * Will be Zero since no specific value is set after the init
+ * due to failure
+ */
+ atf_tc_expect_signal(SIGABRT, "invalid uvm_physseg_t handle");
+
+ ATF_CHECK_EQ(0, uvm_physseg_get_start_hint(upm));
+}
+
+ATF_TC(uvm_physseg_get_pg);
+ATF_TC_HEAD(uvm_physseg_get_pg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned vm_page struct \
+ is correct when fetched by uvm_physseg_get_pg() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_pg, tc)
+{
+ psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ struct vm_page *extracted_pg = NULL;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* Now we initialize the segment */
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(NULL, extracted_pg);
+
+ /* Try fetching the 5th Page in the Segment */
+ extracted_pg = uvm_physseg_get_pg(upm, 5);
+
+ /* Values of phys_addr is n * PAGE_SIZE where n is the page number */
+ ATF_CHECK_EQ(5 * PAGE_SIZE, extracted_pg->phys_addr);
+
+ /* Try fetching the 113th Page in the Segment */
+ extracted_pg = uvm_physseg_get_pg(upm, 113);
+
+ ATF_CHECK_EQ(113 * PAGE_SIZE, extracted_pg->phys_addr);
+}
+
+#ifdef __HAVE_PMAP_PHYSSEG
+ATF_TC(uvm_physseg_get_pmseg);
+ATF_TC_HEAD(uvm_physseg_get_pmseg, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned pmap_physseg \
+ struct is correct when fetched by uvm_physseg_get_pmseg() call.");
+}
+ATF_TC_BODY(uvm_physseg_get_pmseg, tc)
+{
+ psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ struct pmap_physseg pmseg = { true };
+
+ struct pmap_physseg *extracted_pmseg = NULL;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* Now we initialize the segment */
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages);
+
+ ATF_REQUIRE_EQ(NULL, extracted_pmseg);
+
+ ATF_REQUIRE_EQ(true, pmseg.dummy_variable);
+
+ /* Extract the current pmseg */
+ extracted_pmseg = uvm_physseg_get_pmseg(upm);
+
+ /*
+ * We can only check if it is not NULL
+ * We do not know the value it contains
+ */
+ ATF_CHECK(NULL != extracted_pmseg);
+
+ extracted_pmseg->dummy_variable = pmseg.dummy_variable;
+
+ /* Invert value to ensure test integrity */
+ pmseg.dummy_variable = false;
+
+ ATF_REQUIRE_EQ(false, pmseg.dummy_variable);
+
+ extracted_pmseg = uvm_physseg_get_pmseg(upm);
+
+ ATF_CHECK(NULL != extracted_pmseg);
+
+ ATF_CHECK_EQ(true, extracted_pmseg->dummy_variable);
+}
+#endif
+
+ATF_TC(vm_physseg_find);
+ATF_TC_HEAD(vm_physseg_find, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned segment number \
+ is correct when an PFN is passed into uvm_physseg_find() call. \
+ In addition to this the offset of the PFN from the start of \
+ segment is also set if the parameter is passed in as not NULL.");
+}
+ATF_TC_BODY(vm_physseg_find, tc)
+{
+ psize_t offset = (psize_t) -1;
+
+ uvm_physseg_t upm_first, result;
+#if VM_PHYSSEG_MAX > 1
+ uvm_physseg_t upm_second;
+#endif
+
+ setup();
+
+ upm_first = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ upm_second = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+#endif
+
+ /* Under ONE_MEGABYTE is segment upm_first */
+ result = uvm_physseg_find(atop(ONE_MEGABYTE - 1024), NULL);
+ ATF_CHECK_EQ(upm_first, result);
+ ATF_CHECK_EQ(uvm_physseg_get_start(upm_first),
+ uvm_physseg_get_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_end(upm_first),
+ uvm_physseg_get_end(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_first),
+ uvm_physseg_get_avail_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_first),
+ uvm_physseg_get_avail_end(result));
+
+ ATF_REQUIRE_EQ((psize_t) -1, offset);
+
+ /* This test will be triggered only if there are 2 or more segments. */
+#if VM_PHYSSEG_MAX > 1
+ /* Over ONE_MEGABYTE is segment upm_second */
+ result = uvm_physseg_find(atop(ONE_MEGABYTE + 8192), &offset);
+ ATF_CHECK_EQ(upm_second, result);
+ ATF_CHECK_EQ(uvm_physseg_get_start(upm_second),
+ uvm_physseg_get_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_end(upm_second),
+ uvm_physseg_get_end(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_second),
+ uvm_physseg_get_avail_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_second),
+ uvm_physseg_get_avail_end(result));
+
+ /* Offset is calculated based on PAGE_SIZE */
+ /* atop(ONE_MEGABYTE + (2 * PAGE_SIZE)) - VALID_START_PFN1 = 2 */
+ ATF_CHECK_EQ(2, offset);
+#else
+ /* Under ONE_MEGABYTE is segment upm_first */
+ result = uvm_physseg_find(atop(ONE_MEGABYTE - 12288), &offset);
+ ATF_CHECK_EQ(upm_first, result);
+ ATF_CHECK_EQ(uvm_physseg_get_start(upm_first),
+ uvm_physseg_get_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_end(upm_first),
+ uvm_physseg_get_end(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_first),
+ uvm_physseg_get_avail_start(result));
+ ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_first),
+ uvm_physseg_get_avail_end(result));
+
+ /* Offset is calculated based on PAGE_SIZE */
+ /* atop(ONE_MEGABYTE - (3 * PAGE_SIZE)) - VALID_START_PFN1 = 253 */
+ ATF_CHECK_EQ(253, offset);
+#endif
+}
+
+ATF_TC(vm_physseg_find_invalid);
+ATF_TC_HEAD(vm_physseg_find_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the returned segment number \
+ is (paddr_t) -1 when a non existant PFN is passed into \
+ uvm_physseg_find() call.");
+}
+ATF_TC_BODY(vm_physseg_find_invalid, tc)
+{
+ psize_t offset = (psize_t) -1;
+
+ setup();
+ uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* No segments over 3 MB exists at the moment */
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID,
+ uvm_physseg_find(atop(ONE_MEGABYTE * 3), NULL));
+
+ ATF_REQUIRE_EQ((psize_t) -1, offset);
+
+ /* No segments over 3 MB exists at the moment */
+ ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID,
+ uvm_physseg_find(atop(ONE_MEGABYTE * 3), &offset));
+
+ ATF_CHECK_EQ((psize_t) -1, offset);
+}
+
+ATF_TC(uvm_page_physunload_start);
+ATF_TC_HEAD(uvm_page_physunload_start, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\
+ call works without a panic(). Unloads from Start of the segment.");
+}
+ATF_TC_BODY(uvm_page_physunload_start, tc)
+{
+ /*
+ * Would uvmexp.npages reduce everytime an uvm_page_physunload is called?
+ */
+ psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ /*
+ * When called for first time, uvm_page_physload() removes the first PFN
+ *
+ * New avail start will be VALID_AVAIL_START_PFN_2 + 1
+ */
+ ATF_CHECK_EQ(VALID_START_PFN_2, atop(p));
+
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1,
+ uvm_physseg_get_avail_start(upm));
+
+ ATF_CHECK_EQ(VALID_START_PFN_2 + 1, uvm_physseg_get_start(upm));
+
+ /* Rest of the stuff should remain the same */
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+}
+
+ATF_TC(uvm_page_physunload_end);
+ATF_TC_HEAD(uvm_page_physunload_end, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\
+ call works without a panic(). Unloads from End of the segment.");
+}
+ATF_TC_BODY(uvm_page_physunload_end, tc)
+{
+ /*
+ * Would uvmexp.npages reduce everytime an uvm_page_physunload is called?
+ */
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ /* Note: start != avail_start to remove from end. */
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2 + 1, VALID_AVAIL_END_PFN_2,
+ VM_FREELIST_DEFAULT);
+
+ p = 0;
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE(
+ uvm_physseg_get_avail_start(upm) != uvm_physseg_get_start(upm));
+
+ ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ /*
+ * Remember if X is the upper limit the actual valid pointer is X - 1
+ *
+ * For example if 256 is the upper limit for 1MB memory, last valid
+ * pointer is 256 - 1 = 255
+ */
+
+ ATF_CHECK_EQ(VALID_END_PFN_2 - 1, atop(p));
+
+ /*
+ * When called for second time, uvm_page_physload() removes the last PFN
+ *
+ * New avail end will be VALID_AVAIL_END_PFN_2 - 1
+ * New end will be VALID_AVAIL_PFN_2 - 1
+ */
+
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2 - 1, uvm_physseg_get_avail_end(upm));
+
+ ATF_CHECK_EQ(VALID_END_PFN_2 - 1, uvm_physseg_get_end(upm));
+
+ /* Rest of the stuff should remain the same */
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1,
+ uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+}
+
+ATF_TC(uvm_page_physunload_none);
+ATF_TC_HEAD(uvm_page_physunload_none, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\
+ call works without a panic(). Does not unload from start or end \
+ because of non-aligned start / avail_start and end / avail_end \
+ respectively.");
+}
+ATF_TC_BODY(uvm_page_physunload_none, tc)
+{
+ psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ /*
+ * Note: start != avail_start and end != avail_end.
+ *
+ * This prevents any unload from occuring.
+ */
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2 + 1, VALID_AVAIL_END_PFN_2 - 1,
+ VM_FREELIST_DEFAULT);
+
+ p = 0;
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_REQUIRE(
+ uvm_physseg_get_avail_start(upm) != uvm_physseg_get_start(upm));
+
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_CHECK_EQ(false, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ /* uvm_page_physload() will no longer unload memory */
+ ATF_CHECK_EQ(0, p);
+
+ /* Rest of the stuff should remain the same */
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1,
+ uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2 - 1,
+ uvm_physseg_get_avail_end(upm));
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+}
+
+ATF_TC(uvm_page_physunload_delete_start);
+ATF_TC_HEAD(uvm_page_physunload_delete_start, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \
+ works when the segment gets small enough to be deleted scenario. \
+ NOTE: This one works deletes from start.");
+}
+ATF_TC_BODY(uvm_page_physunload_delete_start, tc)
+{
+ /*
+ * Would uvmexp.npages reduce everytime an uvm_page_physunload is called?
+ */
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+
+ /*
+ * Setup the Nuke from Starting point
+ */
+
+ upm = uvm_page_physload(VALID_END_PFN_1 - 1, VALID_END_PFN_1,
+ VALID_AVAIL_END_PFN_1 - 1, VALID_AVAIL_END_PFN_1,
+ VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */
+#if VM_PHYSSEG_MAX > 1
+ uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+#endif
+
+#if VM_PHYSSEG_MAX == 1
+ atf_tc_expect_signal(SIGABRT,
+ "cannot uvm_page_physunload() the last segment");
+#endif
+
+ ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ ATF_CHECK_EQ(VALID_END_PFN_1 - 1, atop(p));
+
+ ATF_CHECK_EQ(1, uvm_physseg_get_entries());
+
+ /* The only node now is the one we inserted second. */
+ upm = uvm_physseg_get_first();
+
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+}
+
+ATF_TC(uvm_page_physunload_delete_end);
+ATF_TC_HEAD(uvm_page_physunload_delete_end, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \
+ works when the segment gets small enough to be deleted scenario. \
+ NOTE: This one works deletes from end.");
+}
+ATF_TC_BODY(uvm_page_physunload_delete_end, tc)
+{
+ /*
+ * Would uvmexp.npages reduce everytime an uvm_page_physunload is called?
+ */
+
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+
+ /*
+ * Setup the Nuke from Ending point
+ */
+
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_START_PFN_1 + 2,
+ VALID_AVAIL_START_PFN_1 + 1, VALID_AVAIL_START_PFN_1 + 2,
+ VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */
+#if VM_PHYSSEG_MAX > 1
+ uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+#endif
+
+#if VM_PHYSSEG_MAX == 1
+ atf_tc_expect_signal(SIGABRT,
+ "cannot uvm_page_physunload() the last segment");
+#endif
+
+ ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ p = 0;
+
+ ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p));
+
+ ATF_CHECK_EQ(VALID_START_PFN_1 + 2, atop(p));
+
+ ATF_CHECK_EQ(1, uvm_physseg_get_entries());
+
+ /* The only node now is the one we inserted second. */
+ upm = uvm_physseg_get_first();
+
+ ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm));
+ ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm));
+ ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm));
+}
+
+ATF_TC(uvm_page_physunload_invalid);
+ATF_TC_HEAD(uvm_page_physunload_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \
+ fails when then Free list does not match.");
+}
+ATF_TC_BODY(uvm_page_physunload_invalid, tc)
+{
+ psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2);
+
+ struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages);
+
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ uvm_physseg_init_seg(upm, pgs);
+
+ ATF_CHECK_EQ(false, uvm_page_physunload(upm, VM_FREELIST_FIRST4G, &p));
+}
+
+ATF_TC(uvm_page_physunload_force);
+ATF_TC_HEAD(uvm_page_physunload_force, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the basic \
+ uvm_page_physunload_force() including delete works without.");
+}
+ATF_TC_BODY(uvm_page_physunload_force, tc)
+{
+ /*
+ * Would uvmexp.npages reduce everytime an uvm_page_physunload is called?
+ */
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1,
+ VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */
+#if VM_PHYSSEG_MAX > 1
+ /*
+ * We have couple of physloads done this is bacause of the fact that if
+ * we physunload all the PFs from a given range and we have only one
+ * segment in total a panic() is called
+ */
+ uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2,
+ VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+#endif
+
+#if VM_PHYSSEG_MAX == 1
+ atf_tc_expect_signal(SIGABRT,
+ "cannot uvm_page_physunload() the last segment");
+#endif
+
+ ATF_REQUIRE_EQ(VALID_AVAIL_START_PFN_1,
+ uvm_physseg_get_avail_start(upm));
+
+ for(paddr_t i = VALID_AVAIL_START_PFN_1;
+ i < VALID_AVAIL_END_PFN_1; i++) {
+ ATF_CHECK_EQ(true,
+ uvm_page_physunload_force(upm, VM_FREELIST_DEFAULT, &p));
+ ATF_CHECK_EQ(i, atop(p));
+
+ if(i + 1 < VALID_AVAIL_END_PFN_1)
+ ATF_CHECK_EQ(i + 1, uvm_physseg_get_avail_start(upm));
+ }
+
+ /*
+ * Now we try to retrieve the segment, which has been removed
+ * from the system through force unloading all the pages inside it.
+ */
+ upm = uvm_physseg_find(VALID_AVAIL_END_PFN_1 - 1, NULL);
+
+ /* It should no longer exist */
+ ATF_CHECK_EQ(NULL, upm);
+
+ ATF_CHECK_EQ(1, uvm_physseg_get_entries());
+}
+
+ATF_TC(uvm_page_physunload_force_invalid);
+ATF_TC_HEAD(uvm_page_physunload_force_invalid, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Tests if the invalid conditions for \
+ uvm_page_physunload_force_invalid().");
+}
+ATF_TC_BODY(uvm_page_physunload_force_invalid, tc)
+{
+ paddr_t p = 0;
+
+ uvm_physseg_t upm;
+
+ setup();
+ upm = uvm_page_physload(VALID_START_PFN_2, VALID_START_PFN_2+ 1,
+ VALID_START_PFN_2, VALID_START_PFN_2, VM_FREELIST_DEFAULT);
+
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ ATF_REQUIRE_EQ(0, uvmexp.npages);
+
+ ATF_CHECK_EQ(false,
+ uvm_page_physunload_force(upm, VM_FREELIST_DEFAULT, &p));
+
+ ATF_CHECK_EQ(0, p);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+#if defined(UVM_HOTPLUG)
+ /* Internal */
+ ATF_TP_ADD_TC(tp, uvm_physseg_alloc_atboot_mismatch);
+ ATF_TP_ADD_TC(tp, uvm_physseg_alloc_atboot_overrun);
+ ATF_TP_ADD_TC(tp, uvm_physseg_alloc_sanity);
+ ATF_TP_ADD_TC(tp, uvm_physseg_free_atboot_mismatch);
+ ATF_TP_ADD_TC(tp, uvm_physseg_free_sanity);
+#if VM_PHYSSEG_MAX > 1
+ ATF_TP_ADD_TC(tp, uvm_physseg_atboot_free_leak);
+#endif
+#endif /* UVM_HOTPLUG */
+
+ ATF_TP_ADD_TC(tp, uvm_physseg_plug);
+ ATF_TP_ADD_TC(tp, uvm_physseg_unplug);
+
+ /* Exported */
+ ATF_TP_ADD_TC(tp, uvm_physseg_init);
+ ATF_TP_ADD_TC(tp, uvm_page_physload_preload);
+ ATF_TP_ADD_TC(tp, uvm_page_physload_postboot);
+ ATF_TP_ADD_TC(tp, uvm_physseg_handle_immutable);
+ ATF_TP_ADD_TC(tp, uvm_physseg_seg_chomp_slab);
+ ATF_TP_ADD_TC(tp, uvm_physseg_alloc_from_slab);
+ ATF_TP_ADD_TC(tp, uvm_physseg_init_seg);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_start);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_start_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_end);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_end_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_start);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_start_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_end);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_end_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_next);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_next_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_prev);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_prev_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_first);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_last);
+ ATF_TP_ADD_TC(tp, uvm_physseg_valid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_valid_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_highest);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_free_list);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_start_hint);
+ ATF_TP_ADD_TC(tp, uvm_physseg_set_start_hint);
+ ATF_TP_ADD_TC(tp, uvm_physseg_set_start_hint_invalid);
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_pg);
+
+#ifdef __HAVE_PMAP_PHYSSEG
+ ATF_TP_ADD_TC(tp, uvm_physseg_get_pmseg);
+#endif
+ ATF_TP_ADD_TC(tp, vm_physseg_find);
+ ATF_TP_ADD_TC(tp, vm_physseg_find_invalid);
+
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_start);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_end);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_none);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_delete_start);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_delete_end);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_invalid);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_force);
+ ATF_TP_ADD_TC(tp, uvm_page_physunload_force_invalid);
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/sys/uvm/t_uvm_physseg_load.c b/contrib/netbsd-tests/sys/uvm/t_uvm_physseg_load.c
new file mode 100644
index 0000000..a150f69
--- /dev/null
+++ b/contrib/netbsd-tests/sys/uvm/t_uvm_physseg_load.c
@@ -0,0 +1,740 @@
+/* $NetBSD: t_uvm_physseg_load.c,v 1.2 2016/12/22 08:15:20 cherry Exp $ */
+
+/*-
+ * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Santhosh N. Raju <santhosh.raju@gmail.com> and
+ * by Cherry G. Mathew
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_uvm_physseg_load.c,v 1.2 2016/12/22 08:15:20 cherry Exp $");
+
+/*
+ * If this line is commented out tests related touvm_physseg_get_pmseg()
+ * wont run.
+ *
+ * Have a look at machine/uvm_physseg.h for more details.
+ */
+#define __HAVE_PMAP_PHYSSEG
+
+/*
+ * This is a dummy struct used for testing purposes
+ *
+ * In reality this struct would exist in the MD part of the code residing in
+ * machines/vmparam.h
+ */
+
+#ifdef __HAVE_PMAP_PHYSSEG
+struct pmap_physseg {
+ int dummy_variable; /* Dummy variable use for testing */
+};
+#endif
+
+/* Testing API - assumes userland */
+/* Provide Kernel API equivalents */
+#include <assert.h>
+#include <stdbool.h>
+#include <string.h> /* memset(3) et. al */
+#include <stdio.h> /* printf(3) */
+#include <stdlib.h> /* malloc(3) */
+#include <stdarg.h>
+#include <stddef.h>
+#include <time.h>
+
+#define PRIxPADDR "lx"
+#define PRIxPSIZE "lx"
+#define PRIuPSIZE "lu"
+#define PRIxVADDR "lx"
+#define PRIxVSIZE "lx"
+#define PRIuVSIZE "lu"
+
+#define UVM_HOTPLUG /* Enable hotplug with rbtree. */
+#define PMAP_STEAL_MEMORY
+#define DEBUG /* Enable debug functionality. */
+
+typedef unsigned long vaddr_t;
+typedef unsigned long paddr_t;
+typedef unsigned long psize_t;
+typedef unsigned long vsize_t;
+
+#include <uvm/uvm_physseg.h>
+#include <uvm/uvm_page.h>
+
+#ifndef DIAGNOSTIC
+#define KASSERTMSG(e, msg, ...) /* NOTHING */
+#define KASSERT(e) /* NOTHING */
+#else
+#define KASSERT(a) assert(a)
+#define KASSERTMSG(exp, ...) printf(__VA_ARGS__); assert((exp))
+#endif
+
+#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
+
+#define VM_NFREELIST 4
+#define VM_FREELIST_DEFAULT 0
+#define VM_FREELIST_FIRST16 3
+#define VM_FREELIST_FIRST1G 2
+#define VM_FREELIST_FIRST4G 1
+
+/*
+ * Used in tests when Array implementation is tested
+ */
+#if !defined(VM_PHYSSEG_MAX)
+#define VM_PHYSSEG_MAX 32
+#endif
+
+#define PAGE_SIZE 4096
+#define PAGE_SHIFT 12
+#define atop(x) (((paddr_t)(x)) >> PAGE_SHIFT)
+
+#define mutex_enter(l)
+#define mutex_exit(l)
+
+#define _SYS_KMEM_H_ /* Disallow the real kmem API (see below) */
+/* free(p) XXX: pgs management need more thought */
+#define kmem_alloc(size, flags) malloc(size)
+#define kmem_zalloc(size, flags) malloc(size)
+#define kmem_free(p, size) free(p)
+
+psize_t physmem;
+
+struct uvmexp uvmexp; /* decl */
+
+/*
+ * uvm structure borrowed from uvm.h
+ *
+ * Remember this is a dummy structure used within the ATF Tests and
+ * uses only necessary fields from the original uvm struct.
+ * See uvm/uvm.h for the full struct.
+ */
+
+struct uvm {
+ /* vm_page related parameters */
+
+ bool page_init_done; /* TRUE if uvm_page_init() finished */
+} uvm;
+
+static void
+panic(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ printf("\n");
+ va_end(ap);
+ KASSERT(false);
+
+ /*NOTREACHED*/
+}
+
+static void
+uvm_pagefree(struct vm_page *pg)
+{
+ return;
+}
+
+#if defined(UVM_HOTPLUG)
+static void
+uvmpdpol_reinit(void)
+{
+ return;
+}
+#endif /* UVM_HOTPLUG */
+
+/* end - Provide Kernel API equivalents */
+
+#include "uvm/uvm_physseg.c"
+
+#include <atf-c.h>
+
+#define ONE_MEGABYTE 1024 * 1024
+
+/* Sample Page Frame Numbers */
+#define VALID_START_PFN_1 atop(0)
+#define VALID_END_PFN_1 atop(ONE_MEGABYTE)
+#define VALID_AVAIL_START_PFN_1 atop(0)
+#define VALID_AVAIL_END_PFN_1 atop(ONE_MEGABYTE)
+
+#define VALID_START_PFN_2 atop(ONE_MEGABYTE + 1)
+#define VALID_END_PFN_2 atop(ONE_MEGABYTE * 2)
+#define VALID_AVAIL_START_PFN_2 atop(ONE_MEGABYTE + 1)
+#define VALID_AVAIL_END_PFN_2 atop(ONE_MEGABYTE * 2)
+
+#define VALID_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1)
+#define VALID_END_PFN_3 atop(ONE_MEGABYTE * 3)
+#define VALID_AVAIL_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1)
+#define VALID_AVAIL_END_PFN_3 atop(ONE_MEGABYTE * 3)
+
+#define VALID_START_PFN_4 atop(ONE_MEGABYTE + 1)
+#define VALID_END_PFN_4 atop(ONE_MEGABYTE * 128)
+#define VALID_AVAIL_START_PFN_4 atop(ONE_MEGABYTE + 1)
+#define VALID_AVAIL_END_PFN_4 atop(ONE_MEGABYTE * 128)
+
+#define VALID_START_PFN_5 atop(ONE_MEGABYTE + 1)
+#define VALID_END_PFN_5 atop(ONE_MEGABYTE * 256)
+#define VALID_AVAIL_START_PFN_5 atop(ONE_MEGABYTE + 1)
+#define VALID_AVAIL_END_PFN_5 atop(ONE_MEGABYTE * 256)
+
+/*
+ * Total number of pages (of 4K size each) should be 256 for 1MB of memory.
+ */
+#define PAGE_COUNT_1M 256
+
+/*
+ * The number of Page Frames to allot per segment
+ */
+#define PF_STEP 8
+
+/*
+ * A debug fucntion to print the content of upm.
+ */
+ static inline void
+ uvm_physseg_dump_seg(uvm_physseg_t upm)
+ {
+#if defined(DEBUG)
+ printf("%s: seg->start == %ld\n", __func__,
+ uvm_physseg_get_start(upm));
+ printf("%s: seg->end == %ld\n", __func__,
+ uvm_physseg_get_end(upm));
+ printf("%s: seg->avail_start == %ld\n", __func__,
+ uvm_physseg_get_avail_start(upm));
+ printf("%s: seg->avail_end == %ld\n", __func__,
+ uvm_physseg_get_avail_end(upm));
+
+ printf("====\n\n");
+#else
+ return;
+#endif /* DEBUG */
+ }
+
+/*
+ * Private accessor that gets the value of vm_physmem.nentries
+ */
+static int
+uvm_physseg_get_entries(void)
+{
+#if defined(UVM_HOTPLUG)
+ return uvm_physseg_graph.nentries;
+#else
+ return vm_nphysmem;
+#endif /* UVM_HOTPLUG */
+}
+
+/*
+ * Note: This function replicates verbatim what happens in
+ * uvm_page.c:uvm_page_init().
+ *
+ * Please track any changes that happen there.
+ */
+static void
+uvm_page_init_fake(struct vm_page *pagearray, psize_t pagecount)
+{
+ uvm_physseg_t bank;
+ size_t n;
+
+ for (bank = uvm_physseg_get_first(),
+ uvm_physseg_seg_chomp_slab(bank, pagearray, pagecount);
+ uvm_physseg_valid_p(bank);
+ bank = uvm_physseg_get_next(bank)) {
+
+ n = uvm_physseg_get_end(bank) - uvm_physseg_get_start(bank);
+ uvm_physseg_seg_alloc_from_slab(bank, n);
+ uvm_physseg_init_seg(bank, pagearray);
+
+ /* set up page array pointers */
+ pagearray += n;
+ pagecount -= n;
+ }
+
+ uvm.page_init_done = true;
+}
+
+/*
+ * PHYS_TO_VM_PAGE: find vm_page for a PA. used by MI code to get vm_pages
+ * back from an I/O mapping (ugh!). used in some MD code as well.
+ */
+static struct vm_page *
+uvm_phys_to_vm_page(paddr_t pa)
+{
+ paddr_t pf = atop(pa);
+ paddr_t off;
+ uvm_physseg_t psi;
+
+ psi = uvm_physseg_find(pf, &off);
+ if (psi != UVM_PHYSSEG_TYPE_INVALID)
+ return uvm_physseg_get_pg(psi, off);
+ return(NULL);
+}
+
+//static paddr_t
+//uvm_vm_page_to_phys(const struct vm_page *pg)
+//{
+//
+// return pg->phys_addr;
+//}
+
+/*
+ * XXX: To do, write control test cases for uvm_vm_page_to_phys().
+ */
+
+/* #define VM_PAGE_TO_PHYS(entry) uvm_vm_page_to_phys(entry) */
+
+#define PHYS_TO_VM_PAGE(pa) uvm_phys_to_vm_page(pa)
+
+/*
+ * Test Fixture SetUp().
+ */
+static void
+setup(void)
+{
+ /* Prerequisites for running certain calls in uvm_physseg */
+ uvmexp.pagesize = PAGE_SIZE;
+ uvmexp.npages = 0;
+ uvm.page_init_done = false;
+ uvm_physseg_init();
+}
+
+ATF_TC(uvm_physseg_100);
+ATF_TC_HEAD(uvm_physseg_100, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 100 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_100, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 100; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_1K);
+ATF_TC_HEAD(uvm_physseg_1K, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 1000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_1K, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 1000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_10K);
+ATF_TC_HEAD(uvm_physseg_10K, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_10K, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 10000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_100K);
+ATF_TC_HEAD(uvm_physseg_100K, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 100,000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_100K, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 100000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_1M);
+ATF_TC_HEAD(uvm_physseg_1M, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 1,000,000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_1M, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 1000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_10M);
+ATF_TC_HEAD(uvm_physseg_10M, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000,000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_10M, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 10000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_100M);
+ATF_TC_HEAD(uvm_physseg_100M, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 100,000,000 calls, VM_PHYSSEG_MAX is 32.");
+}
+ATF_TC_BODY(uvm_physseg_100M, tc)
+{
+ paddr_t pa;
+
+ setup();
+
+ for(paddr_t i = VALID_START_PFN_1;
+ i < VALID_END_PFN_1; i += PF_STEP) {
+ uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP,
+ VM_FREELIST_DEFAULT);
+ }
+
+ ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(int i = 0; i < 100000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_1MB);
+ATF_TC_HEAD(uvm_physseg_1MB, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 1 MB Segment.");
+}
+ATF_TC_BODY(uvm_physseg_1MB, t)
+{
+ paddr_t pa = 0;
+
+ paddr_t pf = 0;
+
+ psize_t pf_chunk_size = 0;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page) *
+ (npages1 + npages2));
+
+ setup();
+
+ /* We start with zero segments */
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL));
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2);
+
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL));
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(pf = VALID_START_PFN_2; pf < VALID_END_PFN_2; pf += PF_STEP) {
+ pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1;
+ uvm_physseg_unplug(pf, pf_chunk_size);
+ }
+
+ for(int i = 0; i < 10000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_2);
+ if(pa < ctob(VALID_START_PFN_2))
+ pa += ctob(VALID_START_PFN_2);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_64MB);
+ATF_TC_HEAD(uvm_physseg_64MB, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 64 MB Segment.");
+}
+ATF_TC_BODY(uvm_physseg_64MB, t)
+{
+ paddr_t pa = 0;
+
+ paddr_t pf = 0;
+
+ psize_t pf_chunk_size = 0;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ psize_t npages2 = (VALID_END_PFN_3 - VALID_START_PFN_3);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page) *
+ (npages1 + npages2));
+
+ setup();
+
+ /* We start with zero segments */
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL));
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2);
+
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_3, npages2, NULL));
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(pf = VALID_START_PFN_3; pf < VALID_END_PFN_3; pf += PF_STEP) {
+ pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1;
+ uvm_physseg_unplug(pf, pf_chunk_size);
+ }
+
+ for(int i = 0; i < 10000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_3);
+ if(pa < ctob(VALID_START_PFN_3))
+ pa += ctob(VALID_START_PFN_3);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_128MB);
+ATF_TC_HEAD(uvm_physseg_128MB, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 128 MB Segment.");
+}
+ATF_TC_BODY(uvm_physseg_128MB, t)
+{
+ paddr_t pa = 0;
+
+ paddr_t pf = 0;
+
+ psize_t pf_chunk_size = 0;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ psize_t npages2 = (VALID_END_PFN_4 - VALID_START_PFN_4);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page)
+ * (npages1 + npages2));
+
+ setup();
+
+ /* We start with zero segments */
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL));
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2);
+
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL));
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(pf = VALID_START_PFN_4; pf < VALID_END_PFN_4; pf += PF_STEP) {
+ pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1;
+ uvm_physseg_unplug(pf, pf_chunk_size);
+ }
+
+ for(int i = 0; i < 10000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_4);
+ if(pa < ctob(VALID_START_PFN_4))
+ pa += ctob(VALID_START_PFN_4);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TC(uvm_physseg_256MB);
+ATF_TC_HEAD(uvm_physseg_256MB, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \
+ 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 256 MB Segment.");
+}
+ATF_TC_BODY(uvm_physseg_256MB, t)
+{
+ paddr_t pa = 0;
+
+ paddr_t pf = 0;
+
+ psize_t pf_chunk_size = 0;
+
+ psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1);
+
+ psize_t npages2 = (VALID_END_PFN_5 - VALID_START_PFN_5);
+
+ struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2));
+
+ setup();
+
+ /* We start with zero segments */
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL));
+ ATF_REQUIRE_EQ(1, uvm_physseg_get_entries());
+
+ /* Post boot: Fake all segments and pages accounted for. */
+ uvm_page_init_fake(slab, npages1 + npages2);
+
+ ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL));
+ ATF_REQUIRE_EQ(2, uvm_physseg_get_entries());
+
+ srandom((unsigned)time(NULL));
+ for(pf = VALID_START_PFN_5; pf < VALID_END_PFN_5; pf += PF_STEP) {
+ pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1;
+ uvm_physseg_unplug(pf, pf_chunk_size);
+ }
+
+ for(int i = 0; i < 10000000; i++) {
+ pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_5);
+ if(pa < ctob(VALID_END_PFN_5))
+ pa += ctob(VALID_START_PFN_5);
+ PHYS_TO_VM_PAGE(pa);
+ }
+
+ ATF_CHECK_EQ(true, true);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ /* Fixed memory size tests. */
+ ATF_TP_ADD_TC(tp, uvm_physseg_100);
+ ATF_TP_ADD_TC(tp, uvm_physseg_1K);
+ ATF_TP_ADD_TC(tp, uvm_physseg_10K);
+ ATF_TP_ADD_TC(tp, uvm_physseg_100K);
+ ATF_TP_ADD_TC(tp, uvm_physseg_1M);
+ ATF_TP_ADD_TC(tp, uvm_physseg_10M);
+ ATF_TP_ADD_TC(tp, uvm_physseg_100M);
+
+#if defined(UVM_HOTPLUG)
+ /* Variable memory size tests. */
+ ATF_TP_ADD_TC(tp, uvm_physseg_1MB);
+ ATF_TP_ADD_TC(tp, uvm_physseg_64MB);
+ ATF_TP_ADD_TC(tp, uvm_physseg_128MB);
+ ATF_TP_ADD_TC(tp, uvm_physseg_256MB);
+#endif /* UVM_HOTPLUG */
+
+ return atf_no_error();
+}
diff --git a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
index 95f0778..558b074 100755
--- a/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
+++ b/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_grep.sh,v 1.2 2013/05/17 15:39:17 christos Exp $
+# $NetBSD: t_grep.sh,v 1.3 2017/01/14 20:43:52 christos Exp $
#
# Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -43,20 +43,9 @@ binary_head()
}
binary_body()
{
- # Begin FreeBSD
- #
- # Generate stable output instead of depending on uname to match the
- # branded OS name of /bin/sh
- if true; then
dd if=/dev/zero count=1 of=test.file
echo -n "foobar" >> test.file
atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep foobar test.file
- else
- # End FreeBSD
- atf_check -o file:"$(atf_get_srcdir)/d_binary.out" grep $(uname) /bin/sh
- # Begin FreeBSD
- fi
- # End FreeBSD
}
atf_test_case recurse
@@ -70,15 +59,7 @@ recurse_body()
echo -e "cod\ndover sole\nhaddock\nhalibut\npilchard" > recurse/d/fish
echo -e "cod\nhaddock\nplaice" > recurse/a/f/favourite-fish
- # Begin FreeBSD
- if true; then
- atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" -x "grep -r haddock recurse | sort"
- else
- # End FreeBSD
- atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" grep -r haddock recurse
- # Begin FreeBSD
- fi
- # End FreeBSD
+ atf_check -o file:"$(atf_get_srcdir)/d_recurse.out" -x "grep -r haddock recurse | sort"
}
atf_test_case recurse_symlink
diff --git a/contrib/netbsd-tests/usr.bin/mixerctl/t_mixerctl.sh b/contrib/netbsd-tests/usr.bin/mixerctl/t_mixerctl.sh
new file mode 100755
index 0000000..94c0bdf
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/mixerctl/t_mixerctl.sh
@@ -0,0 +1,51 @@
+# $NetBSD: t_mixerctl.sh,v 1.1 2017/01/02 15:40:09 christos Exp $
+
+atf_test_case noargs_usage
+noargs_usage_head() {
+ atf_set "descr" "Ensure mixerctl(1) with no args prints a usage message"
+}
+noargs_usage_body() {
+ atf_check -s exit:0 -o not-empty -e ignore \
+ mixerctl
+}
+
+atf_test_case showvalue
+showvalue_head() {
+ atf_set "descr" "Ensure mixerctl(1) can print the value for all variables"
+}
+showvalue_body() {
+ for var in $(mixerctl -a | awk -F= '{print $1}'); do
+ atf_check -s exit:0 -e ignore -o match:"^${var}=" \
+ mixerctl ${var}
+ done
+}
+
+atf_test_case nflag
+nflag_head() {
+ atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output"
+}
+nflag_body() {
+ varname="$(mixerctl -a | head -1 | awk -F= '{print $1}')"
+
+ atf_check -s exit:0 -o match:"${varname}" -e ignore \
+ mixerctl ${varname}
+
+ atf_check -s exit:0 -o not-match:"${varname}" -e ignore \
+ mixerctl -n ${varname}
+}
+
+atf_test_case nonexistant_device
+nonexistant_device_head() {
+ atf_set "descr" "Ensure mixerctl(1) complains if provided a nonexistant mixer device"
+}
+nonexistant_device_body() {
+ atf_check -s not-exit:0 -o ignore -e match:"No such file" \
+ mixerctl -d /a/b/c/d/e
+}
+
+atf_init_test_cases() {
+ atf_add_test_case noargs_usage
+ atf_add_test_case showvalue
+ atf_add_test_case nflag
+ atf_add_test_case nonexistant_device
+}
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_basic.in b/contrib/netbsd-tests/usr.bin/uniq/d_basic.in
new file mode 100644
index 0000000..52a24bc
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_basic.in
@@ -0,0 +1,4 @@
+1
+12
+1
+1
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_basic.out b/contrib/netbsd-tests/usr.bin/uniq/d_basic.out
new file mode 100644
index 0000000..d44fcba
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_basic.out
@@ -0,0 +1,3 @@
+1
+12
+1
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_counts.out b/contrib/netbsd-tests/usr.bin/uniq/d_counts.out
new file mode 100644
index 0000000..bb1c86b
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_counts.out
@@ -0,0 +1,6 @@
+ 1 #01 foo0 bar0 foo1 bar1
+ 1 #02 bar0 foo1 bar1 foo1
+ 1 #03 foo0 bar0 foo1 bar1
+ 1 #04
+ 2 #05 foo0 bar0 foo1 bar1
+ 1 #07 bar0 foo1 bar1 foo0
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_input.in b/contrib/netbsd-tests/usr.bin/uniq/d_input.in
new file mode 100644
index 0000000..c32c44d
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_input.in
@@ -0,0 +1,7 @@
+#01 foo0 bar0 foo1 bar1
+#02 bar0 foo1 bar1 foo1
+#03 foo0 bar0 foo1 bar1
+#04
+#05 foo0 bar0 foo1 bar1
+#06 foo0 bar0 foo1 bar1
+#07 bar0 foo1 bar1 foo0
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_show_duplicates.out b/contrib/netbsd-tests/usr.bin/uniq/d_show_duplicates.out
new file mode 100644
index 0000000..45f4be7
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_show_duplicates.out
@@ -0,0 +1 @@
+#05 foo0 bar0 foo1 bar1
diff --git a/contrib/netbsd-tests/usr.bin/uniq/d_show_uniques.out b/contrib/netbsd-tests/usr.bin/uniq/d_show_uniques.out
new file mode 100644
index 0000000..1cc2ecb
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/d_show_uniques.out
@@ -0,0 +1,5 @@
+#01 foo0 bar0 foo1 bar1
+#02 bar0 foo1 bar1 foo1
+#03 foo0 bar0 foo1 bar1
+#04
+#07 bar0 foo1 bar1 foo0
diff --git a/contrib/netbsd-tests/usr.bin/uniq/t_uniq.sh b/contrib/netbsd-tests/usr.bin/uniq/t_uniq.sh
new file mode 100755
index 0000000..d90a4d5
--- /dev/null
+++ b/contrib/netbsd-tests/usr.bin/uniq/t_uniq.sh
@@ -0,0 +1,97 @@
+# $NetBSD: t_uniq.sh,v 1.1 2016/10/22 14:13:39 abhinav Exp $
+#
+# Copyright (c) 2016 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Abhinav Upadhyay
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+atf_test_case basic
+basic_head()
+{
+ atf_set "descr" "Checks the basic functionality"
+}
+basic_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_basic.out uniq \
+ $(atf_get_srcdir)/d_basic.in
+}
+
+atf_test_case test_counts
+test_counts_head()
+{
+ atf_set "descr" "Tests the -c option, comparing each line of the input" \
+ "file data starting from the second field"
+}
+test_counts_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_counts.out uniq -c -f 1 \
+ $(atf_get_srcdir)/d_input.in
+}
+
+atf_test_case show_duplicates
+show_duplicates_head()
+{
+ atf_set "descr" "Checks the -d option, comparing each line of the input" \
+ "file data starting from the second field"
+}
+show_duplicates_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_show_duplicates.out uniq -d -f 1 \
+ $(atf_get_srcdir)/d_input.in
+}
+
+atf_test_case show_uniques
+show_uniques_head()
+{
+ atf_set "descr" "Checks the -u option, comparing each line of the input" \
+ "file data starting from the second field"
+}
+show_uniques_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_show_uniques.out uniq -u -f 1 \
+ $(atf_get_srcdir)/d_input.in
+}
+
+atf_test_case show_duplicates_from_third_character
+show_duplicates_from_third_character_head()
+{
+ atf_set "descr" "Checks the -d option, comparing each line of the input" \
+ "file data starting from the third character (-s option)"
+}
+show_duplicates_from_third_character_body()
+{
+ atf_check -o empty uniq -d -s 2 $(atf_get_srcdir)/d_input.in
+
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case basic
+ atf_add_test_case test_counts
+ atf_add_test_case show_duplicates
+ atf_add_test_case show_uniques
+ atf_add_test_case show_duplicates_from_third_character
+}
diff --git a/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh b/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
index d84dd3b..58fc7db 100755
--- a/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
+++ b/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_mtree.sh,v 1.6 2013/02/05 16:49:42 christos Exp $
+# $NetBSD: t_mtree.sh,v 1.7 2017/01/14 20:45:16 christos Exp $
#
# Copyright (c) 2009, 2012 The NetBSD Foundation, Inc.
# All rights reserved.
diff --git a/contrib/tzcode/stdtime/localtime.c b/contrib/tzcode/stdtime/localtime.c
index ad95082..632a8d4 100644
--- a/contrib/tzcode/stdtime/localtime.c
+++ b/contrib/tzcode/stdtime/localtime.c
@@ -1453,14 +1453,13 @@ localtime(const time_t *const timep)
}
_RWLOCK_RDLOCK(&lcl_rwlock);
tzset_basic(1);
- localsub(timep, 0L, p_tm);
+ p_tm = localsub(timep, 0L, p_tm);
_RWLOCK_UNLOCK(&lcl_rwlock);
- return(p_tm);
} else {
tzset_basic(0);
- localsub(timep, 0L, &tm);
- return(&tm);
+ p_tm = localsub(timep, 0L, &tm);
}
+ return(p_tm);
}
/*
@@ -1472,7 +1471,7 @@ localtime_r(const time_t *const timep, struct tm *tmp)
{
_RWLOCK_RDLOCK(&lcl_rwlock);
tzset_basic(1);
- localsub(timep, 0L, tmp);
+ tmp = localsub(timep, 0L, tmp);
_RWLOCK_UNLOCK(&lcl_rwlock);
return tmp;
}
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index ac2f305..e84a06a 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -632,6 +632,8 @@
..
soelim
..
+ tail
+ ..
tar
..
timeout
@@ -646,6 +648,8 @@
..
uuencode
..
+ uniq
+ ..
xargs
..
xinstall
diff --git a/etc/ntp.conf b/etc/ntp.conf
index 64edd93..977295e 100644
--- a/etc/ntp.conf
+++ b/etc/ntp.conf
@@ -11,28 +11,43 @@
#
#
-# The following three servers will give you a random set of three
-# NTP servers geographically close to you.
-# See http://www.pool.ntp.org/ for details. Note, the pool encourages
+# Set the target and limit for adding servers configured via pool statements
+# or discovered dynamically via mechanisms such as broadcast and manycast.
+# Ntpd automatically adds maxclock-1 servers from configured pools, and may
+# add as many as maxclock*2 if necessary to ensure that at least minclock
+# servers are providing good consistant time.
+#
+tos minclock 3 maxclock 6
+
+#
+# The following pool statement will give you a random set of NTP servers
+# geographically close to you. A single pool statement adds multiple
+# servers from the pool, according to the tos minclock/maxclock targets.
+# See http://www.pool.ntp.org/ for details. Note, pool.ntp.org encourages
# users with a static IP and good upstream NTP servers to add a server
# to the pool. See http://www.pool.ntp.org/join.html if you are interested.
#
# The option `iburst' is used for faster initial synchronization.
#
-server 0.freebsd.pool.ntp.org iburst
-server 1.freebsd.pool.ntp.org iburst
-server 2.freebsd.pool.ntp.org iburst
-#server 3.freebsd.pool.ntp.org iburst
+pool 0.freebsd.pool.ntp.org iburst
#
# If you want to pick yourself which country's public NTP server
-# you want sync against, comment out the above servers, uncomment
-# the next ones and replace CC with the country's abbreviation.
-# Make sure that the hostnames resolve to a proper IP address!
+# you want to sync against, comment out the above pool, uncomment
+# the next one, and replace CC with the country's abbreviation.
+# Make sure that the hostname resolves to a proper IP address!
+#
+# pool 0.CC.pool.ntp.org iburst
+
+#
+# To configure a specific server, such as an organization-wide local
+# server, add lines similar to the following. One or more specific
+# servers can be configured in addition to, or instead of, any server
+# pools specified above. When both are configured, ntpd first adds all
+# the specific servers, then adds servers from the pool until the tos
+# minclock/maxclock targets are met.
#
-# server 0.CC.pool.ntp.org iburst
-# server 1.CC.pool.ntp.org iburst
-# server 2.CC.pool.ntp.org iburst
+#server time.my-internal.org iburst
#
# Security:
@@ -40,11 +55,17 @@ server 2.freebsd.pool.ntp.org iburst
# By default, only allow time queries and block all other requests
# from unauthenticated clients.
#
+# The "restrict source" line allows peers to be mobilized when added by
+# ntpd from a pool, but does not enable mobilizing a new peer association
+# by other dynamic means (broadcast, manycast, ntpq commands, etc).
+#
# See http://support.ntp.org/bin/view/Support/AccessRestrictions
# for more information.
#
-restrict default limited kod nomodify notrap nopeer noquery
-restrict -6 default limited kod nomodify notrap nopeer noquery
+restrict default limited kod nomodify notrap noquery nopeer
+restrict -6 default limited kod nomodify notrap noquery nopeer
+restrict source limited kod nomodify notrap noquery
+
#
# Alternatively, the following rules would block all unauthorized access.
#
@@ -65,7 +86,6 @@ restrict -6 default limited kod nomodify notrap nopeer noquery
# The following settings allow unrestricted access from the localhost
restrict 127.0.0.1
restrict -6 ::1
-restrict 127.127.1.0
#
# If a server loses sync with all upstream servers, NTP clients
diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate
index 8f5b273..90f9589 100755
--- a/etc/rc.d/ntpdate
+++ b/etc/rc.d/ntpdate
@@ -20,7 +20,7 @@ ntpdate_start()
if [ -z "$ntpdate_hosts" -a -f "$ntpdate_config" ]; then
ntpdate_hosts=`awk '
/^server[ \t]*127.127/ {next}
- /^(server|peer)/ {
+ /^(server|peer|pool)/ {
if ($2 ~/^-/) {print $3}
else {print $2}}
' < "$ntpdate_config"`
diff --git a/gnu/usr.bin/cc/cc_tools/freebsd-native.h b/gnu/usr.bin/cc/cc_tools/freebsd-native.h
index bd3ce1e..b92a596 100644
--- a/gnu/usr.bin/cc/cc_tools/freebsd-native.h
+++ b/gnu/usr.bin/cc/cc_tools/freebsd-native.h
@@ -8,7 +8,7 @@
/* Fake out gcc/config/freebsd<version>.h. */
#define FBSD_MAJOR 11
-#define FBSD_CC_VER 1100002 /* form like __FreeBSD_version */
+#define FBSD_CC_VER 1100003 /* form like __FreeBSD_version */
#undef SYSTEM_INCLUDE_DIR /* We don't need one for now. */
#undef TOOL_INCLUDE_DIR /* We don't need one for now. */
diff --git a/lib/libc/aarch64/Makefile.inc b/lib/libc/aarch64/Makefile.inc
index 5f17200..f059154 100644
--- a/lib/libc/aarch64/Makefile.inc
+++ b/lib/libc/aarch64/Makefile.inc
@@ -5,5 +5,5 @@
# Long double is quad precision
GDTOASRCS+=strtorQ.c
-MDSRCS+=machdep_ldisQ.c
+SRCS+=machdep_ldisQ.c
SYM_MAPS+=${LIBC_SRCTOP}/aarch64/Symbol.map
diff --git a/lib/libc/amd64/Makefile.inc b/lib/libc/amd64/Makefile.inc
index 95fddef..cd8f0f1 100644
--- a/lib/libc/amd64/Makefile.inc
+++ b/lib/libc/amd64/Makefile.inc
@@ -5,5 +5,5 @@
# Long double is 80 bits
GDTOASRCS+=strtorx.c
-MDSRCS+=machdep_ldisx.c
+SRCS+=machdep_ldisx.c
SYM_MAPS+=${LIBC_SRCTOP}/amd64/Symbol.map
diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc
index 46571ab..425de40 100644
--- a/lib/libc/amd64/string/Makefile.inc
+++ b/lib/libc/amd64/string/Makefile.inc
@@ -1,4 +1,13 @@
# $FreeBSD$
-MDSRCS+= bcmp.S bcopy.S bzero.S memcmp.S memcpy.S memmove.S memset.S \
- strcat.S strcmp.S stpcpy.S strcpy.c
+MDSRCS+= \
+ bcmp.S \
+ bcopy.S \
+ bzero.S \
+ memcmp.S \
+ memcpy.S \
+ memmove.S \
+ memset.S \
+ strcat.S \
+ strcmp.S \
+ stpcpy.S
diff --git a/lib/libc/arm/Makefile.inc b/lib/libc/arm/Makefile.inc
index c263ae7..eaf361e 100644
--- a/lib/libc/arm/Makefile.inc
+++ b/lib/libc/arm/Makefile.inc
@@ -6,7 +6,7 @@
SOFTFLOAT_BITS=32
# Long double is just double precision.
-MDSRCS+=machdep_ldisd.c
+SRCS+=machdep_ldisd.c
SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol.map
.include "${LIBC_SRCTOP}/arm/aeabi/Makefile.inc"
diff --git a/lib/libc/arm/string/Makefile.inc b/lib/libc/arm/string/Makefile.inc
index 0ba43e6..cf3175e 100644
--- a/lib/libc/arm/string/Makefile.inc
+++ b/lib/libc/arm/string/Makefile.inc
@@ -1,6 +1,13 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
# $FreeBSD$
-MDSRCS+=bcmp.c bcopy.S bzero.S ffs.S memchr.c memcmp.S memcpy.S \
- memmove.S memset.S strcat.c strchr.c strcmp.S strcpy.c strlen.S \
- strncmp.S strrchr.c swab.c wcschr.c wcscmp.c wcslen.c wmemchr.c
+MDSRCS+= \
+ bcopy.S \
+ bzero.S \
+ ffs.S \
+ memcmp.S \
+ memcpy.S \
+ memmove.S \
+ memset.S \
+ strcmp.S \
+ strlen.S \
+ strncmp.S
diff --git a/lib/libc/gen/tcsendbreak.3 b/lib/libc/gen/tcsendbreak.3
index a7e86d0..dd43a29 100644
--- a/lib/libc/gen/tcsendbreak.3
+++ b/lib/libc/gen/tcsendbreak.3
@@ -28,7 +28,7 @@
.\" @(#)tcsendbreak.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd January 11, 2017
.Dt TCSENDBREAK 3
.Os
.Sh NAME
@@ -137,17 +137,44 @@ is not a terminal.
A signal interrupted the
.Fn tcdrain
function.
+.It Bq Er EWOULDBLOCK
+The configured timeout expired before the
+.Fn tcdrain
+function could write all buffered output.
.El
.Sh SEE ALSO
.Xr tcsetattr 3 ,
-.Xr termios 4
+.Xr termios 4 ,
+.Xr tty 4 ,
+.Xr comcontrol 8
.Sh STANDARDS
The
.Fn tcsendbreak ,
-.Fn tcdrain ,
.Fn tcflush
and
.Fn tcflow
functions are expected to be compliant with the
.St -p1003.1-88
specification.
+.Pp
+The
+.Fn tcdrain
+function is expected to be compliant with
+.St -p1003.1-88
+when the drain wait value is set to zero with
+.Xr comcontrol 8 ,
+or with
+.Xr ioctl 2
+.Va TIOCSDRAINWAIT ,
+or with
+.Xr sysctl 8
+.Va kern.tty_drainwait .
+A non-zero drain wait value can result in
+.Fn tcdrain
+returning
+.Va EWOULDBLOCK
+without writing all output.
+The default value for
+.Va kern.tty_drainwait
+is 300 seconds.
+
diff --git a/lib/libc/i386/Makefile.inc b/lib/libc/i386/Makefile.inc
index 627311c..4470cdb 100644
--- a/lib/libc/i386/Makefile.inc
+++ b/lib/libc/i386/Makefile.inc
@@ -2,5 +2,5 @@
# Long double is 80 bits
GDTOASRCS+=strtorx.c
-MDSRCS+=machdep_ldisx.c
+SRCS+=machdep_ldisx.c
SYM_MAPS+=${LIBC_SRCTOP}/i386/Symbol.map
diff --git a/lib/libc/i386/string/Makefile.inc b/lib/libc/i386/string/Makefile.inc
index f574c8f..17170ee 100644
--- a/lib/libc/i386/string/Makefile.inc
+++ b/lib/libc/i386/string/Makefile.inc
@@ -1,6 +1,23 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
# $FreeBSD$
-MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S memcpy.S memmove.S \
- memset.S strcat.S strchr.S strcmp.S strcpy.S strncmp.S strrchr.S \
- swab.S wcschr.S wcscmp.S wcslen.S wmemchr.S
+MDSRCS+= \
+ bcmp.S \
+ bcopy.S \
+ bzero.S \
+ ffs.S \
+ memchr.S \
+ memcmp.S \
+ memcpy.S \
+ memmove.S \
+ memset.S \
+ strcat.S \
+ strchr.S \
+ strcmp.S \
+ strcpy.S \
+ strncmp.S \
+ strrchr.S \
+ swab.S \
+ wcschr.S \
+ wcscmp.S \
+ wcslen.S \
+ wmemchr.S
diff --git a/lib/libc/mips/Makefile.inc b/lib/libc/mips/Makefile.inc
index 4ec20d4..4b18097 100644
--- a/lib/libc/mips/Makefile.inc
+++ b/lib/libc/mips/Makefile.inc
@@ -3,5 +3,5 @@
CFLAGS+=-DSOFTFLOAT
-MDSRCS+= machdep_ldisd.c
+SRCS+= machdep_ldisd.c
SYM_MAPS+= ${LIBC_SRCTOP}/mips/Symbol.map
diff --git a/lib/libc/mips/gdtoa/Makefile.inc b/lib/libc/mips/gdtoa/Makefile.inc
deleted file mode 100644
index dd6268c..0000000
--- a/lib/libc/mips/gdtoa/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.1 2006/03/15 17:35:18 kleink Exp $
-# $FreeBSD$
-
-SRCS+= strtof.c
diff --git a/lib/libc/mips/gdtoa/arith.h b/lib/libc/mips/gdtoa/arith.h
deleted file mode 100644
index 8b700f8..0000000
--- a/lib/libc/mips/gdtoa/arith.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $NetBSD: arith.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */
-/* $FreeBSD$ */
-
-#include <machine/endian.h>
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define IEEE_BIG_ENDIAN
-#else
-#define IEEE_LITTLE_ENDIAN
-#endif
diff --git a/lib/libc/mips/string/Makefile.inc b/lib/libc/mips/string/Makefile.inc
index f37b9af..266446c 100644
--- a/lib/libc/mips/string/Makefile.inc
+++ b/lib/libc/mips/string/Makefile.inc
@@ -1,8 +1,13 @@
-# $NetBSD: Makefile.inc,v 1.2 2000/10/10 21:51:54 jeffs Exp $
# $FreeBSD$
-SRCS+= bcmp.S bcopy.S bzero.S ffs.S memchr.c memcmp.c memset.c \
- memcpy.S memmove.S \
- strcat.c strchr.S strcmp.S strcpy.c strcspn.c strlen.S \
- strncat.c strncmp.c strncpy.c strrchr.S strpbrk.c strsep.c \
- strspn.c strstr.c swab.c
+MDSRCS+= \
+ bcmp.S \
+ bcopy.S \
+ bzero.S \
+ ffs.S \
+ memcpy.S \
+ memmove.S \
+ strchr.S \
+ strcmp.S \
+ strlen.S \
+ strrchr.S
diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c
index 4de1df3..d8bc2a7f 100644
--- a/lib/libc/net/nsdispatch.c
+++ b/lib/libc/net/nsdispatch.c
@@ -349,20 +349,20 @@ nss_configure(void)
path = getenv("NSSWITCH_CONF");
if (path == NULL)
#endif
- path = _PATH_NS_CONF;
+ path = _PATH_NS_CONF;
if (stat(path, &statbuf) != 0)
return (0);
if (statbuf.st_mtime <= confmod)
return (0);
if (isthreaded) {
- (void)_pthread_rwlock_unlock(&nss_lock);
- result = _pthread_rwlock_wrlock(&nss_lock);
- if (result != 0)
- return (result);
- if (stat(path, &statbuf) != 0)
- goto fin;
- if (statbuf.st_mtime <= confmod)
- goto fin;
+ (void)_pthread_rwlock_unlock(&nss_lock);
+ result = _pthread_rwlock_wrlock(&nss_lock);
+ if (result != 0)
+ return (result);
+ if (stat(path, &statbuf) != 0)
+ goto fin;
+ if (statbuf.st_mtime <= confmod)
+ goto fin;
}
_nsyyin = fopen(path, "re");
if (_nsyyin == NULL)
@@ -371,27 +371,27 @@ nss_configure(void)
(vector_free_elem)ns_dbt_free);
VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod),
(vector_free_elem)ns_mod_free);
+ if (confmod == 0)
+ (void)atexit(nss_atexit);
nss_load_builtin_modules();
_nsyyparse();
(void)fclose(_nsyyin);
vector_sort(_nsmap, _nsmapsize, sizeof(*_nsmap), string_compare);
- if (confmod == 0)
- (void)atexit(nss_atexit);
confmod = statbuf.st_mtime;
#ifdef NS_CACHING
handle = libc_dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if (handle != NULL) {
nss_cache_cycle_prevention_func = dlsym(handle,
- "_nss_cache_cycle_prevention_function");
+ "_nss_cache_cycle_prevention_function");
dlclose(handle);
}
#endif
fin:
if (isthreaded) {
- (void)_pthread_rwlock_unlock(&nss_lock);
- if (result == 0)
- result = _pthread_rwlock_rdlock(&nss_lock);
+ (void)_pthread_rwlock_unlock(&nss_lock);
+ if (result == 0)
+ result = _pthread_rwlock_rdlock(&nss_lock);
}
return (result);
}
diff --git a/lib/libc/powerpc/Makefile.inc b/lib/libc/powerpc/Makefile.inc
index 42982671..afc403d 100644
--- a/lib/libc/powerpc/Makefile.inc
+++ b/lib/libc/powerpc/Makefile.inc
@@ -3,5 +3,5 @@
SRCS+= trivial-vdso_tc.c
# Long double is 64-bits
-MDSRCS+=machdep_ldisd.c
+SRCS+=machdep_ldisd.c
SYM_MAPS+=${LIBC_SRCTOP}/powerpc/Symbol.map
diff --git a/lib/libc/powerpc64/Makefile.inc b/lib/libc/powerpc64/Makefile.inc
index 8e9bcc5..a00ad71 100644
--- a/lib/libc/powerpc64/Makefile.inc
+++ b/lib/libc/powerpc64/Makefile.inc
@@ -3,5 +3,5 @@
SRCS+= trivial-vdso_tc.c
# Long double is 64-bits
-MDSRCS+=machdep_ldisd.c
+SRCS+=machdep_ldisd.c
SYM_MAPS+=${LIBC_SRCTOP}/powerpc64/Symbol.map
diff --git a/lib/libc/riscv/Makefile.inc b/lib/libc/riscv/Makefile.inc
index b221903..9df72b4 100644
--- a/lib/libc/riscv/Makefile.inc
+++ b/lib/libc/riscv/Makefile.inc
@@ -5,5 +5,5 @@
# Long double is quad precision
GDTOASRCS+=strtorQ.c
-MDSRCS+=machdep_ldisQ.c
+SRCS+=machdep_ldisQ.c
SYM_MAPS+=${LIBC_SRCTOP}/riscv/Symbol.map
diff --git a/lib/libc/sparc64/Makefile.inc b/lib/libc/sparc64/Makefile.inc
index 74fb7cd..da507d2 100644
--- a/lib/libc/sparc64/Makefile.inc
+++ b/lib/libc/sparc64/Makefile.inc
@@ -9,5 +9,5 @@ SRCS+= trivial-vdso_tc.c
# Long double is quad precision
GDTOASRCS+=strtorQ.c
-MDSRCS+=machdep_ldisQ.c
+SRCS+=machdep_ldisQ.c
SYM_MAPS+=${LIBC_SRCTOP}/sparc64/Symbol.map
diff --git a/lib/libc/sparc64/string/Makefile.inc b/lib/libc/sparc64/string/Makefile.inc
deleted file mode 100644
index e8c0da7..0000000
--- a/lib/libc/sparc64/string/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-# $FreeBSD$
diff --git a/lib/libc/sys/kenv.2 b/lib/libc/sys/kenv.2
index dc17388..06f7081 100644
--- a/lib/libc/sys/kenv.2
+++ b/lib/libc/sys/kenv.2
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 17, 2002
+.Dd February 20, 2017
.Dt KENV 2
.Os
.Sh NAME
@@ -51,71 +51,59 @@ The
argument can be one of the following:
.Bl -tag -width ".Dv KENV_UNSET"
.It Dv KENV_GET
-Returns the value associated with the named kernel environment variable.
-If the variable is not found, \-1 is returned and
-the global variable
-.Va errno
-is set to
-.Er ENOENT .
-Only the number of bytes available in
+Get the
+.Fa value
+of the variable with the given
+.Fa name .
+The size of the
.Fa value
-are copied out.
+buffer is given by
+.Fa len ,
+which should be at least
+.Dv KENV_MVALLEN
++ 1 bytes to avoid truncation and to ensure NUL termination.
.It Dv KENV_SET
-Sets or adds a new kernel environment variable.
+Set or add a variable.
+The
+.Fa name
+and
+.Fa value
+are limited to
+.Dv KENV_MNAMELEN
+and
+.Dv KENV_MVALLEN
+characters, respectively
+.Pq not including the NUL terminator.
+The
+.Fa len
+argument indicates the length of the
+.Fa value
+and must include the NUL terminator.
This option is only available to the superuser.
.It Dv KENV_UNSET
-Unsets the kernel environment variable
+Unset the variable with the given
.Fa name .
-If the variable does not exist, \-1 is returned and
-the global variable
-.Va errno
-is set to
-.Er EINVAL .
+The
+.Fa value
+and
+.Fa len
+arguments are ignored.
This option is only available to the superuser.
.It Dv KENV_DUMP
-Dumps as much of the kernel environment as will fit in
-.Fa value .
+Dump as much of the kernel environment as will fit in
+.Fa value ,
+whose size is given in
+.Fa len .
If
.Fa value
is
.Dv NULL ,
.Fn kenv
will return the number of bytes required to copy out the entire environment.
-.El
-.Pp
-The
-.Fa name
-argument is the name of the environment variable to be affected.
-In the case of
-.Dv KENV_DUMP
-it is ignored.
-.Pp
The
-.Fa value
-argument contains either the value to set the environment variable
.Fa name
-to in the case of
-.Dv KENV_SET ,
-or it points to the location where
-.Fn kenv
-should copy return data to in the case of
-.Dv KENV_DUMP
-and
-.Dv KENV_GET .
-If
-.Fa value
-is
-.Dv NULL
-in the case of
-.Dv KENV_DUMP ,
-.Fn kenv
-will return the number of bytes required to copy out the entire environment.
-.Pp
-The
-.Fa len
-argument indicates how many bytes of storage
-.Fa value
-points to.
+is ignored.
+.El
.Sh RETURN VALUES
The
.Fn kenv
@@ -148,23 +136,31 @@ is not a valid option, or the length of the
is less than 1 for a
.Dv KENV_SET .
.It Bq Er ENOENT
-no value could be found for
+No value could be found for
.Fa name
for a
-.Dv KENV_SET
+.Dv KENV_GET
or
.Dv KENV_UNSET .
.It Bq Er EPERM
-a user other than the superuser attempted to set or unset a kernel
+A user other than the superuser attempted to set or unset a kernel
environment variable.
.It Bq Er EFAULT
-bad address was encountered while attempting to copy in user arguments,
+A bad address was encountered while attempting to copy in user arguments
or copy out value(s).
.It Bq Er ENAMETOOLONG
-the name of a variable supplied by the user is longer than
+The
+.Fa name
+or the
+.Fa value
+is longer than
.Dv KENV_MNAMELEN
-or the value of a variable is longer than
-.Dv KENV_MVALLEN .
+or
+.Dv KENV_MVALLEN
+characters, respectively, or
+.Fa len
+did not include the NUL terminator for a
+.Dv KENV_SET .
.El
.Sh SEE ALSO
.Xr kenv 1
diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile
index 1e2cd29..7811d45 100644
--- a/lib/libc/tests/hash/Makefile
+++ b/lib/libc/tests/hash/Makefile
@@ -32,8 +32,7 @@ ${PACKAGE}DATA_FILES+= data/sha1test2-out
LIBADD+= md
LIBADD.sha2_test+= crypto
-CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh/openbsd-compat
-CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh
+CFLAGS.h_hash+= -I${SRCTOP}/lib/libnetbsd
.include "../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c
index d9851ef..5730a62 100644
--- a/lib/libc/tests/nss/getgr_test.c
+++ b/lib/libc/tests/nss/getgr_test.c
@@ -176,7 +176,7 @@ sdump_group(struct group *grp, char *buffer, size_t buflen)
char **cp;
int written;
- written = snprintf(buffer, buflen, "%s %s %d",
+ written = snprintf(buffer, buflen, "%s:%s:%d:",
grp->gr_name, grp->gr_passwd, grp->gr_gid);
buffer += written;
if (written > buflen)
@@ -186,7 +186,8 @@ sdump_group(struct group *grp, char *buffer, size_t buflen)
if (grp->gr_mem != NULL) {
if (*(grp->gr_mem) != '\0') {
for (cp = grp->gr_mem; *cp; ++cp) {
- written = snprintf(buffer, buflen, " %s",*cp);
+ written = snprintf(buffer, buflen, "%s%s",
+ cp == grp->gr_mem ? "" : ",", *cp);
buffer += written;
if (written > buflen)
return;
@@ -196,9 +197,9 @@ sdump_group(struct group *grp, char *buffer, size_t buflen)
return;
}
} else
- snprintf(buffer, buflen, " nomem");
+ snprintf(buffer, buflen, "nomem");
} else
- snprintf(buffer, buflen, " (null)");
+ snprintf(buffer, buflen, "(null)");
}
static int
@@ -206,6 +207,7 @@ group_read_snapshot_func(struct group *grp, char *line)
{
StringList *sl;
char *s, *ps, *ts;
+ const char *sep;
int i;
printf("1 line read from snapshot:\n%s\n", line);
@@ -213,8 +215,9 @@ group_read_snapshot_func(struct group *grp, char *line)
i = 0;
sl = NULL;
ps = line;
+ sep = ":";
memset(grp, 0, sizeof(struct group));
- while ((s = strsep(&ps, " ")) != NULL) {
+ while ((s = strsep(&ps, sep)) != NULL) {
switch (i) {
case 0:
grp->gr_name = strdup(s);
@@ -235,6 +238,8 @@ group_read_snapshot_func(struct group *grp, char *line)
grp->gr_passwd = NULL;
return (-1);
}
+ /* Change to parsing groups. */
+ sep = ",";
break;
default:
@@ -474,6 +479,7 @@ fin:
#define SNAPSHOT_FILE "snapshot_grp"
+ATF_TC_WITHOUT_HEAD(getgrent);
ATF_TC_BODY(getgrent, tc)
{
@@ -525,7 +531,6 @@ ATF_TC_BODY(getgrnam_with_snapshot, tc)
ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0);
}
-ATF_TC_WITHOUT_HEAD(getgrent);
ATF_TP_ADD_TCS(tp)
{
diff --git a/lib/libc/tests/regex/Makefile b/lib/libc/tests/regex/Makefile
index c4f4351..b16f503 100644
--- a/lib/libc/tests/regex/Makefile
+++ b/lib/libc/tests/regex/Makefile
@@ -6,7 +6,8 @@ PACKAGE= tests
BINDIR= ${TESTSDIR}
-IMPLEMENTATION?= -DREGEX_SPENCER
+# SKIP_LEFTASSOC -> these testcases fail on FreeBSD.
+IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC
CFLAGS.h_regex+=-I${TESTSRC} -I${.CURDIR:H:H}/regex
PROGS+= h_regex
diff --git a/lib/libcam/scsi_cmdparse.c b/lib/libcam/scsi_cmdparse.c
index 8b43066..4561b0b 100644
--- a/lib/libcam/scsi_cmdparse.c
+++ b/lib/libcam/scsi_cmdparse.c
@@ -128,14 +128,14 @@ do_buff_decode(u_int8_t *buff, size_t len,
*(va_arg(*ap, int *)) = (ARG); \
assigned++; \
} \
- field_name[0] = 0; \
+ field_name[0] = '\0'; \
suppress = 0; \
} while (0)
u_char bits = 0; /* For bit fields */
int shift = 0; /* Bits already shifted out */
suppress = 0;
- field_name[0] = 0;
+ field_name[0] = '\0';
while (!done) {
switch(letter = *fmt) {
@@ -169,9 +169,9 @@ do_buff_decode(u_int8_t *buff, size_t len,
fmt++;
}
- if (fmt)
+ if (*fmt != '\0')
fmt++; /* Skip '}' */
- field_name[i] = 0;
+ field_name[i] = '\0';
break;
}
@@ -255,7 +255,7 @@ do_buff_decode(u_int8_t *buff, size_t len,
break;
}
if (!suppress) {
- if (arg_put)
+ if (arg_put != NULL)
(*arg_put)(puthook,
(letter == 't' ? 'b' : letter),
&buff[ind], width, field_name);
@@ -268,7 +268,7 @@ do_buff_decode(u_int8_t *buff, size_t len,
for (p = dest + width - 1;
p >= dest && *p == ' ';
p--)
- *p = 0;
+ *p = '\0';
}
}
assigned++;
@@ -379,22 +379,22 @@ next_field(const char **pp, char *fmt, int *width_p, int *value_p, char *name,
field_size = 8; /* Default to byte field type... */
*fmt = 'i';
field_width = 1; /* 1 byte wide */
- if (name)
- *name = 0;
+ if (name != NULL)
+ *name = '\0';
state = BETWEEN_FIELDS;
while (state != DONE) {
switch(state) {
case BETWEEN_FIELDS:
- if (*p == 0)
+ if (*p == '\0')
state = DONE;
else if (isspace(*p))
p++;
else if (*p == '#') {
while (*p && *p != '\n')
p++;
- if (p)
+ if (*p != '\0')
p++;
} else if (*p == '{') {
int i = 0;
@@ -410,7 +410,7 @@ next_field(const char **pp, char *fmt, int *width_p, int *value_p, char *name,
}
if(name && i < n_name)
- name[i] = 0;
+ name[i] = '\0';
if (*p == '}')
p++;
@@ -530,7 +530,7 @@ next_field(const char **pp, char *fmt, int *width_p, int *value_p, char *name,
if (is_error) {
*error_p = 1;
- return 0;
+ return (0);
}
*error_p = 0;
@@ -568,7 +568,7 @@ do_encode(u_char *buff, size_t vec_max, size_t *used,
if (suppress)
value = 0;
else
- value = arg_get ?
+ value = arg_get != NULL ?
(*arg_get)(gethook, field_name) :
va_arg(*ap, int);
}
@@ -659,9 +659,9 @@ do_encode(u_char *buff, size_t vec_max, size_t *used,
*used = ind;
if (error)
- return -1;
+ return (-1);
- return encoded;
+ return (encoded);
}
int
@@ -672,8 +672,8 @@ csio_decode(struct ccb_scsiio *csio, const char *fmt, ...)
va_start(ap, fmt);
- retval = do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len, 0, 0,
- fmt, &ap);
+ retval = do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len,
+ NULL, NULL, fmt, &ap);
va_end(ap);
@@ -705,7 +705,7 @@ buff_decode(u_int8_t *buff, size_t len, const char *fmt, ...)
va_start(ap, fmt);
- retval = do_buff_decode(buff, len, 0, 0, fmt, &ap);
+ retval = do_buff_decode(buff, len, NULL, NULL, fmt, &ap);
va_end(ap);
@@ -723,7 +723,7 @@ buff_decode_visit(u_int8_t *buff, size_t len, const char *fmt,
* the arg_put function.
*/
if (arg_put == NULL)
- return(-1);
+ return (-1);
return (do_buff_decode(buff, len, arg_put, puthook, fmt, NULL));
}
@@ -779,20 +779,20 @@ csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr,
int retval;
if (csio == NULL)
- return(0);
+ return (0);
/*
* We need something to encode, but we can't get it without the
* arg_get function.
*/
if (arg_get == NULL)
- return(-1);
+ return (-1);
bzero(csio, sizeof(struct ccb_scsiio));
if ((retval = do_encode(csio->cdb_io.cdb_bytes, SCSI_MAX_CDBLEN,
&cmdlen, arg_get, gethook, cmd_spec, NULL)) == -1)
- return(retval);
+ return (retval);
cam_fill_csio(csio,
/* retries */ retry_count,
@@ -805,7 +805,7 @@ csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr,
/* cdb_len */ cmdlen,
/* timeout */ timeout ? timeout : 5000);
- return(retval);
+ return (retval);
}
int
@@ -819,7 +819,8 @@ csio_encode(struct ccb_scsiio *csio, const char *fmt, ...)
va_start(ap, fmt);
- retval = do_encode(csio->data_ptr, csio->dxfer_len, 0, 0, 0, fmt, &ap);
+ retval = do_encode(csio->data_ptr, csio->dxfer_len, NULL, NULL, NULL,
+ fmt, &ap);
va_end(ap);
@@ -836,9 +837,9 @@ buff_encode_visit(u_int8_t *buff, size_t len, const char *fmt,
* arg_get function.
*/
if (arg_get == NULL)
- return(-1);
+ return (-1);
- return (do_encode(buff, len, 0, arg_get, gethook, fmt, NULL));
+ return (do_encode(buff, len, NULL, arg_get, gethook, fmt, NULL));
}
int
@@ -851,8 +852,8 @@ csio_encode_visit(struct ccb_scsiio *csio, const char *fmt,
* arg_get function.
*/
if (arg_get == NULL)
- return(-1);
+ return (-1);
- return (do_encode(csio->data_ptr, csio->dxfer_len, 0, arg_get,
+ return (do_encode(csio->data_ptr, csio->dxfer_len, NULL, arg_get,
gethook, fmt, NULL));
}
diff --git a/lib/libclang_rt/profile/Makefile b/lib/libclang_rt/profile/Makefile
index e9110cf..74e79ce 100644
--- a/lib/libclang_rt/profile/Makefile
+++ b/lib/libclang_rt/profile/Makefile
@@ -4,6 +4,9 @@
LIB= clang_rt.profile-${CRTARCH}
+# This is needed for --coverage
+CFLAGS+= -fvisibility=default
+
SRCS+= profile/GCDAProfiling.c
SRCS+= profile/InstrProfiling.c
SRCS+= profile/InstrProfilingBuffer.c
diff --git a/lib/libcxxrt/Version.map b/lib/libcxxrt/Version.map
index 73ef707..39f98e3 100644
--- a/lib/libcxxrt/Version.map
+++ b/lib/libcxxrt/Version.map
@@ -254,10 +254,31 @@ CXXABI_1.3.1 {
__cxa_get_exception_ptr;
} CXXABI_1.3;
+CXXABI_1.3.5 {
+ extern "C++" {
+ "typeinfo for __int128 const*";
+ "typeinfo for __int128";
+ "typeinfo for __int128*";
+ "typeinfo for unsigned __int128 const*";
+ "typeinfo for unsigned __int128";
+ "typeinfo for unsigned __int128*";
+ };
+} CXXABI_1.3.1;
+
CXXABI_1.3.6 {
__cxa_deleted_virtual;
-} CXXABI_1.3.1;
+} CXXABI_1.3.5;
+CXXABI_1.3.9 {
+ extern "C++" {
+ "typeinfo name for __int128 const*";
+ "typeinfo name for __int128";
+ "typeinfo name for __int128*";
+ "typeinfo name for unsigned __int128 const*";
+ "typeinfo name for unsigned __int128";
+ "typeinfo name for unsigned __int128*";
+ };
+} CXXABI_1.3.6;
CXXRT_1.0 {
diff --git a/lib/libpam/modules/pam_krb5/pam_krb5.c b/lib/libpam/modules/pam_krb5/pam_krb5.c
index 8c72e28..810573b 100644
--- a/lib/libpam/modules/pam_krb5/pam_krb5.c
+++ b/lib/libpam/modules/pam_krb5/pam_krb5.c
@@ -239,6 +239,8 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
retval = PAM_SERVICE_ERR;
goto cleanup2;
}
+ krb5_get_init_creds_opt_set_default_flags(pam_context,
+ service, NULL, opts);
if (openpam_get_option(pamh, PAM_OPT_FORWARDABLE))
krb5_get_init_creds_opt_set_forwardable(opts, 1);
diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile
index aa0f25e..847cb62 100644
--- a/lib/libutil/Makefile
+++ b/lib/libutil/Makefile
@@ -35,7 +35,7 @@ MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \
property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \
_secure_path.3 trimdomain.3 uucplock.3 pw_util.3
MAN+= login.conf.5
-MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3
+MLINKS+=kld.3 kld_isloaded.3 kld.3 kld_load.3
MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3
MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \
login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \
@@ -57,9 +57,9 @@ MLINKS+=pidfile.3 pidfile_close.3 \
pidfile.3 pidfile_open.3 \
pidfile.3 pidfile_remove.3 \
pidfile.3 pidfile_write.3
-MLINKS+= property.3 property_find.3 property.3 properties_free.3
-MLINKS+= property.3 properties_read.3
-MLINKS+= pty.3 forkpty.3 pty.3 openpty.3
+MLINKS+=property.3 property_find.3 property.3 properties_free.3
+MLINKS+=property.3 properties_read.3
+MLINKS+=pty.3 forkpty.3 pty.3 openpty.3
MLINKS+=quotafile.3 quota_close.3 \
quotafile.3 quota_fsname.3 \
quotafile.3 quota_open.3 \
@@ -69,7 +69,7 @@ MLINKS+=quotafile.3 quota_close.3 \
quotafile.3 quota_write_limits.3 \
quotafile.3 quota_write_usage.3
MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \
- uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3
+ uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3
MLINKS+=pw_util.3 pw_copy.3 \
pw_util.3 pw_dup.3 \
pw_util.3 pw_edit.3 \
diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile
index a64747e..c08d6fe 100644
--- a/lib/msun/tests/Makefile
+++ b/lib/msun/tests/Makefile
@@ -51,7 +51,7 @@ TAP_TESTS_C+= conj_test
# https://llvm.org/bugs/show_bug.cgi?id=26081
TAP_TESTS_C+= csqrt_test
.endif
-TAP_TESTS_C+= ctrig_test
+ATF_TESTS_C+= ctrig_test
TAP_TESTS_C+= exponential_test
TAP_TESTS_C+= fenv_test
TAP_TESTS_C+= fma_test
diff --git a/lib/msun/tests/cexp_test.c b/lib/msun/tests/cexp_test.c
index 6be71ad..5505849 100644
--- a/lib/msun/tests/cexp_test.c
+++ b/lib/msun/tests/cexp_test.c
@@ -94,7 +94,7 @@ static const float finites[] =
/* Tests for 0 */
-void
+static void
test_zero(void)
{
@@ -109,10 +109,10 @@ test_zero(void)
* Tests for NaN. The signs of the results are indeterminate unless the
* imaginary part is 0.
*/
-void
-test_nan()
+static void
+test_nan(void)
{
- int i;
+ unsigned i;
/* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
/* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
@@ -142,10 +142,10 @@ test_nan()
ALL_STD_EXCEPT, 0, 0);
}
-void
+static void
test_inf(void)
{
- int i;
+ unsigned i;
/* cexp(x + inf i) = NaN + NaNi and raises invalid */
for (i = 0; i < nitems(finites); i++) {
@@ -184,10 +184,10 @@ test_inf(void)
ALL_STD_EXCEPT, 0, 1);
}
-void
+static void
test_reals(void)
{
- int i;
+ unsigned i;
for (i = 0; i < nitems(finites); i++) {
/* XXX could check exceptions more meticulously */
@@ -207,10 +207,10 @@ test_reals(void)
}
}
-void
+static void
test_imaginaries(void)
{
- int i;
+ unsigned i;
for (i = 0; i < nitems(finites); i++) {
printf("# Run %d..\n", i);
@@ -229,7 +229,7 @@ test_imaginaries(void)
}
}
-void
+static void
test_small(void)
{
static const double tests[] = {
@@ -242,7 +242,7 @@ test_small(void)
};
double a, b;
double x, y;
- int i;
+ unsigned i;
for (i = 0; i < nitems(tests); i += 4) {
printf("# Run %d..\n", i);
@@ -260,7 +260,7 @@ test_small(void)
}
/* Test inputs with a real part r that would overflow exp(r). */
-void
+static void
test_large(void)
{
@@ -288,7 +288,7 @@ test_large(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..7\n");
diff --git a/lib/msun/tests/conj_test.c b/lib/msun/tests/conj_test.c
index 7426f9e..960fed5 100644
--- a/lib/msun/tests/conj_test.c
+++ b/lib/msun/tests/conj_test.c
@@ -71,7 +71,7 @@ static const double tests[] = {
};
int
-main(int argc, char *argv[])
+main(void)
{
static const int ntests = sizeof(tests) / sizeof(tests[0]) / 2;
complex float in;
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
assert(fpequal(libcreall(in), __real__ in));
assert(fpequal(libcimagf(in), __imag__ in));
assert(fpequal(libcimag(in), __imag__ in));
- assert(fpequal(libcimagl(in), __imag__ in));
+ assert(fpequal(libcimagl(in), __imag__ in));
feclearexcept(FE_ALL_EXCEPT);
if (!cfpequal(libconjf(in), expected)) {
diff --git a/lib/msun/tests/csqrt_test.c b/lib/msun/tests/csqrt_test.c
index aa119d1..89de14b 100644
--- a/lib/msun/tests/csqrt_test.c
+++ b/lib/msun/tests/csqrt_test.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
* The latter two convert to float or double, respectively, and test csqrtf()
* and csqrt() with the same arguments.
*/
-long double complex (*t_csqrt)(long double complex);
+static long double complex (*t_csqrt)(long double complex);
static long double complex
_csqrtf(long double complex d)
@@ -82,7 +82,7 @@ assert_equal(long double complex d1, long double complex d2)
* exceptions.)
*/
static void
-test_finite()
+test_finite(void)
{
static const double tests[] = {
/* csqrt(a + bI) = x + yI */
@@ -125,7 +125,7 @@ test_finite()
double a, b;
double x, y;
- int i, j;
+ unsigned i, j;
for (i = 0; i < nitems(tests); i += 4) {
for (j = 0; j < nitems(mults); j++) {
@@ -143,7 +143,7 @@ test_finite()
* Test the handling of +/- 0.
*/
static void
-test_zeros()
+test_zeros(void)
{
assert_equal(t_csqrt(CMPLXL(0.0, 0.0)), CMPLXL(0.0, 0.0));
@@ -156,7 +156,7 @@ test_zeros()
* Test the handling of infinities when the other argument is not NaN.
*/
static void
-test_infinities()
+test_infinities(void)
{
static const double vals[] = {
0.0,
@@ -167,7 +167,7 @@ test_infinities()
-INFINITY,
};
- int i;
+ unsigned i;
for (i = 0; i < nitems(vals); i++) {
if (isfinite(vals[i])) {
@@ -187,7 +187,7 @@ test_infinities()
* Test the handling of NaNs.
*/
static void
-test_nans()
+test_nans(void)
{
assert(creall(t_csqrt(CMPLXL(INFINITY, NAN))) == INFINITY);
@@ -232,7 +232,7 @@ test_overflow(int maxexp)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..15\n");
diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c
index 475b6c5..c37e151 100644
--- a/lib/msun/tests/ctrig_test.c
+++ b/lib/msun/tests/ctrig_test.c
@@ -31,13 +31,15 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <assert.h>
+#include <sys/param.h>
#include <complex.h>
#include <fenv.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
+#include <atf-c.h>
+
#include "test-utils.h"
#pragma STDC FENV_ACCESS ON
@@ -60,9 +62,9 @@ __FBSDID("$FreeBSD$");
volatile long double complex _d = z; \
debug(" testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func, \
creall(_d), cimagl(_d), creall(result), cimagl(result)); \
- assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
- assert(cfpequal_cs((func)(_d), (result), (checksign))); \
- assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \
+ ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \
+ ATF_CHECK(cfpequal_cs((func)(_d), (result), (checksign))); \
+ ATF_CHECK(((void)(func), fetestexcept(exceptmask) == (excepts))); \
} while (0)
/*
@@ -74,7 +76,7 @@ __FBSDID("$FreeBSD$");
volatile long double complex _d = z; \
debug(" testing %s(%Lg + %Lg I) ~= %Lg + %Lg I\n", #func, \
creall(_d), cimagl(_d), creall(result), cimagl(result)); \
- assert(cfpequal_tol((func)(_d), (result), (tol), FPE_ABS_ZERO)); \
+ ATF_CHECK(cfpequal_tol((func)(_d), (result), (tol), FPE_ABS_ZERO)); \
} while (0)
/* These wrappers apply the identities f(conj(z)) = conj(f(z)). */
@@ -127,9 +129,12 @@ __FBSDID("$FreeBSD$");
} while (0)
-/* Tests for 0 */
-void
-test_zero(void)
+ATF_TC(test_zero_input);
+ATF_TC_HEAD(test_zero_input, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test 0 input");
+}
+ATF_TC_BODY(test_zero_input, tc)
{
long double complex zero = CMPLXL(0.0, 0.0);
@@ -142,11 +147,12 @@ test_zero(void)
testall_odd(ctan, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH);
}
-/*
- * Tests for NaN inputs.
- */
-void
-test_nan()
+ATF_TC(test_nan_inputs);
+ATF_TC_HEAD(test_nan_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test NaN inputs");
+}
+ATF_TC_BODY(test_nan_inputs, tc)
{
long double complex nan_nan = CMPLXL(NAN, NAN);
long double complex z;
@@ -222,14 +228,18 @@ test_nan()
testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0);
}
-void
-test_inf(void)
+ATF_TC(test_inf_inputs);
+ATF_TC_HEAD(test_inf_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test infinity inputs");
+}
+ATF_TC_BODY(test_inf_inputs, tc)
{
static const long double finites[] = {
0, M_PI / 4, 3 * M_PI / 4, 5 * M_PI / 4,
};
long double complex z, c, s;
- int i;
+ unsigned i;
/*
* IN CSINH CCOSH CTANH
@@ -251,7 +261,7 @@ test_inf(void)
testall_odd(ctan, z, CMPLXL(0, 1), ALL_STD_EXCEPT, 0, CS_REAL);
/* XXX We allow spurious inexact exceptions here (hard to avoid). */
- for (i = 0; i < sizeof(finites) / sizeof(finites[0]); i++) {
+ for (i = 0; i < nitems(finites); i++) {
z = CMPLXL(INFINITY, finites[i]);
c = INFINITY * cosl(finites[i]);
s = finites[i] == 0 ? finites[i] : INFINITY * sinl(finites[i]);
@@ -287,18 +297,21 @@ test_inf(void)
testall_odd(ctan, z, CMPLXL(NAN, NAN), OPT_INEXACT, FE_INVALID, 0);
}
-/* Tests along the real and imaginary axes. */
-void
-test_axes(void)
+ATF_TC(test_axes);
+ATF_TC_HEAD(test_axes, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test along the real/imaginary axes");
+}
+ATF_TC_BODY(test_axes, tc)
{
static const long double nums[] = {
M_PI / 4, M_PI / 2, 3 * M_PI / 4,
5 * M_PI / 4, 3 * M_PI / 2, 7 * M_PI / 4,
};
long double complex z;
- int i;
+ unsigned i;
- for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) {
+ for (i = 0; i < nitems(nums); i++) {
/* Real axis */
z = CMPLXL(nums[i], 0.0);
test_odd_tol(csinh, z, CMPLXL(sinh(nums[i]), 0), DBL_ULP());
@@ -347,8 +360,12 @@ test_axes(void)
}
}
-void
-test_small(void)
+ATF_TC(test_small_inputs);
+ATF_TC_HEAD(test_small_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test underflow inputs");
+}
+ATF_TC_BODY(test_small_inputs, tc)
{
/*
* z = 0.5 + i Pi/4
@@ -396,9 +413,9 @@ test_small(void)
-0.26580222883407969212086273981988897L }
};
long double complex z;
- int i;
+ unsigned i;
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < nitems(tests); i++) {
z = CMPLXL(tests[i].a, tests[i].b);
testall_odd_tol(csinh, z,
CMPLXL(tests[i].sinh_a, tests[i].sinh_b), 1.1);
@@ -409,12 +426,20 @@ test_small(void)
}
}
-/* Test inputs that might cause overflow in a sloppy implementation. */
-void
-test_large(void)
+ATF_TC(test_large_inputs);
+ATF_TC_HEAD(test_large_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test inputs that might cause overflow in a sloppy implementation");
+}
+ATF_TC_BODY(test_large_inputs, tc)
{
long double complex z;
+#ifdef __i386__
+ atf_tc_expect_fail("test fails on i386 - bug 205446");
+#endif
+
/* tanh() uses a threshold around x=22, so check both sides. */
z = CMPLXL(21, 0.78539816339744830961566084581987572L);
testall_odd_tol(ctanh, z,
@@ -427,7 +452,6 @@ test_large(void)
test_odd_tol(ctanh, z,
CMPLXL(1.0, 8.95257245135025991216632140458264468e-309L),
DBL_ULP());
-#if !defined(__i386__)
z = CMPLXL(30, 0x1p1023L);
test_odd_tol(ctanh, z,
CMPLXL(1.0, -1.62994325413993477997492170229268382e-26L),
@@ -437,7 +461,6 @@ test_large(void)
CMPLXL(0.878606311888306869546254022621986509L,
-0.225462792499754505792678258169527424L),
DBL_ULP());
-#endif
z = CMPLXL(710.6, 0.78539816339744830961566084581987572L);
test_odd_tol(csinh, z,
@@ -454,29 +477,15 @@ test_large(void)
FE_OVERFLOW, CS_BOTH);
}
-int
-main(int argc, char *argv[])
+ATF_TP_ADD_TCS(tp)
{
- printf("1..6\n");
-
- test_zero();
- printf("ok 1 - ctrig zero\n");
-
- test_nan();
- printf("ok 2 - ctrig nan\n");
-
- test_inf();
- printf("ok 3 - ctrig inf\n");
-
- test_axes();
- printf("ok 4 - ctrig axes\n");
-
- test_small();
- printf("ok 5 - ctrig small\n");
-
- test_large();
- printf("ok 6 - ctrig large\n");
+ ATF_TP_ADD_TC(tp, test_zero_input);
+ ATF_TP_ADD_TC(tp, test_nan_inputs);
+ ATF_TP_ADD_TC(tp, test_inf_inputs);
+ ATF_TP_ADD_TC(tp, test_axes);
+ ATF_TP_ADD_TC(tp, test_small_inputs);
+ ATF_TP_ADD_TC(tp, test_large_inputs);
- return (0);
+ return (atf_no_error());
}
diff --git a/lib/msun/tests/exponential_test.c b/lib/msun/tests/exponential_test.c
index df552ee..5b39d29 100644
--- a/lib/msun/tests/exponential_test.c
+++ b/lib/msun/tests/exponential_test.c
@@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$");
test(expm1f, x, result, exceptmask, excepts); \
} while (0)
-void
+static void
run_generic_tests(void)
{
@@ -122,10 +122,10 @@ run_generic_tests(void)
testall1(-50000.0, -1.0, ALL_STD_EXCEPT, FE_INEXACT);
}
-void
+static void
run_exp2_tests(void)
{
- int i;
+ unsigned i;
/*
* We should insist that exp2() return exactly the correct
@@ -148,7 +148,7 @@ run_exp2_tests(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..3\n");
diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c
index 0ea6e42..1599644 100644
--- a/lib/msun/tests/fenv_test.c
+++ b/lib/msun/tests/fenv_test.c
@@ -64,56 +64,15 @@ static const int std_excepts[] = {
/* init_exceptsets() initializes this to the power set of std_excepts[] */
static int std_except_sets[1 << NEXCEPTS];
-static void init_exceptsets(void);
-
-static void test_dfl_env(void);
-static void test_fegsetenv(void);
-static void test_fegsetexceptflag(void);
-static void test_masking(void);
-static void test_fegsetround(void);
-static void test_feholdupdate(void);
-static void test_feraiseexcept(void);
-static void test_fetestclearexcept(void);
-
-static int getround(void);
-static void raiseexcept(int excepts);
-static void trap_handler(int sig);
-
#pragma STDC FENV_ACCESS ON
-int
-main(int argc, char *argv[])
-{
-
- printf("1..8\n");
- init_exceptsets();
- test_dfl_env();
- printf("ok 1 - fenv\n");
- test_fetestclearexcept();
- printf("ok 2 - fenv\n");
- test_fegsetexceptflag();
- printf("ok 3 - fenv\n");
- test_feraiseexcept();
- printf("ok 4 - fenv\n");
- test_fegsetround();
- printf("ok 5 - fenv\n");
- test_fegsetenv();
- printf("ok 6 - fenv\n");
- test_masking();
- printf("ok 7 - fenv\n");
- test_feholdupdate();
- printf("ok 8 - fenv\n");
-
- return (0);
-}
-
/*
* Initialize std_except_sets[] to the power set of std_excepts[]
*/
-void
+static void
init_exceptsets(void)
{
- int i, j, sr;
+ unsigned i, j, sr;
for (i = 0; i < 1 << NEXCEPTS; i++) {
for (sr = i, j = 0; sr != 0; sr >>= 1, j++)
@@ -122,6 +81,90 @@ init_exceptsets(void)
}
/*
+ * Raise a floating-point exception without relying on the standard
+ * library routines, which we are trying to test.
+ *
+ * XXX We can't raise an {over,under}flow without also raising an
+ * inexact exception.
+ */
+static void
+raiseexcept(int excepts)
+{
+ volatile double d;
+
+ /*
+ * With a compiler that supports the FENV_ACCESS pragma
+ * properly, simple expressions like '0.0 / 0.0' should
+ * be sufficient to generate traps. Unfortunately, we
+ * need to bring a volatile variable into the equation
+ * to prevent incorrect optimizations.
+ */
+ if (excepts & FE_INVALID) {
+ d = 0.0;
+ d = 0.0 / d;
+ }
+ if (excepts & FE_DIVBYZERO) {
+ d = 0.0;
+ d = 1.0 / d;
+ }
+ if (excepts & FE_OVERFLOW) {
+ d = DBL_MAX;
+ d *= 2.0;
+ }
+ if (excepts & FE_UNDERFLOW) {
+ d = DBL_MIN;
+ d /= DBL_MAX;
+ }
+ if (excepts & FE_INEXACT) {
+ d = DBL_MIN;
+ d += 1.0;
+ }
+
+ /*
+ * On the x86 (and some other architectures?) the FPU and
+ * integer units are decoupled. We need to execute an FWAIT
+ * or a floating-point instruction to get synchronous exceptions.
+ */
+ d = 1.0;
+ d += 1.0;
+}
+
+/*
+ * Determine the current rounding mode without relying on the fenv
+ * routines. This function may raise an inexact exception.
+ */
+static int
+getround(void)
+{
+ volatile double d;
+
+ /*
+ * This test works just as well with 0.0 - 0.0, except on ia64
+ * where 0.0 - 0.0 gives the wrong sign when rounding downwards.
+ */
+ d = 1.0;
+ d -= 1.0;
+ if (copysign(1.0, d) < 0.0)
+ return (FE_DOWNWARD);
+
+ d = 1.0;
+ if (d + (DBL_EPSILON * 3.0 / 4.0) == 1.0)
+ return (FE_TOWARDZERO);
+ if (d + (DBL_EPSILON * 1.0 / 4.0) > 1.0)
+ return (FE_UPWARD);
+
+ return (FE_TONEAREST);
+}
+
+static void
+trap_handler(int sig)
+{
+
+ assert(sig == SIGFPE);
+ _exit(0);
+}
+
+/*
* This tests checks the default FP environment, so it must be first.
* The memcmp() test below may be too much to ask for, since there
* could be multiple machine-specific default environments.
@@ -347,7 +390,8 @@ static void
test_masking(void)
{
struct sigaction act;
- int except, i, pass, raise, status;
+ int except, pass, raise, status;
+ unsigned i;
assert((fegetexcept() & ALL_STD_EXCEPT) == 0);
assert((feenableexcept(FE_INVALID|FE_OVERFLOW) & ALL_STD_EXCEPT) == 0);
@@ -427,7 +471,8 @@ test_feholdupdate(void)
fenv_t env;
struct sigaction act;
- int except, i, pass, status, raise;
+ int except, pass, status, raise;
+ unsigned i;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
@@ -452,7 +497,7 @@ test_feholdupdate(void)
* We don't want to cause a fatal exception in
* the child until the second pass, so we can
* check other properties of feupdateenv().
- */
+ */
if (pass == 1)
assert((feenableexcept(except) &
ALL_STD_EXCEPT) == 0);
@@ -491,86 +536,28 @@ test_feholdupdate(void)
assert(fetestexcept(FE_ALL_EXCEPT) == 0);
}
-/*
- * Raise a floating-point exception without relying on the standard
- * library routines, which we are trying to test.
- *
- * XXX We can't raise an {over,under}flow without also raising an
- * inexact exception.
- */
-static void
-raiseexcept(int excepts)
-{
- volatile double d;
-
- /*
- * With a compiler that supports the FENV_ACCESS pragma
- * properly, simple expressions like '0.0 / 0.0' should
- * be sufficient to generate traps. Unfortunately, we
- * need to bring a volatile variable into the equation
- * to prevent incorrect optimizations.
- */
- if (excepts & FE_INVALID) {
- d = 0.0;
- d = 0.0 / d;
- }
- if (excepts & FE_DIVBYZERO) {
- d = 0.0;
- d = 1.0 / d;
- }
- if (excepts & FE_OVERFLOW) {
- d = DBL_MAX;
- d *= 2.0;
- }
- if (excepts & FE_UNDERFLOW) {
- d = DBL_MIN;
- d /= DBL_MAX;
- }
- if (excepts & FE_INEXACT) {
- d = DBL_MIN;
- d += 1.0;
- }
-
- /*
- * On the x86 (and some other architectures?) the FPU and
- * integer units are decoupled. We need to execute an FWAIT
- * or a floating-point instruction to get synchronous exceptions.
- */
- d = 1.0;
- d += 1.0;
-}
-
-/*
- * Determine the current rounding mode without relying on the fenv
- * routines. This function may raise an inexact exception.
- */
-static int
-getround(void)
+int
+main(void)
{
- volatile double d;
- /*
- * This test works just as well with 0.0 - 0.0, except on ia64
- * where 0.0 - 0.0 gives the wrong sign when rounding downwards.
- */
- d = 1.0;
- d -= 1.0;
- if (copysign(1.0, d) < 0.0)
- return (FE_DOWNWARD);
-
- d = 1.0;
- if (d + (DBL_EPSILON * 3.0 / 4.0) == 1.0)
- return (FE_TOWARDZERO);
- if (d + (DBL_EPSILON * 1.0 / 4.0) > 1.0)
- return (FE_UPWARD);
-
- return (FE_TONEAREST);
-}
-
-static void
-trap_handler(int sig)
-{
+ printf("1..8\n");
+ init_exceptsets();
+ test_dfl_env();
+ printf("ok 1 - fenv\n");
+ test_fetestclearexcept();
+ printf("ok 2 - fenv\n");
+ test_fegsetexceptflag();
+ printf("ok 3 - fenv\n");
+ test_feraiseexcept();
+ printf("ok 4 - fenv\n");
+ test_fegsetround();
+ printf("ok 5 - fenv\n");
+ test_fegsetenv();
+ printf("ok 6 - fenv\n");
+ test_masking();
+ printf("ok 7 - fenv\n");
+ test_feholdupdate();
+ printf("ok 8 - fenv\n");
- assert(sig == SIGFPE);
- _exit(0);
+ return (0);
}
diff --git a/lib/msun/tests/fma_test.c b/lib/msun/tests/fma_test.c
index dfcea2a..1b9a490 100644
--- a/lib/msun/tests/fma_test.c
+++ b/lib/msun/tests/fma_test.c
@@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$");
* This is needed because clang constant-folds fma in ways that are incorrect
* in rounding modes other than FE_TONEAREST.
*/
-volatile double one = 1.0;
+static volatile double one = 1.0;
static void
test_zeroes(void)
@@ -472,10 +472,10 @@ test_double_rounding(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
int rmodes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
- int i, j;
+ unsigned i, j;
#if defined(__i386__)
printf("1..0 # SKIP all testcases fail on i386\n");
diff --git a/lib/msun/tests/fmaxmin_test.c b/lib/msun/tests/fmaxmin_test.c
index 24056b0..581fc25 100644
--- a/lib/msun/tests/fmaxmin_test.c
+++ b/lib/msun/tests/fmaxmin_test.c
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
} \
} while (0)
-int
+static int
testall_r(long double big, long double small)
{
int ok;
@@ -86,14 +86,14 @@ testall_r(long double big, long double small)
return (ok);
}
-const char *comment = NULL;
+static const char *comment = NULL;
/*
* Test all the functions: fmaxf, fmax, fmaxl, fminf, fmin, and fminl,
* in all rounding modes and with the arguments in different orders.
* The input 'big' must be >= 'small'.
*/
-void
+static void
testall(int testnum, long double big, long double small)
{
static const int rmodes[] = {
@@ -122,7 +122,7 @@ testall(int testnum, long double big, long double small)
#endif
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..12\n");
diff --git a/lib/msun/tests/invctrig_test.c b/lib/msun/tests/invctrig_test.c
index 34e78a1..7856605 100644
--- a/lib/msun/tests/invctrig_test.c
+++ b/lib/msun/tests/invctrig_test.c
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <assert.h>
#include <complex.h>
#include <fenv.h>
@@ -123,7 +124,7 @@ c3pi = 9.42477796076937971538793014983850839L;
/* Tests for 0 */
-void
+static void
test_zero(void)
{
long double complex zero = CMPLXL(0.0, 0.0);
@@ -143,8 +144,8 @@ test_zero(void)
/*
* Tests for NaN inputs.
*/
-void
-test_nan()
+static void
+test_nan(void)
{
long double complex nan_nan = CMPLXL(NAN, NAN);
long double complex z;
@@ -154,7 +155,7 @@ test_nan()
* NaN,NaN NaN,NaN NaN,NaN NaN,NaN NaN,NaN
* finite,NaN NaN,NaN* NaN,NaN* NaN,NaN* NaN,NaN*
* NaN,finite NaN,NaN* NaN,NaN* NaN,NaN* NaN,NaN*
- * NaN,Inf Inf,NaN NaN,-Inf ?Inf,NaN ?0,pi/2
+ * NaN,Inf Inf,NaN NaN,-Inf ?Inf,NaN ?0,pi/2
* +-Inf,NaN Inf,NaN NaN,?Inf +-Inf,NaN +-0,NaN
* +-0,NaN NaN,NaN* pi/2,NaN NaN,NaN* +-0,NaN
* NaN,0 NaN,NaN* NaN,NaN* NaN,0 NaN,NaN*
@@ -222,7 +223,7 @@ test_nan()
testall(catan, z, CMPLXL(NAN, 0.0), ALL_STD_EXCEPT, 0, 0);
}
-void
+static void
test_inf(void)
{
long double complex z;
@@ -269,16 +270,16 @@ test_inf(void)
}
/* Tests along the real and imaginary axes. */
-void
+static void
test_axes(void)
{
static const long double nums[] = {
-2, -1, -0.5, 0.5, 1, 2
};
long double complex z;
- int i;
+ unsigned i;
- for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) {
+ for (i = 0; i < nitems(nums); i++) {
/* Real axis */
z = CMPLXL(nums[i], 0.0);
if (fabsl(nums[i]) <= 1) {
@@ -306,7 +307,7 @@ test_axes(void)
}
}
-void
+static void
test_small(void)
{
/*
@@ -332,7 +333,7 @@ test_small(void)
}
/* Test inputs that might cause overflow in a sloppy implementation. */
-void
+static void
test_large(void)
{
@@ -340,7 +341,7 @@ test_large(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..6\n");
diff --git a/lib/msun/tests/invtrig_test.c b/lib/msun/tests/invtrig_test.c
index 01b0379..3c24d61 100644
--- a/lib/msun/tests/invtrig_test.c
+++ b/lib/msun/tests/invtrig_test.c
@@ -110,11 +110,10 @@ __FBSDID("$FreeBSD$");
#define testall2(prefix, y, x, result, excepts) \
testall2_tol(prefix, (y), (x), (result), 0, (excepts))
-long double
+static long double
pi = 3.14159265358979323846264338327950280e+00L,
pio3 = 1.04719755119659774615421446109316766e+00L,
c3pi = 9.42477796076937971538793014983850839e+00L,
-c5pi = 1.57079632679489661923132169163975140e+01L,
c7pi = 2.19911485751285526692385036829565196e+01L,
c5pio3 = 5.23598775598298873077107230546583851e+00L,
sqrt2m1 = 4.14213562373095048801688724209698081e-01L;
@@ -444,7 +443,7 @@ test_inverse(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
#if defined(__i386__)
diff --git a/lib/msun/tests/logarithm_test.c b/lib/msun/tests/logarithm_test.c
index 18b9ebe..8f253e3 100644
--- a/lib/msun/tests/logarithm_test.c
+++ b/lib/msun/tests/logarithm_test.c
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <assert.h>
#include <fenv.h>
#include <float.h>
@@ -98,7 +99,7 @@ __FBSDID("$FreeBSD$");
test(log1pl, x, result, exceptmask, excepts); \
} while (0)
-void
+static void
run_generic_tests(void)
{
@@ -127,10 +128,10 @@ run_generic_tests(void)
testall1(-1.0, -INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_DIVBYZERO);
}
-void
+static void
run_log2_tests(void)
{
- int i;
+ unsigned i;
/*
* We should insist that log2() return exactly the correct
@@ -154,7 +155,7 @@ run_log2_tests(void)
}
}
-void
+static void
run_roundingmode_tests(void)
{
@@ -188,7 +189,7 @@ run_roundingmode_tests(void)
fesetround(FE_TONEAREST);
}
-void
+static void
run_accuracy_tests(void)
{
static const struct {
@@ -219,9 +220,9 @@ run_accuracy_tests(void)
7.229787154734166181706169344438271459e1L,
3.139856666636059855894123306947856631e1L },
};
- int i;
+ unsigned i;
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < nitems(tests); i++) {
test_tol(log2, tests[i].x, tests[i].log2x, DBL_ULP());
test_tol(log2f, tests[i].x, tests[i].log2x, FLT_ULP());
test_tol(log2l, tests[i].x, tests[i].log2x, LDBL_ULP());
@@ -242,7 +243,7 @@ run_accuracy_tests(void)
}
}
-void
+static void
run_log1p_accuracy_tests(void)
{
@@ -262,7 +263,7 @@ run_log1p_accuracy_tests(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..5\n");
diff --git a/lib/msun/tests/lrint_test.c b/lib/msun/tests/lrint_test.c
index ba099aa..0c85df0 100644
--- a/lib/msun/tests/lrint_test.c
+++ b/lib/msun/tests/lrint_test.c
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
#pragma STDC FENV_ACCESS ON
-void
+static void
run_tests(void)
{
@@ -132,7 +132,7 @@ run_tests(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..1\n");
diff --git a/lib/msun/tests/nan_test.c b/lib/msun/tests/nan_test.c
index c12926b..d78f6f4 100644
--- a/lib/msun/tests/nan_test.c
+++ b/lib/msun/tests/nan_test.c
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <assert.h>
#include <fenv.h>
#include <float.h>
@@ -41,7 +42,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
-void
+static void
testnan(const char *nan_format)
{
char nan_str[128];
@@ -49,10 +50,10 @@ testnan(const char *nan_format)
long double ald[4];
double ad[4];
float af[4];
- int i;
+ unsigned i;
snprintf(nan_str, sizeof(nan_str), "nan(%s)", nan_format);
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nitems(ad); i++) {
/*
* x86 has an 80-bit long double stored in 96 bits,
* so we need to initialize the memory for the memcmp()
@@ -61,7 +62,6 @@ testnan(const char *nan_format)
bzero(&af[i], sizeof(float));
bzero(&ad[i], sizeof(double));
bzero(&ald[i], sizeof(long double));
-
}
af[0] = nanf(nan_format);
@@ -105,7 +105,7 @@ testnan(const char *nan_format)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..1\n");
diff --git a/lib/msun/tests/nearbyint_test.c b/lib/msun/tests/nearbyint_test.c
index 602ea2a..eebe5c9 100644
--- a/lib/msun/tests/nearbyint_test.c
+++ b/lib/msun/tests/nearbyint_test.c
@@ -35,6 +35,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <assert.h>
#include <fenv.h>
#include <math.h>
@@ -49,9 +50,9 @@ static const int rmodes[] = {
};
/* Make sure we're testing the library, not some broken compiler built-ins. */
-double (*libnearbyint)(double) = nearbyint;
-float (*libnearbyintf)(float) = nearbyintf;
-long double (*libnearbyintl)(long double) = nearbyintl;
+static double (*libnearbyint)(double) = nearbyint;
+static float (*libnearbyintf)(float) = nearbyintf;
+static long double (*libnearbyintl)(long double) = nearbyintl;
#define nearbyintf libnearbyintf
#define nearbyint libnearbyint
#define nearbyintl libnearbyintl
@@ -69,8 +70,6 @@ static const struct {
{ NAN, { NAN, NAN, NAN }},
};
-static const int ntests = sizeof(tests) / sizeof(tests[0]);
-
/* Get the appropriate result for the current rounding mode. */
static float
get_output(int testindex, int rmodeindex, int negative)
@@ -93,7 +92,7 @@ static void
test_nearby(int testindex)
{
float in, out;
- int i;
+ unsigned i;
for (i = 0; i < sizeof(rmodes) / sizeof(rmodes[0]); i++) {
fesetround(rmodes[i]);
@@ -124,7 +123,7 @@ test_modf(int testindex)
float ipartf, ipart_expected;
double ipart;
long double ipartl;
- int i;
+ unsigned i;
for (i = 0; i < sizeof(rmodes) / sizeof(rmodes[0]); i++) {
fesetround(rmodes[i]);
@@ -161,13 +160,13 @@ test_modf(int testindex)
}
int
-main(int argc, char *argv[])
+main(void)
{
- int i;
+ unsigned i;
- printf("1..%d\n", ntests * 2);
+ printf("1..%zu\n", (size_t)(nitems(tests) * 2));
testnum = 1;
- for (i = 0; i < ntests; i++) {
+ for (i = 0; i < nitems(tests); i++) {
test_nearby(i);
test_modf(i);
}
diff --git a/lib/msun/tests/next_test.c b/lib/msun/tests/next_test.c
index d16fa77..26eaacf 100644
--- a/lib/msun/tests/next_test.c
+++ b/lib/msun/tests/next_test.c
@@ -73,7 +73,7 @@ static double idd(double);
static float idf(float);
int
-main(int argc, char *argv[])
+main(void)
{
static const int ex_under = FE_UNDERFLOW | FE_INEXACT; /* shorthand */
static const int ex_over = FE_OVERFLOW | FE_INEXACT;
diff --git a/lib/msun/tests/rem_test.c b/lib/msun/tests/rem_test.c
index 36e3476..f652ada 100644
--- a/lib/msun/tests/rem_test.c
+++ b/lib/msun/tests/rem_test.c
@@ -52,7 +52,7 @@ static void testf(float, float, float, int);
} while (0)
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..3\n");
diff --git a/lib/msun/tests/test-utils.h b/lib/msun/tests/test-utils.h
index bf0d6de..023a8f8 100644
--- a/lib/msun/tests/test-utils.h
+++ b/lib/msun/tests/test-utils.h
@@ -88,6 +88,13 @@ CMPLXL(long double x, long double y)
}
#endif
+static int fpequal(long double, long double) __used;
+static int cfpequal(long double complex, long double complex) __used;
+static int cfpequal_cs(long double complex, long double complex,
+ int) __used;
+static int cfpequal_tol(long double complex, long double complex,
+ long double, unsigned int) __used;
+
/*
* Compare d1 and d2 using special rules: NaN == NaN and +0 != -0.
* Fail an assertion if they differ.
@@ -119,7 +126,8 @@ fpequal_cs(long double x, long double y, int checksign)
}
static int
-fpequal_tol(long double x, long double y, long double tol, unsigned int flags)
+fpequal_tol(long double x, long double y, long double tol,
+ unsigned int flags)
{
fenv_t env;
int ret;
@@ -153,7 +161,7 @@ cfpequal(long double complex d1, long double complex d2)
{
return (fpequal(creall(d1), creall(d2)) &&
- fpequal(cimagl(d1), cimagl(d2)));
+ fpequal(cimagl(d1), cimagl(d2)));
}
static int
@@ -165,7 +173,7 @@ cfpequal_cs(long double complex x, long double complex y, int checksign)
static int
cfpequal_tol(long double complex x, long double complex y, long double tol,
- unsigned int flags)
+ unsigned int flags)
{
return (fpequal_tol(creal(x), creal(y), tol, flags)
&& fpequal_tol(cimag(x), cimag(y), tol, flags));
diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c
index 1dcce1f..3066d15 100644
--- a/lib/msun/tests/trig_test.c
+++ b/lib/msun/tests/trig_test.c
@@ -153,7 +153,7 @@ run_reduction_tests(void)
};
#endif
- int i;
+ unsigned i;
for (i = 0; i < nitems(f_pi_odd); i++) {
assert(fabs(sinf(f_pi_odd[i])) < FLT_EPSILON);
@@ -258,7 +258,7 @@ run_accuracy_tests(void)
}
int
-main(int argc, char *argv[])
+main(void)
{
printf("1..3\n");
diff --git a/release/Makefile.vagrant b/release/Makefile.vagrant
index 3b53ba9..9048279 100644
--- a/release/Makefile.vagrant
+++ b/release/Makefile.vagrant
@@ -1,8 +1,20 @@
#
# $FreeBSD$
#
+# Makefile for producing and uploading Vagrant boxes to Hashicorp Atlas
#
-# Makefile for uploading Vagrant boxes to Hashicorp Atlas
+# Usage Example:
+# Create a Vagrant image for VirtualBox:
+# make vagrant-box WITH_VMIMAGES=y WITH_CLOUDWARE=y \
+# CLOUDWARE=vagrant-virtualbox VMFORMATS=vmdk
+#
+# To create a Vagrant image for VMWare and Upload it to Atlas:
+# VAGRANT_KEY is your Atlas API Token
+# VAGRANT_USERNAME is your Atlas Username
+# env VAGRANT_KEY=foo VAGRANT_USERNAME=bar make vagrant-upload \
+# WITH_VMIMAGES=y WITH_CLOUDWARE=y CLOUDWARE=vagrant-vmware \
+# VMFORMATS=vmdk
+# For more info: https://www.vagrantup.com/docs/other/atlas.html
#
VAGRANT_IMG?= ${.OBJDIR}/vagrant.vmdk
@@ -24,8 +36,8 @@ VAGRANT_VERSION!= date +%Y.%m.%d
VAGRANT_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}
.if !empty(CLOUDWARE)
. for _PROVIDER in ${CLOUDWARE}
-. if ${_PROVIDER:MVAGRANT*}
-VAGRANT_PROVIDERS+= ${_PROVIDER:S/VAGRANT-//:tl}
+. if ${_PROVIDER:tu:MVAGRANT*}
+VAGRANT_PROVIDERS+= ${_PROVIDER:tu:S/VAGRANT-//:tl}
. endif
. endfor
.endif
@@ -70,13 +82,16 @@ ${VAGRANT_TARGET}.${PROVIDER}.box: ${PROVIDER} cw-vagrant-${PROVIDER} vagrant-cr
. endif
CLEANFILES+= vagrant-do-upload-${PROVIDER}
-vagrant-do-upload-${PROVIDER}: ${VAGRANT_TARGET}.${PROVIDER}.box
+vagrant-do-upload-${PROVIDER}: vagrant-box
. if ${PROVIDER} == "virtualbox"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER} -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. elif ${PROVIDER} == "vmware"
${.CURDIR}/scripts/atlas-upload.sh -b ${TYPE}-${REVISION}-${BRANCH} -f ${VAGRANT_TARGET}.${PROVIDER}.box -p ${PROVIDER}_desktop -k ${VAGRANT_KEY} -u ${VAGRANT_USERNAME} -v ${VAGRANT_VERSION}
. endif
touch ${.OBJDIR}/${.TARGET}
+
+vagrant-box: ${VAGRANT_TARGET}.${PROVIDER}.box
+
.endfor
vagrant-upload: ${VAGRANT_UPLOAD_TGTS}
diff --git a/release/Makefile.vm b/release/Makefile.vm
index 9de3846..180ce5b 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -57,8 +57,8 @@ cw-${_CW:tl}:
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \
- -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \
- -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF}
+ -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW:tu}_FORMAT} \
+ -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}IMAGE} -c ${${_CW}CONF}
touch ${.TARGET}
cw${_CW:tl}-package:
diff --git a/release/packages/runtime.ucl b/release/packages/runtime.ucl
index 796ff21..13e4492 100644
--- a/release/packages/runtime.ucl
+++ b/release/packages/runtime.ucl
@@ -20,6 +20,7 @@ scripts: {
post-install = <<EOD
cap_mkdb %CAP_MKDB_ENDIAN% ${PKG_ROOTDIR}/etc/login.conf
pwd_mkdb %PWD_MKDB_ENDIAN% -i -p -d ${PKG_ROOTDIR}/etc ${PKG_ROOTDIR}/etc/master.passwd
+ chmod 1777 ${PKG_ROOTDIR}/tmp
EOD
}
deps: {
diff --git a/release/tools/vagrant-virtualbox.conf b/release/tools/vagrant-virtualbox.conf
index ff14674..772068b 100644
--- a/release/tools/vagrant-virtualbox.conf
+++ b/release/tools/vagrant-virtualbox.conf
@@ -5,11 +5,11 @@
. ${WORLDDIR}/release/tools/vagrant.conf
-export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} virtualbox-ose-additions"
+export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} virtualbox-ose-additions-nox11"
vm_extra_pre_umount () {
# VirtualBox first boot pkgs
- echo 'firstboot_pkgs_list="sudo rsync virtualbox-ose-additions"' >> ${DESTDIR}/etc/rc.conf
+ echo 'firstboot_pkgs_list="sudo rsync virtualbox-ose-additions-nox11"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxguest_enable="YES"' >> ${DESTDIR}/etc/rc.conf
echo 'vboxservice_enable="YES"' >> ${DESTDIR}/etc/rc.conf
diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
index 70d3a37..918090c 100644
--- a/rescue/rescue/Makefile
+++ b/rescue/rescue/Makefile
@@ -90,7 +90,7 @@ CRUNCH_SUPPRESS_LINK_-tcsh= 1
#
CRUNCH_SRCDIRS+= sbin
CRUNCH_PROGS_sbin= badsect \
- camcontrol ccdconfig clri devfs dmesg dump \
+ camcontrol clri devfs dmesg dump \
dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb \
fsirand gbde geom ifconfig init \
kldconfig kldload kldstat kldunload ldconfig \
@@ -98,13 +98,17 @@ CRUNCH_PROGS_sbin= badsect \
mount_msdosfs mount_nfs mount_nullfs \
mount_udf mount_unionfs newfs \
newfs_msdos nos-tun ping reboot \
- restore rcorder route routed rtquery rtsol savecore \
- spppcontrol swapon sysctl tunefs umount
+ restore rcorder route rtsol savecore \
+ shutdown spppcontrol swapon sysctl tunefs umount
.if ${MK_ATM} != "no"
CRUNCH_PROGS_sbin+= atmconfig
.endif
+.if ${MK_CCD} != "no"
+CRUNCH_PROGS_sbin+= ccdconfig
+.endif
+
.if ${MK_INET6_SUPPORT} != "no"
CRUNCH_PROGS_sbin+= ping6
.endif
@@ -112,6 +116,11 @@ CRUNCH_PROGS_sbin+= ping6
.if ${MK_IPFILTER} != "no"
CRUNCH_PROGS_sbin+= ipf
.endif
+
+.if ${MK_ROUTED} != "no"
+CRUNCH_PROGS_sbin+= routed rtquery
+.endif
+
.if ${MK_ZFS} != "no"
CRUNCH_PROGS_sbin+= zfs
CRUNCH_PROGS_sbin+= zpool
@@ -170,6 +179,7 @@ CRUNCH_ALIAS_restore= rrestore
CRUNCH_ALIAS_dump= rdump
CRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
CRUNCH_ALIAS_geom= glabel gpart
+CRUNCH_ALIAS_shutdown= poweroff
# dhclient has historically been troublesome...
CRUNCH_PROGS_sbin+= dhclient
diff --git a/sbin/camcontrol/attrib.c b/sbin/camcontrol/attrib.c
index 7ff2c42..5c3c009 100644
--- a/sbin/camcontrol/attrib.c
+++ b/sbin/camcontrol/attrib.c
@@ -106,7 +106,8 @@ static struct scsi_nv output_format_map[] = {
int
scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout, int verbosemode, int err_recover)
+ int task_attr, int retry_count, int timeout, int verbosemode,
+ int err_recover)
{
union ccb *ccb = NULL;
int attr_num = -1;
@@ -317,7 +318,7 @@ scsiattrib(struct cam_device *device, int argc, char **argv, char *combinedopt,
scsi_read_attribute(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*service_action*/ read_service_action,
/*element*/ element_address,
/*elem_type*/ element_type,
diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8
index 8697564..f7069c8 100644
--- a/sbin/camcontrol/camcontrol.8
+++ b/sbin/camcontrol/camcontrol.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 6, 2017
+.Dd February 17, 2017
.Dt CAMCONTROL 8
.Os
.Sh NAME
@@ -422,6 +422,17 @@ It may take some other actions, depending upon the sense code returned from
the command.
.It Fl n Ar dev_name
Specify the device type to operate on, e.g.\& "da", "cd".
+.It Fl Q Ar task_attr
+.Tn SCSI
+task attribute for the command, if it is a
+.Tn SCSI
+command.
+This may be ordered, simple, head, or aca.
+In most cases this is not needed.
+The default is simple, which works with all
+.Tn SCSI
+devices.
+The task attribute may also be specified numerically.
.It Fl t Ar timeout
SCSI command timeout in seconds.
This overrides the default timeout for
@@ -2509,7 +2520,7 @@ information if the command fails since the
.Fl v
switch was not specified.
.Bd -literal -offset indent
-camcontrol tur da1 -E -C 4 -t 50 -v
+camcontrol tur da1 -E -C 4 -t 50 -Q head -v
.Ed
.Pp
Send a test unit ready command to da1.
@@ -2522,6 +2533,9 @@ flag) if the command fails.
Since error recovery is turned on, the
disk will be spun up if it is not currently spinning.
The
+.Tn SCSI
+task attribute for the command will be set to Head of Queue.
+The
.Nm
utility will report whether the disk is ready.
.Bd -literal -offset indent
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index dda58d2..cad0e73 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -171,6 +171,14 @@ struct ata_set_max_pwd
u_int16_t reserved2[239];
};
+static struct scsi_nv task_attrs[] = {
+ { "simple", MSG_SIMPLE_Q_TAG },
+ { "head", MSG_HEAD_OF_Q_TAG },
+ { "ordered", MSG_ORDERED_Q_TAG },
+ { "iwr", MSG_IGN_WIDE_RESIDUE },
+ { "aca", MSG_ACA_TASK }
+};
+
static const char scsicmd_opts[] = "a:c:dfi:o:r";
static const char readdefect_opts[] = "f:GPqsS:X";
static const char negotiate_opts[] = "acD:M:O:qR:T:UW:";
@@ -265,12 +273,14 @@ static int getdevlist(struct cam_device *device);
#endif /* MINIMALISTIC */
static int getdevtree(int argc, char **argv, char *combinedopt);
#ifndef MINIMALISTIC
-static int testunitready(struct cam_device *device, int retry_count,
- int timeout, int quiet);
+static int testunitready(struct cam_device *device, int task_attr,
+ int retry_count, int timeout, int quiet);
static int scsistart(struct cam_device *device, int startstop, int loadeject,
- int retry_count, int timeout);
-static int scsiinquiry(struct cam_device *device, int retry_count, int timeout);
-static int scsiserial(struct cam_device *device, int retry_count, int timeout);
+ int task_attr, int retry_count, int timeout);
+static int scsiinquiry(struct cam_device *device, int task_attr,
+ int retry_count, int timeout);
+static int scsiserial(struct cam_device *device, int task_attr,
+ int retry_count, int timeout);
#endif /* MINIMALISTIC */
static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target,
lun_id_t *lun, cam_argmask *arglst);
@@ -280,11 +290,14 @@ static int scanlun_or_reset_dev(path_id_t bus, target_id_t target,
lun_id_t lun, int scan);
#ifndef MINIMALISTIC
static int readdefects(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static void modepage(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int scsicmd(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int smpcmd(struct cam_device *device, int argc, char **argv,
char *combinedopt, int retry_count, int timeout);
static int smpreportgeneral(struct cam_device *device, int argc, char **argv,
@@ -309,16 +322,21 @@ static int get_cpi(struct cam_device *device, struct ccb_pathinq *cpi);
static int get_cgd(struct cam_device *device, struct ccb_getdev *cgd);
static int get_print_cts(struct cam_device *device, int user_settings,
int quiet, struct ccb_trans_settings *cts);
-static int ratecontrol(struct cam_device *device, int retry_count,
- int timeout, int argc, char **argv, char *combinedopt);
+static int ratecontrol(struct cam_device *device, int task_attr,
+ int retry_count, int timeout, int argc, char **argv,
+ char *combinedopt);
static int scsiformat(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int scsisanitize(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int scsireportluns(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int scsireadcapacity(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
static int atapm(struct cam_device *device, int argc, char **argv,
char *combinedopt, int retry_count, int timeout);
static int atasecurity(struct cam_device *device, int retry_count, int timeout,
@@ -331,8 +349,8 @@ static int scsiprintoneopcode(struct cam_device *device, int req_opcode,
static int scsiprintopcodes(struct cam_device *device, int td_req, uint8_t *buf,
uint32_t valid_len);
static int scsiopcodes(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout,
- int verbose);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout, int verbose);
static int scsireprobe(struct cam_device *device);
#endif /* MINIMALISTIC */
@@ -650,8 +668,8 @@ getdevtree(int argc, char **argv, char *combinedopt)
#ifndef MINIMALISTIC
static int
-testunitready(struct cam_device *device, int retry_count, int timeout,
- int quiet)
+testunitready(struct cam_device *device, int task_attr, int retry_count,
+ int timeout, int quiet)
{
int error = 0;
union ccb *ccb;
@@ -661,7 +679,7 @@ testunitready(struct cam_device *device, int retry_count, int timeout,
scsi_test_unit_ready(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ timeout ? timeout : 5000);
@@ -705,7 +723,7 @@ testunitready(struct cam_device *device, int retry_count, int timeout,
static int
scsistart(struct cam_device *device, int startstop, int loadeject,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
int error = 0;
@@ -716,13 +734,19 @@ scsistart(struct cam_device *device, int startstop, int loadeject,
* If we're stopping, send an ordered tag so the drive in question
* will finish any previously queued writes before stopping. If
* the device isn't capable of tagged queueing, or if tagged
- * queueing is turned off, the tag action is a no-op.
+ * queueing is turned off, the tag action is a no-op. We override
+ * the default simple tag, although this also has the effect of
+ * overriding the user's wishes if he wanted to specify a simple
+ * tag.
*/
+ if ((startstop == 0)
+ && (task_attr == MSG_SIMPLE_Q_TAG))
+ task_attr = MSG_ORDERED_Q_TAG;
+
scsi_start_stop(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ startstop ? MSG_SIMPLE_Q_TAG :
- MSG_ORDERED_Q_TAG,
+ /* tag_action */ task_attr,
/* start/stop */ startstop,
/* load_eject */ loadeject,
/* immediate */ 0,
@@ -783,7 +807,7 @@ scsistart(struct cam_device *device, int startstop, int loadeject,
int
scsidoinquiry(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
int c;
int error = 0;
@@ -812,13 +836,13 @@ scsidoinquiry(struct cam_device *device, int argc, char **argv,
arglist |= CAM_ARG_INQ_MASK;
if (arglist & CAM_ARG_GET_STDINQ)
- error = scsiinquiry(device, retry_count, timeout);
+ error = scsiinquiry(device, task_attr, retry_count, timeout);
if (error != 0)
return(error);
if (arglist & CAM_ARG_GET_SERIAL)
- scsiserial(device, retry_count, timeout);
+ scsiserial(device, task_attr, retry_count, timeout);
if (arglist & CAM_ARG_GET_XFERRATE)
error = camxferrate(device);
@@ -827,7 +851,8 @@ scsidoinquiry(struct cam_device *device, int argc, char **argv,
}
static int
-scsiinquiry(struct cam_device *device, int retry_count, int timeout)
+scsiinquiry(struct cam_device *device, int task_attr, int retry_count,
+ int timeout)
{
union ccb *ccb;
struct scsi_inquiry_data *inq_buf;
@@ -889,7 +914,7 @@ scsiinquiry(struct cam_device *device, int retry_count, int timeout)
scsi_inquiry(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* inq_buf */ (u_int8_t *)inq_buf,
/* inq_len */ SHORT_INQUIRY_LENGTH,
/* evpd */ 0,
@@ -941,7 +966,8 @@ scsiinquiry(struct cam_device *device, int retry_count, int timeout)
}
static int
-scsiserial(struct cam_device *device, int retry_count, int timeout)
+scsiserial(struct cam_device *device, int task_attr, int retry_count,
+ int timeout)
{
union ccb *ccb;
struct scsi_vpd_unit_serial_number *serial_buf;
@@ -970,7 +996,7 @@ scsiserial(struct cam_device *device, int retry_count, int timeout)
scsi_inquiry(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* inq_buf */ (u_int8_t *)serial_buf,
/* inq_len */ sizeof(*serial_buf),
/* evpd */ 1,
@@ -3405,7 +3431,7 @@ static struct scsi_nv defect_list_type_map[] = {
static int
readdefects(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
union ccb *ccb = NULL;
struct scsi_read_defect_data_hdr_10 *hdr10 = NULL;
@@ -3547,7 +3573,7 @@ next_batch:
scsi_read_defects(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*list_format*/ list_format,
/*addr_desc_index*/ starting_offset,
/*data_ptr*/ defect_list,
@@ -3985,7 +4011,8 @@ reassignblocks(struct cam_device *device, u_int32_t *blocks, int num_blocks)
#ifndef MINIMALISTIC
void
mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
- int retry_count, int timeout, u_int8_t *data, int datalen)
+ int task_attr, int retry_count, int timeout, u_int8_t *data,
+ int datalen)
{
union ccb *ccb;
int retval;
@@ -4000,7 +4027,7 @@ mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
scsi_mode_sense_subpage(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* dbd */ dbd,
/* pc */ pc << 6,
/* page */ page,
@@ -4035,8 +4062,8 @@ mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
}
void
-mode_select(struct cam_device *device, int save_pages, int retry_count,
- int timeout, u_int8_t *data, int datalen)
+mode_select(struct cam_device *device, int save_pages, int task_attr,
+ int retry_count, int timeout, u_int8_t *data, int datalen)
{
union ccb *ccb;
int retval;
@@ -4051,7 +4078,7 @@ mode_select(struct cam_device *device, int save_pages, int retry_count,
scsi_mode_select(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* scsi_page_fmt */ 1,
/* save_pages */ save_pages,
/* param_buf */ data,
@@ -4086,7 +4113,7 @@ mode_select(struct cam_device *device, int save_pages, int retry_count,
void
modepage(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
char *str_subpage;
int c, page = -1, subpage = -1, pc = 0;
@@ -4133,16 +4160,17 @@ modepage(struct cam_device *device, int argc, char **argv, char *combinedopt,
errx(1, "you must specify a mode page!");
if (list != 0) {
- mode_list(device, dbd, pc, list > 1, retry_count, timeout);
+ mode_list(device, dbd, pc, list > 1, task_attr, retry_count,
+ timeout);
} else {
mode_edit(device, dbd, pc, page, subpage, edit, binary,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
}
}
static int
scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
u_int32_t flags = CAM_DIR_NONE;
@@ -4387,7 +4415,7 @@ scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
/*flags*/ flags,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*data_ptr*/ data_ptr,
/*dxfer_len*/ data_bytes,
/*sense_len*/ SSD_FULL_SIZE,
@@ -5498,8 +5526,8 @@ get_print_cts_bailout:
}
static int
-ratecontrol(struct cam_device *device, int retry_count, int timeout,
- int argc, char **argv, char *combinedopt)
+ratecontrol(struct cam_device *device, int task_attr, int retry_count,
+ int timeout, int argc, char **argv, char *combinedopt)
{
int c;
union ccb *ccb;
@@ -5829,7 +5857,7 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
}
}
if (send_tur) {
- retval = testunitready(device, retry_count, timeout,
+ retval = testunitready(device, task_attr, retry_count, timeout,
(arglist & CAM_ARG_VERBOSE) ? 0 : 1);
/*
* If the TUR didn't succeed, just bail.
@@ -5854,7 +5882,7 @@ ratecontrol_bailout:
static int
scsiformat(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
int c;
@@ -5903,7 +5931,7 @@ scsiformat(struct cam_device *device, int argc, char **argv,
"following device:\n");
error = scsidoinquiry(device, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
if (error != 0) {
warnx("scsiformat: error sending inquiry");
@@ -5975,7 +6003,7 @@ scsiformat(struct cam_device *device, int argc, char **argv,
scsi_format_unit(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* byte2 */ byte2,
/* ileave */ 0,
/* data_ptr */ data_ptr,
@@ -6034,7 +6062,7 @@ doreport:
scsi_test_unit_ready(&ccb->csio,
/* retries */ 0,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ 5000);
@@ -6144,7 +6172,7 @@ scsiformat_bailout:
static int
scsisanitize(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
u_int8_t action = 0;
@@ -6309,7 +6337,7 @@ scsisanitize(struct cam_device *device, int argc, char **argv,
"following device:\n");
error = scsidoinquiry(device, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
if (error != 0) {
warnx("scsisanitize: error sending inquiry");
@@ -6367,7 +6395,7 @@ scsisanitize(struct cam_device *device, int argc, char **argv,
scsi_sanitize(&ccb->csio,
/* retries */ retry_count,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* byte2 */ byte2,
/* control */ 0,
/* data_ptr */ data_ptr,
@@ -6442,7 +6470,7 @@ doreport:
scsi_test_unit_ready(&ccb->csio,
/* retries */ 0,
/* cbfcnp */ NULL,
- /* tag_action */ MSG_SIMPLE_Q_TAG,
+ /* tag_action */ task_attr,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ 5000);
@@ -6554,7 +6582,7 @@ scsisanitize_bailout:
static int
scsireportluns(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
int c, countonly, lunsonly;
@@ -6631,7 +6659,7 @@ retry:
scsi_report_luns(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*select_report*/ report_type,
/*rpl_buf*/ lundata,
/*alloc_len*/ alloc_len,
@@ -6796,7 +6824,7 @@ bailout:
static int
scsireadcapacity(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout)
+ char *combinedopt, int task_attr, int retry_count, int timeout)
{
union ccb *ccb;
int blocksizeonly, humanize, numblocks, quiet, sizeonly, baseten;
@@ -6882,7 +6910,7 @@ scsireadcapacity(struct cam_device *device, int argc, char **argv,
scsi_read_capacity(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
&rcap,
SSD_FULL_SIZE,
/*timeout*/ timeout ? timeout : 5000);
@@ -6924,7 +6952,7 @@ scsireadcapacity(struct cam_device *device, int argc, char **argv,
scsi_read_capacity_16(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*lba*/ 0,
/*reladdr*/ 0,
/*pmi*/ 0,
@@ -8365,8 +8393,8 @@ ataaxm(struct cam_device *device, int argc, char **argv,
int
scsigetopcodes(struct cam_device *device, int opcode_set, int opcode,
int show_sa_errors, int sa_set, int service_action,
- int timeout_desc, int retry_count, int timeout, int verbosemode,
- uint32_t *fill_len, uint8_t **data_ptr)
+ int timeout_desc, int task_attr, int retry_count, int timeout,
+ int verbosemode, uint32_t *fill_len, uint8_t **data_ptr)
{
union ccb *ccb = NULL;
uint8_t *buf = NULL;
@@ -8433,7 +8461,7 @@ retry_alloc:
scsi_report_supported_opcodes(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*options*/ options,
/*req_opcode*/ opcode,
/*req_service_action*/ service_action,
@@ -8733,7 +8761,8 @@ bailout:
static int
scsiopcodes(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout, int verbosemode)
+ char *combinedopt, int task_attr, int retry_count, int timeout,
+ int verbosemode)
{
int c;
uint32_t opcode = 0, service_action = 0;
@@ -8797,8 +8826,9 @@ scsiopcodes(struct cam_device *device, int argc, char **argv,
goto bailout;
}
retval = scsigetopcodes(device, opcode_set, opcode, show_sa_errors,
- sa_set, service_action, td_set, retry_count,
- timeout, verbosemode, &valid_len, &buf);
+ sa_set, service_action, td_set, task_attr,
+ retry_count, timeout, verbosemode, &valid_len,
+ &buf);
if (retval != 0)
goto bailout;
@@ -8992,6 +9022,7 @@ usage(int printlong)
"-u unit specify unit number, e.g. \"0\", \"5\"\n"
"-E have the kernel attempt to perform SCSI error recovery\n"
"-C count specify the SCSI command retry count (needs -E to work)\n"
+"-Q task_attr specify ordered, simple or head tag type for SCSI cmds\n"
"modepage arguments:\n"
"-l list all available mode pages\n"
"-m page specify the mode page to view or edit\n"
@@ -9196,10 +9227,11 @@ main(int argc, char **argv)
int timeout = 0, retry_count = 1;
camcontrol_optret optreturn;
char *tstr;
- const char *mainopt = "C:En:t:u:v";
+ const char *mainopt = "C:En:Q:t:u:v";
const char *subopt = NULL;
char combinedopt[256];
int error = 0, optstart = 2;
+ int task_attr = MSG_SIMPLE_Q_TAG;
int devopen = 1;
#ifndef MINIMALISTIC
path_id_t bus;
@@ -9353,6 +9385,40 @@ main(int argc, char **argv)
tstr++;
device = (char *)strdup(tstr);
break;
+ case 'Q': {
+ char *endptr;
+ int table_entry = 0;
+
+ tstr = optarg;
+ while (isspace(*tstr) && (*tstr != '\0'))
+ tstr++;
+ if (isdigit(*tstr)) {
+ task_attr = strtol(tstr, &endptr, 0);
+ if (*endptr != '\0') {
+ errx(1, "Invalid queue option "
+ "%s", tstr);
+ }
+ } else {
+ size_t table_size;
+ scsi_nv_status status;
+
+ table_size = sizeof(task_attrs) /
+ sizeof(task_attrs[0]);
+ status = scsi_get_nv(task_attrs,
+ table_size, tstr, &table_entry,
+ SCSI_NV_FLAG_IG_CASE);
+ if (status == SCSI_NV_FOUND)
+ task_attr = task_attrs[
+ table_entry].value;
+ else {
+ errx(1, "%s option %s",
+ (status == SCSI_NV_AMBIGUOUS)?
+ "ambiguous" : "invalid",
+ tstr);
+ }
+ }
+ break;
+ }
case 't':
timeout = strtol(optarg, NULL, 0);
if (timeout < 0)
@@ -9418,19 +9484,20 @@ main(int argc, char **argv)
break;
#ifndef MINIMALISTIC
case CAM_CMD_TUR:
- error = testunitready(cam_dev, retry_count, timeout, 0);
+ error = testunitready(cam_dev, task_attr, retry_count,
+ timeout, 0);
break;
case CAM_CMD_INQUIRY:
error = scsidoinquiry(cam_dev, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
break;
case CAM_CMD_IDENTIFY:
error = ataidentify(cam_dev, retry_count, timeout);
break;
case CAM_CMD_STARTSTOP:
error = scsistart(cam_dev, arglist & CAM_ARG_START_UNIT,
- arglist & CAM_ARG_EJECT, retry_count,
- timeout);
+ arglist & CAM_ARG_EJECT, task_attr,
+ retry_count, timeout);
break;
#endif /* MINIMALISTIC */
case CAM_CMD_RESCAN:
@@ -9442,15 +9509,15 @@ main(int argc, char **argv)
#ifndef MINIMALISTIC
case CAM_CMD_READ_DEFECTS:
error = readdefects(cam_dev, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
break;
case CAM_CMD_MODE_PAGE:
modepage(cam_dev, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
break;
case CAM_CMD_SCSI_CMD:
error = scsicmd(cam_dev, argc, argv, combinedopt,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
break;
case CAM_CMD_SMP_CMD:
error = smpcmd(cam_dev, argc, argv, combinedopt,
@@ -9480,22 +9547,23 @@ main(int argc, char **argv)
error = tagcontrol(cam_dev, argc, argv, combinedopt);
break;
case CAM_CMD_RATE:
- error = ratecontrol(cam_dev, retry_count, timeout,
- argc, argv, combinedopt);
+ error = ratecontrol(cam_dev, task_attr, retry_count,
+ timeout, argc, argv, combinedopt);
break;
case CAM_CMD_FORMAT:
error = scsiformat(cam_dev, argc, argv,
- combinedopt, retry_count, timeout);
+ combinedopt, task_attr, retry_count,
+ timeout);
break;
case CAM_CMD_REPORTLUNS:
error = scsireportluns(cam_dev, argc, argv,
- combinedopt, retry_count,
- timeout);
+ combinedopt, task_attr,
+ retry_count, timeout);
break;
case CAM_CMD_READCAP:
error = scsireadcapacity(cam_dev, argc, argv,
- combinedopt, retry_count,
- timeout);
+ combinedopt, task_attr,
+ retry_count, timeout);
break;
case CAM_CMD_IDLE:
case CAM_CMD_STANDBY:
@@ -9514,32 +9582,38 @@ main(int argc, char **argv)
break;
case CAM_CMD_DOWNLOAD_FW:
error = fwdownload(cam_dev, argc, argv, combinedopt,
- arglist & CAM_ARG_VERBOSE, retry_count, timeout);
+ arglist & CAM_ARG_VERBOSE, task_attr, retry_count,
+ timeout);
break;
case CAM_CMD_SANITIZE:
error = scsisanitize(cam_dev, argc, argv,
- combinedopt, retry_count, timeout);
+ combinedopt, task_attr,
+ retry_count, timeout);
break;
case CAM_CMD_PERSIST:
error = scsipersist(cam_dev, argc, argv, combinedopt,
- retry_count, timeout, arglist & CAM_ARG_VERBOSE,
+ task_attr, retry_count, timeout,
+ arglist & CAM_ARG_VERBOSE,
arglist & CAM_ARG_ERR_RECOVER);
break;
case CAM_CMD_ATTRIB:
error = scsiattrib(cam_dev, argc, argv, combinedopt,
- retry_count, timeout, arglist & CAM_ARG_VERBOSE,
+ task_attr, retry_count, timeout,
+ arglist & CAM_ARG_VERBOSE,
arglist & CAM_ARG_ERR_RECOVER);
break;
case CAM_CMD_OPCODES:
error = scsiopcodes(cam_dev, argc, argv, combinedopt,
- retry_count, timeout, arglist & CAM_ARG_VERBOSE);
+ task_attr, retry_count, timeout,
+ arglist & CAM_ARG_VERBOSE);
break;
case CAM_CMD_REPROBE:
error = scsireprobe(cam_dev);
break;
case CAM_CMD_ZONE:
error = zone(cam_dev, argc, argv, combinedopt,
- retry_count, timeout, arglist & CAM_ARG_VERBOSE);
+ task_attr, retry_count, timeout,
+ arglist & CAM_ARG_VERBOSE);
break;
case CAM_CMD_EPC:
error = epc(cam_dev, argc, argv, combinedopt,
@@ -9547,7 +9621,8 @@ main(int argc, char **argv)
break;
case CAM_CMD_TIMESTAMP:
error = timestamp(cam_dev, argc, argv, combinedopt,
- retry_count, timeout, arglist & CAM_ARG_VERBOSE);
+ task_attr, retry_count, timeout,
+ arglist & CAM_ARG_VERBOSE);
break;
#endif /* MINIMALISTIC */
case CAM_CMD_USAGE:
diff --git a/sbin/camcontrol/camcontrol.h b/sbin/camcontrol/camcontrol.h
index 9ea1676..1756da6 100644
--- a/sbin/camcontrol/camcontrol.h
+++ b/sbin/camcontrol/camcontrol.h
@@ -75,36 +75,39 @@ int get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error,
uint8_t *status);
int camxferrate(struct cam_device *device);
int fwdownload(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int printerrors, int retry_count,
- int timeout);
+ char *combinedopt, int printerrors, int task_attr,
+ int retry_count, int timeout);
int zone(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout, int verbosemode);
+ int task_attr, int retry_count, int timeout, int verbosemode);
int epc(struct cam_device *device, int argc, char **argv, char *combinedopt,
int retry_count, int timeout, int verbosemode);
int timestamp(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout,
+ char *combinedopt, int task_attr, int retry_count, int timeout,
int verbosemode);
void mode_sense(struct cam_device *device, int dbd, int pc, int page,
- int subpage, int retry_count, int timeout, uint8_t *data,
- int datalen);
-void mode_select(struct cam_device *device, int save_pages, int retry_count,
- int timeout, u_int8_t *data, int datalen);
-void mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
- int edit, int binary, int retry_count, int timeout);
-void mode_list(struct cam_device *device, int dbd, int pc, int subpages,
+ int subpage, int task_attr, int retry_count, int timeout,
+ uint8_t *data, int datalen);
+void mode_select(struct cam_device *device, int save_pages, int task_attr,
+ int retry_count, int timeout, u_int8_t *data, int datalen);
+void mode_edit(struct cam_device *device, int dbd, int pc, int page,
+ int subpage, int edit, int binary, int task_attr,
int retry_count, int timeout);
+void mode_list(struct cam_device *device, int dbd, int pc, int subpages,
+ int task_attr, int retry_count, int timeout);
int scsidoinquiry(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout);
int scsigetopcodes(struct cam_device *device, int opcode_set, int opcode,
int show_sa_errors, int sa_set, int service_action,
- int timeout_desc, int retry_count, int timeout,
- int verbosemode, uint32_t *fill_len, uint8_t **data_ptr);
+ int timeout_desc, int task_attr, int retry_count,
+ int timeout, int verbosemode, uint32_t *fill_len,
+ uint8_t **data_ptr);
int scsipersist(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout, int verbose,
- int err_recover);
+ char *combinedopt, int task_attr, int retry_count,
+ int timeout, int verbose, int err_recover);
int scsiattrib(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int retry_count, int timeout, int verbose,
- int err_recover);
+ char *combinedopt, int task_attr, int retry_count, int timeout,
+ int verbose, int err_recover);
char *cget(void *hook, char *name);
int iget(void *hook, char *name);
void arg_put(void *hook, int letter, void *arg, int count, char *name);
diff --git a/sbin/camcontrol/fwdownload.c b/sbin/camcontrol/fwdownload.c
index 176d8f9..1d4f640 100644
--- a/sbin/camcontrol/fwdownload.c
+++ b/sbin/camcontrol/fwdownload.c
@@ -263,7 +263,7 @@ static const struct fw_timeout_desc fw_timeout_desc_table[] = {
static struct fw_vendor *fw_get_vendor(struct cam_device *cam_dev,
struct ata_params *ident_buf);
static int fw_get_timeout(struct cam_device *cam_dev, struct fw_vendor *vp,
- int retry_count, int timeout);
+ int task_attr, int retry_count, int timeout);
static int fw_validate_ibm(struct cam_device *dev, int retry_count,
int timeout, int fd, char *buf,
const char *fw_img_path, int quiet);
@@ -317,7 +317,7 @@ fw_get_vendor(struct cam_device *cam_dev, struct ata_params *ident_buf)
static int
fw_get_timeout(struct cam_device *cam_dev, struct fw_vendor *vp,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
struct scsi_report_supported_opcodes_one *one;
struct scsi_report_supported_opcodes_timeout *td;
@@ -349,6 +349,7 @@ fw_get_timeout(struct cam_device *cam_dev, struct fw_vendor *vp,
/*sa_set*/ 0,
/*service_action*/ 0,
/*timeout_desc*/ 1,
+ /*task_attr*/ task_attr,
/*retry_count*/ retry_count,
/*timeout*/ 10000,
/*verbose*/ 0,
@@ -919,7 +920,8 @@ bailout:
int
fwdownload(struct cam_device *device, int argc, char **argv,
- char *combinedopt, int printerrors, int retry_count, int timeout)
+ char *combinedopt, int printerrors, int task_attr, int retry_count,
+ int timeout)
{
struct fw_vendor *vp;
char *fw_img_path = NULL;
@@ -994,7 +996,7 @@ fwdownload(struct cam_device *device, int argc, char **argv,
&& (devtype == CC_DT_SCSI))
errx(1, "Unsupported device");
- retval = fw_get_timeout(device, vp, retry_count, timeout);
+ retval = fw_get_timeout(device, vp, task_attr, retry_count, timeout);
if (retval != 0) {
warnx("Unable to get a firmware download timeout value");
goto bailout;
@@ -1012,8 +1014,8 @@ fwdownload(struct cam_device *device, int argc, char **argv,
" into the following device:\n",
fw_img_path);
if (devtype == CC_DT_SCSI) {
- if (scsidoinquiry(device, argc, argv, combinedopt, 0,
- 5000) != 0) {
+ if (scsidoinquiry(device, argc, argv, combinedopt,
+ MSG_SIMPLE_Q_TAG, 0, 5000) != 0) {
warnx("Error sending inquiry");
retval = 1;
goto bailout;
diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c
index 90862db..b636515 100644
--- a/sbin/camcontrol/modeedit.c
+++ b/sbin/camcontrol/modeedit.c
@@ -106,10 +106,11 @@ static int editentry_set(char *name, char *newvalue,
int editonly);
static void editlist_populate(struct cam_device *device, int dbd,
int pc, int page, int subpage,
- int retries, int timeout);
+ int task_attr, int retries,
+ int timeout);
static void editlist_save(struct cam_device *device, int dbd,
int pc, int page, int subpage,
- int retries, int timeout);
+ int task_attr, int retries, int timeout);
static void nameentry_create(int page, int subpage, char *name);
static struct pagename *nameentry_lookup(int page, int subpage);
static int load_format(const char *pagedb_path, int lpage,
@@ -118,8 +119,8 @@ static int modepage_write(FILE *file, int editonly);
static int modepage_read(FILE *file);
static void modepage_edit(void);
static void modepage_dump(struct cam_device *device, int dbd,
- int pc, int page, int subpage, int retries,
- int timeout);
+ int pc, int page, int subpage, int task_attr,
+ int retries, int timeout);
static void cleanup_editfile(void);
@@ -550,7 +551,7 @@ load_format(const char *pagedb_path, int lpage, int lsubpage)
static void
editlist_populate(struct cam_device *device, int dbd, int pc, int page,
- int subpage, int retries, int timeout)
+ int subpage, int task_attr, int retries, int timeout)
{
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
u_int8_t *mode_pars; /* Pointer to modepage params. */
@@ -562,8 +563,8 @@ editlist_populate(struct cam_device *device, int dbd, int pc, int page,
STAILQ_INIT(&editlist);
/* Fetch changeable values; use to build initial editlist. */
- mode_sense(device, dbd, 1, page, subpage, retries, timeout, data,
- sizeof(data));
+ mode_sense(device, dbd, 1, page, subpage, task_attr, retries, timeout,
+ data, sizeof(data));
mh = (struct scsi_mode_header_6 *)data;
mph = MODE_PAGE_HEADER(mh);
@@ -581,14 +582,14 @@ editlist_populate(struct cam_device *device, int dbd, int pc, int page,
buff_decode_visit(mode_pars, len, format, editentry_create, 0);
/* Fetch the current/saved values; use to set editentry values. */
- mode_sense(device, dbd, pc, page, subpage, retries, timeout,
+ mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
data, sizeof(data));
buff_decode_visit(mode_pars, len, format, editentry_update, 0);
}
static void
editlist_save(struct cam_device *device, int dbd, int pc, int page,
- int subpage, int retries, int timeout)
+ int subpage, int task_attr, int retries, int timeout)
{
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
u_int8_t *mode_pars; /* Pointer to modepage params. */
@@ -602,7 +603,7 @@ editlist_save(struct cam_device *device, int dbd, int pc, int page,
return;
/* Preload the CDB buffer with the current mode page data. */
- mode_sense(device, dbd, pc, page, subpage, retries, timeout,
+ mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
data, sizeof(data));
/* Initial headers & offsets. */
@@ -639,7 +640,8 @@ editlist_save(struct cam_device *device, int dbd, int pc, int page,
* recorded.
*/
mode_select(device, (pc << PAGE_CTRL_SHIFT == SMS_PAGE_CTRL_SAVED),
- retries, timeout, (u_int8_t *)mh, sizeof(*mh) + hlen + len);
+ task_attr, retries, timeout, (u_int8_t *)mh,
+ sizeof(*mh) + hlen + len);
}
static int
@@ -809,7 +811,7 @@ modepage_edit(void)
static void
modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage,
- int retries, int timeout)
+ int task_attr, int retries, int timeout)
{
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
u_int8_t *mode_pars; /* Pointer to modepage params. */
@@ -818,7 +820,7 @@ modepage_dump(struct cam_device *device, int dbd, int pc, int page, int subpage,
struct scsi_mode_page_header_sp *mphsp;
size_t indx, len;
- mode_sense(device, dbd, pc, page, subpage, retries, timeout,
+ mode_sense(device, dbd, pc, page, subpage, task_attr, retries, timeout,
data, sizeof(data));
mh = (struct scsi_mode_header_6 *)data;
@@ -853,7 +855,7 @@ cleanup_editfile(void)
void
mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
- int edit, int binary, int retry_count, int timeout)
+ int edit, int binary, int task_attr, int retry_count, int timeout)
{
const char *pagedb_path; /* Path to modepage database. */
@@ -884,8 +886,8 @@ mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
exit(EX_OSFILE);
}
- editlist_populate(device, dbd, pc, page, subpage, retry_count,
- timeout);
+ editlist_populate(device, dbd, pc, page, subpage, task_attr,
+ retry_count, timeout);
}
if (edit) {
@@ -894,10 +896,12 @@ mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
errx(EX_USAGE, "it only makes sense to edit page 0 "
"(current) or page 3 (saved values)");
modepage_edit();
- editlist_save(device, dbd, pc, page, subpage, retry_count, timeout);
+ editlist_save(device, dbd, pc, page, subpage, task_attr,
+ retry_count, timeout);
} else if (binary || STAILQ_EMPTY(&editlist)) {
/* Display without formatting information. */
- modepage_dump(device, dbd, pc, page, subpage, retry_count, timeout);
+ modepage_dump(device, dbd, pc, page, subpage, task_attr,
+ retry_count, timeout);
} else {
/* Display with format. */
modepage_write(stdout, 0);
@@ -906,7 +910,7 @@ mode_edit(struct cam_device *device, int dbd, int pc, int page, int subpage,
void
mode_list(struct cam_device *device, int dbd, int pc, int subpages,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */
struct scsi_mode_header_6 *mh; /* Location of mode header. */
@@ -927,7 +931,7 @@ mode_list(struct cam_device *device, int dbd, int pc, int subpages,
/* Build the list of all mode pages by querying the "all pages" page. */
mode_sense(device, dbd, pc, SMS_ALL_PAGES_PAGE,
subpages ? SMS_SUBPAGE_ALL : 0,
- retry_count, timeout, data, sizeof(data));
+ task_attr, retry_count, timeout, data, sizeof(data));
mh = (struct scsi_mode_header_6 *)data;
len = sizeof(*mh) + mh->blk_desc_len; /* Skip block descriptors. */
diff --git a/sbin/camcontrol/persist.c b/sbin/camcontrol/persist.c
index e53c4fa..34beb2e 100644
--- a/sbin/camcontrol/persist.c
+++ b/sbin/camcontrol/persist.c
@@ -423,7 +423,8 @@ persist_print_full(struct scsi_per_res_in_header *hdr, uint32_t valid_len)
int
scsipersist(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout, int verbosemode, int err_recover)
+ int task_attr, int retry_count, int timeout, int verbosemode,
+ int err_recover)
{
union ccb *ccb = NULL;
int c, in = 0, out = 0;
@@ -754,7 +755,7 @@ retry:
scsi_persistent_reserve_in(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*service_action*/ action,
/*data_ptr*/ res_buf,
/*dxfer_len*/ res_len,
@@ -836,7 +837,7 @@ retry:
scsi_persistent_reserve_out(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*service_action*/ action,
/*scope*/ scope,
/*res_type*/ res_type,
diff --git a/sbin/camcontrol/timestamp.c b/sbin/camcontrol/timestamp.c
index 032357b..6c1f5f0 100644
--- a/sbin/camcontrol/timestamp.c
+++ b/sbin/camcontrol/timestamp.c
@@ -62,16 +62,17 @@ __FBSDID("$FreeBSD$");
#define UTC "utc"
static int set_restore_flags(struct cam_device *device, uint8_t *flags,
- int set_flag, int retry_count, int timeout);
+ int set_flag, int task_attr, int retry_count,
+ int timeout);
static int report_timestamp(struct cam_device *device, uint64_t *ts,
- int retry_count, int timeout);
+ int task_attr, int retry_count, int timeout);
static int set_timestamp(struct cam_device *device, char *format_string,
- char *timestamp_string,
- int retry_count, int timeout);
+ char *timestamp_string, int task_attr, int retry_count,
+ int timeout);
static int
set_restore_flags(struct cam_device *device, uint8_t *flags, int set_flag,
- int retry_count, int timeout)
+ int task_attr, int retry_count, int timeout)
{
unsigned long blk_desc_length, hdr_and_blk_length;
int error = 0;
@@ -97,7 +98,7 @@ set_restore_flags(struct cam_device *device, uint8_t *flags, int set_flag,
scsi_mode_sense_len(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*dbd*/ 0,
/*page_control*/ SMS_PAGE_CTRL_CURRENT,
/*page*/ SCEP_PAGE_CODE,
@@ -154,7 +155,7 @@ set_restore_flags(struct cam_device *device, uint8_t *flags, int set_flag,
scsi_mode_select_len(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*scsi_page_fmt*/ 1,
/*save_pages*/ 0,
/*param_buf*/ &mode_buf[0],
@@ -188,7 +189,7 @@ bailout:
}
static int
-report_timestamp(struct cam_device *device, uint64_t *ts,
+report_timestamp(struct cam_device *device, uint64_t *ts, int task_attr,
int retry_count, int timeout)
{
int error = 0;
@@ -209,7 +210,7 @@ report_timestamp(struct cam_device *device, uint64_t *ts,
scsi_report_timestamp(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*pdf*/ 0,
/*buf*/ report_buf,
/*buf_len*/ report_buf_size,
@@ -246,7 +247,7 @@ bailout:
static int
set_timestamp(struct cam_device *device, char *format_string,
- char *timestamp_string, int retry_count,
+ char *timestamp_string, int task_attr, int retry_count,
int timeout)
{
struct scsi_set_timestamp_parameters ts_p;
@@ -258,8 +259,8 @@ set_timestamp(struct cam_device *device, char *format_string,
union ccb *ccb = NULL;
int do_restore_flags = 0;
- error = set_restore_flags(device, &flags, /*set_flag*/ 1, retry_count,
- timeout);
+ error = set_restore_flags(device, &flags, /*set_flag*/ 1, task_attr,
+ retry_count, timeout);
if (error != 0)
goto bailout;
@@ -288,7 +289,7 @@ set_timestamp(struct cam_device *device, char *format_string,
scsi_set_timestamp(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*buf*/ &ts_p,
/*buf_len*/ sizeof(ts_p),
/*sense_len*/ SSD_FULL_SIZE,
@@ -316,7 +317,7 @@ set_timestamp(struct cam_device *device, char *format_string,
bailout:
if (do_restore_flags != 0)
error = set_restore_flags(device, &flags, /*set_flag*/ 0,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
if (ccb != NULL)
cam_freeccb(ccb);
@@ -325,7 +326,7 @@ bailout:
int
timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout, int verbosemode __unused)
+ int task_attr, int retry_count, int timeout, int verbosemode __unused)
{
int c;
uint64_t ts = 0;
@@ -450,7 +451,7 @@ timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt,
}
if (action == TIMESTAMP_REPORT) {
- error = report_timestamp(device, &ts, retry_count,
+ error = report_timestamp(device, &ts, task_attr, retry_count,
timeout);
if (error != 0) {
goto bailout;
@@ -486,7 +487,7 @@ timestamp(struct cam_device *device, int argc, char **argv, char *combinedopt,
}
error = set_timestamp(device, format_string, timestamp_string,
- retry_count, timeout);
+ task_attr, retry_count, timeout);
}
bailout:
diff --git a/sbin/camcontrol/zone.c b/sbin/camcontrol/zone.c
index 87a1842..853607d 100644
--- a/sbin/camcontrol/zone.c
+++ b/sbin/camcontrol/zone.c
@@ -322,7 +322,7 @@ bailout:
int
zone(struct cam_device *device, int argc, char **argv, char *combinedopt,
- int retry_count, int timeout, int verbosemode __unused)
+ int task_attr, int retry_count, int timeout, int verbosemode __unused)
{
union ccb *ccb = NULL;
int action = -1, rep_option = -1;
@@ -455,7 +455,7 @@ restart_report:
scsi_zbc_in(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*service_action*/ action,
/*zone_start_lba*/ lba,
/*zone_options*/ (rep_option != -1) ?
@@ -500,7 +500,7 @@ restart_report:
error = build_ata_cmd(ccb,
/*retry_count*/ retry_count,
/*flags*/ CAM_DIR_IN | CAM_DEV_QFRZDIS,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*protocol*/ protocol,
/*ata_flags*/ AP_FLAG_BYT_BLOK_BLOCKS |
AP_FLAG_TLEN_SECT_CNT |
@@ -548,7 +548,7 @@ restart_report:
scsi_zbc_out(&ccb->csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*service_action*/ action,
/*zone_id*/ lba,
/*zone_flags*/ (all_zones != 0) ? ZBC_OUT_ALL : 0,
@@ -593,7 +593,7 @@ restart_report:
error = build_ata_cmd(ccb,
/*retry_count*/ retry_count,
/*flags*/ CAM_DIR_NONE | CAM_DEV_QFRZDIS,
- /*tag_action*/ MSG_SIMPLE_Q_TAG,
+ /*tag_action*/ task_attr,
/*protocol*/ AP_PROTO_NON_DATA,
/*ata_flags*/ AP_FLAG_BYT_BLOK_BYTES |
AP_FLAG_TLEN_NO_DATA,
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index b2aea19..d8738e2 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -95,6 +95,7 @@ __FBSDID("$FreeBSD$");
#include <map>
#include <string>
#include <list>
+#include <stdexcept>
#include <vector>
#include "devd.h" /* C compatible definitions */
@@ -372,7 +373,7 @@ media::do_match(config &c)
s = socket(PF_INET, SOCK_DGRAM, 0);
if (s >= 0) {
memset(&ifmr, 0, sizeof(ifmr));
- strncpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
+ strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0 &&
ifmr.ifm_status & IFM_AVALID) {
@@ -871,8 +872,10 @@ create_socket(const char *name, int socktype)
if (::bind(fd, (struct sockaddr *) & sun, slen) < 0)
err(1, "bind");
listen(fd, 4);
- chown(name, 0, 0); /* XXX - root.wheel */
- chmod(name, 0666);
+ if (chown(name, 0, 0)) /* XXX - root.wheel */
+ err(1, "chown");
+ if (chmod(name, 0666))
+ err(1, "chmod");
return (fd);
}
@@ -1058,7 +1061,13 @@ event_loop(void)
buffer[rv] = '\0';
while (buffer[--rv] == '\n')
buffer[rv] = '\0';
- process_event(buffer);
+ try {
+ process_event(buffer);
+ }
+ catch (std::length_error e) {
+ devdlog(LOG_ERR, "Dropping event %s "
+ "due to low memory", buffer);
+ }
} else if (rv < 0) {
if (errno != EINTR)
break;
@@ -1076,6 +1085,8 @@ event_loop(void)
if (FD_ISSET(seqpacket_fd, &fds))
new_client(seqpacket_fd, SOCK_SEQPACKET);
}
+ close(seqpacket_fd);
+ close(stream_fd);
close(fd);
}
@@ -1218,7 +1229,8 @@ check_devd_enabled()
if (val == 0) {
warnx("Setting " SYSCTL " to 1000");
val = 1000;
- sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val));
+ if (sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val)))
+ err(1, "sysctlbyname");
}
}
diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1
index 6fa0393..45125af 100644
--- a/sbin/md5/md5.1
+++ b/sbin/md5/md5.1
@@ -67,21 +67,17 @@ in a secure manner before being encrypted with a private
key under a public-key cryptosystem such as
.Tn RSA .
.Pp
+The
.Tn MD5
-has been completely broken as far as finding collisions is
-concerned, and should not be relied upon to produce unique outputs.
-This also means that
-.Tn MD5
-should not be used as part of a cryptographic signature scheme.
-At the current time (2014-05-17) there is no publicly known method to
-.Dq reverse
-MD5, i.e., to find an input given a hash value.
-.Pp
-.Tn SHA-1
-currently (2014-05-17) has no known collisions, but an attack has been
-found which is faster than a brute-force search, placing the security of
+and
.Tn SHA-1
-in doubt.
+algorithms have been proven to be vulnerable to practical collision
+attacks and should not be relied upon to produce unique outputs, nor
+should they be used as part of a cryptographic signature scheme.
+As of 2017-03-02, there is no publicly known method to
+.Em reverse
+either algorithm, i.e. to find an input that produces a specific
+output.
.Pp
.Tn SHA-512t256
is a version of
@@ -94,6 +90,8 @@ The hashes are not interchangeable.
.Pp
It is recommended that all new applications use
.Tn SHA-512
+or
+.Tn SKEIN-512
instead of one of the other hash functions.
.Pp
The following options may be used in any combination and must
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 951f4af..1ac5387 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -103,6 +103,7 @@ MAN= aac.4 \
cdce.4 \
cfi.4 \
ch.4 \
+ chromebook_platform.4 \
ciss.4 \
cloudabi.4 \
cm.4 \
@@ -240,6 +241,7 @@ MAN= aac.4 \
ixgbe.4 \
ixl.4 \
ixlv.4 \
+ jedec_ts.4 \
jme.4 \
joy.4 \
kbdmux.4 \
diff --git a/share/man/man4/ctl.4 b/share/man/man4/ctl.4
index 1061ead..89bcd8b 100644
--- a/share/man/man4/ctl.4
+++ b/share/man/man4/ctl.4
@@ -24,7 +24,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd September 27, 2015
+.Dd January 19, 2017
.Dt CTL 4
.Os
.Sh NAME
@@ -158,10 +158,9 @@ Verbosity level for log messages from the kernel part of iSCSI target.
Set to 0 to disable logging or 1 to warn about potential problems.
Larger values enable debugging output.
Defaults to 1.
-.It Va kern.cam.ctl.iscsi.maxcmdsn_delta
-The number of outstanding commands to advertise to the iSCSI initiator.
-Technically, it is the difference between ExpCmdSN and MaxCmdSN fields
-in the iSCSI PDU.
+.It Va kern.cam.ctl.iscsi.maxtags
+The number of outstanding commands to advertise to each iSCSI initiator.
+Current implementation is not very accurate, so do not set this below 2.
Defaults to 256.
.It Va kern.cam.ctl.iscsi.ping_timeout
The number of seconds to wait for the iSCSI initiator to respond to a NOP-In
diff --git a/share/man/man4/da.4 b/share/man/man4/da.4
index 464994a..eb1c09a 100644
--- a/share/man/man4/da.4
+++ b/share/man/man4/da.4
@@ -156,7 +156,7 @@ Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is.
The default is sorting enabled for HDDs and disabled for SSDs.
.It Va kern.cam.da. Ns Ar X Ns Va .delete_method
This variable specifies method to handle BIO_DELETE requests:
-.Bl -tag
+.Bl -tag -width "ATA_TRIM"
.It ATA_TRIM
ATA TRIM via ATA COMMAND PASS THROUGH command,
.It UNMAP
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
index 6b072ba..fffd6cf 100644
--- a/share/man/man4/ddb.4
+++ b/share/man/man4/ddb.4
@@ -60,7 +60,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 13, 2016
+.Dd March 3, 2017
.Dt DDB 4
.Os
.Sh NAME
@@ -146,7 +146,7 @@ to be the same as
.Pp
The general command syntax is:
.Ar command Ns Op Li / Ns Ar modifier
-.Oo Ar addr Oc Ns Op Li , Ns Ar count
+.Oo Ar addr Oc Ns Op , Ns Ar count
.Pp
A blank line repeats the previous command from the address
.Va next
@@ -213,11 +213,11 @@ current line.
.Bl -tag -width indent -compact
.It Xo
.Ic examine Ns Op Li / Ns Cm AISabcdghilmorsuxz ...
-.Oo Ar addr Oc Ns Op Li , Ns Ar count
+.Oo Ar addr Oc Ns Op , Ns Ar count
.Xc
.It Xo
.Ic x Ns Op Li / Ns Cm AISabcdghilmorsuxz ...
-.Oo Ar addr Oc Ns Op Li , Ns Ar count
+.Oo Ar addr Oc Ns Op , Ns Ar count
.Xc
Display the addressed locations according to the formats in the modifier.
Multiple modifier formats display multiple locations.
@@ -343,8 +343,8 @@ Set the named variable or register with the value of
.Ar expr .
Valid variable names are described below.
.Pp
-.It Ic break Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count
-.It Ic b Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op Li , Ns Ar count
+.It Ic break Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op , Ns Ar count
+.It Ic b Ns Oo Li / Ns Cm u Oc Oo Ar addr Oc Ns Op , Ns Ar count
Set a break point at
.Ar addr .
If
@@ -394,7 +394,7 @@ command, or by omitting
to get the default address of
.Va dot .
.Pp
-.It Ic watch Oo Ar addr Oc Ns Op Li , Ns Ar size
+.It Ic watch Oo Ar addr Oc Ns Op , Ns Ar size
Set a watchpoint for a region.
Execution stops when an attempt to modify the region occurs.
The
@@ -408,7 +408,7 @@ Attempts to watch wired kernel memory
may cause unrecoverable error in some systems such as i386.
Watchpoints on user addresses work best.
.Pp
-.It Ic hwatch Oo Ar addr Oc Ns Op Li , Ns Ar size
+.It Ic hwatch Oo Ar addr Oc Ns Op , Ns Ar size
Set a hardware watchpoint for a region if supported by the
architecture.
Execution stops when an attempt to modify the region occurs.
@@ -424,11 +424,11 @@ Use
for setting watchpoints on kernel address locations only, and avoid
its use on user mode address spaces.
.Pp
-.It Ic dhwatch Oo Ar addr Oc Ns Op Li , Ns Ar size
+.It Ic dhwatch Oo Ar addr Oc Ns Op , Ns Ar size
Delete specified hardware watchpoint.
.Pp
-.It Ic step Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count
-.It Ic s Ns Oo Li / Ns Cm p Oc Ns Op Li , Ns Ar count
+.It Ic step Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
+.It Ic s Ns Oo Li / Ns Cm p Oc Ns Op , Ns Ar count
Single step
.Ar count
times.
@@ -478,22 +478,22 @@ Otherwise, only print when the matching return is hit.
.It Xo
.Ic trace Ns Op Li / Ns Cm u
.Op Ar pid | tid Ns
-.Op Li , Ns Ar count
+.Op , Ns Ar count
.Xc
.It Xo
.Ic t Ns Op Li / Ns Cm u
.Op Ar pid | tid Ns
-.Op Li , Ns Ar count
+.Op , Ns Ar count
.Xc
.It Xo
.Ic where Ns Op Li / Ns Cm u
.Op Ar pid | tid Ns
-.Op Li , Ns Ar count
+.Op , Ns Ar count
.Xc
.It Xo
.Ic bt Ns Op Li / Ns Cm u
.Op Ar pid | tid Ns
-.Op Li , Ns Ar count
+.Op , Ns Ar count
.Xc
Stack trace.
The
@@ -518,7 +518,7 @@ only if the machine dependent code supports it.
.Ar addr
.Ar value
.Op Ar mask Ns
-.Op Li , Ns Ar count
+.Op , Ns Ar count
.Xc
Search memory for
.Ar value .
@@ -768,12 +768,12 @@ Possible types include
Name of the lock.
.It Ic flags:
Flags passed to the lock initialization function.
-For exact possibilities see manual pages of possible lock types.
+.Em flags
+values are lock class specific.
.It Ic state:
Current state of a lock.
-As well as
-.Ic flags
-it's lock-specific.
+.Em state
+values are lock class specific.
.It Ic owner:
Lock owner.
.El
diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4
index ec6d9f1..ef5bed8 100644
--- a/share/man/man4/tty.4
+++ b/share/man/man4/tty.4
@@ -28,7 +28,7 @@
.\" @(#)tty.4 8.3 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd December 26, 2009
+.Dd January 11, 2017
.Dt TTY 4
.Os
.Sh NAME
@@ -238,7 +238,16 @@ Start output on the terminal (like typing ^Q at the keyboard).
Make the terminal the controlling terminal for the process (the process
must not currently have a controlling terminal).
.It Dv TIOCDRAIN Fa void
-Wait until all output is drained.
+Wait until all output is drained, or until the drain wait timeout expires.
+.It Dv TIOCGDRAINWAIT Fa int *timeout
+Return the current drain wait timeout in seconds.
+.It Dv TIOCSDRAINWAIT Fa int *timeout
+Set the drain wait timeout in seconds.
+A value of zero disables timeouts.
+The default drain wait timeout is controlled by the tunable
+.Xr sysctl 8
+OID
+.Va kern.tty_drainwait .
.It Dv TIOCEXCL Fa void
Set exclusive use on the terminal.
No further opens are permitted except by root.
diff --git a/share/man/man4/wpi.4 b/share/man/man4/wpi.4
index 1de3c8d..7a5143f 100644
--- a/share/man/man4/wpi.4
+++ b/share/man/man4/wpi.4
@@ -85,7 +85,7 @@ driver offloads both encryption and decryption of data frames to the
hardware for the CCMP cipher.
.Pp
This driver requires the firmware built with the
-.Nm wpifw
+.Nm wpifw 4
module to work.
.Pp
The
@@ -144,7 +144,7 @@ The driver failed to load the firmware image using the
.Xr firmware 9
subsystem.
Verify the
-.Xr wpifw
+.Xr wpifw 4
firmware module is installed.
.It "wpi%d: %s: timeout waiting for adapter to initialize, error %d"
The onboard microcontroller failed to initialize in time.
diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors
index 7ffc6df..c06137f 100644
--- a/share/misc/pci_vendors
+++ b/share/misc/pci_vendors
@@ -3,8 +3,8 @@
#
# List of PCI ID's
#
-# Version: 2017.01.08
-# Date: 2017-01-08 03:15:02
+# Version: 2017.02.15
+# Date: 2017-02-15 03:15:02
#
# Maintained by Albert Pool, Martin Mares, and other volunteers from
# the PCI ID Project at http://pci-ids.ucw.cz/.
@@ -2254,6 +2254,7 @@
1043 2016 Trinidad PRO [Radeon R9 370 OEM]
1458 2016 Trinidad PRO [Radeon R9 370 OEM]
1462 2016 Trinidad PRO [Radeon R9 370 OEM]
+ 1462 3050 R9 270 Gaming OC
148c 2016 Trinidad PRO [Radeon R9 370 OEM]
1682 2015 Trinidad PRO [Radeon R7 370]
174b 2016 Trinidad PRO [Radeon R9 370 OEM]
@@ -5520,6 +5521,10 @@
8056 Rockwell HCF 56K modem
808a Memory Stick Controller
81ce SxS Pro memory card
+# 2nd ID
+ 905c SxS Pro memory card
+# 2nd ID
+ 907f SxS Pro+ memory card
908f Aeolia ACPI
909e Aeolia Ethernet Controller (Marvell Yukon 2 Family)
909f Aeolia SATA AHCI Controller
@@ -5528,6 +5533,7 @@
90a2 Aeolia DMA Controller
90a3 Aeolia Memory (DDR3/SPM)
90a4 Aeolia USB 3.0 xHCI Host Controller
+ 90bc SxS Pro+ memory card
104e Oak Technology, Inc
0017 OTI-64017
0107 OTI-107 [Spitfire]
@@ -6093,6 +6099,20 @@
1077 0246 8300 Series Dual Port 10GbE Converged Network Adapter (TCP/IP Networking)
8031 8300 Series 10GbE Converged Network Adapter (FCoE)
8032 8300 Series 10GbE Converged Network Adapter (iSCSI)
+ 8070 FastLinQ QL41000 Series 10/25/40/50GbE Controller
+ 1077 0011 FastLinQ QL41212H 25GbE Adapter
+ 1077 0012 FastLinQ QL41112H 10GbE Adapter
+ 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE)
+ 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter
+ 1077 000e FastLinQ QL41162H 10GbE FCoE Adapter
+ 8084 FastLinQ QL41000 Series 10/25/40/50GbE Controller (iSCSI)
+ 1077 000d FastLinQ QL41262H 25GbE iSCSI Adapter
+ 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter
+ 8090 FastLinQ QL41000 Series Gigabit Ethernet Controller (SR-IOV VF)
+ 1077 000d FastLinQ QL41262H 25GbE FCoE Adapter (SR-IOV VF)
+ 1077 000e FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF)
+ 1077 0011 FastLinQ QL41212H 25GbE Adapter (SR-IOV VF)
+ 1077 0012 FastLinQ QL41112H 10GbE Adapter (SR-IOV VF)
8430 ISP8324 1/10GbE Converged Network Controller (NIC VF)
8431 8300 Series 10GbE Converged Network Adapter (FCoE VF)
8432 ISP2432M-based 10GbE Converged Network Adapter (CNA)
@@ -10584,6 +10604,7 @@
1347 GM108M [GeForce 940M]
1348 GM108M [GeForce 945M / 945A]
1349 GM108M [GeForce 930M]
+ 134b GM108M [GeForce 940MX]
134d GM108M [GeForce 940MX]
134e GM108M [GeForce 930MX]
134f GM108M [GeForce 920MX]
@@ -10616,6 +10637,8 @@
13b1 GM107GLM [Quadro M1000M]
13b2 GM107GLM [Quadro M600M]
13b3 GM107GLM [Quadro K2200M]
+ 13b4 GM107GLM [Quadro M620 Mobile]
+ 13b6 GM107GLM [Quadro M1200 Mobile]
13b9 GM107GL [NVS 810]
13ba GM107GL [Quadro K2200]
13bb GM107GL [Quadro K620]
@@ -10648,6 +10671,7 @@
1427 GM206M [GeForce GTX 965M]
1430 GM206GL [Quadro M2000]
1431 GM206GL [Tesla M4]
+ 1436 GM206GLM [Quadro M2200 Mobile]
15f0 GP100GL
15f1 GP100GL
15f7 GP100GL [Tesla P100 PCIe 12GB]
@@ -10677,28 +10701,31 @@
1b82 GP104
1b83 GP104
1b84 GP104 [GeForce GTX 1060 3GB]
- 1ba0 GP104M [GeForce GTX 1080]
- 1ba1 GP104M [GeForce GTX 1070]
+ 1ba0 GP104M [GeForce GTX 1080 Mobile]
+ 1ba1 GP104M [GeForce GTX 1070 Mobile]
1bb0 GP104GL [Quadro P5000]
1bb1 GP104GL
1bb3 GP104GL [Tesla P4]
1bb4 GP104GL
- 1be0 GP104M [GeForce GTX 1080]
- 1be1 GP104M [GeForce GTX 1070]
+ 1bb6 GP104GLM [Quadro P5000 Mobile]
+ 1bb7 GP104GLM [Quadro P4000 Mobile]
+ 1bb8 GP104GLM [Quadro P3000 Mobile]
+ 1be0 GP104M [GeForce GTX 1080 Mobile]
+ 1be1 GP104M [GeForce GTX 1070 Mobile]
1c00 GP106
1c01 GP106
1c02 GP106 [GeForce GTX 1060 3GB]
1c03 GP106 [GeForce GTX 1060 6GB]
- 1c20 GP106M [GeForce GTX 1060]
+ 1c20 GP106M [GeForce GTX 1060 Mobile]
1c30 GP106GL
1c35 GP106
- 1c60 GP106M [GeForce GTX 1060]
+ 1c60 GP106M [GeForce GTX 1060 Mobile]
1c70 GP106GL
1c80 GP107
1c81 GP107 [GeForce GTX 1050]
1c82 GP107 [GeForce GTX 1050 Ti]
- 1c8c GP107M [GeForce GTX 1050 Ti]
- 1c8d GP107M [GeForce GTX 1050]
+ 1c8c GP107M [GeForce GTX 1050 Ti Mobile]
+ 1c8d GP107M [GeForce GTX 1050 Mobile]
1c8e GP107M
1ca7 GP107GL
1ca8 GP107GL
@@ -13224,6 +13251,7 @@
0001 FireStream 155
0003 FireStream 50
119f Bull HN Information Systems
+ 1081 BXI Host Channel Adapter
11a0 Convex Computer Corporation
11a1 Hamamatsu Photonics K.K.
11a2 Sierra Research and Technology
@@ -16021,6 +16049,9 @@
509b T540-509B Unified Wire Ethernet Controller
509c T520-509C Unified Wire Ethernet Controller
509d T540-509D Unified Wire Ethernet Controller
+ 509e T520-509E Unified Wire Ethernet Controller
+ 509f T540-509F Unified Wire Ethernet Controller
+ 50a0 T540-50A0 Unified Wire Ethernet Controller
5401 T520-CR Unified Wire Ethernet Controller
5402 T522-CR Unified Wire Ethernet Controller
5403 T540-CR Unified Wire Ethernet Controller
@@ -16049,7 +16080,7 @@
5481 T540-5081 Unified Wire Ethernet Controller
5482 T504-5082 Unified Wire Ethernet Controller
5483 T540-5083 Unified Wire Ethernet Controller
- 5484 T580-5084 Unified Wire Ethernet Controller
+ 5484 T540-5084 Unified Wire Ethernet Controller
5485 T580-5085 Unified Wire Ethernet Controller
5486 T580-5086 Unified Wire Ethernet Controller
5487 T580-5087 Unified Wire Ethernet Controller
@@ -16069,6 +16100,9 @@
549b T540-509B Unified Wire Ethernet Controller
549c T520-509C Unified Wire Ethernet Controller
549d T540-509D Unified Wire Ethernet Controller
+ 549e T520-509E Unified Wire Ethernet Controller
+ 549f T540-509F Unified Wire Ethernet Controller
+ 54a0 T540-50A0 Unified Wire Ethernet Controller
5501 T520-CR Unified Wire Storage Controller
5502 T522-CR Unified Wire Storage Controller
5503 T540-CR Unified Wire Storage Controller
@@ -16097,7 +16131,7 @@
5581 T540-5081 Unified Wire Storage Controller
5582 T504-5082 Unified Wire Storage Controller
5583 T540-5083 Unified Wire Storage Controller
- 5584 T580-5084 Unified Wire Storage Controller
+ 5584 T540-5084 Unified Wire Storage Controller
5585 T580-5085 Unified Wire Storage Controller
5586 T580-5086 Unified Wire Storage Controller
5587 T580-5087 Unified Wire Storage Controller
@@ -16117,6 +16151,9 @@
559b T540-509B Unified Wire Storage Controller
559c T520-509C Unified Wire Storage Controller
559d T540-509D Unified Wire Storage Controller
+ 559e T520-509E Unified Wire Storage Controller
+ 559f T540-509F Unified Wire Storage Controller
+ 55a0 T540-50A0 Unified Wire Storage Controller
5601 T520-CR Unified Wire Storage Controller
5602 T522-CR Unified Wire Storage Controller
5603 T540-CR Unified Wire Storage Controller
@@ -16145,7 +16182,7 @@
5681 T540-5081 Unified Wire Storage Controller
5682 T504-5082 Unified Wire Storage Controller
5683 T540-5083 Unified Wire Storage Controller
- 5684 T580-5084 Unified Wire Storage Controller
+ 5684 T540-5084 Unified Wire Storage Controller
5685 T580-5085 Unified Wire Storage Controller
5686 T580-5086 Unified Wire Storage Controller
5687 T580-5087 Unified Wire Storage Controller
@@ -16165,6 +16202,9 @@
569b T540-509B Unified Wire Storage Controller
569c T520-509C Unified Wire Storage Controller
569d T540-509D Unified Wire Storage Controller
+ 569e T520-509E Unified Wire Storage Controller
+ 569f T540-509F Unified Wire Storage Controller
+ 56a0 T540-50A0 Unified Wire Storage Controller
5701 T520-CR Unified Wire Ethernet Controller
5702 T522-CR Unified Wire Ethernet Controller
5703 T540-CR Unified Wire Ethernet Controller
@@ -16232,7 +16272,7 @@
5881 T540-5081 Unified Wire Ethernet Controller [VF]
5882 T504-5082 Unified Wire Ethernet Controller [VF]
5883 T540-5083 Unified Wire Ethernet Controller [VF]
- 5884 T580-5084 Unified Wire Ethernet Controller [VF]
+ 5884 T540-5084 Unified Wire Ethernet Controller [VF]
5885 T580-5085 Unified Wire Ethernet Controller [VF]
5886 T580-5086 Unified Wire Ethernet Controller [VF]
5887 T580-5087 Unified Wire Ethernet Controller [VF]
@@ -16252,6 +16292,9 @@
589b T540-509B Unified Wire Ethernet Controller [VF]
589c T520-509C Unified Wire Ethernet Controller [VF]
589d T540-509D Unified Wire Ethernet Controller [VF]
+ 589e T520-509E Unified Wire Ethernet Controller [VF]
+ 589f T540-509F Unified Wire Ethernet Controller [VF]
+ 58a0 T540-50A0 Unified Wire Ethernet Controller [VF]
6001 T6225-CR Unified Wire Ethernet Controller
6002 T6225-SO-CR Unified Wire Ethernet Controller
6003 T6425-CR Unified Wire Ethernet Controller
@@ -16265,6 +16308,8 @@
6011 T6225-LL-CR Unified Wire Ethernet Controller
6014 T61100-OCP-SO Unified Wire Ethernet Controller
6015 T6201-BT Unified Wire Ethernet Controller
+ 6080 T6225-6080 Unified Wire Ethernet Controller
+ 6081 T62100-6081 Unified Wire Ethernet Controller
6401 T6225-CR Unified Wire Ethernet Controller
6402 T6225-SO-CR Unified Wire Ethernet Controller
6403 T6425-CR Unified Wire Ethernet Controller
@@ -16278,6 +16323,8 @@
6411 T6225-LL-CR Unified Wire Ethernet Controller
6414 T61100-OCP-SO Unified Wire Ethernet Controller
6415 T6201-BT Unified Wire Ethernet Controller
+ 6480 T6225-6080 Unified Wire Ethernet Controller
+ 6481 T62100-6081 Unified Wire Ethernet Controller
6501 T6225-CR Unified Wire Storage Controller
6502 T6225-SO-CR Unified Wire Storage Controller
6503 T6425-CR Unified Wire Storage Controller
@@ -16291,6 +16338,8 @@
6511 T6225-LL-CR Unified Wire Storage Controller
6514 T61100-OCP-SO Unified Wire Storage Controller
6515 T6201-BT Unified Wire Storage Controller
+ 6580 T6225-6080 Unified Wire Storage Controller
+ 6581 T62100-6081 Unified Wire Storage Controller
6601 T6225-CR Unified Wire Storage Controller
6602 T6225-SO-CR Unified Wire Storage Controller
6603 T6425-CR Unified Wire Storage Controller
@@ -16304,6 +16353,8 @@
6611 T6225-LL-CR Unified Wire Storage Controller
6614 T61100-OCP-SO Unified Wire Storage Controller
6615 T6201-BT Unified Wire Storage Controller
+ 6680 T6225-6080 Unified Wire Storage Controller
+ 6681 T62100-6081 Unified Wire Storage Controller
6801 T6225-CR Unified Wire Ethernet Controller [VF]
6802 T6225-SO-CR Unified Wire Ethernet Controller [VF]
6803 T6425-CR Unified Wire Ethernet Controller [VF]
@@ -16317,6 +16368,8 @@
6811 T6225-LL-CR Unified Wire Ethernet Controller [VF]
6814 T61100-OCP-SO Unified Wire Ethernet Controller [VF]
6815 T6201-BT Unified Wire Ethernet Controller [VF]
+ 6880 T6225-6080 Unified Wire Ethernet Controller [VF]
+ 6881 T62100-6081 Unified Wire Ethernet Controller [VF]
a000 PE10K Unified Wire Ethernet Controller
1426 Storage Technology Corp.
1427 Better On-Line Solutions
@@ -16516,6 +16569,7 @@
14a2 Millennium Engineering Inc
14a3 Maverick Networks
14a4 Lite-On Technology Corporation
+ 22f1 M8Pe Series NVMe SSD
# Wrong vendor ID used
4318 Broadcom BCM4318 [AirForce One 54g] 802.11g WLAN Controller
14a5 XIONICS Document Technologies Inc
@@ -17957,6 +18011,7 @@
1599 Delta Electronics Inc
159a General Instrument
159b Faraday Technology Corp
+ 4321 StorLink SL3516 (Gemini) Host Bridge
159c Stratus Computer Systems
159d Ningbo Harrison Electronics Co Ltd
159e A-Max Technology Co Ltd
@@ -18013,6 +18068,7 @@
024f MT53100 [Spectrum-2, Flash recovery mode]
0262 MT27710 [ConnectX-4 Lx Programmable] EN
0263 MT27710 [ConnectX-4 Lx Programmable Virtual Function] EN
+ 0281 NPS-600 Flash Recovery
1002 MT25400 Family [ConnectX-2 Virtual Function]
1003 MT27500 Family [ConnectX-3]
103c 1777 InfiniBand FDR/EN 10/40Gb Dual Port 544FLR-QSFP Adapter (Rev Cx)
@@ -18872,10 +18928,18 @@
9700 Octeon III CN73XX Network Processor
9702 CN23XX [LiquidIO II] Intelligent Adapter
177d 0003 CN2350 [LiquidIO II] 2-port 10GbE Intelligent adapter
- 177d 0004 CN2350 [LiquidIO II] 2-port 25GbE Intelligent adapter
+# This was changed during the production phase to 10GbE adapter.
+ 177d 0004 CN2350 [LiquidIO II] 2-port 10GbE Intelligent adapter
+ 177d 0005 CN2360 [LiquidIO II] 2-port 10GbE Intelligent adapter
+ 177d 0006 CN2360 [LiquidIO II] 2-port 25GbE Intelligent adapter
+ 177d 0007 CN2350 [LiquidIO II] 2-port 25GbE Intelligent adapter
9703 CN23XX [LiquidIO II] NVMe Controller
9712 CN23XX [LiquidIO II] SRIOV Virtual Function
177d 0003 CN2350 [LiquidIO II] 2-port 10GbE SRIOV Virtual Function
+ 177d 0004 CN2350 [LiquidIO II] 2-port 10GbE SRIOV Virtual Function
+ 177d 0005 CN2360 [LiquidIO II] 2-port 10GbE SRIOV Virtual Function
+ 177d 0006 CN2360 [LiquidIO II] 2-port 25GbE SRIOV Virtual Function
+ 177d 0007 CN2350 [LiquidIO II] 2-port 25GbE SRIOV Virtual Function
9713 CN23XX [LiquidIO II] NVMe SRIOV Virtual Function
9800 Octeon Fusion CNF75XX Processor
a001 ThunderX MRML(Master RML Bridge to RSL devices)
@@ -19445,8 +19509,8 @@
0155 NT100E3-1-PTP Network Adapter 1x100Gb
0165 NT80E3-2-PTP Network Adapter 2x40Gb
0175 NT20E3-2-PTP Network Adapter 2x10Gb
- 0185 NT40A01-4x1 Network Adapter 4x1Gb
- 01a5 NT200A01 Network Adapter 2x100Gb
+ 0185 NT40A01 Network Adapter
+ 01a5 NT200A01 Network Adapter
18f6 NextIO
1000 [Nexsis] Switch Virtual P2P PCIe Bridge
1001 [Texsis] Switch Virtual P2P PCIe Bridge
@@ -19602,14 +19666,15 @@
1924 800e SFN7x42Q-R2 Flareon Ultra 7000 Series 10/40G Adapter
1924 800f SFN7xx4F-R1 Flareon Ultra 7000 Series 10G Adapter
0a03 SFC9220 10/40G Ethernet Controller
- 1924 8011 SFN 8022-R1 Solarflare Flareon 8000 Series 10G Adapter
+ 1924 8011 SFN8022-R1 Flareon 8000 Series 10G Adapter
1924 8012 SFN8522-R1 Flareon Ultra 8000 Series 10G Adapter
- 1924 8013 SFN8042-R1 Solarflare Flareon 8000 Series 10/40G Adapter
+ 1924 8013 SFN8042-R1 Flareon 8000 Series 10/40G Adapter
1924 8014 SFN8542-R1 Flareon Ultra 8000 Series 10/40G Adapter
1924 8016 SFN8022-R2 Flareon 8000 Series 10G Adapter
1924 8017 SFN8522-R2 Flareon Ultra 8000 Series 10G Adapter
1924 8018 SFN8042-R2 Flareon 8000 Series 10/40G Adapter
1924 8019 SFN8542-R2 Flareon Ultra 8000 Series 10/40G Adapter
+ 1924 801a SFN8722-R1 Flareon Ultra 8000 Series OCP 10G Adapter
1803 SFC9020 10G Ethernet Controller (Virtual Function)
1813 SFL9021 10GBASE-T Ethernet Controller (Virtual Function)
1903 SFC9120 10G Ethernet Controller (Virtual Function)
@@ -19902,6 +19967,7 @@
5808 DDRdrive X8
dd52 DDRdrive X1-30
19e5 Huawei Technologies Co., Ltd.
+ 1711 Hi1710 [iBMC Intelligent Management system chip w/VGA support]
19e7 NET (Network Equipment Technologies)
1001 STIX DSP Card
1002 STIX - 1 Port T1/E1 Card
@@ -20101,7 +20167,7 @@
1b03 Magnum Semiconductor, Inc,
6100 DXT/DXTPro Multiformat Broadcast HD/SD Encoder/Decoder/Transcoder
7000 D7 Multiformat Broadcast HD/SD Encoder/Decoder/Transcoder
-1b08 MSC Vertriebs GmbH
+1b08 MSC Technologies GmbH
1b0a Pegatron
1b13 Jaton Corp
1b1a K&F Computing Research Co.
@@ -20318,6 +20384,8 @@
0003 Ultrastar SN100 Series NVMe SSD
1014 04f5 PCIe3 1.6TB NVMe Flash Adapter
1014 04f6 PCIe3 3.2TB NVMe Flash Adapter
+1c5f Beijing Memblaze Technology Co. Ltd.
+ 0540 PBlaze4 NVMe SSD
# http://www.nicevt.ru/ (in Russian)
1c63 Science and Research Centre of Computer Technology (JSC "NICEVT")
# http://www.radiotec.ru/catalog.php?cat=jr8&art=14109
@@ -20437,16 +20505,18 @@
4022 TN9310 10GbE SFP+ Ethernet Adapter
1043 8709 XG-C100F 10GbE SFP+ Ethernet Adapter
1186 4d00 DXE-810S 10GbE SFP+ Ethernet Adapter
- 1432 8103 EN-8102PF 10GbE SPF+ Ethernet Adapter
+ 1432 8103 10 Gigabit Ethernet SFP+ PCI Express Adapter
1fc9 3015 Ethernet Adapter
4024 TN9210 10GBase-T Ethernet Adapter
4025 TN9510 10GBase-T/NBASE-T Ethernet Adapter
105a 7203 SANLink3 NBase-T1
1186 2900 DXE-810T 10GBase-T Ethernet Adapter
- 1432 8102 EN-8102P 10GbE Ethernet Adapter
+ 1432 8102 10 Gigabit Ethernet PCI Express Adapter
1fc9 3015 Ethernet Adapter
4026 TN9610 10GbE SFP+ Ethernet Adapter
4027 TN9710P 10GBase-T/NBASE-T Ethernet Adapter
+ 1432 8104 10 Gigabit Ethernet PCI Express Adapter
+ 1fc9 3015 Ethernet Adapter
4527 TN9710Q 5GBase-T/NBASE-T Ethernet Adapter
1fcc StreamLabs
f416 MS416
@@ -21748,6 +21818,7 @@
0a26 Haswell-ULT Integrated Graphics Controller
0a2a Haswell-ULT Integrated Graphics Controller
0a2e Haswell-ULT Integrated Graphics Controller
+ 0a53 DC P3520 SSD
0be0 Atom Processor D2xxx/N2xxx Integrated Graphics Controller
0be1 Atom Processor D2xxx/N2xxx Integrated Graphics Controller
105b 0d7c D270S/D250S Motherboard
@@ -22105,7 +22176,7 @@
8086 1019 PRO/1000 CT Desktop Connection
8086 301f D865PERL mainboard
8086 3025 D875PBZ motherboard
- 8086 302c Intel 82865G Mainboard (D865GBF)
+ 8086 302c D865GBF Mainboard
8086 3427 S875WP1-E mainboard
101a 82547EI Gigabit Ethernet Controller (Mobile)
8086 101a PRO/1000 CT Mobile Connection
@@ -22303,7 +22374,7 @@
1096 80003ES2LAN Gigabit Ethernet Controller (Copper)
15d9 1096 Motherboard
15d9 8680 X7DVL-E-O motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
1097 631xESB/632xESB DPT LAN Controller (Fiber)
1098 80003ES2LAN Gigabit Ethernet Controller (Serdes)
1099 82546GB Gigabit Ethernet Controller (Copper)
@@ -22457,6 +22528,7 @@
103c 17d2 Ethernet 10Gb 2-port 560M Adapter
103c 18d0 Ethernet 10Gb 2-port 560FLB Adapter
1059 0111 T4007 10GbE interface
+ 1059 0130 T4009 10GbE interface
8086 000c Ethernet X520 10GbE Dual Port KX4-KR Mezz
10f9 82599 10 Gigabit Dual Port Network Connection
10fb 82599ES 10-Gigabit SFI/SFP+ Network Connection
@@ -22862,6 +22934,7 @@
1059 0110 T4005 1GbE interface
1059 0111 T4007 1GbE interface
1059 0120 T4008 1GbE interface
+ 1059 0130 T4009 1GbE interface
1538 I210 Gigabit Network Connection
1539 I211 Gigabit Network Connection
153a Ethernet Connection I217-LM
@@ -23187,7 +23260,7 @@
1a31 82845 845 [Brookdale] Chipset AGP Bridge
1a38 5000 Series Chipset DMA Engine
15d9 8680 X7DVL-E-O motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
1a48 82597EX 10GbE Ethernet Controller
8086 a01f PRO/10GbE SR Server Adapter
8086 a11f PRO/10GbE SR Server Adapter
@@ -24772,13 +24845,13 @@
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
2680 631xESB/632xESB/3100 Chipset SATA IDE Controller
2681 631xESB/632xESB SATA AHCI Controller
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
2682 631xESB/632xESB SATA RAID Controller
103c 31fe Adaptec Serial ATA HostRAID
2683 631xESB/632xESB SATA RAID Controller
@@ -24788,31 +24861,31 @@
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
2689 631xESB/632xESB/3100 Chipset UHCI USB Controller #2
1028 01bb PowerEdge 1955 onboard USB
1028 01f0 PowerEdge R900 onboard USB
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
268a 631xESB/632xESB/3100 Chipset UHCI USB Controller #3
1028 01f0 PowerEdge R900 onboard USB
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
268b 631xESB/632xESB/3100 Chipset UHCI USB Controller #4
1028 01f0 PowerEdge R900 onboard USB
15d9 8680 X7DVL-E-O motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
268c 631xESB/632xESB/3100 Chipset EHCI USB2 Controller
1028 01bb PowerEdge 1955 onboard USB
1028 01f0 PowerEdge R900 onboard USB
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
2690 631xESB/632xESB/3100 Chipset PCI Express Root Port 1
103c 31fe ProLiant DL140 G3
15d9 9680 X7DBN Motherboard
@@ -24827,7 +24900,7 @@
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
15d9 9680 X7DBN Motherboard
- 8086 3476 Intel S5000PSLSATA Server Board
+ 8086 3476 S5000PSLSATA Server Board
269e 631xESB/632xESB IDE Controller
103c 31fe ProLiant DL140 G3
15d9 8680 X7DVL-E-O motherboard
@@ -24844,7 +24917,7 @@
103c 2a3b Pavilion A1512X
1462 7418 Wind PC MS-7418
8086 544e DeskTop Board D945GTP
- 8086 d605 Intel Desktop Board D945GCCR
+ 8086 d605 Desktop Board D945GCCR
2774 82955X Memory Controller Hub
2775 82955X PCI Express Root Port
2776 82945G/GZ Integrated Graphics Controller
@@ -26205,8 +26278,7 @@
8086 4010 Dual Band Wireless AC 3165
# Stone Peak 1x1
8086 4210 Dual Band Wireless AC 3165
-# Stone Peak 1x1
- 3166 Intel Dual Band Wireless-AC 3165 Plus Bluetooth
+ 3166 Dual Band Wireless-AC 3165 Plus Bluetooth
3200 GD31244 PCI-X SATA HBA
1775 c200 C2K onboard SATA host bus adapter
3310 IOP348 I/O Processor
diff --git a/sys/amd64/amd64/amd64_mem.c b/sys/amd64/amd64/amd64_mem.c
deleted file mode 100644
index aa8dc5c..0000000
--- a/sys/amd64/amd64/amd64_mem.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/*-
- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/memrange.h>
-#include <sys/smp.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-
-#include <machine/cputypes.h>
-#include <machine/md_var.h>
-#include <machine/specialreg.h>
-
-/*
- * amd64 memory range operations
- *
- * This code will probably be impenetrable without reference to the
- * Intel Pentium Pro documentation or x86-64 programmers manual vol 2.
- */
-
-static char *mem_owner_bios = "BIOS";
-
-#define MR686_FIXMTRR (1<<0)
-
-#define mrwithin(mr, a) \
- (((a) >= (mr)->mr_base) && ((a) < ((mr)->mr_base + (mr)->mr_len)))
-#define mroverlap(mra, mrb) \
- (mrwithin(mra, mrb->mr_base) || mrwithin(mrb, mra->mr_base))
-
-#define mrvalid(base, len) \
- ((!(base & ((1 << 12) - 1))) && /* base is multiple of 4k */ \
- ((len) >= (1 << 12)) && /* length is >= 4k */ \
- powerof2((len)) && /* ... and power of two */ \
- !((base) & ((len) - 1))) /* range is not discontiuous */
-
-#define mrcopyflags(curr, new) \
- (((curr) & ~MDF_ATTRMASK) | ((new) & MDF_ATTRMASK))
-
-static int mtrrs_disabled;
-SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RDTUN,
- &mtrrs_disabled, 0, "Disable amd64 MTRRs.");
-
-static void amd64_mrinit(struct mem_range_softc *sc);
-static int amd64_mrset(struct mem_range_softc *sc,
- struct mem_range_desc *mrd, int *arg);
-static void amd64_mrAPinit(struct mem_range_softc *sc);
-static void amd64_mrreinit(struct mem_range_softc *sc);
-
-static struct mem_range_ops amd64_mrops = {
- amd64_mrinit,
- amd64_mrset,
- amd64_mrAPinit,
- amd64_mrreinit
-};
-
-/* XXX for AP startup hook */
-static u_int64_t mtrrcap, mtrrdef;
-
-/* The bitmask for the PhysBase and PhysMask fields of the variable MTRRs. */
-static u_int64_t mtrr_physmask;
-
-static struct mem_range_desc *mem_range_match(struct mem_range_softc *sc,
- struct mem_range_desc *mrd);
-static void amd64_mrfetch(struct mem_range_softc *sc);
-static int amd64_mtrrtype(int flags);
-static int amd64_mrt2mtrr(int flags, int oldval);
-static int amd64_mtrrconflict(int flag1, int flag2);
-static void amd64_mrstore(struct mem_range_softc *sc);
-static void amd64_mrstoreone(void *arg);
-static struct mem_range_desc *amd64_mtrrfixsearch(struct mem_range_softc *sc,
- u_int64_t addr);
-static int amd64_mrsetlow(struct mem_range_softc *sc,
- struct mem_range_desc *mrd, int *arg);
-static int amd64_mrsetvariable(struct mem_range_softc *sc,
- struct mem_range_desc *mrd, int *arg);
-
-/* amd64 MTRR type to memory range type conversion */
-static int amd64_mtrrtomrt[] = {
- MDF_UNCACHEABLE,
- MDF_WRITECOMBINE,
- MDF_UNKNOWN,
- MDF_UNKNOWN,
- MDF_WRITETHROUGH,
- MDF_WRITEPROTECT,
- MDF_WRITEBACK
-};
-
-#define MTRRTOMRTLEN nitems(amd64_mtrrtomrt)
-
-static int
-amd64_mtrr2mrt(int val)
-{
-
- if (val < 0 || val >= MTRRTOMRTLEN)
- return (MDF_UNKNOWN);
- return (amd64_mtrrtomrt[val]);
-}
-
-/*
- * amd64 MTRR conflicts. Writeback and uncachable may overlap.
- */
-static int
-amd64_mtrrconflict(int flag1, int flag2)
-{
-
- flag1 &= MDF_ATTRMASK;
- flag2 &= MDF_ATTRMASK;
- if ((flag1 & MDF_UNKNOWN) || (flag2 & MDF_UNKNOWN))
- return (1);
- if (flag1 == flag2 ||
- (flag1 == MDF_WRITEBACK && flag2 == MDF_UNCACHEABLE) ||
- (flag2 == MDF_WRITEBACK && flag1 == MDF_UNCACHEABLE))
- return (0);
- return (1);
-}
-
-/*
- * Look for an exactly-matching range.
- */
-static struct mem_range_desc *
-mem_range_match(struct mem_range_softc *sc, struct mem_range_desc *mrd)
-{
- struct mem_range_desc *cand;
- int i;
-
- for (i = 0, cand = sc->mr_desc; i < sc->mr_ndesc; i++, cand++)
- if ((cand->mr_base == mrd->mr_base) &&
- (cand->mr_len == mrd->mr_len))
- return (cand);
- return (NULL);
-}
-
-/*
- * Fetch the current mtrr settings from the current CPU (assumed to
- * all be in sync in the SMP case). Note that if we are here, we
- * assume that MTRRs are enabled, and we may or may not have fixed
- * MTRRs.
- */
-static void
-amd64_mrfetch(struct mem_range_softc *sc)
-{
- struct mem_range_desc *mrd;
- u_int64_t msrv;
- int i, j, msr;
-
- mrd = sc->mr_desc;
-
- /* Get fixed-range MTRRs. */
- if (sc->mr_cap & MR686_FIXMTRR) {
- msr = MSR_MTRR64kBase;
- for (i = 0; i < (MTRR_N64K / 8); i++, msr++) {
- msrv = rdmsr(msr);
- for (j = 0; j < 8; j++, mrd++) {
- mrd->mr_flags =
- (mrd->mr_flags & ~MDF_ATTRMASK) |
- amd64_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
- if (mrd->mr_owner[0] == 0)
- strcpy(mrd->mr_owner, mem_owner_bios);
- msrv = msrv >> 8;
- }
- }
- msr = MSR_MTRR16kBase;
- for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
- msrv = rdmsr(msr);
- for (j = 0; j < 8; j++, mrd++) {
- mrd->mr_flags =
- (mrd->mr_flags & ~MDF_ATTRMASK) |
- amd64_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
- if (mrd->mr_owner[0] == 0)
- strcpy(mrd->mr_owner, mem_owner_bios);
- msrv = msrv >> 8;
- }
- }
- msr = MSR_MTRR4kBase;
- for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
- msrv = rdmsr(msr);
- for (j = 0; j < 8; j++, mrd++) {
- mrd->mr_flags =
- (mrd->mr_flags & ~MDF_ATTRMASK) |
- amd64_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
- if (mrd->mr_owner[0] == 0)
- strcpy(mrd->mr_owner, mem_owner_bios);
- msrv = msrv >> 8;
- }
- }
- }
-
- /* Get remainder which must be variable MTRRs. */
- msr = MSR_MTRRVarBase;
- for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
- msrv = rdmsr(msr);
- mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
- amd64_mtrr2mrt(msrv & MTRR_PHYSBASE_TYPE);
- mrd->mr_base = msrv & mtrr_physmask;
- msrv = rdmsr(msr + 1);
- mrd->mr_flags = (msrv & MTRR_PHYSMASK_VALID) ?
- (mrd->mr_flags | MDF_ACTIVE) :
- (mrd->mr_flags & ~MDF_ACTIVE);
-
- /* Compute the range from the mask. Ick. */
- mrd->mr_len = (~(msrv & mtrr_physmask) &
- (mtrr_physmask | 0xfffL)) + 1;
- if (!mrvalid(mrd->mr_base, mrd->mr_len))
- mrd->mr_flags |= MDF_BOGUS;
-
- /* If unclaimed and active, must be the BIOS. */
- if ((mrd->mr_flags & MDF_ACTIVE) && (mrd->mr_owner[0] == 0))
- strcpy(mrd->mr_owner, mem_owner_bios);
- }
-}
-
-/*
- * Return the MTRR memory type matching a region's flags
- */
-static int
-amd64_mtrrtype(int flags)
-{
- int i;
-
- flags &= MDF_ATTRMASK;
-
- for (i = 0; i < MTRRTOMRTLEN; i++) {
- if (amd64_mtrrtomrt[i] == MDF_UNKNOWN)
- continue;
- if (flags == amd64_mtrrtomrt[i])
- return (i);
- }
- return (-1);
-}
-
-static int
-amd64_mrt2mtrr(int flags, int oldval)
-{
- int val;
-
- if ((val = amd64_mtrrtype(flags)) == -1)
- return (oldval & 0xff);
- return (val & 0xff);
-}
-
-/*
- * Update running CPU(s) MTRRs to match the ranges in the descriptor
- * list.
- *
- * XXX Must be called with interrupts enabled.
- */
-static void
-amd64_mrstore(struct mem_range_softc *sc)
-{
-#ifdef SMP
- /*
- * We should use ipi_all_but_self() to call other CPUs into a
- * locking gate, then call a target function to do this work.
- * The "proper" solution involves a generalised locking gate
- * implementation, not ready yet.
- */
- smp_rendezvous(NULL, amd64_mrstoreone, NULL, sc);
-#else
- disable_intr(); /* disable interrupts */
- amd64_mrstoreone(sc);
- enable_intr();
-#endif
-}
-
-/*
- * Update the current CPU's MTRRs with those represented in the
- * descriptor list. Note that we do this wholesale rather than just
- * stuffing one entry; this is simpler (but slower, of course).
- */
-static void
-amd64_mrstoreone(void *arg)
-{
- struct mem_range_softc *sc = arg;
- struct mem_range_desc *mrd;
- u_int64_t omsrv, msrv;
- int i, j, msr;
- u_long cr0, cr4;
-
- mrd = sc->mr_desc;
-
- critical_enter();
-
- /* Disable PGE. */
- cr4 = rcr4();
- load_cr4(cr4 & ~CR4_PGE);
-
- /* Disable caches (CD = 1, NW = 0). */
- cr0 = rcr0();
- load_cr0((cr0 & ~CR0_NW) | CR0_CD);
-
- /* Flushes caches and TLBs. */
- wbinvd();
- invltlb();
-
- /* Disable MTRRs (E = 0). */
- wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) & ~MTRR_DEF_ENABLE);
-
- /* Set fixed-range MTRRs. */
- if (sc->mr_cap & MR686_FIXMTRR) {
- msr = MSR_MTRR64kBase;
- for (i = 0; i < (MTRR_N64K / 8); i++, msr++) {
- msrv = 0;
- omsrv = rdmsr(msr);
- for (j = 7; j >= 0; j--) {
- msrv = msrv << 8;
- msrv |= amd64_mrt2mtrr((mrd + j)->mr_flags,
- omsrv >> (j * 8));
- }
- wrmsr(msr, msrv);
- mrd += 8;
- }
- msr = MSR_MTRR16kBase;
- for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
- msrv = 0;
- omsrv = rdmsr(msr);
- for (j = 7; j >= 0; j--) {
- msrv = msrv << 8;
- msrv |= amd64_mrt2mtrr((mrd + j)->mr_flags,
- omsrv >> (j * 8));
- }
- wrmsr(msr, msrv);
- mrd += 8;
- }
- msr = MSR_MTRR4kBase;
- for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
- msrv = 0;
- omsrv = rdmsr(msr);
- for (j = 7; j >= 0; j--) {
- msrv = msrv << 8;
- msrv |= amd64_mrt2mtrr((mrd + j)->mr_flags,
- omsrv >> (j * 8));
- }
- wrmsr(msr, msrv);
- mrd += 8;
- }
- }
-
- /* Set remainder which must be variable MTRRs. */
- msr = MSR_MTRRVarBase;
- for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
- /* base/type register */
- omsrv = rdmsr(msr);
- if (mrd->mr_flags & MDF_ACTIVE) {
- msrv = mrd->mr_base & mtrr_physmask;
- msrv |= amd64_mrt2mtrr(mrd->mr_flags, omsrv);
- } else {
- msrv = 0;
- }
- wrmsr(msr, msrv);
-
- /* mask/active register */
- if (mrd->mr_flags & MDF_ACTIVE) {
- msrv = MTRR_PHYSMASK_VALID |
- rounddown2(mtrr_physmask, mrd->mr_len);
- } else {
- msrv = 0;
- }
- wrmsr(msr + 1, msrv);
- }
-
- /* Flush caches and TLBs. */
- wbinvd();
- invltlb();
-
- /* Enable MTRRs. */
- wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) | MTRR_DEF_ENABLE);
-
- /* Restore caches and PGE. */
- load_cr0(cr0);
- load_cr4(cr4);
-
- critical_exit();
-}
-
-/*
- * Hunt for the fixed MTRR referencing (addr)
- */
-static struct mem_range_desc *
-amd64_mtrrfixsearch(struct mem_range_softc *sc, u_int64_t addr)
-{
- struct mem_range_desc *mrd;
- int i;
-
- for (i = 0, mrd = sc->mr_desc; i < (MTRR_N64K + MTRR_N16K + MTRR_N4K);
- i++, mrd++)
- if ((addr >= mrd->mr_base) &&
- (addr < (mrd->mr_base + mrd->mr_len)))
- return (mrd);
- return (NULL);
-}
-
-/*
- * Try to satisfy the given range request by manipulating the fixed
- * MTRRs that cover low memory.
- *
- * Note that we try to be generous here; we'll bloat the range out to
- * the next higher/lower boundary to avoid the consumer having to know
- * too much about the mechanisms here.
- *
- * XXX note that this will have to be updated when we start supporting
- * "busy" ranges.
- */
-static int
-amd64_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
-{
- struct mem_range_desc *first_md, *last_md, *curr_md;
-
- /* Range check. */
- if (((first_md = amd64_mtrrfixsearch(sc, mrd->mr_base)) == NULL) ||
- ((last_md = amd64_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1)) == NULL))
- return (EINVAL);
-
- /* Check that we aren't doing something risky. */
- if (!(mrd->mr_flags & MDF_FORCE))
- for (curr_md = first_md; curr_md <= last_md; curr_md++) {
- if ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN)
- return (EACCES);
- }
-
- /* Set flags, clear set-by-firmware flag. */
- for (curr_md = first_md; curr_md <= last_md; curr_md++) {
- curr_md->mr_flags = mrcopyflags(curr_md->mr_flags &
- ~MDF_FIRMWARE, mrd->mr_flags);
- bcopy(mrd->mr_owner, curr_md->mr_owner, sizeof(mrd->mr_owner));
- }
-
- return (0);
-}
-
-/*
- * Modify/add a variable MTRR to satisfy the request.
- *
- * XXX needs to be updated to properly support "busy" ranges.
- */
-static int
-amd64_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
- int *arg)
-{
- struct mem_range_desc *curr_md, *free_md;
- int i;
-
- /*
- * Scan the currently active variable descriptors, look for
- * one we exactly match (straight takeover) and for possible
- * accidental overlaps.
- *
- * Keep track of the first empty variable descriptor in case
- * we can't perform a takeover.
- */
- i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0;
- curr_md = sc->mr_desc + i;
- free_md = NULL;
- for (; i < sc->mr_ndesc; i++, curr_md++) {
- if (curr_md->mr_flags & MDF_ACTIVE) {
- /* Exact match? */
- if ((curr_md->mr_base == mrd->mr_base) &&
- (curr_md->mr_len == mrd->mr_len)) {
-
- /* Whoops, owned by someone. */
- if (curr_md->mr_flags & MDF_BUSY)
- return (EBUSY);
-
- /* Check that we aren't doing something risky */
- if (!(mrd->mr_flags & MDF_FORCE) &&
- ((curr_md->mr_flags & MDF_ATTRMASK) ==
- MDF_UNKNOWN))
- return (EACCES);
-
- /* Ok, just hijack this entry. */
- free_md = curr_md;
- break;
- }
-
- /* Non-exact overlap? */
- if (mroverlap(curr_md, mrd)) {
- /* Between conflicting region types? */
- if (amd64_mtrrconflict(curr_md->mr_flags,
- mrd->mr_flags))
- return (EINVAL);
- }
- } else if (free_md == NULL) {
- free_md = curr_md;
- }
- }
-
- /* Got somewhere to put it? */
- if (free_md == NULL)
- return (ENOSPC);
-
- /* Set up new descriptor. */
- free_md->mr_base = mrd->mr_base;
- free_md->mr_len = mrd->mr_len;
- free_md->mr_flags = mrcopyflags(MDF_ACTIVE, mrd->mr_flags);
- bcopy(mrd->mr_owner, free_md->mr_owner, sizeof(mrd->mr_owner));
- return (0);
-}
-
-/*
- * Handle requests to set memory range attributes by manipulating MTRRs.
- */
-static int
-amd64_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
-{
- struct mem_range_desc *targ;
- int error, i;
-
- switch (*arg) {
- case MEMRANGE_SET_UPDATE:
- /*
- * Make sure that what's being asked for is even
- * possible at all.
- */
- if (!mrvalid(mrd->mr_base, mrd->mr_len) ||
- amd64_mtrrtype(mrd->mr_flags) == -1)
- return (EINVAL);
-
-#define FIXTOP ((MTRR_N64K * 0x10000) + (MTRR_N16K * 0x4000) + (MTRR_N4K * 0x1000))
-
- /* Are the "low memory" conditions applicable? */
- if ((sc->mr_cap & MR686_FIXMTRR) &&
- ((mrd->mr_base + mrd->mr_len) <= FIXTOP)) {
- if ((error = amd64_mrsetlow(sc, mrd, arg)) != 0)
- return (error);
- } else {
- /* It's time to play with variable MTRRs. */
- if ((error = amd64_mrsetvariable(sc, mrd, arg)) != 0)
- return (error);
- }
- break;
-
- case MEMRANGE_SET_REMOVE:
- if ((targ = mem_range_match(sc, mrd)) == NULL)
- return (ENOENT);
- if (targ->mr_flags & MDF_FIXACTIVE)
- return (EPERM);
- if (targ->mr_flags & MDF_BUSY)
- return (EBUSY);
- targ->mr_flags &= ~MDF_ACTIVE;
- targ->mr_owner[0] = 0;
- break;
-
- default:
- return (EOPNOTSUPP);
- }
-
- /*
- * Ensure that the direct map region does not contain any mappings
- * that span MTRRs of different types. However, the fixed MTRRs can
- * be ignored, because a large page mapping the first 1 MB of physical
- * memory is a special case that the processor handles. The entire
- * TLB will be invalidated by amd64_mrstore(), so pmap_demote_DMAP()
- * needn't do it.
- */
- i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0;
- mrd = sc->mr_desc + i;
- for (; i < sc->mr_ndesc; i++, mrd++) {
- if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE)
- pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, FALSE);
- }
-
- /* Update the hardware. */
- amd64_mrstore(sc);
-
- /* Refetch to see where we're at. */
- amd64_mrfetch(sc);
- return (0);
-}
-
-/*
- * Work out how many ranges we support, initialise storage for them,
- * and fetch the initial settings.
- */
-static void
-amd64_mrinit(struct mem_range_softc *sc)
-{
- struct mem_range_desc *mrd;
- u_int regs[4];
- int i, nmdesc = 0, pabits;
-
- mtrrcap = rdmsr(MSR_MTRRcap);
- mtrrdef = rdmsr(MSR_MTRRdefType);
-
- /* For now, bail out if MTRRs are not enabled. */
- if (!(mtrrdef & MTRR_DEF_ENABLE)) {
- if (bootverbose)
- printf("CPU supports MTRRs but not enabled\n");
- return;
- }
- nmdesc = mtrrcap & MTRR_CAP_VCNT;
-
- /*
- * Determine the size of the PhysMask and PhysBase fields in
- * the variable range MTRRs. If the extended CPUID 0x80000008
- * is present, use that to figure out how many physical
- * address bits the CPU supports. Otherwise, default to 36
- * address bits.
- */
- if (cpu_exthigh >= 0x80000008) {
- do_cpuid(0x80000008, regs);
- pabits = regs[0] & 0xff;
- } else
- pabits = 36;
- mtrr_physmask = ((1UL << pabits) - 1) & ~0xfffUL;
-
- /* If fixed MTRRs supported and enabled. */
- if ((mtrrcap & MTRR_CAP_FIXED) && (mtrrdef & MTRR_DEF_FIXED_ENABLE)) {
- sc->mr_cap = MR686_FIXMTRR;
- nmdesc += MTRR_N64K + MTRR_N16K + MTRR_N4K;
- }
-
- sc->mr_desc = malloc(nmdesc * sizeof(struct mem_range_desc), M_MEMDESC,
- M_WAITOK | M_ZERO);
- sc->mr_ndesc = nmdesc;
-
- mrd = sc->mr_desc;
-
- /* Populate the fixed MTRR entries' base/length. */
- if (sc->mr_cap & MR686_FIXMTRR) {
- for (i = 0; i < MTRR_N64K; i++, mrd++) {
- mrd->mr_base = i * 0x10000;
- mrd->mr_len = 0x10000;
- mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN |
- MDF_FIXACTIVE;
- }
- for (i = 0; i < MTRR_N16K; i++, mrd++) {
- mrd->mr_base = i * 0x4000 + 0x80000;
- mrd->mr_len = 0x4000;
- mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN |
- MDF_FIXACTIVE;
- }
- for (i = 0; i < MTRR_N4K; i++, mrd++) {
- mrd->mr_base = i * 0x1000 + 0xc0000;
- mrd->mr_len = 0x1000;
- mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN |
- MDF_FIXACTIVE;
- }
- }
-
- /*
- * Get current settings, anything set now is considered to
- * have been set by the firmware. (XXX has something already
- * played here?)
- */
- amd64_mrfetch(sc);
- mrd = sc->mr_desc;
- for (i = 0; i < sc->mr_ndesc; i++, mrd++) {
- if (mrd->mr_flags & MDF_ACTIVE)
- mrd->mr_flags |= MDF_FIRMWARE;
- }
-
- /*
- * Ensure that the direct map region does not contain any mappings
- * that span MTRRs of different types. However, the fixed MTRRs can
- * be ignored, because a large page mapping the first 1 MB of physical
- * memory is a special case that the processor handles. Invalidate
- * any old TLB entries that might hold inconsistent memory type
- * information.
- */
- i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0;
- mrd = sc->mr_desc + i;
- for (; i < sc->mr_ndesc; i++, mrd++) {
- if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE)
- pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE);
- }
-}
-
-/*
- * Initialise MTRRs on an AP after the BSP has run the init code.
- */
-static void
-amd64_mrAPinit(struct mem_range_softc *sc)
-{
-
- amd64_mrstoreone(sc);
- wrmsr(MSR_MTRRdefType, mtrrdef);
-}
-
-/*
- * Re-initialise running CPU(s) MTRRs to match the ranges in the descriptor
- * list.
- *
- * XXX Must be called with interrupts enabled.
- */
-static void
-amd64_mrreinit(struct mem_range_softc *sc)
-{
-#ifdef SMP
- /*
- * We should use ipi_all_but_self() to call other CPUs into a
- * locking gate, then call a target function to do this work.
- * The "proper" solution involves a generalised locking gate
- * implementation, not ready yet.
- */
- smp_rendezvous(NULL, (void *)amd64_mrAPinit, NULL, sc);
-#else
- disable_intr(); /* disable interrupts */
- amd64_mrAPinit(sc);
- enable_intr();
-#endif
-}
-
-static void
-amd64_mem_drvinit(void *unused)
-{
-
- if (mtrrs_disabled)
- return;
- if (!(cpu_feature & CPUID_MTRR))
- return;
- if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00)
- return;
- switch (cpu_vendor_id) {
- case CPU_VENDOR_INTEL:
- case CPU_VENDOR_AMD:
- case CPU_VENDOR_CENTAUR:
- break;
- default:
- return;
- }
- mem_range_softc.mr_op = &amd64_mrops;
-}
-SYSINIT(amd64memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, amd64_mem_drvinit, NULL);
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 18484e6..0001127 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1734,6 +1734,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
* area.
*/
thread0.td_pcb = get_pcb_td(&thread0);
+ thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0);
bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size);
if (use_xsave) {
xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) +
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 2d88398..d0b1eed 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4015,12 +4015,12 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot)
anychanged = FALSE;
retry:
oldpde = newpde = *pde;
- if (oldpde & PG_MANAGED) {
+ if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) ==
+ (PG_MANAGED | PG_M | PG_RW)) {
eva = sva + NBPDR;
for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
va < eva; va += PAGE_SIZE, m++)
- if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
- vm_page_dirty(m);
+ vm_page_dirty(m);
}
if ((prot & VM_PROT_WRITE) == 0)
newpde &= ~(PG_RW | PG_M);
@@ -4367,7 +4367,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
if ((m->oflags & VPO_UNMANAGED) != 0) {
if ((newpte & PG_RW) != 0)
newpte |= PG_M;
- }
+ } else
+ newpte |= PG_MANAGED;
mpte = NULL;
@@ -4440,11 +4441,9 @@ retry:
/*
* No, might be a protection or wiring change.
*/
- if ((origpte & PG_MANAGED) != 0) {
- newpte |= PG_MANAGED;
- if ((newpte & PG_RW) != 0)
- vm_page_aflag_set(m, PGA_WRITEABLE);
- }
+ if ((origpte & PG_MANAGED) != 0 &&
+ (newpte & PG_RW) != 0)
+ vm_page_aflag_set(m, PGA_WRITEABLE);
if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0)
goto unchanged;
goto validate;
@@ -4461,8 +4460,7 @@ retry:
/*
* Enter on the PV list if part of our managed memory.
*/
- if ((m->oflags & VPO_UNMANAGED) == 0) {
- newpte |= PG_MANAGED;
+ if ((newpte & PG_MANAGED) != 0) {
pv = get_pv_entry(pmap, &lock);
pv->pv_va = va;
CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa);
diff --git a/sys/amd64/linux/Makefile b/sys/amd64/linux/Makefile
index c8899e6..fc0aac2 100644
--- a/sys/amd64/linux/Makefile
+++ b/sys/amd64/linux/Makefile
@@ -9,9 +9,4 @@ sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_sys
linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
../../kern/makesyscalls.sh syscalls.master syscalls.conf
- -mv -f linux_sysent.c linux_sysent.c.bak
- -mv -f linux_syscall.h linux_syscall.h.bak
- -mv -f linux_proto.h linux_proto.h.bak
- -mv -f linux_syscalls.c linux_syscalls.c.bak
- -mv -f linux_systrace_args.c linux_systrace_args.c.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
diff --git a/sys/amd64/linux/linux_dummy.c b/sys/amd64/linux/linux_dummy.c
index efe18fd..85b6757 100644
--- a/sys/amd64/linux/linux_dummy.c
+++ b/sys/amd64/linux/linux_dummy.c
@@ -111,9 +111,6 @@ DUMMY(timerfd_gettime);
/* linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);
-/* linux 2.6.30: */
-DUMMY(preadv);
-DUMMY(pwritev);
/* linux 2.6.31: */
DUMMY(rt_tgsigqueueinfo);
DUMMY(perf_event_open);
diff --git a/sys/amd64/linux32/Makefile b/sys/amd64/linux32/Makefile
index 4826981..9219b34 100644
--- a/sys/amd64/linux32/Makefile
+++ b/sys/amd64/linux32/Makefile
@@ -9,9 +9,4 @@ sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c l
linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../kern/makesyscalls.sh \
syscalls.master syscalls.conf
- -mv -f linux32_sysent.c linux32_sysent.c.bak
- -mv -f linux32_syscall.h linux32_syscall.h.bak
- -mv -f linux32_proto.h linux32_proto.h.bak
- -mv -f linux32_syscalls.c linux32_syscalls.c.bak
- -mv -f linux32_systrace_args.c linux32_systrace_args.c.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index 97da878..687f8e8 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -663,6 +663,7 @@ struct l_user_desc {
(((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
struct iovec;
+struct uio;
struct l_iovec32 {
uint32_t iov_base;
@@ -671,6 +672,8 @@ struct l_iovec32 {
int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt,
struct iovec **iovp, int error);
+int linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt,
+ struct uio **uiop);
int linux_copyout_rusage(struct rusage *ru, void *uaddr);
/* robust futexes */
diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c
index 74e89a9..27f26f4 100644
--- a/sys/amd64/linux32/linux32_dummy.c
+++ b/sys/amd64/linux32/linux32_dummy.c
@@ -110,9 +110,6 @@ DUMMY(timerfd_gettime);
/* linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);
-/* linux 2.6.30: */
-DUMMY(preadv);
-DUMMY(pwritev);
/* linux 2.6.31: */
DUMMY(rt_tgsigqueueinfo);
DUMMY(perf_event_open);
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 187ec15..74f9315 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -144,7 +144,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
CTASSERT(sizeof(struct l_iovec32) == 8);
-static int
+int
linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt, struct uio **uiop)
{
struct l_iovec32 iov32;
diff --git a/sys/arm/allwinner/a10_common.c b/sys/arm/allwinner/a10_common.c
index 82be0c0..6b3fded 100644
--- a/sys/arm/allwinner/a10_common.c
+++ b/sys/arm/allwinner/a10_common.c
@@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
diff --git a/sys/arm/allwinner/aw_machdep.c b/sys/arm/allwinner/aw_machdep.c
index 3fab0a1..ce761c8 100644
--- a/sys/arm/allwinner/aw_machdep.c
+++ b/sys/arm/allwinner/aw_machdep.c
@@ -36,7 +36,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -147,18 +146,6 @@ allwinner_devmap_init(platform_t plat)
return (0);
}
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
- return (0);
-}
-
void
cpu_reset()
{
diff --git a/sys/arm/allwinner/aw_wdog.c b/sys/arm/allwinner/aw_wdog.c
index 4dcefd4..6dd68b4 100644
--- a/sys/arm/allwinner/aw_wdog.c
+++ b/sys/arm/allwinner/aw_wdog.c
@@ -238,7 +238,7 @@ aw_wdog_shutdown_fn(void *private, int howto)
}
void
-aw_wdog_watchdog_reset()
+aw_wdog_watchdog_reset(void)
{
if (aw_wdog_sc == NULL) {
diff --git a/sys/arm/altera/socfpga/socfpga_common.c b/sys/arm/altera/socfpga/socfpga_common.c
index 740d342..1e6df97 100644
--- a/sys/arm/altera/socfpga/socfpga_common.c
+++ b/sys/arm/altera/socfpga/socfpga_common.c
@@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <machine/bus.h>
@@ -47,7 +46,7 @@ __FBSDID("$FreeBSD$");
void
cpu_reset(void)
{
- uint32_t addr, paddr;
+ uint32_t paddr;
bus_addr_t vaddr;
phandle_t node;
@@ -58,9 +57,8 @@ cpu_reset(void)
if (node == -1)
goto end;
- if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
- addr = fdt32_to_cpu(paddr);
- if (bus_space_map(fdtbus_bs_tag, addr, 0x8, 0, &vaddr) == 0) {
+ if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
+ if (bus_space_map(fdtbus_bs_tag, paddr, 0x8, 0, &vaddr) == 0) {
bus_space_write_4(fdtbus_bs_tag, vaddr,
RSTMGR_CTRL, CTRL_SWWARMRSTREQ);
}
@@ -70,10 +68,6 @@ end:
while (1);
}
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/altera/socfpga/socfpga_machdep.c b/sys/arm/altera/socfpga/socfpga_machdep.c
index 9ae868a..bcfdd5c 100644
--- a/sys/arm/altera/socfpga/socfpga_machdep.c
+++ b/sys/arm/altera/socfpga/socfpga_machdep.c
@@ -34,7 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -100,17 +99,3 @@ platform_devmap_init(void)
return (0);
}
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
diff --git a/sys/arm/altera/socfpga/socfpga_rstmgr.c b/sys/arm/altera/socfpga/socfpga_rstmgr.c
index 49db05e..d5f773f 100644
--- a/sys/arm/altera/socfpga/socfpga_rstmgr.c
+++ b/sys/arm/altera/socfpga/socfpga_rstmgr.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <sys/sysctl.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -84,7 +83,7 @@ enum {
static int
l3remap(struct rstmgr_softc *sc, int remap, int enable)
{
- uint32_t addr, paddr;
+ uint32_t paddr;
bus_addr_t vaddr;
phandle_t node;
int reg;
@@ -106,9 +105,8 @@ l3remap(struct rstmgr_softc *sc, int remap, int enable)
return (1);
}
- if ((OF_getprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
- addr = fdt32_to_cpu(paddr);
- if (bus_space_map(fdtbus_bs_tag, addr, 0x4, 0, &vaddr) == 0) {
+ if ((OF_getencprop(node, "reg", &paddr, sizeof(paddr))) > 0) {
+ if (bus_space_map(fdtbus_bs_tag, paddr, 0x4, 0, &vaddr) == 0) {
bus_space_write_4(fdtbus_bs_tag, vaddr,
L3REGS_REMAP, reg);
return (0);
diff --git a/sys/arm/amlogic/aml8726/aml8726_identsoc.c b/sys/arm/amlogic/aml8726/aml8726_identsoc.c
index b10ad16..64c6687 100644
--- a/sys/arm/amlogic/aml8726/aml8726_identsoc.c
+++ b/sys/arm/amlogic/aml8726/aml8726_identsoc.c
@@ -87,7 +87,7 @@ static const struct {
};
void
-aml8726_identify_soc()
+aml8726_identify_soc(void)
{
int err;
struct resource res;
diff --git a/sys/arm/amlogic/aml8726/aml8726_machdep.c b/sys/arm/amlogic/aml8726/aml8726_machdep.c
index ee2ffd7..0929528 100644
--- a/sys/arm/amlogic/aml8726/aml8726_machdep.c
+++ b/sys/arm/amlogic/aml8726/aml8726_machdep.c
@@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$");
#include "opt_platform.h"
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -57,7 +56,7 @@ vm_offset_t aml8726_aobus_kva_base;
#endif
static void
-aml8726_fixup_busfreq()
+aml8726_fixup_busfreq(void)
{
phandle_t node;
pcell_t freq, prop;
@@ -165,24 +164,6 @@ platform_devmap_init(void)
return (0);
}
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
#ifndef DEV_GIC
static int
diff --git a/sys/arm/amlogic/aml8726/aml8726_wdt.c b/sys/arm/amlogic/aml8726/aml8726_wdt.c
index cd78c93..1e6cb97 100644
--- a/sys/arm/amlogic/aml8726/aml8726_wdt.c
+++ b/sys/arm/amlogic/aml8726/aml8726_wdt.c
@@ -290,7 +290,7 @@ EARLY_DRIVER_MODULE(wdt, simplebus, aml8726_wdt_driver, aml8726_wdt_devclass,
0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
void
-cpu_reset()
+cpu_reset(void)
{
/* Watchdog has not yet been initialized */
diff --git a/sys/arm/annapurna/alpine/alpine_machdep.c b/sys/arm/annapurna/alpine/alpine_machdep.c
index acb9ba2..dd26571 100644
--- a/sys/arm/annapurna/alpine/alpine_machdep.c
+++ b/sys/arm/annapurna/alpine/alpine_machdep.c
@@ -29,7 +29,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -131,17 +130,3 @@ platform_devmap_init(void)
devmap_add_entry(al_devmap_pa, al_devmap_size);
return (0);
}
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
diff --git a/sys/arm/annapurna/alpine/common.c b/sys/arm/annapurna/alpine/common.c
index cf90556..b03c3a4 100644
--- a/sys/arm/annapurna/alpine/common.c
+++ b/sys/arm/annapurna/alpine/common.c
@@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$");
#define LOCK 0x00000001
extern bus_addr_t al_devmap_pa;
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
static int alpine_get_wdt_base(uint32_t *pbase, uint32_t *psize);
static int alpine_pic_decode_fdt(uint32_t iparent, uint32_t *intr,
diff --git a/sys/arm/arm/bus_space_asm_generic.S b/sys/arm/arm/bus_space_asm_generic.S
index 9d2b11d..711f921 100644
--- a/sys/arm/arm/bus_space_asm_generic.S
+++ b/sys/arm/arm/bus_space_asm_generic.S
@@ -36,7 +36,6 @@
*/
#include <machine/asm.h>
-#include <machine/cpuconf.h>
__FBSDID("$FreeBSD$");
/*
diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c
index 0a1331f..5bf4626 100644
--- a/sys/arm/arm/busdma_machdep-v6.c
+++ b/sys/arm/arm/busdma_machdep-v6.c
@@ -33,7 +33,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -90,14 +89,6 @@ struct bus_dma_tag {
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
struct bounce_zone *bounce_zone;
- /*
- * DMA range for this tag. If the page doesn't fall within
- * one of these ranges, an error is returned. The caller
- * may then decide what to do with the transfer. If the
- * range pointer is NULL, it is ignored.
- */
- struct arm32_dma_range *ranges;
- int _nranges;
};
struct bounce_page {
@@ -402,22 +393,6 @@ must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr,
return (0);
}
-static __inline struct arm32_dma_range *
-_bus_dma_inrange(struct arm32_dma_range *ranges, int nranges,
- bus_addr_t curaddr)
-{
- struct arm32_dma_range *dr;
- int i;
-
- for (i = 0, dr = ranges; i < nranges; i++, dr++) {
- if (curaddr >= dr->dr_sysbase &&
- round_page(curaddr) <= (dr->dr_sysbase + dr->dr_len))
- return (dr);
- }
-
- return (NULL);
-}
-
/*
* Convenience function for manipulating driver locks from busdma (during
* busdma_swi, for example). Drivers that don't provide their own locks
@@ -502,8 +477,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->flags = flags;
newtag->ref_count = 1; /* Count ourself */
newtag->map_count = 0;
- newtag->ranges = bus_dma_get_range();
- newtag->_nranges = bus_dma_get_range_nb();
if (lockfunc != NULL) {
newtag->lockfunc = lockfunc;
newtag->lockfuncarg = lockfuncarg;
@@ -987,22 +960,6 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr,
sgsize = (baddr - curaddr);
}
- if (dmat->ranges) {
- struct arm32_dma_range *dr;
-
- dr = _bus_dma_inrange(dmat->ranges, dmat->_nranges,
- curaddr);
- if (dr == NULL) {
- _bus_dmamap_unload(dmat, map);
- return (0);
- }
- /*
- * In a valid DMA range. Translate the physical
- * memory address to an address in the DMA window.
- */
- curaddr = (curaddr - dr->dr_sysbase) + dr->dr_busbase;
- }
-
/*
* Insert chunk into a segment, coalescing with
* previous segment if possible.
diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
index 9a848f5..aae8dc0 100644
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <vm/uma.h>
-#include <machine/cpuconf.h>
#include <machine/cpufunc.h>
#if defined(CPU_XSCALE_81342)
@@ -585,7 +584,7 @@ static int arm_dcache_l2_assoc;
static int arm_dcache_l2_linesize;
static void
-get_cachetype_cp15()
+get_cachetype_cp15(void)
{
u_int ctype, isize, dsize, cpuid;
u_int clevel, csize, i, sel;
@@ -700,7 +699,7 @@ get_cachetype_cp15()
*/
int
-set_cpufuncs()
+set_cpufuncs(void)
{
cputype = cpu_ident();
cputype &= CPU_ID_CPU_MASK;
diff --git a/sys/arm/arm/cpuinfo.c b/sys/arm/arm/cpuinfo.c
index 2b734f4..8099882 100644
--- a/sys/arm/arm/cpuinfo.c
+++ b/sys/arm/arm/cpuinfo.c
@@ -111,6 +111,10 @@ cpuinfo_init(void)
/* Not yet - CBAR only exist on ARM SMP Cortex A CPUs
cpuinfo.cbar = cp15_cbar_get();
*/
+ if (CPU_CT_FORMAT(cpuinfo.ctr) == CPU_CT_ARMV7) {
+ cpuinfo.ccsidr = cp15_ccsidr_get();
+ cpuinfo.clidr = cp15_clidr_get();
+ }
/* Test if revidr is implemented */
if (cpuinfo.revidr == cpuinfo.midr)
@@ -163,6 +167,7 @@ cpuinfo_get_actlr_modifier(uint32_t *actlr_mask, uint32_t *actlr_set)
if (cpuinfo.implementer == CPU_IMPLEMENTER_ARM) {
switch (cpuinfo.part_number) {
+ case CPU_ARCH_CORTEX_A73:
case CPU_ARCH_CORTEX_A72:
case CPU_ARCH_CORTEX_A57:
case CPU_ARCH_CORTEX_A53:
diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c
index 846ad4e..c2b1ed2 100644
--- a/sys/arm/arm/db_trace.c
+++ b/sys/arm/arm/db_trace.c
@@ -130,7 +130,7 @@ db_stack_trace_cmd(struct unwind_state *state)
}
void
-db_md_list_watchpoints()
+db_md_list_watchpoints(void)
{
dbg_show_watchpoint();
diff --git a/sys/arm/arm/identcpu.c b/sys/arm/arm/identcpu-v4.c
index 2b7fec4..769f0b3 100644
--- a/sys/arm/arm/identcpu.c
+++ b/sys/arm/arm/identcpu-v4.c
@@ -43,18 +43,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/systm.h>
#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/time.h>
-#include <sys/proc.h>
+#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#include <machine/endian.h>
-#include <machine/cpuconf.h>
#include <machine/md_var.h>
char machine[] = "arm";
@@ -169,39 +165,6 @@ const struct cpuidtab cpuids[] = {
{ CPU_ID_ARM1026EJS, CPU_CLASS_ARM10EJ, "ARM1026EJ-S",
generic_steppings },
- { CPU_ID_CORTEXA5, CPU_CLASS_CORTEXA, "Cortex A5",
- generic_steppings },
- { CPU_ID_CORTEXA7, CPU_CLASS_CORTEXA, "Cortex A7",
- generic_steppings },
- { CPU_ID_CORTEXA8R1, CPU_CLASS_CORTEXA, "Cortex A8-r1",
- generic_steppings },
- { CPU_ID_CORTEXA8R2, CPU_CLASS_CORTEXA, "Cortex A8-r2",
- generic_steppings },
- { CPU_ID_CORTEXA8R3, CPU_CLASS_CORTEXA, "Cortex A8-r3",
- generic_steppings },
- { CPU_ID_CORTEXA9R1, CPU_CLASS_CORTEXA, "Cortex A9-r1",
- generic_steppings },
- { CPU_ID_CORTEXA9R2, CPU_CLASS_CORTEXA, "Cortex A9-r2",
- generic_steppings },
- { CPU_ID_CORTEXA9R3, CPU_CLASS_CORTEXA, "Cortex A9-r3",
- generic_steppings },
- { CPU_ID_CORTEXA9R4, CPU_CLASS_CORTEXA, "Cortex A9-r4",
- generic_steppings },
- { CPU_ID_CORTEXA12R0, CPU_CLASS_CORTEXA, "Cortex A12-r0",
- generic_steppings },
- { CPU_ID_CORTEXA15R0, CPU_CLASS_CORTEXA, "Cortex A15-r0",
- generic_steppings },
- { CPU_ID_CORTEXA15R1, CPU_CLASS_CORTEXA, "Cortex A15-r1",
- generic_steppings },
- { CPU_ID_CORTEXA15R2, CPU_CLASS_CORTEXA, "Cortex A15-r2",
- generic_steppings },
- { CPU_ID_CORTEXA15R3, CPU_CLASS_CORTEXA, "Cortex A15-r3",
- generic_steppings },
- { CPU_ID_KRAIT300R0, CPU_CLASS_KRAIT, "Krait 300-r0",
- generic_steppings },
- { CPU_ID_KRAIT300R1, CPU_CLASS_KRAIT, "Krait 300-r1",
- generic_steppings },
-
{ CPU_ID_80200, CPU_CLASS_XSCALE, "i80200",
xscale_steppings },
@@ -248,24 +211,11 @@ const struct cpuidtab cpuids[] = {
{ CPU_ID_IXP435, CPU_CLASS_XSCALE, "IXP435",
ixp425_steppings },
- { CPU_ID_ARM1136JS, CPU_CLASS_ARM11J, "ARM1136J-S",
- generic_steppings },
- { CPU_ID_ARM1136JSR1, CPU_CLASS_ARM11J, "ARM1136J-S R1",
- generic_steppings },
- { CPU_ID_ARM1176JZS, CPU_CLASS_ARM11J, "ARM1176JZ-S",
- generic_steppings },
-
{ CPU_ID_MV88FR131, CPU_CLASS_MARVELL, "Feroceon 88FR131",
generic_steppings },
{ CPU_ID_MV88FR571_VD, CPU_CLASS_MARVELL, "Feroceon 88FR571-VD",
generic_steppings },
- { CPU_ID_MV88SV581X_V7, CPU_CLASS_MARVELL, "Sheeva 88SV581x",
- generic_steppings },
- { CPU_ID_ARM_88SV581X_V7, CPU_CLASS_MARVELL, "Sheeva 88SV581x",
- generic_steppings },
- { CPU_ID_MV88SV584X_V7, CPU_CLASS_MARVELL, "Sheeva 88SV584x",
- generic_steppings },
{ 0, CPU_CLASS_NONE, NULL, NULL }
};
@@ -282,10 +232,7 @@ const struct cpu_classtab cpu_classes[] = {
{ "ARM9EJ-S", "CPU_ARM9E" }, /* CPU_CLASS_ARM9EJS */
{ "ARM10E", "CPU_ARM10" }, /* CPU_CLASS_ARM10E */
{ "ARM10EJ", "CPU_ARM10" }, /* CPU_CLASS_ARM10EJ */
- { "Cortex-A", "CPU_CORTEXA" }, /* CPU_CLASS_CORTEXA */
- { "Krait", "CPU_KRAIT" }, /* CPU_CLASS_KRAIT */
{ "XScale", "CPU_XSCALE_..." }, /* CPU_CLASS_XSCALE */
- { "ARM11J", "CPU_ARM11" }, /* CPU_CLASS_ARM11J */
{ "Marvell", "CPU_MARVELL" }, /* CPU_CLASS_MARVELL */
};
@@ -344,50 +291,11 @@ u_int cpu_pfr(int num)
return (feat);
}
-static
-void identify_armv7(void)
-{
- u_int feature;
-
- printf("Supported features:");
- /* Get Processor Feature Register 0 */
- feature = cpu_pfr(0);
-
- if (feature & ARM_PFR0_ARM_ISA_MASK)
- printf(" ARM_ISA");
-
- if (feature & ARM_PFR0_THUMB2)
- printf(" THUMB2");
- else if (feature & ARM_PFR0_THUMB)
- printf(" THUMB");
-
- if (feature & ARM_PFR0_JAZELLE_MASK)
- printf(" JAZELLE");
-
- if (feature & ARM_PFR0_THUMBEE_MASK)
- printf(" THUMBEE");
-
-
- /* Get Processor Feature Register 1 */
- feature = cpu_pfr(1);
-
- if (feature & ARM_PFR1_ARMV4_MASK)
- printf(" ARMv4");
-
- if (feature & ARM_PFR1_SEC_EXT_MASK)
- printf(" Security_Ext");
-
- if (feature & ARM_PFR1_MICROCTRL_MASK)
- printf(" M_profile");
-
- printf("\n");
-}
-
void
identify_arm_cpu(void)
{
- u_int cpuid, reg, size, sets, ways;
- u_int8_t type, linesize, ctrl;
+ u_int cpuid;
+ u_int8_t ctrl;
int i;
ctrl = cpu_get_control();
@@ -413,43 +321,38 @@ identify_arm_cpu(void)
printf(" ");
- if ((cpuid & CPU_ID_ARCH_MASK) == CPU_ID_CPUID_SCHEME) {
- identify_armv7();
- } else {
- if (ctrl & CPU_CONTROL_BEND_ENABLE)
- printf(" Big-endian");
- else
- printf(" Little-endian");
-
- switch (cpu_class) {
- case CPU_CLASS_ARM9TDMI:
- case CPU_CLASS_ARM9ES:
- case CPU_CLASS_ARM9EJS:
- case CPU_CLASS_ARM10E:
- case CPU_CLASS_ARM10EJ:
- case CPU_CLASS_XSCALE:
- case CPU_CLASS_ARM11J:
- case CPU_CLASS_MARVELL:
- print_enadis(ctrl & CPU_CONTROL_DC_ENABLE, "DC");
- print_enadis(ctrl & CPU_CONTROL_IC_ENABLE, "IC");
+ if (ctrl & CPU_CONTROL_BEND_ENABLE)
+ printf(" Big-endian");
+ else
+ printf(" Little-endian");
+
+ switch (cpu_class) {
+ case CPU_CLASS_ARM9TDMI:
+ case CPU_CLASS_ARM9ES:
+ case CPU_CLASS_ARM9EJS:
+ case CPU_CLASS_ARM10E:
+ case CPU_CLASS_ARM10EJ:
+ case CPU_CLASS_XSCALE:
+ case CPU_CLASS_MARVELL:
+ print_enadis(ctrl & CPU_CONTROL_DC_ENABLE, "DC");
+ print_enadis(ctrl & CPU_CONTROL_IC_ENABLE, "IC");
#ifdef CPU_XSCALE_81342
- print_enadis(ctrl & CPU_CONTROL_L2_ENABLE, "L2");
+ print_enadis(ctrl & CPU_CONTROL_L2_ENABLE, "L2");
#endif
#if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY)
- i = sheeva_control_ext(0, 0);
- print_enadis(i & MV_WA_ENABLE, "WA");
- print_enadis(i & MV_DC_STREAM_ENABLE, "DC streaming");
- printf("\n ");
- print_enadis((i & MV_BTB_DISABLE) == 0, "BTB");
- print_enadis(i & MV_L2_ENABLE, "L2");
- print_enadis((i & MV_L2_PREFETCH_DISABLE) == 0,
- "L2 prefetch");
- printf("\n ");
+ i = sheeva_control_ext(0, 0);
+ print_enadis(i & MV_WA_ENABLE, "WA");
+ print_enadis(i & MV_DC_STREAM_ENABLE, "DC streaming");
+ printf("\n ");
+ print_enadis((i & MV_BTB_DISABLE) == 0, "BTB");
+ print_enadis(i & MV_L2_ENABLE, "L2");
+ print_enadis((i & MV_L2_PREFETCH_DISABLE) == 0,
+ "L2 prefetch");
+ printf("\n ");
#endif
- break;
- default:
- break;
- }
+ break;
+ default:
+ break;
}
print_enadis(ctrl & CPU_CONTROL_WBUF_ENABLE, "WB");
@@ -461,74 +364,22 @@ identify_arm_cpu(void)
print_enadis(ctrl & CPU_CONTROL_BPRD_ENABLE, "branch prediction");
printf("\n");
- if (arm_cache_level) {
- printf("LoUU:%d LoC:%d LoUIS:%d \n", CPU_CLIDR_LOUU(arm_cache_level) + 1,
- arm_cache_loc + 1, CPU_CLIDR_LOUIS(arm_cache_level) + 1);
- i = 0;
- while (((type = CPU_CLIDR_CTYPE(arm_cache_level, i)) != 0) && i < 7) {
- printf("Cache level %d: \n", i + 1);
- if (type == CACHE_DCACHE || type == CACHE_UNI_CACHE ||
- type == CACHE_SEP_CACHE) {
- reg = arm_cache_type[2 * i];
- ways = CPUV7_CT_xSIZE_ASSOC(reg) + 1;
- sets = CPUV7_CT_xSIZE_SET(reg) + 1;
- linesize = 1 << (CPUV7_CT_xSIZE_LEN(reg) + 4);
- size = (ways * sets * linesize) / 1024;
-
- if (type == CACHE_UNI_CACHE)
- printf(" %dKB/%dB %d-way unified cache", size, linesize,ways);
- else
- printf(" %dKB/%dB %d-way data cache", size, linesize, ways);
- if (reg & CPUV7_CT_CTYPE_WT)
- printf(" WT");
- if (reg & CPUV7_CT_CTYPE_WB)
- printf(" WB");
- if (reg & CPUV7_CT_CTYPE_RA)
- printf(" Read-Alloc");
- if (reg & CPUV7_CT_CTYPE_WA)
- printf(" Write-Alloc");
- printf("\n");
- }
-
- if (type == CACHE_ICACHE || type == CACHE_SEP_CACHE) {
- reg = arm_cache_type[(2 * i) + 1];
-
- ways = CPUV7_CT_xSIZE_ASSOC(reg) + 1;
- sets = CPUV7_CT_xSIZE_SET(reg) + 1;
- linesize = 1 << (CPUV7_CT_xSIZE_LEN(reg) + 4);
- size = (ways * sets * linesize) / 1024;
-
- printf(" %dKB/%dB %d-way instruction cache", size, linesize, ways);
- if (reg & CPUV7_CT_CTYPE_WT)
- printf(" WT");
- if (reg & CPUV7_CT_CTYPE_WB)
- printf(" WB");
- if (reg & CPUV7_CT_CTYPE_RA)
- printf(" Read-Alloc");
- if (reg & CPUV7_CT_CTYPE_WA)
- printf(" Write-Alloc");
- printf("\n");
- }
- i++;
- }
+ /* Print cache info. */
+ if (arm_picache_line_size == 0 && arm_pdcache_line_size == 0)
+ return;
+
+ if (arm_pcache_unified) {
+ printf(" %dKB/%dB %d-way %s unified cache\n",
+ arm_pdcache_size / 1024,
+ arm_pdcache_line_size, arm_pdcache_ways,
+ wtnames[arm_pcache_type]);
} else {
- /* Print cache info. */
- if (arm_picache_line_size == 0 && arm_pdcache_line_size == 0)
- return;
-
- if (arm_pcache_unified) {
- printf(" %dKB/%dB %d-way %s unified cache\n",
- arm_pdcache_size / 1024,
- arm_pdcache_line_size, arm_pdcache_ways,
- wtnames[arm_pcache_type]);
- } else {
- printf(" %dKB/%dB %d-way instruction cache\n",
- arm_picache_size / 1024,
- arm_picache_line_size, arm_picache_ways);
- printf(" %dKB/%dB %d-way %s data cache\n",
- arm_pdcache_size / 1024,
- arm_pdcache_line_size, arm_pdcache_ways,
- wtnames[arm_pcache_type]);
- }
+ printf(" %dKB/%dB %d-way instruction cache\n",
+ arm_picache_size / 1024,
+ arm_picache_line_size, arm_picache_ways);
+ printf(" %dKB/%dB %d-way %s data cache\n",
+ arm_pdcache_size / 1024,
+ arm_pdcache_line_size, arm_pdcache_ways,
+ wtnames[arm_pcache_type]);
}
}
diff --git a/sys/arm/arm/identcpu-v6.c b/sys/arm/arm/identcpu-v6.c
new file mode 100644
index 0000000..7cc8170
--- /dev/null
+++ b/sys/arm/arm/identcpu-v6.c
@@ -0,0 +1,360 @@
+/* $NetBSD: cpu.c,v 1.55 2004/02/13 11:36:10 wiz Exp $ */
+
+/*-
+ * Copyright (c) 1995 Mark Brinicombe.
+ * Copyright (c) 1995 Brini.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Brini.
+ * 4. The name of the company nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * RiscBSD kernel project
+ *
+ * cpu.c
+ *
+ * Probing and configuration for the master CPU
+ *
+ * Created : 10/10/95
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
+#include <machine/md_var.h>
+
+char machine[] = "arm";
+
+SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
+ machine, 0, "Machine class");
+
+static char hw_buf[81];
+static int hw_buf_idx;
+static bool hw_buf_newline;
+
+static struct {
+ int implementer;
+ int part_number;
+ char *impl_name;
+ char *core_name;
+} cpu_names[] = {
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_ARM1176, "ARM", "ARM1176"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A5 , "ARM", "Cortex-A5"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A7 , "ARM", "Cortex-A7"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A8 , "ARM", "Cortex-A8"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A9 , "ARM", "Cortex-A9"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A12, "ARM", "Cortex-A12"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A15, "ARM", "Cortex-A15"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A17, "ARM", "Cortex-A17"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A53, "ARM", "Cortex-A53"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A57, "ARM", "Cortex-A57"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A72, "ARM", "Cortex-A72"},
+ {CPU_IMPLEMENTER_ARM, CPU_ARCH_CORTEX_A73, "ARM", "Cortex-A73"},
+
+ {CPU_IMPLEMENTER_MRVL, CPU_ARCH_SHEEVA_581, "Marwell", "PJ4 v7"},
+ {CPU_IMPLEMENTER_MRVL, CPU_ARCH_SHEEVA_584, "Marwell", "PJ4MP v7"},
+
+ {CPU_IMPLEMENTER_QCOM, CPU_ARCH_KRAIT_300, "Qualcomm", "Krait 300"},
+};
+
+
+static void
+print_v5_cache(void)
+{
+ uint32_t isize, dsize;
+ uint32_t multiplier;
+ int pcache_type;
+ int pcache_unified;
+ int picache_size;
+ int picache_line_size;
+ int picache_ways;
+ int pdcache_size;
+ int pdcache_line_size;
+ int pdcache_ways;
+
+ pcache_unified = 0;
+ picache_size = 0 ;
+ picache_line_size = 0 ;
+ picache_ways = 0 ;
+ pdcache_size = 0;
+ pdcache_line_size = 0;
+ pdcache_ways = 0;
+
+ if ((cpuinfo.ctr & CPU_CT_S) == 0)
+ pcache_unified = 1;
+
+ /*
+ * If you want to know how this code works, go read the ARM ARM.
+ */
+ pcache_type = CPU_CT_CTYPE(cpuinfo.ctr);
+
+ if (pcache_unified == 0) {
+ isize = CPU_CT_ISIZE(cpuinfo.ctr);
+ multiplier = (isize & CPU_CT_xSIZE_M) ? 3 : 2;
+ picache_line_size = 1U << (CPU_CT_xSIZE_LEN(isize) + 3);
+ if (CPU_CT_xSIZE_ASSOC(isize) == 0) {
+ if (isize & CPU_CT_xSIZE_M)
+ picache_line_size = 0; /* not present */
+ else
+ picache_ways = 1;
+ } else {
+ picache_ways = multiplier <<
+ (CPU_CT_xSIZE_ASSOC(isize) - 1);
+ }
+ picache_size = multiplier << (CPU_CT_xSIZE_SIZE(isize) + 8);
+ }
+
+ dsize = CPU_CT_DSIZE(cpuinfo.ctr);
+ multiplier = (dsize & CPU_CT_xSIZE_M) ? 3 : 2;
+ pdcache_line_size = 1U << (CPU_CT_xSIZE_LEN(dsize) + 3);
+ if (CPU_CT_xSIZE_ASSOC(dsize) == 0) {
+ if (dsize & CPU_CT_xSIZE_M)
+ pdcache_line_size = 0; /* not present */
+ else
+ pdcache_ways = 1;
+ } else {
+ pdcache_ways = multiplier <<
+ (CPU_CT_xSIZE_ASSOC(dsize) - 1);
+ }
+ pdcache_size = multiplier << (CPU_CT_xSIZE_SIZE(dsize) + 8);
+
+
+ /* Print cache info. */
+ if (picache_line_size == 0 && pdcache_line_size == 0)
+ return;
+
+ if (pcache_unified) {
+ printf(" %dKB/%dB %d-way %s unified cache\n",
+ pdcache_size / 1024,
+ pdcache_line_size, pdcache_ways,
+ pcache_type == 0 ? "WT" : "WB");
+ } else {
+ printf(" %dKB/%dB %d-way instruction cache\n",
+ picache_size / 1024,
+ picache_line_size, picache_ways);
+ printf(" %dKB/%dB %d-way %s data cache\n",
+ pdcache_size / 1024,
+ pdcache_line_size, pdcache_ways,
+ pcache_type == 0 ? "WT" : "WB");
+ }
+}
+
+static void
+print_v7_cache(void )
+{
+ uint32_t type, val, size, sets, ways, linesize;
+ int i;
+
+ printf("LoUU:%d LoC:%d LoUIS:%d \n",
+ CPU_CLIDR_LOUU(cpuinfo.clidr) + 1,
+ CPU_CLIDR_LOC(cpuinfo.clidr) + 1,
+ CPU_CLIDR_LOUIS(cpuinfo.clidr) + 1);
+
+ for (i = 0; i < 7; i++) {
+ type = CPU_CLIDR_CTYPE(cpuinfo.clidr, i);
+ if (type == 0)
+ break;
+ printf("Cache level %d:\n", i + 1);
+ if (type == CACHE_DCACHE || type == CACHE_UNI_CACHE ||
+ type == CACHE_SEP_CACHE) {
+ cp15_csselr_set(i << 1);
+ val = cp15_ccsidr_get();
+ ways = CPUV7_CT_xSIZE_ASSOC(val) + 1;
+ sets = CPUV7_CT_xSIZE_SET(val) + 1;
+ linesize = 1 << (CPUV7_CT_xSIZE_LEN(val) + 4);
+ size = (ways * sets * linesize) / 1024;
+
+ if (type == CACHE_UNI_CACHE)
+ printf(" %dKB/%dB %d-way unified cache",
+ size, linesize,ways);
+ else
+ printf(" %dKB/%dB %d-way data cache",
+ size, linesize, ways);
+ if (val & CPUV7_CT_CTYPE_WT)
+ printf(" WT");
+ if (val & CPUV7_CT_CTYPE_WB)
+ printf(" WB");
+ if (val & CPUV7_CT_CTYPE_RA)
+ printf(" Read-Alloc");
+ if (val & CPUV7_CT_CTYPE_WA)
+ printf(" Write-Alloc");
+ printf("\n");
+ }
+
+ if (type == CACHE_ICACHE || type == CACHE_SEP_CACHE) {
+ cp15_csselr_set(i << 1 | 1);
+ val = cp15_ccsidr_get();
+ ways = CPUV7_CT_xSIZE_ASSOC(val) + 1;
+ sets = CPUV7_CT_xSIZE_SET(val) + 1;
+ linesize = 1 << (CPUV7_CT_xSIZE_LEN(val) + 4);
+ size = (ways * sets * linesize) / 1024;
+ printf(" %dKB/%dB %d-way instruction cache",
+ size, linesize, ways);
+ if (val & CPUV7_CT_CTYPE_WT)
+ printf(" WT");
+ if (val & CPUV7_CT_CTYPE_WB)
+ printf(" WB");
+ if (val & CPUV7_CT_CTYPE_RA)
+ printf(" Read-Alloc");
+ if (val & CPUV7_CT_CTYPE_WA)
+ printf(" Write-Alloc");
+ printf("\n");
+ }
+ }
+ cp15_csselr_set(0);
+}
+
+static void
+add_cap(char *cap)
+{
+ int len;
+
+ len = strlen(cap);
+
+ if ((hw_buf_idx + len + 2) >= 79) {
+ printf("%s,\n", hw_buf);
+ hw_buf_idx = 0;
+ hw_buf_newline = true;
+ }
+ if (hw_buf_newline)
+ hw_buf_idx += sprintf(hw_buf + hw_buf_idx, " ");
+ else
+ hw_buf_idx += sprintf(hw_buf + hw_buf_idx, ", ");
+ hw_buf_newline = false;
+
+
+ hw_buf_idx += sprintf(hw_buf + hw_buf_idx, "%s", cap);
+}
+
+void
+identify_arm_cpu(void)
+{
+ int i;
+ u_int val;
+
+ /*
+ * CPU
+ */
+ for(i = 0; i < nitems(cpu_names); i++) {
+ if (cpu_names[i].implementer == cpuinfo.implementer &&
+ cpu_names[i].part_number == cpuinfo.part_number) {
+ printf("CPU: %s %s r%dp%d (ECO: 0x%08X)\n",
+ cpu_names[i].impl_name, cpu_names[i].core_name,
+ cpuinfo.revision, cpuinfo.patch,
+ cpuinfo.midr != cpuinfo.revidr ?
+ cpuinfo.revidr : 0);
+ break;
+ }
+
+ }
+ if (i >= nitems(cpu_names))
+ printf("unknown CPU (ID = 0x%x)\n", cpuinfo.midr);
+
+ printf("CPU Features: \n");
+ hw_buf_idx = 0;
+ hw_buf_newline = true;
+
+ val = (cpuinfo.mpidr >> 4)& 0xF;
+ if (cpuinfo.mpidr & (1 << 31U))
+ add_cap("Multiprocessing");
+ val = (cpuinfo.id_pfr0 >> 4)& 0xF;
+ if (val == 1)
+ add_cap("Thumb");
+ else if (val == 3)
+ add_cap("Thumb2");
+
+ val = (cpuinfo.id_pfr1 >> 4)& 0xF;
+ if (val == 1 || val == 2)
+ add_cap("Security");
+
+ val = (cpuinfo.id_pfr1 >> 12)& 0xF;
+ if (val == 1)
+ add_cap("Virtualization");
+
+ val = (cpuinfo.id_pfr1 >> 16)& 0xF;
+ if (val == 1)
+ add_cap("Generic Timer");
+
+ val = (cpuinfo.id_mmfr0 >> 0)& 0xF;
+ if (val == 2) {
+ add_cap("VMSAv6");
+ } else if (val >= 3) {
+ add_cap("VMSAv7");
+ if (val >= 4)
+ add_cap("PXN");
+ if (val >= 5)
+ add_cap("LPAE");
+ }
+
+ val = (cpuinfo.id_mmfr3 >> 20)& 0xF;
+ if (val == 1)
+ add_cap("Coherent Walk");
+
+ if (hw_buf_idx != 0)
+ printf("%s\n", hw_buf);
+
+ printf("Optional instructions: \n");
+ hw_buf_idx = 0;
+ hw_buf_newline = true;
+ val = (cpuinfo.id_isar0 >> 24)& 0xF;
+ if (val == 1)
+ add_cap("SDIV/UDIV (Thumb)");
+ else if (val == 2)
+ add_cap("SDIV/UDIV");
+
+ val = (cpuinfo.id_isar2 >> 20)& 0xF;
+ if (val == 1 || val == 2)
+ add_cap("UMULL");
+
+ val = (cpuinfo.id_isar2 >> 16)& 0xF;
+ if (val == 1 || val == 2 || val == 3)
+ add_cap("SMULL");
+
+ val = (cpuinfo.id_isar2 >> 12)& 0xF;
+ if (val == 1)
+ add_cap("MLA");
+
+ val = (cpuinfo.id_isar3 >> 4)& 0xF;
+ if (val == 1)
+ add_cap("SIMD");
+ else if (val == 3)
+ add_cap("SIMD(ext)");
+ if (hw_buf_idx != 0)
+ printf("%s\n", hw_buf);
+
+ /*
+ * Cache
+ */
+ if (CPU_CT_FORMAT(cpuinfo.ctr) == CPU_CT_ARMV7)
+ print_v7_cache();
+ else
+ print_v5_cache();
+}
diff --git a/sys/arm/arm/locore-v4.S b/sys/arm/arm/locore-v4.S
index bd39ae1..afba08e 100644
--- a/sys/arm/arm/locore-v4.S
+++ b/sys/arm/arm/locore-v4.S
@@ -37,7 +37,6 @@
#include <sys/syscall.h>
#include <machine/asm.h>
#include <machine/armreg.h>
-#include <machine/cpuconf.h>
#include <machine/pte-v4.h>
__FBSDID("$FreeBSD$");
diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S
index cdca461..fabe450 100644
--- a/sys/arm/arm/locore-v6.S
+++ b/sys/arm/arm/locore-v6.S
@@ -34,7 +34,6 @@
#include <machine/asmacros.h>
#include <machine/armreg.h>
#include <machine/sysreg.h>
-#include <machine/cpuconf.h>
#include <machine/pte-v6.h>
__FBSDID("$FreeBSD$");
diff --git a/sys/arm/arm/physmem.c b/sys/arm/arm/physmem.c
index f6222c3..ec68c36 100644
--- a/sys/arm/arm/physmem.c
+++ b/sys/arm/arm/physmem.c
@@ -145,7 +145,7 @@ physmem_dump_tables(int (*prfunc)(const char *, ...))
* Print the contents of the static mapping table. Used for bootverbose.
*/
void
-arm_physmem_print_tables()
+arm_physmem_print_tables(void)
{
physmem_dump_tables(printf);
diff --git a/sys/arm/arm/platform.c b/sys/arm/arm/platform.c
index 85e60c6..64e8a30 100644
--- a/sys/arm/arm/platform.c
+++ b/sys/arm/arm/platform.c
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
* through a previously registered kernel object.
*/
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index 3a13e8a..2894c35 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -4806,12 +4806,11 @@ pmap_protect_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t sva,
("%s: sva is not 1mpage aligned", __func__));
opte1 = npte1 = pte1_load(pte1p);
- if (pte1_is_managed(opte1)) {
+ if (pte1_is_managed(opte1) && pte1_is_dirty(opte1)) {
eva = sva + PTE1_SIZE;
for (va = sva, m = PHYS_TO_VM_PAGE(pte1_pa(opte1));
va < eva; va += PAGE_SIZE, m++)
- if (pte1_is_dirty(opte1))
- vm_page_dirty(m);
+ vm_page_dirty(m);
}
if ((prot & VM_PROT_WRITE) == 0)
npte1 |= PTE1_RO | PTE1_NM;
diff --git a/sys/arm/arm/stack_machdep.c b/sys/arm/arm/stack_machdep.c
index 6d23be6..df232a9 100644
--- a/sys/arm/arm/stack_machdep.c
+++ b/sys/arm/arm/stack_machdep.c
@@ -27,8 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/systm.h>
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/stack.h>
diff --git a/sys/arm/arm/trap-v4.c b/sys/arm/arm/trap-v4.c
index 024c911..7f0adbe 100644
--- a/sys/arm/arm/trap-v4.c
+++ b/sys/arm/arm/trap-v4.c
@@ -139,11 +139,7 @@ static const struct data_abort data_aborts[] = {
{dab_align, "Alignment Fault 3"},
{dab_buserr, "External Linefetch Abort (S)"},
{NULL, "Translation Fault (S)"},
-#if (ARM_MMU_V6 + ARM_MMU_V7) != 0
- {NULL, "Translation Flag Fault"},
-#else
{dab_buserr, "External Linefetch Abort (P)"},
-#endif
{NULL, "Translation Fault (P)"},
{dab_buserr, "External Non-Linefetch Abort (S)"},
{NULL, "Domain Fault (S)"},
diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c
index fec194e6..5dfa0d4 100644
--- a/sys/arm/arm/undefined.c
+++ b/sys/arm/arm/undefined.c
@@ -165,7 +165,7 @@ gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code)
static struct undefined_handler gdb_uh;
void
-undefined_init()
+undefined_init(void)
{
int loop;
diff --git a/sys/arm/at91/at91_common.c b/sys/arm/at91/at91_common.c
index 49ad065..696161f 100644
--- a/sys/arm/at91/at91_common.c
+++ b/sys/arm/at91/at91_common.c
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
extern const struct devmap_entry at91_devmap[];
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_aic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_common.c b/sys/arm/broadcom/bcm2835/bcm2835_common.c
index 123dce1..7d2ef76 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_common.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_common.c
@@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fb.c b/sys/arm/broadcom/bcm2835/bcm2835_fb.c
index 58caac2..15746ec 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_fb.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_fb.c
@@ -474,15 +474,15 @@ bcmfb_configure(int flags)
if ((root != 0) &&
(display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) {
if (sc->width == 0) {
- if ((OF_getprop(display, "broadcom,width",
+ if ((OF_getencprop(display, "broadcom,width",
&cell, sizeof(cell))) > 0)
- sc->width = (int)fdt32_to_cpu(cell);
+ sc->width = cell;
}
if (sc->height == 0) {
if ((OF_getprop(display, "broadcom,height",
&cell, sizeof(cell))) > 0)
- sc->height = (int)fdt32_to_cpu(cell);
+ sc->height = cell;
}
}
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
index 811c108..840b71b 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
@@ -42,7 +42,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -78,13 +77,15 @@ bcm2835_late_init(platform_t plat)
system = OF_finddevice("/system");
if (system != 0) {
- len = OF_getprop(system, "linux,serial", &cells, sizeof(cells));
+ len = OF_getencprop(system, "linux,serial", cells,
+ sizeof(cells));
if (len > 0)
- board_set_serial(fdt64_to_cpu(*((uint64_t *)cells)));
+ board_set_serial(((uint64_t)cells[0]) << 32 | cells[1]);
- len = OF_getprop(system, "linux,revision", &cells, sizeof(cells));
+ len = OF_getencprop(system, "linux,revision", cells,
+ sizeof(cells));
if (len > 0)
- board_set_revision(fdt32_to_cpu(*((uint32_t *)cells)));
+ board_set_revision(cells[0]);
}
}
@@ -113,19 +114,7 @@ bcm2836_devmap_init(platform_t plat)
}
#endif
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
void
cpu_reset()
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_wdog.c b/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
index 39b16e3..c1152a2 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_wdog.c
@@ -191,7 +191,7 @@ bcmwd_watchdog_fn(void *private, u_int cmd, int *error)
}
void
-bcmwd_watchdog_reset()
+bcmwd_watchdog_reset(void)
{
if (bcmwd_lsc == NULL)
diff --git a/sys/arm/conf/ALLWINNER b/sys/arm/conf/ALLWINNER
index b3258e5..ae7e416 100644
--- a/sys/arm/conf/ALLWINNER
+++ b/sys/arm/conf/ALLWINNER
@@ -32,7 +32,6 @@ options SOC_ALLWINNER_A31S
options SOC_ALLWINNER_A83T
options SOC_ALLWINNER_H3
-options HZ=100
options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
options PLATFORM
diff --git a/sys/arm/conf/ALPINE b/sys/arm/conf/ALPINE
index 4160f95..64a9f6a 100644
--- a/sys/arm/conf/ALPINE
+++ b/sys/arm/conf/ALPINE
@@ -25,7 +25,6 @@ include "../annapurna/alpine/std.alpine"
makeoptions MODULES_OVERRIDE=""
makeoptions WERROR="-Werror"
-options HZ=100
options SCHED_4BSD # 4BSD scheduler
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/AML8726 b/sys/arm/conf/AML8726
index a90cccf..e41c05a 100644
--- a/sys/arm/conf/AML8726
+++ b/sys/arm/conf/AML8726
@@ -23,7 +23,6 @@ ident AML8726
include "std.armv6"
include "../amlogic/aml8726/std.aml8726"
-options HZ=100
options SCHED_ULE # ULE scheduler
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options LINUX_BOOT_ABI
diff --git a/sys/arm/conf/ARMADA38X b/sys/arm/conf/ARMADA38X
index 3176a81..aa5f23d 100644
--- a/sys/arm/conf/ARMADA38X
+++ b/sys/arm/conf/ARMADA38X
@@ -19,8 +19,6 @@ options MD_ROOT
options ROOTDEVNAME=\"/dev/da0s1a\"
options SCHED_ULE # ULE scheduler
-#options SCHED_4BSD # 4BSD scheduler
-
options SMP
# Pseudo devices
diff --git a/sys/arm/conf/ARMADAXP b/sys/arm/conf/ARMADAXP
index 5e107dd..19a11ea 100644
--- a/sys/arm/conf/ARMADAXP
+++ b/sys/arm/conf/ARMADAXP
@@ -27,7 +27,6 @@ options SOC_MV_ARMADAXP
makeoptions WERROR="-Werror"
-options HZ=1000
options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/BEAGLEBONE b/sys/arm/conf/BEAGLEBONE
index 2fbe219..8010aee 100644
--- a/sys/arm/conf/BEAGLEBONE
+++ b/sys/arm/conf/BEAGLEBONE
@@ -30,7 +30,6 @@ makeoptions MODULES_EXTRA="dtb/am335x am335x_dmtpps"
options INTRNG
-options HZ=100
options SCHED_4BSD # 4BSD scheduler
options PLATFORM
diff --git a/sys/arm/conf/EXYNOS5.common b/sys/arm/conf/EXYNOS5.common
index ad42056..b5102dd 100644
--- a/sys/arm/conf/EXYNOS5.common
+++ b/sys/arm/conf/EXYNOS5.common
@@ -21,7 +21,6 @@
makeoptions WERROR="-Werror"
include "std.armv6"
-options HZ=100
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
diff --git a/sys/arm/conf/IMX53-QSB b/sys/arm/conf/IMX53-QSB
index 5fa907c..8d25ea6 100644
--- a/sys/arm/conf/IMX53-QSB
+++ b/sys/arm/conf/IMX53-QSB
@@ -22,8 +22,6 @@
include "IMX53"
ident IMX53-QSB
-options HZ=250 # 4ms scheduling quantum
-
# required for netbooting
#options BOOTP
#options BOOTP_COMPAT
diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6
index 6000566..f834033 100644
--- a/sys/arm/conf/IMX6
+++ b/sys/arm/conf/IMX6
@@ -26,7 +26,6 @@ options INTRNG
options SOC_IMX6
-options HZ=500 # Scheduling quantum is 2 milliseconds.
options SCHED_ULE # ULE scheduler
#options NFSD # Network Filesystem Server
options INCLUDE_CONFIG_FILE # Include this file in kernel
diff --git a/sys/arm/conf/PANDABOARD b/sys/arm/conf/PANDABOARD
index 158a9b7..b98c4b0 100644
--- a/sys/arm/conf/PANDABOARD
+++ b/sys/arm/conf/PANDABOARD
@@ -30,7 +30,6 @@ hints "PANDABOARD.hints"
include "std.armv6"
include "../ti/omap4/pandaboard/std.pandaboard"
-options HZ=100
options SCHED_ULE # ULE scheduler
options PLATFORM
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/RK3188 b/sys/arm/conf/RK3188
index 7528c0c..7f77159 100644
--- a/sys/arm/conf/RK3188
+++ b/sys/arm/conf/RK3188
@@ -23,7 +23,6 @@ ident RK3188
include "std.armv6"
include "../rockchip/std.rk30xx"
-options HZ=100
options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B
index 5e8aee2..ce408ab 100644
--- a/sys/arm/conf/RPI-B
+++ b/sys/arm/conf/RPI-B
@@ -26,7 +26,6 @@ include "../broadcom/bcm2835/std.bcm2835"
options INTRNG
-options HZ=100
options SCHED_4BSD # 4BSD scheduler
options PLATFORM
diff --git a/sys/arm/conf/RPI2 b/sys/arm/conf/RPI2
index 82293ad..b2dc8f1 100644
--- a/sys/arm/conf/RPI2
+++ b/sys/arm/conf/RPI2
@@ -26,7 +26,6 @@ include "../broadcom/bcm2835/std.bcm2836"
options INTRNG
-options HZ=100
options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
options PLATFORM
diff --git a/sys/arm/conf/SOCKIT.common b/sys/arm/conf/SOCKIT.common
index 964c98a..9102002 100644
--- a/sys/arm/conf/SOCKIT.common
+++ b/sys/arm/conf/SOCKIT.common
@@ -25,7 +25,6 @@ makeoptions MODULES_OVERRIDE=""
makeoptions WERROR="-Werror"
-options HZ=100
options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/TEGRA124 b/sys/arm/conf/TEGRA124
index 663a948..34e8409 100644
--- a/sys/arm/conf/TEGRA124
+++ b/sys/arm/conf/TEGRA124
@@ -23,7 +23,6 @@ include "../nvidia/tegra124/std.tegra124"
ident TEGRA124
-options HZ=100 # Scheduling quantum is 10 milliseconds.
options SCHED_ULE # ULE scheduler
options PLATFORM # Platform based SoC
options PLATFORM_SMP
diff --git a/sys/arm/conf/VERSATILEPB b/sys/arm/conf/VERSATILEPB
index 63feaff..7cfc5f6 100644
--- a/sys/arm/conf/VERSATILEPB
+++ b/sys/arm/conf/VERSATILEPB
@@ -29,7 +29,6 @@ makeoptions MODULES_OVERRIDE=""
options KERNVIRTADDR=0xc0100000
makeoptions KERNVIRTADDR=0xc0100000
-options HZ=100
options SCHED_4BSD # 4BSD scheduler
options LINUX_BOOT_ABI # Process metadata passed from Linux boot loaders
diff --git a/sys/arm/conf/VIRT b/sys/arm/conf/VIRT
index 007e24c..ad266c7 100644
--- a/sys/arm/conf/VIRT
+++ b/sys/arm/conf/VIRT
@@ -23,8 +23,7 @@ ident VIRT
include "std.armv6"
include "../qemu/std.virt"
-options HZ=100
-options SCHED_ULE # 4BSD scheduler
+options SCHED_ULE # ULE scheduler
options PLATFORM
options PLATFORM_SMP
options SMP # Enable multiple cores
diff --git a/sys/arm/conf/VYBRID b/sys/arm/conf/VYBRID
index d834b55..2174aee 100644
--- a/sys/arm/conf/VYBRID
+++ b/sys/arm/conf/VYBRID
@@ -24,7 +24,6 @@ include "../freescale/vybrid/std.vybrid"
makeoptions WERROR="-Werror"
-options HZ=100
options SCHED_4BSD # 4BSD scheduler
#options NANDFS # NAND Filesystem
#options SMP # Enable multiple cores
diff --git a/sys/arm/freescale/imx/files.imx5 b/sys/arm/freescale/imx/files.imx5
index aaea851..c2214c1 100644
--- a/sys/arm/freescale/imx/files.imx5
+++ b/sys/arm/freescale/imx/files.imx5
@@ -32,7 +32,7 @@ arm/freescale/imx/imx51_ccm.c standard
dev/ata/chipsets/ata-fsl.c optional imxata
# SDHCI/MMC
-arm/freescale/imx/imx_sdhci.c optional sdhci
+dev/sdhci/fsl_sdhci.c optional sdhci
# USB OH3 controller (1 OTG, 3 EHCI)
arm/freescale/imx/imx_nop_usbphy.c optional ehci
diff --git a/sys/arm/freescale/imx/files.imx6 b/sys/arm/freescale/imx/files.imx6
index de4ff6e..6fb8e2f 100644
--- a/sys/arm/freescale/imx/files.imx6
+++ b/sys/arm/freescale/imx/files.imx6
@@ -32,7 +32,7 @@ arm/freescale/imx/imx6_ipu.c optional vt
#
# Optional devices.
#
-arm/freescale/imx/imx_sdhci.c optional sdhci
+dev/sdhci/fsl_sdhci.c optional sdhci
arm/freescale/imx/imx_wdog.c optional imxwdt
diff --git a/sys/arm/freescale/imx/imx51_ipuv3.c b/sys/arm/freescale/imx/imx51_ipuv3.c
index a96b185..b88bb3f 100644
--- a/sys/arm/freescale/imx/imx51_ipuv3.c
+++ b/sys/arm/freescale/imx/imx51_ipuv3.c
@@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -313,10 +312,10 @@ ipu3_fb_attach(device_t dev)
* On i.MX53, the offset is 0.
*/
node = ofw_bus_get_node(dev);
- if ((OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0)
+ if ((OF_getencprop(node, "reg", &reg, sizeof(reg))) <= 0)
base = 0;
else
- base = fdt32_to_cpu(reg) - IPU_CM_BASE(0);
+ base = reg - IPU_CM_BASE(0);
/* map controller registers */
err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh);
if (err)
diff --git a/sys/arm/freescale/imx/imx51_ipuv3_fbd.c b/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
index 800244a..4f44e9c 100644
--- a/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
+++ b/sys/arm/freescale/imx/imx51_ipuv3_fbd.c
@@ -222,10 +222,10 @@ ipu3_fb_attach(device_t dev)
* On i.MX53, the offset is 0.
*/
node = ofw_bus_get_node(dev);
- if ((OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0)
+ if ((OF_getencprop(node, "reg", &reg, sizeof(reg))) <= 0)
base = 0;
else
- base = fdt32_to_cpu(reg) - IPU_CM_BASE(0);
+ base = reg - IPU_CM_BASE(0);
/* map controller registers */
err = bus_space_map(iot, IPU_CM_BASE(base), IPU_CM_SIZE, 0, &ioh);
if (err)
diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c
index 62c5a64..689df94 100644
--- a/sys/arm/freescale/imx/imx6_anatop.c
+++ b/sys/arm/freescale/imx/imx6_anatop.c
@@ -776,7 +776,7 @@ imx6_anatop_probe(device_t dev)
}
uint32_t
-imx6_get_cpu_clock()
+imx6_get_cpu_clock(void)
{
uint32_t corediv, plldiv;
diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c
index 2379810..6d2ad22 100644
--- a/sys/arm/freescale/imx/imx6_machdep.c
+++ b/sys/arm/freescale/imx/imx6_machdep.c
@@ -52,10 +52,6 @@ __FBSDID("$FreeBSD$");
#include "platform_if.h"
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
static uint32_t gpio1_node;
#ifndef INTRNG
diff --git a/sys/arm/freescale/imx/imx6_src.c b/sys/arm/freescale/imx/imx6_src.c
index 400357a..325c8be 100644
--- a/sys/arm/freescale/imx/imx6_src.c
+++ b/sys/arm/freescale/imx/imx6_src.c
@@ -70,7 +70,7 @@ WR4(struct src_softc *sc, bus_size_t off, uint32_t val)
}
int
-src_reset_ipu()
+src_reset_ipu(void)
{
uint32_t reg;
int timeout = 10000;
diff --git a/sys/arm/freescale/imx/imx6_ssi.c b/sys/arm/freescale/imx/imx6_ssi.c
index 9000ae3..0f916fe 100644
--- a/sys/arm/freescale/imx/imx6_ssi.c
+++ b/sys/arm/freescale/imx/imx6_ssi.c
@@ -447,12 +447,12 @@ find_sdma_controller(struct sc_info *sc)
if ((len = OF_getproplen(node, "dmas")) <= 0)
return (ENXIO);
- OF_getprop(node, "dmas", &dts_value, len);
+ OF_getencprop(node, "dmas", &dts_value, len);
- sc->sdma_ev_rx = fdt32_to_cpu(dts_value[1]);
- sc->sdma_ev_tx = fdt32_to_cpu(dts_value[5]);
+ sc->sdma_ev_rx = dts_value[1];
+ sc->sdma_ev_tx = dts_value[5];
- sdma_node = OF_node_from_xref(fdt32_to_cpu(dts_value[0]));
+ sdma_node = OF_node_from_xref(dts_value[0]);
sdma_sc = NULL;
diff --git a/sys/arm/freescale/imx/imx6_usbphy.c b/sys/arm/freescale/imx/imx6_usbphy.c
index a338737..806659b 100644
--- a/sys/arm/freescale/imx/imx6_usbphy.c
+++ b/sys/arm/freescale/imx/imx6_usbphy.c
@@ -143,6 +143,10 @@ usbphy_attach(device_t dev)
bus_write_4(sc->mem_res, CTRL_SET_REG, CTRL_SFTRST);
bus_write_4(sc->mem_res, CTRL_CLR_REG, CTRL_SFTRST | CTRL_CLKGATE);
+ /* Set UTMI+ level 2+3 bits to enable low and full speed devices. */
+ bus_write_4(sc->mem_res, CTRL_SET_REG,
+ CTRL_ENUTMILEVEL2 | CTRL_ENUTMILEVEL3);
+
/* Power up: clear all bits in the powerdown register. */
bus_write_4(sc->mem_res, PWD_REG, 0);
diff --git a/sys/arm/freescale/imx/imx_common.c b/sys/arm/freescale/imx/imx_common.c
index c423873..3eb076e 100644
--- a/sys/arm/freescale/imx/imx_common.c
+++ b/sys/arm/freescale/imx/imx_common.c
@@ -50,10 +50,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/freescale/imx/imx_gpio.c b/sys/arm/freescale/imx/imx_gpio.c
index 922548e..7da47e6 100644
--- a/sys/arm/freescale/imx/imx_gpio.c
+++ b/sys/arm/freescale/imx/imx_gpio.c
@@ -728,7 +728,7 @@ imx51_gpio_attach(device_t dev)
(READ4(sc, IMX_GPIO_OE_REG) & (1U << i)) ? GPIO_PIN_OUTPUT :
GPIO_PIN_INPUT;
snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME,
- "imx_gpio%d.%d", unit, i);
+ "GPIO%d_IO%02d", unit + 1, i);
}
#ifdef INTRNG
diff --git a/sys/arm/freescale/imx/imx_machdep.c b/sys/arm/freescale/imx/imx_machdep.c
index 6ef44a4..12e4172 100644
--- a/sys/arm/freescale/imx/imx_machdep.c
+++ b/sys/arm/freescale/imx/imx_machdep.c
@@ -29,7 +29,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/reboot.h>
@@ -54,20 +53,6 @@ SYSCTL_UINT(_hw_imx, OID_AUTO, last_reset_status, CTLFLAG_RD,
SYSCTL_STRING(_hw_imx, OID_AUTO, last_reset_reason, CTLFLAG_RD,
"unknown", 0, "Last reset reason");
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
/*
* This code which manipulates the watchdog hardware is here to implement
* cpu_reset() because the watchdog is the only way for software to reset the
@@ -84,11 +69,18 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr)
* Trigger an immediate reset by clearing the SRS bit in the watchdog
* control register. The reset happens on the next cycle of the wdog
* 32KHz clock, so hang out in a spin loop until the reset takes effect.
+ *
+ * Imx6 erratum ERR004346 says the SRS bit has to be cleared twice
+ * within the same cycle of the 32khz clock to reliably trigger the
+ * reset. Writing it 3 times in a row ensures at least 2 of the writes
+ * happen in the same 32k clock cycle.
*/
if ((pcr = devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) {
printf("cpu_reset() can't find its control register... locking up now.");
} else {
*pcr &= ~WDOG_CR_SRS;
+ *pcr &= ~WDOG_CR_SRS;
+ *pcr &= ~WDOG_CR_SRS;
}
for (;;)
continue;
diff --git a/sys/arm/freescale/vybrid/vf_common.c b/sys/arm/freescale/vybrid/vf_common.c
index 494f5d6..2f17b97 100644
--- a/sys/arm/freescale/vybrid/vf_common.c
+++ b/sys/arm/freescale/vybrid/vf_common.c
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <machine/bus.h>
@@ -44,16 +43,15 @@ void
cpu_reset(void)
{
phandle_t src;
- uint32_t addr, paddr;
+ uint32_t paddr;
bus_addr_t vaddr;
if (src_swreset() == 0)
goto end;
src = OF_finddevice("src");
- if ((src != 0) && (OF_getprop(src, "reg", &paddr, sizeof(paddr))) > 0) {
- addr = fdt32_to_cpu(paddr);
- if (bus_space_map(fdtbus_bs_tag, addr, 0x10, 0, &vaddr) == 0) {
+ if ((src != 0) && (OF_getencprop(src, "reg", &paddr, sizeof(paddr))) > 0) {
+ if (bus_space_map(fdtbus_bs_tag, paddr, 0x10, 0, &vaddr) == 0) {
bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST);
}
}
@@ -62,10 +60,6 @@ end:
while (1);
}
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/freescale/vybrid/vf_dcu4.c b/sys/arm/freescale/vybrid/vf_dcu4.c
index 34dea46..7fbf4a3 100644
--- a/sys/arm/freescale/vybrid/vf_dcu4.c
+++ b/sys/arm/freescale/vybrid/vf_dcu4.c
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/pmap.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -246,37 +245,37 @@ get_panel_info(struct dcu_softc *sc, struct panel_info *panel)
/* panel size */
if ((len = OF_getproplen(node, "panel-size")) <= 0)
return (ENXIO);
- OF_getprop(node, "panel-size", &dts_value, len);
- panel->width = fdt32_to_cpu(dts_value[0]);
- panel->height = fdt32_to_cpu(dts_value[1]);
+ OF_getencprop(node, "panel-size", dts_value, len);
+ panel->width = dts_value[0];
+ panel->height = dts_value[1];
/* hsync */
if ((len = OF_getproplen(node, "panel-hsync")) <= 0)
return (ENXIO);
- OF_getprop(node, "panel-hsync", &dts_value, len);
- panel->h_back_porch = fdt32_to_cpu(dts_value[0]);
- panel->h_pulse_width = fdt32_to_cpu(dts_value[1]);
- panel->h_front_porch = fdt32_to_cpu(dts_value[2]);
+ OF_getencprop(node, "panel-hsync", dts_value, len);
+ panel->h_back_porch = dts_value[0];
+ panel->h_pulse_width = dts_value[1];
+ panel->h_front_porch = dts_value[2];
/* vsync */
if ((len = OF_getproplen(node, "panel-vsync")) <= 0)
return (ENXIO);
- OF_getprop(node, "panel-vsync", &dts_value, len);
- panel->v_back_porch = fdt32_to_cpu(dts_value[0]);
- panel->v_pulse_width = fdt32_to_cpu(dts_value[1]);
- panel->v_front_porch = fdt32_to_cpu(dts_value[2]);
+ OF_getencprop(node, "panel-vsync", dts_value, len);
+ panel->v_back_porch = dts_value[0];
+ panel->v_pulse_width = dts_value[1];
+ panel->v_front_porch = dts_value[2];
/* clk divider */
if ((len = OF_getproplen(node, "panel-clk-div")) <= 0)
return (ENXIO);
- OF_getprop(node, "panel-clk-div", &dts_value, len);
- panel->clk_div = fdt32_to_cpu(dts_value[0]);
+ OF_getencprop(node, "panel-clk-div", dts_value, len);
+ panel->clk_div = dts_value[0];
/* backlight pin */
if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0)
return (ENXIO);
- OF_getprop(node, "panel-backlight-pin", &dts_value, len);
- panel->backlight_pin = fdt32_to_cpu(dts_value[0]);
+ OF_getencprop(node, "panel-backlight-pin", dts_value, len);
+ panel->backlight_pin = dts_value[0];
return (0);
}
diff --git a/sys/arm/freescale/vybrid/vf_edma.c b/sys/arm/freescale/vybrid/vf_edma.c
index 9317921..eb6e514 100644
--- a/sys/arm/freescale/vybrid/vf_edma.c
+++ b/sys/arm/freescale/vybrid/vf_edma.c
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <sys/watchdog.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -284,8 +283,8 @@ edma_attach(device_t dev)
if ((len = OF_getproplen(node, "device-id")) <= 0)
return (ENXIO);
- OF_getprop(node, "device-id", &dts_value, len);
- sc->device_id = fdt32_to_cpu(dts_value);
+ OF_getencprop(node, "device-id", &dts_value, len);
+ sc->device_id = dts_value;
sc->dma_stop = dma_stop;
sc->dma_setup = dma_setup;
diff --git a/sys/arm/freescale/vybrid/vf_iomuxc.c b/sys/arm/freescale/vybrid/vf_iomuxc.c
index 95711d6..c4e29fe 100644
--- a/sys/arm/freescale/vybrid/vf_iomuxc.c
+++ b/sys/arm/freescale/vybrid/vf_iomuxc.c
@@ -148,12 +148,12 @@ pinmux_set(struct iomuxc_softc *sc)
continue;
if ((len = OF_getproplen(child, "iomux_config")) > 0) {
- OF_getprop(child, "iomux_config", &iomux_config, len);
+ OF_getencprop(child, "iomux_config", iomux_config, len);
values = len / (sizeof(uint32_t));
for (i = 0; i < values; i += 2) {
- pin = fdt32_to_cpu(iomux_config[i]);
- pin_cfg = fdt32_to_cpu(iomux_config[i+1]);
+ pin = iomux_config[i];
+ pin_cfg = iomux_config[i+1];
#if 0
device_printf(sc->dev, "Set pin %d to 0x%08x\n",
pin, pin_cfg);
diff --git a/sys/arm/freescale/vybrid/vf_machdep.c b/sys/arm/freescale/vybrid/vf_machdep.c
index d32ba0d..15566a4 100644
--- a/sys/arm/freescale/vybrid/vf_machdep.c
+++ b/sys/arm/freescale/vybrid/vf_machdep.c
@@ -30,7 +30,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -78,17 +77,3 @@ platform_devmap_init(void)
return (0);
}
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
diff --git a/sys/arm/freescale/vybrid/vf_sai.c b/sys/arm/freescale/vybrid/vf_sai.c
index 83f689f..8ff802a 100644
--- a/sys/arm/freescale/vybrid/vf_sai.c
+++ b/sys/arm/freescale/vybrid/vf_sai.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include <dev/sound/chip.h>
#include <mixer_if.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -424,19 +423,19 @@ find_edma_controller(struct sc_info *sc)
if ((len = OF_getproplen(node, "edma-mux-group")) <= 0)
return (ENXIO);
- OF_getprop(node, "edma-src-transmit", &dts_value, len);
- edma_src_transmit = fdt32_to_cpu(dts_value);
- OF_getprop(node, "edma-mux-group", &dts_value, len);
- edma_mux_group = fdt32_to_cpu(dts_value);
- OF_getprop(node, "edma-controller", &dts_value, len);
- edma_node = OF_node_from_xref(fdt32_to_cpu(dts_value));
+ OF_getencprop(node, "edma-src-transmit", &dts_value, len);
+ edma_src_transmit = dts_value;
+ OF_getencprop(node, "edma-mux-group", &dts_value, len);
+ edma_mux_group = dts_value;
+ OF_getencprop(node, "edma-controller", &dts_value, len);
+ edma_node = OF_node_from_xref(dts_value);
if ((len = OF_getproplen(edma_node, "device-id")) <= 0) {
return (ENXIO);
}
- OF_getprop(edma_node, "device-id", &dts_value, len);
- edma_device_id = fdt32_to_cpu(dts_value);
+ OF_getencprop(edma_node, "device-id", &dts_value, len);
+ edma_device_id = dts_value;
edma_sc = NULL;
diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h
index 0cf69c9..091e3c1 100644
--- a/sys/arm/include/atomic.h
+++ b/sys/arm/include/atomic.h
@@ -39,13 +39,10 @@
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
-#include <sys/types.h>
#include <machine/armreg.h>
#ifndef _KERNEL
#include <machine/sysarch.h>
-#else
-#include <machine/cpuconf.h>
#endif
#if __ARM_ARCH >= 6
diff --git a/sys/arm/include/bus_dma.h b/sys/arm/include/bus_dma.h
index ddf5504..1295118 100644
--- a/sys/arm/include/bus_dma.h
+++ b/sys/arm/include/bus_dma.h
@@ -72,7 +72,7 @@
#define BUS_DMA_TAG_VALID(t) ((t) != (bus_dma_tag_t)0)
-#ifdef _ARM32_BUS_DMA_PRIVATE
+#if defined(_ARM32_BUS_DMA_PRIVATE) && __ARM_ARCH < 6
/*
* arm32_dma_range
*
diff --git a/sys/arm/include/cpuconf.h b/sys/arm/include/cpuconf.h
deleted file mode 100644
index 24a3b8f..0000000
--- a/sys/arm/include/cpuconf.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $NetBSD: cpuconf.h,v 1.8 2003/09/06 08:55:42 rearnsha Exp $ */
-
-/*-
- * Copyright (c) 2002 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _MACHINE_CPUCONF_H_
-#define _MACHINE_CPUCONF_H_
-
-/*
- * IF YOU CHANGE THIS FILE, MAKE SURE TO UPDATE THE DEFINITION OF
- * "PMAP_NEEDS_PTE_SYNC" IN <arm/arm32/pmap.h> FOR THE CPU TYPE
- * YOU ARE ADDING SUPPORT FOR.
- */
-
-/*
- * Step 1: Count the number of CPU types configured into the kernel.
- */
-#define CPU_NTYPES (defined(CPU_ARM9) + \
- defined(CPU_ARM9E) + \
- defined(CPU_ARM1176) + \
- defined(CPU_XSCALE_PXA2X0) + \
- defined(CPU_FA526) + \
- defined(CPU_XSCALE_IXP425)) + \
- defined(CPU_CORTEXA) + \
- defined(CPU_KRAIT) + \
- defined(CPU_MV_PJ4B)
-
-/*
- * Step 2: Determine which ARM architecture versions are configured.
- */
-#if defined(CPU_ARM9) || defined(CPU_FA526)
-#define ARM_ARCH_4 1
-#else
-#define ARM_ARCH_4 0
-#endif
-
-#if (defined(CPU_ARM9E) || \
- defined(CPU_XSCALE_81342) || \
- defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425))
-#define ARM_ARCH_5 1
-#else
-#define ARM_ARCH_5 0
-#endif
-
-#if !defined(ARM_ARCH_6)
-#if defined(CPU_ARM1176)
-#define ARM_ARCH_6 1
-#else
-#define ARM_ARCH_6 0
-#endif
-#endif
-
-#if defined(CPU_CORTEXA) || defined(CPU_KRAIT) || defined(CPU_MV_PJ4B)
-#define ARM_ARCH_7A 1
-#else
-#define ARM_ARCH_7A 0
-#endif
-
-#define ARM_NARCH (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 | ARM_ARCH_7A)
-
-/*
- * Compatibility for userland builds that have no CPUTYPE defined. Use the ARCH
- * constants predefined by the compiler to define our old-school arch constants.
- * This is a stopgap measure to tide us over until the conversion of all code
- * to the newer ACLE constants defined by ARM (see acle-compat.h).
- */
-#if ARM_NARCH == 0
-#if defined(__ARM_ARCH_4T__)
-#undef ARM_ARCH_4
-#undef ARM_NARCH
-#define ARM_ARCH_4 1
-#define ARM_NARCH 1
-#define CPU_ARM9 1
-#elif defined(__ARM_ARCH_6ZK__)
-#undef ARM_ARCH_6
-#undef ARM_NARCH
-#define ARM_ARCH_6 1
-#define ARM_NARCH 1
-#define CPU_ARM1176 1
-#endif
-#endif
-
-#if ARM_NARCH == 0 && !defined(KLD_MODULE) && defined(_KERNEL)
-#error ARM_NARCH is 0
-#endif
-
-#if ARM_ARCH_5 || ARM_ARCH_6 || ARM_ARCH_7A
-/*
- * We could support Thumb code on v4T, but the lack of clean interworking
- * makes that hard.
- */
-#define THUMB_CODE
-#endif
-
-/*
- * Step 3: Define which MMU classes are configured:
- *
- * ARM_MMU_MEMC Prehistoric, external memory controller
- * and MMU for ARMv2 CPUs.
- *
- * ARM_MMU_GENERIC Generic ARM MMU, compatible with ARMv4 and v5.
- *
- * ARM_MMU_V6 ARMv6 MMU.
- *
- * ARM_MMU_V7 ARMv7 MMU.
- *
- * ARM_MMU_XSCALE XScale MMU. Compatible with generic ARM
- * MMU, but also has several extensions which
- * require different PTE layout to use.
- */
-#if (defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_FA526))
-#define ARM_MMU_GENERIC 1
-#else
-#define ARM_MMU_GENERIC 0
-#endif
-
-#if defined(CPU_ARM1176)
-#define ARM_MMU_V6 1
-#else
-#define ARM_MMU_V6 0
-#endif
-
-#if defined(CPU_CORTEXA) || defined(CPU_KRAIT) || defined(CPU_MV_PJ4B)
-#define ARM_MMU_V7 1
-#else
-#define ARM_MMU_V7 0
-#endif
-
-#if (defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
- defined(CPU_XSCALE_81342))
-#define ARM_MMU_XSCALE 1
-#else
-#define ARM_MMU_XSCALE 0
-#endif
-
-#define ARM_NMMUS (ARM_MMU_GENERIC + ARM_MMU_V6 + \
- ARM_MMU_V7 + ARM_MMU_XSCALE)
-#if ARM_NMMUS == 0 && !defined(KLD_MODULE) && defined(_KERNEL)
-#error ARM_NMMUS is 0
-#endif
-
-/*
- * Step 4: Define features that may be present on a subset of CPUs
- *
- * ARM_XSCALE_PMU Performance Monitoring Unit on 81342
- */
-
-#if (defined(CPU_XSCALE_81342))
-#define ARM_XSCALE_PMU 1
-#else
-#define ARM_XSCALE_PMU 0
-#endif
-
-#if defined(CPU_XSCALE_81342)
-#define CPU_XSCALE_CORE3
-#endif
-#endif /* _MACHINE_CPUCONF_H_ */
diff --git a/sys/arm/include/cpufunc.h b/sys/arm/include/cpufunc.h
index 3102b0a..d983add 100644
--- a/sys/arm/include/cpufunc.h
+++ b/sys/arm/include/cpufunc.h
@@ -48,7 +48,6 @@
#include <sys/types.h>
#include <machine/armreg.h>
-#include <machine/cpuconf.h>
static __inline void
breakpoint(void)
diff --git a/sys/arm/include/cpuinfo.h b/sys/arm/include/cpuinfo.h
index f4db021..41b5e6d 100644
--- a/sys/arm/include/cpuinfo.h
+++ b/sys/arm/include/cpuinfo.h
@@ -48,13 +48,14 @@
#define CPU_ARCH_CORTEX_A53 0xD03
#define CPU_ARCH_CORTEX_A57 0xD07
#define CPU_ARCH_CORTEX_A72 0xD08
+#define CPU_ARCH_CORTEX_A73 0xD09
/* QCOM */
#define CPU_ARCH_KRAIT_300 0x06F
/* MRVL */
-#define CPU_ARCH_SHEEVA_851 0x581 /* PJ4/PJ4B */
+#define CPU_ARCH_SHEEVA_581 0x581 /* PJ4/PJ4B */
#define CPU_ARCH_SHEEVA_584 0x584 /* PJ4B-MP/PJ4C */
struct cpuinfo {
@@ -80,8 +81,10 @@ struct cpuinfo {
uint32_t id_isar4;
uint32_t id_isar5;
uint32_t cbar;
+ uint32_t ccsidr;
+ uint32_t clidr;
- /* Parsed bits of above registers... */
+ /* Parsed bits of above registers... */
/* midr */
int implementer;
diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h
index d3ae30b..33dfb1b 100644
--- a/sys/arm/include/pcpu.h
+++ b/sys/arm/include/pcpu.h
@@ -32,8 +32,6 @@
#ifdef _KERNEL
-#include <machine/cpuconf.h>
-
#include <sys/_lock.h>
#include <sys/_mutex.h>
diff --git a/sys/arm/include/pmap-v4.h b/sys/arm/include/pmap-v4.h
index cfb675e..9ecfc37 100644
--- a/sys/arm/include/pmap-v4.h
+++ b/sys/arm/include/pmap-v4.h
@@ -51,7 +51,30 @@
#define _MACHINE_PMAP_V4_H_
#include <machine/pte-v4.h>
-#include <machine/cpuconf.h>
+
+/*
+ * Define the MMU types we support based on the cpu types. While the code has
+ * some theoretical support for multiple MMU types in a single kernel, there are
+ * no actual working configurations that use that feature.
+ */
+#if (defined(CPU_ARM9) || defined(CPU_ARM9E) || defined(CPU_FA526))
+#define ARM_MMU_GENERIC 1
+#else
+#define ARM_MMU_GENERIC 0
+#endif
+
+#if (defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \
+ defined(CPU_XSCALE_81342))
+#define ARM_MMU_XSCALE 1
+#else
+#define ARM_MMU_XSCALE 0
+#endif
+
+#define ARM_NMMUS (ARM_MMU_GENERIC + ARM_MMU_XSCALE)
+#if ARM_NMMUS == 0 && !defined(KLD_MODULE) && defined(_KERNEL)
+#error ARM_NMMUS is 0
+#endif
+
/*
* Pte related macros
*/
diff --git a/sys/arm/lpc/lpc_fb.c b/sys/arm/lpc/lpc_fb.c
index b2eab8b..e496915 100644
--- a/sys/arm/lpc/lpc_fb.c
+++ b/sys/arm/lpc/lpc_fb.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -280,10 +279,9 @@ lpc_fb_intr(void *arg)
static int
lpc_fb_fdt_read(phandle_t node, const char *name, uint32_t *ret)
{
- if (OF_getprop(node, name, ret, sizeof(uint32_t)) <= 0)
+ if (OF_getencprop(node, name, ret, sizeof(uint32_t)) <= 0)
return (ENOENT);
- *ret = fdt32_to_cpu(*ret);
return (0);
}
diff --git a/sys/arm/lpc/lpc_gpio.c b/sys/arm/lpc/lpc_gpio.c
index 798469d..b062792 100644
--- a/sys/arm/lpc/lpc_gpio.c
+++ b/sys/arm/lpc/lpc_gpio.c
@@ -518,7 +518,7 @@ lpc_gpio_get_state(device_t dev, int pin, int *state)
}
void
-lpc_gpio_init()
+lpc_gpio_init(void)
{
bus_space_tag_t bst;
bus_space_handle_t bsh;
diff --git a/sys/arm/lpc/lpc_intc.c b/sys/arm/lpc/lpc_intc.c
index db7c300..d26ef90 100644
--- a/sys/arm/lpc/lpc_intc.c
+++ b/sys/arm/lpc/lpc_intc.c
@@ -227,10 +227,6 @@ lpc_intc_eoi(void *data)
}
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/lpc/lpc_timer.c b/sys/arm/lpc/lpc_timer.c
index ded53fa..f745cf0 100644
--- a/sys/arm/lpc/lpc_timer.c
+++ b/sys/arm/lpc/lpc_timer.c
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -158,7 +157,7 @@ lpc_timer_attach(device_t dev)
/* Get PERIPH_CLK encoded in parent bus 'bus-frequency' property */
node = ofw_bus_get_node(dev);
- if (OF_getprop(OF_parent(node), "bus-frequency", &freq,
+ if (OF_getencprop(OF_parent(node), "bus-frequency", &freq,
sizeof(pcell_t)) <= 0) {
bus_release_resources(dev, lpc_timer_spec, sc->lt_res);
bus_teardown_intr(dev, sc->lt_res[2], intrcookie);
@@ -166,8 +165,6 @@ lpc_timer_attach(device_t dev)
return (ENXIO);
}
- freq = fdt32_to_cpu(freq);
-
/* Set desired frequency in event timer and timecounter */
sc->lt_et.et_frequency = (uint64_t)freq;
lpc_timecounter.tc_frequency = (uint64_t)freq;
diff --git a/sys/arm/mv/gpio.c b/sys/arm/mv/gpio.c
index 79b7cc6..6708167 100644
--- a/sys/arm/mv/gpio.c
+++ b/sys/arm/mv/gpio.c
@@ -113,7 +113,7 @@ struct gpio_ctrl_entry {
gpios_phandler_t handler;
};
-int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len);
+static int mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len);
int gpio_get_config_from_dt(void);
struct gpio_ctrl_entry gpio_controllers[] = {
@@ -540,7 +540,7 @@ mv_gpio_value_set(uint32_t pin, uint8_t val)
mv_gpio_reg_clear(reg, pin);
}
-int
+static int
mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len)
{
pcell_t gpio_cells, pincnt;
@@ -554,10 +554,8 @@ mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len)
/* Node is not a GPIO controller. */
return (ENXIO);
- if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
+ if (OF_getencprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
return (ENXIO);
-
- gpio_cells = fdt32_to_cpu(gpio_cells);
if (gpio_cells != 3)
return (ENXIO);
@@ -567,9 +565,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len)
if (fdt_regsize(ctrl, &gpio_ctrl, &size))
return (ENXIO);
- if (OF_getprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
+ if (OF_getencprop(ctrl, "pin-count", &pincnt, sizeof(pcell_t)) < 0)
return (ENXIO);
- sc.pin_num = fdt32_to_cpu(pincnt);
+ sc.pin_num = pincnt;
/*
* Skip controller reference, since controller's phandle is given
@@ -579,9 +577,9 @@ mv_handle_gpios_prop(phandle_t ctrl, pcell_t *gpios, int len)
gpios += inc;
for (t = 0; t < tuples; t++) {
- pin = fdt32_to_cpu(gpios[0]);
- dir = fdt32_to_cpu(gpios[1]);
- flags = fdt32_to_cpu(gpios[2]);
+ pin = gpios[0];
+ dir = gpios[1];
+ flags = gpios[2];
mv_gpio_configure(pin, flags);
@@ -630,7 +628,7 @@ mv_gpio_init(void)
return (ENXIO);
/* Get 'gpios' property. */
- OF_getprop(child, "gpios", &gpios, len);
+ OF_getencprop(child, "gpios", gpios, len);
e = (struct gpio_ctrl_entry *)&gpio_controllers;
@@ -641,7 +639,7 @@ mv_gpio_init(void)
* contain a ref. to a node defining GPIO
* controller.
*/
- ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0]));
+ ctrl = OF_node_from_xref(gpios[0]);
if (fdt_is_compatible(ctrl, e->compat))
/* Call a handler. */
diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c
index a1d7d49..782fcf0 100644
--- a/sys/arm/mv/mv_machdep.c
+++ b/sys/arm/mv/mv_machdep.c
@@ -146,21 +146,19 @@ moveon:
/*
* Process 'pin-count' and 'pin-map' props.
*/
- if (OF_getprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0)
+ if (OF_getencprop(node, "pin-count", &pin_count, sizeof(pin_count)) <= 0)
return (ENXIO);
- pin_count = fdt32_to_cpu(pin_count);
if (pin_count > MPP_PIN_MAX)
return (ERANGE);
- if (OF_getprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0)
+ if (OF_getencprop(node, "#pin-cells", &pin_cells, sizeof(pin_cells)) <= 0)
pin_cells = MPP_PIN_CELLS;
- pin_cells = fdt32_to_cpu(pin_cells);
if (pin_cells > MPP_PIN_CELLS)
return (ERANGE);
tuple_size = sizeof(pcell_t) * pin_cells;
bzero(pinmap, sizeof(pinmap));
- len = OF_getprop(node, "pin-map", pinmap, sizeof(pinmap));
+ len = OF_getencprop(node, "pin-map", pinmap, sizeof(pinmap));
if (len <= 0)
return (ERANGE);
if (len % tuple_size)
@@ -175,8 +173,8 @@ moveon:
bzero(mpp, sizeof(mpp));
pinmap_ptr = pinmap;
for (i = 0; i < pins; i++) {
- mpp_pin = fdt32_to_cpu(*pinmap_ptr);
- mpp_function = fdt32_to_cpu(*(pinmap_ptr + 1));
+ mpp_pin = *pinmap_ptr;
+ mpp_function = *(pinmap_ptr + 1);
mpp[mpp_pin] = mpp_function;
pinmap_ptr += pin_cells;
}
@@ -408,12 +406,10 @@ platform_devmap_init(void)
if (fdt_is_compatible(child, "mrvl,lbc")) {
/* Check available space */
- if (OF_getprop(child, "bank-count", (void *)&bank_count,
+ if (OF_getencprop(child, "bank-count", &bank_count,
sizeof(bank_count)) <= 0)
/* If no property, use default value */
bank_count = 1;
- else
- bank_count = fdt32_to_cpu(bank_count);
if ((i + bank_count) >= FDT_DEVMAP_MAX)
return (ENOMEM);
@@ -432,6 +428,7 @@ platform_devmap_init(void)
return (0);
}
+#if __ARM_ARCH < 6
struct arm32_dma_range *
bus_dma_get_range(void)
{
@@ -445,6 +442,7 @@ bus_dma_get_range_nb(void)
return (0);
}
+#endif
#if defined(CPU_MV_PJ4B)
#ifdef DDB
diff --git a/sys/arm/nvidia/tegra124/tegra124_machdep.c b/sys/arm/nvidia/tegra124/tegra124_machdep.c
index 1233a42..d1e3889 100644
--- a/sys/arm/nvidia/tegra124/tegra124_machdep.c
+++ b/sys/arm/nvidia/tegra124/tegra124_machdep.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#define _ARM32_BUS_DMA_PRIVATE
#include "opt_platform.h"
#include <sys/cdefs.h>
@@ -62,24 +61,6 @@ __FBSDID("$FreeBSD$");
PMC_SCRATCH0_MODE_BOOTLOADER | \
PMC_SCRATCH0_MODE_RCM)
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
static vm_offset_t
tegra124_lastaddr(platform_t plat)
{
diff --git a/sys/arm/nvidia/tegra_efuse.c b/sys/arm/nvidia/tegra_efuse.c
index 34e0da0..889c06f 100644
--- a/sys/arm/nvidia/tegra_efuse.c
+++ b/sys/arm/nvidia/tegra_efuse.c
@@ -237,7 +237,7 @@ tegra_fuse_read_4(int addr) {
static void
-tegra_efuse_dump_sku()
+tegra_efuse_dump_sku(void)
{
printf(" TEGRA SKU Info:\n");
printf(" chip_id: %u\n", tegra_sku_info.chip_id);
diff --git a/sys/arm/qemu/virt_common.c b/sys/arm/qemu/virt_common.c
index 03cba30..cda02e5 100644
--- a/sys/arm/qemu/virt_common.c
+++ b/sys/arm/qemu/virt_common.c
@@ -37,10 +37,6 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
fdt_pic_decode_t fdt_pic_table[] = {
&gic_decode_fdt,
diff --git a/sys/arm/qemu/virt_machdep.c b/sys/arm/qemu/virt_machdep.c
index d15b97c..8509ca6 100644
--- a/sys/arm/qemu/virt_machdep.c
+++ b/sys/arm/qemu/virt_machdep.c
@@ -30,7 +30,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/devmap.h>
@@ -45,20 +44,6 @@ __FBSDID("$FreeBSD$");
#include "platform_if.h"
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
void
cpu_reset(void)
{
diff --git a/sys/arm/rockchip/rk30xx_common.c b/sys/arm/rockchip/rk30xx_common.c
index aa66b72..826ebda 100644
--- a/sys/arm/rockchip/rk30xx_common.c
+++ b/sys/arm/rockchip/rk30xx_common.c
@@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/rockchip/rk30xx_gpio.c b/sys/arm/rockchip/rk30xx_gpio.c
index 609eb6a..60dd57b 100644
--- a/sys/arm/rockchip/rk30xx_gpio.c
+++ b/sys/arm/rockchip/rk30xx_gpio.c
@@ -526,10 +526,8 @@ rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len)
if (sc == NULL)
return ENXIO;
- if (OF_getprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
+ if (OF_getencprop(ctrl, "#gpio-cells", &gpio_cells, sizeof(pcell_t)) < 0)
return (ENXIO);
-
- gpio_cells = fdt32_to_cpu(gpio_cells);
if (gpio_cells != 2)
return (ENXIO);
@@ -546,9 +544,9 @@ rk30_gpios_prop_handle(phandle_t ctrl, pcell_t *gpios, int len)
inc = sizeof(ihandle_t) / sizeof(pcell_t);
gpios += inc;
for (t = 0; t < tuples; t++) {
- pin = fdt32_to_cpu(gpios[0]);
- dir = fdt32_to_cpu(gpios[1]);
- flags = fdt32_to_cpu(gpios[2]);
+ pin = gpios[0];
+ dir = gpios[1];
+ flags = gpios[2];
for (i = 0; i < sc->sc_gpio_npins; i++) {
if (sc->sc_gpio_pins[i].gp_pin == pin)
@@ -601,7 +599,7 @@ rk30_gpio_init(void)
return (ENXIO);
/* Get 'gpios' property. */
- OF_getprop(child, "gpios", &gpios, len);
+ OF_getencprop(child, "gpios", gpios, len);
e = (struct gpio_ctrl_entry *)&gpio_controllers;
@@ -612,7 +610,7 @@ rk30_gpio_init(void)
* contain a ref. to a node defining GPIO
* controller.
*/
- ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0]));
+ ctrl = OF_node_from_xref(gpios[0]);
if (fdt_is_compatible(ctrl, e->compat))
/* Call a handler. */
diff --git a/sys/arm/rockchip/rk30xx_machdep.c b/sys/arm/rockchip/rk30xx_machdep.c
index db34d33..bb37315 100644
--- a/sys/arm/rockchip/rk30xx_machdep.c
+++ b/sys/arm/rockchip/rk30xx_machdep.c
@@ -34,7 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -92,20 +91,6 @@ platform_devmap_init(void)
return (0);
}
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
void
cpu_reset()
{
diff --git a/sys/arm/rockchip/rk30xx_wdog.c b/sys/arm/rockchip/rk30xx_wdog.c
index 32ef5bd..47d2b1c 100644
--- a/sys/arm/rockchip/rk30xx_wdog.c
+++ b/sys/arm/rockchip/rk30xx_wdog.c
@@ -171,7 +171,7 @@ rk30_wd_watchdog_fn(void *private, u_int cmd, int *error)
}
void
-rk30_wd_watchdog_reset()
+rk30_wd_watchdog_reset(void)
{
bus_space_handle_t bsh;
diff --git a/sys/arm/samsung/exynos/exynos5_common.c b/sys/arm/samsung/exynos/exynos5_common.c
index b91e083..04021c1 100644
--- a/sys/arm/samsung/exynos/exynos5_common.c
+++ b/sys/arm/samsung/exynos/exynos5_common.c
@@ -49,10 +49,6 @@ cpu_reset(void)
while (1);
}
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/samsung/exynos/exynos5_machdep.c b/sys/arm/samsung/exynos/exynos5_machdep.c
index 6483a7a..76a5af1 100644
--- a/sys/arm/samsung/exynos/exynos5_machdep.c
+++ b/sys/arm/samsung/exynos/exynos5_machdep.c
@@ -30,7 +30,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -83,17 +82,3 @@ platform_devmap_init(void)
return (0);
}
-
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
diff --git a/sys/arm/ti/am335x/am335x_dmtpps.c b/sys/arm/ti/am335x/am335x_dmtpps.c
index 6ed9bd5..2c4e634 100644
--- a/sys/arm/ti/am335x/am335x_dmtpps.c
+++ b/sys/arm/ti/am335x/am335x_dmtpps.c
@@ -163,7 +163,7 @@ dmtpps_translate_nickname(const char *nick)
* fails that IS an error, return -1.
*/
static int
-dmtpps_find_tmr_num_by_tunable()
+dmtpps_find_tmr_num_by_tunable(void)
{
struct padinfo *pi;
char iname[20];
@@ -201,7 +201,7 @@ dmtpps_find_tmr_num_by_tunable()
* input pin. If so, return the timer number, if not return 0.
*/
static int
-dmtpps_find_tmr_num_by_padconf()
+dmtpps_find_tmr_num_by_padconf(void)
{
int err;
unsigned int padstate;
@@ -225,7 +225,7 @@ dmtpps_find_tmr_num_by_padconf()
* configuration. This is done just once, the first time probe() runs.
*/
static int
-dmtpps_find_tmr_num()
+dmtpps_find_tmr_num(void)
{
int tmr_num;
@@ -463,6 +463,14 @@ dmtpps_attach(device_t dev)
sc->tmr_num = ti_hwmods_get_unit(dev, "timer");
snprintf(sc->tmr_name, sizeof(sc->tmr_name), "DMTimer%d", sc->tmr_num);
+ /*
+ * Configure the timer pulse/capture pin to input/capture mode. This is
+ * required in addition to configuring the pin as input with the pinmux
+ * controller (which was done via fdt data or tunable at probe time).
+ */
+ sc->tclr = DMT_TCLR_GPO_CFG;
+ DMTIMER_WRITE4(sc, DMT_TCLR, sc->tclr);
+
/* Set up timecounter hardware, start it. */
DMTIMER_WRITE4(sc, DMT_TSICR, DMT_TSICR_RESET);
while (DMTIMER_READ4(sc, DMT_TIOCP_CFG) & DMT_TIOCP_RESET)
diff --git a/sys/arm/ti/am335x/am335x_dmtreg.h b/sys/arm/ti/am335x/am335x_dmtreg.h
index 8a9d637..f2ef54d 100644
--- a/sys/arm/ti/am335x/am335x_dmtreg.h
+++ b/sys/arm/ti/am335x/am335x_dmtreg.h
@@ -62,7 +62,7 @@
#define DMT_TCLR_TRGMODE_BOTH (2 << 10) /* Trigger on match + ovflow */
#define DMT_TCLR_PWM_PTOGGLE (1 << 12) /* PWM toggles */
#define DMT_TCLR_CAP_MODE_2ND (1 << 13) /* Capture second event mode */
-#define DMT_TCLR_GPO_CFG (1 << 14) /* (no descr in datasheet) */
+#define DMT_TCLR_GPO_CFG (1 << 14) /* Tmr pin conf, 0=out, 1=in */
#define DMT_TCRR 0x3C /* Counter Register */
#define DMT_TLDR 0x40 /* Load Reg */
#define DMT_TTGR 0x44 /* Trigger Reg */
diff --git a/sys/arm/ti/am335x/am335x_lcd.c b/sys/arm/ti/am335x/am335x_lcd.c
index 8121ef5..c23aa24 100644
--- a/sys/arm/ti/am335x/am335x_lcd.c
+++ b/sys/arm/ti/am335x/am335x_lcd.c
@@ -359,13 +359,13 @@ am335x_read_property(device_t dev, phandle_t node, const char *name, uint32_t *v
{
pcell_t cell;
- if ((OF_getprop(node, name, &cell, sizeof(cell))) <= 0) {
+ if ((OF_getencprop(node, name, &cell, sizeof(cell))) <= 0) {
device_printf(dev, "missing '%s' attribute in LCD panel info\n",
name);
return (ENXIO);
}
- *val = fdt32_to_cpu(cell);
+ *val = cell;
return (0);
}
diff --git a/sys/arm/ti/am335x/am335x_lcd_syscons.c b/sys/arm/ti/am335x/am335x_lcd_syscons.c
index 2cbf2fc..e8ab873 100644
--- a/sys/arm/ti/am335x/am335x_lcd_syscons.c
+++ b/sys/arm/ti/am335x/am335x_lcd_syscons.c
@@ -383,13 +383,13 @@ am335x_syscons_configure(int flags)
root = OF_finddevice("/");
if ((root != 0) &&
(display = am335x_syscons_find_panel_node(root))) {
- if ((OF_getprop(display, "panel_width",
- &cell, sizeof(cell))) > 0)
- va_sc->width = (int)fdt32_to_cpu(cell);
+ if ((OF_getencprop(display, "panel_width", &cell,
+ sizeof(cell))) > 0)
+ va_sc->width = cell;
- if ((OF_getprop(display, "panel_height",
- &cell, sizeof(cell))) > 0)
- va_sc->height = (int)fdt32_to_cpu(cell);
+ if ((OF_getencprop(display, "panel_height", &cell,
+ sizeof(cell))) > 0)
+ va_sc->height = cell;
}
if (va_sc->width == 0)
diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c
index 154cd78..2b49789 100644
--- a/sys/arm/ti/ti_adc.c
+++ b/sys/arm/ti/ti_adc.c
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -767,14 +766,17 @@ ti_adc_attach(device_t dev)
/* Read "tsc" node properties */
child = ofw_bus_find_child(node, "tsc");
if (child != 0 && OF_hasprop(child, "ti,wires")) {
- if ((OF_getprop(child, "ti,wires", &cell, sizeof(cell))) > 0)
- sc->sc_tsc_wires = fdt32_to_cpu(cell);
- if ((OF_getprop(child, "ti,coordinate-readouts", &cell, sizeof(cell))) > 0)
- sc->sc_coord_readouts = fdt32_to_cpu(cell);
- if ((OF_getprop(child, "ti,x-plate-resistance", &cell, sizeof(cell))) > 0)
- sc->sc_x_plate_resistance = fdt32_to_cpu(cell);
- if ((OF_getprop(child, "ti,charge-delay", &cell, sizeof(cell))) > 0)
- sc->sc_charge_delay = fdt32_to_cpu(cell);
+ if ((OF_getencprop(child, "ti,wires", &cell, sizeof(cell))) > 0)
+ sc->sc_tsc_wires = cell;
+ if ((OF_getencprop(child, "ti,coordinate-readouts", &cell,
+ sizeof(cell))) > 0)
+ sc->sc_coord_readouts = cell;
+ if ((OF_getencprop(child, "ti,x-plate-resistance", &cell,
+ sizeof(cell))) > 0)
+ sc->sc_x_plate_resistance = cell;
+ if ((OF_getencprop(child, "ti,charge-delay", &cell,
+ sizeof(cell))) > 0)
+ sc->sc_charge_delay = cell;
nwire_configs = OF_getencprop_alloc(child, "ti,wire-config",
sizeof(*wire_configs), (void **)&wire_configs);
if (nwire_configs != sc->sc_tsc_wires) {
diff --git a/sys/arm/ti/ti_common.c b/sys/arm/ti/ti_common.c
index 41c5a72..64a7830 100644
--- a/sys/arm/ti/ti_common.c
+++ b/sys/arm/ti/ti_common.c
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
#ifdef SOC_TI_AM335X
static int
diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c
index f8d5395..907b18b 100644
--- a/sys/arm/ti/ti_machdep.c
+++ b/sys/arm/ti/ti_machdep.c
@@ -40,7 +40,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -96,20 +95,6 @@ ti_am335x_devmap_init(platform_t plat)
}
#endif
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
void
cpu_reset()
{
diff --git a/sys/arm/ti/ti_sdhci.c b/sys/arm/ti/ti_sdhci.c
index a24e693..16fa956 100644
--- a/sys/arm/ti/ti_sdhci.c
+++ b/sys/arm/ti/ti_sdhci.c
@@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -53,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mmc/mmcbrvar.h>
#include <dev/sdhci/sdhci.h>
+#include <dev/sdhci/sdhci_fdt_gpio.h>
#include "sdhci_if.h"
#include <arm/ti/ti_cpuid.h>
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
struct ti_sdhci_softc {
device_t dev;
- device_t gpio_dev;
+ struct sdhci_fdt_gpio * gpio;
struct resource * mem_res;
struct resource * irq_res;
void * intr_cookie;
@@ -71,11 +71,11 @@ struct ti_sdhci_softc {
uint32_t mmchs_reg_off;
uint32_t sdhci_reg_off;
uint32_t baseclk_hz;
- uint32_t wp_gpio_pin;
uint32_t cmd_and_mode;
uint32_t sdhci_clkdiv;
boolean_t disable_highspeed;
boolean_t force_card_present;
+ boolean_t disable_readonly;
};
/*
@@ -363,20 +363,27 @@ static int
ti_sdhci_get_ro(device_t brdev, device_t reqdev)
{
struct ti_sdhci_softc *sc = device_get_softc(brdev);
- unsigned int readonly = 0;
- /* If a gpio pin is configured, read it. */
- if (sc->gpio_dev != NULL) {
- GPIO_PIN_GET(sc->gpio_dev, sc->wp_gpio_pin, &readonly);
- }
+ if (sc->disable_readonly)
+ return (0);
- return (readonly);
+ return (sdhci_fdt_gpio_get_readonly(sc->gpio));
+}
+
+static bool
+ti_sdhci_get_card_present(device_t dev, struct sdhci_slot *slot)
+{
+ struct ti_sdhci_softc *sc = device_get_softc(dev);
+
+ return (sdhci_fdt_gpio_get_present(sc->gpio));
}
static int
ti_sdhci_detach(device_t dev)
{
+ /* sdhci_fdt_gpio_teardown(sc->gpio); */
+
return (EBUSY);
}
@@ -503,25 +510,6 @@ ti_sdhci_attach(device_t dev)
}
/*
- * See if we've got a GPIO-based write detect pin. This is not the
- * standard documented property for this, we added it in freebsd.
- */
- if ((OF_getprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0)
- sc->wp_gpio_pin = 0xffffffff;
- else
- sc->wp_gpio_pin = fdt32_to_cpu(prop);
-
- if (sc->wp_gpio_pin != 0xffffffff) {
- sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
- if (sc->gpio_dev == NULL)
- device_printf(dev, "Error: No GPIO device, "
- "Write Protect pin will not function\n");
- else
- GPIO_PIN_SETFLAGS(sc->gpio_dev, sc->wp_gpio_pin,
- GPIO_PIN_INPUT);
- }
-
- /*
* Set the offset from the device's memory start to the MMCHS registers.
* Also for OMAP4 disable high speed mode due to erratum ID i626.
*/
@@ -573,6 +561,21 @@ ti_sdhci_attach(device_t dev)
goto fail;
}
+ /*
+ * Set up handling of card-detect and write-protect gpio lines.
+ *
+ * If there is no write protect info in the fdt data, fall back to the
+ * historical practice of assuming that the card is writable. This
+ * works around bad fdt data from the upstream source. The alternative
+ * would be to trust the sdhci controller's PRESENT_STATE register WP
+ * bit, but it may say write protect is in effect when it's not if the
+ * pinmux setup doesn't route the WP signal into the sdchi block.
+ */
+ sc->gpio = sdhci_fdt_gpio_setup(sc->dev, &sc->slot);
+
+ if (!OF_hasprop(node, "wp-gpios") && !OF_hasprop(node, "wp-disable"))
+ sc->disable_readonly = true;
+
/* Initialise the MMCHS hardware. */
ti_sdhci_hw_init(dev);
@@ -707,6 +710,7 @@ static device_method_t ti_sdhci_methods[] = {
DEVMETHOD(sdhci_write_2, ti_sdhci_write_2),
DEVMETHOD(sdhci_write_4, ti_sdhci_write_4),
DEVMETHOD(sdhci_write_multi_4, ti_sdhci_write_multi_4),
+ DEVMETHOD(sdhci_get_card_present, ti_sdhci_get_card_present),
DEVMETHOD_END
};
diff --git a/sys/arm/versatile/sp804.c b/sys/arm/versatile/sp804.c
index de05700..894415b 100644
--- a/sys/arm/versatile/sp804.c
+++ b/sys/arm/versatile/sp804.c
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/intr.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -223,8 +222,8 @@ sp804_timer_attach(device_t dev)
sc->sysclk_freq = DEFAULT_FREQUENCY;
/* Get the base clock frequency */
node = ofw_bus_get_node(dev);
- if ((OF_getprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) {
- sc->sysclk_freq = fdt32_to_cpu(clock);
+ if ((OF_getencprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) {
+ sc->sysclk_freq = clock;
}
/* Setup and enable the timer */
diff --git a/sys/arm/versatile/versatile_common.c b/sys/arm/versatile/versatile_common.c
index aca54b7..983b3ce 100644
--- a/sys/arm/versatile/versatile_common.c
+++ b/sys/arm/versatile/versatile_common.c
@@ -46,10 +46,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/vmparam.h>
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
diff --git a/sys/arm/versatile/versatile_machdep.c b/sys/arm/versatile/versatile_machdep.c
index adaff7a..ca0377a 100644
--- a/sys/arm/versatile/versatile_machdep.c
+++ b/sys/arm/versatile/versatile_machdep.c
@@ -39,7 +39,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -102,22 +101,8 @@ platform_devmap_init(void)
return (0);
}
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
void
-cpu_reset()
+cpu_reset(void)
{
printf("cpu_reset\n");
while (1);
diff --git a/sys/arm/xilinx/zy7_machdep.c b/sys/arm/xilinx/zy7_machdep.c
index 4776878..7eb4308 100644
--- a/sys/arm/xilinx/zy7_machdep.c
+++ b/sys/arm/xilinx/zy7_machdep.c
@@ -36,7 +36,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _ARM32_BUS_DMA_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -94,10 +93,6 @@ platform_devmap_init(void)
}
-struct fdt_fixup_entry fdt_fixup_table[] = {
- { NULL, NULL }
-};
-
#ifndef INTRNG
static int
fdt_gic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
@@ -120,22 +115,8 @@ fdt_pic_decode_t fdt_pic_table[] = {
};
#endif
-struct arm32_dma_range *
-bus_dma_get_range(void)
-{
-
- return (NULL);
-}
-
-int
-bus_dma_get_range_nb(void)
-{
-
- return (0);
-}
-
void
-cpu_reset()
+cpu_reset(void)
{
if (zynq7_cpu_reset != NULL)
(*zynq7_cpu_reset)();
diff --git a/sys/arm/xilinx/zy7_slcr.c b/sys/arm/xilinx/zy7_slcr.c
index c99d5b0..c630fe6 100644
--- a/sys/arm/xilinx/zy7_slcr.c
+++ b/sys/arm/xilinx/zy7_slcr.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/stdarg.h>
-#include <dev/fdt/fdt_common.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -497,7 +496,7 @@ zy7_pl_fclk_enabled(int unit)
}
int
-zy7_pl_level_shifters_enabled()
+zy7_pl_level_shifters_enabled(void)
{
struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
@@ -514,7 +513,7 @@ zy7_pl_level_shifters_enabled()
}
void
-zy7_pl_level_shifters_enable()
+zy7_pl_level_shifters_enable(void)
{
struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
@@ -529,7 +528,7 @@ zy7_pl_level_shifters_enable()
}
void
-zy7_pl_level_shifters_disable()
+zy7_pl_level_shifters_disable(void)
{
struct zy7_slcr_softc *sc = zy7_slcr_softc_p;
@@ -621,8 +620,8 @@ zy7_slcr_attach(device_t dev)
/* Derive PLL frequencies from PS_CLK. */
node = ofw_bus_get_node(dev);
- if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0)
- ps_clk_frequency = fdt32_to_cpu(cell);
+ if (OF_getencprop(node, "clock-frequency", &cell, sizeof(cell)) > 0)
+ ps_clk_frequency = cell;
else
ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY;
diff --git a/sys/arm/xscale/pxa/pxa_gpio.c b/sys/arm/xscale/pxa/pxa_gpio.c
index ecc220a..a3ad33d 100644
--- a/sys/arm/xscale/pxa/pxa_gpio.c
+++ b/sys/arm/xscale/pxa/pxa_gpio.c
@@ -331,7 +331,7 @@ pxa_gpio_unmask_irq(int irq)
}
int
-pxa_gpio_get_next_irq()
+pxa_gpio_get_next_irq(void)
{
struct pxa_gpio_softc *sc;
int gpio;
diff --git a/sys/arm/xscale/pxa/pxa_icu.c b/sys/arm/xscale/pxa/pxa_icu.c
index 4194da3..c375ccb 100644
--- a/sys/arm/xscale/pxa/pxa_icu.c
+++ b/sys/arm/xscale/pxa/pxa_icu.c
@@ -171,7 +171,7 @@ arm_unmask_irq(uintptr_t nb)
}
uint32_t
-pxa_icu_get_icip()
+pxa_icu_get_icip(void)
{
return (bus_space_read_4(pxa_icu_softc->pi_bst,
@@ -187,7 +187,7 @@ pxa_icu_clear_icip(int irq)
}
uint32_t
-pxa_icu_get_icfp()
+pxa_icu_get_icfp(void)
{
return (bus_space_read_4(pxa_icu_softc->pi_bst,
@@ -203,7 +203,7 @@ pxa_icu_clear_icfp(int irq)
}
uint32_t
-pxa_icu_get_icmr()
+pxa_icu_get_icmr(void)
{
return (bus_space_read_4(pxa_icu_softc->pi_bst,
@@ -219,7 +219,7 @@ pxa_icu_set_icmr(uint32_t val)
}
uint32_t
-pxa_icu_get_iclr()
+pxa_icu_get_iclr(void)
{
return (bus_space_read_4(pxa_icu_softc->pi_bst,
@@ -235,7 +235,7 @@ pxa_icu_set_iclr(uint32_t val)
}
uint32_t
-pxa_icu_get_icpr()
+pxa_icu_get_icpr(void)
{
return (bus_space_read_4(pxa_icu_softc->pi_bst,
@@ -243,7 +243,7 @@ pxa_icu_get_icpr()
}
void
-pxa_icu_idle_enable()
+pxa_icu_idle_enable(void)
{
bus_space_write_4(pxa_icu_softc->pi_bst,
@@ -251,7 +251,7 @@ pxa_icu_idle_enable()
}
void
-pxa_icu_idle_disable()
+pxa_icu_idle_disable(void)
{
bus_space_write_4(pxa_icu_softc->pi_bst,
diff --git a/sys/arm/xscale/pxa/pxa_space.c b/sys/arm/xscale/pxa/pxa_space.c
index 35b6cd9..2378efe 100644
--- a/sys/arm/xscale/pxa/pxa_space.c
+++ b/sys/arm/xscale/pxa/pxa_space.c
@@ -176,7 +176,7 @@ bus_space_tag_t base_tag = &_base_tag;
bus_space_tag_t obio_tag = NULL;
void
-pxa_obio_tag_init()
+pxa_obio_tag_init(void)
{
bcopy(&_base_tag, &_obio_tag, sizeof(struct bus_space));
diff --git a/sys/arm/xscale/pxa/pxa_timer.c b/sys/arm/xscale/pxa/pxa_timer.c
index d62c1e1..e13793d 100644
--- a/sys/arm/xscale/pxa/pxa_timer.c
+++ b/sys/arm/xscale/pxa/pxa_timer.c
@@ -235,7 +235,7 @@ pxa_timer_set_osmr(int which, uint32_t val)
}
uint32_t
-pxa_timer_get_oscr()
+pxa_timer_get_oscr(void)
{
return (bus_space_read_4(timer_softc->pt_bst,
@@ -251,7 +251,7 @@ pxa_timer_set_oscr(uint32_t val)
}
uint32_t
-pxa_timer_get_ossr()
+pxa_timer_get_ossr(void)
{
return (bus_space_read_4(timer_softc->pt_bst,
@@ -267,7 +267,7 @@ pxa_timer_clear_ossr(uint32_t val)
}
void
-pxa_timer_watchdog_enable()
+pxa_timer_watchdog_enable(void)
{
bus_space_write_4(timer_softc->pt_bst,
@@ -275,7 +275,7 @@ pxa_timer_watchdog_enable()
}
void
-pxa_timer_watchdog_disable()
+pxa_timer_watchdog_disable(void)
{
bus_space_write_4(timer_softc->pt_bst,
diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile
index 4bf4068..47d8cf0 100644
--- a/sys/boot/arm/uboot/Makefile
+++ b/sys/boot/arm/uboot/Makefile
@@ -80,7 +80,8 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
.if ${MK_FORTH} != "no"
# Enable BootForth
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/arm
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
diff --git a/sys/boot/fdt/dts/arm/rpi.dts b/sys/boot/fdt/dts/arm/rpi.dts
index 23e1266..b3eef3a 100644
--- a/sys/boot/fdt/dts/arm/rpi.dts
+++ b/sys/boot/fdt/dts/arm/rpi.dts
@@ -298,7 +298,7 @@
reg = <0x00000001>;
#address-cells = <1>;
#size-cells = <0>;
- ethernet {
+ ethernet: ethernet {
compatible = "net,ethernet",
"usb,device";
reg = <0x00000001>;
@@ -386,6 +386,7 @@
aliases {
uart0 = &uart0;
+ ethernet0 = &ethernet;
};
chosen {
diff --git a/sys/boot/fdt/dts/arm/rpi2.dts b/sys/boot/fdt/dts/arm/rpi2.dts
index 838800f..d127217 100644
--- a/sys/boot/fdt/dts/arm/rpi2.dts
+++ b/sys/boot/fdt/dts/arm/rpi2.dts
@@ -315,7 +315,7 @@
reg = <0x00000001>;
#address-cells = <1>;
#size-cells = <0>;
- ethernet {
+ ethernet: ethernet {
compatible = "net,ethernet",
"usb,device";
reg = <0x00000001>;
@@ -397,6 +397,7 @@
aliases {
uart0 = &uart0;
+ ethernet0 = &ethernet;
};
chosen {
diff --git a/sys/boot/powerpc/kboot/Makefile b/sys/boot/powerpc/kboot/Makefile
index ca46398..6a1741b 100644
--- a/sys/boot/powerpc/kboot/Makefile
+++ b/sys/boot/powerpc/kboot/Makefile
@@ -64,7 +64,8 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
.if ${MK_FORTH} != "no"
# Enable BootForth
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/powerpc
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile
index 5ce47cf..1d135f0 100644
--- a/sys/boot/powerpc/ofw/Makefile
+++ b/sys/boot/powerpc/ofw/Makefile
@@ -63,7 +63,8 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
.if ${MK_FORTH} != "no"
# Enable BootForth
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/powerpc
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile
index b2f2ef6..b54cebe 100644
--- a/sys/boot/powerpc/ps3/Makefile
+++ b/sys/boot/powerpc/ps3/Makefile
@@ -64,7 +64,8 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
.if ${MK_FORTH} != "no"
# Enable BootForth
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/powerpc
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
diff --git a/sys/boot/powerpc/uboot/Makefile b/sys/boot/powerpc/uboot/Makefile
index 6ff3acf..b18d8eb 100644
--- a/sys/boot/powerpc/uboot/Makefile
+++ b/sys/boot/powerpc/uboot/Makefile
@@ -69,7 +69,8 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
.if ${MK_FORTH} != "no"
# Enable BootForth
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/powerpc
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile
index 043dbfb..a6a5d16 100644
--- a/sys/boot/userboot/userboot/Makefile
+++ b/sys/boot/userboot/userboot/Makefile
@@ -41,7 +41,8 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH}
.if ${MK_FORTH} != "no"
BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl
+CFLAGS+= -I${.CURDIR}/../../ficl/i386
CFLAGS+= -DBF_DICTSIZE=15000
LIBFICL= ${.OBJDIR}/../ficl/libficl.a
.endif
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index e5ca93a..d1219de 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -478,15 +478,15 @@ static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc,
struct ctl_scsiio *ctsio);
static int ctl_scsiio(struct ctl_scsiio *ctsio);
-static int ctl_bus_reset(struct ctl_softc *ctl_softc, union ctl_io *io);
-static int ctl_target_reset(struct ctl_softc *ctl_softc, union ctl_io *io,
- ctl_ua_type ua_type);
-static int ctl_do_lun_reset(struct ctl_lun *lun, union ctl_io *io,
+static int ctl_target_reset(union ctl_io *io);
+static void ctl_do_lun_reset(struct ctl_lun *lun, uint32_t initidx,
ctl_ua_type ua_type);
-static int ctl_lun_reset(struct ctl_softc *ctl_softc, union ctl_io *io);
+static int ctl_lun_reset(union ctl_io *io);
static int ctl_abort_task(union ctl_io *io);
static int ctl_abort_task_set(union ctl_io *io);
static int ctl_query_task(union ctl_io *io, int task_set);
+static void ctl_i_t_nexus_loss(struct ctl_softc *softc, uint32_t initidx,
+ ctl_ua_type ua_type);
static int ctl_i_t_nexus_reset(union ctl_io *io);
static int ctl_query_async_event(union ctl_io *io);
static void ctl_run_task(union ctl_io *io);
@@ -1288,6 +1288,9 @@ ctl_isc_iid_sync(struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
return;
}
iid = msg->hdr.nexus.initid;
+ if (port->wwpn_iid[iid].in_use != 0 &&
+ msg->iid.in_use == 0)
+ ctl_i_t_nexus_loss(softc, iid, CTL_UA_POWERON);
port->wwpn_iid[iid].in_use = msg->iid.in_use;
port->wwpn_iid[iid].wwpn = msg->iid.wwpn;
free(port->wwpn_iid[iid].name, M_CTL);
@@ -2027,6 +2030,7 @@ int
ctl_remove_initiator(struct ctl_port *port, int iid)
{
struct ctl_softc *softc = port->ctl_softc;
+ int last;
mtx_assert(&softc->ctl_lock, MA_NOTOWNED);
@@ -2037,9 +2041,11 @@ ctl_remove_initiator(struct ctl_port *port, int iid)
}
mtx_lock(&softc->ctl_lock);
- port->wwpn_iid[iid].in_use--;
+ last = (--port->wwpn_iid[iid].in_use == 0);
port->wwpn_iid[iid].last_use = time_uptime;
mtx_unlock(&softc->ctl_lock);
+ if (last)
+ ctl_i_t_nexus_loss(softc, iid, CTL_UA_POWERON);
ctl_isc_announce_iid(port, iid);
return (0);
@@ -2144,11 +2150,6 @@ ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name)
__func__, port->targ_port, iid, wwpn, name,
(uintmax_t)port->wwpn_iid[iid].wwpn,
port->wwpn_iid[iid].name);
-
- /*
- * XXX KDM clear have_ca and ua_pending on each LUN for
- * this initiator.
- */
}
take:
free(port->wwpn_iid[iid].name, M_CTL);
@@ -9145,7 +9146,7 @@ ctl_request_sense(struct ctl_scsiio *ctsio)
struct ctl_softc *softc = CTL_SOFTC(ctsio);
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_request_sense *cdb;
- struct scsi_sense_data *sense_ptr;
+ struct scsi_sense_data *sense_ptr, *ps;
uint32_t initidx;
int have_error;
u_int sense_len = SSD_FULL_SIZE;
@@ -9201,15 +9202,17 @@ ctl_request_sense(struct ctl_scsiio *ctsio)
* Pending sense gets returned first, then pending unit attentions.
*/
mtx_lock(&lun->lun_lock);
-#ifdef CTL_WITH_CA
- if (ctl_is_set(lun->have_ca, initidx)) {
+ ps = lun->pending_sense[initidx / CTL_MAX_INIT_PER_PORT];
+ if (ps != NULL)
+ ps += initidx % CTL_MAX_INIT_PER_PORT;
+ if (ps != NULL && ps->error_code != 0) {
scsi_sense_data_type stored_format;
/*
* Check to see which sense format was used for the stored
* sense data.
*/
- stored_format = scsi_sense_type(&lun->pending_sense[initidx]);
+ stored_format = scsi_sense_type(ps);
/*
* If the user requested a different sense format than the
@@ -9224,23 +9227,17 @@ ctl_request_sense(struct ctl_scsiio *ctsio)
if ((stored_format == SSD_TYPE_FIXED)
&& (sense_format == SSD_TYPE_DESC))
ctl_sense_to_desc((struct scsi_sense_data_fixed *)
- &lun->pending_sense[initidx],
- (struct scsi_sense_data_desc *)sense_ptr);
+ ps, (struct scsi_sense_data_desc *)sense_ptr);
else if ((stored_format == SSD_TYPE_DESC)
&& (sense_format == SSD_TYPE_FIXED))
ctl_sense_to_fixed((struct scsi_sense_data_desc *)
- &lun->pending_sense[initidx],
- (struct scsi_sense_data_fixed *)sense_ptr);
+ ps, (struct scsi_sense_data_fixed *)sense_ptr);
else
- memcpy(sense_ptr, &lun->pending_sense[initidx],
- MIN(sizeof(*sense_ptr),
- sizeof(lun->pending_sense[initidx])));
+ memcpy(sense_ptr, ps, sizeof(*sense_ptr));
- ctl_clear_mask(lun->have_ca, initidx);
+ ps->error_code = 0;
have_error = 1;
- } else
-#endif
- if (have_error == 0) {
+ } else {
ua_type = ctl_build_ua(lun, initidx, sense_ptr, &sense_len,
sense_format);
if (ua_type != CTL_UA_NONE)
@@ -9553,6 +9550,8 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len)
if (port && port->port_type == CTL_PORT_FC)
proto = SCSI_PROTO_FC << 4;
+ else if (port && port->port_type == CTL_PORT_SAS)
+ proto = SCSI_PROTO_SAS << 4;
else if (port && port->port_type == CTL_PORT_ISCSI)
proto = SCSI_PROTO_ISCSI << 4;
else
@@ -11357,17 +11356,19 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio)
initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
-#ifdef CTL_WITH_CA
/*
* If we've got a request sense, it'll clear the contingent
* allegiance condition. Otherwise, if we have a CA condition for
* this initiator, clear it, because it sent down a command other
* than request sense.
*/
- if ((ctsio->cdb[0] != REQUEST_SENSE)
- && (ctl_is_set(lun->have_ca, initidx)))
- ctl_clear_mask(lun->have_ca, initidx);
-#endif
+ if (ctsio->cdb[0] != REQUEST_SENSE) {
+ struct scsi_sense_data *ps;
+
+ ps = lun->pending_sense[initidx / CTL_MAX_INIT_PER_PORT];
+ if (ps != NULL)
+ ps[initidx % CTL_MAX_INIT_PER_PORT].error_code = 0;
+ }
/*
* If the command has this flag set, it handles its own unit
@@ -11600,50 +11601,42 @@ bailout:
return (retval);
}
-/*
- * Since we only implement one target right now, a bus reset simply resets
- * our single target.
- */
static int
-ctl_bus_reset(struct ctl_softc *softc, union ctl_io *io)
-{
- return(ctl_target_reset(softc, io, CTL_UA_BUS_RESET));
-}
-
-static int
-ctl_target_reset(struct ctl_softc *softc, union ctl_io *io,
- ctl_ua_type ua_type)
+ctl_target_reset(union ctl_io *io)
{
+ struct ctl_softc *softc = CTL_SOFTC(io);
struct ctl_port *port = CTL_PORT(io);
struct ctl_lun *lun;
- int retval;
+ uint32_t initidx;
+ ctl_ua_type ua_type;
if (!(io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC)) {
union ctl_ha_msg msg_info;
msg_info.hdr.nexus = io->io_hdr.nexus;
- if (ua_type==CTL_UA_TARG_RESET)
- msg_info.task.task_action = CTL_TASK_TARGET_RESET;
- else
- msg_info.task.task_action = CTL_TASK_BUS_RESET;
+ msg_info.task.task_action = io->taskio.task_action;
msg_info.hdr.msg_type = CTL_MSG_MANAGE_TASKS;
msg_info.hdr.original_sc = NULL;
msg_info.hdr.serializing_sc = NULL;
ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info,
sizeof(msg_info.task), M_WAITOK);
}
- retval = 0;
+ initidx = ctl_get_initindex(&io->io_hdr.nexus);
+ if (io->taskio.task_action == CTL_TASK_TARGET_RESET)
+ ua_type = CTL_UA_TARG_RESET;
+ else
+ ua_type = CTL_UA_BUS_RESET;
mtx_lock(&softc->ctl_lock);
STAILQ_FOREACH(lun, &softc->lun_list, links) {
if (port != NULL &&
ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX)
continue;
- retval += ctl_do_lun_reset(lun, io, ua_type);
+ ctl_do_lun_reset(lun, initidx, ua_type);
}
mtx_unlock(&softc->ctl_lock);
io->taskio.task_status = CTL_TASK_FUNCTION_COMPLETE;
- return (retval);
+ return (0);
}
/*
@@ -11667,66 +11660,51 @@ ctl_target_reset(struct ctl_softc *softc, union ctl_io *io,
*
* XXX KDM for now, we're setting unit attention for all initiators.
*/
-static int
-ctl_do_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type)
+static void
+ctl_do_lun_reset(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua_type)
{
union ctl_io *xio;
-#if 0
- uint32_t initidx;
-#endif
int i;
mtx_lock(&lun->lun_lock);
- /*
- * Run through the OOA queue and abort each I/O.
- */
+ /* Abort tasks. */
for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL;
xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) {
xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS;
}
-
- /*
- * This version sets unit attention for every
- */
-#if 0
- initidx = ctl_get_initindex(&io->io_hdr.nexus);
- ctl_est_ua_all(lun, initidx, ua_type);
-#else
- ctl_est_ua_all(lun, -1, ua_type);
-#endif
-
- /*
- * A reset (any kind, really) clears reservations established with
- * RESERVE/RELEASE. It does not clear reservations established
- * with PERSISTENT RESERVE OUT, but we don't support that at the
- * moment anyway. See SPC-2, section 5.6. SPC-3 doesn't address
- * reservations made with the RESERVE/RELEASE commands, because
- * those commands are obsolete in SPC-3.
- */
+ /* Clear CA. */
+ for (i = 0; i < CTL_MAX_PORTS; i++) {
+ free(lun->pending_sense[i], M_CTL);
+ lun->pending_sense[i] = NULL;
+ }
+ /* Clear reservation. */
lun->flags &= ~CTL_LUN_RESERVED;
-
-#ifdef CTL_WITH_CA
- for (i = 0; i < CTL_MAX_INITIATORS; i++)
- ctl_clear_mask(lun->have_ca, i);
-#endif
- lun->prevent_count = 0;
+ /* Clear prevent media removal. */
if (lun->prevent) {
for (i = 0; i < CTL_MAX_INITIATORS; i++)
ctl_clear_mask(lun->prevent, i);
+ lun->prevent_count = 0;
}
+ /* Clear TPC status */
+ ctl_tpc_lun_clear(lun, -1);
+ /* Establish UA. */
+#if 0
+ ctl_est_ua_all(lun, initidx, ua_type);
+#else
+ ctl_est_ua_all(lun, -1, ua_type);
+#endif
mtx_unlock(&lun->lun_lock);
-
- return (0);
}
static int
-ctl_lun_reset(struct ctl_softc *softc, union ctl_io *io)
+ctl_lun_reset(union ctl_io *io)
{
+ struct ctl_softc *softc = CTL_SOFTC(io);
struct ctl_lun *lun;
- uint32_t targ_lun;
- int retval;
+ uint32_t targ_lun, initidx;
targ_lun = io->io_hdr.nexus.targ_mapped_lun;
+ initidx = ctl_get_initindex(&io->io_hdr.nexus);
mtx_lock(&softc->ctl_lock);
if (targ_lun >= CTL_MAX_LUNS ||
(lun = softc->ctl_luns[targ_lun]) == NULL) {
@@ -11734,7 +11712,7 @@ ctl_lun_reset(struct ctl_softc *softc, union ctl_io *io)
io->taskio.task_status = CTL_TASK_LUN_DOES_NOT_EXIST;
return (1);
}
- retval = ctl_do_lun_reset(lun, io, CTL_UA_LUN_RESET);
+ ctl_do_lun_reset(lun, initidx, CTL_UA_LUN_RESET);
mtx_unlock(&softc->ctl_lock);
io->taskio.task_status = CTL_TASK_FUNCTION_COMPLETE;
@@ -11749,7 +11727,7 @@ ctl_lun_reset(struct ctl_softc *softc, union ctl_io *io)
ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg_info,
sizeof(msg_info.task), M_WAITOK);
}
- return (retval);
+ return (0);
}
static void
@@ -11829,11 +11807,46 @@ ctl_abort_task_set(union ctl_io *io)
return (0);
}
+static void
+ctl_i_t_nexus_loss(struct ctl_softc *softc, uint32_t initidx,
+ ctl_ua_type ua_type)
+{
+ struct ctl_lun *lun;
+ struct scsi_sense_data *ps;
+ uint32_t p, i;
+
+ p = initidx / CTL_MAX_INIT_PER_PORT;
+ i = initidx % CTL_MAX_INIT_PER_PORT;
+ mtx_lock(&softc->ctl_lock);
+ STAILQ_FOREACH(lun, &softc->lun_list, links) {
+ mtx_lock(&lun->lun_lock);
+ /* Abort tasks. */
+ ctl_abort_tasks_lun(lun, p, i, 1);
+ /* Clear CA. */
+ ps = lun->pending_sense[p];
+ if (ps != NULL)
+ ps[i].error_code = 0;
+ /* Clear reservation. */
+ if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx))
+ lun->flags &= ~CTL_LUN_RESERVED;
+ /* Clear prevent media removal. */
+ if (lun->prevent && ctl_is_set(lun->prevent, initidx)) {
+ ctl_clear_mask(lun->prevent, initidx);
+ lun->prevent_count--;
+ }
+ /* Clear TPC status */
+ ctl_tpc_lun_clear(lun, initidx);
+ /* Establish UA. */
+ ctl_est_ua(lun, initidx, ua_type);
+ mtx_unlock(&lun->lun_lock);
+ }
+ mtx_unlock(&softc->ctl_lock);
+}
+
static int
ctl_i_t_nexus_reset(union ctl_io *io)
{
struct ctl_softc *softc = CTL_SOFTC(io);
- struct ctl_lun *lun;
uint32_t initidx;
if (!(io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC)) {
@@ -11849,24 +11862,7 @@ ctl_i_t_nexus_reset(union ctl_io *io)
}
initidx = ctl_get_initindex(&io->io_hdr.nexus);
- mtx_lock(&softc->ctl_lock);
- STAILQ_FOREACH(lun, &softc->lun_list, links) {
- mtx_lock(&lun->lun_lock);
- ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port,
- io->io_hdr.nexus.initid, 1);
-#ifdef CTL_WITH_CA
- ctl_clear_mask(lun->have_ca, initidx);
-#endif
- if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx))
- lun->flags &= ~CTL_LUN_RESERVED;
- if (lun->prevent && ctl_is_set(lun->prevent, initidx)) {
- ctl_clear_mask(lun->prevent, initidx);
- lun->prevent_count--;
- }
- ctl_est_ua(lun, initidx, CTL_UA_I_T_NEXUS_LOSS);
- mtx_unlock(&lun->lun_lock);
- }
- mtx_unlock(&softc->ctl_lock);
+ ctl_i_t_nexus_loss(softc, initidx, CTL_UA_I_T_NEXUS_LOSS);
io->taskio.task_status = CTL_TASK_FUNCTION_COMPLETE;
return (0);
}
@@ -12075,7 +12071,6 @@ ctl_query_async_event(union ctl_io *io)
static void
ctl_run_task(union ctl_io *io)
{
- struct ctl_softc *softc = CTL_SOFTC(io);
int retval = 1;
CTL_DEBUG_PRINT(("ctl_run_task\n"));
@@ -12097,13 +12092,11 @@ ctl_run_task(union ctl_io *io)
retval = ctl_i_t_nexus_reset(io);
break;
case CTL_TASK_LUN_RESET:
- retval = ctl_lun_reset(softc, io);
+ retval = ctl_lun_reset(io);
break;
case CTL_TASK_TARGET_RESET:
- retval = ctl_target_reset(softc, io, CTL_UA_TARG_RESET);
- break;
case CTL_TASK_BUS_RESET:
- retval = ctl_bus_reset(softc, io);
+ retval = ctl_target_reset(io);
break;
case CTL_TASK_PORT_LOGIN:
break;
@@ -13114,7 +13107,6 @@ bailout:
fe_done(io);
}
-#ifdef CTL_WITH_CA
/*
* Front end should call this if it doesn't do autosense. When the request
* sense comes back in from the initiator, we'll dequeue this and send it.
@@ -13125,7 +13117,8 @@ ctl_queue_sense(union ctl_io *io)
struct ctl_softc *softc = CTL_SOFTC(io);
struct ctl_port *port = CTL_PORT(io);
struct ctl_lun *lun;
- uint32_t initidx, targ_lun;
+ struct scsi_sense_data *ps;
+ uint32_t initidx, p, targ_lun;
CTL_DEBUG_PRINT(("ctl_queue_sense\n"));
@@ -13148,26 +13141,23 @@ ctl_queue_sense(union ctl_io *io)
mtx_lock(&lun->lun_lock);
mtx_unlock(&softc->ctl_lock);
- /*
- * Already have CA set for this LUN...toss the sense information.
- */
initidx = ctl_get_initindex(&io->io_hdr.nexus);
- if (ctl_is_set(lun->have_ca, initidx)) {
- mtx_unlock(&lun->lun_lock);
- goto bailout;
+ p = initidx / CTL_MAX_INIT_PER_PORT;
+ if (lun->pending_sense[p] == NULL) {
+ lun->pending_sense[p] = malloc(sizeof(*ps) * CTL_MAX_INIT_PER_PORT,
+ M_CTL, M_NOWAIT | M_ZERO);
+ }
+ if ((ps = lun->pending_sense[p]) != NULL) {
+ ps += initidx % CTL_MAX_INIT_PER_PORT;
+ memset(ps, 0, sizeof(*ps));
+ memcpy(ps, &io->scsiio.sense_data, io->scsiio.sense_len);
}
-
- memcpy(&lun->pending_sense[initidx], &io->scsiio.sense_data,
- MIN(sizeof(lun->pending_sense[initidx]),
- sizeof(io->scsiio.sense_data)));
- ctl_set_mask(lun->have_ca, initidx);
mtx_unlock(&lun->lun_lock);
bailout:
ctl_free_io(io);
return (CTL_RETVAL_COMPLETE);
}
-#endif
/*
* Primary command inlet from frontend ports. All SCSI and task I/O
diff --git a/sys/cam/ctl/ctl_error.c b/sys/cam/ctl/ctl_error.c
index 9c222fa..42331ea 100644
--- a/sys/cam/ctl/ctl_error.c
+++ b/sys/cam/ctl/ctl_error.c
@@ -920,10 +920,7 @@ ctl_set_data_phase_error(struct ctl_scsiio *ctsio)
void
ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
{
- struct scsi_sense_data *sense;
- sense = &ctsio->sense_data;
- memset(sense, 0, sizeof(*sense));
ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT;
ctsio->sense_len = 0;
ctsio->io_hdr.status = CTL_SCSI_ERROR;
@@ -932,10 +929,7 @@ ctl_set_reservation_conflict(struct ctl_scsiio *ctsio)
void
ctl_set_queue_full(struct ctl_scsiio *ctsio)
{
- struct scsi_sense_data *sense;
- sense = &ctsio->sense_data;
- memset(sense, 0, sizeof(*sense));
ctsio->scsi_status = SCSI_STATUS_QUEUE_FULL;
ctsio->sense_len = 0;
ctsio->io_hdr.status = CTL_SCSI_ERROR;
@@ -944,10 +938,7 @@ ctl_set_queue_full(struct ctl_scsiio *ctsio)
void
ctl_set_busy(struct ctl_scsiio *ctsio)
{
- struct scsi_sense_data *sense;
- sense = &ctsio->sense_data;
- memset(sense, 0, sizeof(*sense));
ctsio->scsi_status = SCSI_STATUS_BUSY;
ctsio->sense_len = 0;
ctsio->io_hdr.status = CTL_SCSI_ERROR;
@@ -956,10 +947,7 @@ ctl_set_busy(struct ctl_scsiio *ctsio)
void
ctl_set_task_aborted(struct ctl_scsiio *ctsio)
{
- struct scsi_sense_data *sense;
- sense = &ctsio->sense_data;
- memset(sense, 0, sizeof(*sense));
ctsio->scsi_status = SCSI_STATUS_TASK_ABORTED;
ctsio->sense_len = 0;
ctsio->io_hdr.status = CTL_CMD_ABORTED;
@@ -992,10 +980,7 @@ ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio)
void
ctl_set_success(struct ctl_scsiio *ctsio)
{
- struct scsi_sense_data *sense;
- sense = &ctsio->sense_data;
- memset(sense, 0, sizeof(*sense));
ctsio->scsi_status = SCSI_STATUS_OK;
ctsio->sense_len = 0;
ctsio->io_hdr.status = CTL_SUCCESS;
diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c
index 765a31d..2c431b0 100644
--- a/sys/cam/ctl/ctl_frontend.c
+++ b/sys/cam/ctl/ctl_frontend.c
@@ -264,6 +264,8 @@ ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn,
if (port->port_type == CTL_PORT_FC)
proto = SCSI_PROTO_FC << 4;
+ else if (port->port_type == CTL_PORT_SAS)
+ proto = SCSI_PROTO_SAS << 4;
else if (port->port_type == CTL_PORT_ISCSI)
proto = SCSI_PROTO_ISCSI << 4;
else
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 72580e9..bd85576 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -95,10 +95,9 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, ping_timeout, CTLFLAG_RWTUN,
static int login_timeout = 60;
SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN,
&login_timeout, 60, "Time to wait for ctld(8) to finish Login Phase, in seconds");
-static int maxcmdsn_delta = 256;
-SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN,
- &maxcmdsn_delta, 256, "Number of commands the initiator can send "
- "without confirmation");
+static int maxtags = 256;
+SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxtags, CTLFLAG_RWTUN,
+ &maxtags, 0, "Max number of requests queued by initiator");
#define CFISCSI_DEBUG(X, ...) \
do { \
@@ -244,7 +243,7 @@ cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request)
* outside of this range.
*/
if (ISCSI_SNLT(cmdsn, cs->cs_cmdsn) ||
- ISCSI_SNGT(cmdsn, cs->cs_cmdsn + maxcmdsn_delta)) {
+ ISCSI_SNGT(cmdsn, cs->cs_cmdsn - 1 + maxtags)) {
CFISCSI_SESSION_UNLOCK(cs);
CFISCSI_SESSION_WARN(cs, "received PDU with CmdSN %u, "
"while expected %u", cmdsn, cs->cs_cmdsn);
@@ -399,7 +398,8 @@ cfiscsi_pdu_prepare(struct icl_pdu *response)
(bhssr->bhssr_flags & BHSDI_FLAGS_S))
bhssr->bhssr_statsn = htonl(cs->cs_statsn);
bhssr->bhssr_expcmdsn = htonl(cs->cs_cmdsn);
- bhssr->bhssr_maxcmdsn = htonl(cs->cs_cmdsn + maxcmdsn_delta);
+ bhssr->bhssr_maxcmdsn = htonl(cs->cs_cmdsn - 1 +
+ imax(0, maxtags - cs->cs_outstanding_ctl_pdus));
if (advance_statsn)
cs->cs_statsn++;
diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h
index 40f0e61..7cb9e59 100644
--- a/sys/cam/ctl/ctl_private.h
+++ b/sys/cam/ctl/ctl_private.h
@@ -390,10 +390,7 @@ struct ctl_lun {
TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue;
TAILQ_HEAD(ctl_blockq,ctl_io_hdr) blocked_queue;
STAILQ_ENTRY(ctl_lun) links;
-#ifdef CTL_WITH_CA
- uint32_t have_ca[CTL_MAX_INITIATORS >> 5];
- struct scsi_sense_data pending_sense[CTL_MAX_INITIATORS];
-#endif
+ struct scsi_sense_data *pending_sense[CTL_MAX_PORTS];
ctl_ua_type *pending_ua[CTL_MAX_PORTS];
uint8_t ua_tpt_info[8];
time_t lasttpt;
@@ -531,6 +528,7 @@ int ctl_get_lba_status(struct ctl_scsiio *ctsio);
void ctl_tpc_init(struct ctl_softc *softc);
void ctl_tpc_shutdown(struct ctl_softc *softc);
void ctl_tpc_lun_init(struct ctl_lun *lun);
+void ctl_tpc_lun_clear(struct ctl_lun *lun, uint32_t initidx);
void ctl_tpc_lun_shutdown(struct ctl_lun *lun);
int ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len);
int ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio);
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index c8d60ca..36b99a0 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -85,6 +85,7 @@ struct tpc_io {
uint8_t target;
uint32_t cscd;
uint64_t lun;
+ uint8_t *buf;
struct tpc_list *list;
struct runl run;
TAILQ_ENTRY(tpc_io) rlinks;
@@ -127,7 +128,6 @@ struct tpc_list {
off_t curbytes;
int curops;
int stage;
- uint8_t *buf;
off_t segsectors;
off_t segbytes;
int tbdio;
@@ -222,6 +222,21 @@ ctl_tpc_lun_init(struct ctl_lun *lun)
}
void
+ctl_tpc_lun_clear(struct ctl_lun *lun, uint32_t initidx)
+{
+ struct tpc_list *list, *tlist;
+
+ TAILQ_FOREACH_SAFE(list, &lun->tpc_lists, links, tlist) {
+ if (initidx != -1 && list->init_idx != initidx)
+ continue;
+ if (!list->completed)
+ continue;
+ TAILQ_REMOVE(&lun->tpc_lists, list, links);
+ free(list, M_CTL);
+ }
+}
+
+void
ctl_tpc_lun_shutdown(struct ctl_lun *lun)
{
struct ctl_softc *softc = lun->ctl_softc;
@@ -813,9 +828,9 @@ tpc_process_b2b(struct tpc_list *list)
while ((tior = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tior, links);
ctl_free_io(tior->io);
+ free(tior->buf, M_CTL);
free(tior, M_CTL);
}
- free(list->buf, M_CTL);
if (list->abort) {
ctl_set_task_aborted(list->ctsio);
return (CTL_RETVAL_ERROR);
@@ -874,7 +889,6 @@ tpc_process_b2b(struct tpc_list *list)
return (CTL_RETVAL_ERROR);
}
- list->buf = malloc(numbytes, M_CTL, M_WAITOK);
list->segbytes = numbytes;
list->segsectors = numbytes / dstblock;
donebytes = 0;
@@ -894,11 +908,12 @@ tpc_process_b2b(struct tpc_list *list)
tior = malloc(sizeof(*tior), M_CTL, M_WAITOK | M_ZERO);
TAILQ_INIT(&tior->run);
+ tior->buf = malloc(roundbytes, M_CTL, M_WAITOK);
tior->list = list;
TAILQ_INSERT_TAIL(&list->allio, tior, links);
tior->io = tpcl_alloc_io();
ctl_scsi_read_write(tior->io,
- /*data_ptr*/ &list->buf[donebytes],
+ /*data_ptr*/ tior->buf,
/*data_len*/ roundbytes,
/*read_op*/ 1,
/*byte2*/ 0,
@@ -919,7 +934,7 @@ tpc_process_b2b(struct tpc_list *list)
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
ctl_scsi_read_write(tiow->io,
- /*data_ptr*/ &list->buf[donebytes],
+ /*data_ptr*/ tior->buf,
/*data_len*/ roundbytes,
/*read_op*/ 0,
/*byte2*/ 0,
@@ -1029,9 +1044,9 @@ tpc_process_register_key(struct tpc_list *list)
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
ctl_free_io(tio->io);
+ free(tio->buf, M_CTL);
free(tio, M_CTL);
}
- free(list->buf, M_CTL);
if (list->abort) {
ctl_set_task_aborted(list->ctsio);
return (CTL_RETVAL_ERROR);
@@ -1064,9 +1079,9 @@ tpc_process_register_key(struct tpc_list *list)
TAILQ_INSERT_TAIL(&list->allio, tio, links);
tio->io = tpcl_alloc_io();
datalen = sizeof(struct scsi_per_res_out_parms);
- list->buf = malloc(datalen, M_CTL, M_WAITOK);
+ tio->buf = malloc(datalen, M_CTL, M_WAITOK);
ctl_scsi_persistent_res_out(tio->io,
- list->buf, datalen, SPRO_REGISTER, -1,
+ tio->buf, datalen, SPRO_REGISTER, -1,
scsi_8btou64(seg->res_key), scsi_8btou64(seg->sa_res_key),
/*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0);
tio->io->io_hdr.retries = 3;
@@ -1166,9 +1181,9 @@ tpc_process_wut(struct tpc_list *list)
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
ctl_free_io(tio->io);
+ free(tio->buf, M_CTL);
free(tio, M_CTL);
}
- free(list->buf, M_CTL);
if (list->abort) {
ctl_set_task_aborted(list->ctsio);
return (CTL_RETVAL_ERROR);
@@ -1233,8 +1248,6 @@ tpc_process_wut(struct tpc_list *list)
return (CTL_RETVAL_ERROR);
}
- list->buf = malloc(numbytes, M_CTL, M_WAITOK |
- (list->token == NULL ? M_ZERO : 0));
list->segbytes = numbytes;
list->segsectors = numbytes / dstblock;
//printf("Copy chunk of %ju sectors from %ju to %ju\n", list->segsectors,
@@ -1257,11 +1270,12 @@ tpc_process_wut(struct tpc_list *list)
tior = malloc(sizeof(*tior), M_CTL, M_WAITOK | M_ZERO);
TAILQ_INIT(&tior->run);
+ tior->buf = malloc(roundbytes, M_CTL, M_WAITOK);
tior->list = list;
TAILQ_INSERT_TAIL(&list->allio, tior, links);
tior->io = tpcl_alloc_io();
ctl_scsi_read_write(tior->io,
- /*data_ptr*/ &list->buf[donebytes],
+ /*data_ptr*/ tior->buf,
/*data_len*/ roundbytes,
/*read_op*/ 1,
/*byte2*/ 0,
@@ -1280,7 +1294,7 @@ tpc_process_wut(struct tpc_list *list)
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
ctl_scsi_read_write(tiow->io,
- /*data_ptr*/ &list->buf[donebytes],
+ /*data_ptr*/ tior->buf,
/*data_len*/ roundbytes,
/*read_op*/ 0,
/*byte2*/ 0,
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c
index 1d3e048..5eeac4b 100644
--- a/sys/cam/ctl/scsi_ctl.c
+++ b/sys/cam/ctl/scsi_ctl.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/systm.h>
+#include <sys/taskqueue.h>
#include <machine/bus.h>
#include <cam/cam.h>
@@ -89,10 +90,6 @@ struct ctlfe_softc {
STAILQ_HEAD(, ctlfe_softc) ctlfe_softc_list;
struct mtx ctlfe_list_mtx;
static char ctlfe_mtx_desc[] = "ctlfelist";
-#ifdef CTLFE_INIT_ENABLE
-static int ctlfe_max_targets = 1;
-static int ctlfe_num_targets = 0;
-#endif
typedef enum {
CTLFE_LUN_NONE = 0x00,
@@ -103,15 +100,11 @@ struct ctlfe_lun_softc {
struct ctlfe_softc *parent_softc;
struct cam_periph *periph;
ctlfe_lun_flags flags;
- uint64_t ccbs_alloced;
- uint64_t ccbs_freed;
- uint64_t ctios_sent;
- uint64_t ctios_returned;
- uint64_t atios_alloced;
- uint64_t atios_freed;
- uint64_t inots_alloced;
- uint64_t inots_freed;
- /* bus_dma_tag_t dma_tag; */
+ int ctios_sent; /* Number of active CTIOs */
+ int refcount; /* Number of active xpt_action() */
+ int atios_alloced; /* Number of ATIOs not freed */
+ int inots_alloced; /* Number of INOTs not freed */
+ struct task refdrain_task;
TAILQ_HEAD(, ccb_hdr) work_queue;
STAILQ_ENTRY(ctlfe_lun_softc) links;
};
@@ -155,12 +148,9 @@ struct ctlfe_cmd_info {
#define CTLFE_IN_PER_LUN 1024
/*
- * Timeout (in seconds) on CTIO CCB allocation for doing a DMA or sending
- * status to the initiator. The SIM is expected to have its own timeouts,
- * so we're not putting this timeout around the CCB execution time. The
- * SIM should timeout and let us know if it has an issue.
+ * Timeout (in seconds) on CTIO CCB doing DMA or sending status
*/
-#define CTLFE_DMA_TIMEOUT 60
+#define CTLFE_TIMEOUT 5
/*
* Turn this on to enable extra debugging prints.
@@ -169,15 +159,6 @@ struct ctlfe_cmd_info {
#define CTLFE_DEBUG
#endif
-/*
- * Use randomly assigned WWNN/WWPN values. This is to work around an issue
- * in the FreeBSD initiator that makes it unable to rescan the target if
- * the target gets rebooted and the WWNN/WWPN stay the same.
- */
-#if 0
-#define RANDOM_WWNN
-#endif
-
MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CAM CTL FE interface");
#define io_ptr ppriv_ptr0
@@ -210,6 +191,10 @@ static void ctlfe_dump_queue(struct ctlfe_lun_softc *softc);
static void ctlfe_datamove(union ctl_io *io);
static void ctlfe_done(union ctl_io *io);
static void ctlfe_dump(void);
+static void ctlfe_free_ccb(struct cam_periph *periph,
+ union ccb *ccb);
+static void ctlfe_requeue_ccb(struct cam_periph *periph,
+ union ccb *ccb, int unlock);
static struct periph_driver ctlfe_driver =
{
@@ -304,49 +289,6 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
break;
}
-#ifdef CTLFE_INIT_ENABLE
- if (ctlfe_num_targets >= ctlfe_max_targets) {
- union ccb *ccb;
-
- ccb = (union ccb *)malloc(sizeof(*ccb), M_TEMP,
- M_NOWAIT | M_ZERO);
- if (ccb == NULL) {
- printf("%s: unable to malloc CCB!\n", __func__);
- return;
- }
- xpt_setup_ccb(&ccb->ccb_h, path, CAM_PRIORITY_NONE);
-
- ccb->ccb_h.func_code = XPT_SET_SIM_KNOB;
- ccb->knob.xport_specific.valid = KNOB_VALID_ROLE;
- ccb->knob.xport_specific.fc.role = KNOB_ROLE_INITIATOR;
-
- xpt_action(ccb);
-
- if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
- CAM_REQ_CMP) {
- printf("%s: SIM %s%d (path id %d) initiator "
- "enable failed with status %#x\n",
- __func__, cpi->dev_name,
- cpi->unit_number, cpi->ccb_h.path_id,
- ccb->ccb_h.status);
- } else {
- printf("%s: SIM %s%d (path id %d) initiator "
- "enable succeeded\n",
- __func__, cpi->dev_name,
- cpi->unit_number, cpi->ccb_h.path_id);
- }
-
- free(ccb, M_TEMP);
-
- break;
- } else {
- ctlfe_num_targets++;
- }
-
- printf("%s: ctlfe_num_targets = %d\n", __func__,
- ctlfe_num_targets);
-#endif /* CTLFE_INIT_ENABLE */
-
/*
* We're in an interrupt context here, so we have to
* use M_NOWAIT. Of course this means trouble if we
@@ -384,7 +326,7 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
port->port_type = CTL_PORT_SCSI;
/* XXX KDM what should the real number be here? */
- port->num_requested_ctl_io = 4096;
+ port->num_requested_ctl_io = CTLFE_REQ_CTL_IO;
snprintf(softc->port_name, sizeof(softc->port_name),
"%s%d", cpi->dev_name, cpi->unit_number);
/*
@@ -409,15 +351,7 @@ ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg)
port->max_targets = cpi->max_target;
port->max_target_id = cpi->max_target;
port->targ_port = -1;
-
- /*
- * XXX KDM need to figure out whether we're the master or
- * slave.
- */
-#ifdef CTLFEDEBUG
- printf("%s: calling ctl_port_register() for %s%d\n",
- __func__, cpi->dev_name, cpi->unit_number);
-#endif
+
retval = ctl_port_register(port);
if (retval != 0) {
printf("%s: ctl_port_register() failed with "
@@ -679,18 +613,14 @@ ctlfecleanup(struct cam_periph *periph)
softc = (struct ctlfe_lun_softc *)periph->softc;
- KASSERT(softc->ccbs_freed == softc->ccbs_alloced, ("%s: "
- "ccbs_freed %ju != ccbs_alloced %ju", __func__,
- softc->ccbs_freed, softc->ccbs_alloced));
- KASSERT(softc->ctios_returned == softc->ctios_sent, ("%s: "
- "ctios_returned %ju != ctios_sent %ju", __func__,
- softc->ctios_returned, softc->ctios_sent));
- KASSERT(softc->atios_freed == softc->atios_alloced, ("%s: "
- "atios_freed %ju != atios_alloced %ju", __func__,
- softc->atios_freed, softc->atios_alloced));
- KASSERT(softc->inots_freed == softc->inots_alloced, ("%s: "
- "inots_freed %ju != inots_alloced %ju", __func__,
- softc->inots_freed, softc->inots_alloced));
+ KASSERT(softc->ctios_sent == 0, ("%s: ctios_sent %d != 0",
+ __func__, softc->ctios_sent));
+ KASSERT(softc->refcount == 0, ("%s: refcount %d != 0",
+ __func__, softc->refcount));
+ KASSERT(softc->atios_alloced == 0, ("%s: atios_alloced %d != 0",
+ __func__, softc->atios_alloced));
+ KASSERT(softc->inots_alloced == 0, ("%s: inots_alloced %d != 0",
+ __func__, softc->inots_alloced));
free(softc, M_CTLFE);
}
@@ -806,11 +736,10 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
uint8_t scsi_status;
softc = (struct ctlfe_lun_softc *)periph->softc;
- softc->ccbs_alloced++;
+next:
ccb_h = TAILQ_FIRST(&softc->work_queue);
if (ccb_h == NULL) {
- softc->ccbs_freed++;
xpt_release_ccb(start_ccb);
return;
}
@@ -842,55 +771,21 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
(io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) {
io->io_hdr.flags &= ~CTL_FLAG_STATUS_QUEUED;
- /*
- * If this command was aborted, we don't
- * need to send status back to the SIM.
- * Just free the CTIO and ctl_io, and
- * recycle the ATIO back to the SIM.
- */
- xpt_print(periph->path, "%s: aborted "
- "command 0x%04x discarded\n",
- __func__, io->scsiio.tag_num);
- /*
- * For a wildcard attachment, commands can
- * come in with a specific target/lun. Reset
- * the target and LUN fields back to the
- * wildcard values before we send them back
- * down to the SIM. The SIM has a wildcard
- * LUN enabled, not whatever target/lun
- * these happened to be.
- */
- if (softc->flags & CTLFE_LUN_WILDCARD) {
- atio->ccb_h.target_id = CAM_TARGET_WILDCARD;
- atio->ccb_h.target_lun = CAM_LUN_WILDCARD;
- }
-
- if (atio->ccb_h.func_code != XPT_ACCEPT_TARGET_IO) {
- xpt_print(periph->path, "%s: func_code "
- "is %#x\n", __func__,
- atio->ccb_h.func_code);
- }
+ /* Tell the SIM that we've aborted this ATIO */
+#ifdef CTLFEDEBUG
+ printf("%s: tag %04x abort\n", __func__, atio->tag_id);
+#endif
+ KASSERT(atio->ccb_h.func_code == XPT_ACCEPT_TARGET_IO,
+ ("func_code %#x is not ATIO", atio->ccb_h.func_code));
start_ccb->ccb_h.func_code = XPT_ABORT;
start_ccb->cab.abort_ccb = (union ccb *)atio;
-
- /* Tell the SIM that we've aborted this ATIO */
xpt_action(start_ccb);
- softc->ccbs_freed++;
- xpt_release_ccb(start_ccb);
- /*
- * Send the ATIO back down to the SIM.
- */
- xpt_action((union ccb *)atio);
+ ctlfe_requeue_ccb(periph, (union ccb *)atio,
+ /* unlock */0);
- /*
- * If we still have work to do, ask for
- * another CCB. Otherwise, deactivate our
- * callout.
- */
- if (!TAILQ_EMPTY(&softc->work_queue))
- xpt_schedule(periph, /*priority*/ 1);
- return;
+ /* XPT_ABORT is not queued, so we can take next I/O. */
+ goto next;
}
data_ptr = NULL;
dxfer_len = 0;
@@ -911,9 +806,6 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
if (csio->sense_len != 0) {
csio->sense_data = io->scsiio.sense_data;
flags |= CAM_SEND_SENSE;
- } else if (scsi_status == SCSI_STATUS_CHECK_COND) {
- xpt_print(periph->path, "%s: check condition "
- "with no sense\n", __func__);
}
}
@@ -961,7 +853,7 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
scsi_status,
/*data_ptr*/ data_ptr,
/*dxfer_len*/ dxfer_len,
- /*timeout*/ 5 * 1000);
+ /*timeout*/ CTLFE_TIMEOUT * 1000);
start_ccb->ccb_h.flags |= CAM_UNLOCKED;
start_ccb->ccb_h.ccb_atio = atio;
if (io->io_hdr.flags & CTL_FLAG_DMA_QUEUED)
@@ -969,16 +861,32 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb)
io->io_hdr.flags &= ~(CTL_FLAG_DMA_QUEUED | CTL_FLAG_STATUS_QUEUED);
softc->ctios_sent++;
-
+ softc->refcount++;
cam_periph_unlock(periph);
xpt_action(start_ccb);
cam_periph_lock(periph);
+ softc->refcount--;
/*
* If we still have work to do, ask for another CCB.
*/
if (!TAILQ_EMPTY(&softc->work_queue))
- xpt_schedule(periph, /*priority*/ 1);
+ xpt_schedule(periph, CAM_PRIORITY_NORMAL);
+}
+
+static void
+ctlfe_drain(void *context, int pending)
+{
+ struct cam_periph *periph = context;
+ struct ctlfe_lun_softc *softc = periph->softc;
+
+ cam_periph_lock(periph);
+ while (softc->refcount != 0) {
+ cam_periph_sleep(periph, &softc->refcount, PRIBIO,
+ "ctlfe_drain", 1);
+ }
+ cam_periph_unlock(periph);
+ cam_periph_release(periph);
}
static void
@@ -993,13 +901,13 @@ ctlfe_free_ccb(struct cam_periph *periph, union ccb *ccb)
switch (ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO:
- softc->atios_freed++;
+ softc->atios_alloced--;
cmd_info = PRIV_INFO(io);
free(cmd_info, M_CTLFE);
break;
case XPT_IMMEDIATE_NOTIFY:
case XPT_NOTIFY_ACKNOWLEDGE:
- softc->inots_freed++;
+ softc->inots_alloced--;
break;
default:
break;
@@ -1008,22 +916,58 @@ ctlfe_free_ccb(struct cam_periph *periph, union ccb *ccb)
ctl_free_io(io);
free(ccb, M_CTLFE);
- KASSERT(softc->atios_freed <= softc->atios_alloced, ("%s: "
- "atios_freed %ju > atios_alloced %ju", __func__,
- softc->atios_freed, softc->atios_alloced));
- KASSERT(softc->inots_freed <= softc->inots_alloced, ("%s: "
- "inots_freed %ju > inots_alloced %ju", __func__,
- softc->inots_freed, softc->inots_alloced));
+ KASSERT(softc->atios_alloced >= 0, ("%s: atios_alloced %d < 0",
+ __func__, softc->atios_alloced));
+ KASSERT(softc->inots_alloced >= 0, ("%s: inots_alloced %d < 0",
+ __func__, softc->inots_alloced));
/*
* If we have received all of our CCBs, we can release our
* reference on the peripheral driver. It will probably go away
* now.
*/
- if ((softc->atios_freed == softc->atios_alloced)
- && (softc->inots_freed == softc->inots_alloced)) {
- cam_periph_release_locked(periph);
+ if (softc->atios_alloced == 0 && softc->inots_alloced == 0) {
+ if (softc->refcount == 0) {
+ cam_periph_release_locked(periph);
+ } else {
+ TASK_INIT(&softc->refdrain_task, 0, ctlfe_drain, periph);
+ taskqueue_enqueue(taskqueue_thread,
+ &softc->refdrain_task);
+ }
+ }
+}
+
+/*
+ * Send the ATIO/INOT back to the SIM, or free it if periph was invalidated.
+ */
+static void
+ctlfe_requeue_ccb(struct cam_periph *periph, union ccb *ccb, int unlock)
+{
+ struct ctlfe_lun_softc *softc;
+ struct mtx *mtx;
+
+ if (periph->flags & CAM_PERIPH_INVALID) {
+ mtx = cam_periph_mtx(periph);
+ ctlfe_free_ccb(periph, ccb);
+ if (unlock)
+ mtx_unlock(mtx);
+ return;
+ }
+ if (unlock)
+ cam_periph_unlock(periph);
+
+ /*
+ * For a wildcard attachment, commands can come in with a specific
+ * target/lun. Reset the target and LUN fields back to the wildcard
+ * values before we send them back down to the SIM.
+ */
+ softc = (struct ctlfe_lun_softc *)periph->softc;
+ if (softc->flags & CTLFE_LUN_WILDCARD) {
+ ccb->ccb_h.target_id = CAM_TARGET_WILDCARD;
+ ccb->ccb_h.target_lun = CAM_LUN_WILDCARD;
}
+
+ xpt_action(ccb);
}
static int
@@ -1102,6 +1046,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
struct ccb_accept_tio *atio = NULL;
union ctl_io *io = NULL;
struct mtx *mtx;
+ cam_status status;
KASSERT((done_ccb->ccb_h.flags & CAM_UNLOCKED) != 0,
("CCB in ctlfedone() without CAM_UNLOCKED flag"));
@@ -1128,30 +1073,15 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
mtx = cam_periph_mtx(periph);
mtx_lock(mtx);
- /*
- * If the peripheral is invalid, ATIOs and immediate notify CCBs
- * need to be freed. Most of the ATIOs and INOTs that come back
- * will be CCBs that are being returned from the SIM as a result of
- * our disabling the LUN.
- *
- * Other CCB types are handled in their respective cases below.
- */
- if (periph->flags & CAM_PERIPH_INVALID) {
- switch (done_ccb->ccb_h.func_code) {
- case XPT_ACCEPT_TARGET_IO:
- case XPT_IMMEDIATE_NOTIFY:
- case XPT_NOTIFY_ACKNOWLEDGE:
- ctlfe_free_ccb(periph, done_ccb);
- goto out;
- default:
- break;
- }
-
- }
switch (done_ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO: {
atio = &done_ccb->atio;
+ status = atio->ccb_h.status & CAM_STATUS_MASK;
+ if (status != CAM_CDB_RECVD) {
+ ctlfe_free_ccb(periph, done_ccb);
+ goto out;
+ }
resubmit:
/*
@@ -1229,7 +1159,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
atio = (struct ccb_accept_tio *)done_ccb->ccb_h.ccb_atio;
io = (union ctl_io *)atio->ccb_h.io_ptr;
- softc->ctios_returned++;
+ softc->ctios_sent--;
#ifdef CTLFEDEBUG
printf("%s: got XPT_CONT_TARGET_IO tag %#x flags %#x\n",
__func__, atio->tag_id, done_ccb->ccb_h.flags);
@@ -1265,11 +1195,10 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
io->scsiio.ext_data_filled = srr_off;
io->scsiio.io_hdr.status = CTL_STATUS_NONE;
io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED;
- softc->ccbs_freed++;
xpt_release_ccb(done_ccb);
TAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h,
periph_links.tqe);
- xpt_schedule(periph, /*priority*/ 1);
+ xpt_schedule(periph, CAM_PRIORITY_NORMAL);
break;
}
@@ -1280,7 +1209,6 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
* should work.
*/
if (srr && (io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
- softc->ccbs_freed++;
xpt_release_ccb(done_ccb);
if (ctlfe_adjust_cdb(atio, srr_off) == 0) {
done_ccb = (union ccb *)atio;
@@ -1301,27 +1229,32 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
* datamove done routine.
*/
if ((io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
- softc->ccbs_freed++;
- xpt_release_ccb(done_ccb);
/*
- * For a wildcard attachment, commands can come in
- * with a specific target/lun. Reset the target
- * and LUN fields back to the wildcard values before
- * we send them back down to the SIM. The SIM has
- * a wildcard LUN enabled, not whatever target/lun
- * these happened to be.
+ * If we asked to send sense data but it wasn't sent,
+ * queue the I/O back to CTL for later REQUEST SENSE.
*/
- if (softc->flags & CTLFE_LUN_WILDCARD) {
- atio->ccb_h.target_id = CAM_TARGET_WILDCARD;
- atio->ccb_h.target_lun = CAM_LUN_WILDCARD;
+ if ((done_ccb->ccb_h.flags & CAM_SEND_SENSE) != 0 &&
+ (done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP &&
+ (done_ccb->ccb_h.status & CAM_SENT_SENSE) == 0 &&
+ (io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref)) != NULL) {
+ PRIV_INFO(io) = PRIV_INFO(
+ (union ctl_io *)atio->ccb_h.io_ptr);
+ ctl_queue_sense(atio->ccb_h.io_ptr);
+ atio->ccb_h.io_ptr = io;
}
- if (periph->flags & CAM_PERIPH_INVALID) {
- ctlfe_free_ccb(periph, (union ccb *)atio);
- } else {
- mtx_unlock(mtx);
- xpt_action((union ccb *)atio);
- return;
+
+ /* Abort ATIO if CTIO sending status has failed. */
+ if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) !=
+ CAM_REQ_CMP) {
+ done_ccb->ccb_h.func_code = XPT_ABORT;
+ done_ccb->cab.abort_ccb = (union ccb *)atio;
+ xpt_action(done_ccb);
}
+
+ xpt_release_ccb(done_ccb);
+ ctlfe_requeue_ccb(periph, (union ccb *)atio,
+ /* unlock */1);
+ return;
} else {
struct ctlfe_cmd_info *cmd_info;
struct ccb_scsiio *csio;
@@ -1340,7 +1273,8 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
*/
switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) {
case CAM_REQ_CMP:
- io->scsiio.kern_data_resid -= csio->dxfer_len;
+ io->scsiio.kern_data_resid -=
+ csio->dxfer_len - csio->resid;
io->io_hdr.port_status = 0;
break;
default:
@@ -1367,8 +1301,8 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
* pieces, figure out where we are in the list, and
* continue sending pieces if necessary.
*/
- if ((cmd_info->flags & CTLFE_CMD_PIECEWISE)
- && (io->io_hdr.port_status == 0)) {
+ if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) &&
+ io->io_hdr.port_status == 0 && csio->resid == 0) {
ccb_flags flags;
uint8_t *data_ptr;
uint32_t dxfer_len;
@@ -1402,7 +1336,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
0,
/*data_ptr*/ data_ptr,
/*dxfer_len*/ dxfer_len,
- /*timeout*/ 5 * 1000);
+ CTLFE_TIMEOUT * 1000);
csio->ccb_h.flags |= CAM_UNLOCKED;
csio->resid = 0;
@@ -1416,7 +1350,6 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
* Release the CTIO. The ATIO will be sent back
* down to the SIM once we send status.
*/
- softc->ccbs_freed++;
xpt_release_ccb(done_ccb);
mtx_unlock(mtx);
@@ -1430,14 +1363,9 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
case XPT_IMMEDIATE_NOTIFY: {
union ctl_io *io;
struct ccb_immediate_notify *inot;
- cam_status status;
int send_ctl_io;
inot = &done_ccb->cin1;
- printf("%s: got XPT_IMMEDIATE_NOTIFY status %#x tag %#x "
- "seq %#x\n", __func__, inot->ccb_h.status,
- inot->tag_id, inot->seq_id);
-
io = done_ccb->ccb_h.io_ptr;
ctl_zero_io(io);
@@ -1503,40 +1431,22 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
break;
default:
xpt_print(periph->path,
- "%s: unsupported message 0x%x\n",
- __func__, inot->arg);
+ "%s: unsupported INOT message 0x%x\n",
+ __func__, inot->arg);
send_ctl_io = 0;
break;
}
break;
+ default:
+ xpt_print(periph->path,
+ "%s: unsupported INOT status 0x%x\n",
+ __func__, status);
+ /* FALLTHROUGH */
case CAM_REQ_ABORTED:
- /*
- * This request was sent back by the driver.
- * XXX KDM what do we do here?
- */
- send_ctl_io = 0;
- break;
case CAM_REQ_INVALID:
+ case CAM_DEV_NOT_THERE:
case CAM_PROVIDE_FAIL:
- default:
- /*
- * We should only get here if we're talking
- * to a talking to a SIM that is target
- * capable but supports the old API. In
- * that case, we need to just free the CCB.
- * If we actually send a notify acknowledge,
- * it will send that back with an error as
- * well.
- */
-
- if ((status != CAM_REQ_INVALID)
- && (status != CAM_PROVIDE_FAIL))
- xpt_print(periph->path,
- "%s: unsupported CAM status 0x%x\n",
- __func__, status);
-
ctlfe_free_ccb(periph, done_ccb);
-
goto out;
}
if (send_ctl_io != 0) {
@@ -1549,13 +1459,11 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb)
break;
}
case XPT_NOTIFY_ACKNOWLEDGE:
- /*
- * Queue this back down to the SIM as an immediate notify.
- */
+ /* Queue this back down to the SIM as an immediate notify. */
done_ccb->ccb_h.status = CAM_REQ_INPROG;
done_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
- xpt_action(done_ccb);
- break;
+ ctlfe_requeue_ccb(periph, done_ccb, /* unlock */1);
+ return;
case XPT_SET_SIM_KNOB:
case XPT_GET_SIM_KNOB:
case XPT_GET_SIM_KNOB_OLD:
@@ -1608,9 +1516,6 @@ ctlfe_onoffline(void *arg, int online)
*/
if (online != 0) {
if ((ccb->knob.xport_specific.valid & KNOB_VALID_ADDRESS) != 0){
-#ifdef RANDOM_WWNN
- uint64_t random_bits;
-#endif
printf("%s: %s current WWNN %#jx\n", __func__,
bus_softc->port_name,
@@ -1619,45 +1524,6 @@ ctlfe_onoffline(void *arg, int online)
bus_softc->port_name,
ccb->knob.xport_specific.fc.wwpn);
-#ifdef RANDOM_WWNN
- arc4rand(&random_bits, sizeof(random_bits), 0);
-#endif
-
- /*
- * XXX KDM this is a bit of a kludge for now. We
- * take the current WWNN/WWPN from the card, and
- * replace the company identifier and the NL-Port
- * indicator and the port number (for the WWPN).
- * This should be replaced later with ddb_GetWWNN,
- * or possibly a more centralized scheme. (It
- * would be nice to have the WWNN/WWPN for each
- * port stored in the ctl_port structure.)
- */
-#ifdef RANDOM_WWNN
- ccb->knob.xport_specific.fc.wwnn =
- (random_bits &
- 0x0000000fffffff00ULL) |
- /* Company ID */ 0x5000ED5000000000ULL |
- /* NL-Port */ 0x0300;
- ccb->knob.xport_specific.fc.wwpn =
- (random_bits &
- 0x0000000fffffff00ULL) |
- /* Company ID */ 0x5000ED5000000000ULL |
- /* NL-Port */ 0x3000 |
- /* Port Num */ (bus_softc->port.targ_port & 0xff);
-
- /*
- * This is a bit of an API break/reversal, but if
- * we're doing the random WWNN that's a little
- * different anyway. So record what we're actually
- * using with the frontend code so it's reported
- * accurately.
- */
- ctl_port_set_wwns(&bus_softc->port,
- true, ccb->knob.xport_specific.fc.wwnn,
- true, ccb->knob.xport_specific.fc.wwpn);
- set_wwnn = 1;
-#else /* RANDOM_WWNN */
/*
* If the user has specified a WWNN/WWPN, send them
* down to the SIM. Otherwise, record what the SIM
@@ -1683,7 +1549,6 @@ ctlfe_onoffline(void *arg, int online)
false, 0,
true, ccb->knob.xport_specific.fc.wwpn);
}
-#endif /* RANDOM_WWNN */
if (set_wwnn != 0) {
@@ -1975,16 +1840,8 @@ ctlfe_dump_queue(struct ctlfe_lun_softc *softc)
}
}
- xpt_print(periph->path, "%d requests total waiting for CCBs\n",
- num_items);
- xpt_print(periph->path, "%ju CCBs outstanding (%ju allocated, %ju "
- "freed)\n", (uintmax_t)(softc->ccbs_alloced -
- softc->ccbs_freed), (uintmax_t)softc->ccbs_alloced,
- (uintmax_t)softc->ccbs_freed);
- xpt_print(periph->path, "%ju CTIOs outstanding (%ju sent, %ju "
- "returned\n", (uintmax_t)(softc->ctios_sent -
- softc->ctios_returned), softc->ctios_sent,
- softc->ctios_returned);
+ xpt_print(periph->path, "%d requests waiting for CCBs\n", num_items);
+ xpt_print(periph->path, "%d CTIOs outstanding\n", softc->ctios_sent);
}
/*
@@ -2012,7 +1869,7 @@ ctlfe_datamove(union ctl_io *io)
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
TAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h,
periph_links.tqe);
- xpt_schedule(periph, /*priority*/ 1);
+ xpt_schedule(periph, CAM_PRIORITY_NORMAL);
cam_periph_unlock(periph);
}
@@ -2030,14 +1887,6 @@ ctlfe_done(union ctl_io *io)
if (io->io_hdr.io_type == CTL_IO_TASK) {
/*
- * Task management commands don't require any further
- * communication back to the adapter. Requeue the CCB
- * to the adapter, and free the CTL I/O.
- */
- xpt_print(ccb->ccb_h.path, "%s: returning task I/O "
- "tag %#x seq %#x\n", __func__,
- ccb->cin1.tag_id, ccb->cin1.seq_id);
- /*
* Send the notify acknowledge down to the SIM, to let it
* know we processed the task management command.
*/
@@ -2067,22 +1916,13 @@ ctlfe_done(union ctl_io *io)
ccb->cna2.arg |= scsi_3btoul(io->taskio.task_resp) << 8;
xpt_action(ccb);
} else if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) {
- if (softc->flags & CTLFE_LUN_WILDCARD) {
- ccb->ccb_h.target_id = CAM_TARGET_WILDCARD;
- ccb->ccb_h.target_lun = CAM_LUN_WILDCARD;
- }
- if (periph->flags & CAM_PERIPH_INVALID) {
- ctlfe_free_ccb(periph, ccb);
- } else {
- cam_periph_unlock(periph);
- xpt_action(ccb);
- return;
- }
+ ctlfe_requeue_ccb(periph, ccb, /* unlock */1);
+ return;
} else {
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
TAILQ_INSERT_TAIL(&softc->work_queue, &ccb->ccb_h,
periph_links.tqe);
- xpt_schedule(periph, /*priority*/ 1);
+ xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
cam_periph_unlock(periph);
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 64c45fb..f85d285 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -3039,7 +3039,7 @@ struct scsi_set_timestamp_parameters
{
uint8_t reserved1[4];
uint8_t timestamp[6];
- uint8_t reserved2[4];
+ uint8_t reserved2[2];
};
struct scsi_report_timestamp_parameter_data
diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c
index 0c91e51..7c8b684 100644
--- a/sys/cam/scsi/scsi_low.c
+++ b/sys/cam/scsi/scsi_low.c
@@ -479,15 +479,6 @@ scsi_low_scsi_action_cam(sim, ccb)
#endif /* SCSI_LOW_DEBUG */
break;
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
- /* XXX Implement */
- ccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(ccb);
- break;
-
case XPT_ABORT: /* Abort the specified CCB */
#ifdef SCSI_LOW_DIAGNOSTIC
if (target == CAM_TARGET_WILDCARD || lun == CAM_LUN_WILDCARD)
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index b80d565..d74ec7f 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -4086,7 +4086,6 @@ arc_reclaim_thread(void *dummy __unused)
mutex_enter(&arc_reclaim_lock);
while (!arc_reclaim_thread_exit) {
- int64_t free_memory = arc_available_memory();
uint64_t evicted = 0;
/*
@@ -4105,6 +4104,14 @@ arc_reclaim_thread(void *dummy __unused)
mutex_exit(&arc_reclaim_lock);
+ /*
+ * We call arc_adjust() before (possibly) calling
+ * arc_kmem_reap_now(), so that we can wake up
+ * arc_get_data_buf() sooner.
+ */
+ evicted = arc_adjust();
+
+ int64_t free_memory = arc_available_memory();
if (free_memory < 0) {
arc_no_grow = B_TRUE;
@@ -4138,8 +4145,6 @@ arc_reclaim_thread(void *dummy __unused)
arc_no_grow = B_FALSE;
}
- evicted = arc_adjust();
-
mutex_enter(&arc_reclaim_lock);
/*
@@ -6892,7 +6897,7 @@ top:
}
if (!all && HDR_HAS_L2HDR(hdr) &&
- (hdr->b_l2hdr.b_daddr > taddr ||
+ (hdr->b_l2hdr.b_daddr >= taddr ||
hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
/*
* We've evicted to the target address,
@@ -7026,7 +7031,22 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
continue;
}
- if ((write_asize + HDR_GET_LSIZE(hdr)) > target_sz) {
+ /*
+ * We rely on the L1 portion of the header below, so
+ * it's invalid for this header to have been evicted out
+ * of the ghost cache, prior to being written out. The
+ * ARC_FLAG_L2_WRITING bit ensures this won't happen.
+ */
+ ASSERT(HDR_HAS_L1HDR(hdr));
+
+ ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
+ ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
+ ASSERT3U(arc_hdr_size(hdr), >, 0);
+ uint64_t size = arc_hdr_size(hdr);
+ uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
+ size);
+
+ if ((write_psize + asize) > target_sz) {
full = B_TRUE;
mutex_exit(hash_lock);
ARCSTAT_BUMP(arcstat_l2_write_full);
@@ -7061,21 +7081,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
list_insert_head(&dev->l2ad_buflist, hdr);
mutex_exit(&dev->l2ad_mtx);
- /*
- * We rely on the L1 portion of the header below, so
- * it's invalid for this header to have been evicted out
- * of the ghost cache, prior to being written out. The
- * ARC_FLAG_L2_WRITING bit ensures this won't happen.
- */
- ASSERT(HDR_HAS_L1HDR(hdr));
-
- ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
- ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
- ASSERT3U(arc_hdr_size(hdr), >, 0);
- uint64_t size = arc_hdr_size(hdr);
- uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
- size);
-
(void) refcount_add_many(&dev->l2ad_alloc, size, hdr);
/*
@@ -7137,7 +7142,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
return (0);
}
- ASSERT3U(write_asize, <=, target_sz);
+ ASSERT3U(write_psize, <=, target_sz);
ARCSTAT_BUMP(arcstat_l2_writes_sent);
ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
ARCSTAT_INCR(arcstat_l2_size, write_sz);
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
index fff5f8f..2f8b7d6 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -167,16 +167,12 @@ id_t zio_taskq_psrset_bind = PS_NONE;
#endif
#ifdef SYSDC
boolean_t zio_taskq_sysdc = B_TRUE; /* use SDC scheduling class */
-#endif
uint_t zio_taskq_basedc = 80; /* base duty cycle */
+#endif
boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */
extern int zfs_sync_pass_deferred_free;
-#ifndef illumos
-extern void spa_deadman(void *arg);
-#endif
-
/*
* This (illegal) pool name is used when temporarily importing a spa_t in order
* to get the vdev stats associated with the imported devices.
@@ -927,9 +923,17 @@ spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q)
* The write issue taskq can be extremely CPU
* intensive. Run it at slightly lower priority
* than the other taskqs.
+ * FreeBSD notes:
+ * - numerically higher priorities are lower priorities;
+ * - if priorities divided by four (RQ_PPQ) are equal
+ * then a difference between them is insignificant.
*/
if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE)
- pri++;
+#ifdef illumos
+ pri--;
+#else
+ pri += 4;
+#endif
tq = taskq_create_proc(name, value, pri, 50,
INT_MAX, spa->spa_proc, flags);
@@ -6880,8 +6884,8 @@ spa_sync(spa_t *spa, uint64_t txg)
spa->spa_sync_starttime + spa->spa_deadman_synctime));
#else /* !illumos */
#ifdef _KERNEL
- callout_reset(&spa->spa_deadman_cycid,
- hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa);
+ callout_schedule(&spa->spa_deadman_cycid,
+ hz * spa->spa_deadman_synctime / NANOSEC);
#endif
#endif /* illumos */
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
index c247388..f543138 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
@@ -597,8 +597,8 @@ spa_lookup(const char *name)
* If the zfs_deadman_enabled flag is set then it inspects all vdev queues
* looking for potentially hung I/Os.
*/
-void
-spa_deadman(void *arg)
+static void
+spa_deadman(void *arg, int pending)
{
spa_t *spa = arg;
@@ -627,6 +627,16 @@ spa_deadman(void *arg)
#endif
}
+#if defined(__FreeBSD__) && defined(_KERNEL)
+static void
+spa_deadman_timeout(void *arg)
+{
+ spa_t *spa = arg;
+
+ taskqueue_enqueue(taskqueue_thread, &spa->spa_deadman_task);
+}
+#endif
+
/*
* Create an uninitialized spa_t with the given name. Requires
* spa_namespace_lock. The caller must ensure that the spa_t doesn't already
@@ -698,7 +708,23 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
mutex_exit(&cpu_lock);
#else /* !illumos */
#ifdef _KERNEL
+ /*
+ * callout(9) does not provide a way to initialize a callout with
+ * a function and an argument, so we use callout_reset() to schedule
+ * the callout in the very distant future. Even if that event ever
+ * fires, it should be okayas we won't have any active zio-s.
+ * But normally spa_sync() will reschedule the callout with a proper
+ * timeout.
+ * callout(9) does not allow the callback function to sleep but
+ * vdev_deadman() needs to acquire vq_lock and illumos mutexes are
+ * emulated using sx(9). For this reason spa_deadman_timeout()
+ * will schedule spa_deadman() as task on a taskqueue that allows
+ * sleeping.
+ */
+ TASK_INIT(&spa->spa_deadman_task, 0, spa_deadman, spa);
callout_init(&spa->spa_deadman_cycid, 1);
+ callout_reset_sbt(&spa->spa_deadman_cycid, SBT_MAX, 0,
+ spa_deadman_timeout, spa, 0);
#endif
#endif
refcount_create(&spa->spa_refcount);
@@ -811,6 +837,7 @@ spa_remove(spa_t *spa)
#else /* !illumos */
#ifdef _KERNEL
callout_drain(&spa->spa_deadman_cycid);
+ taskqueue_drain(taskqueue_thread, &spa->spa_deadman_task);
#endif
#endif
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
index 04c2e16..33d6713 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
@@ -267,6 +267,7 @@ struct spa {
#else /* !illumos */
#ifdef _KERNEL
struct callout spa_deadman_cycid; /* callout id */
+ struct task spa_deadman_task;
#endif
#endif /* illumos */
uint64_t spa_deadman_calls; /* number of deadman calls */
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
index 7d68e58..5d5184e 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
@@ -5866,6 +5866,9 @@ zfs_freebsd_setacl(ap)
if (ap->a_type != ACL_TYPE_NFS4)
return (EINVAL);
+ if (ap->a_aclp == NULL)
+ return (EINVAL);
+
if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES)
return (EINVAL);
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
index 23284a7..07de1d0 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
@@ -267,7 +267,16 @@ zvol_size_changed(zvol_state_t *zv, uint64_t volsize)
if (pp == NULL)
return;
g_topology_lock();
- g_resize_provider(pp, zv->zv_volsize);
+
+ /*
+ * Do not invoke resize event when initial size was zero.
+ * ZVOL initializes the size on first open, this is not
+ * real resizing.
+ */
+ if (pp->mediasize == 0)
+ pp->mediasize = zv->zv_volsize;
+ else
+ g_resize_provider(pp, zv->zv_volsize);
g_topology_unlock();
}
#endif /* illumos */
diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
index df39d2e..717f455 100644
--- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
@@ -41,7 +41,9 @@
#include <sys/dtrace_impl.h>
#include <sys/dtrace_bsd.h>
#include <machine/clock.h>
+#include <machine/cpufunc.h>
#include <machine/frame.h>
+#include <machine/psl.h>
#include <vm/pmap.h>
extern void dtrace_getnanotime(struct timespec *tsp);
@@ -384,6 +386,8 @@ dtrace_gethrestime(void)
int
dtrace_trap(struct trapframe *frame, u_int type)
{
+ uint16_t nofault;
+
/*
* A trap can occur while DTrace executes a probe. Before
* executing the probe, DTrace blocks re-scheduling and sets
@@ -393,7 +397,12 @@ dtrace_trap(struct trapframe *frame, u_int type)
*
* Check if DTrace has enabled 'no-fault' mode:
*/
- if ((cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT) != 0) {
+ sched_pin();
+ nofault = cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT;
+ sched_unpin();
+ if (nofault) {
+ KASSERT((read_rflags() & PSL_I) == 0, ("interrupts enabled"));
+
/*
* There are only a couple of trap types that are expected.
* All the rest will be handled in the usual way.
diff --git a/sys/cddl/dev/dtrace/i386/dtrace_subr.c b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
index b70eab9..3801c1b 100644
--- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
@@ -42,7 +42,9 @@
#include <sys/dtrace_impl.h>
#include <sys/dtrace_bsd.h>
#include <machine/clock.h>
+#include <machine/cpufunc.h>
#include <machine/frame.h>
+#include <machine/psl.h>
#include <vm/pmap.h>
extern uintptr_t kernelbase;
@@ -386,6 +388,8 @@ dtrace_gethrestime(void)
int
dtrace_trap(struct trapframe *frame, u_int type)
{
+ uint16_t nofault;
+
/*
* A trap can occur while DTrace executes a probe. Before
* executing the probe, DTrace blocks re-scheduling and sets
@@ -395,7 +399,12 @@ dtrace_trap(struct trapframe *frame, u_int type)
*
* Check if DTrace has enabled 'no-fault' mode:
*/
- if ((cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT) != 0) {
+ sched_pin();
+ nofault = cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT;
+ sched_unpin();
+ if (nofault) {
+ KASSERT((read_eflags() & PSL_I) == 0, ("interrupts enabled"));
+
/*
* There are only a couple of trap types that are expected.
* All the rest will be handled in the usual way.
diff --git a/sys/compat/cloudabi/cloudabi_mem.c b/sys/compat/cloudabi/cloudabi_mem.c
index 34ee14a..7c0abe6 100644
--- a/sys/compat/cloudabi/cloudabi_mem.c
+++ b/sys/compat/cloudabi/cloudabi_mem.c
@@ -28,7 +28,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mman.h>
-#include <sys/sysproto.h>
+#include <sys/proc.h>
+#include <sys/syscallsubr.h>
#include <contrib/cloudabi/cloudabi_types_common.h>
@@ -62,137 +63,116 @@ int
cloudabi_sys_mem_advise(struct thread *td,
struct cloudabi_sys_mem_advise_args *uap)
{
- struct madvise_args madvise_args = {
- .addr = uap->addr,
- .len = uap->len
- };
+ int behav;
switch (uap->advice) {
case CLOUDABI_ADVICE_DONTNEED:
- madvise_args.behav = MADV_DONTNEED;
+ behav = MADV_DONTNEED;
break;
case CLOUDABI_ADVICE_NORMAL:
- madvise_args.behav = MADV_NORMAL;
+ behav = MADV_NORMAL;
break;
case CLOUDABI_ADVICE_RANDOM:
- madvise_args.behav = MADV_RANDOM;
+ behav = MADV_RANDOM;
break;
case CLOUDABI_ADVICE_SEQUENTIAL:
- madvise_args.behav = MADV_SEQUENTIAL;
+ behav = MADV_SEQUENTIAL;
break;
case CLOUDABI_ADVICE_WILLNEED:
- madvise_args.behav = MADV_WILLNEED;
+ behav = MADV_WILLNEED;
break;
default:
return (EINVAL);
}
- return (sys_madvise(td, &madvise_args));
+ return (kern_madvise(td, (uintptr_t)uap->addr, uap->len,
+ behav));
}
int
cloudabi_sys_mem_lock(struct thread *td, struct cloudabi_sys_mem_lock_args *uap)
{
- struct mlock_args mlock_args = {
- .addr = uap->addr,
- .len = uap->len
- };
- return (sys_mlock(td, &mlock_args));
+ return (kern_mlock(td->td_proc, td->td_ucred,
+ __DECONST(uintptr_t, uap->addr), uap->len));
}
int
cloudabi_sys_mem_map(struct thread *td, struct cloudabi_sys_mem_map_args *uap)
{
- struct mmap_args mmap_args = {
- .addr = uap->addr,
- .len = uap->len,
- .fd = uap->fd,
- .pos = uap->off
- };
- int error;
+ int error, flags, prot;
/* Translate flags. */
+ flags = 0;
if (uap->flags & CLOUDABI_MAP_ANON)
- mmap_args.flags |= MAP_ANON;
+ flags |= MAP_ANON;
if (uap->flags & CLOUDABI_MAP_FIXED)
- mmap_args.flags |= MAP_FIXED;
+ flags |= MAP_FIXED;
if (uap->flags & CLOUDABI_MAP_PRIVATE)
- mmap_args.flags |= MAP_PRIVATE;
+ flags |= MAP_PRIVATE;
if (uap->flags & CLOUDABI_MAP_SHARED)
- mmap_args.flags |= MAP_SHARED;
+ flags |= MAP_SHARED;
/* Translate protection. */
- error = convert_mprot(uap->prot, &mmap_args.prot);
+ error = convert_mprot(uap->prot, &prot);
if (error != 0)
return (error);
- return (sys_mmap(td, &mmap_args));
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags,
+ uap->fd, uap->off));
}
int
cloudabi_sys_mem_protect(struct thread *td,
struct cloudabi_sys_mem_protect_args *uap)
{
- struct mprotect_args mprotect_args = {
- .addr = uap->addr,
- .len = uap->len,
- };
- int error;
+ int error, prot;
/* Translate protection. */
- error = convert_mprot(uap->prot, &mprotect_args.prot);
+ error = convert_mprot(uap->prot, &prot);
if (error != 0)
return (error);
- return (sys_mprotect(td, &mprotect_args));
+ return (kern_mprotect(td, (uintptr_t)uap->addr, uap->len,
+ prot));
}
int
cloudabi_sys_mem_sync(struct thread *td, struct cloudabi_sys_mem_sync_args *uap)
{
- struct msync_args msync_args = {
- .addr = uap->addr,
- .len = uap->len,
- };
+ int flags;
/* Convert flags. */
switch (uap->flags & (CLOUDABI_MS_ASYNC | CLOUDABI_MS_SYNC)) {
case CLOUDABI_MS_ASYNC:
- msync_args.flags |= MS_ASYNC;
+ flags = MS_ASYNC;
break;
case CLOUDABI_MS_SYNC:
- msync_args.flags |= MS_SYNC;
+ flags = MS_SYNC;
break;
default:
return (EINVAL);
}
if ((uap->flags & CLOUDABI_MS_INVALIDATE) != 0)
- msync_args.flags |= MS_INVALIDATE;
+ flags |= MS_INVALIDATE;
- return (sys_msync(td, &msync_args));
+ return (kern_msync(td, (uintptr_t)uap->addr, uap->len,
+ flags));
}
int
cloudabi_sys_mem_unlock(struct thread *td,
struct cloudabi_sys_mem_unlock_args *uap)
{
- struct munlock_args munlock_args = {
- .addr = uap->addr,
- .len = uap->len
- };
- return (sys_munlock(td, &munlock_args));
+ return (kern_munlock(td, __DECONST(uintptr_t, uap->addr),
+ uap->len));
}
int
cloudabi_sys_mem_unmap(struct thread *td,
struct cloudabi_sys_mem_unmap_args *uap)
{
- struct munmap_args munmap_args = {
- .addr = uap->addr,
- .len = uap->len
- };
- return (sys_munmap(td, &munmap_args));
+ return (kern_munmap(td, (uintptr_t)uap->addr, uap->len));
}
diff --git a/sys/compat/freebsd32/Makefile b/sys/compat/freebsd32/Makefile
index bffd4af..e91e042 100644
--- a/sys/compat/freebsd32/Makefile
+++ b/sys/compat/freebsd32/Makefile
@@ -9,11 +9,6 @@ sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_syst
freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \
../../kern/makesyscalls.sh syscalls.master syscalls.conf capabilities.conf
- -mv -f freebsd32_sysent.c freebsd32_sysent.c.bak
- -mv -f freebsd32_syscalls.c freebsd32_syscalls.c.bak
- -mv -f freebsd32_syscall.h freebsd32_syscall.h.bak
- -mv -f freebsd32_proto.h freebsd32_proto.h.bak
- -mv -f freebsd32_systrace_args.c freebsd32_systrace_args.c.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
clean:
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 34eb6d7..67d9afb 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -449,42 +449,30 @@ freebsd32_fexecve(struct thread *td, struct freebsd32_fexecve_args *uap)
int
freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap)
{
- struct mprotect_args ap;
+ int prot;
- ap.addr = PTRIN(uap->addr);
- ap.len = uap->len;
- ap.prot = uap->prot;
+ prot = uap->prot;
#if defined(__amd64__)
- if (i386_read_exec && (ap.prot & PROT_READ) != 0)
- ap.prot |= PROT_EXEC;
+ if (i386_read_exec && (prot & PROT_READ) != 0)
+ prot |= PROT_EXEC;
#endif
- return (sys_mprotect(td, &ap));
+ return (kern_mprotect(td, (uintptr_t)PTRIN(uap->addr), uap->len,
+ prot));
}
int
freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
{
- struct mmap_args ap;
- vm_offset_t addr = (vm_offset_t) uap->addr;
- vm_size_t len = uap->len;
- int prot = uap->prot;
- int flags = uap->flags;
- int fd = uap->fd;
- off_t pos = PAIR32TO64(off_t,uap->pos);
+ int prot;
+ prot = uap->prot;
#if defined(__amd64__)
if (i386_read_exec && (prot & PROT_READ))
prot |= PROT_EXEC;
#endif
- ap.addr = (void *) addr;
- ap.len = len;
- ap.prot = prot;
- ap.flags = flags;
- ap.fd = fd;
- ap.pos = pos;
-
- return (sys_mmap(td, &ap));
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot,
+ uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos)));
}
#ifdef COMPAT_FREEBSD6
@@ -492,17 +480,16 @@ int
freebsd6_freebsd32_mmap(struct thread *td,
struct freebsd6_freebsd32_mmap_args *uap)
{
- struct freebsd32_mmap_args ap;
+ int prot;
- ap.addr = uap->addr;
- ap.len = uap->len;
- ap.prot = uap->prot;
- ap.flags = uap->flags;
- ap.fd = uap->fd;
- ap.pos1 = uap->pos1;
- ap.pos2 = uap->pos2;
+ prot = uap->prot;
+#if defined(__amd64__)
+ if (i386_read_exec && (prot & PROT_READ))
+ prot |= PROT_EXEC;
+#endif
- return (freebsd32_mmap(td, &ap));
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot,
+ uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos)));
}
#endif
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index b5126f4..7ca2ac7 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1062,6 +1062,62 @@ linux_pwrite(td, uap)
}
int
+linux_preadv(struct thread *td, struct linux_preadv_args *uap)
+{
+ struct uio *auio;
+ int error;
+ off_t offset;
+
+ /*
+ * According http://man7.org/linux/man-pages/man2/preadv.2.html#NOTES
+ * pos_l and pos_h, respectively, contain the
+ * low order and high order 32 bits of offset.
+ */
+ offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) <<
+ (sizeof(offset) * 4)) | uap->pos_l;
+ if (offset < 0)
+ return (EINVAL);
+#ifdef COMPAT_LINUX32
+ error = linux32_copyinuio(PTRIN(uap->vec), uap->vlen, &auio);
+#else
+ error = copyinuio(uap->vec, uap->vlen, &auio);
+#endif
+ if (error != 0)
+ return (error);
+ error = kern_preadv(td, uap->fd, auio, offset);
+ free(auio, M_IOV);
+ return (error);
+}
+
+int
+linux_pwritev(struct thread *td, struct linux_pwritev_args *uap)
+{
+ struct uio *auio;
+ int error;
+ off_t offset;
+
+ /*
+ * According http://man7.org/linux/man-pages/man2/pwritev.2.html#NOTES
+ * pos_l and pos_h, respectively, contain the
+ * low order and high order 32 bits of offset.
+ */
+ offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) <<
+ (sizeof(offset) * 4)) | uap->pos_l;
+ if (offset < 0)
+ return (EINVAL);
+#ifdef COMPAT_LINUX32
+ error = linux32_copyinuio(PTRIN(uap->vec), uap->vlen, &auio);
+#else
+ error = copyinuio(uap->vec, uap->vlen, &auio);
+#endif
+ if (error != 0)
+ return (error);
+ error = kern_pwritev(td, uap->fd, auio, offset);
+ free(auio, M_IOV);
+ return (error);
+}
+
+int
linux_mount(struct thread *td, struct linux_mount_args *args)
{
char fstypename[MFSNAMELEN];
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index e61d363..a1fa77b 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -585,10 +585,8 @@ select_out:
int
linux_mremap(struct thread *td, struct linux_mremap_args *args)
{
- struct munmap_args /* {
- void *addr;
- size_t len;
- } */ bsd_args;
+ uintptr_t addr;
+ size_t len;
int error = 0;
#ifdef DEBUG
@@ -623,10 +621,9 @@ linux_mremap(struct thread *td, struct linux_mremap_args *args)
}
if (args->new_len < args->old_len) {
- bsd_args.addr =
- (caddr_t)((uintptr_t)args->addr + args->new_len);
- bsd_args.len = args->old_len - args->new_len;
- error = sys_munmap(td, &bsd_args);
+ addr = args->addr + args->new_len;
+ len = args->old_len - args->new_len;
+ error = kern_munmap(td, addr, len);
}
td->td_retval[0] = error ? 0 : (uintptr_t)args->addr;
@@ -640,13 +637,9 @@ linux_mremap(struct thread *td, struct linux_mremap_args *args)
int
linux_msync(struct thread *td, struct linux_msync_args *args)
{
- struct msync_args bsd_args;
- bsd_args.addr = (caddr_t)(uintptr_t)args->addr;
- bsd_args.len = (uintptr_t)args->len;
- bsd_args.flags = args->fl & ~LINUX_MS_SYNC;
-
- return (sys_msync(td, &bsd_args));
+ return (kern_msync(td, args->addr, args->len,
+ args->fl & ~LINUX_MS_SYNC));
}
int
diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c
index 870f0be..802917f 100644
--- a/sys/compat/linux/linux_mmap.c
+++ b/sys/compat/linux/linux_mmap.c
@@ -41,10 +41,12 @@ __FBSDID("$FreeBSD$");
#include <sys/mman.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
+#include <sys/syscallsubr.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <vm/pmap.h>
+#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <compat/linux/linux_emul.h>
@@ -67,15 +69,7 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
{
struct proc *p = td->td_proc;
struct vmspace *vms = td->td_proc->p_vmspace;
- struct mmap_args /* {
- caddr_t addr;
- size_t len;
- int prot;
- int flags;
- int fd;
- off_t pos;
- } */ bsd_args;
- int error;
+ int bsd_flags, error;
struct file *fp;
cap_rights_t rights;
@@ -83,7 +77,7 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
addr, len, prot, flags, fd, pos);
error = 0;
- bsd_args.flags = 0;
+ bsd_flags = 0;
fp = NULL;
/*
@@ -94,21 +88,21 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
return (EINVAL);
if (flags & LINUX_MAP_SHARED)
- bsd_args.flags |= MAP_SHARED;
+ bsd_flags |= MAP_SHARED;
if (flags & LINUX_MAP_PRIVATE)
- bsd_args.flags |= MAP_PRIVATE;
+ bsd_flags |= MAP_PRIVATE;
if (flags & LINUX_MAP_FIXED)
- bsd_args.flags |= MAP_FIXED;
+ bsd_flags |= MAP_FIXED;
if (flags & LINUX_MAP_ANON) {
/* Enforce pos to be on page boundary, then ignore. */
if ((pos & PAGE_MASK) != 0)
return (EINVAL);
pos = 0;
- bsd_args.flags |= MAP_ANON;
+ bsd_flags |= MAP_ANON;
} else
- bsd_args.flags |= MAP_NOSYNC;
+ bsd_flags |= MAP_NOSYNC;
if (flags & LINUX_MAP_GROWSDOWN)
- bsd_args.flags |= MAP_STACK;
+ bsd_flags |= MAP_STACK;
/*
* PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
@@ -118,14 +112,13 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
*
* XXX. Linux checks that the file system is not mounted with noexec.
*/
- bsd_args.prot = prot;
#if defined(__amd64__)
- linux_fixup_prot(td, &bsd_args.prot);
+ linux_fixup_prot(td, &prot);
#endif
/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
- bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd;
- if (bsd_args.fd != -1) {
+ fd = (bsd_flags & MAP_ANON) ? -1 : fd;
+ if (fd != -1) {
/*
* Linux follows Solaris mmap(2) description:
* The file descriptor fildes is opened with
@@ -133,8 +126,7 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
* protection options specified.
*/
- error = fget(td, bsd_args.fd,
- cap_rights_init(&rights, CAP_MMAP), &fp);
+ error = fget(td, fd, cap_rights_init(&rights, CAP_MMAP), &fp);
if (error != 0)
return (error);
if (fp->f_type != DTYPE_VNODE) {
@@ -205,21 +197,13 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
* we map the full stack, since we don't have a way
* to autogrow it.
*/
- if (len > STACK_SIZE - GUARD_SIZE) {
- bsd_args.addr = (caddr_t)addr;
- bsd_args.len = len;
- } else {
- bsd_args.addr = (caddr_t)addr -
- (STACK_SIZE - GUARD_SIZE - len);
- bsd_args.len = STACK_SIZE - GUARD_SIZE;
+ if (len <= STACK_SIZE - GUARD_SIZE) {
+ addr = addr - (STACK_SIZE - GUARD_SIZE - len);
+ len = STACK_SIZE - GUARD_SIZE;
}
- } else {
- bsd_args.addr = (caddr_t)addr;
- bsd_args.len = len;
}
- bsd_args.pos = pos;
- error = sys_mmap(td, &bsd_args);
+ error = kern_mmap(td, addr, len, prot, bsd_flags, fd, pos);
LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]);
@@ -229,16 +213,11 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
int
linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot)
{
- struct mprotect_args bsd_args;
-
- bsd_args.addr = (void *)addr;
- bsd_args.len = len;
- bsd_args.prot = prot;
#if defined(__amd64__)
- linux_fixup_prot(td, &bsd_args.prot);
+ linux_fixup_prot(td, &prot);
#endif
- return (sys_mprotect(td, &bsd_args));
+ return (kern_mprotect(td, addr, len, prot));
}
#if defined(__amd64__)
diff --git a/sys/compat/svr4/Makefile b/sys/compat/svr4/Makefile
index a90cd55..06cacea 100644
--- a/sys/compat/svr4/Makefile
+++ b/sys/compat/svr4/Makefile
@@ -9,9 +9,5 @@ sysent: svr4_sysent.c svr4_syscall.h svr4_proto.h
svr4_syscallnames.c svr4_sysent.c svr4_syscall.h svr4_proto.h: \
../../kern/makesyscalls.sh syscalls.master syscalls.conf
- -mv -f svr4_syscallnames.c svr4_syscallnames.c.bak
- -mv -f svr4_sysent.c svr4_sysent.c.bak
- -mv -f svr4_syscall.h svr4_syscall.h.bak
- -mv -f svr4_proto.h svr4_proto.h.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
diff --git a/sys/conf/files b/sys/conf/files
index ae4f87d..52cb263 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2556,6 +2556,7 @@ dev/scc/scc_dev_z8530.c optional scc
dev/scd/scd.c optional scd isa
dev/scd/scd_isa.c optional scd isa
dev/sdhci/sdhci.c optional sdhci
+dev/sdhci/sdhci_fdt_gpio.c optional sdhci fdt gpio
dev/sdhci/sdhci_if.m optional sdhci
dev/sdhci/sdhci_acpi.c optional sdhci acpi
dev/sdhci/sdhci_pci.c optional sdhci pci
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 414cdd6..da1b432 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -125,7 +125,6 @@ acpi_wakedata.h optional acpi \
no-obj no-implicit-rule before-depend \
clean "acpi_wakedata.h"
#
-amd64/amd64/amd64_mem.c optional mem
#amd64/amd64/apic_vector.S standard
amd64/amd64/atomic.c standard
amd64/amd64/bios.c standard
@@ -227,6 +226,7 @@ dev/if_ndis/if_ndis.c optional ndis
dev/if_ndis/if_ndis_pccard.c optional ndis pccard
dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci
dev/if_ndis/if_ndis_usb.c optional ndis usb
+dev/intel/spi.c optional intelspi
dev/io/iodev.c optional io
dev/ioat/ioat.c optional ioat pci
dev/ioat/ioat_test.c optional ioat pci
@@ -650,6 +650,7 @@ x86/x86/io_apic.c standard
x86/x86/legacy.c standard
x86/x86/local_apic.c standard
x86/x86/mca.c standard
+x86/x86/x86_mem.c optional mem
x86/x86/mptable.c optional mptable
x86/x86/mptable_pci.c optional mptable pci
x86/x86/mp_x86.c optional smp
diff --git a/sys/conf/files.arm b/sys/conf/files.arm
index d6bd843..a5657bc 100644
--- a/sys/conf/files.arm
+++ b/sys/conf/files.arm
@@ -53,7 +53,8 @@ arm/arm/gdb_machdep.c optional gdb
arm/arm/generic_timer.c optional generic_timer
arm/arm/gic.c optional gic
arm/arm/hdmi_if.m optional hdmi
-arm/arm/identcpu.c standard
+arm/arm/identcpu-v4.c optional !armv6
+arm/arm/identcpu-v6.c optional armv6
arm/arm/in_cksum.c optional inet | inet6
arm/arm/in_cksum_arm.S optional inet | inet6
arm/arm/intr.c optional !intrng
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index 675f008..c9a98a5 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -275,6 +275,7 @@ dev/if_ndis/if_ndis.c optional ndis
dev/if_ndis/if_ndis_pccard.c optional ndis pccard
dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci
dev/if_ndis/if_ndis_usb.c optional ndis usb
+dev/intel/spi.c optional intelspi
dev/io/iodev.c optional io
dev/ipmi/ipmi.c optional ipmi
dev/ipmi/ipmi_acpi.c optional ipmi acpi
@@ -485,7 +486,6 @@ i386/i386/elf_machdep.c standard
i386/i386/exception.s standard
i386/i386/gdb_machdep.c optional gdb
i386/i386/geode.c optional cpu_geode
-i386/i386/i686_mem.c optional mem
i386/i386/in_cksum.c optional inet | inet6
i386/i386/initcpu.c standard
i386/i386/io.c optional io
@@ -528,7 +528,7 @@ i386/ibcs2/ibcs2_xenix.c optional ibcs2
i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2
i386/ibcs2/imgact_coff.c optional ibcs2
i386/isa/elink.c optional ep | ie
-i386/isa/npx.c optional npx
+i386/isa/npx.c standard
i386/isa/pmtimer.c optional pmtimer
i386/isa/prof_machdep.c optional profiling-routine
i386/isa/spic.c optional spic
@@ -624,6 +624,7 @@ x86/x86/io_apic.c optional apic
x86/x86/legacy.c standard
x86/x86/local_apic.c optional apic
x86/x86/mca.c standard
+x86/x86/x86_mem.c optional mem
x86/x86/mptable.c optional apic
x86/x86/mptable_pci.c optional apic pci
x86/x86/mp_x86.c optional smp
diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc
index dc5d52d..d1d5312 100644
--- a/sys/conf/files.powerpc
+++ b/sys/conf/files.powerpc
@@ -63,6 +63,7 @@ dev/ofw/ofw_subr.c optional aim powerpc
dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac
dev/quicc/quicc_bfe_fdt.c optional quicc mpc85xx
dev/scc/scc_bfe_macio.c optional scc powermac
+dev/sdhci/fsl_sdhci.c optional mpc85xx sdhci
dev/sec/sec.c optional sec mpc85xx
dev/sound/macio/aoa.c optional snd_davbus | snd_ai2s powermac
dev/sound/macio/davbus.c optional snd_davbus powermac
@@ -135,7 +136,6 @@ powerpc/mikrotik/platform_rb.c optional mikrotik
powerpc/mpc85xx/atpic.c optional mpc85xx isa
powerpc/mpc85xx/ds1553_bus_fdt.c optional ds1553 fdt
powerpc/mpc85xx/ds1553_core.c optional ds1553
-powerpc/mpc85xx/fsl_sdhc.c optional mpc85xx sdhc | qoriq_dpaa sdhc
powerpc/mpc85xx/i2c.c optional iicbus fdt
powerpc/mpc85xx/isa.c optional mpc85xx isa
powerpc/mpc85xx/lbc.c optional mpc85xx | qoriq_dpaa
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index a16cb03..095b275 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -63,7 +63,7 @@ OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h
.endif
# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build
-WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF}
+WRKDIRPREFIX?= ${.OBJDIR}
PORTSMODULESENV=\
env \
-u CC \
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index e51f82c..6ce0ace 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -50,8 +50,6 @@ CPU_BTB_EN opt_cpu.h
CPU_CYRIX_NO_LOCK opt_cpu.h
CPU_DIRECT_MAPPED_CACHE opt_cpu.h
CPU_DISABLE_5X86_LSSER opt_cpu.h
-CPU_DISABLE_CMPXCHG opt_global.h # XXX global, unlike other CPU_*
-CPU_DISABLE_SSE opt_cpu.h
CPU_ELAN opt_cpu.h
CPU_ELAN_PPS opt_cpu.h
CPU_ELAN_XTAL opt_cpu.h
@@ -113,7 +111,6 @@ NETGRAPH_CRONYX opt_ng_cronyx.h
# Device options
DEV_APIC opt_apic.h
DEV_ATPIC opt_atpic.h
-DEV_NPX opt_npx.h
# Debugging
NPX_DEBUG opt_npx.h
diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h
index a689771..76c8778 100644
--- a/sys/contrib/ipfilter/netinet/ip_compat.h
+++ b/sys/contrib/ipfilter/netinet/ip_compat.h
@@ -165,6 +165,7 @@ struct ether_addr {
# define READ_ENTER(x) rw_rlock(&(x)->ipf_lk)
# define WRITE_ENTER(x) rw_wlock(&(x)->ipf_lk)
# define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk)
+# define MUTEX_TRY_UPGRADE(x) rw_try_upgrade(&(x)->ipf_lk)
# define RWLOCK_INIT(x,y) rw_init(&(x)->ipf_lk, (y))
# define RW_DESTROY(x) rw_destroy(&(x)->ipf_lk)
# define RWLOCK_EXIT(x) do { \
@@ -420,6 +421,8 @@ extern void freembt __P((mb_t *));
# define MUTEX_DOWNGRADE(x) eMrwlock_downgrade(&(x)->ipf_emu, \
__FILE__, __LINE__)
+# define MUTEX_TRY_UPGRADE(x) eMrwlock_try_upgrade(&(x)->ipf_emu, \
+ __FILE__, __LINE__)
# define READ_ENTER(x) eMrwlock_read_enter(&(x)->ipf_emu, \
__FILE__, __LINE__)
# define RWLOCK_INIT(x, y) eMrwlock_init(&(x)->ipf_emu, y)
@@ -670,6 +673,7 @@ extern char *ipf_getifname __P((struct ifnet *, char *));
# define READ_ENTER(x) ;
# define WRITE_ENTER(x) ;
# define MUTEX_DOWNGRADE(x) ;
+# define MUTEX_TRY_UPGRADE(x) ;
# define RWLOCK_INIT(x, y) ;
# define RWLOCK_EXIT(x) ;
# define RW_DESTROY(x) ;
diff --git a/sys/contrib/ipfilter/netinet/ip_frag.c b/sys/contrib/ipfilter/netinet/ip_frag.c
index 2826d67..abb3765 100644
--- a/sys/contrib/ipfilter/netinet/ip_frag.c
+++ b/sys/contrib/ipfilter/netinet/ip_frag.c
@@ -745,7 +745,7 @@ ipf_frag_lookup(softc, softf, fin, table
} else if (off == 0)
f->ipfr_seen0 = 1;
- if (f != table[idx]) {
+ if (f != table[idx] && MUTEX_TRY_UPGRADE(lock)) {
ipfr_t **fp;
/*
@@ -763,6 +763,7 @@ ipf_frag_lookup(softc, softf, fin, table
table[idx]->ipfr_hprev = &f->ipfr_hnext;
f->ipfr_hprev = table + idx;
table[idx] = f;
+ MUTEX_DOWNGRADE(lock);
}
/*
diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c
index ec06b0f..6c2b12c 100644
--- a/sys/contrib/ipfilter/netinet/ip_nat.c
+++ b/sys/contrib/ipfilter/netinet/ip_nat.c
@@ -4704,8 +4704,8 @@ ipf_nat_lookupredir(np)
}
}
- np->nl_realip = nat->nat_ndstip;
- np->nl_realport = nat->nat_ndport;
+ np->nl_realip = nat->nat_odstip;
+ np->nl_realport = nat->nat_odport;
}
}
diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c
index 72931c9..5985d6f 100644
--- a/sys/contrib/ipfilter/netinet/ip_nat6.c
+++ b/sys/contrib/ipfilter/netinet/ip_nat6.c
@@ -2521,8 +2521,8 @@ ipf_nat6_lookupredir(np)
}
}
- np->nl_realip6 = nat->nat_ndst6.in6;
- np->nl_realport = nat->nat_ndport;
+ np->nl_realip6 = nat->nat_odst6.in6;
+ np->nl_realport = nat->nat_odport;
}
}
diff --git a/sys/contrib/vchiq/interface/compat/vchi_bsd.h b/sys/contrib/vchiq/interface/compat/vchi_bsd.h
index d2991a9..107041a 100644
--- a/sys/contrib/vchiq/interface/compat/vchi_bsd.h
+++ b/sys/contrib/vchiq/interface/compat/vchi_bsd.h
@@ -28,8 +28,8 @@
#ifndef __VCHI_BSD_H__
#define __VCHI_BSD_H__
-#include <sys/systm.h>
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/lock.h>
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 00c951f..abcc582 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -703,7 +703,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
sc->cpu_non_c2 = sc->cpu_cx_count;
sc->cpu_non_c3 = sc->cpu_cx_count;
sc->cpu_cx_count++;
- cpu_deepest_sleep = 1;
/*
* The spec says P_BLK must be 6 bytes long. However, some systems
@@ -729,7 +728,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
cx_ptr++;
sc->cpu_non_c3 = sc->cpu_cx_count;
sc->cpu_cx_count++;
- cpu_deepest_sleep = 2;
}
}
if (sc->cpu_p_blk_len < 6)
@@ -746,7 +744,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
cx_ptr++;
sc->cpu_cx_count++;
- cpu_deepest_sleep = 3;
}
}
}
@@ -831,7 +828,6 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc)
cx_ptr->type = ACPI_STATE_C0;
cx_ptr++;
sc->cpu_cx_count++;
- cpu_deepest_sleep = 1;
/* Set up all valid states. */
for (i = 0; i < count; i++) {
@@ -884,8 +880,6 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc)
continue;
case ACPI_STATE_C2:
sc->cpu_non_c3 = sc->cpu_cx_count;
- if (cpu_deepest_sleep < 2)
- cpu_deepest_sleep = 2;
break;
case ACPI_STATE_C3:
default:
@@ -894,8 +888,7 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc)
"acpi_cpu%d: C3[%d] not available.\n",
device_get_unit(sc->cpu_dev), i));
continue;
- } else
- cpu_deepest_sleep = 3;
+ }
break;
}
diff --git a/sys/dev/acpica/acpi_package.c b/sys/dev/acpica/acpi_package.c
index 448d35b..c7e79ab 100644
--- a/sys/dev/acpica/acpi_package.c
+++ b/sys/dev/acpica/acpi_package.c
@@ -50,7 +50,7 @@ acpi_PkgInt(ACPI_OBJECT *res, int idx, UINT64 *dst)
ACPI_OBJECT *obj;
obj = &res->Package.Elements[idx];
- if (obj == NULL || obj->Type != ACPI_TYPE_INTEGER)
+ if (obj->Type != ACPI_TYPE_INTEGER)
return (EINVAL);
*dst = obj->Integer.Value;
diff --git a/sys/dev/advansys/advansys.c b/sys/dev/advansys/advansys.c
index 12ffd81..39c0ad3 100644
--- a/sys/dev/advansys/advansys.c
+++ b/sys/dev/advansys/advansys.c
@@ -233,10 +233,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
break;
}
case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
- case XPT_EN_LUN: /* Enable LUN as a target */
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/aha/aha.c b/sys/dev/aha/aha.c
index 1c767b6..bf55294 100644
--- a/sys/dev/aha/aha.c
+++ b/sys/dev/aha/aha.c
@@ -838,10 +838,6 @@ ahaaction(struct cam_sim *sim, union ccb *ccb)
}
break;
}
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 9bd77b3..80c8e59 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -2570,10 +2570,6 @@ ahciaction(struct cam_sim *sim, union ccb *ccb)
}
ahci_begin_transaction(ch, ccb);
return;
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/aic7xxx/aic79xx.c b/sys/dev/aic7xxx/aic79xx.c
index 76b9c7e..958876a 100644
--- a/sys/dev/aic7xxx/aic79xx.c
+++ b/sys/dev/aic7xxx/aic79xx.c
@@ -9918,7 +9918,8 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb)
u_int our_id;
our_id = ahd->our_id;
- if (ccb->ccb_h.target_id != our_id) {
+ if (ccb->ccb_h.target_id != our_id
+ && ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
if ((ahd->features & AHD_MULTI_TID) != 0
&& (ahd->flags & AHD_INITIATORROLE) != 0) {
/*
diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index daf7aed..ec4908b 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -7347,7 +7347,8 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
else
our_id = ahc->our_id_b;
- if (ccb->ccb_h.target_id != our_id) {
+ if (ccb->ccb_h.target_id != our_id
+ && ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
/*
* our_id represents our initiator ID, or
* the ID of the first target to have an
diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c
index cabb99a..2ec73e0 100644
--- a/sys/dev/arcmsr/arcmsr.c
+++ b/sys/dev/arcmsr/arcmsr.c
@@ -2883,12 +2883,6 @@ static void arcmsr_action(struct cam_sim *psim, union ccb *pccb)
}
break;
}
- case XPT_TARGET_IO: {
- /* target mode not yet support vendor specific commands. */
- pccb->ccb_h.status |= CAM_REQ_CMP;
- xpt_done(pccb);
- break;
- }
case XPT_PATH_INQ: {
struct ccb_pathinq *cpi = &pccb->cpi;
@@ -2938,7 +2932,6 @@ static void arcmsr_action(struct cam_sim *psim, union ccb *pccb)
pabort_ccb = pccb->cab.abort_ccb;
switch (pabort_ccb->ccb_h.func_code) {
case XPT_ACCEPT_TARGET_IO:
- case XPT_IMMED_NOTIFY:
case XPT_CONT_TARGET_IO:
if(arcmsr_seek_cmd2abort(pabort_ccb)==TRUE) {
pabort_ccb->ccb_h.status |= CAM_REQ_ABORTED;
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 889c37b..be108b2 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -1013,10 +1013,6 @@ ataaction(struct cam_sim *sim, union ccb *ccb)
}
ata_cam_begin_transaction(dev, ccb);
return;
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index e5f9838..7cafe37 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -3194,7 +3194,7 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, int nfingers,
if (sc->synhw.capClickPad && ms->button & MOUSE_BUTTON1DOWN) {
y_ok = sc->syninfo.softbuttons_y >= 0 ?
start_y < sc->syninfo.softbuttons_y :
- start_y > max_y - sc->syninfo.softbuttons_y;
+ start_y > max_y + sc->syninfo.softbuttons_y;
center_button = MOUSE_BUTTON2DOWN;
center_x = sc->syninfo.softbutton2_x;
diff --git a/sys/dev/buslogic/bt.c b/sys/dev/buslogic/bt.c
index b0a0d91..537d567 100644
--- a/sys/dev/buslogic/bt.c
+++ b/sys/dev/buslogic/bt.c
@@ -1233,10 +1233,6 @@ btaction(struct cam_sim *sim, union ccb *ccb)
}
break;
}
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/chromebook_platform/chromebook_platform.c b/sys/dev/chromebook_platform/chromebook_platform.c
index 5cfeb9c..a7b266a 100644
--- a/sys/dev/chromebook_platform/chromebook_platform.c
+++ b/sys/dev/chromebook_platform/chromebook_platform.c
@@ -69,7 +69,7 @@ chromebook_i2c_identify(driver_t *driver, device_t bus)
* See http://lxr.free-electrons.com/source/drivers/platform/chrome/chromeos_laptop.c
*/
controller = device_get_parent(bus);
- if (strcmp(device_get_name(controller), "ig4iic") != 0)
+ if (strcmp(device_get_name(controller), "ig4iic_pci") != 0)
return;
for (i = 0; i < nitems(slaves); i++) {
diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c
index 0077c78..2097871 100644
--- a/sys/dev/cxgbe/iw_cxgbe/cm.c
+++ b/sys/dev/cxgbe/iw_cxgbe/cm.c
@@ -92,9 +92,7 @@ static void *alloc_ep(int size, gfp_t flags);
void __free_ep(struct c4iw_ep_common *epc);
static int find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
__be16 peer_port, u8 tos, struct nhop4_extended *pnh4);
-static int close_socket(struct c4iw_ep_common *epc, int close);
-static int shutdown_socket(struct c4iw_ep_common *epc);
-static void abort_socket(struct c4iw_ep *ep);
+static void close_socket(struct socket *so);
static int send_mpa_req(struct c4iw_ep *ep);
static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen);
static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen);
@@ -111,7 +109,8 @@ static void process_peer_close(struct c4iw_ep *ep);
static void process_conn_error(struct c4iw_ep *ep);
static void process_close_complete(struct c4iw_ep *ep);
static void ep_timeout(unsigned long arg);
-static void init_sock(struct c4iw_ep_common *epc);
+static void init_iwarp_socket(struct socket *so, void *arg);
+static void uninit_iwarp_socket(struct socket *so);
static void process_data(struct c4iw_ep *ep);
static void process_connected(struct c4iw_ep *ep);
static int c4iw_so_upcall(struct socket *so, void *arg, int waitflag);
@@ -319,87 +318,12 @@ find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
return err;
}
-static int
-close_socket(struct c4iw_ep_common *epc, int close)
-{
- struct socket *so = epc->so;
- int rc;
-
- CTR5(KTR_IW_CXGBE, "%s:csoB so %p, ep %p, state %s, tid %d", __func__,
- so, epc, states[epc->state],
- ((struct c4iw_ep *)epc)->hwtid);
- mutex_lock(&epc->so_mutex);
- if ((so == NULL) || (so->so_count == 0)) {
- mutex_unlock(&epc->so_mutex);
- CTR5(KTR_IW_CXGBE, "%s:cso1 so %p, ep %p, state %s, tid %d",
- __func__, so, epc, states[epc->state],
- ((struct c4iw_ep *)epc)->hwtid);
- return -EINVAL;
- }
-
- SOCK_LOCK(so);
- soupcall_clear(so, SO_RCV);
- SOCK_UNLOCK(so);
-
- if (close)
- rc = soclose(so);
- else
- rc = soshutdown(so, SHUT_WR | SHUT_RD);
- epc->so = NULL;
-
- mutex_unlock(&epc->so_mutex);
- return (rc);
-}
-
-static int
-shutdown_socket(struct c4iw_ep_common *epc)
-{
-
- struct socket *so = epc->so;
- int rc;
-
- CTR5(KTR_IW_CXGBE, "%s:ssoB so %p, ep %p, state %s, tid %d", __func__,
- epc->so, epc, states[epc->state],
- ((struct c4iw_ep *)epc)->hwtid);
- mutex_lock(&epc->so_mutex);
- if ((so == NULL) || (so->so_count == 0)) {
- mutex_unlock(&epc->so_mutex);
- CTR5(KTR_IW_CXGBE, "%s:sso1 so %p, ep %p, state %s, tid %d",
- __func__, epc->so, epc, states[epc->state],
- ((struct c4iw_ep *)epc)->hwtid);
- return -EINVAL;
- }
- rc = soshutdown(so, SHUT_WR);
- mutex_unlock(&epc->so_mutex);
- return rc;
-}
-
static void
-abort_socket(struct c4iw_ep *ep)
+close_socket(struct socket *so)
{
- struct sockopt sopt;
- int rc;
- struct linger l;
-
- CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep,
- ep->com.so, states[ep->com.state], ep->hwtid);
- mutex_lock(&ep->com.so_mutex);
- l.l_onoff = 1;
- l.l_linger = 0;
- /* linger_time of 0 forces RST to be sent */
- sopt.sopt_dir = SOPT_SET;
- sopt.sopt_level = SOL_SOCKET;
- sopt.sopt_name = SO_LINGER;
- sopt.sopt_val = (caddr_t)&l;
- sopt.sopt_valsize = sizeof l;
- sopt.sopt_td = NULL;
- rc = sosetopt(ep->com.so, &sopt);
- if (rc) {
- log(LOG_ERR, "%s: can't set linger to 0, no RST! err %d\n",
- __func__, rc);
- }
- mutex_unlock(&ep->com.so_mutex);
+ uninit_iwarp_socket(so);
+ sodisconnect(so);
}
static void
@@ -429,7 +353,7 @@ process_peer_close(struct c4iw_ep *ep)
disconnect = 0;
STOP_EP_TIMER(ep);
- close_socket(&ep->com, 0);
+ close_socket(ep->com.so);
deref_cm_id(&ep->com);
release = 1;
break;
@@ -486,7 +410,7 @@ process_peer_close(struct c4iw_ep *ep)
c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
}
- close_socket(&ep->com, 0);
+ close_socket(ep->com.so);
close_complete_upcall(ep, 0);
__state_set(&ep->com, DEAD);
release = 1;
@@ -595,14 +519,7 @@ process_conn_error(struct c4iw_ep *ep)
}
if (state != ABORTING) {
- if (ep->parent_ep) {
- CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep);
- close_socket(&ep->com, 1);
- } else {
- CTR2(KTR_IW_CXGBE, "%s:pce2 %p", __func__, ep);
- close_socket(&ep->com, 0);
- }
-
+ close_socket(ep->com.so);
__state_set(&ep->com, DEAD);
c4iw_put_ep(&ep->com);
}
@@ -648,16 +565,7 @@ process_close_complete(struct c4iw_ep *ep)
&attrs, 1);
}
- if (ep->parent_ep) {
-
- CTR2(KTR_IW_CXGBE, "%s:pcc3 %p", __func__, ep);
- close_socket(&ep->com, 1);
- }
- else {
-
- CTR2(KTR_IW_CXGBE, "%s:pcc4 %p", __func__, ep);
- close_socket(&ep->com, 0);
- }
+ close_socket(ep->com.so);
close_complete_upcall(ep, 0);
__state_set(&ep->com, DEAD);
release = 1;
@@ -688,23 +596,15 @@ process_close_complete(struct c4iw_ep *ep)
}
static void
-init_sock(struct c4iw_ep_common *epc)
+init_iwarp_socket(struct socket *so, void *arg)
{
int rc;
struct sockopt sopt;
- struct socket *so = epc->so;
int on = 1;
- mutex_lock(&epc->so_mutex);
- if ((so == NULL) || (so->so_count == 0)) {
- mutex_unlock(&epc->so_mutex);
- CTR5(KTR_IW_CXGBE, "%s:iso1 so %p, ep %p, state %s, tid %d",
- __func__, so, epc, states[epc->state],
- ((struct c4iw_ep *)epc)->hwtid);
- return;
- }
+ /* Note that SOCK_LOCK(so) is same as SOCKBUF_LOCK(&so->so_rcv) */
SOCK_LOCK(so);
- soupcall_set(so, SO_RCV, c4iw_so_upcall, epc);
+ soupcall_set(so, SO_RCV, c4iw_so_upcall, arg);
so->so_state |= SS_NBIO;
SOCK_UNLOCK(so);
sopt.sopt_dir = SOPT_SET;
@@ -718,7 +618,15 @@ init_sock(struct c4iw_ep_common *epc)
log(LOG_ERR, "%s: can't set TCP_NODELAY on so %p (%d)\n",
__func__, so, rc);
}
- mutex_unlock(&epc->so_mutex);
+}
+
+static void
+uninit_iwarp_socket(struct socket *so)
+{
+
+ SOCKBUF_LOCK(&so->so_rcv);
+ soupcall_clear(so, SO_RCV);
+ SOCKBUF_UNLOCK(&so->so_rcv);
}
static void
@@ -759,18 +667,18 @@ process_data(struct c4iw_ep *ep)
static void
process_connected(struct c4iw_ep *ep)
{
+ struct socket *so = ep->com.so;
- if ((ep->com.so->so_state & SS_ISCONNECTED) && !ep->com.so->so_error) {
+ if ((so->so_state & SS_ISCONNECTED) && !so->so_error) {
if (send_mpa_req(ep))
goto err;
- }
- else {
- connect_reply_upcall(ep, -ep->com.so->so_error);
+ } else {
+ connect_reply_upcall(ep, -so->so_error);
goto err;
}
return;
err:
- close_socket(&ep->com, 0);
+ close_socket(so);
state_set(&ep->com, DEAD);
c4iw_put_ep(&ep->com);
return;
@@ -785,23 +693,9 @@ process_newconn(struct iw_cm_id *parent_cm_id, struct socket *child_so)
struct c4iw_ep *parent_ep = parent_cm_id->provider_data;
int ret = 0;
- if (!child_so) {
- CTR4(KTR_IW_CXGBE,
- "%s: parent so %p, parent ep %p, child so %p, invalid so",
- __func__, parent_ep->com.so, parent_ep, child_so);
- log(LOG_ERR, "%s: invalid child socket\n", __func__);
- return;
- }
- child_ep = alloc_ep(sizeof(*child_ep), M_NOWAIT);
- if (!child_ep) {
- CTR3(KTR_IW_CXGBE, "%s: parent so %p, parent ep %p, ENOMEM",
- __func__, parent_ep->com.so, parent_ep);
- log(LOG_ERR, "%s: failed to allocate ep entry\n", __func__);
- return;
- }
- SOCKBUF_LOCK(&child_so->so_rcv);
- soupcall_set(child_so, SO_RCV, c4iw_so_upcall, child_ep);
- SOCKBUF_UNLOCK(&child_so->so_rcv);
+ MPASS(child_so != NULL);
+
+ child_ep = alloc_ep(sizeof(*child_ep), M_WAITOK);
CTR5(KTR_IW_CXGBE,
"%s: parent so %p, parent ep %p, child so %p, child ep %p",
@@ -821,6 +715,7 @@ process_newconn(struct iw_cm_id *parent_cm_id, struct socket *child_so)
free(local, M_SONAME);
free(remote, M_SONAME);
+ init_iwarp_socket(child_so, &child_ep->com);
c4iw_get_ep(&parent_ep->com);
init_timer(&child_ep->timer);
state_set(&child_ep->com, MPA_REQ_WAIT);
@@ -1038,7 +933,6 @@ alloc_ep(int size, gfp_t gfp)
kref_init(&epc->kref);
mutex_init(&epc->mutex);
- mutex_init(&epc->so_mutex);
c4iw_init_wr_wait(&epc->wr_wait);
return (epc);
@@ -1359,30 +1253,47 @@ static void close_complete_upcall(struct c4iw_ep *ep, int status)
CTR2(KTR_IW_CXGBE, "%s:ccuE %p", __func__, ep);
}
-static int send_abort(struct c4iw_ep *ep)
+static int
+send_abort(struct c4iw_ep *ep)
{
- int err;
+ struct socket *so = ep->com.so;
+ struct sockopt sopt;
+ int rc;
+ struct linger l;
- CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep);
- abort_socket(ep);
+ CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep, so,
+ states[ep->com.state], ep->hwtid);
- /*
- * Since socket options were set as l_onoff=1 and l_linger=0 in in
- * abort_socket, invoking soclose here sends a RST (reset) to the peer.
- */
- err = close_socket(&ep->com, 1);
+ l.l_onoff = 1;
+ l.l_linger = 0;
+
+ /* linger_time of 0 forces RST to be sent */
+ sopt.sopt_dir = SOPT_SET;
+ sopt.sopt_level = SOL_SOCKET;
+ sopt.sopt_name = SO_LINGER;
+ sopt.sopt_val = (caddr_t)&l;
+ sopt.sopt_valsize = sizeof l;
+ sopt.sopt_td = NULL;
+ rc = sosetopt(so, &sopt);
+ if (rc != 0) {
+ log(LOG_ERR, "%s: sosetopt(%p, linger = 0) failed with %d.\n",
+ __func__, so, rc);
+ }
+
+ uninit_iwarp_socket(so);
+ sodisconnect(so);
set_bit(ABORT_CONN, &ep->com.history);
- CTR2(KTR_IW_CXGBE, "%s:abE %p", __func__, ep);
/*
- * TBD: iw_cgbe driver should receive ABORT reply for every ABORT
+ * TBD: iw_cxgbe driver should receive ABORT reply for every ABORT
* request it has sent. But the current TOE driver is not propagating
* this ABORT reply event (via do_abort_rpl) to iw_cxgbe. So as a work-
* around de-refer 'ep' (which was refered before sending ABORT request)
* here instead of doing it in abort_rpl() handler of iw_cxgbe driver.
*/
c4iw_put_ep(&ep->com);
- return err;
+
+ return (0);
}
static void peer_close_upcall(struct c4iw_ep *ep)
@@ -2213,7 +2124,6 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_ep *ep = NULL;
struct nhop4_extended nh4;
- struct toedev *tdev;
CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id);
@@ -2266,8 +2176,6 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ep->com.thread = curthread;
ep->com.so = cm_id->so;
- init_sock(&ep->com);
-
/* find a route */
err = find_route(
cm_id->local_addr.sin_addr.s_addr,
@@ -2283,22 +2191,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
goto fail2;
}
- if (!(nh4.nh_ifp->if_capenable & IFCAP_TOE)) {
-
- CTR2(KTR_IW_CXGBE, "%s:cc8 %p", __func__, ep);
- printf("%s - interface not TOE capable.\n", __func__);
- close_socket(&ep->com, 0);
+ if (!(nh4.nh_ifp->if_capenable & IFCAP_TOE) ||
+ TOEDEV(nh4.nh_ifp) == NULL) {
err = -ENOPROTOOPT;
goto fail3;
}
- tdev = TOEDEV(nh4.nh_ifp);
-
- if (tdev == NULL) {
-
- CTR2(KTR_IW_CXGBE, "%s:cc9 %p", __func__, ep);
- printf("%s - No toedev for interface.\n", __func__);
- goto fail3;
- }
fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
state_set(&ep->com, CONNECTING);
@@ -2309,19 +2206,18 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ep->com.thread);
if (!err) {
- CTR2(KTR_IW_CXGBE, "%s:cca %p", __func__, ep);
+ init_iwarp_socket(cm_id->so, &ep->com);
goto out;
} else {
- close_socket(&ep->com, 0);
goto fail2;
}
fail3:
- CTR2(KTR_IW_CXGBE, "%s:ccb %p", __func__, ep);
fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
fail2:
deref_cm_id(&ep->com);
c4iw_put_ep(&ep->com);
+ ep = NULL; /* CTR shouldn't display already-freed ep. */
out:
CTR2(KTR_IW_CXGBE, "%s:ccE %p", __func__, ep);
return err;
@@ -2465,7 +2361,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
if (!ep->parent_ep)
__state_set(&ep->com, MORIBUND);
- ret = shutdown_socket(&ep->com);
+ ret = sodisconnect(ep->com.so);
}
if (ret) {
diff --git a/sys/dev/cxgbe/iw_cxgbe/cq.c b/sys/dev/cxgbe/iw_cxgbe/cq.c
index 5c040e9..54eb026 100644
--- a/sys/dev/cxgbe/iw_cxgbe/cq.c
+++ b/sys/dev/cxgbe/iw_cxgbe/cq.c
@@ -450,6 +450,15 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,
}
/*
+ * Special cqe for drain WR completions...
+ */
+ if (CQE_OPCODE(hw_cqe) == C4IW_DRAIN_OPCODE) {
+ *cookie = CQE_DRAIN_COOKIE(hw_cqe);
+ *cqe = *hw_cqe;
+ goto skip_cqe;
+ }
+
+ /*
* Gotta tweak READ completions:
* 1) the cqe doesn't contain the sq_wptr from the wr.
* 2) opcode not reflected from the wr.
@@ -665,6 +674,9 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
case FW_RI_FAST_REGISTER:
wc->opcode = IB_WC_FAST_REG_MR;
break;
+ case C4IW_DRAIN_OPCODE:
+ wc->opcode = IB_WC_SEND;
+ break;
default:
printf("Unexpected opcode %d "
"in the CQE received for QPID = 0x%0x\n",
diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
index 2374a39..de27d5d 100644
--- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
+++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
@@ -559,6 +559,8 @@ static inline int to_ib_qp_state(int c4iw_qp_state)
return IB_QPS_ERR;
}
+#define C4IW_DRAIN_OPCODE FW_RI_SGE_EC_CR_RETURN
+
static inline u32 c4iw_ib_to_tpt_access(int a)
{
return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) |
@@ -754,7 +756,6 @@ struct c4iw_ep_common {
int rpl_done;
struct thread *thread;
struct socket *so;
- struct mutex so_mutex;
};
struct c4iw_listen_ep {
diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c
index f7e90a5..5f68fbf 100644
--- a/sys/dev/cxgbe/iw_cxgbe/mem.c
+++ b/sys/dev/cxgbe/iw_cxgbe/mem.c
@@ -341,9 +341,6 @@ static int build_phys_page_list(struct ib_phys_buf *buffer_list,
PAGE_SIZE - 1) & PAGE_MASK;
}
- if (*total_size > 0xFFFFFFFFULL)
- return -ENOMEM;
-
/* Find largest page shift we can use to cover buffers */
for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift))
if ((1ULL << *shift) & mask)
diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c
index 4dc2fba..58a89c5 100644
--- a/sys/dev/cxgbe/iw_cxgbe/qp.c
+++ b/sys/dev/cxgbe/iw_cxgbe/qp.c
@@ -577,6 +577,66 @@ void c4iw_qp_rem_ref(struct ib_qp *qp)
wake_up(&(to_c4iw_qp(qp)->wait));
}
+static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr)
+{
+ struct t4_cqe cqe = {};
+ struct c4iw_cq *schp;
+ unsigned long flag;
+ struct t4_cq *cq;
+
+ schp = to_c4iw_cq(qhp->ibqp.send_cq);
+ cq = &schp->cq;
+
+ PDBG("%s drain sq id %u\n", __func__, qhp->wq.sq.qid);
+ cqe.u.drain_cookie = wr->wr_id;
+ cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) |
+ V_CQE_OPCODE(C4IW_DRAIN_OPCODE) |
+ V_CQE_TYPE(1) |
+ V_CQE_SWCQE(1) |
+ V_CQE_QPID(qhp->wq.sq.qid));
+
+ spin_lock_irqsave(&schp->lock, flag);
+ cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen));
+ cq->sw_queue[cq->sw_pidx] = cqe;
+ t4_swcq_produce(cq);
+ spin_unlock_irqrestore(&schp->lock, flag);
+
+ spin_lock_irqsave(&schp->comp_handler_lock, flag);
+ (*schp->ibcq.comp_handler)(&schp->ibcq,
+ schp->ibcq.cq_context);
+ spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
+}
+
+static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr)
+{
+ struct t4_cqe cqe = {};
+ struct c4iw_cq *rchp;
+ unsigned long flag;
+ struct t4_cq *cq;
+
+ rchp = to_c4iw_cq(qhp->ibqp.recv_cq);
+ cq = &rchp->cq;
+
+ PDBG("%s drain rq id %u\n", __func__, qhp->wq.sq.qid);
+ cqe.u.drain_cookie = wr->wr_id;
+ cqe.header = cpu_to_be32(V_CQE_STATUS(T4_ERR_SWFLUSH) |
+ V_CQE_OPCODE(C4IW_DRAIN_OPCODE) |
+ V_CQE_TYPE(0) |
+ V_CQE_SWCQE(1) |
+ V_CQE_QPID(qhp->wq.sq.qid));
+
+ spin_lock_irqsave(&rchp->lock, flag);
+ cqe.bits_type_ts = cpu_to_be64(V_CQE_GENBIT((u64)cq->gen));
+ cq->sw_queue[cq->sw_pidx] = cqe;
+ t4_swcq_produce(cq);
+ spin_unlock_irqrestore(&rchp->lock, flag);
+
+ spin_lock_irqsave(&rchp->comp_handler_lock, flag);
+ (*rchp->ibcq.comp_handler)(&rchp->ibcq,
+ rchp->ibcq.cq_context);
+ spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
+}
+
int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
struct ib_send_wr **bad_wr)
{
@@ -595,7 +655,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
spin_lock_irqsave(&qhp->lock, flag);
if (t4_wq_in_error(&qhp->wq)) {
spin_unlock_irqrestore(&qhp->lock, flag);
- return -EINVAL;
+ complete_sq_drain_wr(qhp, wr);
+ return err;
}
num_wrs = t4_sq_avail(&qhp->wq);
if (num_wrs == 0) {
@@ -708,7 +769,8 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
spin_lock_irqsave(&qhp->lock, flag);
if (t4_wq_in_error(&qhp->wq)) {
spin_unlock_irqrestore(&qhp->lock, flag);
- return -EINVAL;
+ complete_rq_drain_wr(qhp, wr);
+ return err;
}
num_wrs = t4_rq_avail(&qhp->wq);
if (num_wrs == 0) {
@@ -1303,7 +1365,12 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
}
break;
case C4IW_QP_STATE_CLOSING:
- if (!internal) {
+
+ /*
+ * Allow kernel users to move to ERROR for qp draining.
+ */
+ if (!internal && (qhp->ibqp.uobject || attrs->next_state !=
+ C4IW_QP_STATE_ERROR)) {
ret = -EINVAL;
goto out;
}
diff --git a/sys/dev/cxgbe/iw_cxgbe/t4.h b/sys/dev/cxgbe/iw_cxgbe/t4.h
index 4219fd0..baab4d0 100644
--- a/sys/dev/cxgbe/iw_cxgbe/t4.h
+++ b/sys/dev/cxgbe/iw_cxgbe/t4.h
@@ -203,6 +203,7 @@ struct t4_cqe {
__be32 wrid_hi;
__be32 wrid_low;
} gen;
+ u64 drain_cookie;
} u;
__be64 reserved;
__be64 bits_type_ts;
@@ -261,6 +262,7 @@ struct t4_cqe {
/* generic accessor macros */
#define CQE_WRID_HI(x) ((x)->u.gen.wrid_hi)
#define CQE_WRID_LOW(x) ((x)->u.gen.wrid_low)
+#define CQE_DRAIN_COOKIE(x) (x)->u.drain_cookie;
/* macros for flit 3 of the cqe */
#define S_CQE_GENBIT 63
diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c
index ef5256f..374ce96 100644
--- a/sys/dev/e1000/if_igb.c
+++ b/sys/dev/e1000/if_igb.c
@@ -3182,7 +3182,7 @@ igb_setup_interface(device_t dev, struct adapter *adapter)
#else
ifp->if_start = igb_start;
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1);
- ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1;
+ ifp->if_snd.ifq_drv_maxlen = 0;
IFQ_SET_READY(&ifp->if_snd);
#endif
diff --git a/sys/dev/ffec/if_ffecreg.h b/sys/dev/ffec/if_ffecreg.h
index 2233df7..bc44af3 100644
--- a/sys/dev/ffec/if_ffecreg.h
+++ b/sys/dev/ffec/if_ffecreg.h
@@ -186,6 +186,27 @@ __FBSDID("$FreeBSD$");
#define FEC_RACC_PADREM (1 << 0)
/*
+ * IEEE-1588 timer registers
+ */
+
+#define FEC_ATCR_REG 0x0400
+#define FEC_ATCR_SLAVE (1u << 13)
+#define FEC_ATCR_CAPTURE (1u << 11)
+#define FEC_ATCR_RESTART (1u << 9)
+#define FEC_ATCR_PINPER (1u << 7)
+#define FEC_ATCR_PEREN (1u << 4)
+#define FEC_ATCR_OFFRST (1u << 3)
+#define FEC_ATCR_OFFEN (1u << 2)
+#define FEC_ATCR_EN (1u << 0)
+
+#define FEC_ATVR_REG 0x0404
+#define FEC_ATOFF_REG 0x0408
+#define FEC_ATPER_REG 0x040c
+#define FEC_ATCOR_REG 0x0410
+#define FEC_ATINC_REG 0x0414
+#define FEC_ATSTMP_REG 0x0418
+
+/*
* Statistics registers
*/
#define FEC_RMON_T_DROP 0x200
diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index 0d8fc54..c74d651 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -2367,6 +2367,11 @@ END_DEBUG
xpt_done(ccb);
return;
}
+ if (csio->cdb_len > sizeof(ocb->orb) - 5 * sizeof(uint32_t)) {
+ ccb->ccb_h.status = CAM_REQ_INVALID;
+ xpt_done(ccb);
+ return;
+ }
#if 0
/* if we are in probe stage, pass only probe commands */
if (sdev->status == SBP_DEV_PROBE) {
diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c
index 27e9843..7109765 100644
--- a/sys/dev/firewire/sbp_targ.c
+++ b/sys/dev/firewire/sbp_targ.c
@@ -1324,7 +1324,8 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb)
| PIT_DISCONNECT
| PIT_TERM_IO;
cpi->transport = XPORT_SPI; /* FIXME add XPORT_FW type to cam */
- cpi->hba_misc = PIM_NOBUSRESET | PIM_NO_6_BYTE;
+ cpi->hba_misc = PIM_NOINITIATOR | PIM_NOBUSRESET |
+ PIM_NO_6_BYTE;
cpi->hba_eng_cnt = 0;
cpi->max_target = 7; /* XXX */
cpi->max_lun = MAX_LUN - 1;
diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c
index 96775dc..aa9ce07 100644
--- a/sys/dev/gpio/ofw_gpiobus.c
+++ b/sys/dev/gpio/ofw_gpiobus.c
@@ -176,9 +176,10 @@ gpio_pin_is_active(gpio_pin_t pin, bool *active)
return (rv);
}
- *active = tmp != 0;
if (pin->flags & GPIO_ACTIVE_LOW)
- *active = !(*active);
+ *active = tmp == 0;
+ else
+ *active = tmp != 0;
return (0);
}
diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
index 5dbf33d..9d4f461 100644
--- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
+++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c
@@ -297,7 +297,7 @@ static int hpt_flush_vdev(PVBUS_EXT vbus_ext, PVDEV vd)
hpt_lock_vbus(vbus_ext);
if (mIsArray(vd->type) && vd->u.array.transform)
- count = MAX(vd->u.array.transform->source->cmds_per_request,
+ count = max(vd->u.array.transform->source->cmds_per_request,
vd->u.array.transform->target->cmds_per_request);
else
count = vd->cmds_per_request;
diff --git a/sys/dev/hpt27xx/ldm.h b/sys/dev/hpt27xx/ldm.h
index 58cddad..defa459 100644
--- a/sys/dev/hpt27xx/ldm.h
+++ b/sys/dev/hpt27xx/ldm.h
@@ -59,10 +59,6 @@ extern "C" {
#error "Please redefine MAX_PARTITIONS_PER_DISK!!!"
#endif
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-
typedef char check_HPT_TIME_is_unsigned[ (HPT_TIME)(-1) > 0 ? 1 : -1 ];
#define hpt_time_after_eq(a, b) ((int)(a) - (int)(b) >= 0)
diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c
index a3ef364..93d6549 100644
--- a/sys/dev/hptmv/entry.c
+++ b/sys/dev/hptmv/entry.c
@@ -2289,10 +2289,6 @@ hpt_action(struct cam_sim *sim, union ccb *ccb)
break;
case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
case XPT_TERM_IO: /* Terminate the I/O process */
/* XXX Implement */
diff --git a/sys/dev/hptnr/hptnr_osm_bsd.c b/sys/dev/hptnr/hptnr_osm_bsd.c
index 214303d..eeaf667 100644
--- a/sys/dev/hptnr/hptnr_osm_bsd.c
+++ b/sys/dev/hptnr/hptnr_osm_bsd.c
@@ -294,7 +294,7 @@ static int hpt_flush_vdev(PVBUS_EXT vbus_ext, PVDEV vd)
hpt_assert_vbus_locked(vbus_ext);
if (mIsArray(vd->type) && vd->u.array.transform)
- count = MAX(vd->u.array.transform->source->cmds_per_request,
+ count = max(vd->u.array.transform->source->cmds_per_request,
vd->u.array.transform->target->cmds_per_request);
else
count = vd->cmds_per_request;
diff --git a/sys/dev/hptnr/ldm.h b/sys/dev/hptnr/ldm.h
index 087cb20..a8f2991 100644
--- a/sys/dev/hptnr/ldm.h
+++ b/sys/dev/hptnr/ldm.h
@@ -58,9 +58,6 @@ extern "C" {
#error "Please redefine MAX_PARTITIONS_PER_DISK!!!"
#endif
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
typedef char check_HPT_TIME_is_unsigned[ (HPT_TIME)(-1) > 0 ? 1 : -1 ];
diff --git a/sys/dev/hptrr/hptrr_osm_bsd.c b/sys/dev/hptrr/hptrr_osm_bsd.c
index b5e718a..83c6493 100644
--- a/sys/dev/hptrr/hptrr_osm_bsd.c
+++ b/sys/dev/hptrr/hptrr_osm_bsd.c
@@ -300,7 +300,7 @@ static int hpt_flush_vdev(PVBUS_EXT vbus_ext, PVDEV vd)
hpt_assert_vbus_locked(vbus_ext);
if (mIsArray(vd->type) && vd->u.array.transform)
- count = MAX(vd->u.array.transform->source->cmds_per_request,
+ count = max(vd->u.array.transform->source->cmds_per_request,
vd->u.array.transform->target->cmds_per_request);
else
count = vd->cmds_per_request;
diff --git a/sys/dev/hptrr/ldm.h b/sys/dev/hptrr/ldm.h
index 93a92fa..1ec3427 100644
--- a/sys/dev/hptrr/ldm.h
+++ b/sys/dev/hptrr/ldm.h
@@ -58,10 +58,6 @@ extern "C" {
#error "Please redefine MAX_PARTITIONS_PER_DISK!!!"
#endif
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-
-
typedef char check_HPT_TIME_is_unsigned[ (HPT_TIME)(-1) > 0 ? 1 : -1 ];
#define hpt_time_after_eq(a, b) ((long)(a) - (long)(b) >= 0)
diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
new file mode 100644
index 0000000..9b229bb
--- /dev/null
+++ b/sys/dev/intel/spi.c
@@ -0,0 +1,533 @@
+/*-
+ * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_acpi.h"
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/proc.h>
+#include <sys/rman.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <dev/spibus/spi.h>
+#include <dev/spibus/spibusvar.h>
+
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+
+#include <dev/acpica/acpivar.h>
+
+#include "spibus_if.h"
+
+/**
+ * Macros for driver mutex locking
+ */
+#define INTELSPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
+#define INTELSPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
+#define INTELSPI_LOCK_INIT(_sc) \
+ mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
+ "intelspi", MTX_DEF)
+#define INTELSPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
+#define INTELSPI_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
+#define INTELSPI_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
+
+#define INTELSPI_WRITE(_sc, _off, _val) \
+ bus_write_4((_sc)->sc_mem_res, (_off), (_val))
+#define INTELSPI_READ(_sc, _off) \
+ bus_read_4((_sc)->sc_mem_res, (_off))
+
+#define INTELSPI_BUSY 0x1
+#define TX_FIFO_THRESHOLD 2
+#define RX_FIFO_THRESHOLD 2
+#define CLOCK_DIV_10MHZ 5
+#define DATA_SIZE_8BITS 8
+
+#define CS_LOW 0
+#define CS_HIGH 1
+
+#define INTELSPI_SSPREG_SSCR0 0x0
+#define SSCR0_SCR(n) (((n) - 1) << 8)
+#define SSCR0_SSE (1 << 7)
+#define SSCR0_FRF_SPI (0 << 4)
+#define SSCR0_DSS(n) (((n) - 1) << 0)
+#define INTELSPI_SSPREG_SSCR1 0x4
+#define SSCR1_TINTE (1 << 19)
+#define SSCR1_RFT(n) (((n) - 1) << 10)
+#define SSCR1_RFT_MASK (0xf << 10)
+#define SSCR1_TFT(n) (((n) - 1) << 6)
+#define SSCR1_SPI_SPH (1 << 4)
+#define SSCR1_SPI_SPO (1 << 3)
+#define SSCR1_MODE_MASK (SSCR1_SPI_SPO | SSCR1_SPI_SPH)
+#define SSCR1_MODE_0 (0)
+#define SSCR1_MODE_1 (SSCR1_SPI_SPH)
+#define SSCR1_MODE_2 (SSCR1_SPI_SPO)
+#define SSCR1_MODE_3 (SSCR1_SPI_SPO | SSCR1_SPI_SPH)
+#define SSCR1_TIE (1 << 1)
+#define SSCR1_RIE (1 << 0)
+#define INTELSPI_SSPREG_SSSR 0x8
+#define SSSR_RFL_MASK (0xf << 12)
+#define SSSR_TFL_MASK (0xf << 8)
+#define SSSR_RNE (1 << 3)
+#define SSSR_TNF (1 << 2)
+#define INTELSPI_SSPREG_SSITR 0xC
+#define INTELSPI_SSPREG_SSDR 0x10
+#define INTELSPI_SSPREG_SSTO 0x28
+#define INTELSPI_SSPREG_SSPSP 0x2C
+#define INTELSPI_SSPREG_SSTSA 0x30
+#define INTELSPI_SSPREG_SSRSA 0x34
+#define INTELSPI_SSPREG_SSTSS 0x38
+#define INTELSPI_SSPREG_SSACD 0x3C
+#define INTELSPI_SSPREG_ITF 0x40
+#define INTELSPI_SSPREG_SITF 0x44
+#define INTELSPI_SSPREG_SIRF 0x48
+#define INTELSPI_SSPREG_PRV_CLOCK_PARAMS 0x400
+#define INTELSPI_SSPREG_RESETS 0x404
+#define INTELSPI_SSPREG_GENERAL 0x408
+#define INTELSPI_SSPREG_SSP_REG 0x40C
+#define INTELSPI_SSPREG_SPI_CS_CTRL 0x418
+#define SPI_CS_CTRL_CS_MASK (3)
+#define SPI_CS_CTRL_SW_MODE (1 << 0)
+#define SPI_CS_CTRL_HW_MODE (1 << 0)
+#define SPI_CS_CTRL_CS_HIGH (1 << 1)
+#define SPI_CS_CTRL_CS_LOW (0 << 1)
+
+struct intelspi_softc {
+ ACPI_HANDLE sc_handle;
+ device_t sc_dev;
+ struct mtx sc_mtx;
+ int sc_mem_rid;
+ struct resource *sc_mem_res;
+ int sc_irq_rid;
+ struct resource *sc_irq_res;
+ void *sc_irq_ih;
+ struct spi_command *sc_cmd;
+ uint32_t sc_len;
+ uint32_t sc_read;
+ uint32_t sc_flags;
+ uint32_t sc_written;
+};
+
+static int intelspi_probe(device_t dev);
+static int intelspi_attach(device_t dev);
+static int intelspi_detach(device_t dev);
+static void intelspi_intr(void *);
+
+static int
+intelspi_txfifo_full(struct intelspi_softc *sc)
+{
+ uint32_t sssr;
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR);
+ if (sssr & SSSR_TNF)
+ return (0);
+
+ return (1);
+}
+
+static int
+intelspi_rxfifo_empty(struct intelspi_softc *sc)
+{
+ uint32_t sssr;
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR);
+ if (sssr & SSSR_RNE)
+ return (0);
+ else
+ return (1);
+}
+
+static void
+intelspi_fill_tx_fifo(struct intelspi_softc *sc)
+{
+ struct spi_command *cmd;
+ uint32_t written;
+ uint8_t *data;
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ cmd = sc->sc_cmd;
+ while (sc->sc_written < sc->sc_len &&
+ !intelspi_txfifo_full(sc)) {
+ data = (uint8_t *)cmd->tx_cmd;
+ written = sc->sc_written++;
+
+ if (written >= cmd->tx_cmd_sz) {
+ data = (uint8_t *)cmd->tx_data;
+ written -= cmd->tx_cmd_sz;
+ }
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSDR, data[written]);
+ }
+}
+
+static void
+intelspi_drain_rx_fifo(struct intelspi_softc *sc)
+{
+ struct spi_command *cmd;
+ uint32_t read;
+ uint8_t *data;
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ cmd = sc->sc_cmd;
+ while (sc->sc_read < sc->sc_len &&
+ !intelspi_rxfifo_empty(sc)) {
+ data = (uint8_t *)cmd->rx_cmd;
+ read = sc->sc_read++;
+ if (read >= cmd->rx_cmd_sz) {
+ data = (uint8_t *)cmd->rx_data;
+ read -= cmd->rx_cmd_sz;
+ }
+ data[read] = INTELSPI_READ(sc, INTELSPI_SSPREG_SSDR) & 0xff;
+ }
+}
+
+static int
+intelspi_transaction_done(struct intelspi_softc *sc)
+{
+ int txfifo_empty;
+ uint32_t sssr;
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ if (sc->sc_written != sc->sc_len ||
+ sc->sc_read != sc->sc_len)
+ return (0);
+
+ sssr = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR);
+ txfifo_empty = ((sssr & SSSR_TFL_MASK) == 0) &&
+ (sssr & SSSR_TNF);
+
+ if (txfifo_empty && !(sssr & SSSR_RNE))
+ return (1);
+
+ return (0);
+}
+
+static int
+intelspi_transact(struct intelspi_softc *sc)
+{
+
+ INTELSPI_ASSERT_LOCKED(sc);
+
+ /* TX - Fill up the FIFO. */
+ intelspi_fill_tx_fifo(sc);
+
+ /* RX - Drain the FIFO. */
+ intelspi_drain_rx_fifo(sc);
+
+ /* Check for end of transfer. */
+ return intelspi_transaction_done(sc);
+}
+
+static void
+intelspi_intr(void *arg)
+{
+ struct intelspi_softc *sc;
+ uint32_t reg;
+
+ sc = (struct intelspi_softc *)arg;
+
+ INTELSPI_LOCK(sc);
+ if ((sc->sc_flags & INTELSPI_BUSY) == 0) {
+ INTELSPI_UNLOCK(sc);
+ return;
+ }
+
+ /* Check if SSP if off */
+ reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SSSR);
+ if (reg == 0xffffffffU) {
+ INTELSPI_UNLOCK(sc);
+ return;
+ }
+
+ /* Check for end of transfer. */
+ if (intelspi_transact(sc)) {
+ /* Disable interrupts */
+ reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1);
+ reg &= ~(SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE);
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, reg);
+ wakeup(sc->sc_dev);
+ }
+
+ INTELSPI_UNLOCK(sc);
+}
+
+static void
+intelspi_init(struct intelspi_softc *sc)
+{
+ uint32_t reg;
+
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR0, 0);
+
+ /* Manual CS control */
+ reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SPI_CS_CTRL);
+ reg &= ~(SPI_CS_CTRL_CS_MASK);
+ reg |= (SPI_CS_CTRL_SW_MODE | SPI_CS_CTRL_CS_HIGH);
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SPI_CS_CTRL, reg);
+
+ /* Set TX/RX FIFO IRQ threshold levels */
+ reg = SSCR1_TFT(TX_FIFO_THRESHOLD) | SSCR1_RFT(RX_FIFO_THRESHOLD);
+ /*
+ * Set SPI mode. This should be part of transaction or sysctl
+ */
+ reg |= SSCR1_MODE_0;
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, reg);
+
+ /*
+ * Parent clock on Minowboard Turbot is 50MHz
+ * divide it by 5 to set to more or less reasonable
+ * value. But this should be part of transaction config
+ * or sysctl
+ */
+ reg = SSCR0_SCR(CLOCK_DIV_10MHZ);
+ /* Put SSP in SPI mode */
+ reg |= SSCR0_FRF_SPI;
+ /* Data size */
+ reg |= SSCR0_DSS(DATA_SIZE_8BITS);
+ /* Enable SSP */
+ reg |= SSCR0_SSE;
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR0, reg);
+}
+
+static void
+intelspi_set_cs(struct intelspi_softc *sc, int level)
+{
+ uint32_t reg;
+
+ reg = INTELSPI_READ(sc, INTELSPI_SSPREG_SPI_CS_CTRL);
+ reg &= ~(SPI_CS_CTRL_CS_MASK);
+ reg |= SPI_CS_CTRL_SW_MODE;
+
+ if (level == CS_HIGH)
+ reg |= SPI_CS_CTRL_CS_HIGH;
+ else
+ reg |= SPI_CS_CTRL_CS_LOW;
+
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SPI_CS_CTRL, reg);
+}
+
+static int
+intelspi_transfer(device_t dev, device_t child, struct spi_command *cmd)
+{
+ struct intelspi_softc *sc;
+ int err;
+ uint32_t sscr1;
+
+ sc = device_get_softc(dev);
+ err = 0;
+
+ KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz,
+ ("TX/RX command sizes should be equal"));
+ KASSERT(cmd->tx_data_sz == cmd->rx_data_sz,
+ ("TX/RX data sizes should be equal"));
+
+ INTELSPI_LOCK(sc);
+
+ /* If the controller is in use wait until it is available. */
+ while (sc->sc_flags & INTELSPI_BUSY) {
+ err = mtx_sleep(dev, &sc->sc_mtx, 0, "intelspi", 0);
+ if (err == EINTR) {
+ INTELSPI_UNLOCK(sc);
+ return (err);
+ }
+ }
+
+ /* Now we have control over SPI controller. */
+ sc->sc_flags = INTELSPI_BUSY;
+
+ /* Save a pointer to the SPI command. */
+ sc->sc_cmd = cmd;
+ sc->sc_read = 0;
+ sc->sc_written = 0;
+ sc->sc_len = cmd->tx_cmd_sz + cmd->tx_data_sz;
+
+ /* Enable CS */
+ intelspi_set_cs(sc, CS_LOW);
+ /* Transfer as much as possible to FIFOs */
+ if (!intelspi_transact(sc)) {
+ /* If FIFO is not large enough - enable interrupts */
+ sscr1 = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1);
+ sscr1 |= (SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE);
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, sscr1);
+
+ /* and wait for transaction to complete */
+ err = mtx_sleep(dev, &sc->sc_mtx, 0, "intelspi", hz * 2);
+ }
+
+ /* de-asser CS */
+ intelspi_set_cs(sc, CS_HIGH);
+
+ /* Clear transaction details */
+ sc->sc_cmd = NULL;
+ sc->sc_read = 0;
+ sc->sc_written = 0;
+ sc->sc_len = 0;
+
+ /* Make sure the SPI engine and interrupts are disabled. */
+ sscr1 = INTELSPI_READ(sc, INTELSPI_SSPREG_SSCR1);
+ sscr1 &= ~(SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE);
+ INTELSPI_WRITE(sc, INTELSPI_SSPREG_SSCR1, sscr1);
+
+ /* Release the controller and wakeup the next thread waiting for it. */
+ sc->sc_flags = 0;
+ wakeup_one(dev);
+ INTELSPI_UNLOCK(sc);
+
+ /*
+ * Check for transfer timeout. The SPI controller doesn't
+ * return errors.
+ */
+ if (err == EWOULDBLOCK) {
+ device_printf(sc->sc_dev, "transfer timeout\n");
+ err = EIO;
+ }
+
+ return (err);
+}
+
+static int
+intelspi_probe(device_t dev)
+{
+ static char *gpio_ids[] = { "80860F0E", NULL };
+
+ if (acpi_disabled("spi") ||
+ ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids) == NULL)
+ return (ENXIO);
+
+ device_set_desc(dev, "Intel SPI Controller");
+ return (0);
+}
+
+static int
+intelspi_attach(device_t dev)
+{
+ struct intelspi_softc *sc;
+
+ sc = device_get_softc(dev);
+ sc->sc_dev = dev;
+ sc->sc_handle = acpi_get_handle(dev);
+
+ INTELSPI_LOCK_INIT(sc);
+
+ sc->sc_mem_rid = 0;
+ sc->sc_mem_res = bus_alloc_resource_any(sc->sc_dev,
+ SYS_RES_MEMORY, &sc->sc_mem_rid, RF_ACTIVE);
+ if (sc->sc_mem_res == NULL) {
+ device_printf(dev, "can't allocate memory resource\n");
+ goto error;
+ }
+
+ sc->sc_irq_rid = 0;
+ sc->sc_irq_res = bus_alloc_resource_any(sc->sc_dev,
+ SYS_RES_IRQ, &sc->sc_irq_rid, RF_ACTIVE);
+ if (sc->sc_irq_res == NULL) {
+ device_printf(dev, "can't allocate IRQ resource\n");
+ goto error;
+ }
+
+ /* Hook up our interrupt handler. */
+ if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
+ NULL, intelspi_intr, sc, &sc->sc_irq_ih)) {
+ device_printf(dev, "cannot setup the interrupt handler\n");
+ goto error;
+ }
+
+ intelspi_init(sc);
+
+ device_add_child(dev, "spibus", -1);
+
+ return (bus_generic_attach(dev));
+
+error:
+ INTELSPI_LOCK_DESTROY(sc);
+
+ if (sc->sc_mem_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY,
+ sc->sc_mem_rid, sc->sc_mem_res);
+
+ if (sc->sc_irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY,
+ sc->sc_irq_rid, sc->sc_irq_res);
+
+ return (ENXIO);
+}
+
+static int
+intelspi_detach(device_t dev)
+{
+ struct intelspi_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ INTELSPI_LOCK_DESTROY(sc);
+
+ if (sc->sc_irq_ih)
+ bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_ih);
+
+ if (sc->sc_mem_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY,
+ sc->sc_mem_rid, sc->sc_mem_res);
+
+ if (sc->sc_irq_res != NULL)
+ bus_release_resource(dev, SYS_RES_MEMORY,
+ sc->sc_irq_rid, sc->sc_irq_res);
+
+ return (0);
+}
+
+static device_method_t intelspi_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, intelspi_probe),
+ DEVMETHOD(device_attach, intelspi_attach),
+ DEVMETHOD(device_detach, intelspi_detach),
+
+ /* SPI interface */
+ DEVMETHOD(spibus_transfer, intelspi_transfer),
+
+ DEVMETHOD_END
+};
+
+static driver_t intelspi_driver = {
+ "spi",
+ intelspi_methods,
+ sizeof(struct intelspi_softc),
+};
+
+static devclass_t intelspi_devclass;
+DRIVER_MODULE(intelspi, acpi, intelspi_driver, intelspi_devclass, 0, 0);
+MODULE_DEPEND(intelspi, acpi, 1, 1, 1);
+MODULE_DEPEND(intelspi, spibus, 1, 1, 1);
diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c
index 7fecd48..234bad2 100644
--- a/sys/dev/ioat/ioat_test.c
+++ b/sys/dev/ioat/ioat_test.c
@@ -79,7 +79,7 @@ static int g_thread_index = 1;
static struct cdev *g_ioat_cdev = NULL;
#define ioat_test_log(v, ...) _ioat_test_log((v), "ioat_test: " __VA_ARGS__)
-static inline void _ioat_test_log(int verbosity, const char *fmt, ...);
+static void _ioat_test_log(int verbosity, const char *fmt, ...);
static void
ioat_test_transaction_destroy(struct test_transaction *tx)
@@ -579,7 +579,7 @@ ioat_test_detach(void)
mtx_unlock(&Giant);
}
-static inline void
+static void
_ioat_test_log(int verbosity, const char *fmt, ...)
{
va_list argp;
diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 4efae9f..68c547c 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -169,6 +169,40 @@ icl_conn_receive(struct icl_conn *ic, size_t len)
return (m);
}
+static int
+icl_conn_receive_buf(struct icl_conn *ic, void *buf, size_t len)
+{
+ struct iovec iov[1];
+ struct uio uio;
+ struct socket *so;
+ int error, flags;
+
+ so = ic->ic_socket;
+
+ memset(&uio, 0, sizeof(uio));
+ iov[0].iov_base = buf;
+ iov[0].iov_len = len;
+ uio.uio_iov = iov;
+ uio.uio_iovcnt = 1;
+ uio.uio_offset = 0;
+ uio.uio_resid = len;
+ uio.uio_segflg = UIO_SYSSPACE;
+ uio.uio_rw = UIO_READ;
+
+ flags = MSG_DONTWAIT;
+ error = soreceive(so, NULL, &uio, NULL, NULL, &flags);
+ if (error != 0) {
+ ICL_DEBUG("soreceive error %d", error);
+ return (-1);
+ }
+ if (uio.uio_resid != 0) {
+ ICL_DEBUG("short read");
+ return (-1);
+ }
+
+ return (0);
+}
+
static struct icl_pdu *
icl_pdu_new_empty(struct icl_conn *ic, int flags)
{
@@ -226,10 +260,10 @@ icl_soft_conn_new_pdu(struct icl_conn *ic, int flags)
if (ip == NULL)
return (NULL);
- ip->ip_bhs_mbuf = m_getm2(NULL, sizeof(struct iscsi_bhs),
- flags, MT_DATA, M_PKTHDR);
+ CTASSERT(sizeof(struct iscsi_bhs) <= MHLEN);
+ ip->ip_bhs_mbuf = m_gethdr(flags, MT_DATA);
if (ip->ip_bhs_mbuf == NULL) {
- ICL_WARN("failed to allocate %zd bytes", sizeof(*ip));
+ ICL_WARN("failed to allocate BHS mbuf");
icl_pdu_free(ip);
return (NULL);
}
@@ -308,28 +342,13 @@ icl_pdu_size(const struct icl_pdu *response)
static int
icl_pdu_receive_bhs(struct icl_pdu *request, size_t *availablep)
{
- struct mbuf *m;
- m = icl_conn_receive(request->ip_conn, sizeof(struct iscsi_bhs));
- if (m == NULL) {
+ if (icl_conn_receive_buf(request->ip_conn,
+ request->ip_bhs, sizeof(struct iscsi_bhs))) {
ICL_DEBUG("failed to receive BHS");
return (-1);
}
- request->ip_bhs_mbuf = m_pullup(m, sizeof(struct iscsi_bhs));
- if (request->ip_bhs_mbuf == NULL) {
- ICL_WARN("m_pullup failed");
- return (-1);
- }
- request->ip_bhs = mtod(request->ip_bhs_mbuf, struct iscsi_bhs *);
-
- /*
- * XXX: For architectures with strict alignment requirements
- * we may need to allocate ip_bhs and copy the data into it.
- * For some reason, though, not doing this doesn't seem
- * to cause problems; tested on sparc64.
- */
-
*availablep -= sizeof(struct iscsi_bhs);
return (0);
}
@@ -371,28 +390,23 @@ icl_mbuf_to_crc32c(const struct mbuf *m0)
static int
icl_pdu_check_header_digest(struct icl_pdu *request, size_t *availablep)
{
- struct mbuf *m;
uint32_t received_digest, valid_digest;
if (request->ip_conn->ic_header_crc32c == false)
return (0);
- m = icl_conn_receive(request->ip_conn, ISCSI_HEADER_DIGEST_SIZE);
- if (m == NULL) {
+ CTASSERT(sizeof(received_digest) == ISCSI_HEADER_DIGEST_SIZE);
+ if (icl_conn_receive_buf(request->ip_conn,
+ &received_digest, ISCSI_HEADER_DIGEST_SIZE)) {
ICL_DEBUG("failed to receive header digest");
return (-1);
}
-
- CTASSERT(sizeof(received_digest) == ISCSI_HEADER_DIGEST_SIZE);
- m_copydata(m, 0, ISCSI_HEADER_DIGEST_SIZE, (void *)&received_digest);
- m_freem(m);
-
*availablep -= ISCSI_HEADER_DIGEST_SIZE;
- /*
- * XXX: Handle AHS.
- */
+ /* Temporary attach AHS to BHS to calculate header digest. */
+ request->ip_bhs_mbuf->m_next = request->ip_ahs_mbuf;
valid_digest = icl_mbuf_to_crc32c(request->ip_bhs_mbuf);
+ request->ip_bhs_mbuf->m_next = NULL;
if (received_digest != valid_digest) {
ICL_WARN("header digest check failed; got 0x%x, "
"should be 0x%x", received_digest, valid_digest);
@@ -526,7 +540,6 @@ icl_pdu_receive_data_segment(struct icl_pdu *request,
static int
icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep)
{
- struct mbuf *m;
uint32_t received_digest, valid_digest;
if (request->ip_conn->ic_data_crc32c == false)
@@ -535,16 +548,12 @@ icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep)
if (request->ip_data_len == 0)
return (0);
- m = icl_conn_receive(request->ip_conn, ISCSI_DATA_DIGEST_SIZE);
- if (m == NULL) {
+ CTASSERT(sizeof(received_digest) == ISCSI_DATA_DIGEST_SIZE);
+ if (icl_conn_receive_buf(request->ip_conn,
+ &received_digest, ISCSI_DATA_DIGEST_SIZE)) {
ICL_DEBUG("failed to receive data digest");
return (-1);
}
-
- CTASSERT(sizeof(received_digest) == ISCSI_DATA_DIGEST_SIZE);
- m_copydata(m, 0, ISCSI_DATA_DIGEST_SIZE, (void *)&received_digest);
- m_freem(m);
-
*availablep -= ISCSI_DATA_DIGEST_SIZE;
/*
@@ -580,7 +589,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep)
if (ic->ic_receive_state == ICL_CONN_STATE_BHS) {
KASSERT(ic->ic_receive_pdu == NULL,
("ic->ic_receive_pdu != NULL"));
- request = icl_pdu_new_empty(ic, M_NOWAIT);
+ request = icl_soft_conn_new_pdu(ic, M_NOWAIT);
if (request == NULL) {
ICL_DEBUG("failed to allocate PDU; "
"dropping connection");
@@ -883,7 +892,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue)
{
struct icl_pdu *request, *request2;
struct socket *so;
- size_t available, size, size2;
+ long available, size, size2;
int coalesced, error;
ICL_CONN_LOCK_ASSERT_NOT(ic);
@@ -922,7 +931,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue)
if (available < size) {
#if 1
ICL_DEBUG("no space to send; "
- "have %zd, need %zd",
+ "have %ld, need %ld",
available, size);
#endif
so->so_snd.sb_lowat = size;
@@ -969,7 +978,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue)
}
#if 0
if (coalesced > 1) {
- ICL_DEBUG("coalesced %d PDUs into %zd bytes",
+ ICL_DEBUG("coalesced %d PDUs into %ld bytes",
coalesced, size);
}
#endif
@@ -1087,7 +1096,7 @@ icl_pdu_append_data(struct icl_pdu *request, const void *addr, size_t len,
KASSERT(len > 0, ("len == 0"));
- newmb = m_getm2(NULL, len, flags, MT_DATA, M_PKTHDR);
+ newmb = m_getm2(NULL, len, flags, MT_DATA, 0);
if (newmb == NULL) {
ICL_WARN("failed to allocate mbuf for %zd bytes", len);
return (ENOMEM);
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 5364584..2b8afa7 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -231,14 +231,16 @@ iscsi_session_send_postponed(struct iscsi_session *is)
ISCSI_SESSION_LOCK_ASSERT(is);
- while (!STAILQ_EMPTY(&is->is_postponed)) {
- request = STAILQ_FIRST(&is->is_postponed);
+ if (STAILQ_EMPTY(&is->is_postponed))
+ return;
+ while ((request = STAILQ_FIRST(&is->is_postponed)) != NULL) {
postpone = iscsi_pdu_prepare(request);
if (postpone)
- break;
+ return;
STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
icl_pdu_queue(request);
}
+ xpt_release_simq(is->is_sim, 1);
}
static void
@@ -252,6 +254,8 @@ iscsi_pdu_queue_locked(struct icl_pdu *request)
iscsi_session_send_postponed(is);
postpone = iscsi_pdu_prepare(request);
if (postpone) {
+ if (STAILQ_EMPTY(&is->is_postponed))
+ xpt_freeze_simq(is->is_sim, 1);
STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next);
return;
}
@@ -339,8 +343,9 @@ iscsi_session_cleanup(struct iscsi_session *is, bool destroy_sim)
/*
* Remove postponed PDUs.
*/
- while (!STAILQ_EMPTY(&is->is_postponed)) {
- pdu = STAILQ_FIRST(&is->is_postponed);
+ if (!STAILQ_EMPTY(&is->is_postponed))
+ xpt_release_simq(is->is_sim, 1);
+ while ((pdu = STAILQ_FIRST(&is->is_postponed)) != NULL) {
STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
icl_pdu_free(pdu);
}
@@ -475,15 +480,14 @@ iscsi_maintenance_thread_terminate(struct iscsi_session *is)
static void
iscsi_maintenance_thread(void *arg)
{
- struct iscsi_session *is;
-
- is = arg;
+ struct iscsi_session *is = arg;
+ ISCSI_SESSION_LOCK(is);
for (;;) {
- ISCSI_SESSION_LOCK(is);
if (is->is_reconnecting == false &&
is->is_terminating == false &&
- STAILQ_EMPTY(&is->is_postponed))
+ (STAILQ_EMPTY(&is->is_postponed) ||
+ ISCSI_SNGT(is->is_cmdsn, is->is_maxcmdsn)))
cv_wait(&is->is_maintenance_cv, &is->is_lock);
/* Terminate supersedes reconnect. */
@@ -497,12 +501,13 @@ iscsi_maintenance_thread(void *arg)
if (is->is_reconnecting) {
ISCSI_SESSION_UNLOCK(is);
iscsi_maintenance_thread_reconnect(is);
+ ISCSI_SESSION_LOCK(is);
continue;
}
iscsi_session_send_postponed(is);
- ISCSI_SESSION_UNLOCK(is);
}
+ ISCSI_SESSION_UNLOCK(is);
}
static void
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index 62fbea3..1fa2d1a2 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -4317,7 +4317,7 @@ isp_start(XS_T *xs)
if (XS_CDBLEN(xs) > (IS_FC(isp)? 16 : 44) || XS_CDBLEN(xs) == 0) {
isp_prt(isp, ISP_LOGERR, "unsupported cdb length (%d, CDB[0]=0x%x)", XS_CDBLEN(xs), XS_CDBP(xs)[0] & 0xff);
- XS_SETERR(xs, HBA_BOTCH);
+ XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
@@ -4494,7 +4494,7 @@ isp_start(XS_T *xs)
if (IS_SCSI(isp)) {
if (cdblen > sizeof (reqp->req_cdb)) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_BOTCH);
+ XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
reqp->req_target = target | (XS_CHANNEL(xs) << 7);
@@ -4506,7 +4506,7 @@ isp_start(XS_T *xs)
if (cdblen > sizeof (t7->req_cdb)) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_BOTCH);
+ XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
@@ -4539,7 +4539,7 @@ isp_start(XS_T *xs)
if (cdblen > sizeof t2->req_cdb) {
isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
- XS_SETERR(xs, HBA_BOTCH);
+ XS_SETERR(xs, HBA_REQINVAL);
return (CMD_COMPLETE);
}
if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) {
@@ -6567,6 +6567,7 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
case RQCS_PORT_BUSY:
isp_prt(isp, ISP_LOGWARN, "port busy for target %d", XS_TGT(xs));
if (XS_NOERR(xs)) {
+ *XS_STSP(xs) = SCSI_BUSY;
XS_SETERR(xs, HBA_TGTBSY);
}
return;
@@ -7132,7 +7133,7 @@ static const uint32_t mbpfc[] = {
ISP_FC_OPMAP(0x00, 0x00), /* 0x3f: */
ISP_FC_OPMAP(0x03, 0x01), /* 0x40: MBOX_LOOP_PORT_BYPASS */
ISP_FC_OPMAP(0x03, 0x01), /* 0x41: MBOX_LOOP_PORT_ENABLE */
- ISP_FC_OPMAP_HALF(0x0, 0x01, 0x3, 0xcf), /* 0x42: MBOX_GET_RESOURCE_COUNT */
+ ISP_FC_OPMAP_HALF(0x0, 0x01, 0x1f, 0xcf), /* 0x42: MBOX_GET_RESOURCE_COUNT */
ISP_FC_OPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_OFFLINE_MODE */
ISP_FC_OPMAP(0x00, 0x00), /* 0x44: */
ISP_FC_OPMAP(0x00, 0x00), /* 0x45: */
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 32f8e1d..25aa673 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -41,12 +41,6 @@ __FBSDID("$FreeBSD$");
#include <cam/cam_periph.h>
#include <cam/cam_xpt_periph.h>
-#if __FreeBSD_version < 800002
-#define THREAD_CREATE kthread_create
-#else
-#define THREAD_CREATE kproc_create
-#endif
-
MODULE_VERSION(isp, 1);
MODULE_DEPEND(isp, cam, 1, 1, 1);
int isp_announced = 0;
@@ -115,6 +109,9 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
struct ccb_setasync csa;
struct cam_sim *sim;
struct cam_path *path;
+#ifdef ISP_TARGET_MODE
+ int i;
+#endif
/*
* Construct our SIM entry.
@@ -153,6 +150,17 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
struct isp_spi *spi = ISP_SPI_PC(isp, chan);
spi->sim = sim;
spi->path = path;
+#ifdef ISP_TARGET_MODE
+ TAILQ_INIT(&spi->waitq);
+ STAILQ_INIT(&spi->ntfree);
+ for (i = 0; i < ATPDPSIZE; i++)
+ STAILQ_INSERT_TAIL(&spi->ntfree, &spi->ntpool[i], next);
+ LIST_INIT(&spi->atfree);
+ for (i = ATPDPSIZE-1; i >= 0; i--)
+ LIST_INSERT_HEAD(&spi->atfree, &spi->atpool[i], next);
+ for (i = 0; i < ATPDPHASHSIZE; i++)
+ LIST_INIT(&spi->atused[i]);
+#endif
} else {
fcparam *fcp = FCPARAM(isp, chan);
struct isp_fc *fc = ISP_FC_PC(isp, chan);
@@ -168,9 +176,21 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
callout_init_mtx(&fc->gdt, &isp->isp_osinfo.lock, 0);
TASK_INIT(&fc->gtask, 1, isp_gdt_task, fc);
+#ifdef ISP_TARGET_MODE
+ TAILQ_INIT(&fc->waitq);
+ STAILQ_INIT(&fc->ntfree);
+ for (i = 0; i < ATPDPSIZE; i++)
+ STAILQ_INSERT_TAIL(&fc->ntfree, &fc->ntpool[i], next);
+ LIST_INIT(&fc->atfree);
+ for (i = ATPDPSIZE-1; i >= 0; i--)
+ LIST_INSERT_HEAD(&fc->atfree, &fc->atpool[i], next);
+ for (i = 0; i < ATPDPHASHSIZE; i++)
+ LIST_INIT(&fc->atused[i]);
+#endif
isp_loop_changed(isp, chan);
ISP_UNLOCK(isp);
- if (THREAD_CREATE(isp_kthread, fc, &fc->kproc, 0, 0, "%s: fc_thrd%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
+ if (kproc_create(isp_kthread, fc, &fc->kproc, 0, 0,
+ "%s_%d", device_get_nameunit(isp->isp_osinfo.dev), chan)) {
xpt_free_path(fc->path);
ISP_LOCK(isp);
xpt_bus_deregister(cam_sim_path(fc->sim));
@@ -830,19 +850,15 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb)
* Put the target mode functions here, because some are inlines
*/
#ifdef ISP_TARGET_MODE
-static ISP_INLINE int is_lun_enabled(ispsoftc_t *, int, lun_id_t);
static ISP_INLINE tstate_t *get_lun_statep(ispsoftc_t *, int, lun_id_t);
-static ISP_INLINE tstate_t *get_lun_statep_from_tag(ispsoftc_t *, int, uint32_t);
-static ISP_INLINE void rls_lun_statep(ispsoftc_t *, tstate_t *);
-static ISP_INLINE inot_private_data_t *get_ntp_from_tagdata(ispsoftc_t *, uint32_t, uint32_t, tstate_t **);
-static ISP_INLINE atio_private_data_t *isp_get_atpd(ispsoftc_t *, tstate_t *, uint32_t);
-static ISP_INLINE atio_private_data_t *isp_find_atpd(ispsoftc_t *, tstate_t *, uint32_t);
-static ISP_INLINE void isp_put_atpd(ispsoftc_t *, tstate_t *, atio_private_data_t *);
-static ISP_INLINE inot_private_data_t *isp_get_ntpd(ispsoftc_t *, tstate_t *);
-static ISP_INLINE inot_private_data_t *isp_find_ntpd(ispsoftc_t *, tstate_t *, uint32_t, uint32_t);
-static ISP_INLINE void isp_put_ntpd(ispsoftc_t *, tstate_t *, inot_private_data_t *);
+static atio_private_data_t *isp_get_atpd(ispsoftc_t *, int, uint32_t);
+static atio_private_data_t *isp_find_atpd(ispsoftc_t *, int, uint32_t);
+static void isp_put_atpd(ispsoftc_t *, int, atio_private_data_t *);
+static inot_private_data_t *isp_get_ntpd(ispsoftc_t *, int);
+static inot_private_data_t *isp_find_ntpd(ispsoftc_t *, int, uint32_t, uint32_t);
+static void isp_put_ntpd(ispsoftc_t *, int, inot_private_data_t *);
static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_t **);
-static void destroy_lun_state(ispsoftc_t *, tstate_t *);
+static void destroy_lun_state(ispsoftc_t *, int, tstate_t *);
static void isp_enable_lun(ispsoftc_t *, union ccb *);
static void isp_disable_lun(ispsoftc_t *, union ccb *);
static timeout_t isp_refire_putback_atio;
@@ -858,43 +874,7 @@ static void isp_handle_platform_notify_fc(ispsoftc_t *, in_fcentry_t *);
static void isp_handle_platform_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *);
static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *, uint32_t rsp);
static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *);
-static void isp_target_mark_aborted(ispsoftc_t *, union ccb *);
-static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t);
-
-static ISP_INLINE int
-is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun)
-{
- tstate_t *tptr;
- struct tslist *lhp;
-
- ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp);
- SLIST_FOREACH(tptr, lhp, next) {
- if (tptr->ts_lun == lun) {
- return (1);
- }
- }
- return (0);
-}
-
-static void
-dump_tstates(ispsoftc_t *isp, int bus)
-{
- int i, j;
- struct tslist *lhp;
- tstate_t *tptr = NULL;
-
- if (bus >= isp->isp_nchan) {
- return;
- }
- for (i = 0; i < LUN_HASH_SIZE; i++) {
- ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
- j = 0;
- SLIST_FOREACH(tptr, lhp, next) {
- xpt_print(tptr->owner, "[%d, %d] atio_cnt=%d inot_cnt=%d\n", i, j, tptr->atio_count, tptr->inot_count);
- j++;
- }
- }
-}
+static void isp_target_mark_aborted_early(ispsoftc_t *, int chan, tstate_t *, uint32_t);
static ISP_INLINE tstate_t *
get_lun_statep(ispsoftc_t *isp, int bus, lun_id_t lun)
@@ -905,208 +885,179 @@ get_lun_statep(ispsoftc_t *isp, int bus, lun_id_t lun)
if (bus < isp->isp_nchan) {
ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp);
SLIST_FOREACH(tptr, lhp, next) {
- if (tptr->ts_lun == lun) {
- tptr->hold++;
+ if (tptr->ts_lun == lun)
return (tptr);
- }
}
}
return (NULL);
}
-static ISP_INLINE tstate_t *
-get_lun_statep_from_tag(ispsoftc_t *isp, int bus, uint32_t tagval)
-{
- tstate_t *tptr = NULL;
- atio_private_data_t *atp;
- struct tslist *lhp;
- int i;
-
- if (bus < isp->isp_nchan && tagval != 0) {
- for (i = 0; i < LUN_HASH_SIZE; i++) {
- ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
- SLIST_FOREACH(tptr, lhp, next) {
- atp = isp_find_atpd(isp, tptr, tagval);
- if (atp) {
- tptr->hold++;
- return (tptr);
- }
- }
- }
- }
- return (NULL);
-}
-
-static ISP_INLINE inot_private_data_t *
-get_ntp_from_tagdata(ispsoftc_t *isp, uint32_t tag_id, uint32_t seq_id, tstate_t **rslt)
+static int
+isp_atio_restart(ispsoftc_t *isp, int bus, tstate_t *tptr)
{
inot_private_data_t *ntp;
- tstate_t *tptr;
- struct tslist *lhp;
- int bus, i;
+ struct ntpdlist rq;
- for (bus = 0; bus < isp->isp_nchan; bus++) {
- for (i = 0; i < LUN_HASH_SIZE; i++) {
- ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
- SLIST_FOREACH(tptr, lhp, next) {
- ntp = isp_find_ntpd(isp, tptr, tag_id, seq_id);
- if (ntp) {
- *rslt = tptr;
- tptr->hold++;
- return (ntp);
- }
- }
+ if (STAILQ_EMPTY(&tptr->restart_queue))
+ return (0);
+ STAILQ_INIT(&rq);
+ STAILQ_CONCAT(&rq, &tptr->restart_queue);
+ while ((ntp = STAILQ_FIRST(&rq)) != NULL) {
+ STAILQ_REMOVE_HEAD(&rq, next);
+ if (IS_24XX(isp)) {
+ isp_prt(isp, ISP_LOGTDEBUG0,
+ "%s: restarting resrc deprived %x", __func__,
+ ((at7_entry_t *)ntp->data)->at_rxid);
+ isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->data);
+ } else {
+ isp_prt(isp, ISP_LOGTDEBUG0,
+ "%s: restarting resrc deprived %x", __func__,
+ ((at2_entry_t *)ntp->data)->at_rxid);
+ isp_handle_platform_atio2(isp, (at2_entry_t *) ntp->data);
}
+ isp_put_ntpd(isp, bus, ntp);
+ if (!STAILQ_EMPTY(&tptr->restart_queue))
+ break;
}
- return (NULL);
-}
-
-static ISP_INLINE void
-rls_lun_statep(ispsoftc_t *isp, tstate_t *tptr)
-{
- KASSERT((tptr->hold), ("tptr not held"));
- tptr->hold--;
+ if (!STAILQ_EMPTY(&rq)) {
+ STAILQ_CONCAT(&rq, &tptr->restart_queue);
+ STAILQ_CONCAT(&tptr->restart_queue, &rq);
+ }
+ return (!STAILQ_EMPTY(&tptr->restart_queue));
}
static void
isp_tmcmd_restart(ispsoftc_t *isp)
{
- inot_private_data_t *ntp;
- inot_private_data_t *restart_queue;
tstate_t *tptr;
union ccb *ccb;
struct tslist *lhp;
+ struct isp_ccbq *waitq;
int bus, i;
for (bus = 0; bus < isp->isp_nchan; bus++) {
for (i = 0; i < LUN_HASH_SIZE; i++) {
ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
- SLIST_FOREACH(tptr, lhp, next) {
- if ((restart_queue = tptr->restart_queue) != NULL)
- tptr->restart_queue = NULL;
- while (restart_queue) {
- ntp = restart_queue;
- restart_queue = ntp->rd.nt.nt_hba;
- if (IS_24XX(isp)) {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: restarting resrc deprived %x", __func__, ((at7_entry_t *)ntp->rd.data)->at_rxid);
- isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->rd.data);
- } else {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: restarting resrc deprived %x", __func__, ((at2_entry_t *)ntp->rd.data)->at_rxid);
- isp_handle_platform_atio2(isp, (at2_entry_t *) ntp->rd.data);
- }
- isp_put_ntpd(isp, tptr, ntp);
- if (tptr->restart_queue && restart_queue != NULL) {
- ntp = tptr->restart_queue;
- tptr->restart_queue = restart_queue;
- while (restart_queue->rd.nt.nt_hba) {
- restart_queue = restart_queue->rd.nt.nt_hba;
- }
- restart_queue->rd.nt.nt_hba = ntp;
- break;
- }
- }
- /*
- * We only need to do this once per tptr
- */
- if (!TAILQ_EMPTY(&tptr->waitq)) {
- ccb = (union ccb *)TAILQ_LAST(&tptr->waitq, isp_ccbq);
- TAILQ_REMOVE(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
- isp_target_start_ctio(isp, ccb, FROM_TIMER);
- }
- }
+ SLIST_FOREACH(tptr, lhp, next)
+ isp_atio_restart(isp, bus, tptr);
+ }
+
+ /*
+ * We only need to do this once per channel.
+ */
+ ISP_GET_PC_ADDR(isp, bus, waitq, waitq);
+ ccb = (union ccb *)TAILQ_FIRST(waitq);
+ if (ccb != NULL) {
+ TAILQ_REMOVE(waitq, &ccb->ccb_h, periph_links.tqe);
+ isp_target_start_ctio(isp, ccb, FROM_TIMER);
}
}
}
-static ISP_INLINE atio_private_data_t *
-isp_get_atpd(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag)
+static atio_private_data_t *
+isp_get_atpd(ispsoftc_t *isp, int chan, uint32_t tag)
{
+ struct atpdlist *atfree;
+ struct atpdlist *atused;
atio_private_data_t *atp;
- atp = LIST_FIRST(&tptr->atfree);
+ ISP_GET_PC_ADDR(isp, chan, atfree, atfree);
+ atp = LIST_FIRST(atfree);
if (atp) {
LIST_REMOVE(atp, next);
atp->tag = tag;
- LIST_INSERT_HEAD(&tptr->atused[ATPDPHASH(tag)], atp, next);
+ ISP_GET_PC(isp, chan, atused, atused);
+ LIST_INSERT_HEAD(&atused[ATPDPHASH(tag)], atp, next);
}
return (atp);
}
-static ISP_INLINE atio_private_data_t *
-isp_find_atpd(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag)
+static atio_private_data_t *
+isp_find_atpd(ispsoftc_t *isp, int chan, uint32_t tag)
{
+ struct atpdlist *atused;
atio_private_data_t *atp;
- LIST_FOREACH(atp, &tptr->atused[ATPDPHASH(tag)], next) {
+ ISP_GET_PC(isp, chan, atused, atused);
+ LIST_FOREACH(atp, &atused[ATPDPHASH(tag)], next) {
if (atp->tag == tag)
return (atp);
}
return (NULL);
}
-static ISP_INLINE void
-isp_put_atpd(ispsoftc_t *isp, tstate_t *tptr, atio_private_data_t *atp)
+static void
+isp_put_atpd(ispsoftc_t *isp, int chan, atio_private_data_t *atp)
{
+ struct atpdlist *atfree;
+
if (atp->ests) {
isp_put_ecmd(isp, atp->ests);
}
LIST_REMOVE(atp, next);
memset(atp, 0, sizeof (*atp));
- LIST_INSERT_HEAD(&tptr->atfree, atp, next);
+ ISP_GET_PC_ADDR(isp, chan, atfree, atfree);
+ LIST_INSERT_HEAD(atfree, atp, next);
}
static void
-isp_dump_atpd(ispsoftc_t *isp, tstate_t *tptr)
+isp_dump_atpd(ispsoftc_t *isp, int chan)
{
- atio_private_data_t *atp;
+ atio_private_data_t *atp, *atpool;
const char *states[8] = { "Free", "ATIO", "CAM", "CTIO", "LAST_CTIO", "PDON", "?6", "7" };
- for (atp = tptr->atpool; atp < &tptr->atpool[ATPDPSIZE]; atp++) {
- xpt_print(tptr->owner, "ATP: [0x%x] origdlen %u bytes_xfrd %u lun %x nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s\n",
- atp->tag, atp->orig_datalen, atp->bytes_xfered, atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]);
+ ISP_GET_PC(isp, chan, atpool, atpool);
+ for (atp = atpool; atp < &atpool[ATPDPSIZE]; atp++) {
+ if (atp->state == ATPD_STATE_FREE)
+ continue;
+ isp_prt(isp, ISP_LOGALL, "Chan %d ATP [0x%x] origdlen %u bytes_xfrd %u lun %jx nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s",
+ chan, atp->tag, atp->orig_datalen, atp->bytes_xfered, (uintmax_t)atp->lun, atp->nphdl, atp->sid, atp->did, atp->oxid, states[atp->state & 0x7]);
}
}
-
-static ISP_INLINE inot_private_data_t *
-isp_get_ntpd(ispsoftc_t *isp, tstate_t *tptr)
+static inot_private_data_t *
+isp_get_ntpd(ispsoftc_t *isp, int chan)
{
+ struct ntpdlist *ntfree;
inot_private_data_t *ntp;
- ntp = tptr->ntfree;
- if (ntp) {
- tptr->ntfree = ntp->next;
- }
+
+ ISP_GET_PC_ADDR(isp, chan, ntfree, ntfree);
+ ntp = STAILQ_FIRST(ntfree);
+ if (ntp)
+ STAILQ_REMOVE_HEAD(ntfree, next);
return (ntp);
}
-static ISP_INLINE inot_private_data_t *
-isp_find_ntpd(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag_id, uint32_t seq_id)
+static inot_private_data_t *
+isp_find_ntpd(ispsoftc_t *isp, int chan, uint32_t tag_id, uint32_t seq_id)
{
- inot_private_data_t *ntp;
- for (ntp = tptr->ntpool; ntp < &tptr->ntpool[ATPDPSIZE]; ntp++) {
- if (ntp->rd.tag_id == tag_id && ntp->rd.seq_id == seq_id) {
+ inot_private_data_t *ntp, *ntp2;
+
+ ISP_GET_PC(isp, chan, ntpool, ntp);
+ ISP_GET_PC_ADDR(isp, chan, ntpool[ATPDPSIZE], ntp2);
+ for (; ntp < ntp2; ntp++) {
+ if (ntp->tag_id == tag_id && ntp->seq_id == seq_id)
return (ntp);
- }
}
return (NULL);
}
-static ISP_INLINE void
-isp_put_ntpd(ispsoftc_t *isp, tstate_t *tptr, inot_private_data_t *ntp)
+static void
+isp_put_ntpd(ispsoftc_t *isp, int chan, inot_private_data_t *ntp)
{
- ntp->rd.tag_id = ntp->rd.seq_id = 0;
- ntp->next = tptr->ntfree;
- tptr->ntfree = ntp;
+ struct ntpdlist *ntfree;
+
+ ntp->tag_id = ntp->seq_id = 0;
+ ISP_GET_PC_ADDR(isp, chan, ntfree, ntfree);
+ STAILQ_INSERT_HEAD(ntfree, ntp, next);
}
static cam_status
create_lun_state(ispsoftc_t *isp, int bus, struct cam_path *path, tstate_t **rslt)
{
- cam_status status;
lun_id_t lun;
struct tslist *lhp;
tstate_t *tptr;
- int i;
lun = xpt_path_lun_id(path);
if (lun != CAM_LUN_WILDCARD) {
@@ -1114,31 +1065,13 @@ create_lun_state(ispsoftc_t *isp, int bus, struct cam_path *path, tstate_t **rsl
return (CAM_LUN_INVALID);
}
}
- if (is_lun_enabled(isp, bus, lun)) {
- return (CAM_LUN_ALRDY_ENA);
- }
tptr = malloc(sizeof (tstate_t), M_DEVBUF, M_NOWAIT|M_ZERO);
if (tptr == NULL) {
return (CAM_RESRC_UNAVAIL);
}
tptr->ts_lun = lun;
- status = xpt_create_path(&tptr->owner, NULL, xpt_path_path_id(path), xpt_path_target_id(path), lun);
- if (status != CAM_REQ_CMP) {
- free(tptr, M_DEVBUF);
- return (status);
- }
SLIST_INIT(&tptr->atios);
SLIST_INIT(&tptr->inots);
- TAILQ_INIT(&tptr->waitq);
- LIST_INIT(&tptr->atfree);
- for (i = ATPDPSIZE-1; i >= 0; i--)
- LIST_INSERT_HEAD(&tptr->atfree, &tptr->atpool[i], next);
- for (i = 0; i < ATPDPHASHSIZE; i++)
- LIST_INIT(&tptr->atused[i]);
- for (i = 0; i < ATPDPSIZE-1; i++)
- tptr->ntpool[i].next = &tptr->ntpool[i+1];
- tptr->ntfree = tptr->ntpool;
- tptr->hold = 1;
ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp);
SLIST_INSERT_HEAD(lhp, tptr, next);
*rslt = tptr;
@@ -1146,34 +1079,30 @@ create_lun_state(ispsoftc_t *isp, int bus, struct cam_path *path, tstate_t **rsl
return (CAM_REQ_CMP);
}
-static ISP_INLINE void
-destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr)
+static void
+destroy_lun_state(ispsoftc_t *isp, int bus, tstate_t *tptr)
{
union ccb *ccb;
struct tslist *lhp;
+ inot_private_data_t *ntp;
- KASSERT((tptr->hold != 0), ("tptr is not held"));
- KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold));
- do {
- ccb = (union ccb *)SLIST_FIRST(&tptr->atios);
- if (ccb) {
- SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
- ccb->ccb_h.status = CAM_REQ_ABORTED;
- xpt_done(ccb);
- }
- } while (ccb);
- do {
- ccb = (union ccb *)SLIST_FIRST(&tptr->inots);
- if (ccb) {
- SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle);
- ccb->ccb_h.status = CAM_REQ_ABORTED;
- xpt_done(ccb);
- }
- } while (ccb);
- ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(tptr->ts_lun)], lhp);
+ while ((ccb = (union ccb *)SLIST_FIRST(&tptr->atios)) != NULL) {
+ SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
+ ccb->ccb_h.status = CAM_REQ_ABORTED;
+ xpt_done(ccb);
+ };
+ while ((ccb = (union ccb *)SLIST_FIRST(&tptr->inots)) != NULL) {
+ SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle);
+ ccb->ccb_h.status = CAM_REQ_ABORTED;
+ xpt_done(ccb);
+ }
+ while ((ntp = STAILQ_FIRST(&tptr->restart_queue)) != NULL) {
+ isp_endcmd(isp, ntp->data, NIL_HANDLE, bus, SCSI_STATUS_BUSY, 0);
+ STAILQ_REMOVE_HEAD(&tptr->restart_queue, next);
+ isp_put_ntpd(isp, bus, ntp);
+ }
+ ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(tptr->ts_lun)], lhp);
SLIST_REMOVE(lhp, tptr, tstate, next);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n");
- xpt_free_path(tptr->owner);
free(tptr, M_DEVBUF);
}
@@ -1220,7 +1149,6 @@ isp_enable_lun(ispsoftc_t *isp, union ccb *ccb)
return;
}
- rls_lun_statep(isp, tptr);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
}
@@ -1251,7 +1179,7 @@ isp_disable_lun(ispsoftc_t *isp, union ccb *ccb)
return;
}
- destroy_lun_state(isp, tptr);
+ destroy_lun_state(isp, bus, tptr);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
}
@@ -1260,43 +1188,33 @@ static void
isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
{
int fctape, sendstatus, resid;
- tstate_t *tptr;
fcparam *fcp;
atio_private_data_t *atp;
struct ccb_scsiio *cso;
+ struct isp_ccbq *waitq;
uint32_t dmaresult, handle, xfrlen, sense_length, tmp;
uint8_t local[QENTRY_LEN];
- tptr = get_lun_statep(isp, XS_CHANNEL(ccb), XS_LUN(ccb));
- if (tptr == NULL) {
- tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD);
- if (tptr == NULL) {
- isp_prt(isp, ISP_LOGERR, "%s: [0x%x] cannot find tstate pointer", __func__, ccb->csio.tag_id);
- ccb->ccb_h.status = CAM_DEV_NOT_THERE;
- xpt_done(ccb);
- return;
- }
- }
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ENTRY[0x%x] how %u xfrlen %u sendstatus %d sense_len %u", __func__, ccb->csio.tag_id, how, ccb->csio.dxfer_len,
(ccb->ccb_h.flags & CAM_SEND_STATUS) != 0, ((ccb->ccb_h.flags & CAM_SEND_SENSE)? ccb->csio.sense_len : 0));
+ ISP_GET_PC_ADDR(isp, XS_CHANNEL(ccb), waitq, waitq);
switch (how) {
- case FROM_TIMER:
case FROM_CAM:
/*
* Insert at the tail of the list, if any, waiting CTIO CCBs
*/
- TAILQ_INSERT_TAIL(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_TAIL(waitq, &ccb->ccb_h, periph_links.tqe);
break;
+ case FROM_TIMER:
case FROM_SRR:
case FROM_CTIO_DONE:
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
- while (TAILQ_FIRST(&tptr->waitq) != NULL) {
- ccb = (union ccb *) TAILQ_FIRST(&tptr->waitq);
- TAILQ_REMOVE(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ while ((ccb = (union ccb *) TAILQ_FIRST(waitq)) != NULL) {
+ TAILQ_REMOVE(waitq, &ccb->ccb_h, periph_links.tqe);
cso = &ccb->csio;
xfrlen = cso->dxfer_len;
@@ -1309,10 +1227,10 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
}
}
- atp = isp_find_atpd(isp, tptr, cso->tag_id);
+ atp = isp_find_atpd(isp, XS_CHANNEL(ccb), cso->tag_id);
if (atp == NULL) {
isp_prt(isp, ISP_LOGERR, "%s: [0x%x] cannot find private data adjunct in %s", __func__, cso->tag_id, __func__);
- isp_dump_atpd(isp, tptr);
+ isp_dump_atpd(isp, XS_CHANNEL(ccb));
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
continue;
@@ -1345,7 +1263,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
*/
if (atp->ctcnt >= ATPD_CCB_OUTSTANDING) {
isp_prt(isp, ISP_LOGTINFO, "[0x%x] handling only %d CCBs at a time (flags for this ccb: 0x%x)", cso->tag_id, ATPD_CCB_OUTSTANDING, ccb->ccb_h.flags);
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
@@ -1398,13 +1316,24 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
/*
* Check for overflow
*/
- tmp = atp->bytes_xfered + atp->bytes_in_transit + xfrlen;
- if (tmp > atp->orig_datalen) {
- isp_prt(isp, ISP_LOGERR, "%s: [0x%x] data overflow by %u bytes", __func__, cso->tag_id, tmp - atp->orig_datalen);
+ tmp = atp->bytes_xfered + atp->bytes_in_transit;
+ if (xfrlen > 0 && tmp > atp->orig_datalen) {
+ isp_prt(isp, ISP_LOGERR,
+ "%s: [0x%x] data overflow by %u bytes", __func__,
+ cso->tag_id, tmp + xfrlen - atp->orig_datalen);
ccb->ccb_h.status = CAM_DATA_RUN_ERR;
xpt_done(ccb);
continue;
}
+ if (xfrlen > atp->orig_datalen - tmp) {
+ xfrlen = atp->orig_datalen - tmp;
+ if (xfrlen == 0 && !sendstatus) {
+ cso->resid = cso->dxfer_len;
+ ccb->ccb_h.status = CAM_REQ_CMP;
+ xpt_done(ccb);
+ continue;
+ }
+ }
if (IS_24XX(isp)) {
ct7_entry_t *cto = (ct7_entry_t *) local;
@@ -1415,8 +1344,8 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
ATPD_SET_SEQNO(cto, atp);
cto->ct_nphdl = atp->nphdl;
cto->ct_rxid = atp->tag;
- cto->ct_iid_lo = atp->portid;
- cto->ct_iid_hi = atp->portid >> 16;
+ cto->ct_iid_lo = atp->sid;
+ cto->ct_iid_hi = atp->sid >> 16;
cto->ct_oxid = atp->oxid;
cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb));
cto->ct_timeout = (XS_TIME(ccb) + 999) / 1000;
@@ -1434,16 +1363,13 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
cto->ct_flags |= CT7_SENDSTATUS | CT7_NO_DATA;
resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit;
if (sense_length <= MAXRESPLEN_24XX) {
- if (resid < 0) {
- cto->ct_resid = -resid;
- } else if (resid > 0) {
- cto->ct_resid = resid;
- }
cto->ct_flags |= CT7_FLAG_MODE1;
cto->ct_scsi_status = cso->scsi_status;
if (resid < 0) {
+ cto->ct_resid = -resid;
cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
} else if (resid > 0) {
+ cto->ct_resid = resid;
cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
}
if (fctape) {
@@ -1462,7 +1388,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
if (atp->ests == NULL) {
atp->ests = isp_get_ecmd(isp);
if (atp->ests == NULL) {
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
}
@@ -1617,7 +1543,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
if (atp->ests == NULL) {
atp->ests = isp_get_ecmd(isp);
if (atp->ests == NULL) {
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
}
@@ -1706,13 +1632,13 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
if (isp_get_pcmd(isp, ccb)) {
ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n");
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
handle = isp_allocate_handle(isp, ccb, ISP_HANDLE_TARGET);
if (handle == 0) {
ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__);
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
isp_free_pcmd(isp, ccb);
break;
}
@@ -1742,7 +1668,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
isp_destroy_handle(isp, handle);
isp_free_pcmd(isp, ccb);
if (dmaresult == CMD_EAGAIN) {
- TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe);
+ TAILQ_INSERT_HEAD(waitq, &ccb->ccb_h, periph_links.tqe);
break;
}
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
@@ -1759,7 +1685,6 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
atp->ctcnt++;
atp->seqno++;
}
- rls_lun_statep(isp, tptr);
}
static void
@@ -1856,7 +1781,7 @@ isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
*/
if ((aep->at_status & ~QLTM_SVALID) != AT_CDB) {
isp_prt(isp, ISP_LOGWARN, "bogus atio (0x%x) leaked to platform", aep->at_status);
- isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
+ isp_endcmd(isp, aep, NIL_HANDLE, 0, SCSI_STATUS_BUSY, 0);
return;
}
@@ -1880,9 +1805,9 @@ isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
if (tptr == NULL) {
isp_prt(isp, ISP_LOGWARN, "%s: [0x%x] no state pointer for lun %jx or wildcard", __func__, aep->at_rxid, (uintmax_t)lun);
if (lun == 0) {
- isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
+ isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_BUSY, 0);
} else {
- isp_endcmd(isp, aep, SCSI_STATUS_CHECK_COND | ECMD_SVALID | (0x5 << 12) | (0x25 << 16), 0);
+ isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_CHECK_COND | ECMD_SVALID | (0x5 << 12) | (0x25 << 16), 0);
}
return;
}
@@ -1891,38 +1816,15 @@ isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
/*
* Start any commands pending resources first.
*/
- if (tptr->restart_queue) {
- inot_private_data_t *restart_queue = tptr->restart_queue;
- tptr->restart_queue = NULL;
- while (restart_queue) {
- ntp = restart_queue;
- restart_queue = ntp->rd.nt.nt_hba;
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: restarting resrc deprived %x", __func__, ((at2_entry_t *)ntp->rd.data)->at_rxid);
- isp_handle_platform_atio2(isp, (at2_entry_t *) ntp->rd.data);
- isp_put_ntpd(isp, tptr, ntp);
- /*
- * If a recursion caused the restart queue to start to fill again,
- * stop and splice the new list on top of the old list and restore
- * it and go to noresrc.
- */
- if (tptr->restart_queue) {
- ntp = tptr->restart_queue;
- tptr->restart_queue = restart_queue;
- while (restart_queue->rd.nt.nt_hba) {
- restart_queue = restart_queue->rd.nt.nt_hba;
- }
- restart_queue->rd.nt.nt_hba = ntp;
- goto noresrc;
- }
- }
- }
+ if (isp_atio_restart(isp, 0, tptr))
+ goto noresrc;
atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios);
if (atiop == NULL) {
goto noresrc;
}
- atp = isp_get_atpd(isp, tptr, aep->at_rxid);
+ atp = isp_get_atpd(isp, 0, aep->at_rxid);
if (atp == NULL) {
goto noresrc;
}
@@ -1997,19 +1899,15 @@ isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
atp->state = ATPD_STATE_CAM;
xpt_done((union ccb *)atiop);
isp_prt(isp, ISP_LOGTDEBUG0, "ATIO2[0x%x] CDB=0x%x lun %jx datalen %u", aep->at_rxid, atp->cdb0, (uintmax_t)lun, atp->orig_datalen);
- rls_lun_statep(isp, tptr);
return;
noresrc:
- ntp = isp_get_ntpd(isp, tptr);
+ ntp = isp_get_ntpd(isp, 0);
if (ntp == NULL) {
- rls_lun_statep(isp, tptr);
- isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
+ isp_endcmd(isp, aep, nphdl, 0, SCSI_STATUS_BUSY, 0);
return;
}
- memcpy(ntp->rd.data, aep, QENTRY_LEN);
- ntp->rd.nt.nt_hba = tptr->restart_queue;
- tptr->restart_queue = ntp;
- rls_lun_statep(isp, tptr);
+ memcpy(ntp->data, aep, QENTRY_LEN);
+ STAILQ_INSERT_TAIL(&tptr->restart_queue, ntp, next);
}
static void
@@ -2114,40 +2012,13 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
/*
* Start any commands pending resources first.
*/
- if (tptr->restart_queue) {
- inot_private_data_t *restart_queue = tptr->restart_queue;
- tptr->restart_queue = NULL;
- while (restart_queue) {
- ntp = restart_queue;
- restart_queue = ntp->rd.nt.nt_hba;
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: restarting resrc deprived %x", __func__, ((at7_entry_t *)ntp->rd.data)->at_rxid);
- isp_handle_platform_atio7(isp, (at7_entry_t *) ntp->rd.data);
- isp_put_ntpd(isp, tptr, ntp);
- /*
- * If a recursion caused the restart queue to start to fill again,
- * stop and splice the new list on top of the old list and restore
- * it and go to noresrc.
- */
- if (tptr->restart_queue) {
- isp_prt(isp, ISP_LOGTDEBUG0, "%s: restart queue refilling", __func__);
- if (restart_queue) {
- ntp = tptr->restart_queue;
- tptr->restart_queue = restart_queue;
- while (restart_queue->rd.nt.nt_hba) {
- restart_queue = restart_queue->rd.nt.nt_hba;
- }
- restart_queue->rd.nt.nt_hba = ntp;
- }
- goto noresrc;
- }
- }
- }
+ if (isp_atio_restart(isp, chan, tptr))
+ goto noresrc;
/*
* If the f/w is out of resources, just send a BUSY status back.
*/
if (aep->at_rxid == AT7_NORESRC_RXID) {
- rls_lun_statep(isp, tptr);
isp_endcmd(isp, aep, nphdl, chan, SCSI_BUSY, 0);
return;
}
@@ -2161,7 +2032,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
goto noresrc;
}
- oatp = isp_find_atpd(isp, tptr, aep->at_rxid);
+ oatp = isp_find_atpd(isp, chan, aep->at_rxid);
if (oatp) {
isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x) oatp state %d",
aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id, oatp->state);
@@ -2170,7 +2041,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
*/
goto noresrc;
}
- atp = isp_get_atpd(isp, tptr, aep->at_rxid);
+ atp = isp_get_atpd(isp, chan, aep->at_rxid);
if (atp == NULL) {
isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid);
goto noresrc;
@@ -2217,7 +2088,8 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
atp->bytes_xfered = 0;
atp->lun = lun;
atp->nphdl = nphdl;
- atp->portid = sid;
+ atp->sid = sid;
+ atp->did = did;
atp->oxid = aep->at_hdr.ox_id;
atp->rxid = aep->at_hdr.rx_id;
atp->cdb0 = atiop->cdb_io.cdb_bytes[0];
@@ -2226,22 +2098,17 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
isp_prt(isp, ISP_LOGTDEBUG0, "ATIO7[0x%x] CDB=0x%x lun %jx datalen %u",
aep->at_rxid, atp->cdb0, (uintmax_t)lun, atp->orig_datalen);
xpt_done((union ccb *)atiop);
- rls_lun_statep(isp, tptr);
return;
noresrc:
- if (atp) {
- isp_put_atpd(isp, tptr, atp);
- }
- ntp = isp_get_ntpd(isp, tptr);
+ if (atp)
+ isp_put_atpd(isp, chan, atp);
+ ntp = isp_get_ntpd(isp, chan);
if (ntp == NULL) {
- rls_lun_statep(isp, tptr);
isp_endcmd(isp, aep, nphdl, chan, SCSI_STATUS_BUSY, 0);
return;
}
- memcpy(ntp->rd.data, aep, QENTRY_LEN);
- ntp->rd.nt.nt_hba = tptr->restart_queue;
- tptr->restart_queue = ntp;
- rls_lun_statep(isp, tptr);
+ memcpy(ntp->data, aep, QENTRY_LEN);
+ STAILQ_INSERT_TAIL(&tptr->restart_queue, ntp, next);
}
@@ -2252,7 +2119,7 @@ noresrc:
* transaction.
*/
static void
-isp_handle_srr_start(ispsoftc_t *isp, tstate_t *tptr, atio_private_data_t *atp)
+isp_handle_srr_start(ispsoftc_t *isp, atio_private_data_t *atp)
{
in_fcentry_24xx_t *inot;
uint32_t srr_off, ccb_off, ccb_len, ccb_end;
@@ -2352,7 +2219,6 @@ mdp:
static void
isp_handle_srr_notify(ispsoftc_t *isp, void *inot_raw)
{
- tstate_t *tptr;
in_fcentry_24xx_t *inot = inot_raw;
atio_private_data_t *atp;
uint32_t tag = inot->in_rxid;
@@ -2363,15 +2229,8 @@ isp_handle_srr_notify(ispsoftc_t *isp, void *inot_raw)
return;
}
- tptr = get_lun_statep_from_tag(isp, bus, tag);
- if (tptr == NULL) {
- isp_prt(isp, ISP_LOGERR, "%s: cannot find tptr for tag %x in SRR Notify", __func__, tag);
- isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot);
- return;
- }
- atp = isp_find_atpd(isp, tptr, tag);
+ atp = isp_find_atpd(isp, bus, tag);
if (atp == NULL) {
- rls_lun_statep(isp, tptr);
isp_prt(isp, ISP_LOGERR, "%s: cannot find adjunct for %x in SRR Notify", __func__, tag);
isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot);
return;
@@ -2381,19 +2240,17 @@ isp_handle_srr_notify(ispsoftc_t *isp, void *inot_raw)
isp_prt(isp, ISP_LOGTINFO /* ISP_LOGTDEBUG0 */, "SRR[0x%x] inot->in_rxid flags 0x%x srr_iu=%x reloff 0x%x", inot->in_rxid, inot->in_flags, inot->in_srr_iu,
inot->in_srr_reloff_lo | (inot->in_srr_reloff_hi << 16));
if (atp->srr_ccb)
- isp_handle_srr_start(isp, tptr, atp);
- rls_lun_statep(isp, tptr);
+ isp_handle_srr_start(isp, atp);
}
static void
isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
{
union ccb *ccb;
- int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0;
- tstate_t *tptr = NULL;
+ int sentstatus = 0, ok = 0, notify_cam = 0, failure = 0;
atio_private_data_t *atp = NULL;
int bus;
- uint32_t handle, moved_data = 0, data_requested;
+ uint32_t handle, data_requested, resid;
handle = ((ct2_entry_t *)arg)->ct_syshandle;
ccb = isp_find_xs(isp, handle);
@@ -2402,26 +2259,17 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
return;
}
isp_destroy_handle(isp, handle);
- data_requested = PISP_PCMD(ccb)->datalen;
+ resid = data_requested = PISP_PCMD(ccb)->datalen;
isp_free_pcmd(isp, ccb);
if (isp->isp_nactive) {
isp->isp_nactive--;
}
bus = XS_CHANNEL(ccb);
- tptr = get_lun_statep(isp, bus, XS_LUN(ccb));
- if (tptr == NULL) {
- tptr = get_lun_statep(isp, bus, CAM_LUN_WILDCARD);
- }
- if (tptr == NULL) {
- isp_prt(isp, ISP_LOGERR, "%s: cannot find tptr for tag %x after I/O", __func__, ccb->csio.tag_id);
- return;
- }
-
if (IS_24XX(isp)) {
- atp = isp_find_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid);
+ atp = isp_find_atpd(isp, bus, ((ct7_entry_t *)arg)->ct_rxid);
} else {
- atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid);
+ atp = isp_find_atpd(isp, bus, ((ct2_entry_t *)arg)->ct_rxid);
}
if (atp == NULL) {
/*
@@ -2429,10 +2277,9 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
* ct_rxid value, filling only ct_syshandle. Workaround
* that using tag_id from the CCB, pointed by ct_syshandle.
*/
- atp = isp_find_atpd(isp, tptr, ccb->csio.tag_id);
+ atp = isp_find_atpd(isp, bus, ccb->csio.tag_id);
}
if (atp == NULL) {
- rls_lun_statep(isp, tptr);
isp_prt(isp, ISP_LOGERR, "%s: cannot find adjunct for %x after I/O", __func__, ccb->csio.tag_id);
return;
}
@@ -2447,20 +2294,19 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
if (ct->ct_nphdl == CT7_SRR) {
atp->srr_ccb = ccb;
if (atp->srr_notify_rcvd)
- isp_handle_srr_start(isp, tptr, atp);
- rls_lun_statep(isp, tptr);
+ isp_handle_srr_start(isp, atp);
return;
}
if (ct->ct_nphdl == CT_HBA_RESET) {
+ sentstatus = (ccb->ccb_h.flags & CAM_SEND_STATUS) &&
+ (atp->sendst == 0);
failure = CAM_UNREC_HBA_ERROR;
} else {
sentstatus = ct->ct_flags & CT7_SENDSTATUS;
ok = (ct->ct_nphdl == CT7_OK);
notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
- if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA) {
+ if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA)
resid = ct->ct_resid;
- moved_data = data_requested - resid;
- }
}
isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
@@ -2469,33 +2315,32 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
if (ct->ct_status == CT_SRR) {
atp->srr_ccb = ccb;
if (atp->srr_notify_rcvd)
- isp_handle_srr_start(isp, tptr, atp);
- rls_lun_statep(isp, tptr);
+ isp_handle_srr_start(isp, atp);
isp_target_putback_atio(ccb);
return;
}
if (ct->ct_status == CT_HBA_RESET) {
+ sentstatus = (ccb->ccb_h.flags & CAM_SEND_STATUS) &&
+ (atp->sendst == 0);
failure = CAM_UNREC_HBA_ERROR;
} else {
sentstatus = ct->ct_flags & CT2_SENDSTATUS;
ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK;
notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
- if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) {
+ if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA)
resid = ct->ct_resid;
- moved_data = data_requested - resid;
- }
}
isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO2[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
notify_cam, ct->ct_status, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
}
if (ok) {
- if (moved_data) {
- atp->bytes_xfered += moved_data;
- ccb->csio.resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit;
+ if (data_requested > 0) {
+ atp->bytes_xfered += data_requested - resid;
+ ccb->csio.resid = ccb->csio.dxfer_len -
+ (data_requested - resid);
}
- if (sentstatus && (ccb->ccb_h.flags & CAM_SEND_SENSE)) {
+ if (sentstatus && (ccb->ccb_h.flags & CAM_SEND_SENSE))
ccb->ccb_h.status |= CAM_SENT_SENSE;
- }
ccb->ccb_h.status |= CAM_REQ_CMP;
} else {
notify_cam = 1;
@@ -2505,7 +2350,6 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
ccb->ccb_h.status |= CAM_REQ_CMP_ERR;
}
atp->state = ATPD_STATE_PDON;
- rls_lun_statep(isp, tptr);
/*
* We never *not* notify CAM when there has been any error (ok == 0),
@@ -2521,6 +2365,13 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
}
/*
+ * We are done with this ATIO if we successfully sent status.
+ * In all other cases expect either another CTIO or XPT_ABORT.
+ */
+ if (ok && sentstatus)
+ isp_put_atpd(isp, bus, atp);
+
+ /*
* We're telling CAM we're done with this CTIO transaction.
*
* 24XX cards never need an ATIO put back.
@@ -2560,13 +2411,11 @@ isp_handle_platform_notify_fc(ispsoftc_t *isp, in_fcentry_t *inp)
break;
case IN_ABORT_TASK:
{
- tstate_t *tptr;
uint16_t nphdl, lun;
uint32_t sid;
uint64_t wwn;
- atio_private_data_t *atp;
fcportdb_t *lp;
- struct ccb_immediate_notify *inot = NULL;
+ isp_notify_t tmp, *nt = &tmp;
if (ISP_CAP_SCCFW(isp)) {
lun = inp->in_scclun;
@@ -2588,47 +2437,25 @@ isp_handle_platform_notify_fc(ispsoftc_t *isp, in_fcentry_t *inp)
wwn = INI_ANY;
sid = PORT_ANY;
}
- tptr = get_lun_statep(isp, 0, lun);
- if (tptr == NULL) {
- tptr = get_lun_statep(isp, 0, CAM_LUN_WILDCARD);
- if (tptr == NULL) {
- isp_prt(isp, ISP_LOGWARN, "ABORT TASK for lun %x, but no tstate", lun);
- return;
- }
- }
- atp = isp_find_atpd(isp, tptr, inp->in_seqid);
-
- if (atp) {
- inot = (struct ccb_immediate_notify *) SLIST_FIRST(&tptr->inots);
- isp_prt(isp, ISP_LOGTDEBUG0, "ABORT TASK RX_ID %x WWN 0x%016llx state %d", inp->in_seqid, (unsigned long long) wwn, atp->state);
- if (inot) {
- tptr->inot_count--;
- SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, inot->ccb_h.path, "%s: Take FREE INOT count now %d\n", __func__, tptr->inot_count);
- } else {
- ISP_PATH_PRT(isp, ISP_LOGWARN, tptr->owner, "out of INOT structures\n");
- }
- } else {
- ISP_PATH_PRT(isp, ISP_LOGWARN, tptr->owner, "abort task RX_ID %x from wwn 0x%016llx, state unknown\n", inp->in_seqid, wwn);
- }
- if (inot) {
- isp_notify_t tmp, *nt = &tmp;
- ISP_MEMZERO(nt, sizeof (isp_notify_t));
- nt->nt_hba = isp;
- nt->nt_tgt = FCPARAM(isp, 0)->isp_wwpn;
- nt->nt_wwn = wwn;
- nt->nt_nphdl = nphdl;
- nt->nt_sid = sid;
- nt->nt_did = PORT_ANY;
- nt->nt_lun = lun;
- nt->nt_need_ack = 1;
- nt->nt_channel = 0;
- nt->nt_ncode = NT_ABORT_TASK;
- nt->nt_lreserved = inot;
- isp_handle_platform_target_tmf(isp, nt);
- needack = 0;
- }
- rls_lun_statep(isp, tptr);
+ isp_prt(isp, ISP_LOGTDEBUG0, "ABORT TASK RX_ID %x WWN 0x%016llx",
+ inp->in_seqid, (unsigned long long) wwn);
+
+ ISP_MEMZERO(nt, sizeof (isp_notify_t));
+ nt->nt_hba = isp;
+ nt->nt_tgt = FCPARAM(isp, 0)->isp_wwpn;
+ nt->nt_wwn = wwn;
+ nt->nt_nphdl = nphdl;
+ nt->nt_sid = sid;
+ nt->nt_did = PORT_ANY;
+ nt->nt_lun = lun;
+ nt->nt_tagval = inp->in_seqid;
+ nt->nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
+ nt->nt_need_ack = 1;
+ nt->nt_channel = 0;
+ nt->nt_ncode = NT_ABORT_TASK;
+ nt->nt_lreserved = inp;
+ isp_handle_platform_target_tmf(isp, nt);
+ needack = 0;
break;
}
default:
@@ -2924,11 +2751,11 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
switch (notify->nt_ncode) {
case NT_ABORT_TASK:
- isp_target_mark_aborted_early(isp, tptr, inot->tag_id);
+ isp_target_mark_aborted_early(isp, notify->nt_channel, tptr, inot->tag_id);
inot->arg = MSG_ABORT_TASK;
break;
case NT_ABORT_TASK_SET:
- isp_target_mark_aborted_early(isp, tptr, TAG_ANY);
+ isp_target_mark_aborted_early(isp, notify->nt_channel, tptr, TAG_ANY);
inot->arg = MSG_ABORT_TASK_SET;
break;
case NT_CLEAR_ACA:
@@ -2954,30 +2781,26 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
goto bad;
}
- ntp = isp_get_ntpd(isp, tptr);
+ ntp = isp_get_ntpd(isp, notify->nt_channel);
if (ntp == NULL) {
isp_prt(isp, ISP_LOGWARN, "%s: out of inotify private structures", __func__);
goto bad;
}
- ISP_MEMCPY(&ntp->rd.nt, notify, sizeof (isp_notify_t));
+ ISP_MEMCPY(&ntp->nt, notify, sizeof (isp_notify_t));
if (notify->nt_lreserved) {
- ISP_MEMCPY(&ntp->rd.data, notify->nt_lreserved, QENTRY_LEN);
- ntp->rd.nt.nt_lreserved = &ntp->rd.data;
+ ISP_MEMCPY(&ntp->data, notify->nt_lreserved, QENTRY_LEN);
+ ntp->nt.nt_lreserved = &ntp->data;
}
- ntp->rd.seq_id = notify->nt_tagval;
- ntp->rd.tag_id = notify->nt_tagval >> 32;
+ ntp->seq_id = notify->nt_tagval;
+ ntp->tag_id = notify->nt_tagval >> 32;
tptr->inot_count--;
SLIST_REMOVE_HEAD(&tptr->inots, sim_links.sle);
- rls_lun_statep(isp, tptr);
ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, inot->ccb_h.path, "%s: Take FREE INOT count now %d\n", __func__, tptr->inot_count);
inot->ccb_h.status = CAM_MESSAGE_RECV;
xpt_done((union ccb *)inot);
return;
bad:
- if (tptr) {
- rls_lun_statep(isp, tptr);
- }
if (notify->nt_need_ack && notify->nt_lreserved) {
if (((isphdr_t *)notify->nt_lreserved)->rqs_entry_type == RQSTYPE_ABTS_RCVD) {
if (isp_acknak_abts(isp, notify->nt_lreserved, ENOMEM)) {
@@ -2989,72 +2812,39 @@ bad:
}
}
-/*
- * Find the associated private data and mark it as dead so
- * we don't try to work on it any further.
- */
-static void
-isp_target_mark_aborted(ispsoftc_t *isp, union ccb *ccb)
-{
- tstate_t *tptr;
- atio_private_data_t *atp;
- union ccb *accb = ccb->cab.abort_ccb;
-
- tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb));
- if (tptr == NULL) {
- tptr = get_lun_statep(isp, XS_CHANNEL(accb), CAM_LUN_WILDCARD);
- if (tptr == NULL) {
- ccb->ccb_h.status = CAM_REQ_INVALID;
- return;
- }
- }
-
- atp = isp_find_atpd(isp, tptr, accb->atio.tag_id);
- if (atp == NULL) {
- ccb->ccb_h.status = CAM_REQ_INVALID;
- } else {
- atp->dead = 1;
- ccb->ccb_h.status = CAM_REQ_CMP;
- }
- rls_lun_statep(isp, tptr);
-}
-
static void
-isp_target_mark_aborted_early(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag_id)
+isp_target_mark_aborted_early(ispsoftc_t *isp, int chan, tstate_t *tptr, uint32_t tag_id)
{
- atio_private_data_t *atp;
- inot_private_data_t *restart_queue = tptr->restart_queue;
+ atio_private_data_t *atp, *atpool;
+ inot_private_data_t *ntp, *tmp;
+ uint32_t this_tag_id;
/*
* First, clean any commands pending restart
*/
- tptr->restart_queue = NULL;
- while (restart_queue) {
- uint32_t this_tag_id;
- inot_private_data_t *ntp = restart_queue;
-
- restart_queue = ntp->rd.nt.nt_hba;
-
- if (IS_24XX(isp)) {
- this_tag_id = ((at7_entry_t *)ntp->rd.data)->at_rxid;
- } else {
- this_tag_id = ((at2_entry_t *)ntp->rd.data)->at_rxid;
- }
+ STAILQ_FOREACH_SAFE(ntp, &tptr->restart_queue, next, tmp) {
+ if (IS_24XX(isp))
+ this_tag_id = ((at7_entry_t *)ntp->data)->at_rxid;
+ else
+ this_tag_id = ((at2_entry_t *)ntp->data)->at_rxid;
if ((uint64_t)tag_id == TAG_ANY || tag_id == this_tag_id) {
- isp_put_ntpd(isp, tptr, ntp);
- } else {
- ntp->rd.nt.nt_hba = tptr->restart_queue;
- tptr->restart_queue = ntp;
+ isp_endcmd(isp, ntp->data, NIL_HANDLE, chan,
+ ECMD_TERMINATE, 0);
+ isp_put_ntpd(isp, chan, ntp);
+ STAILQ_REMOVE(&tptr->restart_queue, ntp,
+ inot_private_data, next);
}
}
/*
* Now mark other ones dead as well.
*/
- for (atp = tptr->atpool; atp < &tptr->atpool[ATPDPSIZE]; atp++) {
- if ((uint64_t)tag_id == TAG_ANY || atp->tag == tag_id) {
+ ISP_GET_PC(isp, chan, atpool, atpool);
+ for (atp = atpool; atp < &atpool[ATPDPSIZE]; atp++) {
+ if (atp->lun != tptr->ts_lun)
+ continue;
+ if ((uint64_t)tag_id == TAG_ANY || atp->tag == tag_id)
atp->dead = 1;
- }
}
}
#endif
@@ -3453,6 +3243,93 @@ isp_kthread(void *arg)
kthread_exit();
}
+#ifdef ISP_TARGET_MODE
+static void
+isp_abort_atio(ispsoftc_t *isp, union ccb *ccb)
+{
+ atio_private_data_t *atp;
+ union ccb *accb = ccb->cab.abort_ccb;
+ struct ccb_hdr *sccb;
+ tstate_t *tptr;
+
+ tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb));
+ if (tptr != NULL) {
+ /* Search for the ATIO among queueued. */
+ SLIST_FOREACH(sccb, &tptr->atios, sim_links.sle) {
+ if (sccb != &accb->ccb_h)
+ continue;
+ SLIST_REMOVE(&tptr->atios, sccb, ccb_hdr, sim_links.sle);
+ tptr->atio_count--;
+ accb->ccb_h.status = CAM_REQ_ABORTED;
+ xpt_done(accb);
+ ccb->ccb_h.status = CAM_REQ_CMP;
+ return;
+ }
+ }
+
+ /* Search for the ATIO among running. */
+ atp = isp_find_atpd(isp, XS_CHANNEL(accb), accb->atio.tag_id);
+ if (atp != NULL) {
+ /* Send TERMINATE to firmware. */
+ if (!atp->dead && IS_24XX(isp)) {
+ uint8_t storage[QENTRY_LEN];
+ ct7_entry_t *cto = (ct7_entry_t *) storage;
+
+ ISP_MEMZERO(cto, sizeof (ct7_entry_t));
+ cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
+ cto->ct_header.rqs_entry_count = 1;
+ cto->ct_nphdl = atp->nphdl;
+ cto->ct_rxid = atp->tag;
+ cto->ct_iid_lo = atp->sid;
+ cto->ct_iid_hi = atp->sid >> 16;
+ cto->ct_oxid = atp->oxid;
+ cto->ct_vpidx = XS_CHANNEL(accb);
+ cto->ct_flags = CT7_NOACK|CT7_TERMINATE;
+ isp_target_put_entry(isp, cto);
+ }
+ isp_put_atpd(isp, XS_CHANNEL(accb), atp);
+ ccb->ccb_h.status = CAM_REQ_CMP;
+ } else {
+ ccb->ccb_h.status = CAM_UA_ABORT;
+ }
+}
+
+static void
+isp_abort_inot(ispsoftc_t *isp, union ccb *ccb)
+{
+ inot_private_data_t *ntp;
+ union ccb *accb = ccb->cab.abort_ccb;
+ struct ccb_hdr *sccb;
+ tstate_t *tptr;
+
+ tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb));
+ if (tptr != NULL) {
+ /* Search for the INOT among queueued. */
+ SLIST_FOREACH(sccb, &tptr->inots, sim_links.sle) {
+ if (sccb != &accb->ccb_h)
+ continue;
+ SLIST_REMOVE(&tptr->inots, sccb, ccb_hdr, sim_links.sle);
+ tptr->inot_count--;
+ accb->ccb_h.status = CAM_REQ_ABORTED;
+ xpt_done(accb);
+ ccb->ccb_h.status = CAM_REQ_CMP;
+ return;
+ }
+ }
+
+ /* Search for the INOT among running. */
+ ntp = isp_find_ntpd(isp, XS_CHANNEL(accb), accb->cin1.tag_id, accb->cin1.seq_id);
+ if (ntp != NULL) {
+ isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, ntp->data);
+ isp_put_ntpd(isp, XS_CHANNEL(accb), ntp);
+ ccb->ccb_h.status = CAM_REQ_CMP;
+ } else {
+ ccb->ccb_h.status = CAM_UA_ABORT;
+ return;
+ }
+}
+#endif
+
static void
isp_action(struct cam_sim *sim, union ccb *ccb)
{
@@ -3565,74 +3442,45 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
isp_disable_lun(isp, ccb);
}
break;
- case XPT_IMMED_NOTIFY:
case XPT_IMMEDIATE_NOTIFY: /* Add Immediate Notify Resource */
case XPT_ACCEPT_TARGET_IO: /* Add Accept Target IO Resource */
{
tstate_t *tptr = get_lun_statep(isp, XS_CHANNEL(ccb), ccb->ccb_h.target_lun);
if (tptr == NULL) {
- tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD);
- }
- if (tptr == NULL) {
const char *str;
- uint32_t tag;
- if (ccb->ccb_h.func_code == XPT_IMMEDIATE_NOTIFY) {
+ if (ccb->ccb_h.func_code == XPT_IMMEDIATE_NOTIFY)
str = "XPT_IMMEDIATE_NOTIFY";
- tag = ccb->cin1.seq_id;
- } else {
- tag = ccb->atio.tag_id;
+ else
str = "XPT_ACCEPT_TARGET_IO";
- }
- ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "%s: [0x%x] no state pointer found for %s\n", __func__, tag, str);
- dump_tstates(isp, XS_CHANNEL(ccb));
+ ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path,
+ "%s: no state pointer found for %s\n",
+ __func__, str);
ccb->ccb_h.status = CAM_DEV_NOT_THERE;
+ xpt_done(ccb);
break;
}
ccb->ccb_h.spriv_field0 = 0;
ccb->ccb_h.spriv_ptr1 = isp;
if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) {
- if (ccb->atio.tag_id) {
- atio_private_data_t *atp = isp_find_atpd(isp, tptr, ccb->atio.tag_id);
- if (atp) {
- isp_put_atpd(isp, tptr, atp);
- }
- }
+ ccb->atio.tag_id = 0;
tptr->atio_count++;
SLIST_INSERT_HEAD(&tptr->atios, &ccb->ccb_h, sim_links.sle);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, ccb->ccb_h.path, "Put FREE ATIO (tag id 0x%x), count now %d\n",
- ccb->atio.tag_id, tptr->atio_count);
- ccb->atio.tag_id = 0;
+ ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, ccb->ccb_h.path,
+ "Put FREE ATIO, count now %d\n", tptr->atio_count);
} else if (ccb->ccb_h.func_code == XPT_IMMEDIATE_NOTIFY) {
- if (ccb->cin1.tag_id) {
- inot_private_data_t *ntp = isp_find_ntpd(isp, tptr, ccb->cin1.tag_id, ccb->cin1.seq_id);
- if (ntp) {
- isp_put_ntpd(isp, tptr, ntp);
- }
- }
- tptr->inot_count++;
- SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n",
- ccb->cin1.seq_id, tptr->inot_count);
- ccb->cin1.seq_id = 0;
- } else if (ccb->ccb_h.func_code == XPT_IMMED_NOTIFY) {
+ ccb->cin1.seq_id = ccb->cin1.tag_id = 0;
tptr->inot_count++;
SLIST_INSERT_HEAD(&tptr->inots, &ccb->ccb_h, sim_links.sle);
- ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, ccb->ccb_h.path, "Put FREE INOT, (seq id 0x%x) count now %d\n",
- ccb->cin1.seq_id, tptr->inot_count);
- ccb->cin1.seq_id = 0;
+ ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, ccb->ccb_h.path,
+ "Put FREE INOT, count now %d\n", tptr->inot_count);
}
- rls_lun_statep(isp, tptr);
ccb->ccb_h.status = CAM_REQ_INPROG;
break;
}
- case XPT_NOTIFY_ACK:
- ccb->ccb_h.status = CAM_REQ_CMP_ERR;
- break;
case XPT_NOTIFY_ACKNOWLEDGE: /* notify ack */
{
- tstate_t *tptr;
inot_private_data_t *ntp;
/*
@@ -3643,7 +3491,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
* All the relevant path information is in the associated immediate notify
*/
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "%s: [0x%x] NOTIFY ACKNOWLEDGE for 0x%x seen\n", __func__, ccb->cna2.tag_id, ccb->cna2.seq_id);
- ntp = get_ntp_from_tagdata(isp, ccb->cna2.tag_id, ccb->cna2.seq_id, &tptr);
+ ntp = isp_find_ntpd(isp, XS_CHANNEL(ccb), ccb->cna2.tag_id, ccb->cna2.seq_id);
if (ntp == NULL) {
ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "%s: [0x%x] XPT_NOTIFY_ACKNOWLEDGE of 0x%x cannot find ntp private data\n", __func__,
ccb->cna2.tag_id, ccb->cna2.seq_id);
@@ -3651,17 +3499,15 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
xpt_done(ccb);
break;
}
- if (isp_handle_platform_target_notify_ack(isp, &ntp->rd.nt,
+ if (isp_handle_platform_target_notify_ack(isp, &ntp->nt,
(ccb->ccb_h.flags & CAM_SEND_STATUS) ? ccb->cna2.arg : 0)) {
- rls_lun_statep(isp, tptr);
cam_freeze_devq(ccb->ccb_h.path);
cam_release_devq(ccb->ccb_h.path, RELSIM_RELEASE_AFTER_TIMEOUT, 0, 1000, 0);
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
ccb->ccb_h.status |= CAM_REQUEUE_REQ;
break;
}
- isp_put_ntpd(isp, tptr, ntp);
- rls_lun_statep(isp, tptr);
+ isp_put_ntpd(isp, XS_CHANNEL(ccb), ntp);
ccb->ccb_h.status = CAM_REQ_CMP;
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, ccb->ccb_h.path, "%s: [0x%x] calling xpt_done for tag 0x%x\n", __func__, ccb->cna2.tag_id, ccb->cna2.seq_id);
xpt_done(ccb);
@@ -3698,7 +3544,10 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
switch (accb->ccb_h.func_code) {
#ifdef ISP_TARGET_MODE
case XPT_ACCEPT_TARGET_IO:
- isp_target_mark_aborted(isp, ccb);
+ isp_abort_atio(isp, ccb);
+ break;
+ case XPT_IMMEDIATE_NOTIFY:
+ isp_abort_inot(isp, ccb);
break;
#endif
case XPT_SCSI_IO:
@@ -4486,7 +4335,7 @@ changed:
{
abts_t *abts = (abts_t *)hp;
isp_notify_t notify, *nt = &notify;
- tstate_t *tptr;
+ atio_private_data_t *atp;
fcportdb_t *lp;
uint16_t chan;
uint32_t sid, did;
@@ -4513,13 +4362,8 @@ changed:
/*
* Try hard to find the lun for this command.
*/
- tptr = get_lun_statep_from_tag(isp, chan, abts->abts_rxid_task);
- if (tptr) {
- nt->nt_lun = tptr->ts_lun;
- rls_lun_statep(isp, tptr);
- } else {
- nt->nt_lun = LUN_ANY;
- }
+ atp = isp_find_atpd(isp, chan, abts->abts_rxid_task);
+ nt->nt_lun = atp ? atp->lun : LUN_ANY;
nt->nt_need_ack = 1;
nt->nt_tagval = abts->abts_rxid_task;
nt->nt_tagval |= (((uint64_t) abts->abts_rxid_abts) << 32);
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h
index d6c62a2..b540c77 100644
--- a/sys/dev/isp/isp_freebsd.h
+++ b/sys/dev/isp/isp_freebsd.h
@@ -88,14 +88,6 @@ isp_ecmd_t * isp_get_ecmd(struct ispsoftc *);
void isp_put_ecmd(struct ispsoftc *, isp_ecmd_t *);
#ifdef ISP_TARGET_MODE
-/* Not quite right, but there was no bump for this change */
-#if __FreeBSD_version < 225469
-#define SDFIXED(x) (&x)
-#else
-#define SDFIXED(x) ((struct scsi_sense_data_fixed *)(&x))
-#endif
-
-#define ISP_TARGET_FUNCTIONS 1
#define ATPDPSIZE 4096
#define ATPDPHASHSIZE 32
#define ATPDPHASH(x) ((((x) >> 24) ^ ((x) >> 16) ^ ((x) >> 8) ^ (x)) & \
@@ -108,10 +100,10 @@ typedef struct atio_private_data {
uint32_t bytes_xfered;
uint32_t bytes_in_transit;
uint32_t tag; /* typically f/w RX_ID */
- uint32_t lun;
+ lun_id_t lun;
uint32_t nphdl;
uint32_t sid;
- uint32_t portid;
+ uint32_t did;
uint16_t rxid; /* wire rxid */
uint16_t oxid; /* wire oxid */
uint16_t word3; /* PRLI word3 params */
@@ -147,14 +139,12 @@ typedef struct atio_private_data {
#define ATPD_GET_SEQNO(hdrp) (((isphdr_t *)hdrp)->rqs_seqno & ATPD_SEQ_MASK)
#define ATPD_GET_NCAM(hdrp) ((((isphdr_t *)hdrp)->rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0)
-typedef union inot_private_data inot_private_data_t;
-union inot_private_data {
- inot_private_data_t *next;
- struct {
- isp_notify_t nt; /* must be first! */
- uint8_t data[64]; /* sb QENTRY_LEN, but order of definitions is wrong */
- uint32_t tag_id, seq_id;
- } rd;
+typedef struct inot_private_data inot_private_data_t;
+struct inot_private_data {
+ STAILQ_ENTRY(inot_private_data) next;
+ isp_notify_t nt;
+ uint8_t data[64]; /* sb QENTRY_LEN, but order of definitions is wrong */
+ uint32_t tag_id, seq_id;
};
typedef struct isp_timed_notify_ack {
void *isp;
@@ -163,23 +153,15 @@ typedef struct isp_timed_notify_ack {
struct callout timer;
} isp_tna_t;
-TAILQ_HEAD(isp_ccbq, ccb_hdr);
+STAILQ_HEAD(ntpdlist, inot_private_data);
typedef struct tstate {
- SLIST_ENTRY(tstate) next;
- lun_id_t ts_lun;
- struct cam_path *owner;
- struct isp_ccbq waitq; /* waiting CCBs */
- struct ccb_hdr_slist atios;
- struct ccb_hdr_slist inots;
- uint32_t hold;
+ SLIST_ENTRY(tstate) next;
+ lun_id_t ts_lun;
+ struct ccb_hdr_slist atios;
+ struct ccb_hdr_slist inots;
+ struct ntpdlist restart_queue;
uint16_t atio_count;
uint16_t inot_count;
- inot_private_data_t * restart_queue;
- inot_private_data_t * ntfree;
- inot_private_data_t ntpool[ATPDPSIZE];
- LIST_HEAD(, atio_private_data) atfree;
- LIST_HEAD(, atio_private_data) atused[ATPDPHASHSIZE];
- atio_private_data_t atpool[ATPDPSIZE];
} tstate_t;
#define LUN_HASH_SIZE 32
@@ -220,6 +202,8 @@ struct isp_nexus {
* Per channel information
*/
SLIST_HEAD(tslist, tstate);
+TAILQ_HEAD(isp_ccbq, ccb_hdr);
+LIST_HEAD(atpdlist, atio_private_data);
struct isp_fc {
struct cam_sim *sim;
@@ -249,7 +233,13 @@ struct isp_fc {
struct callout gdt; /* gone device timer */
struct task gtask;
#ifdef ISP_TARGET_MODE
- struct tslist lun_hash[LUN_HASH_SIZE];
+ struct tslist lun_hash[LUN_HASH_SIZE];
+ struct isp_ccbq waitq; /* waiting CCBs */
+ struct ntpdlist ntfree;
+ inot_private_data_t ntpool[ATPDPSIZE];
+ struct atpdlist atfree;
+ struct atpdlist atused[ATPDPHASHSIZE];
+ atio_private_data_t atpool[ATPDPSIZE];
#if defined(DEBUG)
unsigned int inject_lost_data_frame;
#endif
@@ -264,7 +254,13 @@ struct isp_spi {
simqfrozen : 3,
iid : 4;
#ifdef ISP_TARGET_MODE
- struct tslist lun_hash[LUN_HASH_SIZE];
+ struct tslist lun_hash[LUN_HASH_SIZE];
+ struct isp_ccbq waitq; /* waiting CCBs */
+ struct ntpdlist ntfree;
+ inot_private_data_t ntpool[ATPDPSIZE];
+ struct atpdlist atfree;
+ struct atpdlist atused[ATPDPHASHSIZE];
+ atio_private_data_t atpool[ATPDPSIZE];
#endif
int num_threads;
};
@@ -578,6 +574,7 @@ default: \
# define HBA_CMDTIMEOUT CAM_CMD_TIMEOUT
# define HBA_SELTIMEOUT CAM_SEL_TIMEOUT
# define HBA_TGTBSY CAM_SCSI_STATUS_ERROR
+# define HBA_REQINVAL CAM_REQ_INVALID
# define HBA_BUSRESET CAM_SCSI_BUS_RESET
# define HBA_ABORTED CAM_REQ_ABORTED
# define HBA_DATAOVR CAM_DATA_RUN_ERR
diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c
index c5c277f..f86792e 100644
--- a/sys/dev/isp/isp_target.c
+++ b/sys/dev/isp/isp_target.c
@@ -503,11 +503,11 @@ isp_endcmd(ispsoftc_t *isp, ...)
ct7_entry_t _ctio7;
} un;
va_list ap;
+ int vpidx, nphdl;
ISP_MEMZERO(&un, sizeof un);
if (IS_24XX(isp)) {
- int vpidx, nphdl;
at7_entry_t *aep;
ct7_entry_t *cto = &un._ctio7;
@@ -558,13 +558,9 @@ isp_endcmd(ispsoftc_t *isp, ...)
} else {
cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
}
- if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl) {
+ if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl != 0) {
cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
- if (cto->ct_resid < 0) {
- cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
- } else if (cto->ct_resid > 0) {
- cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
- }
+ cto->ct_scsi_status |= (FCP_RESID_UNDERFLOW << 8);
}
cto->ct_syshandle = hdl;
} else {
@@ -573,6 +569,9 @@ isp_endcmd(ispsoftc_t *isp, ...)
va_start(ap, isp);
aep = va_arg(ap, at2_entry_t *);
+ /* nphdl and vpidx are unused here. */
+ nphdl = va_arg(ap, int);
+ vpidx = va_arg(ap, int);
code = va_arg(ap, uint32_t);
hdl = va_arg(ap, uint32_t);
va_end(ap);
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c
index f1116f6..8e049e3 100644
--- a/sys/dev/iwi/if_iwi.c
+++ b/sys/dev/iwi/if_iwi.c
@@ -1979,9 +1979,9 @@ iwi_start(struct iwi_softc *sc)
}
ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
if (iwi_tx_start(sc, m, ni, ac) != 0) {
- ieee80211_free_node(ni);
if_inc_counter(ni->ni_vap->iv_ifp,
IFCOUNTER_OERRORS, 1);
+ ieee80211_free_node(ni);
break;
}
sc->sc_tx_timer = 5;
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index e0d274f..488d115 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -8828,6 +8828,7 @@ iwn_stop_locked(struct iwn_softc *sc)
sc->sc_is_scanning = 0;
sc->sc_tx_timer = 0;
callout_stop(&sc->watchdog_to);
+ callout_stop(&sc->scan_timeout);
callout_stop(&sc->calib_to);
sc->sc_flags &= ~IWN_FLAG_RUNNING;
diff --git a/sys/dev/jedec_ts/jedec_ts.c b/sys/dev/jedec_ts/jedec_ts.c
index b65ef78..d1e9596 100644
--- a/sys/dev/jedec_ts/jedec_ts.c
+++ b/sys/dev/jedec_ts/jedec_ts.c
@@ -104,7 +104,7 @@ ts_attach(device_t dev)
uint8_t addr;
addr = smbus_get_addr(dev);
- if ((addr & 0x30) != 0x30) {
+ if ((addr & 0xf0) != 0x30) {
/* Up to 8 slave devices starting at 0x30. */
return (ENXIO);
}
diff --git a/sys/dev/mpr/mpi/mpi2_ioc.h b/sys/dev/mpr/mpi/mpi2_ioc.h
index 37f01c6..003f7cd 100644
--- a/sys/dev/mpr/mpi/mpi2_ioc.h
+++ b/sys/dev/mpr/mpi/mpi2_ioc.h
@@ -688,7 +688,10 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT
MPI2_POINTER pMpi26EventDataActiveCableExcept_t;
/* defines for ReasonCode field */
-#define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00)
+#define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER (0x00)
+#define MPI26_EVENT_ACTIVE_CABLE_PRESENT (0x01)
+#define MPI26_EVENT_ACTIVE_CABLE_DEGRADED (0x02)
+
/* Hard Reset Received Event data */
diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c
index aeb9864..f773df2 100644
--- a/sys/dev/mpr/mpr_sas_lsi.c
+++ b/sys/dev/mpr/mpr_sas_lsi.c
@@ -651,14 +651,26 @@ skip_fp_send:
ace_event_data =
(pMpi26EventDataActiveCableExcept_t)fw_event->event_data;
- if (ace_event_data->ReasonCode ==
- MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) {
- mpr_printf(sc, "Currently an active cable with "
+ switch(ace_event_data->ReasonCode) {
+ case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:
+ {
+ mpr_printf(sc, "Currently a cable with "
"ReceptacleID %d cannot be powered and device "
"connected to this active cable will not be seen. "
"This active cable requires %d mW of power.\n",
ace_event_data->ReceptacleID,
ace_event_data->ActiveCablePowerRequirement);
+ break;
+ }
+ case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
+ {
+ mpr_printf(sc, "Currently a cable with "
+ "ReceptacleID %d is not running at optimal speed "
+ "(12 Gb/s rate)\n", ace_event_data->ReceptacleID);
+ break;
+ }
+ default:
+ break;
}
break;
}
@@ -893,6 +905,7 @@ mprsas_get_sas_address_for_sata_disk(struct mpr_softc *sc,
u8 sas_status;
memset(&ata_identify, 0, sizeof(ata_identify));
+ memset(&mpi_reply, 0, sizeof(mpi_reply));
try_count = 0;
do {
rc = mprsas_get_sata_identify(sc, handle, &mpi_reply,
diff --git a/sys/dev/mpr/mpr_table.c b/sys/dev/mpr/mpr_table.c
index 6ec6492..4674b79 100644
--- a/sys/dev/mpr/mpr_table.c
+++ b/sys/dev/mpr/mpr_table.c
@@ -95,6 +95,12 @@ struct mpr_table_lookup mpr_event_names[] = {
{"SasPhyCounter", 0x22},
{"GpioInterrupt", 0x23},
{"HbdPhyEvent", 0x24},
+ {"SasQuiesce", 0x25},
+ {"SasNotifyPrimitive", 0x26},
+ {"TempThreshold", 0x27},
+ {"HostMessage", 0x28},
+ {"PowerPerformanceChange", 0x29},
+ {"CableEvent", 0x34},
{NULL, 0},
{"Unknown Event", 0}
};
diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h
index b3a61f4..7cb71d6 100644
--- a/sys/dev/mpr/mprvar.h
+++ b/sys/dev/mpr/mprvar.h
@@ -33,7 +33,7 @@
#ifndef _MPRVAR_H
#define _MPRVAR_H
-#define MPR_DRIVER_VERSION "13.01.00.00-fbsd"
+#define MPR_DRIVER_VERSION "15.01.00.00-fbsd"
#define MPR_DB_MAX_WAIT 2500
diff --git a/sys/dev/mvs/mvs.c b/sys/dev/mvs/mvs.c
index b3ff4d1..df35971 100644
--- a/sys/dev/mvs/mvs.c
+++ b/sys/dev/mvs/mvs.c
@@ -2288,10 +2288,6 @@ mvsaction(struct cam_sim *sim, union ccb *ccb)
}
mvs_begin_transaction(dev, ccb);
return;
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/ncr/ncr.c b/sys/dev/ncr/ncr.c
index 6f52f0f..af0019a 100644
--- a/sys/dev/ncr/ncr.c
+++ b/sys/dev/ncr/ncr.c
@@ -4152,10 +4152,6 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
break;
}
case XPT_RESET_DEV: /* Bus Device Reset the specified SCSI device */
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/ofw/ofw_fdt.c b/sys/dev/ofw/ofw_fdt.c
index fc41d5b..aa545a3 100644
--- a/sys/dev/ofw/ofw_fdt.c
+++ b/sys/dev/ofw/ofw_fdt.c
@@ -52,6 +52,15 @@ __FBSDID("$FreeBSD$");
#define debugf(fmt, args...)
#endif
+#if defined(__arm__)
+#if defined(SOC_MV_ARMADAXP) || defined(SOC_MV_ARMADA38X) || \
+ defined(SOC_MV_DISCOVERY) || defined(SOC_MV_DOVE) || \
+ defined(SOC_MV_FREY) || defined(SOC_MV_KIRKWOOD) || \
+ defined(SOC_MV_LOKIPLUS) || defined(SOC_MV_ORION)
+#define FDT_MARVELL
+#endif
+#endif
+
static int ofw_fdt_init(ofw_t, void *);
static phandle_t ofw_fdt_peer(ofw_t, phandle_t);
static phandle_t ofw_fdt_child(ofw_t, phandle_t);
@@ -394,7 +403,7 @@ ofw_fdt_package_to_path(ofw_t ofw, phandle_t package, char *buf, size_t len)
return (-1);
}
-#if defined(__arm__) || defined(__powerpc__)
+#if defined(FDT_MARVELL) || defined(__powerpc__)
static int
ofw_fdt_fixup(ofw_t ofw)
{
@@ -433,7 +442,7 @@ ofw_fdt_fixup(ofw_t ofw)
static int
ofw_fdt_interpret(ofw_t ofw, const char *cmd, int nret, cell_t *retvals)
{
-#if defined(__arm__) || defined(__powerpc__)
+#if defined(FDT_MARVELL) || defined(__powerpc__)
int rv;
/*
diff --git a/sys/dev/qlxgbe/ql_os.c b/sys/dev/qlxgbe/ql_os.c
index b7cda78..77efe6d 100644
--- a/sys/dev/qlxgbe/ql_os.c
+++ b/sys/dev/qlxgbe/ql_os.c
@@ -735,6 +735,7 @@ ql_alloc_dmabuf_exit:
void
ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf)
{
+ bus_dmamap_unload(dma_buf->dma_tag, dma_buf->dma_map);
bus_dmamem_free(dma_buf->dma_tag, dma_buf->dma_b, dma_buf->dma_map);
bus_dma_tag_destroy(dma_buf->dma_tag);
}
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index 8d51fd8..5f105f6 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -1619,9 +1619,9 @@ rt2661_start(struct rt2661_softc *sc)
}
ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
if (rt2661_tx_data(sc, m, ni, ac) != 0) {
- ieee80211_free_node(ni);
if_inc_counter(ni->ni_vap->iv_ifp,
IFCOUNTER_OERRORS, 1);
+ ieee80211_free_node(ni);
break;
}
sc->sc_tx_timer = 5;
diff --git a/sys/arm/freescale/imx/imx_sdhci.c b/sys/dev/sdhci/fsl_sdhci.c
index 39c9508..7e9a983 100644
--- a/sys/arm/freescale/imx/imx_sdhci.c
+++ b/sys/dev/sdhci/fsl_sdhci.c
@@ -28,7 +28,7 @@
__FBSDID("$FreeBSD$");
/*
- * SDHCI driver glue for Freescale i.MX SoC family.
+ * SDHCI driver glue for Freescale i.MX SoC and QorIQ families.
*
* This supports both eSDHC (earlier SoCs) and uSDHC (more recent SoCs).
*/
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/callout.h>
+#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/lock.h>
@@ -52,10 +53,13 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/resource.h>
+#ifdef __arm__
#include <machine/intr.h>
#include <arm/freescale/imx/imx_ccmvar.h>
+#endif
+#include <dev/gpio/gpiobusvar.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -64,9 +68,10 @@ __FBSDID("$FreeBSD$");
#include <dev/mmc/mmcbrvar.h>
#include <dev/sdhci/sdhci.h>
+#include <dev/sdhci/sdhci_fdt_gpio.h>
#include "sdhci_if.h"
-struct imx_sdhci_softc {
+struct fsl_sdhci_softc {
device_t dev;
struct resource * mem_res;
struct resource * irq_res;
@@ -74,10 +79,10 @@ struct imx_sdhci_softc {
struct sdhci_slot slot;
struct callout r1bfix_callout;
sbintime_t r1bfix_timeout_at;
+ struct sdhci_fdt_gpio * gpio;
uint32_t baseclk_hz;
uint32_t cmd_and_mode;
uint32_t r1bfix_intmask;
- boolean_t force_card_present;
uint16_t sdclockreg_freq_bits;
uint8_t r1bfix_type;
uint8_t hwtype;
@@ -88,8 +93,8 @@ struct imx_sdhci_softc {
#define R1BFIX_AC12 2 /* Wait for busy after auto command 12. */
#define HWTYPE_NONE 0 /* Hardware not recognized/supported. */
-#define HWTYPE_ESDHC 1 /* imx5x and earlier. */
-#define HWTYPE_USDHC 2 /* imx6. */
+#define HWTYPE_ESDHC 1 /* fsl5x and earlier. */
+#define HWTYPE_USDHC 2 /* fsl6. */
/*
* Freescale-specific registers, or in some cases the layout of bits within the
@@ -146,7 +151,6 @@ struct imx_sdhci_softc {
#define SDHC_PROT_CDSS (1 << 7)
#define SDHC_SYS_CTRL 0x2c
-#define SDHC_INT_STATUS 0x30
/*
* The clock enable bits exist in different registers for ESDHC vs USDHC, but
@@ -169,31 +173,32 @@ static struct ofw_compat_data compat_data[] = {
{"fsl,imx6sl-usdhc", HWTYPE_USDHC},
{"fsl,imx53-esdhc", HWTYPE_ESDHC},
{"fsl,imx51-esdhc", HWTYPE_ESDHC},
+ {"fsl,esdhc", HWTYPE_ESDHC},
{NULL, HWTYPE_NONE},
};
-static uint16_t imx_sdhc_get_clock(struct imx_sdhci_softc *sc);
-static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val);
-static void imx_sdhci_r1bfix_func(void *arg);
+static uint16_t fsl_sdhc_get_clock(struct fsl_sdhci_softc *sc);
+static void fsl_sdhc_set_clock(struct fsl_sdhci_softc *sc, uint16_t val);
+static void fsl_sdhci_r1bfix_func(void *arg);
static inline uint32_t
-RD4(struct imx_sdhci_softc *sc, bus_size_t off)
+RD4(struct fsl_sdhci_softc *sc, bus_size_t off)
{
return (bus_read_4(sc->mem_res, off));
}
static inline void
-WR4(struct imx_sdhci_softc *sc, bus_size_t off, uint32_t val)
+WR4(struct fsl_sdhci_softc *sc, bus_size_t off, uint32_t val)
{
bus_write_4(sc->mem_res, off, val);
}
static uint8_t
-imx_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off)
+fsl_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32, wrk32;
/*
@@ -246,9 +251,9 @@ imx_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off)
}
static uint16_t
-imx_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off)
+fsl_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32;
if (sc->hwtype == HWTYPE_USDHC) {
@@ -297,16 +302,16 @@ imx_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off)
* hardware type, complex enough to have their own function.
*/
if (off == SDHCI_CLOCK_CONTROL) {
- return (imx_sdhc_get_clock(sc));
+ return (fsl_sdhc_get_clock(sc));
}
return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0xffff);
}
static uint32_t
-imx_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off)
+fsl_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32, wrk32;
val32 = RD4(sc, off);
@@ -342,13 +347,11 @@ imx_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off)
val32 &= 0x000F0F07;
val32 |= (wrk32 >> 4) & SDHCI_STATE_DAT_MASK;
val32 |= (wrk32 >> 9) & SDHCI_RETUNE_REQUEST;
- if (sc->force_card_present)
- val32 |= SDHCI_CARD_PRESENT;
return (val32);
}
/*
- * imx_sdhci_intr() can synthesize a DATA_END interrupt following a
+ * fsl_sdhci_intr() can synthesize a DATA_END interrupt following a
* command with an R1B response, mix it into the hardware status.
*/
if (off == SDHCI_INT_STATUS) {
@@ -359,18 +362,18 @@ imx_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off)
}
static void
-imx_sdhci_read_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off,
+fsl_sdhci_read_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off,
uint32_t *data, bus_size_t count)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
bus_read_multi_4(sc->mem_res, off, data, count);
}
static void
-imx_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val)
+fsl_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32;
/*
@@ -397,6 +400,11 @@ imx_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t
if (off == SDHCI_POWER_CONTROL) {
return;
}
+#ifdef __powerpc__
+ /* XXX Reset doesn't seem to work as expected. Do nothing for now. */
+ if (off == SDHCI_SOFTWARE_RESET)
+ return;
+#endif
val32 = RD4(sc, off & ~3);
val32 &= ~(0xff << (off & 3) * 8);
@@ -406,9 +414,9 @@ imx_sdhci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t
}
static void
-imx_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val)
+fsl_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32;
/*
@@ -416,7 +424,7 @@ imx_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_
* that can handle the ESDHC versus USDHC differences.
*/
if (off == SDHCI_CLOCK_CONTROL) {
- imx_sdhc_set_clock(sc, val);
+ fsl_sdhc_set_clock(sc, val);
return;
}
@@ -432,7 +440,7 @@ imx_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_
* there's a control bit for it (bit 3) in the vendor register.
* When we're starting a command that needs a manual DAT0 line check at
* interrupt time, we leave ourselves a note in r1bfix_type so that we
- * can do the extra work in imx_sdhci_intr().
+ * can do the extra work in fsl_sdhci_intr().
*/
if (off == SDHCI_COMMAND_FLAGS) {
if (val & SDHCI_CMD_DATA) {
@@ -485,9 +493,9 @@ imx_sdhci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_
}
static void
-imx_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val)
+fsl_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
/* Clear synthesized interrupts, then pass the value to the hardware. */
if (off == SDHCI_INT_STATUS) {
@@ -498,16 +506,16 @@ imx_sdhci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_
}
static void
-imx_sdhci_write_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off,
+fsl_sdhci_write_multi_4(device_t dev, struct sdhci_slot *slot, bus_size_t off,
uint32_t *data, bus_size_t count)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
bus_write_multi_4(sc->mem_res, off, data, count);
}
static uint16_t
-imx_sdhc_get_clock(struct imx_sdhci_softc *sc)
+fsl_sdhc_get_clock(struct fsl_sdhci_softc *sc)
{
uint16_t val;
@@ -531,17 +539,20 @@ imx_sdhc_get_clock(struct imx_sdhci_softc *sc)
val |= SDHCI_CLOCK_INT_STABLE;
/*
- * On ESDHC hardware the card bus clock enable is in the usual sdhci
- * register but it's a different bit, so transcribe it (note the
+ * On i.MX ESDHC hardware the card bus clock enable is in the usual
+ * sdhci register but it's a different bit, so transcribe it (note the
* difference between standard SDHCI_ and Freescale SDHC_ prefixes
- * here). On USDHC hardware there is a force-on bit, but no force-off
- * for the card bus clock (the hardware runs the clock when transfers
- * are active no matter what), so we always say the clock is on.
+ * here). On USDHC and QorIQ ESDHC hardware there is a force-on bit, but
+ * no force-off for the card bus clock (the hardware runs the clock when
+ * transfers are active no matter what), so we always say the clock is
+ * on.
* XXX Maybe we should say it's in whatever state the sdhci driver last
* set it to.
*/
if (sc->hwtype == HWTYPE_ESDHC) {
+#ifdef __arm__
if (RD4(sc, SDHC_SYS_CTRL) & SDHC_CLK_SDCLKEN)
+#endif
val |= SDHCI_CLOCK_CARD_EN;
} else {
val |= SDHCI_CLOCK_CARD_EN;
@@ -551,7 +562,7 @@ imx_sdhc_get_clock(struct imx_sdhci_softc *sc)
}
static void
-imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val)
+fsl_sdhc_set_clock(struct fsl_sdhci_softc *sc, uint16_t val)
{
uint32_t divisor, freq, prescale, val32;
@@ -565,15 +576,18 @@ imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val)
sc->sdclockreg_freq_bits = val & SDHCI_DIVIDERS_MASK;
if (sc->hwtype == HWTYPE_ESDHC) {
/*
- * The ESDHC hardware requires the driver to manually start and
- * stop the sd bus clock. If the enable bit is not set, turn
- * off the clock in hardware and we're done, otherwise decode
- * the requested frequency. ESDHC hardware is sdhci 2.0; the
- * sdhci driver will use the original 8-bit divisor field and
- * the "base / 2^N" divisor scheme.
+ * The i.MX5 ESDHC hardware requires the driver to manually
+ * start and stop the sd bus clock. If the enable bit is not
+ * set, turn off the clock in hardware and we're done, otherwise
+ * decode the requested frequency. ESDHC hardware is sdhci 2.0;
+ * the sdhci driver will use the original 8-bit divisor field
+ * and the "base / 2^N" divisor scheme.
*/
if ((val & SDHCI_CLOCK_CARD_EN) == 0) {
+#ifdef __arm__
+ /* On QorIQ, this is a reserved bit. */
WR4(sc, SDHCI_CLOCK_CONTROL, val32 & ~SDHC_CLK_SDCLKEN);
+#endif
return;
}
@@ -625,11 +639,12 @@ imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val)
val32 &= ~(SDHC_CLK_DIVISOR_MASK | SDHC_CLK_PRESCALE_MASK);
val32 |= divisor << SDHC_CLK_DIVISOR_SHIFT;
val32 |= prescale << SDHC_CLK_PRESCALE_SHIFT;
+ val32 |= SDHC_CLK_IPGEN;
WR4(sc, SDHCI_CLOCK_CONTROL, val32);
}
static boolean_t
-imx_sdhci_r1bfix_is_wait_done(struct imx_sdhci_softc *sc)
+fsl_sdhci_r1bfix_is_wait_done(struct fsl_sdhci_softc *sc)
{
uint32_t inhibit;
@@ -646,7 +661,7 @@ imx_sdhci_r1bfix_is_wait_done(struct imx_sdhci_softc *sc)
if (inhibit && getsbinuptime() < sc->r1bfix_timeout_at) {
callout_reset_sbt(&sc->r1bfix_callout, SBT_1MS, 0,
- imx_sdhci_r1bfix_func, sc, 0);
+ fsl_sdhci_r1bfix_func, sc, 0);
return (false);
}
@@ -670,22 +685,22 @@ imx_sdhci_r1bfix_is_wait_done(struct imx_sdhci_softc *sc)
}
static void
-imx_sdhci_r1bfix_func(void * arg)
+fsl_sdhci_r1bfix_func(void * arg)
{
- struct imx_sdhci_softc *sc = arg;
+ struct fsl_sdhci_softc *sc = arg;
boolean_t r1bwait_done;
mtx_lock(&sc->slot.mtx);
- r1bwait_done = imx_sdhci_r1bfix_is_wait_done(sc);
+ r1bwait_done = fsl_sdhci_r1bfix_is_wait_done(sc);
mtx_unlock(&sc->slot.mtx);
if (r1bwait_done)
sdhci_generic_intr(&sc->slot);
}
static void
-imx_sdhci_intr(void *arg)
+fsl_sdhci_intr(void *arg)
{
- struct imx_sdhci_softc *sc = arg;
+ struct fsl_sdhci_softc *sc = arg;
uint32_t intmask;
mtx_lock(&sc->slot.mtx);
@@ -710,10 +725,10 @@ imx_sdhci_intr(void *arg)
*/
switch (sc->r1bfix_type) {
case R1BFIX_NODATA:
- intmask = RD4(sc, SDHC_INT_STATUS) & SDHCI_INT_RESPONSE;
+ intmask = RD4(sc, SDHCI_INT_STATUS) & SDHCI_INT_RESPONSE;
break;
case R1BFIX_AC12:
- intmask = RD4(sc, SDHC_INT_STATUS) & SDHCI_INT_DATA_END;
+ intmask = RD4(sc, SDHCI_INT_STATUS) & SDHCI_INT_DATA_END;
break;
default:
intmask = 0;
@@ -721,9 +736,9 @@ imx_sdhci_intr(void *arg)
}
if (intmask) {
sc->r1bfix_timeout_at = getsbinuptime() + 250 * SBT_1MS;
- if (!imx_sdhci_r1bfix_is_wait_done(sc)) {
- WR4(sc, SDHC_INT_STATUS, intmask);
- bus_barrier(sc->mem_res, SDHC_INT_STATUS, 4,
+ if (!fsl_sdhci_r1bfix_is_wait_done(sc)) {
+ WR4(sc, SDHCI_INT_STATUS, intmask);
+ bus_barrier(sc->mem_res, SDHCI_INT_STATUS, 4,
BUS_SPACE_BARRIER_WRITE);
}
}
@@ -733,31 +748,85 @@ imx_sdhci_intr(void *arg)
}
static int
-imx_sdhci_get_ro(device_t bus, device_t child)
+fsl_sdhci_get_ro(device_t bus, device_t child)
+{
+ struct fsl_sdhci_softc *sc = device_get_softc(bus);
+
+ return (sdhci_fdt_gpio_get_readonly(sc->gpio));
+}
+
+static bool
+fsl_sdhci_get_card_present(device_t dev, struct sdhci_slot *slot)
{
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
- return (false);
+ return (sdhci_fdt_gpio_get_present(sc->gpio));
}
+#ifdef __powerpc__
+static uint32_t
+fsl_sdhci_get_platform_clock(device_t dev)
+{
+ device_t parent;
+ phandle_t node;
+ uint32_t clock;
+
+ node = ofw_bus_get_node(dev);
+
+ /* Get sdhci node properties */
+ if((OF_getprop(node, "clock-frequency", (void *)&clock,
+ sizeof(clock)) <= 0) || (clock == 0)) {
+
+ /*
+ * Trying to get clock from parent device (soc) if correct
+ * clock cannot be acquired from sdhci node.
+ */
+ parent = device_get_parent(dev);
+ node = ofw_bus_get_node(parent);
+
+ /* Get soc properties */
+ if ((OF_getprop(node, "bus-frequency", (void *)&clock,
+ sizeof(clock)) <= 0) || (clock == 0)) {
+ device_printf(dev,"Cannot acquire correct sdhci "
+ "frequency from DTS.\n");
+
+ return (0);
+ }
+ /* eSDHC clock is 1/2 platform clock. */
+ clock /= 2;
+ }
+
+ if (bootverbose)
+ device_printf(dev, "Acquired clock: %d from DTS\n", clock);
+
+ return (clock);
+}
+#endif
+
+
static int
-imx_sdhci_detach(device_t dev)
+fsl_sdhci_detach(device_t dev)
{
+ /* sdhci_fdt_gpio_teardown(sc->gpio); */
return (EBUSY);
}
static int
-imx_sdhci_attach(device_t dev)
+fsl_sdhci_attach(device_t dev)
{
- struct imx_sdhci_softc *sc = device_get_softc(dev);
+ struct fsl_sdhci_softc *sc = device_get_softc(dev);
int rid, err;
+#ifdef __powerpc__
phandle_t node;
+ uint32_t protctl;
+#endif
sc->dev = dev;
sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
if (sc->hwtype == HWTYPE_NONE)
- panic("Impossible: not compatible in imx_sdhci_attach()");
+ panic("Impossible: not compatible in fsl_sdhci_attach()");
rid = 0;
sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
@@ -778,7 +847,7 @@ imx_sdhci_attach(device_t dev)
}
if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
- NULL, imx_sdhci_intr, sc, &sc->intr_cookie)) {
+ NULL, fsl_sdhci_intr, sc, &sc->intr_cookie)) {
device_printf(dev, "cannot setup interrupt handler\n");
err = ENXIO;
goto fail;
@@ -807,29 +876,40 @@ imx_sdhci_attach(device_t dev)
*
* XXX need named constants for this stuff.
*/
- WR4(sc, SDHC_WTMK_LVL, 0x08800880);
+ /* P1022 has the '*_BRST_LEN' fields as reserved, always reading 0x10 */
+ if (ofw_bus_is_compatible(dev, "fsl,p1022-esdhc"))
+ WR4(sc, SDHC_WTMK_LVL, 0x10801080);
+ else
+ WR4(sc, SDHC_WTMK_LVL, 0x08800880);
+ /*
+ * We read in native byte order in the main driver, but the register
+ * defaults to little endian.
+ */
+#ifdef __powerpc__
+ sc->baseclk_hz = fsl_sdhci_get_platform_clock(dev);
+#else
sc->baseclk_hz = imx_ccm_sdhci_hz();
+#endif
sc->slot.max_clk = sc->baseclk_hz;
/*
- * If the slot is flagged with the non-removable property, set our flag
- * to always force the SDHCI_CARD_PRESENT bit on.
- *
- * XXX Workaround for gpio-based card detect...
- *
- * We don't have gpio support yet. If there's a cd-gpios property just
- * force the SDHCI_CARD_PRESENT bit on for now. If there isn't really a
- * card there it will fail to probe at the mmc layer and nothing bad
- * happens except instantiating an mmcN device for an empty slot.
+ * Set up any gpio pin handling described in the FDT data. This cannot
+ * fail; see comments in sdhci_fdt_gpio.h for details.
*/
+ sc->gpio = sdhci_fdt_gpio_setup(dev, &sc->slot);
+
+#ifdef __powerpc__
node = ofw_bus_get_node(dev);
- if (OF_hasprop(node, "non-removable"))
- sc->force_card_present = true;
- else if (OF_hasprop(node, "cd-gpios")) {
- /* XXX put real gpio hookup here. */
- sc->force_card_present = true;
- }
+ /* Default to big-endian on powerpc */
+ protctl = RD4(sc, SDHC_PROT_CTRL);
+ protctl &= ~SDHC_PROT_EMODE_MASK;
+ if (OF_hasprop(node, "little-endian"))
+ protctl |= SDHC_PROT_EMODE_LITTLE;
+ else
+ protctl |= SDHC_PROT_EMODE_BIG;
+ WR4(sc, SDHC_PROT_CTRL, protctl);
+#endif
callout_init(&sc->r1bfix_callout, 1);
sdhci_init_slot(dev, &sc->slot, 0);
@@ -853,7 +933,7 @@ fail:
}
static int
-imx_sdhci_probe(device_t dev)
+fsl_sdhci_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
@@ -872,11 +952,11 @@ imx_sdhci_probe(device_t dev)
return (ENXIO);
}
-static device_method_t imx_sdhci_methods[] = {
+static device_method_t fsl_sdhci_methods[] = {
/* Device interface */
- DEVMETHOD(device_probe, imx_sdhci_probe),
- DEVMETHOD(device_attach, imx_sdhci_attach),
- DEVMETHOD(device_detach, imx_sdhci_detach),
+ DEVMETHOD(device_probe, fsl_sdhci_probe),
+ DEVMETHOD(device_attach, fsl_sdhci_attach),
+ DEVMETHOD(device_detach, fsl_sdhci_detach),
/* Bus interface */
DEVMETHOD(bus_read_ivar, sdhci_generic_read_ivar),
@@ -886,32 +966,33 @@ static device_method_t imx_sdhci_methods[] = {
/* MMC bridge interface */
DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios),
DEVMETHOD(mmcbr_request, sdhci_generic_request),
- DEVMETHOD(mmcbr_get_ro, imx_sdhci_get_ro),
+ DEVMETHOD(mmcbr_get_ro, fsl_sdhci_get_ro),
DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host),
DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host),
- /* SDHCI registers accessors */
- DEVMETHOD(sdhci_read_1, imx_sdhci_read_1),
- DEVMETHOD(sdhci_read_2, imx_sdhci_read_2),
- DEVMETHOD(sdhci_read_4, imx_sdhci_read_4),
- DEVMETHOD(sdhci_read_multi_4, imx_sdhci_read_multi_4),
- DEVMETHOD(sdhci_write_1, imx_sdhci_write_1),
- DEVMETHOD(sdhci_write_2, imx_sdhci_write_2),
- DEVMETHOD(sdhci_write_4, imx_sdhci_write_4),
- DEVMETHOD(sdhci_write_multi_4, imx_sdhci_write_multi_4),
+ /* SDHCI accessors */
+ DEVMETHOD(sdhci_read_1, fsl_sdhci_read_1),
+ DEVMETHOD(sdhci_read_2, fsl_sdhci_read_2),
+ DEVMETHOD(sdhci_read_4, fsl_sdhci_read_4),
+ DEVMETHOD(sdhci_read_multi_4, fsl_sdhci_read_multi_4),
+ DEVMETHOD(sdhci_write_1, fsl_sdhci_write_1),
+ DEVMETHOD(sdhci_write_2, fsl_sdhci_write_2),
+ DEVMETHOD(sdhci_write_4, fsl_sdhci_write_4),
+ DEVMETHOD(sdhci_write_multi_4, fsl_sdhci_write_multi_4),
+ DEVMETHOD(sdhci_get_card_present,fsl_sdhci_get_card_present),
{ 0, 0 }
};
-static devclass_t imx_sdhci_devclass;
+static devclass_t fsl_sdhci_devclass;
-static driver_t imx_sdhci_driver = {
- "sdhci_imx",
- imx_sdhci_methods,
- sizeof(struct imx_sdhci_softc),
+static driver_t fsl_sdhci_driver = {
+ "sdhci_fsl",
+ fsl_sdhci_methods,
+ sizeof(struct fsl_sdhci_softc),
};
-DRIVER_MODULE(sdhci_imx, simplebus, imx_sdhci_driver, imx_sdhci_devclass, 0, 0);
-MODULE_DEPEND(sdhci_imx, sdhci, 1, 1, 1);
-DRIVER_MODULE(mmc, sdhci_imx, mmc_driver, mmc_devclass, NULL, NULL);
-MODULE_DEPEND(sdhci_imx, mmc, 1, 1, 1);
+DRIVER_MODULE(sdhci_fsl, simplebus, fsl_sdhci_driver, fsl_sdhci_devclass, 0, 0);
+MODULE_DEPEND(sdhci_fsl, sdhci, 1, 1, 1);
+DRIVER_MODULE(mmc, sdhci_fsl, mmc_driver, mmc_devclass, NULL, NULL);
+MODULE_DEPEND(sdhci_fsl, mmc, 1, 1, 1);
diff --git a/sys/dev/sdhci/sdhci_acpi.c b/sys/dev/sdhci/sdhci_acpi.c
index a2a2cab..fff6923 100644
--- a/sys/dev/sdhci/sdhci_acpi.c
+++ b/sys/dev/sdhci/sdhci_acpi.c
@@ -60,9 +60,11 @@ static const struct sdhci_acpi_device {
const char *desc;
u_int quirks;
} sdhci_acpi_devices[] = {
- { "80860F14", 1, "Intel Bay Trail eMMC 4.5 Controller",
+ { "80860F14", 1, "Intel Bay Trail SD Host Controller",
SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE |
SDHCI_QUIRK_INTEL_POWER_UP_RESET },
+ { "80860F14", 3, "Intel Bay Trail SD Host Controller",
+ SDHCI_QUIRK_INTEL_POWER_UP_RESET },
{ "80860F16", 0, "Intel Bay Trail SD Host Controller",
0 },
{ NULL, 0, NULL, 0}
diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.c b/sys/dev/sdhci/sdhci_fdt_gpio.c
new file mode 100644
index 0000000..77bc745
--- /dev/null
+++ b/sys/dev/sdhci/sdhci_fdt_gpio.c
@@ -0,0 +1,257 @@
+/*-
+ * Copyright (c) 2017 Ian Lepore <ian@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Support routines usable by any SoC sdhci bridge driver that uses gpio pins
+ * for card detect and write protect, and uses FDT data to describe those pins.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/gpio.h>
+#include <sys/sysctl.h>
+#include <sys/systm.h>
+#include <sys/taskqueue.h>
+
+#include <dev/gpio/gpiobusvar.h>
+#include <dev/mmc/bridge.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/sdhci/sdhci.h>
+#include <dev/sdhci/sdhci_fdt_gpio.h>
+
+struct sdhci_fdt_gpio {
+ device_t dev;
+ struct sdhci_slot * slot;
+ gpio_pin_t wp_pin;
+ gpio_pin_t cd_pin;
+ void * cd_ihandler;
+ struct resource * cd_ires;
+ int cd_irid;
+ bool wp_disabled;
+ bool wp_inverted;
+ bool cd_disabled;
+ bool cd_inverted;
+};
+
+/*
+ * Card detect interrupt handler.
+ */
+static void
+cd_intr(void *arg)
+{
+ struct sdhci_fdt_gpio *gpio = arg;
+
+ sdhci_handle_card_present(gpio->slot, sdhci_fdt_gpio_get_present(gpio));
+}
+
+/*
+ * Card detect setup.
+ */
+static void
+cd_setup(struct sdhci_fdt_gpio *gpio, phandle_t node)
+{
+ int pincaps;
+ device_t dev;
+ const char *cd_mode_str;
+
+ dev = gpio->dev;
+
+ /*
+ * If the device is flagged as non-removable, set that slot option, and
+ * set a flag to make sdhci_fdt_gpio_get_present() always return true.
+ */
+ if (OF_hasprop(node, "non-removable")) {
+ gpio->slot->opt |= SDHCI_NON_REMOVABLE;
+ gpio->cd_disabled = true;
+ if (bootverbose)
+ device_printf(dev, "Non-removable media");
+ return;
+ }
+
+ /*
+ * If there is no cd-gpios property, then presumably the hardware
+ * PRESENT_STATE register and interrupts will reflect card state
+ * properly, and there's nothing more for us to do. Our get_present()
+ * will return sdhci_generic_get_card_present() because cd_pin is NULL.
+ *
+ * If there is a property, make sure we can read the pin.
+ */
+ if (gpio_pin_get_by_ofw_property(dev, node, "cd-gpios", &gpio->cd_pin))
+ return;
+
+ if (gpio_pin_getcaps(gpio->cd_pin, &pincaps) != 0 ||
+ !(pincaps & GPIO_PIN_INPUT)) {
+ device_printf(dev, "Cannot read card-detect gpio pin; "
+ "setting card-always-present flag.\n");
+ gpio->cd_disabled = true;
+ return;
+ }
+
+ if (OF_hasprop(node, "cd-inverted"))
+ gpio->cd_inverted = true;
+
+ /*
+ * If the pin can trigger an interrupt on both rising and falling edges,
+ * we can use it to detect card presence changes. If not, we'll request
+ * card presence polling instead of using interrupts.
+ */
+ if (!(pincaps & GPIO_INTR_EDGE_BOTH)) {
+ if (bootverbose)
+ device_printf(dev, "Cannot configure "
+ "GPIO_INTR_EDGE_BOTH for card detect\n");
+ goto without_interrupts;
+ }
+
+ /*
+ * Create an interrupt resource from the pin and set up the interrupt.
+ */
+ if ((gpio->cd_ires = gpio_alloc_intr_resource(dev, &gpio->cd_irid,
+ RF_ACTIVE, gpio->cd_pin, GPIO_INTR_EDGE_BOTH)) == NULL) {
+ if (bootverbose)
+ device_printf(dev, "Cannot allocate an IRQ for card "
+ "detect GPIO\n");
+ goto without_interrupts;
+ }
+
+ if (bus_setup_intr(dev, gpio->cd_ires, INTR_TYPE_BIO | INTR_MPSAFE,
+ NULL, cd_intr, gpio, &gpio->cd_ihandler) != 0) {
+ device_printf(dev, "Unable to setup card-detect irq handler\n");
+ gpio->cd_ihandler = NULL;
+ goto without_interrupts;
+ }
+
+without_interrupts:
+
+ /*
+ * If we have a readable gpio pin, but didn't successfully configure
+ * gpio interrupts, ask the sdhci driver to poll from a callout.
+ */
+ if (gpio->cd_ihandler == NULL) {
+ cd_mode_str = "polling";
+ gpio->slot->quirks |= SDHCI_QUIRK_POLL_CARD_PRESENT;
+ } else {
+ cd_mode_str = "interrupts";
+ }
+
+ if (bootverbose) {
+ device_printf(dev, "Card presence detect on %s pin %u, "
+ "configured for %s.\n",
+ device_get_nameunit(gpio->cd_pin->dev), gpio->cd_pin->pin,
+ cd_mode_str);
+ }
+}
+
+/*
+ * Write protect setup.
+ */
+static void
+wp_setup(struct sdhci_fdt_gpio *gpio, phandle_t node)
+{
+ device_t dev;
+
+ dev = gpio->dev;
+
+ if (OF_hasprop(node, "wp-disable"))
+ return;
+
+ if (gpio_pin_get_by_ofw_property(dev, node, "wp-gpios", &gpio->wp_pin))
+ return;
+
+ if (OF_hasprop(node, "wp-inverted"))
+ gpio->wp_inverted = true;
+
+ if (bootverbose)
+ device_printf(dev, "Write protect switch on %s pin %u\n",
+ device_get_nameunit(gpio->wp_pin->dev), gpio->wp_pin->pin);
+}
+
+struct sdhci_fdt_gpio *
+sdhci_fdt_gpio_setup(device_t dev, struct sdhci_slot *slot)
+{
+ phandle_t node;
+ struct sdhci_fdt_gpio *gpio;
+
+ gpio = malloc(sizeof(*gpio), M_DEVBUF, M_ZERO | M_WAITOK);
+ gpio->dev = dev;
+ gpio->slot = slot;
+
+ node = ofw_bus_get_node(dev);
+
+ wp_setup(gpio, node);
+ cd_setup(gpio, node);
+
+ return (gpio);
+}
+
+void
+sdhci_fdt_gpio_teardown(struct sdhci_fdt_gpio *gpio)
+{
+
+ if (gpio == NULL)
+ return;
+
+ if (gpio->cd_ihandler != NULL) {
+ bus_teardown_intr(gpio->dev, gpio->cd_ires, gpio->cd_ihandler);
+ }
+
+ free(gpio, M_DEVBUF);
+}
+
+bool
+sdhci_fdt_gpio_get_present(struct sdhci_fdt_gpio *gpio)
+{
+ bool pinstate;
+
+ if (gpio->cd_disabled)
+ return (true);
+
+ if (gpio->cd_pin == NULL)
+ return (sdhci_generic_get_card_present(gpio->slot->bus,
+ gpio->slot));
+
+ gpio_pin_is_active(gpio->cd_pin, &pinstate);
+
+ return (pinstate ^ gpio->cd_inverted);
+}
+
+int
+sdhci_fdt_gpio_get_readonly(struct sdhci_fdt_gpio *gpio)
+{
+ bool pinstate;
+
+ if (gpio->wp_disabled)
+ return (false);
+
+ if (gpio->wp_pin == NULL)
+ return (sdhci_generic_get_ro(gpio->slot->bus, gpio->slot->dev));
+
+ gpio_pin_is_active(gpio->wp_pin, &pinstate);
+
+ return (pinstate ^ gpio->wp_inverted);
+}
diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.h b/sys/dev/sdhci/sdhci_fdt_gpio.h
new file mode 100644
index 0000000..6d51737
--- /dev/null
+++ b/sys/dev/sdhci/sdhci_fdt_gpio.h
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2017 Ian Lepore <ian@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Support routines usable by any SoC sdhci bridge driver that uses gpio pins
+ * for card detect and/or write protect, and uses FDT data to describe those
+ * pins. A bridge driver need only supply a couple 2-line forwarding functions
+ * to connect the get_present and get_readonly accessors to the corresponding
+ * driver interface functions, and add setup/teardown calls to its attach and
+ * detach functions.
+ */
+
+#ifndef _SDHCI_FDT_GPIO_H_
+#define _SDHCI_FDT_GPIO_H_
+
+struct sdhci_slot;
+struct sdhci_fdt_gpio;
+
+/*
+ * sdhci_fdt_gpio_setup()
+ * sdhci_fdt_gpio_teardown()
+ *
+ * Process FDT properties that use gpio pins and set up interrupt handling (if
+ * supported by hardware) and accessor functions to read the pins.
+ *
+ * Setup cannot fail. If the properties are not present, the accessors will
+ * return the values from standard sdhci registers. If the gpio controller
+ * can't trigger interrupts on both edges, it configures the slot to use polling
+ * for card presence detection. If it can't access the gpio pin at all it sets
+ * up the get_present() accessor to always return true. Likewise the
+ * get_readonly() accessor always returns false if its pin can't be accessed.
+ */
+struct sdhci_fdt_gpio *sdhci_fdt_gpio_setup(device_t dev, struct sdhci_slot *slot);
+void sdhci_fdt_gpio_teardown(struct sdhci_fdt_gpio *gpio);
+
+/*
+ * sdhci_fdt_gpio_get_present()
+ * sdhci_fdt_gpio_get_readonly()
+ *
+ * Gpio pin state accessor functions.
+ */
+bool sdhci_fdt_gpio_get_present(struct sdhci_fdt_gpio *gpio);
+int sdhci_fdt_gpio_get_readonly(struct sdhci_fdt_gpio *gpio);
+
+#endif
diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c
index 989a780..5f1e7d2 100644
--- a/sys/dev/siis/siis.c
+++ b/sys/dev/siis/siis.c
@@ -1835,10 +1835,6 @@ siisaction(struct cam_sim *sim, union ccb *ccb)
}
siis_begin_transaction(dev, ccb);
return;
- case XPT_EN_LUN: /* Enable LUN as a target */
- case XPT_TARGET_IO: /* Execute target I/O request */
- case XPT_ACCEPT_TARGET_IO: /* Accept Host Target Mode CDB */
- case XPT_CONT_TARGET_IO: /* Continue Host Target I/O Connection*/
case XPT_ABORT: /* Abort the specified CCB */
/* XXX Implement */
ccb->ccb_h.status = CAM_REQ_INVALID;
diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c
index 44cb78f..e4e87b1 100644
--- a/sys/dev/sym/sym_hipd.c
+++ b/sys/dev/sym/sym_hipd.c
@@ -8090,11 +8090,6 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
sym_init (np, 1);
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
break;
- case XPT_ACCEPT_TARGET_IO:
- case XPT_CONT_TARGET_IO:
- case XPT_EN_LUN:
- case XPT_NOTIFY_ACK:
- case XPT_IMMED_NOTIFY:
case XPT_TERM_IO:
default:
sym_xpt_done2(np, ccb, CAM_REQ_INVALID);
diff --git a/sys/dev/trm/trm.c b/sys/dev/trm/trm.c
index e5f02dd..e44dc1e 100644
--- a/sys/dev/trm/trm.c
+++ b/sys/dev/trm/trm.c
@@ -543,11 +543,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
target_lun = pccb->ccb_h.target_lun;
switch (pccb->ccb_h.func_code) {
- case XPT_NOOP:
- TRM_DPRINTF(" XPT_NOOP \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
/*
* Execute the requested I/O operation
*/
@@ -623,16 +618,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
}
break;
}
- case XPT_GDEV_TYPE:
- TRM_DPRINTF(" XPT_GDEV_TYPE \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- case XPT_GDEVLIST:
- TRM_DPRINTF(" XPT_GDEVLIST \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
/*
* Path routing inquiry
* Path Inquiry CCB
@@ -661,76 +646,33 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
cpi->protocol_version = SCSI_REV_2;
cpi->ccb_h.status = CAM_REQ_CMP;
xpt_done(pccb);
- }
break;
+ }
/*
- * Release a frozen SIM queue
- * Release SIM Queue
+ * XPT_ABORT = 0x10, Abort the specified CCB
+ * Abort XPT request CCB
*/
- case XPT_REL_SIMQ:
- TRM_DPRINTF(" XPT_REL_SIMQ \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Set Asynchronous Callback Parameters
- * Set Asynchronous Callback CCB
- */
- case XPT_SASYNC_CB:
- TRM_DPRINTF(" XPT_SASYNC_CB \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Set device type information
- * Set Device Type CCB
- */
- case XPT_SDEV_TYPE:
- TRM_DPRINTF(" XPT_SDEV_TYPE \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Get EDT entries matching the given pattern
- */
- case XPT_DEV_MATCH:
- TRM_DPRINTF(" XPT_DEV_MATCH \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Turn on debugging for a bus, target or lun
- */
- case XPT_DEBUG:
- TRM_DPRINTF(" XPT_DEBUG \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * XPT_ABORT = 0x10, Abort the specified CCB
- * Abort XPT request CCB
- */
case XPT_ABORT:
TRM_DPRINTF(" XPT_ABORT \n");
pccb->ccb_h.status = CAM_REQ_INVALID;
xpt_done(pccb);
break;
/*
- * Reset the specified SCSI bus
- * Reset SCSI Bus CCB
- */
- case XPT_RESET_BUS: {
+ * Reset the specified SCSI bus
+ * Reset SCSI Bus CCB
+ */
+ case XPT_RESET_BUS: {
int i;
TRM_DPRINTF(" XPT_RESET_BUS \n");
- trm_reset(pACB);
+ trm_reset(pACB);
pACB->ACBFlag=0;
for (i=0; i<500; i++)
DELAY(1000);
pccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(pccb);
- }
break;
+ }
/*
* Bus Device Reset the specified SCSI device
* Reset SCSI Device CCB
@@ -929,92 +871,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
cam_calc_geometry(&pccb->ccg, /*extended*/1);
xpt_done(pccb);
break;
- case XPT_ENG_INQ:
- TRM_DPRINTF(" XPT_ENG_INQ \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * HBA execute engine request
- * This structure must match SCSIIO size
- */
- case XPT_ENG_EXEC:
- TRM_DPRINTF(" XPT_ENG_EXEC \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * XPT_EN_LUN = 0x30, Enable LUN as a target
- * Target mode structures.
- */
- case XPT_EN_LUN:
- /*
- * Don't (yet?) support vendor
- * specific commands.
- */
- TRM_DPRINTF(" XPT_EN_LUN \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Execute target I/O request
- */
- case XPT_TARGET_IO:
- /*
- * Don't (yet?) support vendor
- * specific commands.
- */
- TRM_DPRINTF(" XPT_TARGET_IO \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Accept Host Target Mode CDB
- */
- case XPT_ACCEPT_TARGET_IO:
- /*
- * Don't (yet?) support vendor
- * specific commands.
- */
- TRM_DPRINTF(" XPT_ACCEPT_TARGET_IO \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Continue Host Target I/O Connection
- */
- case XPT_CONT_TARGET_IO:
- /*
- * Don't (yet?) support vendor
- * specific commands.
- */
- TRM_DPRINTF(" XPT_CONT_TARGET_IO \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Notify Host Target driver of event
- */
- case XPT_IMMED_NOTIFY:
- TRM_DPRINTF(" XPT_IMMED_NOTIFY \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * Acknowledgement of event
- */
- case XPT_NOTIFY_ACK:
- TRM_DPRINTF(" XPT_NOTIFY_ACK \n");
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
- /*
- * XPT_VUNIQUE = 0x80
- */
- case XPT_VUNIQUE:
- pccb->ccb_h.status = CAM_REQ_INVALID;
- xpt_done(pccb);
- break;
default:
pccb->ccb_h.status = CAM_REQ_INVALID;
xpt_done(pccb);
diff --git a/sys/dev/usb/controller/ehci_imx.c b/sys/dev/usb/controller/ehci_imx.c
index df4d202..4ebccdf 100644
--- a/sys/dev/usb/controller/ehci_imx.c
+++ b/sys/dev/usb/controller/ehci_imx.c
@@ -298,8 +298,9 @@ imx_ehci_attach(device_t dev)
* Set flags that affect ehci_init() behavior, and hook our post-reset
* code into the standard controller code.
*/
- esc->sc_flags |= EHCI_SCFLG_NORESTERM;
+ esc->sc_flags |= EHCI_SCFLG_NORESTERM | EHCI_SCFLG_TT;
esc->sc_vendor_post_reset = imx_ehci_post_reset;
+ esc->sc_vendor_get_port_speed = ehci_get_port_speed_portsc;
err = ehci_init(esc);
if (err != 0) {
diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index 686a401..e27c95f 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -1102,6 +1102,7 @@ u3g_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{
struct u3g_softc *sc = ucom->sc_parent;
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr[ucom->sc_subunit];
*msr = sc->sc_msr[ucom->sc_subunit];
}
diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c
index e0e6d0b..a1c8976 100644
--- a/sys/dev/usb/serial/uark.c
+++ b/sys/dev/usb/serial/uark.c
@@ -427,6 +427,7 @@ uark_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{
struct uark_softc *sc = ucom->sc_parent;
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c
index 5fac56a..7415968 100644
--- a/sys/dev/usb/serial/ubsa.c
+++ b/sys/dev/usb/serial/ubsa.c
@@ -650,11 +650,19 @@ ubsa_intr_callback(struct usb_xfer *xfer, usb_error_t error)
usbd_copy_out(pc, 0, buf, sizeof(buf));
/*
- * incidentally, Belkin adapter status bits match
- * UART 16550 bits
+ * MSR bits need translation from ns16550 to SER_* values.
+ * LSR bits are ns16550 in hardware and ucom.
*/
+ sc->sc_msr = 0;
+ if (buf[3] & UBSA_MSR_CTS)
+ sc->sc_msr |= SER_CTS;
+ if (buf[3] & UBSA_MSR_DCD)
+ sc->sc_msr |= SER_DCD;
+ if (buf[3] & UBSA_MSR_RI)
+ sc->sc_msr |= SER_RI;
+ if (buf[3] & UBSA_MSR_DSR)
+ sc->sc_msr |= SER_DSR;
sc->sc_lsr = buf[2];
- sc->sc_msr = buf[3];
DPRINTF("lsr = 0x%02x, msr = 0x%02x\n",
sc->sc_lsr, sc->sc_msr);
@@ -663,7 +671,7 @@ ubsa_intr_callback(struct usb_xfer *xfer, usb_error_t error)
} else {
DPRINTF("ignoring short packet, %d bytes\n", actlen);
}
-
+ /* FALLTHROUGH */
case USB_ST_SETUP:
tr_setup:
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c
index d1063fd..e3fdeed 100644
--- a/sys/dev/usb/serial/uchcom.c
+++ b/sys/dev/usb/serial/uchcom.c
@@ -625,6 +625,7 @@ uchcom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
DPRINTF("\n");
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c
index fb526cd..dfb41e1 100644
--- a/sys/dev/usb/serial/ufoma.c
+++ b/sys/dev/usb/serial/ufoma.c
@@ -900,6 +900,7 @@ ufoma_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{
struct ufoma_softc *sc = ucom->sc_parent;
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c
index 8b7e620..bdad318 100644
--- a/sys/dev/usb/serial/uftdi.c
+++ b/sys/dev/usb/serial/uftdi.c
@@ -1123,6 +1123,9 @@ uftdi_attach(device_t dev)
FTDI_SIO_SET_DATA_PARITY_NONE |
FTDI_SIO_SET_DATA_BITS(8));
+ /* Indicate tx bits in sc_lsr can be used to determine busy vs idle. */
+ ucom_use_lsr_txbits(&sc->sc_ucom);
+
error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
&uftdi_callback, &sc->sc_mtx);
if (error) {
@@ -1279,16 +1282,20 @@ uftdi_read_callback(struct usb_xfer *xfer, usb_error_t error)
offset = 0;
/*
* Extract packet headers and payload bytes from the buffer.
- * Feed payload bytes to ucom/tty layer; OR-accumulate header
- * status bits which are transient and could toggle with each
- * packet. After processing all packets in the buffer, process
- * the accumulated transient MSR and LSR values along with the
+ * Feed payload bytes to ucom/tty layer; OR-accumulate the
+ * receiver-related header status bits which are transient and
+ * could toggle with each packet, but for transmitter-related
+ * bits keep only the ones from the last packet.
+ *
+ * After processing all packets in the buffer, process the
+ * accumulated transient MSR and LSR values along with the
* non-transient bits from the last packet header.
*/
while (buflen >= UFTDI_IHDRSIZE) {
usbd_copy_out(pc, offset, buf, UFTDI_IHDRSIZE);
offset += UFTDI_IHDRSIZE;
buflen -= UFTDI_IHDRSIZE;
+ lsr &= ~(ULSR_TXRDY | ULSR_TSRE);
lsr |= FTDI_GET_LSR(buf);
if (FTDI_GET_MSR(buf) & FTDI_SIO_RI_MASK)
msr |= SER_RI;
@@ -1311,8 +1318,7 @@ uftdi_read_callback(struct usb_xfer *xfer, usb_error_t error)
if (ftdi_msr & FTDI_SIO_RLSD_MASK)
msr |= SER_DCD;
- if ((sc->sc_msr != msr) ||
- ((sc->sc_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK))) {
+ if (sc->sc_msr != msr || sc->sc_lsr != lsr) {
DPRINTF("status change msr=0x%02x (0x%02x) "
"lsr=0x%02x (0x%02x)\n", msr, sc->sc_msr,
lsr, sc->sc_lsr);
diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c
index 6b55b5a..c5ac0d6 100644
--- a/sys/dev/usb/serial/umcs.c
+++ b/sys/dev/usb/serial/umcs.c
@@ -743,15 +743,26 @@ umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{
struct umcs7840_softc *sc = ucom->sc_parent;
uint8_t pn = ucom->sc_portno;
- uint8_t hw_lsr = 0; /* local line status register */
uint8_t hw_msr = 0; /* local modem status register */
- /* Read LSR & MSR */
- umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &hw_lsr);
+ /*
+ * Read status registers. MSR bits need translation from ns16550 to
+ * SER_* values. LSR bits are ns16550 in hardware and ucom.
+ */
+ umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, lsr);
umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr);
- *lsr = hw_lsr;
- *msr = hw_msr;
+ if (hw_msr & MCS7840_UART_MSR_NEGCTS)
+ *msr |= SER_CTS;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGDCD)
+ *msr |= SER_DCD;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGRI)
+ *msr |= SER_RI;
+
+ if (hw_msr & MCS7840_UART_MSR_NEGDSR)
+ *msr |= SER_DSR;
DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr);
}
diff --git a/sys/dev/usb/serial/umct.c b/sys/dev/usb/serial/umct.c
index 32c7897..251e079 100644
--- a/sys/dev/usb/serial/umct.c
+++ b/sys/dev/usb/serial/umct.c
@@ -86,6 +86,15 @@ __FBSDID("$FreeBSD$");
#define UMCT_SET_MCR 10 /* Set Modem Control Register */
#define UMCT_SET_MCR_SIZE 1
+#define UMCT_MSR_CTS_CHG 0x01
+#define UMCT_MSR_DSR_CHG 0x02
+#define UMCT_MSR_RI_CHG 0x04
+#define UMCT_MSR_CD_CHG 0x08
+#define UMCT_MSR_CTS 0x10
+#define UMCT_MSR_RTS 0x20
+#define UMCT_MSR_RI 0x40
+#define UMCT_MSR_CD 0x80
+
#define UMCT_INTR_INTERVAL 100
#define UMCT_IFACE_INDEX 0
#define UMCT_CONFIG_INDEX 0
@@ -384,11 +393,23 @@ umct_intr_callback_sub(struct usb_xfer *xfer, usb_error_t error)
pc = usbd_xfer_get_frame(xfer, 0);
usbd_copy_out(pc, 0, buf, sizeof(buf));
- sc->sc_msr = buf[0];
+ /*
+ * MSR bits need translation from ns16550 to SER_* values.
+ * LSR bits are ns16550 in hardware and ucom.
+ */
+ sc->sc_msr = 0;
+ if (buf[0] & UMCT_MSR_CTS)
+ sc->sc_msr |= SER_CTS;
+ if (buf[0] & UMCT_MSR_CD)
+ sc->sc_msr |= SER_DCD;
+ if (buf[0] & UMCT_MSR_RI)
+ sc->sc_msr |= SER_RI;
+ if (buf[0] & UMCT_MSR_RTS)
+ sc->sc_msr |= SER_DSR;
sc->sc_lsr = buf[1];
ucom_status_change(&sc->sc_ucom);
-
+ /* FALLTHROUGH */
case USB_ST_SETUP:
tr_setup:
usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c
index 5e65c12..b9f798b 100644
--- a/sys/dev/usb/serial/umodem.c
+++ b/sys/dev/usb/serial/umodem.c
@@ -558,6 +558,7 @@ umodem_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
DPRINTF("\n");
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c
index 8c580da..daa83c5 100644
--- a/sys/dev/usb/serial/umoscom.c
+++ b/sys/dev/usb/serial/umoscom.c
@@ -523,14 +523,16 @@ static void
umoscom_cfg_get_status(struct ucom_softc *ucom, uint8_t *p_lsr, uint8_t *p_msr)
{
struct umoscom_softc *sc = ucom->sc_parent;
- uint8_t lsr;
uint8_t msr;
DPRINTFN(5, "\n");
- /* read status registers */
+ /*
+ * Read status registers. MSR bits need translation from ns16550 to
+ * SER_* values. LSR bits are ns16550 in hardware and ucom.
+ */
- lsr = umoscom_cfg_read(sc, UMOSCOM_LSR);
+ *p_lsr = umoscom_cfg_read(sc, UMOSCOM_LSR);
msr = umoscom_cfg_read(sc, UMOSCOM_MSR);
/* translate bits */
diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c
index be7cc2d..1bcf131 100644
--- a/sys/dev/usb/serial/uplcom.c
+++ b/sys/dev/usb/serial/uplcom.c
@@ -807,6 +807,7 @@ uplcom_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
DPRINTF("\n");
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c
index bdcc10f..4c4f8f2 100644
--- a/sys/dev/usb/serial/usb_serial.c
+++ b/sys/dev/usb/serial/usb_serial.c
@@ -162,6 +162,7 @@ static tsw_param_t ucom_param;
static tsw_outwakeup_t ucom_outwakeup;
static tsw_inwakeup_t ucom_inwakeup;
static tsw_free_t ucom_free;
+static tsw_busy_t ucom_busy;
static struct ttydevsw ucom_class = {
.tsw_flags = TF_INITLOCK | TF_CALLOUT,
@@ -173,6 +174,7 @@ static struct ttydevsw ucom_class = {
.tsw_param = ucom_param,
.tsw_modem = ucom_modem,
.tsw_free = ucom_free,
+ .tsw_busy = ucom_busy,
};
MODULE_DEPEND(ucom, usb, 1, 1, 1);
@@ -1295,6 +1297,27 @@ ucom_outwakeup(struct tty *tp)
ucom_start_transfers(sc);
}
+static bool
+ucom_busy(struct tty *tp)
+{
+ struct ucom_softc *sc = tty_softc(tp);
+ const uint8_t txidle = ULSR_TXRDY | ULSR_TSRE;
+
+ UCOM_MTX_ASSERT(sc, MA_OWNED);
+
+ DPRINTFN(3, "sc = %p lsr 0x%02x\n", sc, sc->sc_lsr);
+
+ /*
+ * If the driver maintains the txidle bits in LSR, we can use them to
+ * determine whether the transmitter is busy or idle. Otherwise we have
+ * to assume it is idle to avoid hanging forever on tcdrain(3).
+ */
+ if (sc->sc_flag & UCOM_FLAG_LSRTXIDLE)
+ return ((sc->sc_lsr & txidle) != txidle);
+ else
+ return (false);
+}
+
/*------------------------------------------------------------------------*
* ucom_get_data
*
diff --git a/sys/dev/usb/serial/usb_serial.h b/sys/dev/usb/serial/usb_serial.h
index d003bf1..2b3e258 100644
--- a/sys/dev/usb/serial/usb_serial.h
+++ b/sys/dev/usb/serial/usb_serial.h
@@ -180,6 +180,7 @@ struct ucom_softc {
#define UCOM_FLAG_WAIT_REFS 0x0100 /* set if we must wait for refs */
#define UCOM_FLAG_FREE_UNIT 0x0200 /* set if we must free the unit */
#define UCOM_FLAG_INWAKEUP 0x0400 /* set if we are in the tsw_inwakeup callback */
+#define UCOM_FLAG_LSRTXIDLE 0x0800 /* set if sc_lsr bits ULSR_TSRE+TXRDY work */
uint8_t sc_lsr;
uint8_t sc_msr;
uint8_t sc_mcr;
@@ -218,4 +219,12 @@ void ucom_drain(struct ucom_super_softc *);
void ucom_drain_all(void *);
void ucom_ref(struct ucom_super_softc *);
int ucom_unref(struct ucom_super_softc *);
+
+static inline void
+ucom_use_lsr_txbits(struct ucom_softc *sc)
+{
+
+ sc->sc_flag |= UCOM_FLAG_LSRTXIDLE;
+}
+
#endif /* _USB_SERIAL_H_ */
diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c
index b516bde..063f715 100644
--- a/sys/dev/usb/serial/uslcom.c
+++ b/sys/dev/usb/serial/uslcom.c
@@ -704,6 +704,7 @@ uslcom_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
DPRINTF("\n");
+ /* XXX Note: sc_lsr is always zero */
*lsr = sc->sc_lsr;
*msr = sc->sc_msr;
}
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index 01afe1b..76f8f42 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -2570,10 +2570,10 @@ zyd_start(struct zyd_softc *sc)
while (sc->tx_nfree > 0 && (m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
if (zyd_tx_start(sc, m, ni) != 0) {
- ieee80211_free_node(ni);
m_freem(m);
if_inc_counter(ni->ni_vap->iv_ifp,
IFCOUNTER_OERRORS, 1);
+ ieee80211_free_node(ni);
break;
}
}
diff --git a/sys/dev/vxge/vxge.c b/sys/dev/vxge/vxge.c
index 84320f6..166577f 100644
--- a/sys/dev/vxge/vxge.c
+++ b/sys/dev/vxge/vxge.c
@@ -2312,7 +2312,7 @@ vxge_vpath_open(vxge_dev_t *vdev)
vpath->rx_ticks = ticks;
vpath->tti_rtimer_val = VXGE_DEFAULT_TTI_RTIMER_VAL;
- vpath->tti_rtimer_val = VXGE_DEFAULT_TTI_RTIMER_VAL;
+ vpath->rti_rtimer_val = VXGE_DEFAULT_RTI_RTIMER_VAL;
vpath->tx_intr_coalesce = vdev->config.intr_coalesce;
vpath->rx_intr_coalesce = vdev->config.intr_coalesce;
diff --git a/sys/dev/vxge/vxgehal/vxgehal-config.c b/sys/dev/vxge/vxgehal/vxgehal-config.c
index 4c0d6b7..15a48e2 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-config.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-config.c
@@ -2312,9 +2312,6 @@ vxge_hal_device_config_default_get(
port_config->host_chosen_aggr =
VXGE_HAL_LAG_PORT_HOST_CHOSEN_AGGR_DEFAULT;
- port_config->host_chosen_aggr =
- VXGE_HAL_LAG_PORT_HOST_CHOSEN_AGGR_DEFAULT;
-
port_config->discard_unknown_slow_proto =
VXGE_HAL_LAG_PORT_DISCARD_UNKNOWN_SLOW_PROTO_DEFAULT;
@@ -2348,9 +2345,6 @@ vxge_hal_device_config_default_get(
port_config->actor_distributing =
VXGE_HAL_LAG_PORT_ACTOR_DISTRIBUTING_DEFAULT;
- port_config->actor_distributing =
- VXGE_HAL_LAG_PORT_ACTOR_DISTRIBUTING_DEFAULT;
-
port_config->actor_defaulted =
VXGE_HAL_LAG_PORT_ACTOR_DEFAULTED_DEFAULT;
@@ -2387,9 +2381,6 @@ vxge_hal_device_config_default_get(
port_config->partner_distributing =
VXGE_HAL_LAG_PORT_PARTNER_DISTRIBUTING_DEFAULT;
- port_config->partner_distributing =
- VXGE_HAL_LAG_PORT_PARTNER_DISTRIBUTING_DEFAULT;
-
port_config->partner_defaulted =
VXGE_HAL_LAG_PORT_PARTNER_DEFAULTED_DEFAULT;
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index afa3da4..e90918f 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1789,9 +1789,11 @@ devfs_mmap_f(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size,
* compatible.
*/
mp = vp->v_mount;
- if (mp != NULL && (mp->mnt_flag & MNT_NOEXEC) != 0)
+ if (mp != NULL && (mp->mnt_flag & MNT_NOEXEC) != 0) {
maxprot = VM_PROT_NONE;
- else
+ if ((prot & VM_PROT_EXECUTE) != 0)
+ return (EACCES);
+ } else
maxprot = VM_PROT_EXECUTE;
if ((fp->f_flag & FREAD) != 0)
maxprot |= VM_PROT_READ;
diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c
index 6d74070..32796ca 100644
--- a/sys/fs/ext2fs/ext2_htree.c
+++ b/sys/fs/ext2fs/ext2_htree.c
@@ -766,7 +766,6 @@ ext2_htree_add_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry,
root_entires = info.h_levels[0].h_entries;
newidxblock = malloc(blksize, M_TEMP, M_WAITOK | M_ZERO);
dst_node = (struct ext2fs_htree_node *)newidxblock;
- dst_entries = dst_node->h_entries;
memset(&dst_node->h_fake_dirent, 0,
sizeof(dst_node->h_fake_dirent));
dst_node->h_fake_dirent.e2d_reclen = blksize;
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index a7e9fe3..3c18663 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -749,8 +749,7 @@ static int
nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
struct sockaddr_in **sinp, char *dirpath, size_t dirpathsize, int *dirlenp)
{
- char nam[MNAMELEN + 1];
- char *delimp, *hostp, *spec;
+ char *nam, *delimp, *hostp, *spec;
int error, have_bracket = 0, offset, rv, speclen;
struct sockaddr_in *sin;
size_t len;
@@ -758,6 +757,7 @@ nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
error = vfs_getopt(opts, "from", (void **)&spec, &speclen);
if (error != 0)
return (error);
+ nam = malloc(MNAMELEN + 1, M_TEMP, M_WAITOK);
/*
* This part comes from sbin/mount_nfs/mount_nfs.c:getnfsargs().
@@ -776,6 +776,7 @@ nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
hostp = delimp + 1;
} else {
printf("%s: no <host>:<dirpath> nfs-name\n", __func__);
+ free(nam, M_TEMP);
return (EINVAL);
}
*delimp = '\0';
@@ -791,6 +792,7 @@ nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
spec[speclen - 1] = '\0';
if (strlen(hostp) + strlen(spec) + 1 > MNAMELEN) {
printf("%s: %s:%s: name too long", __func__, hostp, spec);
+ free(nam, M_TEMP);
return (EINVAL);
}
/* Make both '@' and ':' notations equal */
@@ -816,6 +818,7 @@ nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
if (rv != 1) {
printf("%s: cannot parse '%s', inet_pton() returned %d\n",
__func__, hostp, rv);
+ free(nam, M_TEMP);
free(sin, M_SONAME);
return (EINVAL);
}
@@ -832,6 +835,7 @@ nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep,
strlcpy(dirpath, spec, dirpathsize);
*dirlenp = strlen(dirpath);
+ free(nam, M_TEMP);
return (0);
}
@@ -874,7 +878,7 @@ nfs_mount(struct mount *mp)
struct sockaddr *nam = NULL;
struct vnode *vp;
struct thread *td;
- char hst[MNAMELEN];
+ char *hst;
u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100];
char *cp, *opt, *name, *secname;
int nametimeo = NFS_DEFAULT_NAMETIMEO;
@@ -886,6 +890,7 @@ nfs_mount(struct mount *mp)
has_nfs_args_opt = 0;
has_nfs_from_opt = 0;
+ hst = malloc(MNAMELEN, M_TEMP, M_WAITOK);
if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) {
error = EINVAL;
goto out;
@@ -1265,8 +1270,13 @@ nfs_mount(struct mount *mp)
error = EINVAL;
goto out;
}
- bcopy(args.hostname, hst, MNAMELEN);
- hst[MNAMELEN - 1] = '\0';
+ if (len >= MNAMELEN) {
+ vfs_mount_error(mp, "Hostname too long");
+ error = EINVAL;
+ goto out;
+ }
+ bcopy(args.hostname, hst, len);
+ hst[len] = '\0';
}
if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0)
@@ -1324,6 +1334,7 @@ out:
mp->mnt_kern_flag |= MNTK_NULL_NOCACHE;
MNT_IUNLOCK(mp);
}
+ free(hst, M_TEMP);
return (error);
}
diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c
index 130d423..fb4c525 100644
--- a/sys/fs/nfsserver/nfs_nfsdkrpc.c
+++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c
@@ -300,8 +300,7 @@ nfssvc_program(struct svc_req *rqst, SVCXPRT *xprt)
svc_freereq(rqst);
out:
- if (softdep_ast_cleanup != NULL)
- softdep_ast_cleanup();
+ td_softdep_cleanup(curthread);
NFSEXITCODE(0);
}
diff --git a/sys/i386/conf/DEFAULTS b/sys/i386/conf/DEFAULTS
index d5bdb1d..8d53209 100644
--- a/sys/i386/conf/DEFAULTS
+++ b/sys/i386/conf/DEFAULTS
@@ -9,9 +9,6 @@ machine i386
device isa
options ISAPNP
-# Floating point support.
-device npx
-
# Pseudo devices.
device mem # Memory and kernel memory devices
device io # I/O device
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index e0065f8..1d732c1 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -115,15 +115,6 @@ cpu I686_CPU # aka Pentium Pro(tm)
# reorder). This option should not be used if you use memory mapped
# I/O device(s).
#
-# CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32
-# machines. VmWare 3.x seems to emulate this instruction poorly, causing
-# the guest OS to run very slowly. This problem appears to be fixed in
-# VmWare 4.x, at least in version 4.5.2, so that enabling this option with
-# VmWare 4.x will result in locking operations to be 20-30 times slower.
-# Enabling this with an SMP kernel will cause the kernel to be unusable.
-#
-# CPU_DISABLE_SSE explicitly prevents I686_CPU from turning on SSE.
-#
# CPU_ELAN enables support for AMDs ElanSC520 CPU.
# CPU_ELAN_PPS enables precision timestamp code.
# CPU_ELAN_XTAL sets the clock crystal frequency in Hz.
@@ -201,8 +192,6 @@ options CPU_BLUELIGHTNING_FPU_OP_CACHE
options CPU_BTB_EN
options CPU_DIRECT_MAPPED_CACHE
options CPU_DISABLE_5X86_LSSER
-options CPU_DISABLE_CMPXCHG
-#options CPU_DISABLE_SSE
options CPU_ELAN
options CPU_ELAN_PPS
options CPU_ELAN_XTAL=32768000
@@ -313,7 +302,7 @@ device apm_saver # Requires APM
#
# ISA bus
#
-device isa # Required by npx(4)
+device isa
#
# Options for `isa':
@@ -395,8 +384,7 @@ device dpms # DPMS suspend & resume via VESA BIOS
options X86BIOS
#
-# The Numeric Processing eXtension driver. This is non-optional.
-device npx
+# Hints for the non-optional Numeric Processing eXtension driver.
hint.npx.0.flags="0x0"
hint.npx.0.irq="13"
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
index 3c76ab2..fcac38a 100644
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -49,10 +49,6 @@ __FBSDID("$FreeBSD$");
#include <machine/md_var.h>
#include <machine/npx.h>
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
struct sysentvec elf32_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
@@ -143,13 +139,10 @@ SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
void
elf32_dump_thread(struct thread *td, void *dst, size_t *off)
{
-#ifdef CPU_ENABLE_SSE
void *buf;
-#endif
size_t len;
len = 0;
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
if (dst != NULL) {
npxgetregs(td);
@@ -162,7 +155,6 @@ elf32_dump_thread(struct thread *td, void *dst, size_t *off)
len += elf32_populate_note(NT_X86_XSTATE, NULL, NULL,
cpu_max_ext_state_size, NULL);
}
-#endif
*off = len;
}
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index a8f738a..73c67fe 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -37,7 +37,6 @@
#include "opt_apic.h"
#include "opt_atpic.h"
#include "opt_hwpmc_hooks.h"
-#include "opt_npx.h"
#include <machine/asmacros.h>
#include <machine/psl.h>
diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c
index f675937..ce86133 100644
--- a/sys/i386/i386/initcpu.c
+++ b/sys/i386/i386/initcpu.c
@@ -44,10 +44,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/pmap.h>
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
#ifdef I486_CPU
static void init_5x86(void);
static void init_bluelightning(void);
@@ -758,12 +754,10 @@ initializecpu(void)
default:
break;
}
-#if defined(CPU_ENABLE_SSE)
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
load_cr4(rcr4() | CR4_FXSR | CR4_XMM);
cpu_fxsr = hw_instruction_sse = 1;
}
-#endif
#if defined(PAE) || defined(PAE_TABLES)
if ((amd_feature & AMDID_NX) != 0) {
uint64_t msr;
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 15f9851..fcc804c 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
#include "opt_kstack_pages.h"
#include "opt_maxmem.h"
#include "opt_mp_watchdog.h"
-#include "opt_npx.h"
#include "opt_perfmon.h"
#include "opt_platform.h"
#include "opt_xbox.h"
@@ -166,10 +165,6 @@ CTASSERT(offsetof(struct pcpu, pc_curthread) == 0);
extern register_t init386(int first);
extern void dblfault_handler(void);
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
static void cpu_startup(void *);
static void fpstate_drop(struct thread *td);
static void get_fpcontext(struct thread *td, mcontext_t *mcp,
@@ -635,14 +630,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
-#ifdef CPU_ENABLE_SSE
if (cpu_max_ext_state_size > sizeof(union savefpu) && use_xsave) {
xfpusave_len = cpu_max_ext_state_size - sizeof(union savefpu);
xfpusave = __builtin_alloca(xfpusave_len);
} else {
-#else
- {
-#endif
xfpusave_len = 0;
xfpusave = NULL;
}
@@ -2449,9 +2440,7 @@ init386(int first)
struct gate_descriptor *gdp;
int gsel_tss, metadata_missing, x, pa;
struct pcpu *pc;
-#ifdef CPU_ENABLE_SSE
struct xstate_hdr *xhdr;
-#endif
int late_console;
thread0.td_kstack = proc0kstack;
@@ -2713,23 +2702,20 @@ init386(int first)
i386_kdb_init();
msgbufinit(msgbufp, msgbufsize);
-#ifdef DEV_NPX
npxinit(true);
-#endif
/*
* Set up thread0 pcb after npxinit calculated pcb + fpu save
* area size. Zero out the extended state header in fpu save
* area.
*/
thread0.td_pcb = get_pcb_td(&thread0);
+ thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0);
bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size);
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) +
1);
xhdr->xstate_bv = xsave_mask;
}
-#endif
PCPU_SET(curpcb, thread0.td_pcb);
/* Move esp0 in the tss to its final place. */
/* Note: -16 is so we can grow the trapframe if we came from vm86 */
@@ -2998,17 +2984,11 @@ fill_fpregs(struct thread *td, struct fpreg *fpregs)
KASSERT(td == curthread || TD_IS_SUSPENDED(td) ||
P_SHOULDSTOP(td->td_proc),
("not suspended thread %p", td));
-#ifdef DEV_NPX
npxgetregs(td);
-#else
- bzero(fpregs, sizeof(*fpregs));
-#endif
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
npx_fill_fpregs_xmm(&get_pcb_user_save_td(td)->sv_xmm,
(struct save87 *)fpregs);
else
-#endif /* CPU_ENABLE_SSE */
bcopy(&get_pcb_user_save_td(td)->sv_87, fpregs,
sizeof(*fpregs));
return (0);
@@ -3018,17 +2998,13 @@ int
set_fpregs(struct thread *td, struct fpreg *fpregs)
{
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
npx_set_fpregs_xmm((struct save87 *)fpregs,
&get_pcb_user_save_td(td)->sv_xmm);
else
-#endif /* CPU_ENABLE_SSE */
bcopy(fpregs, &get_pcb_user_save_td(td)->sv_87,
sizeof(*fpregs));
-#ifdef DEV_NPX
npxuserinited(td);
-#endif
return (0);
}
@@ -3137,20 +3113,12 @@ static void
get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave,
size_t xfpusave_len)
{
-#ifdef CPU_ENABLE_SSE
size_t max_len, len;
-#endif
-#ifndef DEV_NPX
- mcp->mc_fpformat = _MC_FPFMT_NODEV;
- mcp->mc_ownedfp = _MC_FPOWNED_NONE;
- bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
-#else
mcp->mc_ownedfp = npxgetregs(td);
bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0],
sizeof(mcp->mc_fpstate));
mcp->mc_fpformat = npxformat();
-#ifdef CPU_ENABLE_SSE
if (!use_xsave || xfpusave_len == 0)
return;
max_len = cpu_max_ext_state_size - sizeof(union savefpu);
@@ -3162,8 +3130,6 @@ get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave,
mcp->mc_flags |= _MC_HASFPXSTATE;
mcp->mc_xfpustate_len = len;
bcopy(get_pcb_user_save_td(td) + 1, xfpusave, len);
-#endif
-#endif
}
static int
@@ -3184,16 +3150,10 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate,
error = 0;
} else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU ||
mcp->mc_ownedfp == _MC_FPOWNED_PCB) {
-#ifdef DEV_NPX
fpstate = (union savefpu *)&mcp->mc_fpstate;
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
fpstate->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask;
-#endif
error = npxsetregs(td, fpstate, xfpustate, xfpustate_len);
-#else
- error = EINVAL;
-#endif
} else
return (EINVAL);
return (error);
@@ -3205,10 +3165,8 @@ fpstate_drop(struct thread *td)
KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu"));
critical_enter();
-#ifdef DEV_NPX
if (PCPU_GET(fpcurthread) == td)
npxdrop();
-#endif
/*
* XXX force a full drop of the npx. The above only drops it if we
* owned it. npxgetregs() has the same bug in the !cpu_fxsr case.
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index c2c200a..ddfe57f 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$");
#ifndef DEV_APIC
#error The apic device is required for SMP, add "device apic" to your config file.
#endif
-#if defined(CPU_DISABLE_CMPXCHG) && !defined(COMPILING_LINT)
-#error SMP not supported with CPU_DISABLE_CMPXCHG
-#endif
#endif /* not lint */
#include <sys/param.h>
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 9a5ae8b..db71c4d 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -152,10 +152,6 @@ __FBSDID("$FreeBSD$");
#include <machine/xbox.h>
#endif
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
#ifndef PMAP_SHPGPERPROC
#define PMAP_SHPGPERPROC 200
#endif
@@ -3150,12 +3146,12 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot)
anychanged = FALSE;
retry:
oldpde = newpde = *pde;
- if (oldpde & PG_MANAGED) {
+ if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) ==
+ (PG_MANAGED | PG_M | PG_RW)) {
eva = sva + NBPDR;
for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
va < eva; va += PAGE_SIZE, m++)
- if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
- vm_page_dirty(m);
+ vm_page_dirty(m);
}
if ((prot & VM_PROT_WRITE) == 0)
newpde &= ~(PG_RW | PG_M);
@@ -4231,11 +4227,9 @@ pagezero(void *page)
{
#if defined(I686_CPU)
if (cpu_class == CPUCLASS_686) {
-#if defined(CPU_ENABLE_SSE)
if (cpu_feature & CPUID_SSE2)
sse2_pagezero(page);
else
-#endif
i686_pagezero(page);
} else
#endif
diff --git a/sys/i386/i386/ptrace_machdep.c b/sys/i386/i386/ptrace_machdep.c
index 12bafe5..7ab685c 100644
--- a/sys/i386/i386/ptrace_machdep.c
+++ b/sys/i386/i386/ptrace_machdep.c
@@ -39,11 +39,6 @@ __FBSDID("$FreeBSD$");
#include <machine/md_var.h>
#include <machine/pcb.h>
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
-#ifdef CPU_ENABLE_SSE
static int
cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data)
{
@@ -114,12 +109,10 @@ cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data)
return (error);
}
-#endif
static int
cpu_ptrace_xmm(struct thread *td, int req, void *addr, int data)
{
-#ifdef CPU_ENABLE_SSE
struct savexmm *fpstate;
int error;
@@ -152,9 +145,6 @@ cpu_ptrace_xmm(struct thread *td, int req, void *addr, int data)
}
return (error);
-#else
- return (EINVAL);
-#endif
}
int
diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s
index 63912b6..d569970 100644
--- a/sys/i386/i386/support.s
+++ b/sys/i386/i386/support.s
@@ -29,8 +29,6 @@
* $FreeBSD$
*/
-#include "opt_npx.h"
-
#include <machine/asmacros.h>
#include <machine/cputypes.h>
#include <machine/pmap.h>
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 6bedb48..6ca3ca2 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -32,7 +32,6 @@
* $FreeBSD$
*/
-#include "opt_npx.h"
#include "opt_sched.h"
#include <machine/asmacros.h>
@@ -152,7 +151,6 @@ ENTRY(cpu_switch)
movl %eax,PCB_DR0(%edx)
1:
-#ifdef DEV_NPX
/* have we used fp, and need a save? */
cmpl %ecx,PCPU(FPCURTHREAD)
jne 1f
@@ -160,7 +158,6 @@ ENTRY(cpu_switch)
call npxsave /* do it in a big C function */
popl %eax
1:
-#endif
/* Save is done. Now fire up new thread. Leave old vmspace. */
movl 4(%esp),%edi
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 2ab8d1b..7c16b24 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
#include "opt_hwpmc_hooks.h"
#include "opt_isa.h"
#include "opt_kdb.h"
-#include "opt_npx.h"
#include "opt_stack.h"
#include "opt_trap.h"
@@ -335,13 +334,9 @@ user_trctrap_out:
break;
case T_ARITHTRAP: /* arithmetic trap */
-#ifdef DEV_NPX
ucode = npxtrap_x87();
if (ucode == -1)
goto userout;
-#else
- ucode = 0;
-#endif
i = SIGFPE;
break;
@@ -475,13 +470,11 @@ user_trctrap_out:
break;
case T_DNA:
-#ifdef DEV_NPX
KASSERT(PCB_USER_FPU(td->td_pcb),
("kernel FPU ctx has leaked"));
/* transparent fault (due to context switch "late") */
if (npxdna())
goto userout;
-#endif
uprintf("pid %d killed due to lack of floating point\n",
p->p_pid);
i = SIGKILL;
@@ -494,13 +487,9 @@ user_trctrap_out:
break;
case T_XMMFLT: /* SIMD floating-point exception */
-#if defined(DEV_NPX) && !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
ucode = npxtrap_sse();
if (ucode == -1)
goto userout;
-#else
- ucode = 0;
-#endif
i = SIGFPE;
break;
#ifdef KDTRACE_HOOKS
@@ -524,12 +513,10 @@ user_trctrap_out:
goto out;
case T_DNA:
-#ifdef DEV_NPX
if (PCB_USER_FPU(td->td_pcb))
panic("Unregistered use of FPU in kernel");
if (npxdna())
goto out;
-#endif
break;
case T_ARITHTRAP: /* arithmetic trap */
diff --git a/sys/i386/i386/vm86bios.s b/sys/i386/i386/vm86bios.s
index f81b784..98c6f3d 100644
--- a/sys/i386/i386/vm86bios.s
+++ b/sys/i386/i386/vm86bios.s
@@ -26,8 +26,6 @@
* $FreeBSD$
*/
-#include "opt_npx.h"
-
#include <machine/asmacros.h> /* miscellaneous asm macros */
#include <machine/trap.h>
@@ -63,7 +61,6 @@ ENTRY(vm86_bioscall)
pushl %edi
pushl %gs
-#ifdef DEV_NPX
pushfl
cli
movl PCPU(CURTHREAD),%ecx
@@ -77,7 +74,6 @@ ENTRY(vm86_bioscall)
popl %edx /* recover our pcb */
1:
popfl
-#endif
movl SCR_VMFRAME(%edx),%ebx /* target frame location */
movl %ebx,%edi /* destination */
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 58fba7c..2b35f5c 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -103,10 +103,6 @@ __FBSDID("$FreeBSD$");
#define NSFBUFS (512 + maxusers * 16)
#endif
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread),
"OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread.");
_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb),
@@ -156,18 +152,14 @@ void *
alloc_fpusave(int flags)
{
void *res;
-#ifdef CPU_ENABLE_SSE
struct savefpu_ymm *sf;
-#endif
res = malloc(cpu_max_ext_state_size, M_DEVBUF, flags);
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
sf = (struct savefpu_ymm *)res;
bzero(&sf->sv_xstate.sx_hd, sizeof(sf->sv_xstate.sx_hd));
sf->sv_xstate.sx_hd.xstate_bv = xsave_mask;
}
-#endif
return (res);
}
/*
@@ -207,12 +199,10 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
/* Ensure that td1's pcb is up to date. */
if (td1 == curthread)
td1->td_pcb->pcb_gs = rgs();
-#ifdef DEV_NPX
critical_enter();
if (PCPU_GET(fpcurthread) == td1)
npxsave(td1->td_pcb->pcb_save);
critical_exit();
-#endif
/* Point the pcb to the top of the stack */
pcb2 = get_pcb_td(td2);
@@ -351,12 +341,10 @@ void
cpu_thread_exit(struct thread *td)
{
-#ifdef DEV_NPX
critical_enter();
if (td == PCPU_GET(fpcurthread))
npxdrop();
critical_exit();
-#endif
/* Disable any hardware breakpoints. */
if (td->td_pcb->pcb_flags & PCB_DBREGS) {
@@ -397,21 +385,17 @@ void
cpu_thread_alloc(struct thread *td)
{
struct pcb *pcb;
-#ifdef CPU_ENABLE_SSE
struct xstate_hdr *xhdr;
-#endif
td->td_pcb = pcb = get_pcb_td(td);
td->td_frame = (struct trapframe *)((caddr_t)pcb - 16) - 1;
pcb->pcb_ext = NULL;
pcb->pcb_save = get_pcb_user_save_pcb(pcb);
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1);
bzero(xhdr, sizeof(*xhdr));
xhdr->xstate_bv = xsave_mask;
}
-#endif
}
void
diff --git a/sys/i386/ibcs2/Makefile b/sys/i386/ibcs2/Makefile
index 68e91fa..1802d6e 100644
--- a/sys/i386/ibcs2/Makefile
+++ b/sys/i386/ibcs2/Makefile
@@ -9,24 +9,16 @@ sysent: ibcs2_sysent.c ibcs2_syscall.h ibcs2_proto.h
ibcs2_sysent.c ibcs2_syscall.h ibcs2_proto.h: ../../kern/makesyscalls.sh \
syscalls.master syscalls.conf
- -mv -f ibcs2_sysent.c ibcs2_sysent.c.bak
- -mv -f ibcs2_syscall.h ibcs2_syscall.h.bak
- -mv -f ibcs2_proto.h ibcs2_proto.h.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
isc_sysent: ibcs2_isc_sysent.c ibcs2_isc_syscall.h
ibcs2_isc_sysent.c ibcs2_isc_syscall.h : ../../kern/makesyscalls.sh \
syscalls.isc syscalls.isc.conf
- -mv -f ibcs2_isc_sysent.c ibcs2_isc_sysent.c.bak
- -mv -f ibcs2_isc_syscall.h ibcs2_isc_syscall.h.bak
sh ../../kern/makesyscalls.sh syscalls.isc syscalls.isc.conf
xenix_sysent: ibcs2_xenix_sysent.c ibcs2_xenix_syscall.h ibcs2_xenix.h
ibcs2_xenix_sysent.c ibcs2_xenix_syscall.h ibcs2_xenix.h: \
../../kern/makesyscalls.sh syscalls.xenix syscalls.xenix.conf
- -mv -f ibcs2_xenix_sysent.c ibcs2_xenix_sysent.c.bak
- -mv -f ibcs2_xenix_syscall.h ibcs2_xenix_syscall.h.bak
- -mv -f ibcs2_xenix.h ibcs2_xenix.h.bak
sh ../../kern/makesyscalls.sh syscalls.xenix syscalls.xenix.conf
diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h
index 90fb950..e92e94b 100644
--- a/sys/i386/include/atomic.h
+++ b/sys/i386/include/atomic.h
@@ -169,33 +169,6 @@ struct __hack
* Returns 0 on failure, non-zero on success
*/
-#ifdef CPU_DISABLE_CMPXCHG
-
-static __inline int
-atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
-{
- u_char res;
-
- __asm __volatile(
- " pushfl ; "
- " cli ; "
- " cmpl %3,%1 ; "
- " jne 1f ; "
- " movl %2,%1 ; "
- "1: "
- " sete %0 ; "
- " popfl ; "
- "# atomic_cmpset_int"
- : "=q" (res), /* 0 */
- "+m" (*dst) /* 1 */
- : "r" (src), /* 2 */
- "r" (expect) /* 3 */
- : "memory");
- return (res);
-}
-
-#else /* !CPU_DISABLE_CMPXCHG */
-
static __inline int
atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
{
@@ -214,8 +187,6 @@ atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
return (res);
}
-#endif /* CPU_DISABLE_CMPXCHG */
-
/*
* Atomically add the value of v to the integer pointed to by p and return
* the previous value of *p.
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index fc953b6..a12507e 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -74,10 +74,6 @@ __FBSDID("$FreeBSD$");
#include <isa/isavar.h>
#endif
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
/*
* 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
*/
@@ -93,7 +89,6 @@ __FBSDID("$FreeBSD$");
#define fp_divide_by_0() __asm __volatile( \
"fldz; fld1; fdiv %st,%st(1); fnop")
#define frstor(addr) __asm __volatile("frstor %0" : : "m" (*(addr)))
-#ifdef CPU_ENABLE_SSE
#define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr)))
#define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr)))
#define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr))
@@ -130,7 +125,6 @@ xsaveopt(char *addr, uint64_t mask)
__asm __volatile("xsaveopt %0" : "=m" (*addr) : "a" (low), "d" (hi) :
"memory");
}
-#endif
#else /* !(__GNUCLIKE_ASM && !lint) */
void fldcw(u_short cw);
@@ -141,7 +135,6 @@ void fnstcw(caddr_t addr);
void fnstsw(caddr_t addr);
void fp_divide_by_0(void);
void frstor(caddr_t addr);
-#ifdef CPU_ENABLE_SSE
void fxsave(caddr_t addr);
void fxrstor(caddr_t addr);
void ldmxcsr(u_int csr);
@@ -149,14 +142,12 @@ void stmxcsr(u_int *csr);
void xrstor(char *addr, uint64_t mask);
void xsave(char *addr, uint64_t mask);
void xsaveopt(char *addr, uint64_t mask);
-#endif
#endif /* __GNUCLIKE_ASM && !lint */
#define start_emulating() load_cr0(rcr0() | CR0_TS)
#define stop_emulating() clts()
-#ifdef CPU_ENABLE_SSE
#define GET_FPU_CW(thread) \
(cpu_fxsr ? \
(thread)->td_pcb->pcb_save->sv_xmm.sv_env.en_cw : \
@@ -171,16 +162,7 @@ void xsaveopt(char *addr, uint64_t mask);
else \
(savefpu)->sv_87.sv_env.en_cw = (value); \
} while (0)
-#else /* CPU_ENABLE_SSE */
-#define GET_FPU_CW(thread) \
- (thread->td_pcb->pcb_save->sv_87.sv_env.en_cw)
-#define GET_FPU_SW(thread) \
- (thread->td_pcb->pcb_save->sv_87.sv_env.en_sw)
-#define SET_FPU_CW(savefpu, value) \
- (savefpu)->sv_87.sv_env.en_cw = (value)
-#endif /* CPU_ENABLE_SSE */
-#ifdef CPU_ENABLE_SSE
CTASSERT(sizeof(union savefpu) == 512);
CTASSERT(sizeof(struct xstate_hdr) == 64);
CTASSERT(sizeof(struct savefpu_ymm) == 832);
@@ -200,7 +182,6 @@ CTASSERT(X86_XSTATE_XCR0_OFFSET >= offsetof(struct savexmm, sv_pad) &&
X86_XSTATE_XCR0_OFFSET + sizeof(uint64_t) <= sizeof(struct savexmm));
static void fpu_clean_state(void);
-#endif
static void fpusave(union savefpu *);
static void fpurstor(union savefpu *);
@@ -210,21 +191,17 @@ int hw_float;
SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
&hw_float, 0, "Floating point instructions executed in hardware");
-#ifdef CPU_ENABLE_SSE
int use_xsave;
uint64_t xsave_mask;
-#endif
static uma_zone_t fpu_save_area_zone;
static union savefpu *npx_initialstate;
-#ifdef CPU_ENABLE_SSE
struct xsave_area_elm_descr {
u_int offset;
u_int size;
} *xsave_area_desc;
static int use_xsaveopt;
-#endif
static volatile u_int npx_traps_while_probing;
@@ -340,7 +317,6 @@ cleanup:
return (hw_float);
}
-#ifdef CPU_ENABLE_SSE
/*
* Enable XSAVE if supported and allowed by user.
* Calculate the xsave_mask.
@@ -376,7 +352,7 @@ npxinit_bsp1(void)
if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0)
use_xsaveopt = 1;
}
-#endif
+
/*
* Calculate the fpu save area size.
@@ -384,7 +360,6 @@ npxinit_bsp1(void)
static void
npxinit_bsp2(void)
{
-#ifdef CPU_ENABLE_SSE
u_int cp[4];
if (use_xsave) {
@@ -397,7 +372,6 @@ npxinit_bsp2(void)
do_cpuid(1, cp);
cpu_feature2 = cp[2];
} else
-#endif
cpu_max_ext_state_size = sizeof(union savefpu);
}
@@ -409,25 +383,19 @@ npxinit(bool bsp)
{
static union savefpu dummy;
register_t saveintr;
-#ifdef CPU_ENABLE_SSE
u_int mxcsr;
-#endif
u_short control;
if (bsp) {
if (!npx_probe())
return;
-#ifdef CPU_ENABLE_SSE
npxinit_bsp1();
-#endif
}
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
load_cr4(rcr4() | CR4_XSAVE);
load_xcr(XCR0, xsave_mask);
}
-#endif
/*
* XCR0 shall be set up before CPU can report the save area size.
@@ -444,20 +412,16 @@ npxinit(bool bsp)
*/
saveintr = intr_disable();
stop_emulating();
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
fninit();
else
-#endif
fnsave(&dummy);
control = __INITIAL_NPXCW__;
fldcw(control);
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr) {
mxcsr = __INITIAL_MXCSR__;
ldmxcsr(mxcsr);
}
-#endif
start_emulating();
intr_restore(saveintr);
}
@@ -471,9 +435,7 @@ static void
npxinitstate(void *arg __unused)
{
register_t saveintr;
-#ifdef CPU_ENABLE_SSE
int cp[4], i, max_ext_n;
-#endif
if (!hw_float)
return;
@@ -484,7 +446,6 @@ npxinitstate(void *arg __unused)
stop_emulating();
fpusave(npx_initialstate);
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr) {
if (npx_initialstate->sv_xmm.sv_env.en_mxcsr_mask)
cpu_mxcsr_mask =
@@ -506,11 +467,9 @@ npxinitstate(void *arg __unused)
bzero(npx_initialstate->sv_xmm.sv_xmm,
sizeof(npx_initialstate->sv_xmm.sv_xmm));
} else
-#endif
bzero(npx_initialstate->sv_87.sv_ac,
sizeof(npx_initialstate->sv_87.sv_ac));
-#ifdef CPU_ENABLE_SSE
/*
* Create a table describing the layout of the CPU Extended
* Save Area.
@@ -535,7 +494,6 @@ npxinitstate(void *arg __unused)
xsave_area_desc[i].size = cp[0];
}
}
-#endif
fpu_save_area_zone = uma_zcreate("FPU_save_area",
cpu_max_ext_state_size, NULL, NULL, NULL, NULL,
@@ -585,10 +543,8 @@ npxformat(void)
if (!hw_float)
return (_MC_FPFMT_NODEV);
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
return (_MC_FPFMT_XMM);
-#endif
return (_MC_FPFMT_387);
}
@@ -809,7 +765,6 @@ npxtrap_x87(void)
return (fpetable[status & ((~control & 0x3f) | 0x40)]);
}
-#ifdef CPU_ENABLE_SSE
int
npxtrap_sse(void)
{
@@ -829,7 +784,6 @@ npxtrap_sse(void)
critical_exit();
return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
}
-#endif
/*
* Implement device not available (DNA) exception
@@ -868,10 +822,8 @@ npxdna(void)
*/
PCPU_SET(fpcurthread, curthread);
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
fpu_clean_state();
-#endif
if ((curpcb->pcb_flags & PCB_NPXINITDONE) == 0) {
/*
@@ -913,11 +865,9 @@ npxsave(addr)
{
stop_emulating();
-#ifdef CPU_ENABLE_SSE
if (use_xsaveopt)
xsaveopt((char *)addr, xsave_mask);
else
-#endif
fpusave(addr);
start_emulating();
PCPU_SET(fpcurthread, NULL);
@@ -968,9 +918,7 @@ npxdrop(void)
* Discard pending exceptions in the !cpu_fxsr case so that unmasked
* ones don't cause a panic on the next frstor.
*/
-#ifdef CPU_ENABLE_SSE
if (!cpu_fxsr)
-#endif
fnclex();
td = PCPU_GET(fpcurthread);
@@ -990,11 +938,9 @@ int
npxgetregs(struct thread *td)
{
struct pcb *pcb;
-#ifdef CPU_ENABLE_SSE
uint64_t *xstate_bv, bit;
char *sa;
int max_ext_n, i;
-#endif
int owned;
if (!hw_float)
@@ -1011,9 +957,7 @@ npxgetregs(struct thread *td)
critical_enter();
if (td == PCPU_GET(fpcurthread)) {
fpusave(get_pcb_user_save_pcb(pcb));
-#ifdef CPU_ENABLE_SSE
if (!cpu_fxsr)
-#endif
/*
* fnsave initializes the FPU and destroys whatever
* context it contains. Make sure the FPU owner
@@ -1025,7 +969,6 @@ npxgetregs(struct thread *td)
owned = _MC_FPOWNED_PCB;
}
critical_exit();
-#ifdef CPU_ENABLE_SSE
if (use_xsave) {
/*
* Handle partially saved state.
@@ -1048,7 +991,6 @@ npxgetregs(struct thread *td)
*xstate_bv |= bit;
}
}
-#endif
return (owned);
}
@@ -1063,7 +1005,6 @@ npxuserinited(struct thread *td)
pcb->pcb_flags |= PCB_NPXUSERINITDONE;
}
-#ifdef CPU_ENABLE_SSE
int
npxsetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size)
{
@@ -1101,16 +1042,13 @@ npxsetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size)
return (0);
}
-#endif
int
npxsetregs(struct thread *td, union savefpu *addr, char *xfpustate,
size_t xfpustate_size)
{
struct pcb *pcb;
-#ifdef CPU_ENABLE_SSE
int error;
-#endif
if (!hw_float)
return (ENXIO);
@@ -1118,14 +1056,12 @@ npxsetregs(struct thread *td, union savefpu *addr, char *xfpustate,
pcb = td->td_pcb;
critical_enter();
if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) {
-#ifdef CPU_ENABLE_SSE
error = npxsetxstate(td, xfpustate, xfpustate_size);
if (error != 0) {
critical_exit();
return (error);
}
if (!cpu_fxsr)
-#endif
fnclex(); /* As in npxdrop(). */
bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr));
fpurstor(get_pcb_user_save_td(td));
@@ -1133,11 +1069,9 @@ npxsetregs(struct thread *td, union savefpu *addr, char *xfpustate,
pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE;
} else {
critical_exit();
-#ifdef CPU_ENABLE_SSE
error = npxsetxstate(td, xfpustate, xfpustate_size);
if (error != 0)
return (error);
-#endif
bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr));
npxuserinited(td);
}
@@ -1149,17 +1083,14 @@ fpusave(addr)
union savefpu *addr;
{
-#ifdef CPU_ENABLE_SSE
if (use_xsave)
xsave((char *)addr, xsave_mask);
else if (cpu_fxsr)
fxsave(addr);
else
-#endif
fnsave(addr);
}
-#ifdef CPU_ENABLE_SSE
static void
npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct save87 *sv_87)
{
@@ -1224,7 +1155,6 @@ npx_set_fpregs_xmm(struct save87 *sv_87, struct savexmm *sv_xmm)
penv_xmm->en_tw |= 1 << i;
}
}
-#endif /* CPU_ENABLE_SSE */
void
npx_get_fsave(void *addr)
@@ -1235,11 +1165,9 @@ npx_get_fsave(void *addr)
td = curthread;
npxgetregs(td);
sv = get_pcb_user_save_td(td);
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
npx_fill_fpregs_xmm1(&sv->sv_xmm, addr);
else
-#endif
bcopy(sv, addr, sizeof(struct env87) +
sizeof(struct fpacc87[8]));
}
@@ -1251,18 +1179,15 @@ npx_set_fsave(void *addr)
int error;
bzero(&sv, sizeof(sv));
-#ifdef CPU_ENABLE_SSE
if (cpu_fxsr)
npx_set_fpregs_xmm(addr, &sv.sv_xmm);
else
-#endif
bcopy(addr, &sv, sizeof(struct env87) +
sizeof(struct fpacc87[8]));
error = npxsetregs(curthread, &sv, NULL, 0);
return (error);
}
-#ifdef CPU_ENABLE_SSE
/*
* On AuthenticAMD processors, the fxrstor instruction does not restore
* the x87's stored last instruction pointer, last data pointer, and last
@@ -1293,19 +1218,16 @@ fpu_clean_state(void)
*/
__asm __volatile("ffree %%st(7); flds %0" : : "m" (dummy_variable));
}
-#endif /* CPU_ENABLE_SSE */
static void
fpurstor(union savefpu *addr)
{
-#ifdef CPU_ENABLE_SSE
if (use_xsave)
xrstor((char *)addr, xsave_mask);
else if (cpu_fxsr)
fxrstor(addr);
else
-#endif
frstor(addr);
}
diff --git a/sys/i386/linux/Makefile b/sys/i386/linux/Makefile
index c8899e6..fc0aac2 100644
--- a/sys/i386/linux/Makefile
+++ b/sys/i386/linux/Makefile
@@ -9,9 +9,4 @@ sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_sys
linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
../../kern/makesyscalls.sh syscalls.master syscalls.conf
- -mv -f linux_sysent.c linux_sysent.c.bak
- -mv -f linux_syscall.h linux_syscall.h.bak
- -mv -f linux_proto.h linux_proto.h.bak
- -mv -f linux_syscalls.c linux_syscalls.c.bak
- -mv -f linux_systrace_args.c linux_systrace_args.c.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c
index 9aafeb3..f046600 100644
--- a/sys/i386/linux/linux_dummy.c
+++ b/sys/i386/linux/linux_dummy.c
@@ -106,9 +106,6 @@ DUMMY(timerfd_gettime);
/* linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);
-/* linux 2.6.30: */
-DUMMY(preadv);
-DUMMY(pwritev);
/* linux 2.6.31: */
DUMMY(rt_tgsigqueueinfo);
DUMMY(perf_event_open);
diff --git a/sys/i386/linux/linux_ptrace.c b/sys/i386/linux/linux_ptrace.c
index fbe66b4..a4b39b3 100644
--- a/sys/i386/linux/linux_ptrace.c
+++ b/sys/i386/linux/linux_ptrace.c
@@ -47,10 +47,6 @@ __FBSDID("$FreeBSD$");
#include <i386/linux/linux_proto.h>
#include <compat/linux/linux_signal.h>
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
/*
* Linux ptrace requests numbers. Mostly identical to FreeBSD,
* except for MD ones and PT_ATTACH/PT_DETACH.
@@ -216,7 +212,6 @@ struct linux_pt_fpxreg {
l_long padding[56];
};
-#ifdef CPU_ENABLE_SSE
static int
linux_proc_read_fpxregs(struct thread *td, struct linux_pt_fpxreg *fpxregs)
{
@@ -238,7 +233,6 @@ linux_proc_write_fpxregs(struct thread *td, struct linux_pt_fpxreg *fpxregs)
bcopy(fpxregs, &get_pcb_user_save_td(td)->sv_xmm, sizeof(*fpxregs));
return (0);
}
-#endif
int
linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
@@ -330,14 +324,11 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
}
break;
case PTRACE_SETFPXREGS:
-#ifdef CPU_ENABLE_SSE
error = copyin((void *)uap->data, &r.fpxreg, sizeof(r.fpxreg));
if (error)
break;
-#endif
/* FALL THROUGH */
case PTRACE_GETFPXREGS: {
-#ifdef CPU_ENABLE_SSE
struct proc *p;
struct thread *td2;
@@ -411,9 +402,6 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
fail:
PROC_UNLOCK(p);
-#else
- error = EIO;
-#endif
break;
}
case PTRACE_PEEKUSR:
diff --git a/sys/kern/Makefile b/sys/kern/Makefile
index 0721e82..eb11891 100644
--- a/sys/kern/Makefile
+++ b/sys/kern/Makefile
@@ -12,10 +12,4 @@ sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \
init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \
../sys/syscall.mk ../sys/sysproto.h: makesyscalls.sh syscalls.master \
capabilities.conf
- -mv -f init_sysent.c init_sysent.c.bak
- -mv -f syscalls.c syscalls.c.bak
- -mv -f systrace_args.c systrace_args.c.bak
- -mv -f ../sys/syscall.h ../sys/syscall.h.bak
- -mv -f ../sys/syscall.mk ../sys/syscall.mk.bak
- -mv -f ../sys/sysproto.h ../sys/sysproto.h.bak
sh makesyscalls.sh syscalls.master
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index a1a24d1..32e7f8a 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -397,10 +397,8 @@ __elfN(map_partial)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
/*
* Create the page if it doesn't exist yet. Ignore errors.
*/
- vm_map_lock(map);
- vm_map_insert(map, NULL, 0, trunc_page(start), round_page(end),
- VM_PROT_ALL, VM_PROT_ALL, 0);
- vm_map_unlock(map);
+ vm_map_fixed(map, NULL, 0, trunc_page(start), round_page(end) -
+ trunc_page(start), VM_PROT_ALL, VM_PROT_ALL, MAP_CHECK_EXCL);
/*
* Find the page from the underlying object.
@@ -413,22 +411,22 @@ __elfN(map_partial)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
error = copyout((caddr_t)sf_buf_kva(sf) + off, (caddr_t)start,
end - start);
vm_imgact_unmap_page(sf);
- if (error) {
+ if (error != 0)
return (KERN_FAILURE);
- }
}
return (KERN_SUCCESS);
}
static int
-__elfN(map_insert)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
- vm_offset_t start, vm_offset_t end, vm_prot_t prot, int cow)
+__elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
+ vm_ooffset_t offset, vm_offset_t start, vm_offset_t end, vm_prot_t prot,
+ int cow)
{
struct sf_buf *sf;
vm_offset_t off;
vm_size_t sz;
- int error, rv;
+ int error, locked, rv;
if (start != trunc_page(start)) {
rv = __elfN(map_partial)(map, object, offset, start,
@@ -451,9 +449,8 @@ __elfN(map_insert)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
* The mapping is not page aligned. This means we have
* to copy the data. Sigh.
*/
- rv = vm_map_find(map, NULL, 0, &start, end - start, 0,
- VMFS_NO_SPACE, prot | VM_PROT_WRITE, VM_PROT_ALL,
- 0);
+ rv = vm_map_fixed(map, NULL, 0, start, end - start,
+ prot | VM_PROT_WRITE, VM_PROT_ALL, MAP_CHECK_EXCL);
if (rv != KERN_SUCCESS)
return (rv);
if (object == NULL)
@@ -476,12 +473,15 @@ __elfN(map_insert)(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
rv = KERN_SUCCESS;
} else {
vm_object_reference(object);
- vm_map_lock(map);
- rv = vm_map_insert(map, object, offset, start, end,
- prot, VM_PROT_ALL, cow);
- vm_map_unlock(map);
- if (rv != KERN_SUCCESS)
+ rv = vm_map_fixed(map, object, offset, start,
+ end - start, prot, VM_PROT_ALL,
+ cow | MAP_CHECK_EXCL);
+ if (rv != KERN_SUCCESS) {
+ locked = VOP_ISLOCKED(imgp->vp);
+ VOP_UNLOCK(imgp->vp, 0);
vm_object_deallocate(object);
+ vn_lock(imgp->vp, locked | LK_RETRY);
+ }
}
return (rv);
} else {
@@ -538,7 +538,7 @@ __elfN(load_section)(struct image_params *imgp, vm_offset_t offset,
cow = MAP_COPY_ON_WRITE | MAP_PREFAULT |
(prot & VM_PROT_WRITE ? 0 : MAP_DISABLE_COREDUMP);
- rv = __elfN(map_insert)(map,
+ rv = __elfN(map_insert)(imgp, map,
object,
file_addr, /* file offset */
map_addr, /* virtual start */
@@ -568,8 +568,8 @@ __elfN(load_section)(struct image_params *imgp, vm_offset_t offset,
/* This had damn well better be true! */
if (map_len != 0) {
- rv = __elfN(map_insert)(map, NULL, 0, map_addr, map_addr +
- map_len, VM_PROT_ALL, 0);
+ rv = __elfN(map_insert)(imgp, map, NULL, 0, map_addr,
+ map_addr + map_len, VM_PROT_ALL, 0);
if (rv != KERN_SUCCESS) {
return (EINVAL);
}
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
index 7f7769d..64788ec 100644
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/smp.h>
-int cpu_deepest_sleep = 0; /* Deepest Cx state available. */
int cpu_disable_c2_sleep = 0; /* Timer dies in C2. */
int cpu_disable_c3_sleep = 0; /* Timer dies in C3. */
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index cd1ba6f..30cd545 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -820,6 +820,9 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new)
MPASS((flags & ~(FDDUP_FLAG_CLOEXEC)) == 0);
MPASS(mode < FDDUP_LASTMODE);
+ AUDIT_ARG_FD(old);
+ /* XXXRW: if (flags & FDDUP_FIXED) AUDIT_ARG_FD2(new); */
+
/*
* Verify we have a valid descriptor to dup from and possibly to
* dup to. Unlike dup() and dup2(), fcntl()'s F_DUPFD should
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index ce7d453..ea10781 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -207,8 +207,7 @@ exit1(struct thread *td, int rval, int signo)
/*
* Deref SU mp, since the thread does not return to userspace.
*/
- if (softdep_ast_cleanup != NULL)
- softdep_ast_cleanup();
+ td_softdep_cleanup(td);
/*
* MUST abort all other threads before proceeding past here.
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
index 8c2f0ac..2a22af1 100644
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -1014,10 +1014,13 @@ racct_proc_exit(struct proc *p)
racct_set_locked(p, RACCT_CPU, runtime, 0);
racct_add_cred_locked(p->p_ucred, RACCT_PCTCPU, pct);
+ KASSERT(p->p_racct->r_resources[RACCT_RSS] == 0,
+ ("process reaped with %ju allocated for RSS\n",
+ p->p_racct->r_resources[RACCT_RSS]));
for (i = 0; i <= RACCT_MAX; i++) {
if (p->p_racct->r_resources[i] == 0)
continue;
- if (!RACCT_IS_RECLAIMABLE(i))
+ if (!RACCT_IS_RECLAIMABLE(i))
continue;
racct_set_locked(p, i, 0, 0);
}
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 3a73098..6b79a30 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -192,6 +192,8 @@ thread_dtor(void *mem, int size, void *arg)
#endif
/* Free all OSD associated to this thread. */
osd_thread_exit(td);
+ td_softdep_cleanup(td);
+ MPASS(td->td_su == NULL);
EVENTHANDLER_INVOKE(thread_dtor, td);
tid_free(td->td_tid);
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index d83beca..c7b8238 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1662,7 +1662,11 @@ sched_pctcpu_update(struct td_sched *ts, int run)
{
int t = ticks;
- if (t - ts->ts_ltick >= SCHED_TICK_TARG) {
+ /*
+ * The signed difference may be negative if the thread hasn't run for
+ * over half of the ticks rollover period.
+ */
+ if ((u_int)(t - ts->ts_ltick) >= SCHED_TICK_TARG) {
ts->ts_ticks = 0;
ts->ts_ftick = t - SCHED_TICK_TARG;
} else if (t - ts->ts_ftick >= SCHED_TICK_MAX) {
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index 90c5673..3bd9f93 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -26,7 +26,7 @@
/*
* Implementation of sleep queues used to hold queue of threads blocked on
- * a wait channel. Sleep queues different from turnstiles in that wait
+ * a wait channel. Sleep queues are different from turnstiles in that wait
* channels are not owned by anyone, so there is no priority propagation.
* Sleep queues can also provide a timeout and can also be interrupted by
* signals. That said, there are several similarities between the turnstile
@@ -36,7 +36,7 @@
* a linked list of queues. An individual queue is located by using a hash
* to pick a chain, locking the chain, and then walking the chain searching
* for the queue. This means that a wait channel object does not need to
- * embed it's queue head just as locks do not embed their turnstile queue
+ * embed its queue head just as locks do not embed their turnstile queue
* head. Threads also carry around a sleep queue that they lend to the
* wait channel when blocking. Just as in turnstiles, the queue includes
* a free list of the sleep queues of other threads blocked on the same
@@ -98,7 +98,7 @@ __FBSDID("$FreeBSD$");
#define SC_LOOKUP(wc) &sleepq_chains[SC_HASH(wc)]
#define NR_SLEEPQS 2
/*
- * There two different lists of sleep queues. Both lists are connected
+ * There are two different lists of sleep queues. Both lists are connected
* via the sq_hash entries. The first list is the sleep queue chain list
* that a sleep queue is on when it is attached to a wait channel. The
* second list is the free list hung off of a sleep queue that is attached
@@ -183,7 +183,7 @@ init_sleepqueue_profiling(void)
for (i = 0; i < SC_TABLESIZE; i++) {
snprintf(chain_name, sizeof(chain_name), "%u", i);
- chain_oid = SYSCTL_ADD_NODE(NULL,
+ chain_oid = SYSCTL_ADD_NODE(NULL,
SYSCTL_STATIC_CHILDREN(_debug_sleepq_chains), OID_AUTO,
chain_name, CTLFLAG_RD, NULL, "sleepq chain stats");
SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(chain_oid), OID_AUTO,
@@ -218,7 +218,7 @@ init_sleepqueues(void)
#else
NULL, NULL, sleepq_init, NULL, UMA_ALIGN_CACHE, 0);
#endif
-
+
thread0.td_sleepqueue = sleepq_alloc();
}
@@ -430,6 +430,7 @@ sleepq_catch_signals(void *wchan, int pri)
struct sigacts *ps;
int sig, ret;
+ ret = 0;
td = curthread;
p = curproc;
sc = SC_LOOKUP(wchan);
@@ -443,53 +444,65 @@ sleepq_catch_signals(void *wchan, int pri)
}
/*
- * See if there are any pending signals for this thread. If not
- * we can switch immediately. Otherwise do the signal processing
- * directly.
+ * See if there are any pending signals or suspension requests for this
+ * thread. If not, we can switch immediately.
*/
thread_lock(td);
- if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) == 0) {
- sleepq_switch(wchan, pri);
- return (0);
- }
- thread_unlock(td);
- mtx_unlock_spin(&sc->sc_lock);
- CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
- (void *)td, (long)p->p_pid, td->td_name);
- PROC_LOCK(p);
- ps = p->p_sigacts;
- mtx_lock(&ps->ps_mtx);
- sig = cursig(td);
- if (sig == -1) {
- mtx_unlock(&ps->ps_mtx);
- KASSERT((td->td_flags & TDF_SBDRY) != 0, ("lost TDF_SBDRY"));
- KASSERT(TD_SBDRY_INTR(td),
- ("lost TDF_SERESTART of TDF_SEINTR"));
- KASSERT((td->td_flags & (TDF_SEINTR | TDF_SERESTART)) !=
- (TDF_SEINTR | TDF_SERESTART),
- ("both TDF_SEINTR and TDF_SERESTART"));
- ret = TD_SBDRY_ERRNO(td);
- } else if (sig == 0) {
- mtx_unlock(&ps->ps_mtx);
- ret = thread_suspend_check(1);
- MPASS(ret == 0 || ret == EINTR || ret == ERESTART);
- } else {
- if (SIGISMEMBER(ps->ps_sigintr, sig))
- ret = EINTR;
- else
- ret = ERESTART;
- mtx_unlock(&ps->ps_mtx);
+ if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) != 0) {
+ thread_unlock(td);
+ mtx_unlock_spin(&sc->sc_lock);
+ CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
+ (void *)td, (long)p->p_pid, td->td_name);
+ PROC_LOCK(p);
+ /*
+ * Check for suspension first. Checking for signals and then
+ * suspending could result in a missed signal, since a signal
+ * can be delivered while this thread is suspended.
+ */
+ if ((td->td_flags & TDF_NEEDSUSPCHK) != 0) {
+ ret = thread_suspend_check(1);
+ MPASS(ret == 0 || ret == EINTR || ret == ERESTART);
+ if (ret != 0) {
+ PROC_UNLOCK(p);
+ mtx_lock_spin(&sc->sc_lock);
+ thread_lock(td);
+ goto out;
+ }
+ }
+ if ((td->td_flags & TDF_NEEDSIGCHK) != 0) {
+ ps = p->p_sigacts;
+ mtx_lock(&ps->ps_mtx);
+ sig = cursig(td);
+ if (sig == -1) {
+ mtx_unlock(&ps->ps_mtx);
+ KASSERT((td->td_flags & TDF_SBDRY) != 0,
+ ("lost TDF_SBDRY"));
+ KASSERT(TD_SBDRY_INTR(td),
+ ("lost TDF_SERESTART of TDF_SEINTR"));
+ KASSERT((td->td_flags &
+ (TDF_SEINTR | TDF_SERESTART)) !=
+ (TDF_SEINTR | TDF_SERESTART),
+ ("both TDF_SEINTR and TDF_SERESTART"));
+ ret = TD_SBDRY_ERRNO(td);
+ } else if (sig != 0) {
+ ret = SIGISMEMBER(ps->ps_sigintr, sig) ?
+ EINTR : ERESTART;
+ mtx_unlock(&ps->ps_mtx);
+ } else {
+ mtx_unlock(&ps->ps_mtx);
+ }
+ }
+ /*
+ * Lock the per-process spinlock prior to dropping the PROC_LOCK
+ * to avoid a signal delivery race. PROC_LOCK, PROC_SLOCK, and
+ * thread_lock() are currently held in tdsendsignal().
+ */
+ PROC_SLOCK(p);
+ mtx_lock_spin(&sc->sc_lock);
+ PROC_UNLOCK(p);
+ thread_lock(td);
+ PROC_SUNLOCK(p);
}
- /*
- * Lock the per-process spinlock prior to dropping the PROC_LOCK
- * to avoid a signal delivery race. PROC_LOCK, PROC_SLOCK, and
- * thread_lock() are currently held in tdsendsignal().
- */
- PROC_SLOCK(p);
- mtx_lock_spin(&sc->sc_lock);
- PROC_UNLOCK(p);
- thread_lock(td);
- PROC_SUNLOCK(p);
if (ret == 0) {
sleepq_switch(wchan, pri);
return (0);
@@ -532,7 +545,7 @@ sleepq_switch(void *wchan, int pri)
mtx_assert(&sc->sc_lock, MA_OWNED);
THREAD_LOCK_ASSERT(td, MA_OWNED);
- /*
+ /*
* If we have a sleep queue, then we've already been woken up, so
* just return.
*/
@@ -559,7 +572,7 @@ sleepq_switch(void *wchan, int pri)
#endif
}
mtx_unlock_spin(&sc->sc_lock);
- return;
+ return;
}
#ifdef SLEEPQUEUE_PROFILING
if (prof_enabled)
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 763ba0d..1c9db43 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
-void (*softdep_ast_cleanup)(void);
+void (*softdep_ast_cleanup)(struct thread *);
/*
* Define the code needed before returning to user mode, for trap and
@@ -128,8 +128,8 @@ userret(struct thread *td, struct trapframe *frame)
#ifdef KTRACE
KTRUSERRET(td);
#endif
- if (softdep_ast_cleanup != NULL)
- softdep_ast_cleanup();
+ td_softdep_cleanup(td);
+ MPASS(td->td_su == NULL);
/*
* If this thread tickled GEOM, we need to wait for the giggling to
diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
index c856a6e..c00a901 100644
--- a/sys/kern/subr_uio.c
+++ b/sys/kern/subr_uio.c
@@ -468,10 +468,11 @@ copyout_map(struct thread *td, vm_offset_t *addr, size_t sz)
/* round size up to page boundary */
size = (vm_size_t)round_page(sz);
-
- error = vm_mmap(&vms->vm_map, addr, size, VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0);
-
+ if (size == 0)
+ return (EINVAL);
+ error = vm_mmap_object(&vms->vm_map, addr, size, VM_PROT_READ |
+ VM_PROT_WRITE, VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, NULL, 0,
+ FALSE, td);
return (error);
}
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 75fb66e..8a77e17 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -363,6 +363,8 @@ dofileread(td, fd, fp, auio, offset, flags)
struct uio *ktruio = NULL;
#endif
+ AUDIT_ARG_FD(fd);
+
/* Finish zero length reads right here */
if (auio->uio_resid == 0) {
td->td_retval[0] = 0;
@@ -576,6 +578,7 @@ dofilewrite(td, fd, fp, auio, offset, flags)
struct uio *ktruio = NULL;
#endif
+ AUDIT_ARG_FD(fd);
auio->uio_rw = UIO_WRITE;
auio->uio_td = td;
auio->uio_offset = offset;
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index b37d5a5..b0a535c 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -95,64 +95,101 @@ static const char *dev_console_filename;
#define TTY_CALLOUT(tp,d) (dev2unit(d) & TTYUNIT_CALLOUT)
+static int tty_drainwait = 5 * 60;
+SYSCTL_INT(_kern, OID_AUTO, tty_drainwait, CTLFLAG_RWTUN,
+ &tty_drainwait, 0, "Default output drain timeout in seconds");
+
/*
* Set TTY buffer sizes.
*/
#define TTYBUF_MAX 65536
-static void
+/*
+ * Allocate buffer space if necessary, and set low watermarks, based on speed.
+ * Note that the ttyxxxq_setsize() functions may drop and then reacquire the tty
+ * lock during memory allocation. They will return ENXIO if the tty disappears
+ * while unlocked.
+ */
+static int
tty_watermarks(struct tty *tp)
{
size_t bs = 0;
+ int error;
- /* Provide an input buffer for 0.2 seconds of data. */
+ /* Provide an input buffer for 2 seconds of data. */
if (tp->t_termios.c_cflag & CREAD)
bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX);
- ttyinq_setsize(&tp->t_inq, tp, bs);
+ error = ttyinq_setsize(&tp->t_inq, tp, bs);
+ if (error != 0)
+ return (error);
/* Set low watermark at 10% (when 90% is available). */
tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10;
- /* Provide an output buffer for 0.2 seconds of data. */
+ /* Provide an output buffer for 2 seconds of data. */
bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX);
- ttyoutq_setsize(&tp->t_outq, tp, bs);
+ error = ttyoutq_setsize(&tp->t_outq, tp, bs);
+ if (error != 0)
+ return (error);
/* Set low watermark at 10% (when 90% is available). */
tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10;
+
+ return (0);
}
static int
tty_drain(struct tty *tp, int leaving)
{
- size_t bytesused;
+ sbintime_t timeout_at;
+ size_t bytes;
int error;
if (ttyhook_hashook(tp, getc_inject))
/* buffer is inaccessible */
return (0);
- while (ttyoutq_bytesused(&tp->t_outq) > 0 || ttydevsw_busy(tp)) {
- ttydevsw_outwakeup(tp);
- /* Could be handled synchronously. */
- bytesused = ttyoutq_bytesused(&tp->t_outq);
- if (bytesused == 0 && !ttydevsw_busy(tp))
- return (0);
-
- /* Wait for data to be drained. */
- if (leaving) {
- error = tty_timedwait(tp, &tp->t_outwait, hz);
- if (error == EWOULDBLOCK &&
- ttyoutq_bytesused(&tp->t_outq) < bytesused)
- error = 0;
- } else
- error = tty_wait(tp, &tp->t_outwait);
+ /*
+ * For close(), use the recent historic timeout of "1 second without
+ * making progress". For tcdrain(), use t_drainwait as the timeout,
+ * with zero meaning "no timeout" which gives POSIX behavior.
+ */
+ if (leaving)
+ timeout_at = getsbinuptime() + SBT_1S;
+ else if (tp->t_drainwait != 0)
+ timeout_at = getsbinuptime() + SBT_1S * tp->t_drainwait;
+ else
+ timeout_at = 0;
- if (error)
+ /*
+ * Poll the output buffer and the hardware for completion, at 10 Hz.
+ * Polling is required for devices which are not able to signal an
+ * interrupt when the transmitter becomes idle (most USB serial devs).
+ * The unusual structure of this loop ensures we check for busy one more
+ * time after tty_timedwait() returns EWOULDBLOCK, so that success has
+ * higher priority than timeout if the IO completed in the last 100mS.
+ */
+ error = 0;
+ bytes = ttyoutq_bytesused(&tp->t_outq);
+ for (;;) {
+ if (ttyoutq_bytesused(&tp->t_outq) == 0 && !ttydevsw_busy(tp))
+ return (0);
+ if (error != 0)
+ return (error);
+ ttydevsw_outwakeup(tp);
+ error = tty_timedwait(tp, &tp->t_outwait, hz / 10);
+ if (error != 0 && error != EWOULDBLOCK)
return (error);
+ else if (timeout_at == 0 || getsbinuptime() < timeout_at)
+ error = 0;
+ else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) {
+ /* In close, making progress, grant an extra second. */
+ error = 0;
+ timeout_at += SBT_1S;
+ bytes = ttyoutq_bytesused(&tp->t_outq);
+ }
}
-
- return (0);
}
/*
@@ -294,7 +331,9 @@ ttydev_open(struct cdev *dev, int oflags, int devtype __unused,
goto done;
ttydisc_open(tp);
- tty_watermarks(tp); /* XXXGL: drops lock */
+ error = tty_watermarks(tp);
+ if (error != 0)
+ goto done;
}
/* Wait for Carrier Detect. */
@@ -1015,6 +1054,7 @@ tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct mtx *mutex)
tp->t_devsw = tsw;
tp->t_devswsoftc = sc;
tp->t_flags = tsw->tsw_flags;
+ tp->t_drainwait = tty_drainwait;
tty_init_termios(tp);
@@ -1602,7 +1642,9 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
tp->t_termios.c_ospeed = t->c_ospeed;
/* Baud rate has changed - update watermarks. */
- tty_watermarks(tp);
+ error = tty_watermarks(tp);
+ if (error)
+ return (error);
}
/* Copy new non-device driver parameters. */
@@ -1755,6 +1797,14 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
case TIOCDRAIN:
/* Drain TTY output. */
return tty_drain(tp, 0);
+ case TIOCGDRAINWAIT:
+ *(int *)data = tp->t_drainwait;
+ return (0);
+ case TIOCSDRAINWAIT:
+ error = priv_check(td, PRIV_TTY_DRAINWAIT);
+ if (error == 0)
+ tp->t_drainwait = *(int *)data;
+ return (error);
case TIOCCONS:
/* Set terminal as console TTY. */
if (*(int *)data) {
diff --git a/sys/kern/tty_inq.c b/sys/kern/tty_inq.c
index 97017ac..163b194 100644
--- a/sys/kern/tty_inq.c
+++ b/sys/kern/tty_inq.c
@@ -112,7 +112,7 @@ static uma_zone_t ttyinq_zone;
TTYINQ_INSERT_TAIL(ti, tib); \
} while (0)
-void
+int
ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size)
{
struct ttyinq_block *tib;
@@ -134,8 +134,14 @@ ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size)
tib = uma_zalloc(ttyinq_zone, M_WAITOK);
tty_lock(tp);
+ if (tty_gone(tp)) {
+ uma_zfree(ttyinq_zone, tib);
+ return (ENXIO);
+ }
+
TTYINQ_INSERT_TAIL(ti, tib);
}
+ return (0);
}
void
diff --git a/sys/kern/tty_outq.c b/sys/kern/tty_outq.c
index 5d40abe..3f86e11 100644
--- a/sys/kern/tty_outq.c
+++ b/sys/kern/tty_outq.c
@@ -89,7 +89,7 @@ ttyoutq_flush(struct ttyoutq *to)
to->to_end = 0;
}
-void
+int
ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size)
{
struct ttyoutq_block *tob;
@@ -111,8 +111,14 @@ ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size)
tob = uma_zalloc(ttyoutq_zone, M_WAITOK);
tty_lock(tp);
+ if (tty_gone(tp)) {
+ uma_zfree(ttyoutq_zone, tob);
+ return (ENXIO);
+ }
+
TTYOUTQ_INSERT_TAIL(to, tob);
}
+ return (0);
}
void
diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c
index 4886501..354564b 100644
--- a/sys/kern/uipc_mqueue.c
+++ b/sys/kern/uipc_mqueue.c
@@ -714,7 +714,9 @@ do_recycle(void *context, int pending __unused)
{
struct vnode *vp = (struct vnode *)context;
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
vrecycle(vp);
+ VOP_UNLOCK(vp, 0);
vdrop(vp);
}
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index dce0e1a..1e01ccd 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
+#include <sys/syscallsubr.h>
#include <sys/protosw.h>
#include <sys/rwlock.h>
#include <sys/sema.h>
@@ -858,12 +859,9 @@ aio_process_mlock(struct kaiocb *job)
("%s: opcode %d", __func__, job->uaiocb.aio_lio_opcode));
aio_switch_vmspace(job);
- error = vm_mlock(job->userproc, job->cred,
- __DEVOLATILE(void *, cb->aio_buf), cb->aio_nbytes);
- if (error)
- aio_complete(job, -1, error);
- else
- aio_complete(job, 0, 0);
+ error = kern_mlock(job->userproc, job->cred,
+ __DEVOLATILE(uintptr_t, cb->aio_buf), cb->aio_nbytes);
+ aio_complete(job, error != 0 ? -1 : 0, error);
}
static void
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index d2f779f..f9da22b 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -349,8 +349,12 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred,
if ((error = VOP_OPEN(vp, fmode, cred, td, fp)) != 0)
return (error);
- if (fmode & (O_EXLOCK | O_SHLOCK)) {
+ while ((fmode & (O_EXLOCK | O_SHLOCK)) != 0) {
KASSERT(fp != NULL, ("open with flock requires fp"));
+ if (fp->f_type != DTYPE_NONE && fp->f_type != DTYPE_VNODE) {
+ error = EOPNOTSUPP;
+ break;
+ }
lock_flags = VOP_ISLOCKED(vp);
VOP_UNLOCK(vp, 0);
lf.l_whence = SEEK_SET;
@@ -367,8 +371,12 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred,
if (error == 0)
fp->f_flag |= FHASLOCK;
vn_lock(vp, lock_flags | LK_RETRY);
- if (error == 0 && vp->v_iflag & VI_DOOMED)
+ if (error != 0)
+ break;
+ if ((vp->v_iflag & VI_DOOMED) != 0) {
error = ENOENT;
+ break;
+ }
/*
* Another thread might have used this vnode as an
@@ -376,20 +384,20 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred,
* Ensure the vnode is still able to be opened for
* writing after the lock has been obtained.
*/
- if (error == 0 && accmode & VWRITE)
+ if ((accmode & VWRITE) != 0)
error = vn_writechk(vp);
+ break;
+ }
- if (error != 0) {
- fp->f_flag |= FOPENFAILED;
- fp->f_vnode = vp;
- if (fp->f_ops == &badfileops) {
- fp->f_type = DTYPE_VNODE;
- fp->f_ops = &vnops;
- }
- vref(vp);
+ if (error != 0) {
+ fp->f_flag |= FOPENFAILED;
+ fp->f_vnode = vp;
+ if (fp->f_ops == &badfileops) {
+ fp->f_type = DTYPE_VNODE;
+ fp->f_ops = &vnops;
}
- }
- if (error == 0 && fmode & FWRITE) {
+ vref(vp);
+ } else if ((fmode & FWRITE) != 0) {
VOP_ADD_WRITECOUNT(vp, 1);
CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d",
__func__, vp, vp->v_writecount);
@@ -422,12 +430,9 @@ vn_writechk(vp)
/*
* Vnode close call
*/
-int
-vn_close(vp, flags, file_cred, td)
- register struct vnode *vp;
- int flags;
- struct ucred *file_cred;
- struct thread *td;
+static int
+vn_close1(struct vnode *vp, int flags, struct ucred *file_cred,
+ struct thread *td, bool keep_ref)
{
struct mount *mp;
int error, lock_flags;
@@ -449,11 +454,22 @@ vn_close(vp, flags, file_cred, td)
__func__, vp, vp->v_writecount);
}
error = VOP_CLOSE(vp, flags, file_cred, td);
- vput(vp);
+ if (keep_ref)
+ VOP_UNLOCK(vp, 0);
+ else
+ vput(vp);
vn_finished_write(mp);
return (error);
}
+int
+vn_close(struct vnode *vp, int flags, struct ucred *file_cred,
+ struct thread *td)
+{
+
+ return (vn_close1(vp, flags, file_cred, td, false));
+}
+
/*
* Heuristic to detect sequential operation.
*/
@@ -1569,16 +1585,15 @@ vn_closefile(fp, td)
struct vnode *vp;
struct flock lf;
int error;
+ bool ref;
vp = fp->f_vnode;
fp->f_ops = &badfileops;
+ ref= (fp->f_flag & FHASLOCK) != 0 && fp->f_type == DTYPE_VNODE;
- if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK)
- vref(vp);
-
- error = vn_close(vp, fp->f_flag, fp->f_cred, td);
+ error = vn_close1(vp, fp->f_flag, fp->f_cred, td, ref);
- if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) {
+ if (__predict_false(ref)) {
lf.l_whence = SEEK_SET;
lf.l_start = 0;
lf.l_len = 0;
@@ -2419,9 +2434,11 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size,
* proc does a setuid?
*/
mp = vp->v_mount;
- if (mp != NULL && (mp->mnt_flag & MNT_NOEXEC) != 0)
+ if (mp != NULL && (mp->mnt_flag & MNT_NOEXEC) != 0) {
maxprot = VM_PROT_NONE;
- else
+ if ((prot & VM_PROT_EXECUTE) != 0)
+ return (EACCES);
+ } else
maxprot = VM_PROT_EXECUTE;
if ((fp->f_flag & FREAD) != 0)
maxprot |= VM_PROT_READ;
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index d141aa9..14b7036 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -165,6 +165,7 @@ SUBDIR= \
${_igb} \
${_iir} \
imgact_binmisc \
+ ${_intelspi} \
${_io} \
${_ioat} \
${_ipoib} \
@@ -623,6 +624,7 @@ _hyperv= hyperv
_ichwd= ichwd
_ida= ida
_iir= iir
+_intelspi= intelspi
_ipmi= ipmi
_ips= ips
_isci= isci
diff --git a/sys/modules/bytgpio/Makefile b/sys/modules/bytgpio/Makefile
index db06e4af..069241e 100644
--- a/sys/modules/bytgpio/Makefile
+++ b/sys/modules/bytgpio/Makefile
@@ -3,6 +3,6 @@
.PATH: ${.CURDIR}/../../dev/gpio
KMOD= bytgpio
SRCS= bytgpio.c
-SRCS+= acpi_if.h device_if.h bus_if.h gpio_if.h
+SRCS+= acpi_if.h device_if.h bus_if.h gpio_if.h opt_acpi.h opt_platform.h
.include <bsd.kmod.mk>
diff --git a/sys/modules/dtb/imx6/Makefile b/sys/modules/dtb/imx6/Makefile
index 9e83ab6..a84024c 100644
--- a/sys/modules/dtb/imx6/Makefile
+++ b/sys/modules/dtb/imx6/Makefile
@@ -5,6 +5,9 @@ DTS= \
imx6q-cubox-i.dts \
imx6dl-hummingboard.dts \
imx6q-hummingboard.dts \
+ imx6dl-nitrogen6x.dts \
+ imx6q-nitrogen6_max.dts \
+ imx6q-nitrogen6x.dts \
imx6dl-riotboard.dts \
imx6dl-wandboard.dts \
imx6q-wandboard.dts
diff --git a/sys/modules/geom/geom_uzip/Makefile b/sys/modules/geom/geom_uzip/Makefile
index a336f63..dd2bd46 100644
--- a/sys/modules/geom/geom_uzip/Makefile
+++ b/sys/modules/geom/geom_uzip/Makefile
@@ -18,5 +18,6 @@ CFLAGS+= -I${.CURDIR}/../../../contrib/xz-embedded/freebsd \
SRCS+= xz_crc32.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \
xz_malloc.c
SRCS+= xz.h xz_config.h xz_lzma2.h xz_malloc.h xz_private.h xz_stream.h
+SRCS+= opt_geom.h
.include <bsd.kmod.mk>
diff --git a/sys/modules/intelspi/Makefile b/sys/modules/intelspi/Makefile
new file mode 100644
index 0000000..b53eca7
--- /dev/null
+++ b/sys/modules/intelspi/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/intel
+KMOD= intelspi
+SRCS= spi.c
+SRCS+= acpi_if.h device_if.h bus_if.h opt_acpi.h spibus_if.h
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/mem/Makefile b/sys/modules/mem/Makefile
index 3710c5d..0e47a28 100644
--- a/sys/modules/mem/Makefile
+++ b/sys/modules/mem/Makefile
@@ -3,14 +3,17 @@
.PATH: ${.CURDIR}/../../dev/mem
.PATH: ${.CURDIR}/../../${MACHINE}/${MACHINE}
.PATH: ${.CURDIR}/../../${MACHINE_CPUARCH}/${MACHINE_CPUARCH}
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+.PATH: ${.CURDIR}/../../x86/x86
+.endif
KMOD= mem
SRCS= mem.c memdev.c memutil.c
.if ${MACHINE_CPUARCH} == "i386"
-SRCS+= i686_mem.c k6_mem.c
+SRCS+= x86_mem.c k6_mem.c
.endif
.if ${MACHINE_CPUARCH} == "amd64"
-SRCS+= amd64_mem.c
+SRCS+= x86_mem.c
.endif
SRCS+= bus_if.h device_if.h
diff --git a/sys/modules/nvme/Makefile b/sys/modules/nvme/Makefile
index ae727a7..6fa3531 100644
--- a/sys/modules/nvme/Makefile
+++ b/sys/modules/nvme/Makefile
@@ -16,6 +16,7 @@ SRCS = nvme.c \
\
bus_if.h \
device_if.h \
+ opt_cam.h \
pci_if.h
.include <bsd.kmod.mk>
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index b0aa5fe..df1f722 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -528,6 +528,11 @@ insert:
af6 = ip6af->ip6af_down;
frag6_deq(ip6af);
while (af6 != (struct ip6asfrag *)q6) {
+ m->m_pkthdr.csum_flags &=
+ IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags;
+ m->m_pkthdr.csum_data +=
+ IP6_REASS_MBUF(af6)->m_pkthdr.csum_data;
+
af6dwn = af6->ip6af_down;
frag6_deq(af6);
while (t->m_next)
@@ -538,6 +543,10 @@ insert:
af6 = af6dwn;
}
+ while (m->m_pkthdr.csum_data & 0xffff0000)
+ m->m_pkthdr.csum_data = (m->m_pkthdr.csum_data & 0xffff) +
+ (m->m_pkthdr.csum_data >> 16);
+
/* adjust offset to point where the original next header starts */
offset = ip6af->ip6af_offset - sizeof(struct ip6_frag);
free(ip6af, M_FTABLE);
diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c
index a80d1e5..d96b14c 100644
--- a/sys/netpfil/ipfw/ip_fw2.c
+++ b/sys/netpfil/ipfw/ip_fw2.c
@@ -1510,8 +1510,8 @@ do { \
if (!match)
break;
if (cmdlen == F_INSN_SIZE(ipfw_insn_u32))
- match =
- ((ipfw_insn_u32 *)cmd)->d[0] == v;
+ match = ((ipfw_insn_u32 *)cmd)->d[0] ==
+ TARG_VAL(chain, v, tag);
else
tablearg = v;
} else if (is_ipv6) {
@@ -1523,7 +1523,8 @@ do { \
sizeof(struct in6_addr),
pkey, &v);
if (cmdlen == F_INSN_SIZE(ipfw_insn_u32))
- match = ((ipfw_insn_u32 *)cmd)->d[0] == v;
+ match = ((ipfw_insn_u32 *)cmd)->d[0] ==
+ TARG_VAL(chain, v, tag);
if (match)
tablearg = v;
}
@@ -1535,7 +1536,8 @@ do { \
match = ipfw_lookup_table_extended(chain,
cmd->arg1, 0, &args->f_id, &v);
if (cmdlen == F_INSN_SIZE(ipfw_insn_u32))
- match = ((ipfw_insn_u32 *)cmd)->d[0] == v;
+ match = ((ipfw_insn_u32 *)cmd)->d[0] ==
+ TARG_VAL(chain, v, tag);
if (match)
tablearg = v;
}
diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c
index ec90605..003f0a9 100644
--- a/sys/netpfil/ipfw/ip_fw_sockopt.c
+++ b/sys/netpfil/ipfw/ip_fw_sockopt.c
@@ -2662,7 +2662,14 @@ ref_opcode_object(struct ip_fw_chain *ch, ipfw_insn *cmd, struct tid_info *ti,
return (0);
}
- /* Found. Bump refcount and update kidx. */
+ /*
+ * Object is already exist.
+ * Its subtype should match with expected value.
+ */
+ if (ti->type != no->subtype)
+ return (EINVAL);
+
+ /* Bump refcount and update kidx. */
no->refcnt++;
rw->update(cmd, no->kidx);
return (0);
diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c
index 6cb5840..eac5317 100644
--- a/sys/netpfil/pf/pf_lb.c
+++ b/sys/netpfil/pf/pf_lb.c
@@ -553,7 +553,7 @@ pf_get_translation(struct pf_pdesc *pd, struct mbuf *m, int off, int direction,
return (NULL);
*nkp = pf_state_key_clone(*skp);
if (*nkp == NULL) {
- uma_zfree(V_pf_state_key_z, skp);
+ uma_zfree(V_pf_state_key_z, *skp);
*skp = NULL;
return (NULL);
}
diff --git a/sys/netpfil/pf/pf_osfp.c b/sys/netpfil/pf/pf_osfp.c
index 55a7d10..9c41cf5 100644
--- a/sys/netpfil/pf/pf_osfp.c
+++ b/sys/netpfil/pf/pf_osfp.c
@@ -19,6 +19,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_inet6.h"
+
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -34,7 +36,9 @@ __FBSDID("$FreeBSD$");
#include <net/vnet.h>
#include <net/pfvar.h>
+#ifdef INET6
#include <netinet/ip6.h>
+#endif
static MALLOC_DEFINE(M_PFOSFP, "pf_osfp", "pf(4) operating system fingerprints");
#define DPFPRINTF(format, x...) \
@@ -94,7 +98,11 @@ pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const st
struct pf_os_fingerprint fp, *fpresult;
int cnt, optlen = 0;
const u_int8_t *optp;
- char srcname[128];
+#ifdef INET6
+ char srcname[INET6_ADDRSTRLEN];
+#else
+ char srcname[INET_ADDRSTRLEN];
+#endif
if ((tcp->th_flags & (TH_SYN|TH_ACK)) != TH_SYN)
return (NULL);
@@ -110,7 +118,7 @@ pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const st
fp.fp_ttl = ip->ip_ttl;
if (ip->ip_off & htons(IP_DF))
fp.fp_flags |= PF_OSFP_DF;
- strlcpy(srcname, inet_ntoa(ip->ip_src), sizeof(srcname));
+ inet_ntoa_r(ip->ip_src, srcname);
}
#ifdef INET6
else if (ip6) {
@@ -119,8 +127,7 @@ pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const st
fp.fp_ttl = ip6->ip6_hlim;
fp.fp_flags |= PF_OSFP_DF;
fp.fp_flags |= PF_OSFP_INET6;
- strlcpy(srcname, ip6_sprintf((struct in6_addr *)&ip6->ip6_src),
- sizeof(srcname));
+ ip6_sprintf(srcname, (const struct in6_addr *)&ip6->ip6_src);
}
#endif
else
diff --git a/sys/ofed/drivers/infiniband/core/cma.c b/sys/ofed/drivers/infiniband/core/cma.c
index 27e6194..f860c42 100644
--- a/sys/ofed/drivers/infiniband/core/cma.c
+++ b/sys/ofed/drivers/infiniband/core/cma.c
@@ -1049,8 +1049,6 @@ static void cma_release_port(struct rdma_id_private *id_priv)
kfree(bind_list);
}
mutex_unlock(&lock);
- if (id_priv->sock)
- sock_release(id_priv->sock);
}
static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
diff --git a/sys/ofed/drivers/infiniband/core/iwcm.c b/sys/ofed/drivers/infiniband/core/iwcm.c
index 3651063..fa6b674 100644
--- a/sys/ofed/drivers/infiniband/core/iwcm.c
+++ b/sys/ofed/drivers/infiniband/core/iwcm.c
@@ -528,24 +528,15 @@ iw_init_sock(struct iw_cm_id *cm_id)
}
static int
-iw_close_socket(struct iw_cm_id *cm_id, int close)
+iw_uninit_socket(struct iw_cm_id *cm_id)
{
struct socket *so = cm_id->so;
- int rc;
-
SOCK_LOCK(so);
soupcall_clear(so, SO_RCV);
SOCK_UNLOCK(so);
- if (close)
- rc = soclose(so);
- else
- rc = soshutdown(so, SHUT_WR | SHUT_RD);
-
- cm_id->so = NULL;
-
- return rc;
+ return (0);
}
static int
@@ -554,18 +545,17 @@ iw_create_listen(struct iw_cm_id *cm_id, int backlog)
int rc;
iw_init_sock(cm_id);
- rc = solisten(cm_id->so, backlog, curthread);
+ rc = -solisten(cm_id->so, backlog, curthread);
if (rc != 0)
- iw_close_socket(cm_id, 0);
- return rc;
+ iw_uninit_socket(cm_id);
+ return (rc);
}
static int
iw_destroy_listen(struct iw_cm_id *cm_id)
{
- int rc;
- rc = iw_close_socket(cm_id, 0);
- return rc;
+
+ return (iw_uninit_socket(cm_id));
}
@@ -663,6 +653,9 @@ void iw_destroy_cm_id(struct iw_cm_id *cm_id)
wait_for_completion(&cm_id_priv->destroy_comp);
+ if (cm_id->so)
+ sock_release(cm_id->so);
+
free_cm_id(cm_id_priv);
}
EXPORT_SYMBOL(iw_destroy_cm_id);
diff --git a/sys/powerpc/mpc85xx/fsl_sdhc.c b/sys/powerpc/mpc85xx/fsl_sdhc.c
deleted file mode 100644
index 03e6bdd..0000000
--- a/sys/powerpc/mpc85xx/fsl_sdhc.c
+++ /dev/null
@@ -1,1303 +0,0 @@
-/*-
- * Copyright (c) 2011-2012 Semihalf
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Driver for Freescale integrated eSDHC controller.
- * Limitations:
- * - No support for multi-block transfers.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/rman.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-#include <sys/taskqueue.h>
-
-#include <machine/bus.h>
-#include <machine/vmparam.h>
-
-#include <dev/fdt/fdt_common.h>
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/ofw_bus_subr.h>
-
-#include <dev/mmc/bridge.h>
-#include <dev/mmc/mmcreg.h>
-#include <dev/mmc/mmcvar.h>
-#include <dev/mmc/mmcbrvar.h>
-
-#include <powerpc/mpc85xx/mpc85xx.h>
-
-#include "opt_platform.h"
-
-#include "mmcbr_if.h"
-
-#include "fsl_sdhc.h"
-
-#ifdef DEBUG
-#define DPRINTF(fmt, arg...) printf("DEBUG %s(): " fmt, __FUNCTION__, ##arg)
-#else
-#define DPRINTF(fmt, arg...)
-#endif
-
-
-/*****************************************************************************
- * Register the driver
- *****************************************************************************/
-/* Forward declarations */
-static int fsl_sdhc_probe(device_t);
-static int fsl_sdhc_attach(device_t);
-static int fsl_sdhc_detach(device_t);
-
-static int fsl_sdhc_read_ivar(device_t, device_t, int, uintptr_t *);
-static int fsl_sdhc_write_ivar(device_t, device_t, int, uintptr_t);
-
-static int fsl_sdhc_update_ios(device_t, device_t);
-static int fsl_sdhc_request(device_t, device_t, struct mmc_request *);
-static int fsl_sdhc_get_ro(device_t, device_t);
-static int fsl_sdhc_acquire_host(device_t, device_t);
-static int fsl_sdhc_release_host(device_t, device_t);
-
-static device_method_t fsl_sdhc_methods[] = {
- /* device_if */
- DEVMETHOD(device_probe, fsl_sdhc_probe),
- DEVMETHOD(device_attach, fsl_sdhc_attach),
- DEVMETHOD(device_detach, fsl_sdhc_detach),
-
- /* Bus interface */
- DEVMETHOD(bus_read_ivar, fsl_sdhc_read_ivar),
- DEVMETHOD(bus_write_ivar, fsl_sdhc_write_ivar),
-
- /* OFW bus interface */
- DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat),
- DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model),
- DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
- DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
- DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
-
- /* mmcbr_if */
- DEVMETHOD(mmcbr_update_ios, fsl_sdhc_update_ios),
- DEVMETHOD(mmcbr_request, fsl_sdhc_request),
- DEVMETHOD(mmcbr_get_ro, fsl_sdhc_get_ro),
- DEVMETHOD(mmcbr_acquire_host, fsl_sdhc_acquire_host),
- DEVMETHOD(mmcbr_release_host, fsl_sdhc_release_host),
-
- {0, 0},
-};
-
-/* kobj_class definition */
-static driver_t fsl_sdhc_driver = {
- "sdhci_fsl",
- fsl_sdhc_methods,
- sizeof(struct fsl_sdhc_softc)
-};
-
-static devclass_t fsl_sdhc_devclass;
-
-DRIVER_MODULE(sdhci_fsl, simplebus, fsl_sdhc_driver, fsl_sdhc_devclass, 0, 0);
-DRIVER_MODULE(mmc, sdhci_fsl, mmc_driver, mmc_devclass, NULL, NULL);
-MODULE_DEPEND(sdhci_fsl, mmc, 1, 1, 1);
-
-/*****************************************************************************
- * Private methods
- *****************************************************************************/
-static inline int
-read4(struct fsl_sdhc_softc *sc, unsigned int offset)
-{
-
- return bus_space_read_4(sc->bst, sc->bsh, offset);
-}
-
-static inline void
-write4(struct fsl_sdhc_softc *sc, unsigned int offset, int value)
-{
-
- bus_space_write_4(sc->bst, sc->bsh, offset, value);
-}
-
-static inline void
-set_bit(struct fsl_sdhc_softc *sc, uint32_t offset, uint32_t mask)
-{
- uint32_t x = read4(sc, offset);
-
- write4(sc, offset, x | mask);
-}
-
-static inline void
-clear_bit(struct fsl_sdhc_softc *sc, uint32_t offset, uint32_t mask)
-{
- uint32_t x = read4(sc, offset);
-
- write4(sc, offset, x & ~mask);
-}
-
-static int
-wait_for_bit_clear(struct fsl_sdhc_softc *sc, enum sdhc_reg_off reg,
- uint32_t bit)
-{
- uint32_t timeout = 10;
- uint32_t stat;
-
- stat = read4(sc, reg);
- while (stat & bit) {
- if (timeout == 0) {
- return (-1);
- }
- --timeout;
- DELAY(1000);
- stat = read4(sc, reg);
- }
-
- return (0);
-}
-
-static int
-wait_for_free_line(struct fsl_sdhc_softc *sc, enum sdhc_line line)
-{
- uint32_t timeout = 100;
- uint32_t stat;
-
- stat = read4(sc, SDHC_PRSSTAT);
- while (stat & line) {
- if (timeout == 0) {
- return (-1);
- }
- --timeout;
- DELAY(1000);
- stat = read4(sc, SDHC_PRSSTAT);
- }
-
- return (0);
-}
-
-static uint32_t
-get_platform_clock(struct fsl_sdhc_softc *sc)
-{
- device_t self, parent;
- phandle_t node;
- uint32_t clock;
-
- self = sc->self;
- node = ofw_bus_get_node(self);
-
- /* Get sdhci node properties */
- if((OF_getprop(node, "clock-frequency", (void *)&clock,
- sizeof(clock)) <= 0) || (clock == 0)) {
-
- /*
- * Trying to get clock from parent device (soc) if correct
- * clock cannot be acquired from sdhci node.
- */
- parent = device_get_parent(self);
- node = ofw_bus_get_node(parent);
-
- /* Get soc properties */
- if ((OF_getprop(node, "bus-frequency", (void *)&clock,
- sizeof(clock)) <= 0) || (clock == 0)) {
- device_printf(self,"Cannot acquire correct sdhci "
- "frequency from DTS.\n");
-
- return (0);
- }
- }
-
- DPRINTF("Acquired clock: %d from DTS\n", clock);
-
- return (clock);
-}
-
-/**
- * Set clock driving card.
- * @param sc
- * @param clock Desired clock frequency in Hz
- */
-static void
-set_clock(struct fsl_sdhc_softc *sc, uint32_t clock)
-{
- uint32_t base_clock;
- uint32_t divisor, prescaler = 1;
- uint32_t round = 0;
-
- if (clock == sc->slot.clock)
- return;
-
- if (clock == 0) {
- clear_bit(sc, SDHC_SYSCTL, MASK_CLOCK_CONTROL | SYSCTL_PEREN |
- SYSCTL_HCKEN | SYSCTL_IPGEN);
- return;
- }
-
- base_clock = sc->platform_clock;
- round = base_clock & 0x2;
- base_clock >>= 2;
- base_clock += round;
- round = 0;
-
- /* SD specification 1.1 doesn't allow frequences above 50 MHz */
- if (clock > FSL_SDHC_MAX_CLOCK)
- clock = FSL_SDHC_MAX_CLOCK;
-
- /*
- * divisor = ceil(base_clock / clock)
- * TODO: Reconsider symmetric rounding here instead of ceiling.
- */
- divisor = howmany(base_clock, clock);
-
- while (divisor > 16) {
- round = divisor & 0x1;
- divisor >>= 1;
-
- prescaler <<= 1;
- }
- divisor += round - 1;
-
- /* Turn off the clock. */
- clear_bit(sc, SDHC_SYSCTL, MASK_CLOCK_CONTROL);
-
- /* Write clock settings. */
- set_bit(sc, SDHC_SYSCTL, (prescaler << SHIFT_SDCLKFS) |
- (divisor << SHIFT_DVS));
-
- /*
- * Turn on clocks.
- * TODO: This actually disables clock automatic gating off feature of
- * the controller which eventually should be enabled but as for now
- * it prevents controller from generating card insertion/removal
- * interrupts correctly.
- */
- set_bit(sc, SDHC_SYSCTL, SYSCTL_PEREN | SYSCTL_HCKEN | SYSCTL_IPGEN);
-
- sc->slot.clock = clock;
-
- DPRINTF("given clock = %d, computed clock = %d\n", clock,
- (base_clock / prescaler) / (divisor + 1));
-}
-
-static inline void
-send_80_clock_ticks(struct fsl_sdhc_softc *sc)
-{
- int err;
-
- err = wait_for_free_line(sc, SDHC_CMD_LINE | SDHC_DAT_LINE);
- if (err != 0) {
- device_printf(sc->self, "Can't acquire data/cmd lines\n");
- return;
- }
-
- set_bit(sc, SDHC_SYSCTL, SYSCTL_INITA);
- err = wait_for_bit_clear(sc, SDHC_SYSCTL, SYSCTL_INITA);
- if (err != 0) {
- device_printf(sc->self, "Can't send 80 clocks to the card.\n");
- }
-}
-
-static void
-set_bus_width(struct fsl_sdhc_softc *sc, enum mmc_bus_width width)
-{
-
- DPRINTF("setting bus width to %d\n", width);
- switch (width) {
- case bus_width_1:
- set_bit(sc, SDHC_PROCTL, DTW_1);
- break;
- case bus_width_4:
- set_bit(sc, SDHC_PROCTL, DTW_4);
- break;
- case bus_width_8:
- set_bit(sc, SDHC_PROCTL, DTW_8);
- break;
- default:
- device_printf(sc->self, "Unsupported bus width\n");
- }
-}
-
-static void
-reset_controller_all(struct fsl_sdhc_softc *sc)
-{
- uint32_t count = 5;
-
- set_bit(sc, SDHC_SYSCTL, SYSCTL_RSTA);
- while (read4(sc, SDHC_SYSCTL) & SYSCTL_RSTA) {
- DELAY(FSL_SDHC_RESET_DELAY);
- --count;
- if (count == 0) {
- device_printf(sc->self,
- "Can't reset the controller\n");
- return;
- }
- }
-}
-
-static void
-reset_controller_dat_cmd(struct fsl_sdhc_softc *sc)
-{
- int err;
-
- set_bit(sc, SDHC_SYSCTL, SYSCTL_RSTD | SYSCTL_RSTC);
- err = wait_for_bit_clear(sc, SDHC_SYSCTL, SYSCTL_RSTD | SYSCTL_RSTC);
- if (err != 0) {
- device_printf(sc->self, "Can't reset data & command part!\n");
- return;
- }
-}
-
-static void
-init_controller(struct fsl_sdhc_softc *sc)
-{
-
- /* Enable interrupts. */
-#ifdef FSL_SDHC_NO_DMA
- write4(sc, SDHC_IRQSTATEN, MASK_IRQ_ALL & ~IRQ_DINT & ~IRQ_DMAE);
- write4(sc, SDHC_IRQSIGEN, MASK_IRQ_ALL & ~IRQ_DINT & ~IRQ_DMAE);
-#else
- write4(sc, SDHC_IRQSTATEN, MASK_IRQ_ALL & ~IRQ_BRR & ~IRQ_BWR);
- write4(sc, SDHC_IRQSIGEN, MASK_IRQ_ALL & ~IRQ_BRR & ~IRQ_BWR);
-
- /* Write DMA address */
- write4(sc, SDHC_DSADDR, sc->dma_phys);
-
- /* Enable snooping and fix for AHB2MAG bypass. */
- write4(sc, SDHC_DCR, DCR_SNOOP | DCR_AHB2MAG_BYPASS);
-#endif
- /* Set data timeout. */
- set_bit(sc, SDHC_SYSCTL, 0xe << SHIFT_DTOCV);
-
- /* Set water-mark levels (FIFO buffer size). */
- write4(sc, SDHC_WML, (FSL_SDHC_FIFO_BUF_WORDS << 16) |
- FSL_SDHC_FIFO_BUF_WORDS);
-}
-
-static void
-init_mmc_host_struct(struct fsl_sdhc_softc *sc)
-{
- struct mmc_host *host = &sc->mmc_host;
-
- /* Clear host structure. */
- bzero(host, sizeof(struct mmc_host));
-
- /* Calculate minimum and maximum operating frequencies. */
- host->f_min = sc->platform_clock / FSL_SDHC_MAX_DIV;
- host->f_max = FSL_SDHC_MAX_CLOCK;
-
- /* Set operation conditions (voltage). */
- host->host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340;
-
- /* Set additional host controller capabilities. */
- host->caps = MMC_CAP_4_BIT_DATA;
-
- /* Set mode. */
- host->mode = mode_sd;
-}
-
-static void
-card_detect_task(void *arg, int pending)
-{
- struct fsl_sdhc_softc *sc = (struct fsl_sdhc_softc *)arg;
- int err;
- int insert;
-
- insert = read4(sc, SDHC_PRSSTAT) & PRSSTAT_CINS;
-
- mtx_lock(&sc->mtx);
-
- if (insert) {
- if (sc->child != NULL) {
- mtx_unlock(&sc->mtx);
- return;
- }
-
- sc->child = device_add_child(sc->self, "mmc", -1);
- if (sc->child == NULL) {
- device_printf(sc->self, "Couldn't add MMC bus!\n");
- mtx_unlock(&sc->mtx);
- return;
- }
-
- /* Initialize MMC bus host structure. */
- init_mmc_host_struct(sc);
- device_set_ivars(sc->child, &sc->mmc_host);
-
- } else {
- if (sc->child == NULL) {
- mtx_unlock(&sc->mtx);
- return;
- }
- }
-
- mtx_unlock(&sc->mtx);
-
- if (insert) {
- if ((err = device_probe_and_attach(sc->child)) != 0) {
- device_printf(sc->self, "MMC bus failed on probe "
- "and attach! error %d\n", err);
- device_delete_child(sc->self, sc->child);
- sc->child = NULL;
- }
- } else {
- if (device_delete_child(sc->self, sc->child) != 0)
- device_printf(sc->self, "Could not delete MMC bus!\n");
- sc->child = NULL;
- }
-}
-
-static void
-card_detect_delay(void *arg)
-{
- struct fsl_sdhc_softc *sc = arg;
-
- taskqueue_enqueue(taskqueue_swi_giant, &sc->card_detect_task);
-}
-
-static void
-finalize_request(struct fsl_sdhc_softc *sc)
-{
-
- DPRINTF("finishing request %p\n", sc->request);
-
- sc->request->done(sc->request);
- sc->request = NULL;
-}
-
-/**
- * Read response from card.
- * @todo Implement Auto-CMD responses being held in R3 for multi-block xfers.
- * @param sc
- */
-static void
-get_response(struct fsl_sdhc_softc *sc)
-{
- struct mmc_command *cmd = sc->request->cmd;
- int i;
- uint32_t val;
- uint8_t ext = 0;
-
- if (cmd->flags & MMC_RSP_136) {
- /* CRC is stripped, need to shift one byte left. */
- for (i = 0; i < 4; i++) {
- val = read4(sc, SDHC_CMDRSP0 + i * 4);
- cmd->resp[3 - i] = (val << 8) + ext;
- ext = val >> 24;
- }
- } else {
- cmd->resp[0] = read4(sc, SDHC_CMDRSP0);
- }
-}
-
-#ifdef FSL_SDHC_NO_DMA
-/**
- * Read all content of a fifo buffer.
- * @warning Assumes data buffer is 32-bit aligned.
- * @param sc
- */
-static void
-read_block_pio(struct fsl_sdhc_softc *sc)
-{
- struct mmc_data *data = sc->request->cmd->data;
- size_t left = min(FSL_SDHC_FIFO_BUF_SIZE, data->len);
- uint8_t *buf = data->data;
- uint32_t word;
-
- buf += sc->data_offset;
- bus_space_read_multi_4(sc->bst, sc->bsh, SDHC_DATPORT, (uint32_t *)buf,
- left >> 2);
-
- sc->data_offset += left;
-
- /* Handle 32-bit unaligned size case. */
- left &= 0x3;
- if (left > 0) {
- buf = (uint8_t *)data->data + (sc->data_offset & ~0x3);
- word = read4(sc, SDHC_DATPORT);
- while (left > 0) {
- *(buf++) = word;
- word >>= 8;
- --left;
- }
- }
-}
-
-/**
- * Write a fifo buffer.
- * @warning Assumes data buffer size is 32-bit aligned.
- * @param sc
- */
-static void
-write_block_pio(struct fsl_sdhc_softc *sc)
-{
- struct mmc_data *data = sc->request->cmd->data;
- size_t left = min(FSL_SDHC_FIFO_BUF_SIZE, data->len);
- uint8_t *buf = data->data;
- uint32_t word = 0;
-
- DPRINTF("sc->data_offset %d\n", sc->data_offset);
-
- buf += sc->data_offset;
- bus_space_write_multi_4(sc->bst, sc->bsh, SDHC_DATPORT, (uint32_t *)buf,
- left >> 2);
-
- sc->data_offset += left;
-
- /* Handle 32-bit unaligned size case. */
- left &= 0x3;
- if (left > 0) {
- buf = (uint8_t *)data->data + (sc->data_offset & ~0x3);
- while (left > 0) {
- word += *(buf++);
- word <<= 8;
- --left;
- }
- write4(sc, SDHC_DATPORT, word);
- }
-}
-
-static void
-pio_read_transfer(struct fsl_sdhc_softc *sc)
-{
-
- while (read4(sc, SDHC_PRSSTAT) & PRSSTAT_BREN) {
- read_block_pio(sc);
-
- /*
- * TODO: should we check here whether data_offset >= data->len?
- */
- }
-}
-
-static void
-pio_write_transfer(struct fsl_sdhc_softc *sc)
-{
-
- while (read4(sc, SDHC_PRSSTAT) & PRSSTAT_BWEN) {
- write_block_pio(sc);
-
- /*
- * TODO: should we check here whether data_offset >= data->len?
- */
- }
-}
-#endif /* FSL_SDHC_USE_DMA */
-
-static inline void
-handle_command_intr(struct fsl_sdhc_softc *sc, uint32_t irq_stat)
-{
- struct mmc_command *cmd = sc->request->cmd;
-
- /* Handle errors. */
- if (irq_stat & IRQ_CTOE) {
- cmd->error = MMC_ERR_TIMEOUT;
- } else if (irq_stat & IRQ_CCE) {
- cmd->error = MMC_ERR_BADCRC;
- } else if (irq_stat & (IRQ_CEBE | IRQ_CIE)) {
- cmd->error = MMC_ERR_FIFO;
- }
-
- if (cmd->error) {
- device_printf(sc->self, "Error interrupt occured\n");
- reset_controller_dat_cmd(sc);
- return;
- }
-
- if (sc->command_done)
- return;
-
- if (irq_stat & IRQ_CC) {
- sc->command_done = 1;
-
- if (cmd->flags & MMC_RSP_PRESENT)
- get_response(sc);
- }
-}
-
-static inline void
-handle_data_intr(struct fsl_sdhc_softc *sc, uint32_t irq_stat)
-{
- struct mmc_command *cmd = sc->request->cmd;
-
- /* Handle errors. */
- if (irq_stat & IRQ_DTOE) {
- cmd->error = MMC_ERR_TIMEOUT;
- } else if (irq_stat & (IRQ_DCE | IRQ_DEBE)) {
- cmd->error = MMC_ERR_BADCRC;
- } else if (irq_stat & IRQ_ERROR_DATA_MASK) {
- cmd->error = MMC_ERR_FAILED;
- }
-
- if (cmd->error) {
- device_printf(sc->self, "Error interrupt occured\n");
- sc->data_done = 1;
- reset_controller_dat_cmd(sc);
- return;
- }
-
- if (sc->data_done)
- return;
-
-#ifdef FSL_SDHC_NO_DMA
- if (irq_stat & IRQ_BRR) {
- pio_read_transfer(sc);
- }
-
- if (irq_stat & IRQ_BWR) {
- pio_write_transfer(sc);
- }
-#else
- if (irq_stat & IRQ_DINT) {
- struct mmc_data *data = sc->request->cmd->data;
-
- /* Synchronize DMA. */
- if (data->flags & MMC_DATA_READ) {
- bus_dmamap_sync(sc->dma_tag, sc->dma_map,
- BUS_DMASYNC_POSTREAD);
- memcpy(data->data, sc->dma_mem, data->len);
- } else {
- bus_dmamap_sync(sc->dma_tag, sc->dma_map,
- BUS_DMASYNC_POSTWRITE);
- }
-
- /*
- * TODO: For multiple block transfers, address of dma memory
- * in DSADDR register should be set to the beginning of the
- * segment here. Also offset to data pointer should be handled.
- */
- }
-#endif
-
- if (irq_stat & IRQ_TC)
- sc->data_done = 1;
-}
-
-static void
-interrupt_handler(void *arg)
-{
- struct fsl_sdhc_softc *sc = (struct fsl_sdhc_softc *)arg;
- uint32_t irq_stat;
-
- mtx_lock(&sc->mtx);
-
- irq_stat = read4(sc, SDHC_IRQSTAT);
-
- /* Card interrupt. */
- if (irq_stat & IRQ_CINT) {
- DPRINTF("Card interrupt recievied\n");
-
- }
-
- /* Card insertion interrupt. */
- if (irq_stat & IRQ_CINS) {
- clear_bit(sc, SDHC_IRQSIGEN, IRQ_CINS);
- clear_bit(sc, SDHC_IRQSTATEN, IRQ_CINS);
- set_bit(sc, SDHC_IRQSIGEN, IRQ_CRM);
- set_bit(sc, SDHC_IRQSTATEN, IRQ_CRM);
-
- callout_reset(&sc->card_detect_callout, hz / 2,
- card_detect_delay, sc);
- }
-
- /* Card removal interrupt. */
- if (irq_stat & IRQ_CRM) {
- clear_bit(sc, SDHC_IRQSIGEN, IRQ_CRM);
- clear_bit(sc, SDHC_IRQSTATEN, IRQ_CRM);
- set_bit(sc, SDHC_IRQSIGEN, IRQ_CINS);
- set_bit(sc, SDHC_IRQSTATEN, IRQ_CINS);
-
- callout_stop(&sc->card_detect_callout);
- taskqueue_enqueue(taskqueue_swi_giant, &sc->card_detect_task);
- }
-
- /* Handle request interrupts. */
- if (sc->request) {
- handle_command_intr(sc, irq_stat);
- handle_data_intr(sc, irq_stat);
-
- /*
- * Finalize request when transfer is done successfully
- * or was interrupted due to error.
- */
- if ((sc->data_done && sc->command_done) ||
- (sc->request->cmd->error))
- finalize_request(sc);
- }
-
- /* Clear status register. */
- write4(sc, SDHC_IRQSTAT, irq_stat);
-
- mtx_unlock(&sc->mtx);
-}
-
-#ifndef FSL_SDHC_NO_DMA
-static void
-dma_get_phys_addr(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
-
- if (error != 0)
- return;
-
- /* Get first segment's physical address. */
- *(bus_addr_t *)arg = segs->ds_addr;
-}
-
-static int
-init_dma(struct fsl_sdhc_softc *sc)
-{
- device_t self = sc->self;
- int err;
-
- err = bus_dma_tag_create(bus_get_dma_tag(self),
- FSL_SDHC_DMA_BLOCK_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
- BUS_SPACE_MAXADDR, NULL, NULL, FSL_SDHC_DMA_BLOCK_SIZE, 1,
- FSL_SDHC_DMA_BLOCK_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL,
- &sc->dma_tag);
-
- if (err) {
- device_printf(self, "Could not create DMA tag!\n");
- return (-1);
- }
-
- err = bus_dmamem_alloc(sc->dma_tag, (void **)&(sc->dma_mem),
- BUS_DMA_NOWAIT | BUS_DMA_NOCACHE, &sc->dma_map);
- if (err) {
- device_printf(self, "Could not allocate DMA memory!\n");
- goto fail1;
- }
-
- err = bus_dmamap_load(sc->dma_tag, sc->dma_map, (void *)sc->dma_mem,
- FSL_SDHC_DMA_BLOCK_SIZE, dma_get_phys_addr, &sc->dma_phys, 0);
- if (err) {
- device_printf(self, "Could not load DMA map!\n");
- goto fail2;
- }
-
- return (0);
-
-fail2:
- bus_dmamem_free(sc->dma_tag, sc->dma_mem, sc->dma_map);
-fail1:
- bus_dma_tag_destroy(sc->dma_tag);
-
- return (-1);
-}
-#endif /* FSL_SDHC_NO_DMA */
-
-static uint32_t
-set_xfertyp_register(const struct mmc_command *cmd)
-{
- uint32_t xfertyp = 0;
-
- /* Set command index. */
- xfertyp |= cmd->opcode << CMDINX_SHIFT;
-
- /* Set command type. */
- if (cmd->opcode == MMC_STOP_TRANSMISSION)
- xfertyp |= CMDTYP_ABORT;
-
- /* Set data preset select. */
- if (cmd->data) {
- xfertyp |= XFERTYP_DPSEL;
-
- /* Set transfer direction. */
- if (cmd->data->flags & MMC_DATA_READ)
- xfertyp |= XFERTYP_DTDSEL;
- }
-
- /* Set command index check. */
- if (cmd->flags & MMC_RSP_OPCODE)
- xfertyp |= XFERTYP_CICEN;
-
- /* Set command CRC check. */
- if (cmd->flags & MMC_RSP_CRC)
- xfertyp |= XFERTYP_CCCEN;
-
- /* Set response type */
- if (!(cmd->flags & MMC_RSP_PRESENT))
- xfertyp |= RSPTYP_NONE;
- else if (cmd->flags & MMC_RSP_136)
- xfertyp |= RSPTYP_136;
- else if (cmd->flags & MMC_RSP_BUSY)
- xfertyp |= RSPTYP_48_BUSY;
- else
- xfertyp |= RSPTYP_48;
-
-#ifndef FSL_SDHC_NO_DMA
- /* Enable DMA */
- xfertyp |= XFERTYP_DMAEN;
-#endif
-
- return (xfertyp);
-}
-
-static uint32_t
-set_blkattr_register(const struct mmc_data *data)
-{
-
- if (data->len <= FSL_SDHC_MAX_BLOCK_SIZE) {
- /* One block transfer. */
- return (BLKATTR_BLOCK_COUNT(1) | ((data->len) &
- BLKATTR_BLKSZE));
- }
-
- /* TODO: Write code here for multi-block transfers. */
- return (0);
-}
-
-/**
- * Initiate data transfer. Interrupt handler will finalize it.
- * @todo Implement multi-block transfers.
- * @param sc
- * @param cmd
- */
-static int
-start_data(struct fsl_sdhc_softc *sc, struct mmc_data *data)
-{
- uint32_t reg;
-
- if ((uint32_t)data->data & 0x3) {
- device_printf(sc->self, "32-bit unaligned data pointer in "
- "request\n");
- return (-1);
- }
-
- sc->data_done = 0;
-
-#ifdef FSL_SDHC_NO_DMA
- sc->data_ptr = data->data;
- sc->data_offset = 0;
-#else
- /* Write DMA address register. */
- write4(sc, SDHC_DSADDR, sc->dma_phys);
-
- /* Synchronize DMA. */
- if (data->flags & MMC_DATA_READ) {
- bus_dmamap_sync(sc->dma_tag, sc->dma_map,
- BUS_DMASYNC_PREREAD);
- } else {
- memcpy(sc->dma_mem, data->data, data->len);
- bus_dmamap_sync(sc->dma_tag, sc->dma_map,
- BUS_DMASYNC_PREWRITE);
- }
-#endif
- /* Set block size and count. */
- reg = set_blkattr_register(data);
- if (reg == 0) {
- device_printf(sc->self, "Requested unsupported multi-block "
- "transfer.\n");
- return (-1);
- }
- write4(sc, SDHC_BLKATTR, reg);
-
- return (0);
-}
-
-static int
-start_command(struct fsl_sdhc_softc *sc, struct mmc_command *cmd)
-{
- struct mmc_request *req = sc->request;
- uint32_t mask;
- uint32_t xfertyp;
- int err;
-
- DPRINTF("opcode %d, flags 0x%08x\n", cmd->opcode, cmd->flags);
- DPRINTF("PRSSTAT = 0x%08x\n", read4(sc, SDHC_PRSSTAT));
-
- sc->command_done = 0;
-
- cmd->error = MMC_ERR_NONE;
-
- /* TODO: should we check here for card presence and clock settings? */
-
- /* Always wait for free CMD line. */
- mask = SDHC_CMD_LINE;
- /* Wait for free DAT if we have data or busy signal. */
- if (cmd->data || (cmd->flags & MMC_RSP_BUSY))
- mask |= SDHC_DAT_LINE;
- /* We shouldn't wait for DAT for stop commands. */
- if (cmd == req->stop)
- mask &= ~SDHC_DAT_LINE;
- err = wait_for_free_line(sc, mask);
- if (err != 0) {
- device_printf(sc->self, "Controller never released inhibit "
- "bit(s).\n");
- reset_controller_dat_cmd(sc);
- cmd->error = MMC_ERR_FAILED;
- sc->request = NULL;
- req->done(req);
- return (-1);
- }
-
- xfertyp = set_xfertyp_register(cmd);
-
- if (cmd->data != NULL) {
- err = start_data(sc, cmd->data);
- if (err != 0) {
- device_printf(sc->self,
- "Data transfer request failed\n");
- reset_controller_dat_cmd(sc);
- cmd->error = MMC_ERR_FAILED;
- sc->request = NULL;
- req->done(req);
- return (-1);
- }
- }
-
- write4(sc, SDHC_CMDARG, cmd->arg);
- write4(sc, SDHC_XFERTYP, xfertyp);
-
- DPRINTF("XFERTYP = 0x%08x\n", xfertyp);
- DPRINTF("CMDARG = 0x%08x\n", cmd->arg);
-
- return (0);
-}
-
-#ifdef DEBUG
-static void
-dump_registers(struct fsl_sdhc_softc *sc)
-{
- printf("PRSSTAT = 0x%08x\n", read4(sc, SDHC_PRSSTAT));
- printf("PROCTL = 0x%08x\n", read4(sc, SDHC_PROCTL));
- printf("HOSTCAPBLT = 0x%08x\n", read4(sc, SDHC_HOSTCAPBLT));
- printf("IRQSTAT = 0x%08x\n", read4(sc, SDHC_IRQSTAT));
- printf("IRQSTATEN = 0x%08x\n", read4(sc, SDHC_IRQSTATEN));
- printf("IRQSIGEN = 0x%08x\n", read4(sc, SDHC_IRQSIGEN));
- printf("WML = 0x%08x\n", read4(sc, SDHC_WML));
- printf("DSADDR = 0x%08x\n", read4(sc, SDHC_DSADDR));
- printf("XFERTYP = 0x%08x\n", read4(sc, SDHC_XFERTYP));
- printf("DCR = 0x%08x\n", read4(sc, SDHC_DCR));
-}
-#endif
-
-/*****************************************************************************
- * Public methods
- *****************************************************************************/
-/*
- * Device interface methods.
- */
-static int
-fsl_sdhc_probe(device_t self)
-{
- static const char *desc =
- "Freescale Enhanced Secure Digital Host Controller";
-
- if (!ofw_bus_is_compatible(self, "fsl,p2020-esdhc") &&
- !ofw_bus_is_compatible(self, "fsl,esdhc"))
- return (ENXIO);
-
- device_set_desc(self, desc);
-
- return (BUS_PROBE_VENDOR);
-}
-
-static int
-fsl_sdhc_attach(device_t self)
-{
- struct fsl_sdhc_softc *sc;
-
- sc = device_get_softc(self);
-
- sc->self = self;
-
- mtx_init(&sc->mtx, device_get_nameunit(self), NULL, MTX_DEF);
-
- /* Setup memory resource */
- sc->mem_rid = 0;
- sc->mem_resource = bus_alloc_resource_any(self, SYS_RES_MEMORY,
- &sc->mem_rid, RF_ACTIVE);
- if (sc->mem_resource == NULL) {
- device_printf(self, "Could not allocate memory.\n");
- goto fail;
- }
- sc->bst = rman_get_bustag(sc->mem_resource);
- sc->bsh = rman_get_bushandle(sc->mem_resource);
-
- /* Setup interrupt resource. */
- sc->irq_rid = 0;
- sc->irq_resource = bus_alloc_resource_any(self, SYS_RES_IRQ,
- &sc->irq_rid, RF_ACTIVE);
- if (sc->irq_resource == NULL) {
- device_printf(self, "Could not allocate interrupt.\n");
- goto fail;
- }
- if (bus_setup_intr(self, sc->irq_resource, INTR_TYPE_MISC |
- INTR_MPSAFE, NULL, interrupt_handler, sc, &sc->ihl) != 0) {
- device_printf(self, "Could not setup interrupt.\n");
- goto fail;
- }
-
- /* Setup DMA. */
-#ifndef FSL_SDHC_NO_DMA
- if (init_dma(sc) != 0) {
- device_printf(self, "Could not setup DMA\n");
- }
-#endif
- sc->bus_busy = 0;
- sc->platform_clock = get_platform_clock(sc);
- if (sc->platform_clock == 0) {
- device_printf(self, "Could not get platform clock.\n");
- goto fail;
- }
- sc->command_done = 1;
- sc->data_done = 1;
-
- /* Init card detection task. */
- TASK_INIT(&sc->card_detect_task, 0, card_detect_task, sc);
- callout_init(&sc->card_detect_callout, 1);
-
- reset_controller_all(sc);
- init_controller(sc);
- set_clock(sc, 400000);
- send_80_clock_ticks(sc);
-
-#ifdef DEBUG
- dump_registers(sc);
-#endif
-
- return (0);
-
-fail:
- fsl_sdhc_detach(self);
- return (ENXIO);
-}
-
-static int
-fsl_sdhc_detach(device_t self)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
- int err;
-
- if (sc->child)
- device_delete_child(self, sc->child);
-
- taskqueue_drain(taskqueue_swi_giant, &sc->card_detect_task);
-
-#ifndef FSL_SDHC_NO_DMA
- bus_dmamap_unload(sc->dma_tag, sc->dma_map);
- bus_dmamem_free(sc->dma_tag, sc->dma_mem, sc->dma_map);
- bus_dma_tag_destroy(sc->dma_tag);
-#endif
-
- if (sc->ihl != NULL) {
- err = bus_teardown_intr(self, sc->irq_resource, sc->ihl);
- if (err)
- return (err);
- }
- if (sc->irq_resource != NULL) {
- err = bus_release_resource(self, SYS_RES_IRQ, sc->irq_rid,
- sc->irq_resource);
- if (err)
- return (err);
-
- }
- if (sc->mem_resource != NULL) {
- err = bus_release_resource(self, SYS_RES_MEMORY, sc->mem_rid,
- sc->mem_resource);
- if (err)
- return (err);
- }
-
- mtx_destroy(&sc->mtx);
-
- return (0);
-}
-
-
-/*
- * Bus interface methods.
- */
-static int
-fsl_sdhc_read_ivar(device_t self, device_t child, int index,
- uintptr_t *result)
-{
- struct mmc_host *host = device_get_ivars(child);
-
- switch (index) {
- case MMCBR_IVAR_BUS_MODE:
- *(int *)result = host->ios.bus_mode;
- break;
- case MMCBR_IVAR_BUS_WIDTH:
- *(int *)result = host->ios.bus_width;
- break;
- case MMCBR_IVAR_CHIP_SELECT:
- *(int *)result = host->ios.chip_select;
- break;
- case MMCBR_IVAR_CLOCK:
- *(int *)result = host->ios.clock;
- break;
- case MMCBR_IVAR_F_MIN:
- *(int *)result = host->f_min;
- break;
- case MMCBR_IVAR_F_MAX:
- *(int *)result = host->f_max;
- break;
- case MMCBR_IVAR_HOST_OCR:
- *(int *)result = host->host_ocr;
- break;
- case MMCBR_IVAR_MODE:
- *(int *)result = host->mode;
- break;
- case MMCBR_IVAR_OCR:
- *(int *)result = host->ocr;
- break;
- case MMCBR_IVAR_POWER_MODE:
- *(int *)result = host->ios.power_mode;
- break;
- case MMCBR_IVAR_VDD:
- *(int *)result = host->ios.vdd;
- break;
- default:
- return (EINVAL);
- }
-
- return (0);
-}
-
-static int
-fsl_sdhc_write_ivar(device_t self, device_t child, int index,
- uintptr_t value)
-{
- struct mmc_host *host = device_get_ivars(child);
-
- switch (index) {
- case MMCBR_IVAR_BUS_MODE:
- host->ios.bus_mode = value;
- break;
- case MMCBR_IVAR_BUS_WIDTH:
- host->ios.bus_width = value;
- break;
- case MMCBR_IVAR_CHIP_SELECT:
- host->ios.chip_select = value;
- break;
- case MMCBR_IVAR_CLOCK:
- host->ios.clock = value;
- break;
- case MMCBR_IVAR_MODE:
- host->mode = value;
- break;
- case MMCBR_IVAR_OCR:
- host->ocr = value;
- break;
- case MMCBR_IVAR_POWER_MODE:
- host->ios.power_mode = value;
- break;
- case MMCBR_IVAR_VDD:
- host->ios.vdd = value;
- break;
- case MMCBR_IVAR_HOST_OCR:
- case MMCBR_IVAR_F_MIN:
- case MMCBR_IVAR_F_MAX:
- default:
- /* Instance variable not writable. */
- return (EINVAL);
- }
-
- return (0);
-}
-
-
-/*
- * MMC bridge methods.
- */
-static int
-fsl_sdhc_update_ios(device_t self, device_t reqdev)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
- struct mmc_host *host = device_get_ivars(reqdev);
- struct mmc_ios *ios = &host->ios;
-
- mtx_lock(&sc->mtx);
-
- /* Full reset on bus power down to clear from any state. */
- if (ios->power_mode == power_off) {
- reset_controller_all(sc);
- init_controller(sc);
- }
-
- set_clock(sc, ios->clock);
- set_bus_width(sc, ios->bus_width);
-
- mtx_unlock(&sc->mtx);
-
- return (0);
-}
-
-static int
-fsl_sdhc_request(device_t self, device_t reqdev, struct mmc_request *req)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
- int err;
-
- mtx_lock(&sc->mtx);
-
- sc->request = req;
- err = start_command(sc, req->cmd);
-
- mtx_unlock(&sc->mtx);
-
- return (err);
-}
-
-static int
-fsl_sdhc_get_ro(device_t self, device_t reqdev)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
-
- /* Wouldn't it be faster using branching (if {}) ?? */
- return (((read4(sc, SDHC_PRSSTAT) & PRSSTAT_WPSPL) >> 19) ^ 0x1);
-}
-
-static int
-fsl_sdhc_acquire_host(device_t self, device_t reqdev)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
- int retval = 0;
-
- mtx_lock(&sc->mtx);
-
- while (sc->bus_busy)
- retval = mtx_sleep(sc, &sc->mtx, PZERO, "sdhcah", 0);
- ++(sc->bus_busy);
-
- mtx_unlock(&sc->mtx);
-
- return (retval);
-}
-
-static int
-fsl_sdhc_release_host(device_t self, device_t reqdev)
-{
- struct fsl_sdhc_softc *sc = device_get_softc(self);
-
- mtx_lock(&sc->mtx);
- --(sc->bus_busy);
- mtx_unlock(&sc->mtx);
- wakeup(sc);
-
- return (0);
-}
diff --git a/sys/powerpc/mpc85xx/fsl_sdhc.h b/sys/powerpc/mpc85xx/fsl_sdhc.h
deleted file mode 100644
index 9bd2e3d3..0000000
--- a/sys/powerpc/mpc85xx/fsl_sdhc.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*-
- * Copyright (c) 2011-2012 Semihalf
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef FSL_SDHC_H_
-#define FSL_SDHC_H_
-
-#include <sys/cdefs.h>
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/rman.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-#include <sys/taskqueue.h>
-
-#include <machine/bus.h>
-
-#include <dev/mmc/bridge.h>
-#include <dev/mmc/mmcreg.h>
-#include <dev/mmc/mmcvar.h>
-#include <dev/mmc/mmcbrvar.h>
-
-#include "mmcbr_if.h"
-
-
-/*****************************************************************************
- * Private defines
- *****************************************************************************/
-struct slot {
- uint32_t clock;
-};
-
-struct fsl_sdhc_softc {
- device_t self;
- device_t child;
-
- bus_space_handle_t bsh;
- bus_space_tag_t bst;
-
- struct resource *mem_resource;
- int mem_rid;
- struct resource *irq_resource;
- int irq_rid;
- void *ihl;
-
- bus_dma_tag_t dma_tag;
- bus_dmamap_t dma_map;
- uint32_t* dma_mem;
- bus_addr_t dma_phys;
-
- struct mtx mtx;
-
- struct task card_detect_task;
- struct callout card_detect_callout;
-
- struct mmc_host mmc_host;
-
- struct slot slot;
- uint32_t bus_busy;
- uint32_t platform_clock;
-
- struct mmc_request *request;
- int data_done;
- int command_done;
- int use_dma;
- uint32_t* data_ptr;
- uint32_t data_offset;
-};
-
-#define FSL_SDHC_RESET_DELAY 50
-
-#define FSL_SDHC_BASE_CLOCK_DIV (2)
-#define FSL_SDHC_MAX_DIV (FSL_SDHC_BASE_CLOCK_DIV * 256 * 16)
-#define FSL_SDHC_MIN_DIV (FSL_SDHC_BASE_CLOCK_DIV * 2)
-#define FSL_SDHC_MAX_CLOCK (50000000)
-
-#define FSL_SDHC_MAX_BLOCK_COUNT (65535)
-#define FSL_SDHC_MAX_BLOCK_SIZE (4096)
-
-#define FSL_SDHC_FIFO_BUF_SIZE (64) /* Water-mark level. */
-#define FSL_SDHC_FIFO_BUF_WORDS (FSL_SDHC_FIFO_BUF_SIZE / 4)
-
-#define FSL_SDHC_DMA_SEGMENT_SIZE (1024)
-#define FSL_SDHC_DMA_ALIGNMENT (4)
-#define FSL_SDHC_DMA_BLOCK_SIZE FSL_SDHC_MAX_BLOCK_SIZE
-
-
-/*
- * Offsets of SD HC registers
- */
-enum sdhc_reg_off {
- SDHC_DSADDR = 0x000,
- SDHC_BLKATTR = 0x004,
- SDHC_CMDARG = 0x008,
- SDHC_XFERTYP = 0x00c,
- SDHC_CMDRSP0 = 0x010,
- SDHC_CMDRSP1 = 0x014,
- SDHC_CMDRSP2 = 0x018,
- SDHC_CMDRSP3 = 0x01c,
- SDHC_DATPORT = 0x020,
- SDHC_PRSSTAT = 0x024,
- SDHC_PROCTL = 0x028,
- SDHC_SYSCTL = 0x02c,
- SDHC_IRQSTAT = 0x030,
- SDHC_IRQSTATEN = 0x034,
- SDHC_IRQSIGEN = 0x038,
- SDHC_AUTOC12ERR = 0x03c,
- SDHC_HOSTCAPBLT = 0x040,
- SDHC_WML = 0x044,
- SDHC_FEVT = 0x050,
- SDHC_HOSTVER = 0x0fc,
- SDHC_DCR = 0x40c
-};
-
-enum sysctl_bit {
- SYSCTL_INITA = 0x08000000,
- SYSCTL_RSTD = 0x04000000,
- SYSCTL_RSTC = 0x02000000,
- SYSCTL_RSTA = 0x01000000,
- SYSCTL_DTOCV = 0x000f0000,
- SYSCTL_SDCLKFS = 0x0000ff00,
- SYSCTL_DVS = 0x000000f0,
- SYSCTL_PEREN = 0x00000004,
- SYSCTL_HCKEN = 0x00000002,
- SYSCTL_IPGEN = 0x00000001
-};
-
-#define HEX_LEFT_SHIFT(x) (4 * x)
-enum sysctl_shift {
- SHIFT_DTOCV = HEX_LEFT_SHIFT(4),
- SHIFT_SDCLKFS = HEX_LEFT_SHIFT(2),
- SHIFT_DVS = HEX_LEFT_SHIFT(1)
-};
-
-enum proctl_bit {
- PROCTL_WECRM = 0x04000000,
- PROCTL_WECINS = 0x02000000,
- PROCTL_WECINT = 0x01000000,
- PROCTL_RWCTL = 0x00040000,
- PROCTL_CREQ = 0x00020000,
- PROCTL_SABGREQ = 0x00010000,
- PROCTL_CDSS = 0x00000080,
- PROCTL_CDTL = 0x00000040,
- PROCTL_EMODE = 0x00000030,
- PROCTL_D3CD = 0x00000008,
- PROCTL_DTW = 0x00000006
-};
-
-enum dtw {
- DTW_1 = 0x00000000,
- DTW_4 = 0x00000002,
- DTW_8 = 0x00000004
-};
-
-enum prsstat_bit {
- PRSSTAT_DLSL = 0xff000000,
- PRSSTAT_CLSL = 0x00800000,
- PRSSTAT_WPSPL = 0x00080000,
- PRSSTAT_CDPL = 0x00040000,
- PRSSTAT_CINS = 0x00010000,
- PRSSTAT_BREN = 0x00000800,
- PRSSTAT_BWEN = 0x00000400,
- PRSSTAT_RTA = 0x00000200,
- PRSSTAT_WTA = 0x00000100,
- PRSSTAT_SDOFF = 0x00000080,
- PRSSTAT_PEROFF = 0x00000040,
- PRSSTAT_HCKOFF = 0x00000020,
- PRSSTAT_IPGOFF = 0x00000010,
- PRSSTAT_DLA = 0x00000004,
- PRSSTAT_CDIHB = 0x00000002,
- PRSSTAT_CIHB = 0x00000001
-
-};
-
-enum irq_bits {
- IRQ_DMAE = 0x10000000,
- IRQ_AC12E = 0x01000000,
- IRQ_DEBE = 0x00400000,
- IRQ_DCE = 0x00200000,
- IRQ_DTOE = 0x00100000,
- IRQ_CIE = 0x00080000,
- IRQ_CEBE = 0x00040000,
- IRQ_CCE = 0x00020000,
- IRQ_CTOE = 0x00010000,
- IRQ_CINT = 0x00000100,
- IRQ_CRM = 0x00000080,
- IRQ_CINS = 0x00000040,
- IRQ_BRR = 0x00000020,
- IRQ_BWR = 0x00000010,
- IRQ_DINT = 0x00000008,
- IRQ_BGE = 0x00000004,
- IRQ_TC = 0x00000002,
- IRQ_CC = 0x00000001
-};
-
-enum irq_masks {
- IRQ_ERROR_DATA_MASK = IRQ_DMAE | IRQ_DEBE | IRQ_DCE | IRQ_DTOE,
- IRQ_ERROR_CMD_MASK = IRQ_AC12E | IRQ_CIE | IRQ_CTOE | IRQ_CCE |
- IRQ_CEBE
-};
-
-enum dcr_bits {
- DCR_PRI = 0x0000c000,
- DCR_SNOOP = 0x00000040,
- DCR_AHB2MAG_BYPASS = 0x00000020,
- DCR_RD_SAFE = 0x00000004,
- DCR_RD_PFE = 0x00000002,
- DCR_RD_PF_SIZE = 0x00000001
-};
-
-#define DCR_PRI_SHIFT (14)
-
-enum xfertyp_bits {
- XFERTYP_CMDINX = 0x3f000000,
- XFERTYP_CMDTYP = 0x00c00000,
- XFERTYP_DPSEL = 0x00200000,
- XFERTYP_CICEN = 0x00100000,
- XFERTYP_CCCEN = 0x00080000,
- XFERTYP_RSPTYP = 0x00030000,
- XFERTYP_MSBSEL = 0x00000020,
- XFERTYP_DTDSEL = 0x00000010,
- XFERTYP_AC12EN = 0x00000004,
- XFERTYP_BCEN = 0x00000002,
- XFERTYP_DMAEN = 0x00000001
-};
-
-#define CMDINX_SHIFT (24)
-
-enum xfertyp_cmdtyp {
- CMDTYP_NORMAL = 0x00000000,
- CMDYTP_SUSPEND = 0x00400000,
- CMDTYP_RESUME = 0x00800000,
- CMDTYP_ABORT = 0x00c00000
-};
-
-enum xfertyp_rsptyp {
- RSPTYP_NONE = 0x00000000,
- RSPTYP_136 = 0x00010000,
- RSPTYP_48 = 0x00020000,
- RSPTYP_48_BUSY = 0x00030000
-};
-
-enum blkattr_bits {
- BLKATTR_BLKSZE = 0x00001fff,
- BLKATTR_BLKCNT = 0xffff0000
-};
-#define BLKATTR_BLOCK_COUNT(x) (x << 16)
-
-enum wml_bits {
- WR_WML = 0x00ff0000,
- RD_WML = 0x000000ff,
-};
-
-enum sdhc_bit_mask {
- MASK_CLOCK_CONTROL = 0x0000ffff,
- MASK_IRQ_ALL = IRQ_DMAE | IRQ_AC12E | IRQ_DEBE | IRQ_DCE |
- IRQ_DTOE | IRQ_CIE | IRQ_CEBE | IRQ_CCE |
- IRQ_CTOE | IRQ_CINT | IRQ_CRM | IRQ_CINS |
- IRQ_BRR | IRQ_BWR | IRQ_DINT | IRQ_BGE |
- IRQ_TC | IRQ_CC,
-};
-
-enum sdhc_line {
- SDHC_DAT_LINE = 0x2,
- SDHC_CMD_LINE = 0x1
-};
-
-#endif /* FSL_SDHC_H_ */
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 179a609..8027d33 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -349,7 +349,8 @@
* void bar(int myArray[__min_size(10)]);
*/
#if !defined(__cplusplus) && \
- (!defined(__STDC_VERSION) || (__STDC_VERSION__ >= 199901))
+ (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
+ (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
#define __min_size(x) static (x)
#else
#define __min_size(x) (x)
diff --git a/sys/sys/file.h b/sys/sys/file.h
index c30eb05..6926081 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -55,6 +55,7 @@ struct socket;
#endif /* _KERNEL */
+#define DTYPE_NONE 0 /* not yet initialized */
#define DTYPE_VNODE 1 /* file */
#define DTYPE_SOCKET 2 /* communications endpoint */
#define DTYPE_PIPE 3 /* pipe */
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index ebe8302..140732f 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1106,6 +1106,15 @@ td_get_sched(struct thread *td)
return ((struct td_sched *)&td[1]);
}
+extern void (*softdep_ast_cleanup)(struct thread *);
+static __inline void
+td_softdep_cleanup(struct thread *td)
+{
+
+ if (td->td_su != NULL && softdep_ast_cleanup != NULL)
+ softdep_ast_cleanup(td);
+}
+
#endif /* _KERNEL */
#endif /* !_SYS_PROC_H_ */
diff --git a/sys/sys/resource.h b/sys/sys/resource.h
index 91b1141..8e445e6 100644
--- a/sys/sys/resource.h
+++ b/sys/sys/resource.h
@@ -119,8 +119,8 @@ struct __wrusage {
#define RLIM_NLIMITS 15 /* number of resource limits */
#define RLIM_INFINITY ((rlim_t)(((__uint64_t)1 << 63) - 1))
-/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */
-
+#define RLIM_SAVED_MAX RLIM_INFINITY
+#define RLIM_SAVED_CUR RLIM_INFINITY
/*
* Resource limit string identifiers
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index a8a975f..cd4213c 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -235,7 +235,7 @@ typedef struct ksiginfo {
#define KSI_TRAP 0x01 /* Generated by trap. */
#define KSI_EXT 0x02 /* Externally managed ksi. */
#define KSI_INS 0x04 /* Directly insert ksi, not the copy */
-#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EGAIN. */
+#define KSI_SIGQ 0x08 /* Generated by sigqueue, might ret EAGAIN. */
#define KSI_HEAD 0x10 /* Insert into head, not tail. */
#define KSI_COPYMASK (KSI_TRAP|KSI_SIGQ)
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 2af3f7b..5069161 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -138,15 +138,24 @@ int kern_linkat(struct thread *td, int fd1, int fd2, char *path1,
char *path2, enum uio_seg segflg, int follow);
int kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
struct timeval *tptr, enum uio_seg tptrseg);
+int kern_madvise(struct thread *td, uintptr_t addr, size_t len, int behav);
int kern_mkdirat(struct thread *td, int fd, char *path,
enum uio_seg segflg, int mode);
int kern_mkfifoat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, int mode);
int kern_mknodat(struct thread *td, int fd, char *path,
enum uio_seg pathseg, int mode, int dev);
+int kern_mlock(struct proc *proc, struct ucred *cred, uintptr_t addr,
+ size_t len);
+int kern_mmap(struct thread *td, uintptr_t addr, size_t size, int prot,
+ int flags, int fd, off_t pos);
+int kern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot);
int kern_msgctl(struct thread *, int, int, struct msqid_ds *);
int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
int kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
+int kern_msync(struct thread *td, uintptr_t addr, size_t size, int flags);
+int kern_munlock(struct thread *td, uintptr_t addr, size_t size);
+int kern_munmap(struct thread *td, uintptr_t addr, size_t size);
int kern_nanosleep(struct thread *td, struct timespec *rqt,
struct timespec *rmt);
int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index c3818a3..8313fc0 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -138,7 +138,7 @@ struct sysentvec {
#define SV_AOUT 0x008000 /* a.out executable. */
#define SV_SHP 0x010000 /* Shared page. */
#define SV_CAPSICUM 0x020000 /* Force cap_enter() on startup. */
-#define SV_TIMEKEEP 0x040000
+#define SV_TIMEKEEP 0x040000 /* Shared page timehands. */
#define SV_ABI_MASK 0xff
#define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index caffd7b..88e1838 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -309,7 +309,6 @@ sbintime_t cpu_idleclock(void);
void cpu_activeclock(void);
void cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);
void cpu_et_frequency(struct eventtimer *et, uint64_t newfreq);
-extern int cpu_deepest_sleep;
extern int cpu_disable_c2_sleep;
extern int cpu_disable_c3_sleep;
@@ -445,8 +444,6 @@ void free_unr(struct unrhdr *uh, u_int item);
void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
-extern void (*softdep_ast_cleanup)(void);
-
void counted_warning(unsigned *counter, const char *msg);
#endif /* !_SYS_SYSTM_H_ */
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index f1a044f..09e0419 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -62,6 +62,7 @@ struct tty {
struct mtx *t_mtx; /* TTY lock. */
struct mtx t_mtxobj; /* Per-TTY lock (when not borrowing). */
TAILQ_ENTRY(tty) t_list; /* (l) TTY list entry. */
+ int t_drainwait; /* (t) TIOCDRAIN timeout seconds. */
unsigned int t_flags; /* (t) Terminal option flags. */
/* Keep flags in sync with db_show_tty and pstat(8). */
#define TF_NOPREFIX 0x00001 /* Don't prepend "tty" to device name. */
diff --git a/sys/sys/ttyqueue.h b/sys/sys/ttyqueue.h
index 2d1a565..c8d85d6 100644
--- a/sys/sys/ttyqueue.h
+++ b/sys/sys/ttyqueue.h
@@ -69,7 +69,7 @@ struct ttyoutq {
#ifdef _KERNEL
/* Input queue handling routines. */
-void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);
+int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);
void ttyinq_free(struct ttyinq *ti);
int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio,
size_t readlen, size_t flushlen);
@@ -136,7 +136,7 @@ void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti,
/* Output queue handling routines. */
void ttyoutq_flush(struct ttyoutq *to);
-void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);
+int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);
void ttyoutq_free(struct ttyoutq *to);
size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len);
int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio);
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 94ac101..e7214cb 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -902,7 +902,7 @@ static int pagedep_find(struct pagedep_hashhead *, ino_t, ufs_lbn_t,
static void pause_timer(void *);
static int request_cleanup(struct mount *, int);
static void schedule_cleanup(struct mount *);
-static void softdep_ast_cleanup_proc(void);
+static void softdep_ast_cleanup_proc(struct thread *);
static int process_worklist_item(struct mount *, int, int);
static void process_removes(struct vnode *);
static void process_truncates(struct vnode *);
@@ -13437,15 +13437,13 @@ schedule_cleanup(struct mount *mp)
}
static void
-softdep_ast_cleanup_proc(void)
+softdep_ast_cleanup_proc(struct thread *td)
{
- struct thread *td;
struct mount *mp;
struct ufsmount *ump;
int error;
bool req;
- td = curthread;
while ((mp = td->td_su) != NULL) {
td->td_su = NULL;
error = vfs_busy(mp, MBF_NOWAIT);
@@ -13483,6 +13481,10 @@ softdep_ast_cleanup_proc(void)
}
vfs_unbusy(mp);
}
+ if ((mp = td->td_su) != NULL) {
+ td->td_su = NULL;
+ vfs_rel(mp);
+ }
}
/*
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 90ed297..35f65e6 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bitset.h>
+#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/types.h>
#include <sys/queue.h>
@@ -3199,6 +3200,9 @@ uma_reclaim_worker(void *arg __unused)
"umarcl", 0);
if (uma_reclaim_needed) {
uma_reclaim_needed = 0;
+ sx_xunlock(&uma_drain_lock);
+ EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM);
+ sx_xlock(&uma_drain_lock);
uma_reclaim_locked(true);
}
}
diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h
index 2400018..0489b6e 100644
--- a/sys/vm/vm_extern.h
+++ b/sys/vm/vm_extern.h
@@ -114,6 +114,5 @@ struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);
void vm_imgact_unmap_page(struct sf_buf *sf);
void vm_thread_dispose(struct thread *td);
int vm_thread_new(struct thread *td, int pages);
-int vm_mlock(struct proc *, struct ucred *, const void *, size_t);
#endif /* _KERNEL */
#endif /* !_VM_EXTERN_H_ */
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 7d44af6..bd3b08f 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1372,11 +1372,12 @@ vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra,
entry = fs->entry;
- starta = addra - backward * PAGE_SIZE;
- if (starta < entry->start) {
+ if (addra < backward * PAGE_SIZE) {
starta = entry->start;
- } else if (starta > addra) {
- starta = 0;
+ } else {
+ starta = addra - backward * PAGE_SIZE;
+ if (starta < entry->start)
+ starta = entry->start;
}
/*
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index f56dbca..1b15f97 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -549,11 +549,13 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_int(oidp, &i, 0, req);
if (error)
return (error);
- if (i)
- EVENTHANDLER_INVOKE(vm_lowmem, 0);
+ if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0)
+ return (EINVAL);
+ if (i != 0)
+ EVENTHANDLER_INVOKE(vm_lowmem, i);
return (0);
}
SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
- debug_vm_lowmem, "I", "set to trigger vm_lowmem event");
+ debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags");
#endif
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index b33f064..ada71f0 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <sys/vmmeter.h>
+#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
@@ -169,26 +170,29 @@ struct mmap_args {
#endif
int
-sys_mmap(td, uap)
- struct thread *td;
- struct mmap_args *uap;
+sys_mmap(struct thread *td, struct mmap_args *uap)
{
+
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot,
+ uap->flags, uap->fd, uap->pos));
+}
+
+int
+kern_mmap(struct thread *td, uintptr_t addr0, size_t size, int prot, int flags,
+ int fd, off_t pos)
+{
+ struct vmspace *vms;
struct file *fp;
vm_offset_t addr;
- vm_size_t size, pageoff;
+ vm_size_t pageoff;
vm_prot_t cap_maxprot;
- int align, error, flags, prot;
- off_t pos;
- struct vmspace *vms = td->td_proc->p_vmspace;
+ int align, error;
cap_rights_t rights;
- addr = (vm_offset_t) uap->addr;
- size = uap->len;
- prot = uap->prot;
- flags = uap->flags;
- pos = uap->pos;
-
+ vms = td->td_proc->p_vmspace;
fp = NULL;
+ AUDIT_ARG_FD(fd);
+ addr = addr0;
/*
* Ignore old flags that used to be defined but did not do anything.
@@ -205,8 +209,8 @@ sys_mmap(td, uap)
* pos.
*/
if (!SV_CURPROC_FLAG(SV_AOUT)) {
- if ((uap->len == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
- ((flags & MAP_ANON) != 0 && (uap->fd != -1 || pos != 0)))
+ if ((size == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
+ ((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0)))
return (EINVAL);
} else {
if ((flags & MAP_ANON) != 0)
@@ -214,7 +218,7 @@ sys_mmap(td, uap)
}
if (flags & MAP_STACK) {
- if ((uap->fd != -1) ||
+ if ((fd != -1) ||
((prot & (PROT_READ | PROT_WRITE)) != (PROT_READ | PROT_WRITE)))
return (EINVAL);
flags |= MAP_ANON;
@@ -334,7 +338,7 @@ sys_mmap(td, uap)
}
if (prot & PROT_EXEC)
cap_rights_set(&rights, CAP_MMAP_X);
- error = fget_mmap(td, uap->fd, &rights, &cap_maxprot, &fp);
+ error = fget_mmap(td, fd, &rights, &cap_maxprot, &fp);
if (error != 0)
goto done;
if ((flags & (MAP_SHARED | MAP_PRIVATE)) == 0 &&
@@ -361,15 +365,9 @@ done:
int
freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap)
{
- struct mmap_args oargs;
-
- oargs.addr = uap->addr;
- oargs.len = uap->len;
- oargs.prot = uap->prot;
- oargs.flags = uap->flags;
- oargs.fd = uap->fd;
- oargs.pos = uap->pos;
- return (sys_mmap(td, &oargs));
+
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot,
+ uap->flags, uap->fd, uap->pos));
}
#endif
@@ -385,11 +383,8 @@ struct ommap_args {
};
#endif
int
-ommap(td, uap)
- struct thread *td;
- struct ommap_args *uap;
+ommap(struct thread *td, struct ommap_args *uap)
{
- struct mmap_args nargs;
static const char cvtbsdprot[8] = {
0,
PROT_EXEC,
@@ -400,36 +395,34 @@ ommap(td, uap)
PROT_WRITE | PROT_READ,
PROT_EXEC | PROT_WRITE | PROT_READ,
};
+ int flags, prot;
#define OMAP_ANON 0x0002
#define OMAP_COPY 0x0020
#define OMAP_SHARED 0x0010
#define OMAP_FIXED 0x0100
- nargs.addr = uap->addr;
- nargs.len = uap->len;
- nargs.prot = cvtbsdprot[uap->prot & 0x7];
+ prot = cvtbsdprot[uap->prot & 0x7];
#ifdef COMPAT_FREEBSD32
#if defined(__amd64__)
if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
- nargs.prot != 0)
- nargs.prot |= PROT_EXEC;
+ prot != 0)
+ prot |= PROT_EXEC;
#endif
#endif
- nargs.flags = 0;
+ flags = 0;
if (uap->flags & OMAP_ANON)
- nargs.flags |= MAP_ANON;
+ flags |= MAP_ANON;
if (uap->flags & OMAP_COPY)
- nargs.flags |= MAP_COPY;
+ flags |= MAP_COPY;
if (uap->flags & OMAP_SHARED)
- nargs.flags |= MAP_SHARED;
+ flags |= MAP_SHARED;
else
- nargs.flags |= MAP_PRIVATE;
+ flags |= MAP_PRIVATE;
if (uap->flags & OMAP_FIXED)
- nargs.flags |= MAP_FIXED;
- nargs.fd = uap->fd;
- nargs.pos = uap->pos;
- return (sys_mmap(td, &nargs));
+ flags |= MAP_FIXED;
+ return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags,
+ uap->fd, uap->pos));
}
#endif /* COMPAT_43 */
@@ -442,20 +435,21 @@ struct msync_args {
};
#endif
int
-sys_msync(td, uap)
- struct thread *td;
- struct msync_args *uap;
+sys_msync(struct thread *td, struct msync_args *uap)
+{
+
+ return (kern_msync(td, (uintptr_t)uap->addr, uap->len, uap->flags));
+}
+
+int
+kern_msync(struct thread *td, uintptr_t addr0, size_t size, int flags)
{
vm_offset_t addr;
- vm_size_t size, pageoff;
- int flags;
+ vm_size_t pageoff;
vm_map_t map;
int rv;
- addr = (vm_offset_t) uap->addr;
- size = uap->len;
- flags = uap->flags;
-
+ addr = addr0;
pageoff = (addr & PAGE_MASK);
addr -= pageoff;
size += pageoff;
@@ -494,23 +488,27 @@ struct munmap_args {
};
#endif
int
-sys_munmap(td, uap)
- struct thread *td;
- struct munmap_args *uap;
+sys_munmap(struct thread *td, struct munmap_args *uap)
+{
+
+ return (kern_munmap(td, (uintptr_t)uap->addr, uap->len));
+}
+
+int
+kern_munmap(struct thread *td, uintptr_t addr0, size_t size)
{
#ifdef HWPMC_HOOKS
struct pmckern_map_out pkm;
vm_map_entry_t entry;
#endif
vm_offset_t addr;
- vm_size_t size, pageoff;
+ vm_size_t pageoff;
vm_map_t map;
- addr = (vm_offset_t) uap->addr;
- size = uap->len;
if (size == 0)
return (EINVAL);
+ addr = addr0;
pageoff = (addr & PAGE_MASK);
addr -= pageoff;
size += pageoff;
@@ -567,18 +565,20 @@ struct mprotect_args {
};
#endif
int
-sys_mprotect(td, uap)
- struct thread *td;
- struct mprotect_args *uap;
+sys_mprotect(struct thread *td, struct mprotect_args *uap)
{
- vm_offset_t addr;
- vm_size_t size, pageoff;
- vm_prot_t prot;
- addr = (vm_offset_t) uap->addr;
- size = uap->len;
- prot = uap->prot & VM_PROT_ALL;
+ return (kern_mprotect(td, (uintptr_t)uap->addr, uap->len, uap->prot));
+}
+
+int
+kern_mprotect(struct thread *td, uintptr_t addr0, size_t size, int prot)
+{
+ vm_offset_t addr;
+ vm_size_t pageoff;
+ addr = addr0;
+ prot = (prot & VM_PROT_ALL);
pageoff = (addr & PAGE_MASK);
addr -= pageoff;
size += pageoff;
@@ -644,15 +644,22 @@ struct madvise_args {
int
sys_madvise(struct thread *td, struct madvise_args *uap)
{
- vm_offset_t start, end;
+
+ return (kern_madvise(td, (uintptr_t)uap->addr, uap->len, uap->behav));
+}
+
+int
+kern_madvise(struct thread *td, uintptr_t addr0, size_t len, int behav)
+{
vm_map_t map;
+ vm_offset_t addr, end, start;
int flags;
/*
* Check for our special case, advising the swap pager we are
* "immortal."
*/
- if (uap->behav == MADV_PROTECT) {
+ if (behav == MADV_PROTECT) {
flags = PPROT_SET;
return (kern_procctl(td, P_PID, td->td_proc->p_pid,
PROC_SPROTECT, &flags));
@@ -661,27 +668,27 @@ sys_madvise(struct thread *td, struct madvise_args *uap)
/*
* Check for illegal behavior
*/
- if (uap->behav < 0 || uap->behav > MADV_CORE)
+ if (behav < 0 || behav > MADV_CORE)
return (EINVAL);
/*
* Check for illegal addresses. Watch out for address wrap... Note
* that VM_*_ADDRESS are not constants due to casts (argh).
*/
map = &td->td_proc->p_vmspace->vm_map;
- if ((vm_offset_t)uap->addr < vm_map_min(map) ||
- (vm_offset_t)uap->addr + uap->len > vm_map_max(map))
+ addr = addr0;
+ if (addr < vm_map_min(map) || addr + len > vm_map_max(map))
return (EINVAL);
- if (((vm_offset_t) uap->addr + uap->len) < (vm_offset_t) uap->addr)
+ if ((addr + len) < addr)
return (EINVAL);
/*
* Since this routine is only advisory, we default to conservative
* behavior.
*/
- start = trunc_page((vm_offset_t) uap->addr);
- end = round_page((vm_offset_t) uap->addr + uap->len);
+ start = trunc_page(addr);
+ end = round_page(addr + len);
- if (vm_map_madvise(map, start, end, uap->behav))
+ if (vm_map_madvise(map, start, end, behav))
return (EINVAL);
return (0);
}
@@ -952,11 +959,12 @@ int
sys_mlock(struct thread *td, struct mlock_args *uap)
{
- return (vm_mlock(td->td_proc, td->td_ucred, uap->addr, uap->len));
+ return (kern_mlock(td->td_proc, td->td_ucred,
+ __DECONST(uintptr_t, uap->addr), uap->len));
}
int
-vm_mlock(struct proc *proc, struct ucred *cred, const void *addr0, size_t len)
+kern_mlock(struct proc *proc, struct ucred *cred, uintptr_t addr0, size_t len)
{
vm_offset_t addr, end, last, start;
vm_size_t npages, size;
@@ -967,7 +975,7 @@ vm_mlock(struct proc *proc, struct ucred *cred, const void *addr0, size_t len)
error = priv_check_cred(cred, PRIV_VM_MLOCK, 0);
if (error)
return (error);
- addr = (vm_offset_t)addr0;
+ addr = addr0;
size = len;
last = addr + size;
start = trunc_page(addr);
@@ -1124,12 +1132,16 @@ struct munlock_args {
};
#endif
int
-sys_munlock(td, uap)
- struct thread *td;
- struct munlock_args *uap;
+sys_munlock(struct thread *td, struct munlock_args *uap)
+{
+
+ return (kern_munlock(td, (uintptr_t)uap->addr, uap->len));
+}
+
+int
+kern_munlock(struct thread *td, uintptr_t addr0, size_t size)
{
vm_offset_t addr, end, last, start;
- vm_size_t size;
#ifdef RACCT
vm_map_t map;
#endif
@@ -1138,8 +1150,7 @@ sys_munlock(td, uap)
error = priv_check(td, PRIV_VM_MUNLOCK);
if (error)
return (error);
- addr = (vm_offset_t)uap->addr;
- size = uap->len;
+ addr = addr0;
last = addr + size;
start = trunc_page(addr);
end = round_page(last);
@@ -1184,6 +1195,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
locktype = LK_SHARED;
if ((error = vget(vp, locktype, td)) != 0)
return (error);
+ AUDIT_ARG_VNODE1(vp);
foff = *foffp;
flags = *flagsp;
obj = vp->v_object;
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index ed9d439..cd8fe45 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -871,7 +871,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
* Decrease registered cache sizes.
*/
SDT_PROBE0(vm, , , vm__lowmem_scan);
- EVENTHANDLER_INVOKE(vm_lowmem, 0);
+ EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES);
/*
* We do this explicitly after the caches have been
* drained above.
@@ -1806,12 +1806,14 @@ again:
if (size >= limit) {
vm_pageout_map_deactivate_pages(
&vm->vm_map, limit);
+ size = vmspace_resident_count(vm);
}
#ifdef RACCT
if (racct_enable) {
rsize = IDX_TO_OFF(size);
PROC_LOCK(p);
- racct_set(p, RACCT_RSS, rsize);
+ if (p->p_state == PRS_NORMAL)
+ racct_set(p, RACCT_RSS, rsize);
ravailable = racct_get_available(p, RACCT_RSS);
PROC_UNLOCK(p);
if (rsize > ravailable) {
@@ -1837,7 +1839,8 @@ again:
size = vmspace_resident_count(vm);
rsize = IDX_TO_OFF(size);
PROC_LOCK(p);
- racct_set(p, RACCT_RSS, rsize);
+ if (p->p_state == PRS_NORMAL)
+ racct_set(p, RACCT_RSS, rsize);
PROC_UNLOCK(p);
if (rsize > ravailable)
tryagain = 1;
diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h
index c677197..b44ca2f 100644
--- a/sys/vm/vm_pageout.h
+++ b/sys/vm/vm_pageout.h
@@ -87,6 +87,12 @@ extern bool vm_pages_needed;
#define VM_OOM_SWAPZ 2
/*
+ * vm_lowmem flags.
+ */
+#define VM_LOW_KMEM 0x01
+#define VM_LOW_PAGES 0x02
+
+/*
* Exported routines.
*/
diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c
index d551b02..4a10ac7 100644
--- a/sys/x86/acpica/acpi_wakeup.c
+++ b/sys/x86/acpica/acpi_wakeup.c
@@ -35,9 +35,6 @@ __FBSDID("$FreeBSD$");
#else
#include "opt_apic.h"
#endif
-#ifdef __i386__
-#include "opt_npx.h"
-#endif
#include <sys/param.h>
#include <sys/bus.h>
@@ -213,7 +210,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
if (savectx(pcb)) {
#ifdef __amd64__
fpususpend(susppcbs[0]->sp_fpususpend);
-#elif defined(DEV_NPX)
+#else
npxsuspend(susppcbs[0]->sp_fpususpend);
#endif
#ifdef SMP
@@ -250,7 +247,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
} else {
#ifdef __amd64__
fpuresume(susppcbs[0]->sp_fpususpend);
-#elif defined(DEV_NPX)
+#else
npxresume(susppcbs[0]->sp_fpususpend);
#endif
}
diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c
index 4e75402..c2d42a9 100644
--- a/sys/x86/x86/cpu_machdep.c
+++ b/sys/x86/x86/cpu_machdep.c
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
#include "opt_perfmon.h"
#include "opt_platform.h"
#ifdef __i386__
-#include "opt_npx.h"
#include "opt_apic.h"
#include "opt_xbox.h"
#endif
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index d4cc223..86bdc0a 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -67,10 +67,6 @@ __FBSDID("$FreeBSD$");
#include <x86/vmware.h>
#ifdef __i386__
-#if !defined(CPU_DISABLE_SSE) && defined(I686_CPU)
-#define CPU_ENABLE_SSE
-#endif
-
#define IDENTBLUE_CYRIX486 0
#define IDENTBLUE_IBMCPU 1
#define IDENTBLUE_CYRIXM2 2
@@ -105,10 +101,8 @@ u_int cpu_procinfo; /* HyperThreading Info / Brand Index / CLFUSH */
u_int cpu_procinfo2; /* Multicore info */
char cpu_vendor[20]; /* CPU Origin code */
u_int cpu_vendor_id; /* CPU vendor ID */
-#if defined(__amd64__) || defined(CPU_ENABLE_SSE)
u_int cpu_fxsr; /* SSE enabled */
u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */
-#endif
u_int cpu_clflush_line_size = 32;
u_int cpu_stdext_feature;
u_int cpu_stdext_feature2;
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 1b1547d..097712d 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -398,7 +398,7 @@ lvt_mode(struct lapic *la, u_int pin, uint32_t value)
if (!lvt->lvt_edgetrigger && bootverbose) {
printf("lapic%u: Forcing LINT%u to edge trigger\n",
la->la_id, pin);
- value |= APIC_LVT_TM;
+ value &= ~APIC_LVT_TM;
}
/* Use a vector of 0. */
break;
diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c
index a917cc4..08e29d5 100644
--- a/sys/x86/x86/mca.c
+++ b/sys/x86/x86/mca.c
@@ -73,7 +73,7 @@ enum scan_mode {
*/
struct cmc_state {
int max_threshold;
- int last_intr;
+ time_t last_intr;
};
#endif
@@ -533,7 +533,7 @@ cmci_update(enum scan_mode mode, int bank, int valid, struct mca_record *rec)
cc = &cmc_state[PCPU_GET(cpuid)][bank];
ctl = rdmsr(MSR_MC_CTL2(bank));
count = (rec->mr_status & MC_STATUS_COR_COUNT) >> 38;
- delta = (u_int)(ticks - cc->last_intr);
+ delta = (u_int)(time_uptime - cc->last_intr);
/*
* If an interrupt was received less than cmc_throttle seconds
@@ -548,9 +548,9 @@ cmci_update(enum scan_mode mode, int bank, int valid, struct mca_record *rec)
limit = min(limit << 1, cc->max_threshold);
ctl &= ~MC_CTL2_THRESHOLD;
ctl |= limit;
- wrmsr(MSR_MC_CTL2(bank), limit);
+ wrmsr(MSR_MC_CTL2(bank), ctl);
}
- cc->last_intr = ticks;
+ cc->last_intr = time_uptime;
return;
}
@@ -581,7 +581,7 @@ cmci_update(enum scan_mode mode, int bank, int valid, struct mca_record *rec)
if ((ctl & MC_CTL2_THRESHOLD) != limit) {
ctl &= ~MC_CTL2_THRESHOLD;
ctl |= limit;
- wrmsr(MSR_MC_CTL2(bank), limit);
+ wrmsr(MSR_MC_CTL2(bank), ctl);
}
}
#endif
@@ -857,7 +857,7 @@ cmci_resume(int i)
return;
cc = &cmc_state[PCPU_GET(cpuid)][i];
- cc->last_intr = -ticks;
+ cc->last_intr = 0;
ctl = rdmsr(MSR_MC_CTL2(i));
ctl &= ~MC_CTL2_THRESHOLD;
ctl |= MC_CTL2_CMCI_EN | 1;
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
index 3f36fbd..7dcf77f 100644
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -542,7 +542,7 @@ init_TSC_tc(void)
* result incorrect runtimes for kernel idle threads (but not
* for any non-idle threads).
*/
- if (cpu_deepest_sleep >= 2 && cpu_vendor_id == CPU_VENDOR_INTEL &&
+ if (cpu_vendor_id == CPU_VENDOR_INTEL &&
(amd_pminfo & AMDPM_TSC_INVARIANT) == 0) {
tsc_timecounter.tc_flags |= TC_FLAGS_C2STOP;
if (bootverbose)
diff --git a/sys/i386/i386/i686_mem.c b/sys/x86/x86/x86_mem.c
index a7b8166..8bc4d39 100644
--- a/sys/i386/i386/i686_mem.c
+++ b/sys/x86/x86/x86_mem.c
@@ -1,7 +1,11 @@
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
+ * Copyright (c) 2017 The FreeBSD Foundation
* All rights reserved.
*
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -35,15 +39,19 @@ __FBSDID("$FreeBSD$");
#include <sys/smp.h>
#include <sys/sysctl.h>
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
/*
- * i686 memory range operations
+ * Pentium Pro+ memory range operations
*
* This code will probably be impenetrable without reference to the
- * Intel Pentium Pro documentation.
+ * Intel Pentium Pro documentation or x86-64 programmers manual vol 2.
*/
static char *mem_owner_bios = "BIOS";
@@ -66,19 +74,20 @@ static char *mem_owner_bios = "BIOS";
static int mtrrs_disabled;
SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RDTUN,
- &mtrrs_disabled, 0, "Disable i686 MTRRs.");
+ &mtrrs_disabled, 0,
+ "Disable MTRRs.");
-static void i686_mrinit(struct mem_range_softc *sc);
-static int i686_mrset(struct mem_range_softc *sc,
+static void x86_mrinit(struct mem_range_softc *sc);
+static int x86_mrset(struct mem_range_softc *sc,
struct mem_range_desc *mrd, int *arg);
-static void i686_mrAPinit(struct mem_range_softc *sc);
-static void i686_mrreinit(struct mem_range_softc *sc);
-
-static struct mem_range_ops i686_mrops = {
- i686_mrinit,
- i686_mrset,
- i686_mrAPinit,
- i686_mrreinit
+static void x86_mrAPinit(struct mem_range_softc *sc);
+static void x86_mrreinit(struct mem_range_softc *sc);
+
+static struct mem_range_ops x86_mrops = {
+ x86_mrinit,
+ x86_mrset,
+ x86_mrAPinit,
+ x86_mrreinit
};
/* XXX for AP startup hook */
@@ -89,21 +98,21 @@ static u_int64_t mtrr_physmask;
static struct mem_range_desc *mem_range_match(struct mem_range_softc *sc,
struct mem_range_desc *mrd);
-static void i686_mrfetch(struct mem_range_softc *sc);
-static int i686_mtrrtype(int flags);
-static int i686_mrt2mtrr(int flags, int oldval);
-static int i686_mtrrconflict(int flag1, int flag2);
-static void i686_mrstore(struct mem_range_softc *sc);
-static void i686_mrstoreone(void *arg);
-static struct mem_range_desc *i686_mtrrfixsearch(struct mem_range_softc *sc,
+static void x86_mrfetch(struct mem_range_softc *sc);
+static int x86_mtrrtype(int flags);
+static int x86_mrt2mtrr(int flags, int oldval);
+static int x86_mtrrconflict(int flag1, int flag2);
+static void x86_mrstore(struct mem_range_softc *sc);
+static void x86_mrstoreone(void *arg);
+static struct mem_range_desc *x86_mtrrfixsearch(struct mem_range_softc *sc,
u_int64_t addr);
-static int i686_mrsetlow(struct mem_range_softc *sc,
+static int x86_mrsetlow(struct mem_range_softc *sc,
struct mem_range_desc *mrd, int *arg);
-static int i686_mrsetvariable(struct mem_range_softc *sc,
+static int x86_mrsetvariable(struct mem_range_softc *sc,
struct mem_range_desc *mrd, int *arg);
-/* i686 MTRR type to memory range type conversion */
-static int i686_mtrrtomrt[] = {
+/* ia32 MTRR type to memory range type conversion */
+static int x86_mtrrtomrt[] = {
MDF_UNCACHEABLE,
MDF_WRITECOMBINE,
MDF_UNKNOWN,
@@ -113,26 +122,28 @@ static int i686_mtrrtomrt[] = {
MDF_WRITEBACK
};
-#define MTRRTOMRTLEN nitems(i686_mtrrtomrt)
+#define MTRRTOMRTLEN nitems(x86_mtrrtomrt)
static int
-i686_mtrr2mrt(int val)
+x86_mtrr2mrt(int val)
{
if (val < 0 || val >= MTRRTOMRTLEN)
return (MDF_UNKNOWN);
- return (i686_mtrrtomrt[val]);
+ return (x86_mtrrtomrt[val]);
}
/*
- * i686 MTRR conflicts. Writeback and uncachable may overlap.
+ * x86 MTRR conflicts. Writeback and uncachable may overlap.
*/
static int
-i686_mtrrconflict(int flag1, int flag2)
+x86_mtrrconflict(int flag1, int flag2)
{
flag1 &= MDF_ATTRMASK;
flag2 &= MDF_ATTRMASK;
+ if ((flag1 & MDF_UNKNOWN) || (flag2 & MDF_UNKNOWN))
+ return (1);
if (flag1 == flag2 ||
(flag1 == MDF_WRITEBACK && flag2 == MDF_UNCACHEABLE) ||
(flag2 == MDF_WRITEBACK && flag1 == MDF_UNCACHEABLE))
@@ -157,13 +168,37 @@ mem_range_match(struct mem_range_softc *sc, struct mem_range_desc *mrd)
}
/*
+ * Ensure that the direct map region does not contain any mappings
+ * that span MTRRs of different types. However, the fixed MTRRs can
+ * be ignored, because a large page mapping the first 1 MB of physical
+ * memory is a special case that the processor handles. Invalidate
+ * any old TLB entries that might hold inconsistent memory type
+ * information.
+ */
+static void
+x86_mr_split_dmap(struct mem_range_softc *sc __unused)
+{
+#ifdef __amd64__
+ struct mem_range_desc *mrd;
+ int i;
+
+ i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0;
+ mrd = sc->mr_desc + i;
+ for (; i < sc->mr_ndesc; i++, mrd++) {
+ if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE)
+ pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE);
+ }
+#endif
+}
+
+/*
* Fetch the current mtrr settings from the current CPU (assumed to
* all be in sync in the SMP case). Note that if we are here, we
* assume that MTRRs are enabled, and we may or may not have fixed
* MTRRs.
*/
static void
-i686_mrfetch(struct mem_range_softc *sc)
+x86_mrfetch(struct mem_range_softc *sc)
{
struct mem_range_desc *mrd;
u_int64_t msrv;
@@ -179,31 +214,31 @@ i686_mrfetch(struct mem_range_softc *sc)
for (j = 0; j < 8; j++, mrd++) {
mrd->mr_flags =
(mrd->mr_flags & ~MDF_ATTRMASK) |
- i686_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
+ x86_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
if (mrd->mr_owner[0] == 0)
strcpy(mrd->mr_owner, mem_owner_bios);
msrv = msrv >> 8;
}
}
msr = MSR_MTRR16kBase;
- for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
+ for (i = 0; i < MTRR_N16K / 8; i++, msr++) {
msrv = rdmsr(msr);
for (j = 0; j < 8; j++, mrd++) {
mrd->mr_flags =
(mrd->mr_flags & ~MDF_ATTRMASK) |
- i686_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
+ x86_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
if (mrd->mr_owner[0] == 0)
strcpy(mrd->mr_owner, mem_owner_bios);
msrv = msrv >> 8;
}
}
msr = MSR_MTRR4kBase;
- for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
+ for (i = 0; i < MTRR_N4K / 8; i++, msr++) {
msrv = rdmsr(msr);
for (j = 0; j < 8; j++, mrd++) {
mrd->mr_flags =
(mrd->mr_flags & ~MDF_ATTRMASK) |
- i686_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
+ x86_mtrr2mrt(msrv & 0xff) | MDF_ACTIVE;
if (mrd->mr_owner[0] == 0)
strcpy(mrd->mr_owner, mem_owner_bios);
msrv = msrv >> 8;
@@ -213,10 +248,10 @@ i686_mrfetch(struct mem_range_softc *sc)
/* Get remainder which must be variable MTRRs. */
msr = MSR_MTRRVarBase;
- for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
+ for (; mrd - sc->mr_desc < sc->mr_ndesc; msr += 2, mrd++) {
msrv = rdmsr(msr);
mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
- i686_mtrr2mrt(msrv & MTRR_PHYSBASE_TYPE);
+ x86_mtrr2mrt(msrv & MTRR_PHYSBASE_TYPE);
mrd->mr_base = msrv & mtrr_physmask;
msrv = rdmsr(msr + 1);
mrd->mr_flags = (msrv & MTRR_PHYSMASK_VALID) ?
@@ -225,7 +260,7 @@ i686_mrfetch(struct mem_range_softc *sc)
/* Compute the range from the mask. Ick. */
mrd->mr_len = (~(msrv & mtrr_physmask) &
- (mtrr_physmask | 0xfffLL)) + 1;
+ (mtrr_physmask | 0xfff)) + 1;
if (!mrvalid(mrd->mr_base, mrd->mr_len))
mrd->mr_flags |= MDF_BOGUS;
@@ -239,27 +274,27 @@ i686_mrfetch(struct mem_range_softc *sc)
* Return the MTRR memory type matching a region's flags
*/
static int
-i686_mtrrtype(int flags)
+x86_mtrrtype(int flags)
{
int i;
flags &= MDF_ATTRMASK;
for (i = 0; i < MTRRTOMRTLEN; i++) {
- if (i686_mtrrtomrt[i] == MDF_UNKNOWN)
+ if (x86_mtrrtomrt[i] == MDF_UNKNOWN)
continue;
- if (flags == i686_mtrrtomrt[i])
+ if (flags == x86_mtrrtomrt[i])
return (i);
}
return (-1);
}
static int
-i686_mrt2mtrr(int flags, int oldval)
+x86_mrt2mtrr(int flags, int oldval)
{
int val;
- if ((val = i686_mtrrtype(flags)) == -1)
+ if ((val = x86_mtrrtype(flags)) == -1)
return (oldval & 0xff);
return (val & 0xff);
}
@@ -268,24 +303,13 @@ i686_mrt2mtrr(int flags, int oldval)
* Update running CPU(s) MTRRs to match the ranges in the descriptor
* list.
*
- * XXX Must be called with interrupts enabled.
+ * Must be called with interrupts enabled.
*/
static void
-i686_mrstore(struct mem_range_softc *sc)
+x86_mrstore(struct mem_range_softc *sc)
{
-#ifdef SMP
- /*
- * We should use ipi_all_but_self() to call other CPUs into a
- * locking gate, then call a target function to do this work.
- * The "proper" solution involves a generalised locking gate
- * implementation, not ready yet.
- */
- smp_rendezvous(NULL, i686_mrstoreone, NULL, sc);
-#else
- disable_intr(); /* disable interrupts */
- i686_mrstoreone(sc);
- enable_intr();
-#endif
+
+ smp_rendezvous(NULL, x86_mrstoreone, NULL, sc);
}
/*
@@ -294,7 +318,7 @@ i686_mrstore(struct mem_range_softc *sc)
* stuffing one entry; this is simpler (but slower, of course).
*/
static void
-i686_mrstoreone(void *arg)
+x86_mrstoreone(void *arg)
{
struct mem_range_softc *sc = arg;
struct mem_range_desc *mrd;
@@ -324,36 +348,36 @@ i686_mrstoreone(void *arg)
/* Set fixed-range MTRRs. */
if (sc->mr_cap & MR686_FIXMTRR) {
msr = MSR_MTRR64kBase;
- for (i = 0; i < (MTRR_N64K / 8); i++, msr++) {
+ for (i = 0; i < MTRR_N64K / 8; i++, msr++) {
msrv = 0;
omsrv = rdmsr(msr);
for (j = 7; j >= 0; j--) {
msrv = msrv << 8;
- msrv |= i686_mrt2mtrr((mrd + j)->mr_flags,
+ msrv |= x86_mrt2mtrr((mrd + j)->mr_flags,
omsrv >> (j * 8));
}
wrmsr(msr, msrv);
mrd += 8;
}
msr = MSR_MTRR16kBase;
- for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
+ for (i = 0; i < MTRR_N16K / 8; i++, msr++) {
msrv = 0;
omsrv = rdmsr(msr);
for (j = 7; j >= 0; j--) {
msrv = msrv << 8;
- msrv |= i686_mrt2mtrr((mrd + j)->mr_flags,
+ msrv |= x86_mrt2mtrr((mrd + j)->mr_flags,
omsrv >> (j * 8));
}
wrmsr(msr, msrv);
mrd += 8;
}
msr = MSR_MTRR4kBase;
- for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
+ for (i = 0; i < MTRR_N4K / 8; i++, msr++) {
msrv = 0;
omsrv = rdmsr(msr);
for (j = 7; j >= 0; j--) {
msrv = msrv << 8;
- msrv |= i686_mrt2mtrr((mrd + j)->mr_flags,
+ msrv |= x86_mrt2mtrr((mrd + j)->mr_flags,
omsrv >> (j * 8));
}
wrmsr(msr, msrv);
@@ -363,12 +387,12 @@ i686_mrstoreone(void *arg)
/* Set remainder which must be variable MTRRs. */
msr = MSR_MTRRVarBase;
- for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
+ for (; mrd - sc->mr_desc < sc->mr_ndesc; msr += 2, mrd++) {
/* base/type register */
omsrv = rdmsr(msr);
if (mrd->mr_flags & MDF_ACTIVE) {
msrv = mrd->mr_base & mtrr_physmask;
- msrv |= i686_mrt2mtrr(mrd->mr_flags, omsrv);
+ msrv |= x86_mrt2mtrr(mrd->mr_flags, omsrv);
} else {
msrv = 0;
}
@@ -402,15 +426,15 @@ i686_mrstoreone(void *arg)
* Hunt for the fixed MTRR referencing (addr)
*/
static struct mem_range_desc *
-i686_mtrrfixsearch(struct mem_range_softc *sc, u_int64_t addr)
+x86_mtrrfixsearch(struct mem_range_softc *sc, u_int64_t addr)
{
struct mem_range_desc *mrd;
int i;
- for (i = 0, mrd = sc->mr_desc; i < (MTRR_N64K + MTRR_N16K + MTRR_N4K);
+ for (i = 0, mrd = sc->mr_desc; i < MTRR_N64K + MTRR_N16K + MTRR_N4K;
i++, mrd++)
- if ((addr >= mrd->mr_base) &&
- (addr < (mrd->mr_base + mrd->mr_len)))
+ if (addr >= mrd->mr_base &&
+ addr < mrd->mr_base + mrd->mr_len)
return (mrd);
return (NULL);
}
@@ -427,21 +451,23 @@ i686_mtrrfixsearch(struct mem_range_softc *sc, u_int64_t addr)
* "busy" ranges.
*/
static int
-i686_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
+x86_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
{
struct mem_range_desc *first_md, *last_md, *curr_md;
/* Range check. */
- if (((first_md = i686_mtrrfixsearch(sc, mrd->mr_base)) == NULL) ||
- ((last_md = i686_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1)) == NULL))
+ if ((first_md = x86_mtrrfixsearch(sc, mrd->mr_base)) == NULL ||
+ (last_md = x86_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1))
+ == NULL)
return (EINVAL);
/* Check that we aren't doing something risky. */
- if (!(mrd->mr_flags & MDF_FORCE))
+ if ((mrd->mr_flags & MDF_FORCE) == 0) {
for (curr_md = first_md; curr_md <= last_md; curr_md++) {
if ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN)
return (EACCES);
}
+ }
/* Set flags, clear set-by-firmware flag. */
for (curr_md = first_md; curr_md <= last_md; curr_md++) {
@@ -459,7 +485,7 @@ i686_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
* XXX needs to be updated to properly support "busy" ranges.
*/
static int
-i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
+x86_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
int *arg)
{
struct mem_range_desc *curr_md, *free_md;
@@ -479,8 +505,8 @@ i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
for (; i < sc->mr_ndesc; i++, curr_md++) {
if (curr_md->mr_flags & MDF_ACTIVE) {
/* Exact match? */
- if ((curr_md->mr_base == mrd->mr_base) &&
- (curr_md->mr_len == mrd->mr_len)) {
+ if (curr_md->mr_base == mrd->mr_base &&
+ curr_md->mr_len == mrd->mr_len) {
/* Whoops, owned by someone. */
if (curr_md->mr_flags & MDF_BUSY)
@@ -488,8 +514,8 @@ i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
/* Check that we aren't doing something risky */
if (!(mrd->mr_flags & MDF_FORCE) &&
- ((curr_md->mr_flags & MDF_ATTRMASK) ==
- MDF_UNKNOWN))
+ (curr_md->mr_flags & MDF_ATTRMASK) ==
+ MDF_UNKNOWN)
return (EACCES);
/* Ok, just hijack this entry. */
@@ -500,7 +526,7 @@ i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
/* Non-exact overlap? */
if (mroverlap(curr_md, mrd)) {
/* Between conflicting region types? */
- if (i686_mtrrconflict(curr_md->mr_flags,
+ if (x86_mtrrconflict(curr_md->mr_flags,
mrd->mr_flags))
return (EINVAL);
}
@@ -525,31 +551,32 @@ i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd,
* Handle requests to set memory range attributes by manipulating MTRRs.
*/
static int
-i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
+x86_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
{
struct mem_range_desc *targ;
- int error = 0;
+ int error;
- switch(*arg) {
+ switch (*arg) {
case MEMRANGE_SET_UPDATE:
/*
* Make sure that what's being asked for is even
* possible at all.
*/
if (!mrvalid(mrd->mr_base, mrd->mr_len) ||
- i686_mtrrtype(mrd->mr_flags) == -1)
+ x86_mtrrtype(mrd->mr_flags) == -1)
return (EINVAL);
-#define FIXTOP ((MTRR_N64K * 0x10000) + (MTRR_N16K * 0x4000) + (MTRR_N4K * 0x1000))
+#define FIXTOP \
+ ((MTRR_N64K * 0x10000) + (MTRR_N16K * 0x4000) + (MTRR_N4K * 0x1000))
/* Are the "low memory" conditions applicable? */
- if ((sc->mr_cap & MR686_FIXMTRR) &&
- ((mrd->mr_base + mrd->mr_len) <= FIXTOP)) {
- if ((error = i686_mrsetlow(sc, mrd, arg)) != 0)
+ if ((sc->mr_cap & MR686_FIXMTRR) != 0 &&
+ mrd->mr_base + mrd->mr_len <= FIXTOP) {
+ if ((error = x86_mrsetlow(sc, mrd, arg)) != 0)
return (error);
} else {
/* It's time to play with variable MTRRs. */
- if ((error = i686_mrsetvariable(sc, mrd, arg)) != 0)
+ if ((error = x86_mrsetvariable(sc, mrd, arg)) != 0)
return (error);
}
break;
@@ -569,11 +596,13 @@ i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
return (EOPNOTSUPP);
}
+ x86_mr_split_dmap(sc);
+
/* Update the hardware. */
- i686_mrstore(sc);
+ x86_mrstore(sc);
/* Refetch to see where we're at. */
- i686_mrfetch(sc);
+ x86_mrfetch(sc);
return (0);
}
@@ -582,12 +611,16 @@ i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
* and fetch the initial settings.
*/
static void
-i686_mrinit(struct mem_range_softc *sc)
+x86_mrinit(struct mem_range_softc *sc)
{
struct mem_range_desc *mrd;
- u_int regs[4];
- int i, nmdesc = 0, pabits;
+ int i, nmdesc;
+ if (sc->mr_desc != NULL)
+ /* Already initialized. */
+ return;
+
+ nmdesc = 0;
mtrrcap = rdmsr(MSR_MTRRcap);
mtrrdef = rdmsr(MSR_MTRRdefType);
@@ -603,17 +636,10 @@ i686_mrinit(struct mem_range_softc *sc)
/*
* Determine the size of the PhysMask and PhysBase fields in
- * the variable range MTRRs. If the extended CPUID 0x80000008
- * is present, use that to figure out how many physical
- * address bits the CPU supports. Otherwise, default to 36
- * address bits.
+ * the variable range MTRRs.
*/
- if (cpu_exthigh >= 0x80000008) {
- do_cpuid(0x80000008, regs);
- pabits = regs[0] & 0xff;
- } else
- pabits = 36;
- mtrr_physmask = ((1ULL << pabits) - 1) & ~0xfffULL;
+ mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) &
+ ~(uint64_t)0xfff;
/* If fixed MTRRs supported and enabled. */
if ((mtrrcap & MTRR_CAP_FIXED) && (mtrrdef & MTRR_DEF_FIXED_ENABLE)) {
@@ -654,22 +680,24 @@ i686_mrinit(struct mem_range_softc *sc)
* have been set by the firmware. (XXX has something already
* played here?)
*/
- i686_mrfetch(sc);
+ x86_mrfetch(sc);
mrd = sc->mr_desc;
for (i = 0; i < sc->mr_ndesc; i++, mrd++) {
if (mrd->mr_flags & MDF_ACTIVE)
mrd->mr_flags |= MDF_FIRMWARE;
}
+
+ x86_mr_split_dmap(sc);
}
/*
* Initialise MTRRs on an AP after the BSP has run the init code.
*/
static void
-i686_mrAPinit(struct mem_range_softc *sc)
+x86_mrAPinit(struct mem_range_softc *sc)
{
- i686_mrstoreone(sc);
+ x86_mrstoreone(sc);
wrmsr(MSR_MTRRdefType, mtrrdef);
}
@@ -677,44 +705,24 @@ i686_mrAPinit(struct mem_range_softc *sc)
* Re-initialise running CPU(s) MTRRs to match the ranges in the descriptor
* list.
*
- * XXX Must be called with interrupts enabled.
+ * Must be called with interrupts enabled.
*/
static void
-i686_mrreinit(struct mem_range_softc *sc)
+x86_mrreinit(struct mem_range_softc *sc)
{
-#ifdef SMP
- /*
- * We should use ipi_all_but_self() to call other CPUs into a
- * locking gate, then call a target function to do this work.
- * The "proper" solution involves a generalised locking gate
- * implementation, not ready yet.
- */
- smp_rendezvous(NULL, (void *)i686_mrAPinit, NULL, sc);
-#else
- disable_intr(); /* disable interrupts */
- i686_mrAPinit(sc);
- enable_intr();
-#endif
+
+ smp_rendezvous(NULL, (void (*)(void *))x86_mrAPinit, NULL, sc);
}
static void
-i686_mem_drvinit(void *unused)
+x86_mem_drvinit(void *unused)
{
if (mtrrs_disabled)
return;
if (!(cpu_feature & CPUID_MTRR))
return;
- if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00)
- return;
- switch (cpu_vendor_id) {
- case CPU_VENDOR_INTEL:
- case CPU_VENDOR_AMD:
- case CPU_VENDOR_CENTAUR:
- break;
- default:
- return;
- }
- mem_range_softc.mr_op = &i686_mrops;
+ mem_range_softc.mr_op = &x86_mrops;
+ x86_mrinit(&mem_range_softc);
}
-SYSINIT(i686memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, i686_mem_drvinit, NULL);
+SYSINIT(x86memdev, SI_SUB_CPU, SI_ORDER_ANY, x86_mem_drvinit, NULL);
diff --git a/tests/sys/fs/tmpfs/Makefile b/tests/sys/fs/tmpfs/Makefile
index 63facd1..388d911 100644
--- a/tests/sys/fs/tmpfs/Makefile
+++ b/tests/sys/fs/tmpfs/Makefile
@@ -41,12 +41,17 @@ ${PACKAGE}FILESDIR= ${TESTSDIR}
PROGS+= h_tools
BINDIR.h_tools= ${TESTSDIR}
+ATF_TESTS_SH_SED_mknod_test= \
+ -e 's,mknod pipe p,mkfifo pipe,g' \
+ -e 's,mknod dir/pipe p,mkfifo dir/pipe,g'
+
ATF_TESTS_SH_SED_mount_test= \
-e 's,-o -g,-o gid=,g' \
-e 's,-o -m,-o mode=,g' \
-e 's,-o -s,-o size=,g' \
-e 's,-o -u,-o uid=,g' \
-e 's,mount_${FILESYSTEM},mount -t ${FILESYSTEM},g'
+ATF_TESTS_SH_SED_readdir_test= -e 's,mknod fifo p,mkfifo fifo,g'
ATF_TESTS_SH_SED_sizes_test= -e 's,-o -s,-o size=,g'
ATF_TESTS_SH_SED_statvfs_test= -e 's,-o -s,-o size=,g'
ATF_TESTS_SH_SED_vnode_leak_test= -e 's,-o -s,-o size=,g'
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index e555710..27dd92f 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -1201,6 +1201,7 @@ OLD_FILES+=usr/share/man/man8/casperd.8.gz
.if ${MK_CCD} == no
OLD_FILES+=etc/rc.d/ccd
+OLD_FILES+=rescue/ccdconfig
OLD_FILES+=sbin/ccdconfig
OLD_FILES+=usr/share/man/man4/ccd.4.gz
OLD_FILES+=usr/share/man/man8/ccdconfig.8.gz
@@ -1518,10 +1519,6 @@ OLD_FILES+=usr/bin/cpp
OLD_FILES+=usr/share/man/man1/cpp.1.gz
.endif
-#.if ${MK_CRYPT} == no
-# to be filled in
-#.endif
-
.if ${MK_CTM} == no
OLD_FILES+=usr/sbin/ctm
OLD_FILES+=usr/sbin/ctm_dequeue
@@ -6666,10 +6663,6 @@ OLD_FILES+=usr/share/man/man8/ntpq.8.gz
OLD_FILES+=usr/share/man/man8/ntptime.8.gz
.endif
-#.if ${MK_OBJC} == no
-# to be filled in
-#.endif
-
.if ${MK_OPENSSH} == no
OLD_FILES+=etc/rc.d/sshd
OLD_FILES+=etc/ssh/moduli
@@ -7138,6 +7131,8 @@ OLD_FILES+=usr/share/man/man5/rcsfile.5.gz
#.endif
.if ${MK_ROUTED} == no
+OLD_FILES+=rescue/routed
+OLD_FILES+=rescue/rtquery
OLD_FILES+=sbin/routed
OLD_FILES+=sbin/rtquery
OLD_FILES+=usr/share/man/man8/routed.8.gz
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
index 8225185..edb641c 100644
--- a/usr.bin/cmp/special.c
+++ b/usr.bin/cmp/special.c
@@ -99,6 +99,8 @@ eof: if (ferror(fp1))
} else
if (feof(fp2))
eofmsg(file2);
+ fclose(fp2);
+ fclose(fp1);
if (dfound)
exit(DIFF_EXIT);
}
diff --git a/usr.bin/cmp/tests/Makefile b/usr.bin/cmp/tests/Makefile
index bfae46c..087f32f 100644
--- a/usr.bin/cmp/tests/Makefile
+++ b/usr.bin/cmp/tests/Makefile
@@ -2,6 +2,7 @@
.include <bsd.own.mk>
+ATF_TESTS_SH+= cmp_test2
NETBSD_ATF_TESTS_SH= cmp_test
.include <netbsd-tests.test.mk>
diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh
new file mode 100755
index 0000000..2221e62
--- /dev/null
+++ b/usr.bin/cmp/tests/cmp_test2.sh
@@ -0,0 +1,67 @@
+# Copyright (c) 2017 Alan Somers
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case special
+special_head() {
+ atf_set "descr" "Test cmp(1)'s handling of non-regular files"
+}
+special_body() {
+ echo 0123456789abcdef > a
+ echo 0123456789abcdeg > b
+ cat a | atf_check -s exit:0 cmp a -
+ cat a | atf_check -s exit:0 cmp - a
+ cat b | atf_check -s not-exit:0 cmp a -
+ cat b | atf_check -s not-exit:0 cmp - a
+ true
+}
+
+atf_test_case symlink
+symlink_head() {
+ atf_set "descr" "Test cmp(1)'s handling of symlinks"
+}
+symlink_body() {
+ echo 0123456789abcdef > a
+ echo 0123456789abcdeg > b
+ ln -s a a.lnk
+ ln -s b b.lnk
+ ln -s a a2.lnk
+ cp a adup
+ ln -s adup adup.lnk
+ atf_check -s exit:0 cmp a a.lnk
+ atf_check -s exit:0 cmp a.lnk a
+ atf_check -s not-exit:0 -o ignore cmp a b.lnk
+ atf_check -s not-exit:0 -o ignore cmp b.lnk a
+ atf_check -s not-exit:0 -o ignore -e ignore cmp -h a a.lnk
+ atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk a
+ atf_check -s exit:0 cmp -h a.lnk a2.lnk
+ atf_check -s not-exit:0 -o ignore -e ignore cmp -h a.lnk adup.lnk
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case special
+ atf_add_test_case symlink
+}
diff --git a/usr.bin/ctlstat/ctlstat.c b/usr.bin/ctlstat/ctlstat.c
index d55e004..eb01f60 100644
--- a/usr.bin/ctlstat/ctlstat.c
+++ b/usr.bin/ctlstat/ctlstat.c
@@ -312,8 +312,8 @@ compute_stats(struct ctl_io_stats *cur_stats,
* conducive to programming, however.
*/
-#define PRINT_BINTIME(prefix, bt) \
- printf("%s %jd.%06ju\n", prefix, (intmax_t)(bt).sec, \
+#define PRINT_BINTIME(bt) \
+ printf("%jd.%06ju", (intmax_t)(bt).sec, \
(uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
static const char *iotypes[] = {"NO IO", "READ", "WRITE"};
@@ -335,15 +335,15 @@ ctlstat_dump(struct ctlstat_context *ctx)
stats[i].operations[iotype]);
printf(" dmas %ju\n", (uintmax_t)
stats[i].dmas[iotype]);
- PRINT_BINTIME(" io time", stats[i].time[iotype]);
- PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]);
+ printf(" io time ");
+ PRINT_BINTIME(stats[i].time[iotype]);
+ printf("\n dma time ");
+ PRINT_BINTIME(stats[i].dma_time[iotype]);
+ printf("\n");
}
}
}
-#define JSON_BINTIME(prefix, bt) \
- printf("\"%s\":%jd.%06ju,", prefix, (intmax_t)(bt).sec, \
- (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32))
static void
ctlstat_json(struct ctlstat_context *ctx) {
int iotype, i;
@@ -357,14 +357,17 @@ ctlstat_json(struct ctlstat_context *ctx) {
stats[i].item);
for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) {
printf("{\"type\":\"%s\",", iotypes[iotype]);
- printf("\"bytes\":%ju,", (uintmax_t)stats[
- i].bytes[iotype]);
- printf("\"operations\":%ju,", (uintmax_t)stats[
- i].operations[iotype]);
- printf("\"dmas\":%ju}", (uintmax_t)
+ printf("\"bytes\":%ju,", (uintmax_t)
+ stats[i].bytes[iotype]);
+ printf("\"operations\":%ju,", (uintmax_t)
+ stats[i].operations[iotype]);
+ printf("\"dmas\":%ju,", (uintmax_t)
stats[i].dmas[iotype]);
- JSON_BINTIME("io time", stats[i].time[iotype]);
- JSON_BINTIME("dma time", stats[i].dma_time[iotype]);
+ printf("\"io time\":");
+ PRINT_BINTIME(stats[i].time[iotype]);
+ printf(",\"dma time\":");
+ PRINT_BINTIME(stats[i].dma_time[iotype]);
+ printf("}");
if (iotype < (CTL_STATS_NUM_TYPES - 1))
printf(","); /* continue io array */
}
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c
index 52ce85c..2834e4f 100644
--- a/usr.bin/dc/bcode.c
+++ b/usr.bin/dc/bcode.c
@@ -960,9 +960,8 @@ badd(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -987,9 +986,8 @@ bsub(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1035,9 +1033,8 @@ bmul(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1060,9 +1057,8 @@ bdiv(void)
u_int scale;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1097,9 +1093,8 @@ bmod(void)
u_int scale;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1134,9 +1129,8 @@ bdivmod(void)
u_int scale;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1176,9 +1170,8 @@ bexp(void)
u_int rscale;
p = pop_number();
- if (p == NULL) {
+ if (p == NULL)
return;
- }
a = pop_number();
if (a == NULL) {
push_number(p);
@@ -1299,9 +1292,8 @@ bsqrt(void)
onecount = 0;
n = pop_number();
- if (n == NULL) {
+ if (n == NULL)
return;
- }
if (BN_is_zero(n->number)) {
r = new_number();
push_number(r);
@@ -1342,9 +1334,8 @@ not(void)
struct number *a;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
a->scale = 0;
bn_check(BN_set_word(a->number, BN_get_word(a->number) ? 0 : 1));
push_number(a);
@@ -1363,9 +1354,8 @@ equal_numbers(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1383,9 +1373,8 @@ less_numbers(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1403,9 +1392,8 @@ lesseq_numbers(void)
struct number *a, *b, *r;
a = pop_number();
- if (a == NULL) {
+ if (a == NULL)
return;
- }
b = pop_number();
if (b == NULL) {
push_number(a);
@@ -1736,9 +1724,8 @@ eval_tos(void)
char *p;
p = pop_string();
- if (p == NULL)
- return;
- eval_string(p);
+ if (p != NULL)
+ eval_string(p);
}
void
diff --git a/usr.bin/dc/dc.c b/usr.bin/dc/dc.c
index 546b247..f6968a5 100644
--- a/usr.bin/dc/dc.c
+++ b/usr.bin/dc/dc.c
@@ -120,8 +120,8 @@ main(int argc, char *argv[])
if (!preproc_done)
init_bmachine(extended_regs);
- setlinebuf(stdout);
- setlinebuf(stderr);
+ (void)setvbuf(stdout, NULL, _IOLBF, 0);
+ (void)setvbuf(stderr, NULL, _IOLBF, 0);
if (argc > 1)
usage();
diff --git a/usr.bin/dc/stack.c b/usr.bin/dc/stack.c
index 3364ae2..33082c7 100644
--- a/usr.bin/dc/stack.c
+++ b/usr.bin/dc/stack.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stack.c,v 1.11 2009/10/27 23:59:37 deraadt Exp $ */
+/* $OpenBSD: stack.c,v 1.12 2014/11/26 15:05:51 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -68,10 +68,8 @@ stack_free_value(struct value *v)
free(v->u.string);
break;
}
- if (v->array != NULL) {
- array_free(v->array);
- v->array = NULL;
- }
+ array_free(v->array);
+ v->array = NULL;
}
/* Copy number or string content into already allocated target */
@@ -225,10 +223,8 @@ stack_popnumber(struct stack *stack)
if (stack_empty(stack))
return (NULL);
- if (stack->stack[stack->sp].array != NULL) {
- array_free(stack->stack[stack->sp].array);
- stack->stack[stack->sp].array = NULL;
- }
+ array_free(stack->stack[stack->sp].array);
+ stack->stack[stack->sp].array = NULL;
if (stack->stack[stack->sp].type != BCODE_NUMBER) {
warnx("not a number"); /* XXX remove */
return (NULL);
@@ -242,10 +238,8 @@ stack_popstring(struct stack *stack)
if (stack_empty(stack))
return (NULL);
- if (stack->stack[stack->sp].array != NULL) {
- array_free(stack->stack[stack->sp].array);
- stack->stack[stack->sp].array = NULL;
- }
+ array_free(stack->stack[stack->sp].array);
+ stack->stack[stack->sp].array = NULL;
if (stack->stack[stack->sp].type != BCODE_STRING) {
warnx("not a string"); /* XXX remove */
return (NULL);
@@ -257,9 +251,8 @@ void
stack_clear(struct stack *stack)
{
- while (stack->sp >= 0) {
+ while (stack->sp >= 0)
stack_free_value(&stack->stack[stack->sp--]);
- }
free(stack->stack);
stack_init(stack);
}
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index e4c5a8f..dea195c 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -88,9 +88,9 @@ static size_t numprotos; /* allocated size of protos[] */
static int *ports;
-#define INT_BIT (sizeof(int)*CHAR_BIT)
-#define SET_PORT(p) do { ports[p / INT_BIT] |= 1 << (p % INT_BIT); } while (0)
-#define CHK_PORT(p) (ports[p / INT_BIT] & (1 << (p % INT_BIT)))
+#define INT_BIT (sizeof(int)*CHAR_BIT)
+#define SET_PORT(p) do { ports[p / INT_BIT] |= 1 << (p % INT_BIT); } while (0)
+#define CHK_PORT(p) (ports[p / INT_BIT] & (1 << (p % INT_BIT)))
struct addr {
struct sockaddr_storage address;
@@ -111,7 +111,7 @@ struct sock {
struct sock *next;
};
-#define HASHSIZE 1009
+#define HASHSIZE 1009
static struct sock *sockhash[HASHSIZE];
static struct xfile *xfiles;
@@ -131,7 +131,6 @@ xprintf(const char *fmt, ...)
return (len);
}
-
static int
get_proto_type(const char *proto)
{
@@ -147,7 +146,6 @@ get_proto_type(const char *proto)
return (pent->p_proto);
}
-
static void
init_protos(int num)
{
@@ -167,7 +165,6 @@ init_protos(int num)
numprotos = proto_count;
}
-
static int
parse_protos(char *protospec)
{
@@ -190,7 +187,6 @@ parse_protos(char *protospec)
return (proto_index);
}
-
static void
parse_ports(const char *portspec)
{
@@ -359,27 +355,27 @@ gather_sctp(void)
err(1, "malloc()");
switch (xladdr->address.sa.sa_family) {
case AF_INET:
-#define __IN_IS_ADDR_LOOPBACK(pina) \
+#define __IN_IS_ADDR_LOOPBACK(pina) \
((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
- if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr))
+ if (!__IN_IS_ADDR_LOOPBACK(
+ &xladdr->address.sin.sin_addr))
local_all_loopback = 0;
-#undef __IN_IS_ADDR_LOOPBACK
- sockaddr(&laddr->address,
- AF_INET,
- &xladdr->address.sin.sin_addr,
- htons(xinpcb->local_port));
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&laddr->address, AF_INET,
+ &xladdr->address.sin.sin_addr,
+ htons(xinpcb->local_port));
break;
case AF_INET6:
- if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr))
+ if (!IN6_IS_ADDR_LOOPBACK(
+ &xladdr->address.sin6.sin6_addr))
local_all_loopback = 0;
- sockaddr(&laddr->address,
- AF_INET6,
- &xladdr->address.sin6.sin6_addr,
- htons(xinpcb->local_port));
+ sockaddr(&laddr->address, AF_INET6,
+ &xladdr->address.sin6.sin6_addr,
+ htons(xinpcb->local_port));
break;
default:
errx(1, "address family %d not supported",
- xladdr->address.sa.sa_family);
+ xladdr->address.sa.sa_family);
}
laddr->next = NULL;
if (prev_laddr == NULL)
@@ -389,33 +385,38 @@ gather_sctp(void)
prev_laddr = laddr;
}
if (sock->laddr == NULL) {
- if ((sock->laddr = calloc(1, sizeof(struct addr))) == NULL)
+ if ((sock->laddr =
+ calloc(1, sizeof(struct addr))) == NULL)
err(1, "malloc()");
sock->laddr->address.ss_family = sock->family;
if (sock->family == AF_INET)
- sock->laddr->address.ss_len = sizeof(struct sockaddr_in);
+ sock->laddr->address.ss_len =
+ sizeof(struct sockaddr_in);
else
- sock->laddr->address.ss_len = sizeof(struct sockaddr_in6);
+ sock->laddr->address.ss_len =
+ sizeof(struct sockaddr_in6);
local_all_loopback = 0;
}
if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL)
err(1, "malloc()");
sock->faddr->address.ss_family = sock->family;
if (sock->family == AF_INET)
- sock->faddr->address.ss_len = sizeof(struct sockaddr_in);
+ sock->faddr->address.ss_len =
+ sizeof(struct sockaddr_in);
else
- sock->faddr->address.ss_len = sizeof(struct sockaddr_in6);
+ sock->faddr->address.ss_len =
+ sizeof(struct sockaddr_in6);
no_stcb = 1;
while (offset < len) {
xstcb = (struct xsctp_tcb *)(void *)(buf + offset);
offset += sizeof(struct xsctp_tcb);
if (no_stcb) {
- if (opt_l &&
- (sock->vflag & vflag) &&
+ if (opt_l && (sock->vflag & vflag) &&
(!opt_L || !local_all_loopback) &&
((xinpcb->flags & SCTP_PCB_FLAGS_UDPTYPE) ||
(xstcb->last == 1))) {
- hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ hash = (int)((uintptr_t)sock->socket %
+ HASHSIZE);
sock->next = sockhash[hash];
sockhash[hash] = sock;
} else {
@@ -448,37 +449,40 @@ gather_sctp(void)
prev_laddr = NULL;
local_all_loopback = 1;
while (offset < len) {
- xladdr = (struct xsctp_laddr *)(void *)(buf + offset);
+ xladdr = (struct xsctp_laddr *)(void *)(buf +
+ offset);
offset += sizeof(struct xsctp_laddr);
if (xladdr->last == 1)
break;
if (!opt_c)
continue;
- if ((laddr = calloc(1, sizeof(struct addr))) == NULL)
+ laddr = calloc(1, sizeof(struct addr));
+ if (laddr == NULL)
err(1, "malloc()");
switch (xladdr->address.sa.sa_family) {
case AF_INET:
-#define __IN_IS_ADDR_LOOPBACK(pina) \
+#define __IN_IS_ADDR_LOOPBACK(pina) \
((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
- if (!__IN_IS_ADDR_LOOPBACK(&xladdr->address.sin.sin_addr))
+ if (!__IN_IS_ADDR_LOOPBACK(
+ &xladdr->address.sin.sin_addr))
local_all_loopback = 0;
-#undef __IN_IS_ADDR_LOOPBACK
- sockaddr(&laddr->address,
- AF_INET,
- &xladdr->address.sin.sin_addr,
- htons(xstcb->local_port));
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&laddr->address, AF_INET,
+ &xladdr->address.sin.sin_addr,
+ htons(xstcb->local_port));
break;
case AF_INET6:
- if (!IN6_IS_ADDR_LOOPBACK(&xladdr->address.sin6.sin6_addr))
+ if (!IN6_IS_ADDR_LOOPBACK(
+ &xladdr->address.sin6.sin6_addr))
local_all_loopback = 0;
- sockaddr(&laddr->address,
- AF_INET6,
- &xladdr->address.sin6.sin6_addr,
- htons(xstcb->local_port));
+ sockaddr(&laddr->address, AF_INET6,
+ &xladdr->address.sin6.sin6_addr,
+ htons(xstcb->local_port));
break;
default:
- errx(1, "address family %d not supported",
- xladdr->address.sa.sa_family);
+ errx(1,
+ "address family %d not supported",
+ xladdr->address.sa.sa_family);
}
laddr->next = NULL;
if (prev_laddr == NULL)
@@ -490,37 +494,40 @@ gather_sctp(void)
prev_faddr = NULL;
foreign_all_loopback = 1;
while (offset < len) {
- xraddr = (struct xsctp_raddr *)(void *)(buf + offset);
+ xraddr = (struct xsctp_raddr *)(void *)(buf +
+ offset);
offset += sizeof(struct xsctp_raddr);
if (xraddr->last == 1)
break;
if (!opt_c)
continue;
- if ((faddr = calloc(1, sizeof(struct addr))) == NULL)
+ faddr = calloc(1, sizeof(struct addr));
+ if (faddr == NULL)
err(1, "malloc()");
switch (xraddr->address.sa.sa_family) {
case AF_INET:
-#define __IN_IS_ADDR_LOOPBACK(pina) \
+#define __IN_IS_ADDR_LOOPBACK(pina) \
((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
- if (!__IN_IS_ADDR_LOOPBACK(&xraddr->address.sin.sin_addr))
+ if (!__IN_IS_ADDR_LOOPBACK(
+ &xraddr->address.sin.sin_addr))
foreign_all_loopback = 0;
-#undef __IN_IS_ADDR_LOOPBACK
- sockaddr(&faddr->address,
- AF_INET,
- &xraddr->address.sin.sin_addr,
- htons(xstcb->remote_port));
+#undef __IN_IS_ADDR_LOOPBACK
+ sockaddr(&faddr->address, AF_INET,
+ &xraddr->address.sin.sin_addr,
+ htons(xstcb->remote_port));
break;
case AF_INET6:
- if (!IN6_IS_ADDR_LOOPBACK(&xraddr->address.sin6.sin6_addr))
+ if (!IN6_IS_ADDR_LOOPBACK(
+ &xraddr->address.sin6.sin6_addr))
foreign_all_loopback = 0;
- sockaddr(&faddr->address,
- AF_INET6,
- &xraddr->address.sin6.sin6_addr,
- htons(xstcb->remote_port));
+ sockaddr(&faddr->address, AF_INET6,
+ &xraddr->address.sin6.sin6_addr,
+ htons(xstcb->remote_port));
break;
default:
- errx(1, "address family %d not supported",
- xraddr->address.sa.sa_family);
+ errx(1,
+ "address family %d not supported",
+ xraddr->address.sa.sa_family);
}
faddr->next = NULL;
if (prev_faddr == NULL)
@@ -532,8 +539,10 @@ gather_sctp(void)
if (opt_c) {
if ((sock->vflag & vflag) &&
(!opt_L ||
- !(local_all_loopback || foreign_all_loopback))) {
- hash = (int)((uintptr_t)sock->socket % HASHSIZE);
+ !(local_all_loopback ||
+ foreign_all_loopback))) {
+ hash = (int)((uintptr_t)sock->socket %
+ HASHSIZE);
sock->next = sockhash[hash];
sockhash[hash] = sock;
} else {
@@ -646,13 +655,13 @@ gather_inet(int proto)
if ((inp->inp_fport == 0 && !opt_l) ||
(inp->inp_fport != 0 && !opt_c))
continue;
-#define __IN_IS_ADDR_LOOPBACK(pina) \
+#define __IN_IS_ADDR_LOOPBACK(pina) \
((ntohl((pina)->s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
if (opt_L &&
(__IN_IS_ADDR_LOOPBACK(&inp->inp_faddr) ||
__IN_IS_ADDR_LOOPBACK(&inp->inp_laddr)))
continue;
-#undef __IN_IS_ADDR_LOOPBACK
+#undef __IN_IS_ADDR_LOOPBACK
} else if (inp->inp_vflag & INP_IPV6) {
if ((inp->inp_fport == 0 && !opt_l) ||
(inp->inp_fport != 0 && !opt_c))
@@ -1003,7 +1012,7 @@ displaysock(struct sock *s, int pos)
case AF_UNIX:
if ((laddr == NULL) || (faddr == NULL))
errx(1, "laddr = %p or faddr = %p is NULL",
- (void *)laddr, (void *)faddr);
+ (void *)laddr, (void *)faddr);
/* server */
if (laddr->address.ss_len > 0) {
pos += printaddr(&laddr->address);
@@ -1018,15 +1027,14 @@ displaysock(struct sock *s, int pos)
pos += xprintf("-> ");
for (hash = 0; hash < HASHSIZE; ++hash) {
for (s_tmp = sockhash[hash];
- s_tmp != NULL;
- s_tmp = s_tmp->next)
+ s_tmp != NULL;
+ s_tmp = s_tmp->next)
if (s_tmp->pcb == p)
break;
if (s_tmp != NULL)
break;
}
- if (s_tmp == NULL ||
- s_tmp->laddr == NULL ||
+ if (s_tmp == NULL || s_tmp->laddr == NULL ||
s_tmp->laddr->address.ss_len == 0)
pos += xprintf("??");
else
@@ -1144,7 +1152,6 @@ static int set_default_protos(void)
return (pindex);
}
-
static void
usage(void)
{
diff --git a/usr.bin/tail/Makefile b/usr.bin/tail/Makefile
index 672cbed..6366f6f 100644
--- a/usr.bin/tail/Makefile
+++ b/usr.bin/tail/Makefile
@@ -1,7 +1,13 @@
# $FreeBSD$
# @(#)Makefile 8.1 (Berkeley) 6/6/93
+.include <src.opts.mk>
+
PROG= tail
SRCS= forward.c misc.c read.c reverse.c tail.c
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c
index 8726905..88c328a 100644
--- a/usr.bin/tail/reverse.c
+++ b/usr.bin/tail/reverse.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93";
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/mman.h>
@@ -169,12 +170,12 @@ r_reg(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp)
ierr(fn);
}
-typedef struct bf {
- struct bf *next;
- struct bf *prev;
- int len;
- char *l;
-} BF;
+#define BSZ (128 * 1024)
+typedef struct bfelem {
+ TAILQ_ENTRY(bfelem) entries;
+ size_t len;
+ char l[BSZ];
+} bfelem_t;
/*
* r_buf -- display a non-regular file in reverse order by line.
@@ -189,64 +190,44 @@ typedef struct bf {
static void
r_buf(FILE *fp, const char *fn)
{
- BF *mark, *tl, *tr;
- int ch, len, llen;
+ struct bfelem *tl, *first = NULL;
+ size_t llen;
char *p;
- off_t enomem;
+ off_t enomem = 0;
+ TAILQ_HEAD(bfhead, bfelem) head;
+
+ TAILQ_INIT(&head);
+
+ while (!feof(fp)) {
+ size_t len;
- tl = NULL;
-#define BSZ (128 * 1024)
- for (mark = NULL, enomem = 0;;) {
/*
* Allocate a new block and link it into place in a doubly
* linked list. If out of memory, toss the LRU block and
* keep going.
*/
- if (enomem || (tl = malloc(sizeof(BF))) == NULL ||
- (tl->l = malloc(BSZ)) == NULL) {
- if (!mark)
+ while ((tl = malloc(sizeof(bfelem_t))) == NULL) {
+ first = TAILQ_FIRST(&head);
+ if (TAILQ_EMPTY(&head))
err(1, "malloc");
- if (enomem)
- tl = tl->next;
- else {
- if (tl)
- free(tl);
- tl = mark;
- }
- enomem += tl->len;
- } else if (mark) {
- tl->next = mark;
- tl->prev = mark->prev;
- mark->prev->next = tl;
- mark->prev = tl;
- } else {
- mark = tl;
- mark->next = mark->prev = mark;
+ enomem += first->len;
+ TAILQ_REMOVE(&head, first, entries);
+ free(first);
}
+ TAILQ_INSERT_TAIL(&head, tl, entries);
/* Fill the block with input data. */
- for (p = tl->l, len = 0;
- len < BSZ && (ch = getc(fp)) != EOF; ++len)
- *p++ = ch;
-
- if (ferror(fp)) {
- ierr(fn);
- return;
- }
-
- /*
- * If no input data for this block and we tossed some data,
- * recover it.
- */
- if (!len && enomem) {
- enomem -= tl->len;
- tl = tl->prev;
- break;
+ len = 0;
+ while ((!feof(fp)) && len < BSZ) {
+ p = tl->l + len;
+ len += fread(p, 1, BSZ - len, fp);
+ if (ferror(fp)) {
+ ierr(fn);
+ return;
+ }
}
tl->len = len;
- if (ch == EOF)
- break;
}
if (enomem) {
@@ -255,37 +236,46 @@ r_buf(FILE *fp, const char *fn)
}
/*
- * Step through the blocks in the reverse order read. The last char
- * is special, ignore whether newline or not.
+ * Now print the lines in reverse order
+ * Outline:
+ * Scan backward for "\n",
+ * print forward to the end of the buffers
+ * free any buffers that start after the "\n" just found
+ * Loop
*/
- for (mark = tl;;) {
- for (p = tl->l + (len = tl->len) - 1, llen = 0; len--;
- --p, ++llen)
- if (*p == '\n') {
- if (llen) {
+ tl = TAILQ_LAST(&head, bfhead);
+ first = TAILQ_FIRST(&head);
+ while (tl != NULL) {
+ struct bfelem *temp;
+
+ for (p = tl->l + tl->len - 1, llen = 0; p >= tl->l;
+ --p, ++llen) {
+ int start = (tl == first && p == tl->l);
+
+ if ((*p == '\n') || start) {
+ struct bfelem *tr;
+
+ if (start && llen)
+ WR(p, llen + 1);
+ else if (llen)
WR(p + 1, llen);
- llen = 0;
- }
- if (tl == mark)
- continue;
- for (tr = tl->next; tr->len; tr = tr->next) {
- WR(tr->l, tr->len);
- tr->len = 0;
- if (tr == mark)
- break;
+ tr = TAILQ_NEXT(tl, entries);
+ llen = 0;
+ if (tr != NULL) {
+ TAILQ_FOREACH_FROM_SAFE(tr, &head,
+ entries, temp) {
+ if (tr->len)
+ WR(&tr->l, tr->len);
+ TAILQ_REMOVE(&head, tr,
+ entries);
+ free(tr);
+ }
}
}
+ }
tl->len = llen;
- if ((tl = tl->prev) == mark)
- break;
- }
- tl = tl->next;
- if (tl->len) {
- WR(tl->l, tl->len);
- tl->len = 0;
- }
- while ((tl = tl->next)->len) {
- WR(tl->l, tl->len);
- tl->len = 0;
+ tl = TAILQ_PREV(tl, bfhead, entries);
}
+ TAILQ_REMOVE(&head, first, entries);
+ free(first);
}
diff --git a/usr.bin/tail/tests/Makefile b/usr.bin/tail/tests/Makefile
new file mode 100644
index 0000000..84338e2
--- /dev/null
+++ b/usr.bin/tail/tests/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+ATF_TESTS_SH= tail_test
+
+.include <bsd.test.mk>
diff --git a/usr.bin/tail/tests/tail_test.sh b/usr.bin/tail/tests/tail_test.sh
new file mode 100755
index 0000000..3e407ea
--- /dev/null
+++ b/usr.bin/tail/tests/tail_test.sh
@@ -0,0 +1,233 @@
+# Copyright (c) 2016 Alan Somers
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case empty_r
+empty_r_head()
+{
+ atf_set "descr" "Reverse an empty file"
+}
+empty_r_body()
+{
+ touch infile expectfile
+ tail -r infile > outfile
+ tail -r < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case file_r
+file_r_head()
+{
+ atf_set "descr" "Reverse a file"
+}
+file_r_body()
+{
+ cat > infile <<HERE
+This is the first line
+This is the second line
+This is the third line
+HERE
+ cat > expectfile << HERE
+This is the third line
+This is the second line
+This is the first line
+HERE
+ tail -r infile > outfile
+ tail -r < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case file_rn2
+file_rn2_head()
+{
+ atf_set "descr" "Reverse the last two lines of a file"
+}
+file_rn2_body()
+{
+ cat > infile <<HERE
+This is the first line
+This is the second line
+This is the third line
+HERE
+ cat > expectfile << HERE
+This is the third line
+This is the second line
+HERE
+ tail -rn2 infile > outfile
+ tail -rn2 < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case file_rc28
+file_rc28_head()
+{
+ atf_set "descr" "Reverse a file and display the last 28 characters"
+}
+file_rc28_body()
+{
+ cat > infile <<HERE
+This is the first line
+This is the second line
+This is the third line
+HERE
+ cat > expectfile << HERE
+This is the third line
+line
+HERE
+ tail -rc28 infile > outfile
+ tail -rc28 < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case longfile_r
+longfile_r_head()
+{
+ atf_set "descr" "Reverse a long file"
+}
+longfile_r_body()
+{
+ jot -w "%0511d" 1030 0 > infile
+ jot -w "%0511d" 1030 1029 0 -1 > expectfile
+ tail -r infile > outfile
+ tail -r < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case longfile_r_enomem
+longfile_r_enomem_head()
+{
+ atf_set "descr" "Reverse a file that's too long to store in RAM"
+}
+longfile_r_enomem_body()
+{
+ # When we reverse a file that's too long for RAM, tail should drop the
+ # first part and just print what it can. We'll check that the last
+ # part is ok
+ {
+ ulimit -v 32768 || atf_skip "Can't adjust ulimit"
+ jot -w "%01023d" 32768 0 | tail -r > outfile ;
+ }
+ if [ "$?" -ne 1 ]; then
+ atf_skip "Didn't get ENOMEM. Adjust test parameters"
+ fi
+ # We don't know how much of the input we dropped. So just check that
+ # the first ten lines of tail's output are the same as the last ten of
+ # the input
+ jot -w "%01023d" 10 32767 0 -1 > expectfile
+ head -n 10 outfile > outtrunc
+ diff expectfile outtrunc
+ atf_check cmp expectfile outtrunc
+}
+
+atf_test_case longfile_r_longlines
+longfile_r_longlines_head()
+{
+ atf_set "descr" "Reverse a long file with extremely long lines"
+}
+longfile_r_longlines_body()
+{
+ jot -s " " -w "%07d" 18000 0 > infile
+ jot -s " " -w "%07d" 18000 18000 >> infile
+ jot -s " " -w "%07d" 18000 36000 >> infile
+ jot -s " " -w "%07d" 18000 36000 > expectfile
+ jot -s " " -w "%07d" 18000 18000 >> expectfile
+ jot -s " " -w "%07d" 18000 0 >> expectfile
+ tail -r infile > outfile
+ tail -r < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case longfile_rc135782
+longfile_rc135782_head()
+{
+ atf_set "descr" "Reverse a long file and print the last 135,782 bytes"
+}
+longfile_rc135782_body()
+{
+ jot -w "%063d" 9000 0 > infile
+ jot -w "%063d" 2121 8999 0 -1 > expectfile
+ echo "0000000000000000000000000000000006878" >> expectfile
+ tail -rc135782 infile > outfile
+ tail -rc135782 < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case longfile_rc145782_longlines
+longfile_rc145782_longlines_head()
+{
+ atf_set "descr" "Reverse a long file with extremely long lines and print the last 145,782 bytes"
+}
+longfile_rc145782_longlines_body()
+{
+ jot -s " " -w "%07d" 18000 0 > infile
+ jot -s " " -w "%07d" 18000 18000 >> infile
+ jot -s " " -w "%07d" 18000 36000 >> infile
+ jot -s " " -w "%07d" 18000 36000 > expectfile
+ echo -n "35777 " >> expectfile
+ jot -s " " -w "%07d" 222 35778 >> expectfile
+ tail -rc145782 infile > outfile
+ tail -rc145782 < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+atf_test_case longfile_rn2500
+longfile_rn2500_head()
+{
+ atf_set "descr" "Reverse a long file and print the last 2,500 lines"
+}
+longfile_rn2500_body()
+{
+ jot -w "%063d" 9000 0 > infile
+ jot -w "%063d" 2500 8999 0 -1 > expectfile
+ tail -rn2500 infile > outfile
+ tail -rn2500 < infile > outpipe
+ atf_check cmp expectfile outfile
+ atf_check cmp expectfile outpipe
+}
+
+
+atf_init_test_cases()
+{
+ atf_add_test_case empty_r
+ atf_add_test_case file_r
+ atf_add_test_case file_rc28
+ atf_add_test_case file_rn2
+ # The longfile tests are designed to exercise behavior in r_buf(),
+ # which operates on 128KB blocks
+ atf_add_test_case longfile_r
+ atf_add_test_case longfile_r_enomem
+ atf_add_test_case longfile_r_longlines
+ atf_add_test_case longfile_rc135782
+ atf_add_test_case longfile_rc145782_longlines
+ atf_add_test_case longfile_rn2500
+}
diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1
index c9e838b..f4532b1 100644
--- a/usr.bin/timeout/timeout.1
+++ b/usr.bin/timeout/timeout.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 17, 2017
+.Dd February 20, 2017
.Dt TIMEOUT 1
.Os
.Sh NAME
@@ -68,7 +68,9 @@ By default,
.Ar SIGTERM .
is sent.
.It Fl k Ar time , Fl -kill-after Ar time
-Send a second kill signal if
+Send a
+.Ar SIGKILL
+signal if
.Ar command
is still running after
.Ar time
diff --git a/usr.bin/uniq/Makefile b/usr.bin/uniq/Makefile
index 2bcf18e..c6ca369 100644
--- a/usr.bin/uniq/Makefile
+++ b/usr.bin/uniq/Makefile
@@ -1,6 +1,12 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
+.include <src.opts.mk>
+
PROG= uniq
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/uniq/tests/Makefile b/usr.bin/uniq/tests/Makefile
new file mode 100644
index 0000000..06a384e
--- /dev/null
+++ b/usr.bin/uniq/tests/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+NETBSD_ATF_TESTS_SH= uniq_test
+
+${PACKAGE}FILES+= d_basic.in
+${PACKAGE}FILES+= d_basic.out
+${PACKAGE}FILES+= d_counts.out
+${PACKAGE}FILES+= d_input.in
+${PACKAGE}FILES+= d_show_duplicates.out
+${PACKAGE}FILES+= d_show_uniques.out
+
+.include <netbsd-tests.test.mk>
+
+.include <bsd.test.mk>
diff --git a/usr.bin/uniq/tests/Makefile.depend b/usr.bin/uniq/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/usr.bin/uniq/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/usr.bin/vi/catalog/Makefile b/usr.bin/vi/catalog/Makefile
index a045dbc..ba2fa9c 100644
--- a/usr.bin/vi/catalog/Makefile
+++ b/usr.bin/vi/catalog/Makefile
@@ -39,7 +39,7 @@ CAT+= $c.UTF-8
${c}: ${c}.base
echo "... $c"; \
rm -f $c; \
- env LANG=C sort -u ${.ALLSRC} | \
+ env LC_ALL=C sort -u ${.ALLSRC} | \
awk '{ \
if ($$1 == 1) { \
print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \
@@ -86,13 +86,13 @@ ${c}.check: ${c}.base
echo =========================; \
echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):"; \
for j in \
- `sed '/^$$/d' < $$f.base | LANG=C sort -u | \
+ `sed '/^$$/d' < $$f.base | LC_ALL=C sort -u | \
awk '{print $$1}' | uniq -d`; do \
egrep $$j $$f.base; \
done; \
echo =========================; \
echo "Duplicate messages, both id and message (this is okay):"; \
- sed '/^$$/d' < $$f.base | LANG=C sort | uniq -c | \
+ sed '/^$$/d' < $$f.base | LC_ALL=C sort | uniq -c | \
awk '$$1 != 1 { print $$0 }' | sort -n; \
echo =========================) > $c
.endfor
diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c
index 1bcd091..05225f6 100644
--- a/usr.sbin/camdd/camdd.c
+++ b/usr.sbin/camdd/camdd.c
@@ -420,9 +420,9 @@ struct camdd_dev {
};
static sem_t camdd_sem;
-static int need_exit = 0;
-static int error_exit = 0;
-static int need_status = 0;
+static sig_atomic_t need_exit = 0;
+static sig_atomic_t error_exit = 0;
+static sig_atomic_t need_status = 0;
#ifndef min
#define min(a, b) (a < b) ? a : b
@@ -712,11 +712,7 @@ camdd_alloc_buf(struct camdd_dev *dev, camdd_buf_type buf_type)
return (buf);
bailout_error:
- if (data_ptr != NULL)
- free(data_ptr);
-
- if (buf != NULL)
- free(buf);
+ free(data_ptr);
return (NULL);
}
@@ -2262,6 +2258,7 @@ camdd_file_run(struct camdd_dev *dev)
if (file_dev->tmp_buf == NULL) {
buf->status = CAMDD_STATUS_ERROR;
error_count++;
+ pthread_mutex_lock(&dev->mutex);
goto bailout;
}
for (i = 0, cur_offset = 0; i < data->sg_count; i++) {
@@ -2984,7 +2981,6 @@ int
camdd_rw(struct camdd_io_opts *io_opts, int num_io_opts, uint64_t max_io,
int retry_count, int timeout)
{
- char *device = NULL;
struct cam_device *new_cam_dev = NULL;
struct camdd_dev *devs[2];
struct timespec start_time;
@@ -3004,12 +3000,11 @@ camdd_rw(struct camdd_io_opts *io_opts, int num_io_opts, uint64_t max_io,
for (i = 0; i < num_io_opts; i++) {
switch (io_opts[i].dev_type) {
case CAMDD_DEV_PASS: {
- camdd_argmask new_arglist = CAMDD_ARG_NONE;
- int bus = 0, target = 0, lun = 0;
- char name[30];
- int rv;
-
if (isdigit(io_opts[i].dev_name[0])) {
+ camdd_argmask new_arglist = CAMDD_ARG_NONE;
+ int bus = 0, target = 0, lun = 0;
+ int rv;
+
/* device specified as bus:target[:lun] */
rv = parse_btl(io_opts[i].dev_name, &bus,
&target, &lun, &new_arglist);
@@ -3025,23 +3020,21 @@ camdd_rw(struct camdd_io_opts *io_opts, int num_io_opts, uint64_t max_io,
lun = 0;
new_arglist |= CAMDD_ARG_LUN;
}
+ new_cam_dev = cam_open_btl(bus, target, lun,
+ O_RDWR, NULL);
} else {
+ char name[30];
+
if (cam_get_device(io_opts[i].dev_name, name,
sizeof name, &unit) == -1) {
warnx("%s", cam_errbuf);
error = 1;
goto bailout;
}
- device = strdup(name);
- new_arglist |= CAMDD_ARG_DEVICE |CAMDD_ARG_UNIT;
+ new_cam_dev = cam_open_spec_device(name, unit,
+ O_RDWR, NULL);
}
- if (new_arglist & (CAMDD_ARG_BUS | CAMDD_ARG_TARGET))
- new_cam_dev = cam_open_btl(bus, target, lun,
- O_RDWR, NULL);
- else
- new_cam_dev = cam_open_spec_device(device, unit,
- O_RDWR, NULL);
if (new_cam_dev == NULL) {
warnx("%s", cam_errbuf);
error = 1;
diff --git a/usr.sbin/ntp/doc/ntp.conf.5 b/usr.sbin/ntp/doc/ntp.conf.5
index 22c0cd3..5a86a39 100644
--- a/usr.sbin/ntp/doc/ntp.conf.5
+++ b/usr.sbin/ntp/doc/ntp.conf.5
@@ -13,10 +13,6 @@
.Nd Network Time Protocol (NTP) daemon configuration file format
.Sh SYNOPSIS
.Nm
-.Op Fl \-option\-name
-.Op Fl \-option\-name Ar value
-.Pp
-All arguments must be options.
.Pp
.Sh DESCRIPTION
The
diff --git a/usr.sbin/ntp/doc/ntp.keys.5 b/usr.sbin/ntp/doc/ntp.keys.5
index 4dba058..7c4e50a 100644
--- a/usr.sbin/ntp/doc/ntp.keys.5
+++ b/usr.sbin/ntp/doc/ntp.keys.5
@@ -11,10 +11,6 @@
.Sh NAME
.Nm ntp.keys
.Nd NTP symmetric key file format
-
-.Sh NAME
-.Nm ntp.keys
-.Nd NTP symmetric key file format
.Sh SYNOPSIS
.Nm
.Op Fl \-option\-name
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 90a492f..41f8fe3 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1062,6 +1062,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len)
iov[0].iov_len = len;
m.msg_iov = iov;
m.msg_iovlen = 1;
+ m.msg_flags = 0;
if (!idx) {
m.msg_control = NULL;
m.msg_controllen = 0;
@@ -1126,6 +1127,7 @@ riprecv(void)
cm = (struct cmsghdr *)cmsgbuf;
m.msg_control = (caddr_t)cm;
m.msg_controllen = sizeof(cmsgbuf);
+ m.msg_flags = 0;
if ((len = recvmsg(ripsock, &m, 0)) < 0) {
fatal("recvmsg");
/*NOTREACHED*/
diff --git a/usr.sbin/syslogd/Makefile b/usr.sbin/syslogd/Makefile
index 716efbe..d116e3c 100644
--- a/usr.sbin/syslogd/Makefile
+++ b/usr.sbin/syslogd/Makefile
@@ -3,7 +3,7 @@
.include <src.opts.mk>
-.PATH: ${.CURDIR}/../../usr.bin/wall
+.PATH: ${SRCTOP}/usr.bin/wall
PROG= syslogd
MAN= syslog.conf.5 syslogd.8
@@ -17,6 +17,6 @@ WARNS?= 3
CFLAGS+= -DINET6
.endif
-CFLAGS+= -I${.CURDIR}/../../usr.bin/wall
+CFLAGS+= -I${SRCTOP}/usr.bin/wall
.include <bsd.prog.mk>
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 7603be8..7104096 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$");
* Priority comparison code by Harlan Stenn.
*/
+/* Maximum number of characters in time of last occurrence */
+#define MAXDATELEN 16
#define MAXLINE 1024 /* maximum line length */
#define MAXSVLINE MAXLINE /* maximum saved line length */
#define DEFUPRI (LOG_USER|LOG_NOTICE)
@@ -205,7 +207,7 @@ struct filed {
} f_ring;
} f_un;
char f_prevline[MAXSVLINE]; /* last message logged */
- char f_lasttime[16]; /* time of last occurrence */
+ char f_lasttime[MAXDATELEN]; /* time of last occurrence */
char f_prevhost[MAXHOSTNAMELEN]; /* host from which recd. */
int f_prevpri; /* pri of f_prevline */
int f_prevlen; /* length of f_prevline */
@@ -986,7 +988,7 @@ logmsg(int pri, const char *msg, const char *from, int flags)
* Check to see if msg looks non-standard.
*/
msglen = strlen(msg);
- if (msglen < 16 || msg[3] != ' ' || msg[6] != ' ' ||
+ if (msglen < MAXDATELEN || msg[3] != ' ' || msg[6] != ' ' ||
msg[9] != ':' || msg[12] != ':' || msg[15] != ' ')
flags |= ADDDATE;
@@ -995,8 +997,8 @@ logmsg(int pri, const char *msg, const char *from, int flags)
timestamp = ctime(&now) + 4;
} else {
timestamp = msg;
- msg += 16;
- msglen -= 16;
+ msg += MAXDATELEN;
+ msglen -= MAXDATELEN;
}
/* skip leading blanks */
OpenPOWER on IntegriCloud