Merge head up to r263906.

This commit is contained in:
Martin Matuska 2014-03-29 08:39:53 +00:00
commit 1709ccf9d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/pf/head/; revision=263907
4705 changed files with 197688 additions and 184289 deletions

View File

@ -77,12 +77,11 @@ ntp roberto Pre-commit review requested.
inetd dwmalone Recommends pre-commit review.
contrib/smbfs bp Open for in-tree committs. In case of functional
changes pre-commit review requested.
contrib/pf mlaier Pre-commit review requested.
contrib/pf glebius Pre-commit review recommended.
binutils obrien Insists on BU blocked from unapproved commits
file obrien Insists to keep file blocked from other's unapproved
commits
contrib/bzip2 obrien Pre-commit review required.
lukemftpd obrien Pre-commit review required.
geom_concat pjd Pre-commit review preferred.
geom_eli pjd Pre-commit review preferred.
geom_gate pjd Pre-commit review preferred.
@ -130,3 +129,6 @@ sh(1) jilles Pre-commit review requested. This also applies
nvme(4) jimharris Pre-commit review requested.
nvd(4) jimharris Pre-commit review requested.
nvmecontrol(8) jimharris Pre-commit review requested.
release/release.sh gjb Pre-commit review and regression tests
requested.
nanobsd imp Pre-commit review requested for coordination.

View File

@ -164,7 +164,7 @@ _MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=$
_TARGET_ARCH= ${TARGET:S/pc98/i386/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/}
.endif
# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
.if defined(TARGET) && defined(TARGET_ARCH) && \
@ -374,7 +374,7 @@ kernel-toolchains:
#
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
TARGET_ARCHES_arm?= arm armeb armv6
TARGET_ARCHES_arm?= arm armeb armv6 armv6hf
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32
TARGET_ARCHES_powerpc?= powerpc powerpc64
TARGET_ARCHES_pc98?= i386

View File

@ -132,14 +132,14 @@ OSRELDATE= 0
.endif
.if !defined(VERSION)
REVISION!= make -C ${SRCDIR}/release -V REVISION
BRANCH!= make -C ${SRCDIR}/release -V BRANCH
REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
${SRCDIR}/sys/sys/param.h
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
.endif
KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else
@ -231,6 +231,9 @@ CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
.endif
.if defined(TARGET_CFLAGS)
CROSSENV+= ${TARGET_CFLAGS}
.endif
# bootstrap-tools stage
BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
@ -348,6 +351,8 @@ XFLAGS+= -B${WORLDTMP}/usr/bin
.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
${MK_ARM_EABI} != "no"
TARGET_ABI= gnueabi
.elif ${TARGET_ARCH} == "armv6hf"
TARGET_ABI= gnueabihf
.else
TARGET_ABI= unknown
.endif
@ -1012,7 +1017,7 @@ buildkernel:
cd ${KRNLCONFDIR}; \
PATH=${TMPPATH} \
config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
${KERNCONFDIR}/${_kernel}
-I ${KERNCONFDIR} ${KERNCONFDIR}/${_kernel}
.endif
.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
@echo
@ -1262,7 +1267,7 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
.endif
# Default to building the BSDL DTC, but build the GPL one if users explicitly
# Default to building the GPL DTC, but build the BSDL one if users explicitly
# request it.
_dtc= usr.bin/dtc
.if ${MK_GPL_DTC} != "no"
@ -1486,7 +1491,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_lib_atf} \
lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libelf lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
${_lib_libgssapi} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
${_lib_libcapsicum} \
lib/ncurses/ncurses lib/ncurses/ncursesw \
@ -1588,10 +1593,6 @@ kerberos5/lib/libheimsqlite__L: lib/libthr__L
_lib_libgssapi= lib/libgssapi
.endif
.if ${MK_IPX} != "no"
_lib_libipx= lib/libipx
.endif
.if ${MK_KERBEROS} != "no"
_kerberos5_lib= kerberos5/lib
_kerberos5_lib_libasn1= kerberos5/lib/libasn1
@ -1853,7 +1854,7 @@ builddtb:
echo "ERROR: FDT_DTS_FILE must be specified!"; \
exit 1; \
fi; \
if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; then \
echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
exist!"; \
exit 1; \
@ -1863,9 +1864,9 @@ builddtb:
directory"; \
fi
@PATH=${TMPPATH} \
dtc -O dtb -o \
${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
-p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
${FDT_DTS_FILE} \
${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts`
###############
@ -1898,7 +1899,7 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
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}
XDDESTDIR=${DESTDIR}/${XDTP}
XDDESTDIR?=${DESTDIR}/${XDTP}
.if !defined(OSREL)
OSREL!= uname -r | sed -e 's/[-(].*//'
.endif

View File

@ -38,6 +38,52 @@
# xargs -n1 | sort | uniq -d;
# done
# 20140314: AppleTalk
OLD_DIRS+=usr/include/netatalk
OLD_FILES+=usr/include/netatalk/aarp.h
OLD_FILES+=usr/include/netatalk/at.h
OLD_FILES+=usr/include/netatalk/at_extern.h
OLD_FILES+=usr/include/netatalk/at_var.h
OLD_FILES+=usr/include/netatalk/ddp.h
OLD_FILES+=usr/include/netatalk/ddp_pcb.h
OLD_FILES+=usr/include/netatalk/ddp_var.h
OLD_FILES+=usr/include/netatalk/endian.h
OLD_FILES+=usr/include/netatalk/phase2.h
# 20140314: Remove IPX/SPX
OLD_LIBS+=lib/libipx.so.5
OLD_FILES+=usr/include/netipx/ipx.h
OLD_FILES+=usr/include/netipx/ipx_if.h
OLD_FILES+=usr/include/netipx/ipx_pcb.h
OLD_FILES+=usr/include/netipx/ipx_var.h
OLD_FILES+=usr/include/netipx/spx.h
OLD_FILES+=usr/include/netipx/spx_debug.h
OLD_FILES+=usr/include/netipx/spx_timer.h
OLD_FILES+=usr/include/netipx/spx_var.h
OLD_DIRS+=usr/include/netipx
OLD_FILES+=usr/lib/libipx.a
OLD_FILES+=usr/lib/libipx.so
OLD_FILES+=usr/lib/libipx_p.a
OLD_FILES+=usr/lib32/libipx.a
OLD_FILES+=usr/lib32/libipx.so
OLD_LIBS+=usr/lib32/libipx.so.5
OLD_FILES+=usr/lib32/libipx_p.a
OLD_FILES+=usr/sbin/IPXrouted
OLD_FILES+=usr/share/man/man3/ipx.3.gz
OLD_FILES+=usr/share/man/man3/ipx_addr.3.gz
OLD_FILES+=usr/share/man/man3/ipx_ntoa.3.gz
OLD_FILES+=usr/share/man/man4/ef.4.gz
OLD_FILES+=usr/share/man/man4/if_ef.4.gz
OLD_FILES+=usr/share/man/man8/IPXrouted.8.gz
# 20140314: bsdconfig usermgmt rewrite
OLD_FILES+=usr/libexec/bsdconfig/070.usermgmt/userinput
# 20140307: bsdconfig groupmgmt rewrite
OLD_FILES+=usr/libexec/bsdconfig/070.usermgmt/groupinput
# 20140223: Remove libyaml
OLD_FILES+=usr/lib/private/libyaml.a
OLD_FILES+=usr/lib/private/libyaml.so
OLD_FILES+=usr/lib/private/libyaml.so.1
OLD_FILES+=usr/lib/private/libyaml_p.a
# 20140216: new clang import which bumps version from 3.3 to 3.4.
OLD_FILES+=usr/bin/llvm-prof
OLD_FILES+=usr/bin/llvm-ranlib
@ -75,6 +121,9 @@ OLD_FILES+=usr/include/clang/3.3/xopintrin.h
OLD_FILES+=usr/share/man/man1/llvm-prof.1.gz
OLD_FILES+=usr/share/man/man1/llvm-ranlib.1.gz
OLD_DIRS+=usr/include/clang/3.3
# 20140216: nve(4) removed
OLD_FILES+=usr/share/man/man4/if_nve.4.gz
OLD_FILES+=usr/share/man/man4/nve.4.gz
# 20140205: Open Firmware device moved
OLD_FILES+=usr/include/dev/ofw/ofw_nexus.h
# 20140128: libelf and libdwarf import

View File

@ -31,9 +31,39 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20140325:
It is no longer necessary to include the dwarf version in your DEBUG
options in your kernel config file. The bug that required it to be
placed in the config file has bene fixed. DEBUG should now just
contain -g. The build system will automatically update things
to do the right thing. Ignore the entry from 20140216.
20140306:
Support for libwrap (TCP wrappers) in rpcbind was disabled by default
to improve performance. To re-enable it, if needed, run rpcbind
with command line option -W.
20140226:
Switched back to the GPL dtc compiler due to updates in the upstream
dts files not being supported by the BSDL dtc compiler. You will need
to rebuild your kernel toolchain to pick up the new compiler. Core dumps
may result while building dtb files during a kernel build if you fail
to do so. Set WITHOUT_GPL_DTC if you require the BSDL compiler.
20140216:
Clang and llvm have been upgraded to 3.4 release.
Please note that clang 3.4 now defaults to DWARF4 debug information
format when you specify -g. Since kgdb(1) only supports DWARF2, you
should update any customized kernel configurations which include debug
information to explicitly use -gdwarf-2, e.g:
makeoptions DEBUG=-gdwarf-2
This has already been applied to the appropriate GENERIC configuration
files, so if you inherit from those, no changes are required.
Please note: this bug has been fixed, please see 20140325.
20140216:
The nve(4) driver has been removed. Please use the nfe(4) driver
for NVIDIA nForce MCP Ethernet adapters instead.
@ -45,6 +75,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
has now been fixed, but any C++ applications or shared libraries built
between r261283 and r261801 should be recompiled.
20140204:
OpenSSH will now ignore errors caused by kernel lacking of Capsicum
capability mode support. Please note that enabling the feature in
kernel is still highly recommended.
20140131:
OpenSSH is now built with sandbox support, and will use sandbox as
the default privilege separation method. This requires Capsicum
capability mode support in kernel.
20140128:
The libelf and libdwarf libraries have been updated to newer
versions from upstream. Shared library version numbers for
@ -1953,9 +1993,9 @@ COMMON ITEMS:
make kernel KERNCONF=YOUR_KERNEL_HERE
[1]
<reboot in single user> [3]
mergemaster -p [5]
mergemaster -Fp [5]
make installworld
mergemaster -i [4]
mergemaster -Fi [4]
make delete-old [6]
<reboot>
@ -1990,9 +2030,9 @@ COMMON ITEMS:
make kernel KERNCONF=YOUR_KERNEL_HERE [8]
[1]
<reboot in single user> [3]
mergemaster -p [5]
mergemaster -Fp [5]
make installworld
mergemaster -i [4]
mergemaster -Fi [4]
make delete-old [6]
<reboot>

View File

@ -60,4 +60,6 @@ SUBDIR+= tests
SUBDIR:= ${SUBDIR:O}
SUBDIR_PARALLEL=
.include <bsd.subdir.mk>

View File

@ -6,4 +6,4 @@ TESTSDIR= ${TESTSBASE}/bin/date
TAP_TESTS_SH= legacy_test
.include <tap.test.mk>
.include <bsd.test.mk>

View File

@ -67,7 +67,7 @@ static void usage(void);
int
main(int argc, char *argv[])
{
int errors, numsig, pid;
int errors, numsig, pid, ret;
char *ep;
if (argc < 2)
@ -134,15 +134,16 @@ main(int argc, char *argv[])
for (errors = 0; argc; argc--, argv++) {
#ifdef SHELL
if (**argv == '%')
pid = getjobpgrp(*argv);
ret = killjob(*argv, numsig);
else
#endif
{
pid = strtol(*argv, &ep, 10);
if (!**argv || *ep)
errx(2, "illegal process id: %s", *argv);
ret = kill(pid, numsig);
}
if (kill(pid, numsig) == -1) {
if (ret == -1) {
warn("%s", *argv);
errors = 1;
}

View File

@ -6,4 +6,4 @@ TESTSDIR= ${TESTSBASE}/bin/mv
TAP_TESTS_SH= legacy_test
.include <tap.test.mk>
.include <bsd.test.mk>

View File

@ -6,4 +6,4 @@ TESTSDIR= ${TESTSBASE}/bin/pax
TAP_TESTS_PERL= legacy_test
.include <tap.test.mk>
.include <bsd.test.mk>

View File

@ -1,6 +1,8 @@
# $NetBSD: Makefile,v 1.1 2002/03/01 11:21:58 ad Exp $
# $FreeBSD$
.include <bsd.own.mk>
PROG= pkill
DPADD= ${LIBKVM}
@ -17,4 +19,8 @@ MLINKS= pkill.1 pgrep.1
SYMLINKS= ${BINDIR}/pkill /usr/bin/pkill
SYMLINKS+= ${BINDIR}/pgrep /usr/bin/pgrep
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
.include <bsd.prog.mk>

38
bin/pkill/tests/Makefile Normal file
View File

@ -0,0 +1,38 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/pkill
TAP_TESTS_SH= pgrep-F_test
TAP_TESTS_SH+= pgrep-LF_test
TAP_TESTS_SH+= pgrep-P_test
TAP_TESTS_SH+= pgrep-U_test
TAP_TESTS_SH+= pgrep-_g_test
TAP_TESTS_SH+= pgrep-_s_test
TAP_TESTS_SH+= pgrep-g_test
TAP_TESTS_SH+= pgrep-i_test
TAP_TESTS_SH+= pgrep-j_test
TEST_METADATA.pgrep-j_test+= required_user="root"
TAP_TESTS_SH+= pgrep-l_test
TAP_TESTS_SH+= pgrep-n_test
TAP_TESTS_SH+= pgrep-o_test
TAP_TESTS_SH+= pgrep-q_test
TAP_TESTS_SH+= pgrep-s_test
TAP_TESTS_SH+= pgrep-t_test
TAP_TESTS_SH+= pgrep-v_test
TAP_TESTS_SH+= pgrep-x_test
TAP_TESTS_SH+= pkill-F_test
TAP_TESTS_SH+= pkill-LF_test
TAP_TESTS_SH+= pkill-P_test
TAP_TESTS_SH+= pkill-U_test
TAP_TESTS_SH+= pkill-_g_test
TAP_TESTS_SH+= pkill-g_test
TAP_TESTS_SH+= pkill-i_test
TAP_TESTS_SH+= pkill-j_test
TEST_METADATA.pkill-j_test+= required_user="root"
TAP_TESTS_SH+= pkill-s_test
TAP_TESTS_SH+= pkill-t_test
TAP_TESTS_SH+= pkill-x_test
.include <bsd.test.mk>

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..1"
name="pgrep -F <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
pidfile=$(pwd)/pidfile.txt
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pgrep -LF <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
pidfile=$(pwd)/pidfile.txt
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
daemon -p $pidfile $sleep 5
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..1"
name="pgrep -P <ppid>"
ppid=$$
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -U <uid>"
ruid=`id -ur`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -23,7 +23,7 @@ rm -f $sleep
name="pgrep -U <user>"
ruid=`id -urn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -G <gid>"
rgid=`id -gr`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -23,7 +23,7 @@ rm -f $sleep
name="pgrep -G <group>"
rgid=`id -grn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -5,15 +5,17 @@ base=`basename $0`
echo "1..2"
exp_pid="$(ps ax | grep '\[idle\]' | awk '{print $1}')"
name="pgrep -S"
pid=`pgrep -Sx g_event`
if [ "$pid" = "2" ]; then
pid=`pgrep -Sx idle`
if [ "$pid" = "$exp_pid" ]; then
echo "ok 1 - $name"
else
echo "not ok 1 - $name"
fi
pid=`pgrep -x g_event`
if [ "$pid" != "2" ]; then
pid=`pgrep -x idle`
if [ "$pid" != "$exp_pid" ]; then
echo "ok 2 - $name"
else
echo "not ok 2 - $name"

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -g <pgrp>"
pgrp=`ps -o tpgid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -22,7 +22,7 @@ kill $chpid
rm -f $sleep
name="pgrep -g 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1"
name="pgrep -i"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
usleep="${sleep}XXX"
touch $usleep
lsleep="${sleep}xxx"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pgrep -j <jid>"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$!
@ -31,7 +31,7 @@ fi
name="pgrep -j any"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$!
@ -55,7 +55,7 @@ fi
name="pgrep -j none"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
chpid=$!

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1"
name="pgrep -l"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1"
name="pgrep -n"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
oldpid=$!

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1"
name="pgrep -o"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
oldpid=$!

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..4"
name="pgrep -q"
sleep0=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep1=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep0=$(pwd)/sleep0.txt
sleep1=$(pwd)/sleep1.txt
ln -sf /bin/sleep $sleep0
$sleep0 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -s <sid>"
sid=`ps -o tsid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -22,7 +22,7 @@ kill $chpid
rm -f $sleep
name="pgrep -s 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pgrep -t <tty>"
tty=`ps -o tty -p $$ | tail -1`
if [ "$tty" = "??" ]; then
tty=`ps -x -o tty -p $$ | tail -1`
if [ "$tty" = "??" -o "$tty" = "-" ]; then
tty="-"
ttyshort="-"
else
@ -16,7 +16,7 @@ else
*) ttyshort=`echo $tty | cut -c 4-` ;;
esac
fi
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..2"
name="pgrep -v"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..4"
name="pgrep -x"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..1"
name="pkill -F <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
pidfile=$(pwd)/pidfile.txt
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pkill -LF <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
pidfile=$(pwd)/pidfile.txt
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
daemon -p $pidfile $sleep 5
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..1"
name="pkill -P <ppid>"
ppid=$$
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -U <uid>"
ruid=`id -ur`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -25,7 +25,7 @@ rm -f $sleep
name="pkill -U <user>"
ruid=`id -urn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -G <gid>"
rgid=`id -gr`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -25,7 +25,7 @@ rm -f $sleep
name="pkill -G <group>"
rgid=`id -grn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -g <pgrp>"
pgrp=`ps -o tpgid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -24,7 +24,7 @@ esac
rm -f $sleep
name="pkill -g 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1"
name="pkill -i"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
usleep="${sleep}XXX"
touch $usleep
lsleep="${sleep}xxx"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pkill -j <jid>"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$!
@ -30,7 +30,7 @@ fi
name="pkill -j any"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$!
@ -52,7 +52,7 @@ fi
name="pkill -j none"
if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
chpid=$!

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -s <sid>"
sid=`ps -o tsid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -24,7 +24,7 @@ esac
rm -f $sleep
name="pkill -s 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pkill -t <tty>"
tty=`ps -o tty -p $$ | tail -1`
if [ "$tty" = "??" ]; then
tty=`ps -x -o tty -p $$ | tail -1`
if [ "$tty" = "??" -o "$tty" = "-" ]; then
tty="-"
ttyshort="-"
else
@ -16,7 +16,7 @@ else
*) ttyshort=`echo $tty | cut -c 4-` ;;
esac
fi
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..4"
name="pkill -x"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
@ -25,7 +25,7 @@ fi
rm -f $sleep
name="pkill -x -f"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -180,6 +180,7 @@ printaliases(void)
int i, j;
struct alias **sorted, *ap;
INTOFF;
sorted = ckmalloc(aliases * sizeof(*sorted));
j = 0;
for (i = 0; i < ATABSIZE; i++)
@ -187,9 +188,13 @@ printaliases(void)
if (*ap->name != '\0')
sorted[j++] = ap;
qsort(sorted, aliases, sizeof(*sorted), comparealiases);
for (i = 0; i < aliases; i++)
for (i = 0; i < aliases; i++) {
printalias(sorted[i]);
if (int_pending())
break;
}
ckfree(sorted);
INTON;
}
int

View File

@ -74,6 +74,6 @@
pointer stalloc(int);
void error(const char *, ...) __printf0like(1, 2);
pid_t getjobpgrp(char *);
int killjob(const char *, int);
extern char *commandname;

View File

@ -612,6 +612,7 @@ defun(const char *name, union node *func)
/*
* Delete a function if it exists.
* Called with interrupts off.
*/
int

View File

@ -98,13 +98,14 @@ static struct ifsregion ifsfirst; /* first struct in list of ifs regions */
static struct ifsregion *ifslastp; /* last struct in list */
static struct arglist exparg; /* holds expanded arg list */
static void argstr(char *, int);
static char *argstr(char *, int);
static char *exptilde(char *, int);
static char *expari(char *);
static void expbackq(union node *, int, int);
static int subevalvar(char *, char *, int, int, int, int, int);
static char *evalvar(char *, int);
static int varisset(char *, int);
static void varvalue(char *, int, int, int);
static int varisset(const char *, int);
static void varvalue(const char *, int, int, int);
static void recordregion(int, int, int);
static void removerecordregions(int);
static void ifsbreakup(char *, struct arglist *);
@ -206,13 +207,13 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
/*
* Perform parameter expansion, command substitution and arithmetic
* expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE.
* Processing ends at a CTLENDVAR character as well as '\0'.
* Processing ends at a CTLENDVAR or CTLENDARI character as well as '\0'.
* This is used to expand word in ${var+word} etc.
* If EXP_FULL, EXP_CASE or EXP_REDIR are set, keep and/or generate CTLESC
* characters to allow for further processing.
* If EXP_FULL is set, also preserve CTLQUOTEMARK characters.
*/
static void
static char *
argstr(char *p, int flag)
{
char c;
@ -230,8 +231,10 @@ argstr(char *p, int flag)
CHECKSTRSPACE(2, expdest);
switch (c = *p++) {
case '\0':
return (p - 1);
case CTLENDVAR:
goto breakloop;
case CTLENDARI:
return (p);
case CTLQUOTEMARK:
lit_quoted = 1;
/* "$@" syntax adherence hack */
@ -261,8 +264,8 @@ argstr(char *p, int flag)
expbackq(argbackq->n, c & CTLQUOTE, flag);
argbackq = argbackq->next;
break;
case CTLENDARI:
expari(flag);
case CTLARI:
p = expari(p);
break;
case ':':
case '=':
@ -288,7 +291,6 @@ argstr(char *p, int flag)
expdest - stackblock(), 0);
}
}
breakloop:;
}
/*
@ -387,59 +389,40 @@ removerecordregions(int endoff)
}
/*
* Expand arithmetic expression. Backup to start of expression,
* evaluate, place result in (backed up) result, adjust string position.
* Expand arithmetic expression.
* Note that flag is not required as digits never require CTLESC characters.
*/
void
expari(int flag)
static char *
expari(char *p)
{
char *p, *q, *start;
char *q, *start;
arith_t result;
int begoff;
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
int quoted;
int adj;
/*
* This routine is slightly over-complicated for
* efficiency. First we make sure there is
* enough space for the result, which may be bigger
* than the expression. Next we
* scan backwards looking for the start of arithmetic. If the
* next previous character is a CTLESC character, then we
* have to rescan starting from the beginning since CTLESC
* characters have to be processed left to right.
*/
CHECKSTRSPACE(DIGITS(result) - 2, expdest);
USTPUTC('\0', expdest);
start = stackblock();
p = expdest - 2;
while (p >= start && *p != CTLARI)
--p;
if (p < start || *p != CTLARI)
error("missing CTLARI (shouldn't happen)");
if (p > start && *(p - 1) == CTLESC)
for (p = start; *p != CTLARI; p++)
if (*p == CTLESC)
p++;
if (p[1] == '"')
quoted=1;
else
quoted=0;
begoff = p - start;
quoted = *p++ == '"';
begoff = expdest - stackblock();
p = argstr(p, 0);
removerecordregions(begoff);
if (quotes)
rmescapes(p+2);
STPUTC('\0', expdest);
start = stackblock() + begoff;
q = grabstackstr(expdest);
result = arith(p+2);
result = arith(start);
ungrabstackstr(q, expdest);
fmtstr(p, DIGITS(result), ARITH_FORMAT_STR, result);
while (*p++)
;
if (quoted == 0)
recordregion(begoff, p - 1 - start, 0);
result = expdest - p + 1;
STADJUST(-result, expdest);
start = stackblock() + begoff;
adj = start - expdest;
STADJUST(adj, expdest);
CHECKSTRSPACE((int)(DIGITS(result) + 1), expdest);
fmtstr(expdest, DIGITS(result), ARITH_FORMAT_STR, result);
adj = strlen(expdest);
STADJUST(adj, expdest);
if (!quoted)
recordregion(begoff, expdest - stackblock(), 0);
return p;
}
@ -650,7 +633,7 @@ evalvar(char *p, int flag)
int subtype;
int varflags;
char *var;
char *val;
const char *val;
int patloc;
int c;
int set;
@ -671,10 +654,8 @@ evalvar(char *p, int flag)
again: /* jump here after setting a variable with ${var=text} */
if (varflags & VSLINENO) {
set = 1;
special = 0;
val = var;
p[-1] = '\0'; /* temporarily overwrite '=' to have \0
terminated string */
special = 1;
val = NULL;
} else if (special) {
set = varisset(var, varflags & VSNUL);
val = NULL;
@ -703,7 +684,10 @@ evalvar(char *p, int flag)
if (set && subtype != VSPLUS) {
/* insert the value of the variable */
if (special) {
varvalue(var, varflags & VSQUOTE, subtype, flag);
if (varflags & VSLINENO)
STPUTBIN(var, p - var - 1, expdest);
else
varvalue(var, varflags & VSQUOTE, subtype, flag);
if (subtype == VSLENGTH) {
varlenb = expdest - stackblock() - startloc;
varlen = varlenb;
@ -815,7 +799,6 @@ evalvar(char *p, int flag)
default:
abort();
}
p[-1] = '='; /* recover overwritten '=' */
if (subtype != VSNORMAL) { /* skip to end of alternative */
int nesting = 1;
@ -844,7 +827,7 @@ evalvar(char *p, int flag)
*/
static int
varisset(char *name, int nulok)
varisset(const char *name, int nulok)
{
if (*name == '!')
@ -893,7 +876,7 @@ strtodest(const char *p, int flag, int subtype, int quoted)
*/
static void
varvalue(char *name, int quoted, int subtype, int flag)
varvalue(const char *name, int quoted, int subtype, int flag)
{
int num;
char *p;
@ -973,6 +956,7 @@ recordregion(int start, int end, int inquotes)
{
struct ifsregion *ifsp;
INTOFF;
if (ifslastp == NULL) {
ifsp = &ifsfirst;
} else {
@ -980,6 +964,7 @@ recordregion(int start, int end, int inquotes)
&& ifslastp->inquotes == inquotes) {
/* extend previous area */
ifslastp->endoff = end;
INTON;
return;
}
ifsp = (struct ifsregion *)ckmalloc(sizeof (struct ifsregion));
@ -990,6 +975,7 @@ recordregion(int start, int end, int inquotes)
ifslastp->begoff = start;
ifslastp->endoff = end;
ifslastp->inquotes = inquotes;
INTON;
}

View File

@ -58,6 +58,5 @@ struct arglist {
union node;
void expandarg(union node *, struct arglist *, int);
void expari(int);
void rmescapes(char *);
int casematch(union node *, const char *);

View File

@ -95,9 +95,9 @@ static void restartjob(struct job *);
#endif
static void freejob(struct job *);
static int waitcmdloop(struct job *);
static struct job *getjob_nonotfound(char *);
static struct job *getjob(char *);
pid_t getjobpgrp(char *);
static struct job *getjob_nonotfound(const char *);
static struct job *getjob(const char *);
pid_t killjob(const char *, int);
static pid_t dowait(int, struct job *);
static void checkzombies(void);
static void cmdtxt(union node *);
@ -558,7 +558,7 @@ jobidcmd(int argc __unused, char **argv __unused)
*/
static struct job *
getjob_nonotfound(char *name)
getjob_nonotfound(const char *name)
{
int jobno;
struct job *found, *jp;
@ -628,7 +628,7 @@ currentjob: if ((jp = getcurjob(NULL)) == NULL)
static struct job *
getjob(char *name)
getjob(const char *name)
{
struct job *jp;
@ -639,13 +639,26 @@ getjob(char *name)
}
pid_t
getjobpgrp(char *name)
int
killjob(const char *name, int sig)
{
struct job *jp;
int i, ret;
jp = getjob(name);
return -jp->ps[0].pid;
if (jp->state == JOBDONE)
return 0;
if (jp->jobctl)
return kill(-jp->ps[0].pid, sig);
ret = -1;
errno = ESRCH;
for (i = 0; i < jp->nprocs; i++)
if (jp->ps[i].status == -1 || WIFSTOPPED(jp->ps[i].status)) {
if (kill(jp->ps[i].pid, sig) == 0)
ret = 0;
} else
ret = 0;
return ret;
}
/*
@ -1108,7 +1121,8 @@ dowait(int mode, struct job *job)
for (sp = jp->ps ; sp < jp->ps + jp->nprocs ; sp++) {
if (sp->pid == -1)
continue;
if (sp->pid == pid) {
if (sp->pid == pid && (sp->status == -1 ||
WIFSTOPPED(sp->status))) {
TRACE(("Changing status of proc %d from 0x%x to 0x%x\n",
(int)pid, sp->status,
status));

View File

@ -92,6 +92,13 @@ static int openhere(union node *);
* undone by calling popredir. If the REDIR_BACKQ flag is set, then the
* standard output, and the standard error if it becomes a duplicate of
* stdout, is saved in memory.
*
* We suppress interrupts so that we won't leave open file
* descriptors around. Because the signal handler remains
* installed and we do not use system call restart, interrupts
* will still abort blocking opens such as fifos (they will fail
* with EINTR). There is, however, a race condition if an interrupt
* arrives after INTOFF and before open blocks.
*/
void
@ -103,6 +110,7 @@ redirect(union node *redir, int flags)
int fd;
char memory[10]; /* file descriptors to write to memory */
INTOFF;
for (i = 10 ; --i >= 0 ; )
memory[i] = 0;
memory[1] = flags & REDIR_BACKQ;
@ -139,11 +147,14 @@ redirect(union node *redir, int flags)
INTON;
}
openredirect(n, memory);
INTON;
INTOFF;
}
if (memory[1])
out1 = &memout;
if (memory[2])
out2 = &memout;
INTON;
}
@ -152,19 +163,10 @@ openredirect(union node *redir, char memory[10])
{
struct stat sb;
int fd = redir->nfile.fd;
char *fname;
const char *fname;
int f;
int e;
/*
* We suppress interrupts so that we won't leave open file
* descriptors around. Because the signal handler remains
* installed and we do not use system call restart, interrupts
* will still abort blocking opens such as fifos (they will fail
* with EINTR). There is, however, a race condition if an interrupt
* arrives after INTOFF and before open blocks.
*/
INTOFF;
memory[fd] = 0;
switch (redir->nfile.type) {
case NFROM:
@ -237,7 +239,6 @@ openredirect(union node *redir, char memory[10])
default:
abort();
}
INTON;
}
@ -250,7 +251,7 @@ openredirect(union node *redir, char memory[10])
static int
openhere(union node *redir)
{
char *p;
const char *p;
int pip[2];
size_t len = 0;
int flags;

View File

@ -40,14 +40,14 @@
.Nd command interpreter (shell)
.Sh SYNOPSIS
.Nm
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+abCEefhIimnPpTuVvx
.Op Fl /+o Ar longname
.Oo
.Ar script
.Op Ar arg ...
.Oc
.Nm
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+abCEefhIimnPpTuVvx
.Op Fl /+o Ar longname
.Fl c Ar string
.Oo
@ -55,7 +55,7 @@
.Op Ar arg ...
.Oc
.Nm
.Op Fl /+abCEefIimnPpTuVvx
.Op Fl /+abCEefhIimnPpTuVvx
.Op Fl /+o Ar longname
.Fl s
.Op Ar arg ...

View File

@ -15,4 +15,4 @@ TEST_METADATA.legacy_test+= required_user="unprivileged"
SUBDIR+= builtins errors execution expansion parameters parser set-e
.include <tap.test.mk>
.include <bsd.test.mk>

View File

@ -86,7 +86,9 @@ FILES+= hash3.0 hash3.0.stdout
FILES+= hash4.0
FILES+= jobid1.0
FILES+= jobid2.0
FILES+= kill1.0 kill2.0
FILES+= lineno.0 lineno.0.stdout
FILES+= lineno2.0
FILES+= local1.0
FILES+= local2.0
FILES+= local3.0

View File

@ -0,0 +1,8 @@
# $FreeBSD$
: &
p1=$!
: &
p2=$!
wait $p2
kill %1

View File

@ -0,0 +1,7 @@
# $FreeBSD$
sleep 1 | sleep 1 &
kill %+
wait "$!"
r=$?
[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = TERM ]

View File

@ -0,0 +1,10 @@
# $FreeBSD$
f() {
: ${LINENO+${x?}}
}
unset -v x
command eval f 2>/dev/null && exit 3
x=1
f

View File

@ -249,6 +249,7 @@ setvar(const char *name, const char *val, int flags)
vallen = strlen(val);
len += vallen;
}
INTOFF;
nameeq = ckmalloc(len);
memcpy(nameeq, name, namelen);
nameeq[namelen] = '=';
@ -257,6 +258,7 @@ setvar(const char *name, const char *val, int flags)
else
nameeq[namelen + 1] = '\0';
setvareq(nameeq, flags);
INTON;
}
static int
@ -289,6 +291,7 @@ change_env(const char *s, int set)
char *eqp;
char *ss;
INTOFF;
ss = savestr(s);
if ((eqp = strchr(ss, '=')) != NULL)
*eqp = '\0';
@ -297,6 +300,7 @@ change_env(const char *s, int set)
else
(void) unsetenv(ss);
ckfree(ss);
INTON;
return;
}
@ -321,10 +325,16 @@ setvareq(char *s, int flags)
mklocal(s);
vp = find_var(s, &vpp, &nlen);
if (vp != NULL) {
if (vp->flags & VREADONLY)
if (vp->flags & VREADONLY) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
error("%.*s: is read only", vp->name_len, s);
if (flags & VNOSET)
}
if (flags & VNOSET) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
return;
}
INTOFF;
if (vp->func && (flags & VNOFUNC) == 0)
@ -357,15 +367,18 @@ setvareq(char *s, int flags)
return;
}
/* not found */
if (flags & VNOSET)
if (flags & VNOSET) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
return;
}
INTOFF;
vp = ckmalloc(sizeof (*vp));
vp->flags = flags;
vp->text = s;
vp->name_len = nlen;
vp->next = *vpp;
vp->func = NULL;
INTOFF;
*vpp = vp;
if ((vp->flags & VEXPORT) && localevar(s)) {
change_env(s, 1);
@ -773,6 +786,7 @@ poplocalvars(void)
struct localvar *lvp;
struct var *vp;
INTOFF;
while ((lvp = localvars) != NULL) {
localvars = lvp->next;
vp = lvp->vp;
@ -790,6 +804,7 @@ poplocalvars(void)
}
ckfree(lvp);
}
INTON;
}
@ -828,18 +843,21 @@ unsetcmd(int argc __unused, char **argv __unused)
if (flg_func == 0 && flg_var == 0)
flg_var = 1;
INTOFF;
for (ap = argptr; *ap ; ap++) {
if (flg_func)
ret |= unsetfunc(*ap);
if (flg_var)
ret |= unsetvar(*ap);
}
INTON;
return ret;
}
/*
* Unset the specified variable.
* Called with interrupts off.
*/
int
@ -853,7 +871,6 @@ unsetvar(const char *s)
return (0);
if (vp->flags & VREADONLY)
return (1);
INTOFF;
if (vp->text[vp->name_len + 1] != '\0')
setvar(s, nullstr, 0);
if ((vp->flags & VEXPORT) && localevar(vp->text)) {
@ -869,7 +886,6 @@ unsetvar(const char *s)
*vpp = vp->next;
ckfree(vp);
}
INTON;
return (0);
}

View File

@ -12,4 +12,4 @@ TAP_TESTS_SH= legacy_test
# requested. See https://code.google.com/p/kyua/issues/detail?id=6
TEST_METADATA.legacy_test+= required_user="unprivileged"
.include <tap.test.mk>
.include <bsd.test.mk>

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Checks that setting "bufresize" to "auto" will cause buffer
@ -34,14 +32,8 @@
* SECTION: Buffers and Buffering/Buffer Resizing Policy;
* Options and Tunables/bufsize;
* Options and Tunables/bufresize
*
* NOTES:
* We use the undocumented "preallocate" option to make sure dtrace(1M)
* has enough space in its heap to allocate a buffer as large as the
* kernel's trace buffer.
*/
#pragma D option preallocate=100t
#pragma D option bufresize=auto
#pragma D option bufsize=100t

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Checks that setting "bufresize" to "auto" will cause buffer
@ -34,14 +32,8 @@
* SECTION: Buffers and Buffering/Buffer Resizing Policy;
* Options and Tunables/aggsize;
* Options and Tunables/bufresize
*
* NOTES:
* We use the undocumented "preallocate" option to make sure dtrace(1M)
* has enough space in its heap to allocate a buffer as large as the
* kernel's trace buffer.
*/
#pragma D option preallocate=100t
#pragma D option bufresize=auto
#pragma D option aggsize=100t

View File

@ -0,0 +1,97 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
let j=8
enable()
{
prog=/var/tmp/dtest.$$.d
err=/var/tmp/dtest.$$.err
nawk -v nprobes=$1 'BEGIN { \
for (i = 0; i < nprobes - 1; i++) { \
printf("dtrace:::BEGIN,\n"); \
} \
\
printf("dtrace:::BEGIN { exit(0); }\n"); \
}' /dev/null > $prog
dtrace -qs $prog > /dev/null 2> $err
if [[ "$?" -eq 0 ]]; then
return 0
else
if ! grep "DIF program exceeds maximum program size" $err \
1> /dev/null 2>&1 ; then
echo "failed to enable $prog: `cat $err`"
exit 1
fi
return 1
fi
}
#
# First, establish an upper bound
#
let upper=1
while enable $upper ; do
let lower=upper
let upper=upper+upper
echo success at $lower, raised to $upper
done
#
# Now search for the highest value that can be enabled
#
while [[ "$lower" -lt "$upper" ]]; do
let guess=$(((lower + upper) / 2))
echo "lower is $lower; upper is $upper; guess is $guess\c"
if enable $guess ; then
if [[ $((upper - lower)) -le 2 ]]; then
let upper=guess
fi
echo " (success)"
let lower=guess
else
echo " (failure)"
let upper=guess
fi
done
let expected=10000
if [[ "$lower" -lt "$expected" ]]; then
echo "expected support for enablings of at least $expected probes; \c"
echo "found $lower"
exit 1
fi
echo "maximum supported enabled probes found to be $lower"
exit 0

View File

@ -19,7 +19,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 31, 2013
.Dd March 20, 2014
.Dt ZDB 8
.Os
.Sh NAME
@ -127,6 +127,12 @@ compression ratio (compress), inflation due to the zfs copies property
If specified twice, display a histogram of deduplication statistics, showing
the allocated (physically present on disk) and referenced (logically
referenced in the pool) block counts and sizes by reference count.
.Pp
If specified a third time, display the statistics independently for each deduplication table.
.Pp
If specified a fourth time, dump the contents of the deduplication tables describing duplicate blocks.
.Pp
If specified a fifth time, also dump the contents of the deduplication tables describing unique blocks.
.It Fl h
Display pool history similar to
.Cm zpool history ,

View File

@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 2, 2014
.Dd March 20, 2014
.Dt ZFS 8
.Os
.Sh NAME
@ -1335,10 +1335,21 @@ features being supported, the new file system will have the default values for
these properties.
.Bl -tag -width 4n
.It Sy casesensitivity Ns = Ns Cm sensitive | insensitive | mixed
The
Indicates whether the file name matching algorithm used by the file system
should be case-sensitive, case-insensitive, or allow a combination of both
styles of matching. The default value for the
.Sy casesensitivity
property is currently not supported on
.Fx .
property is
.Cm sensitive .
Traditionally, UNIX and POSIX file systems have case-sensitive file names.
.Pp
The
.Cm mixed
value for the
.Sy casesensitivity
property indicates that the
file system can support requests for both case-sensitive and case-insensitive
matching behavior.
.It Sy normalization Ns = Ns Cm none | formC | formD | formKC | formKD
Indicates whether the file system should perform a
.Sy unicode

View File

@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>.
.\" Copyright (c) 2013-2014, Xin Li <delphij@FreeBSD.org>.
.\" All Rights Reserved.
.\"
.\" The contents of this file are subject to the terms of the
@ -25,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 31, 2013
.Dd March 28, 2014
.Dt ZPOOL 8
.Os
.Sh NAME
@ -70,6 +71,8 @@
.Ar pool ...
.Nm
.Cm get
.Op Fl Hp
.Op Fl o Ar field Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar pool ...
.Nm
@ -120,7 +123,7 @@
.Ar device
.Nm
.Cm list
.Op Fl H
.Op Fl Hpv
.Op Fl o Ar property Ns Op , Ns Ar ...
.Op Fl T Cm d Ns | Ns Cm u
.Op Ar pool
@ -624,6 +627,9 @@ Datasets of this pool can only be mounted read-only
.It
To write to a read-only pool, a export and import of the pool is required.
.El
.Pp
This property can also be referred to by its shortened column name,
.Sy rdonly .
.El
.Pp
The following properties can be set at creation time and import time, and later
@ -682,7 +688,9 @@ property.
Threshold for the number of block ditto copies. If the reference count for a
deduplicated block increases above this number, a new ditto copy of this block
is automatically stored. Default setting is
.Cm 0 .
.Cm 0
which causes no ditto copies to be created for deduplicated blocks.
The miniumum legal nonzero setting is 100.
.It Sy delegation Ns = Ns Cm on No | Cm off
Controls whether a non-privileged user is granted access based on the dataset
permissions defined on the dataset. See
@ -1013,6 +1021,8 @@ is currently being used. This may lead to potential data corruption.
.It Xo
.Nm
.Cm get
.Op Fl Hp
.Op Fl o Ar field Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar pool ...
.Xc
@ -1031,6 +1041,19 @@ the following fields:
See the
.Qq Sx Properties
section for more information on the available pool properties.
.Pp
.It Fl H
Scripted mode. Do not display headers, and separate fields by a single tab
instead of arbitrary space.
.It Fl p
Display numbers in parsable (exact) values.
.It Fl o Ar field
A comma-separated list of columns to display.
.Sy name Ns , Ns
.Sy property Ns , Ns
.Sy value Ns , Ns
.Sy source
is the default value.
.It Xo
.Nm
.Cm history
@ -1152,9 +1175,10 @@ option is also required.
.It Fl f
Forces import, even if the pool appears to be potentially active.
.It Fl m
Enables import with missing log devices.
Allows a pool to import when there is a missing log device. Recent transactions
can be lost because the log device will be discarded.
.It Fl N
Do not mount any filesystems from the imported pool.
Import the pool without mounting any file systems.
.It Fl R Ar root
Sets the
.Qq Sy cachefile
@ -1245,9 +1269,10 @@ option is also required.
.It Fl f
Forces import, even if the pool appears to be potentially active.
.It Fl m
Enables import with missing log devices.
Allows a pool to import when there is a missing log device. Recent transactions
can be lost because the log device will be discarded.
.It Fl N
Do not mount any filesystems from the imported pool.
Import the pool without mounting any file systems.
.It Fl R Ar root
Equivalent to
.Qq Fl o Cm cachefile=none,altroot= Ns Pa root
@ -1328,7 +1353,7 @@ Treat exported or foreign devices as inactive.
.It Xo
.Nm
.Cm list
.Op Fl Hv
.Op Fl Hpv
.Op Fl o Ar property Ns Op , Ns Ar ...
.Op Fl T Cm d Ns | Ns Cm u
.Op Ar pool
@ -1336,8 +1361,9 @@ Treat exported or foreign devices as inactive.
.Op Ar inverval Op Ar count
.Xc
.Pp
Lists the given pools along with a health status and space usage. When given no
arguments, all pools in the system are listed.
Lists the given pools along with a health status and space usage. If no
.Ar pools
are specified, all pools in the system are listed.
.Pp
When given an interval, the output is printed every
.Ar interval
@ -1349,9 +1375,22 @@ is specified, the command exits after
.Ar count
reports are printed.
.Bl -tag -width indent
.It Fl T Cm d Ns | Ns Cm u
Print a timestamp.
.Pp
Use modifier
.Cm d
for standard date format. See
.Xr date 1 .
Use modifier
.Cm u
for unixtime
.Pq equals Qq Ic date +%s .
.It Fl H
Scripted mode. Do not display headers, and separate fields by a single tab
instead of arbitrary space.
.It Fl p
Display numbers in parsable (exact) values.
.It Fl v
Show more detailed information.
.It Fl o Ar property Ns Op , Ns Ar ...
@ -1677,7 +1716,7 @@ Once this is done, the pool will no longer be accessible on systems that do
not support feature flags.
See
.Xr zpool-features 7
for details on compatability with system sthat support feature flags, but do
for details on compatibility with systems that support feature flags, but do
not support all features enabled on the pool.
.Bl -tag -width indent
.It Fl a

View File

@ -236,7 +236,7 @@ get_usage(zpool_help_t idx) {
case HELP_LABELCLEAR:
return (gettext("\tlabelclear [-f] <vdev>\n"));
case HELP_LIST:
return (gettext("\tlist [-Hv] [-o property[,...]] "
return (gettext("\tlist [-Hpv] [-o property[,...]] "
"[-T d|u] [pool] ... [interval [count]]\n"));
case HELP_OFFLINE:
return (gettext("\toffline [-t] <pool> <device> ...\n"));
@ -258,8 +258,8 @@ get_usage(zpool_help_t idx) {
return (gettext("\tupgrade [-v]\n"
"\tupgrade [-V version] <-a | pool ...>\n"));
case HELP_GET:
return (gettext("\tget <\"all\" | property[,...]> "
"<pool> ...\n"));
return (gettext("\tget [-Hp] [-o \"all\" | field[,...]] "
"<\"all\" | property[,...]> <pool> ...\n"));
case HELP_SET:
return (gettext("\tset <property=value> <pool> \n"));
case HELP_SPLIT:
@ -1969,7 +1969,7 @@ zpool_do_import(int argc, char **argv)
char *endptr;
/* check options */
while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:rR:T:VX")) != -1) {
while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:T:VX")) != -1) {
switch (c) {
case 'a':
do_all = B_TRUE;
@ -2765,6 +2765,7 @@ typedef struct list_cbdata {
int cb_namewidth;
boolean_t cb_scripted;
zprop_list_t *cb_proplist;
boolean_t cb_literal;
} list_cbdata_t;
/*
@ -2860,7 +2861,7 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
zpool_get_prop_int(zhp, pl->pl_prop, NULL) == 0)
propstr = "-";
else if (zpool_get_prop(zhp, pl->pl_prop, property,
sizeof (property), NULL) != 0)
sizeof (property), NULL, cb->cb_literal) != 0)
propstr = "-";
else
propstr = property;
@ -3011,12 +3012,13 @@ list_callback(zpool_handle_t *zhp, void *data)
}
/*
* zpool list [-H] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]]
* zpool list [-Hp] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]]
*
* -H Scripted mode. Don't display headers, and separate properties
* by a single tab.
* -o List of properties to display. Defaults to
* "name,size,allocated,free,capacity,health,altroot"
* -p Diplay values in parsable (exact) format.
* -T Display a timestamp in date(1) or Unix format
*
* List all pools in the system, whether or not they're healthy. Output space
@ -3037,7 +3039,7 @@ zpool_do_list(int argc, char **argv)
boolean_t first = B_TRUE;
/* check options */
while ((c = getopt(argc, argv, ":Ho:T:v")) != -1) {
while ((c = getopt(argc, argv, ":Ho:pT:v")) != -1) {
switch (c) {
case 'H':
cb.cb_scripted = B_TRUE;
@ -3045,6 +3047,9 @@ zpool_do_list(int argc, char **argv)
case 'o':
props = optarg;
break;
case 'p':
cb.cb_literal = B_TRUE;
break;
case 'T':
get_timestamp_arg(*optarg);
break;
@ -5199,7 +5204,7 @@ get_callback(zpool_handle_t *zhp, void *data)
}
} else {
if (zpool_get_prop(zhp, pl->pl_prop, value,
sizeof (value), &srctype) != 0)
sizeof (value), &srctype, cbp->cb_literal) != 0)
continue;
zprop_print_one_property(zpool_get_name(zhp), cbp,
@ -5210,20 +5215,32 @@ get_callback(zpool_handle_t *zhp, void *data)
return (0);
}
/*
* zpool get [-Hp] [-o "all" | field[,...]] <"all" | property[,...]> <pool> ...
*
* -H Scripted mode. Don't display headers, and separate properties
* by a single tab.
* -o List of columns to display. Defaults to
* "name,property,value,source".
* -p Diplay values in parsable (exact) format.
*
* Get properties of pools in the system. Output space statistics
* for each one as well as other attributes.
*/
int
zpool_do_get(int argc, char **argv)
{
zprop_get_cbdata_t cb = { 0 };
zprop_list_t fake_name = { 0 };
int ret;
if (argc < 2) {
(void) fprintf(stderr, gettext("missing property "
"argument\n"));
usage(B_FALSE);
}
int c, i;
char *value;
cb.cb_first = B_TRUE;
/*
* Set up default columns and sources.
*/
cb.cb_sources = ZPROP_SRC_ALL;
cb.cb_columns[0] = GET_COL_NAME;
cb.cb_columns[1] = GET_COL_PROPERTY;
@ -5231,10 +5248,89 @@ zpool_do_get(int argc, char **argv)
cb.cb_columns[3] = GET_COL_SOURCE;
cb.cb_type = ZFS_TYPE_POOL;
if (zprop_get_list(g_zfs, argv[1], &cb.cb_proplist,
/* check options */
while ((c = getopt(argc, argv, ":Hpo:")) != -1) {
switch (c) {
case 'p':
cb.cb_literal = B_TRUE;
break;
case 'H':
cb.cb_scripted = B_TRUE;
break;
case 'o':
bzero(&cb.cb_columns, sizeof (cb.cb_columns));
i = 0;
while (*optarg != '\0') {
static char *col_subopts[] =
{ "name", "property", "value", "source",
"all", NULL };
if (i == ZFS_GET_NCOLS) {
(void) fprintf(stderr, gettext("too "
"many fields given to -o "
"option\n"));
usage(B_FALSE);
}
switch (getsubopt(&optarg, col_subopts,
&value)) {
case 0:
cb.cb_columns[i++] = GET_COL_NAME;
break;
case 1:
cb.cb_columns[i++] = GET_COL_PROPERTY;
break;
case 2:
cb.cb_columns[i++] = GET_COL_VALUE;
break;
case 3:
cb.cb_columns[i++] = GET_COL_SOURCE;
break;
case 4:
if (i > 0) {
(void) fprintf(stderr,
gettext("\"all\" conflicts "
"with specific fields "
"given to -o option\n"));
usage(B_FALSE);
}
cb.cb_columns[0] = GET_COL_NAME;
cb.cb_columns[1] = GET_COL_PROPERTY;
cb.cb_columns[2] = GET_COL_VALUE;
cb.cb_columns[3] = GET_COL_SOURCE;
i = ZFS_GET_NCOLS;
break;
default:
(void) fprintf(stderr,
gettext("invalid column name "
"'%s'\n"), value);
usage(B_FALSE);
}
}
break;
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
usage(B_FALSE);
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
(void) fprintf(stderr, gettext("missing property "
"argument\n"));
usage(B_FALSE);
}
if (zprop_get_list(g_zfs, argv[0], &cb.cb_proplist,
ZFS_TYPE_POOL) != 0)
usage(B_FALSE);
argc--;
argv++;
if (cb.cb_proplist != NULL) {
fake_name.pl_prop = ZPOOL_PROP_NAME;
fake_name.pl_width = strlen(gettext("NAME"));
@ -5242,7 +5338,7 @@ zpool_do_get(int argc, char **argv)
cb.cb_proplist = &fake_name;
}
ret = for_each_pool(argc - 2, argv + 2, B_TRUE, &cb.cb_proplist,
ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist,
get_callback, &cb);
if (cb.cb_proplist == &fake_name)

View File

@ -20,6 +20,7 @@
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright 2013 Voxer Inc. All rights reserved.
* Use is subject to license terms.
*/
@ -144,7 +145,8 @@ dtrace_dof_init(void)
Lmid_t lmid;
#else
u_long lmid = 0;
dof_sec_t *sec;
dof_sec_t *sec, *secstart, *dofstrtab, *dofprobes;
dof_provider_t *dofprovider;
size_t i;
#endif
int fd;
@ -152,14 +154,15 @@ dtrace_dof_init(void)
#if !defined(sun)
Elf *e;
Elf_Scn *scn = NULL;
Elf_Data *symtabdata = NULL, *dynsymdata = NULL;
Elf_Data *symtabdata = NULL, *dynsymdata = NULL, *dofdata = NULL;
dof_hdr_t *dof_next = NULL;
GElf_Shdr shdr;
int efd, nprobes;
char *s;
char *dofstrtabraw;
size_t shstridx, symtabidx = 0, dynsymidx = 0;
unsigned char *dofstrtab = NULL;
unsigned char *buf;
int fixedprobes = 0;
int fixedprobes;
#endif
if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL)
@ -209,7 +212,8 @@ dtrace_dof_init(void)
} else if (shdr.sh_type == SHT_PROGBITS) {
s = elf_strptr(e, shstridx, shdr.sh_name);
if (s && strcmp(s, ".SUNW_dof") == 0) {
dof = elf_getdata(scn, NULL)->d_buf;
dofdata = elf_getdata(scn, NULL);
dof = dofdata->d_buf;
}
}
}
@ -219,6 +223,10 @@ dtrace_dof_init(void)
close(efd);
return;
}
while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) {
fixedprobes = 0;
dof_next = (void *) ((char *) dof + dof->dofh_filesz);
#endif
if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 ||
@ -290,34 +298,49 @@ dtrace_dof_init(void)
* We are assuming the number of probes is less than the number of
* symbols (libc can have 4k symbols, for example).
*/
sec = (dof_sec_t *)(dof + 1);
secstart = sec = (dof_sec_t *)(dof + 1);
buf = (char *)dof;
for (i = 0; i < dof->dofh_secnum; i++, sec++) {
if (sec->dofs_type == DOF_SECT_STRTAB)
dofstrtab = (unsigned char *)(buf + sec->dofs_offset);
else if (sec->dofs_type == DOF_SECT_PROBES && dofstrtab)
if (sec->dofs_type != DOF_SECT_PROVIDER)
continue;
dofprovider = (void *) (buf + sec->dofs_offset);
dofstrtab = secstart + dofprovider->dofpv_strtab;
dofprobes = secstart + dofprovider->dofpv_probes;
if (dofstrtab->dofs_type != DOF_SECT_STRTAB) {
fprintf(stderr, "WARNING: expected STRTAB section, but got %d\n",
dofstrtab->dofs_type);
break;
}
nprobes = sec->dofs_size / sec->dofs_entsize;
fixsymbol(e, symtabdata, symtabidx, nprobes, buf, sec, &fixedprobes,
dofstrtab);
if (fixedprobes != nprobes) {
/*
* If we haven't fixed all the probes using the
* symtab section, look inside the dynsym
* section.
*/
fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, sec,
&fixedprobes, dofstrtab);
}
if (fixedprobes != nprobes) {
fprintf(stderr, "WARNING: number of probes "
"fixed does not match the number of "
"defined probes (%d != %d, "
"respectively)\n", fixedprobes, nprobes);
fprintf(stderr, "WARNING: some probes might "
"not fire or your program might crash\n");
}
if (dofprobes->dofs_type != DOF_SECT_PROBES) {
fprintf(stderr, "WARNING: expected PROBES section, but got %d\n",
dofprobes->dofs_type);
break;
}
dprintf(1, "found provider %p\n", dofprovider);
dofstrtabraw = (char *)(buf + dofstrtab->dofs_offset);
nprobes = dofprobes->dofs_size / dofprobes->dofs_entsize;
fixsymbol(e, symtabdata, symtabidx, nprobes, buf, dofprobes, &fixedprobes,
dofstrtabraw);
if (fixedprobes != nprobes) {
/*
* If we haven't fixed all the probes using the
* symtab section, look inside the dynsym
* section.
*/
fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, dofprobes,
&fixedprobes, dofstrtabraw);
}
if (fixedprobes != nprobes) {
fprintf(stderr, "WARNING: number of probes "
"fixed does not match the number of "
"defined probes (%d != %d, "
"respectively)\n", fixedprobes, nprobes);
fprintf(stderr, "WARNING: some probes might "
"not fire or your program might crash\n");
}
}
#endif
if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1)
@ -330,7 +353,12 @@ dtrace_dof_init(void)
}
(void) close(fd);
#if !defined(sun)
/* End of while loop */
dof = dof_next;
}
elf_end(e);
(void) close(efd);
#endif

View File

@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@ -906,30 +904,6 @@ dt_options_load(dtrace_hdl_t *dtp)
return (0);
}
/*ARGSUSED*/
static int
dt_opt_preallocate(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
{
dtrace_optval_t size;
void *p;
if (arg == NULL || dt_optval_parse(arg, &size) != 0)
return (dt_set_errno(dtp, EDT_BADOPTVAL));
if (size > SIZE_MAX)
size = SIZE_MAX;
if ((p = dt_zalloc(dtp, size)) == NULL) {
do {
size /= 2;
} while ((p = dt_zalloc(dtp, size)) == NULL);
}
dt_free(dtp, p);
return (0);
}
typedef struct dt_option {
const char *o_name;
int (*o_func)(dtrace_hdl_t *, const char *, uintptr_t);
@ -968,7 +942,6 @@ static const dt_option_t _dtrace_ctoptions[] = {
{ "linktype", dt_opt_linktype },
{ "nolibs", dt_opt_cflags, DTRACE_C_NOLIBS },
{ "pgmax", dt_opt_pgmax },
{ "preallocate", dt_opt_preallocate },
{ "pspec", dt_opt_cflags, DTRACE_C_PSPEC },
{ "setenv", dt_opt_setenv, 1 },
{ "stdc", dt_opt_stdc },

View File

@ -128,6 +128,7 @@ uu_avl_pool_destroy(uu_avl_pool_t *pp)
pp->uap_next->uap_prev = pp->uap_prev;
pp->uap_prev->uap_next = pp->uap_next;
(void) pthread_mutex_unlock(&uu_apool_list_lock);
(void) pthread_mutex_destroy(&pp->uap_lock);
pp->uap_prev = NULL;
pp->uap_next = NULL;
uu_free(pp);

View File

@ -270,7 +270,7 @@ extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *);
*/
extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
size_t proplen, zprop_source_t *);
size_t proplen, zprop_source_t *, boolean_t);
extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t,
zprop_source_t *);

View File

@ -2237,8 +2237,8 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
}
if ((zpool_get_prop(zhp->zpool_hdl,
ZPOOL_PROP_ALTROOT, buf, MAXPATHLEN, NULL)) ||
(strcmp(root, "-") == 0))
ZPOOL_PROP_ALTROOT, buf, MAXPATHLEN, NULL,
B_FALSE)) || (strcmp(root, "-") == 0))
root[0] = '\0';
/*
* Special case an alternate root of '/'. This will

View File

@ -20,8 +20,8 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@ -1613,9 +1613,16 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
* its state to active.
*/
if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
(zhp = zpool_open_canfail(hdl, name)) != NULL &&
zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
stateval = POOL_STATE_ACTIVE;
(zhp = zpool_open_canfail(hdl, name)) != NULL) {
if (zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
stateval = POOL_STATE_ACTIVE;
/*
* All we needed the zpool handle for is the
* readonly prop check.
*/
zpool_close(zhp);
}
ret = B_TRUE;
break;

View File

@ -240,7 +240,7 @@ zpool_pool_state_to_name(pool_state_t state)
*/
int
zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
zprop_source_t *srctype)
zprop_source_t *srctype, boolean_t literal)
{
uint64_t intval;
const char *strval;
@ -272,9 +272,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
(void) strlcpy(buf,
zpool_get_prop_string(zhp, prop, &src),
len);
if (srctype != NULL)
*srctype = src;
return (0);
break;
}
/* FALLTHROUGH */
default:
@ -306,12 +304,22 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
case ZPOOL_PROP_FREE:
case ZPOOL_PROP_FREEING:
case ZPOOL_PROP_EXPANDSZ:
(void) zfs_nicenum(intval, buf, len);
if (literal) {
(void) snprintf(buf, len, "%llu",
(u_longlong_t)intval);
} else {
(void) zfs_nicenum(intval, buf, len);
}
break;
case ZPOOL_PROP_CAPACITY:
(void) snprintf(buf, len, "%llu%%",
(u_longlong_t)intval);
if (literal) {
(void) snprintf(buf, len, "%llu",
(u_longlong_t)intval);
} else {
(void) snprintf(buf, len, "%llu%%",
(u_longlong_t)intval);
}
break;
case ZPOOL_PROP_DEDUPRATIO:
@ -407,7 +415,7 @@ zpool_is_bootable(zpool_handle_t *zhp)
char bootfs[ZPOOL_MAXNAMELEN];
return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
sizeof (bootfs), NULL) == 0 && strncmp(bootfs, "-",
sizeof (bootfs), NULL, B_FALSE) == 0 && strncmp(bootfs, "-",
sizeof (bootfs)) != 0);
}
@ -806,7 +814,7 @@ zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp)
if (entry->pl_prop != ZPROP_INVAL &&
zpool_get_prop(zhp, entry->pl_prop, buf, sizeof (buf),
NULL) == 0) {
NULL, B_FALSE) == 0) {
if (strlen(buf) > entry->pl_width)
entry->pl_width = strlen(buf);
}

View File

@ -27,5 +27,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
DPADD= ${LIBZ}
LDADD= -lz
.include <bsd.lib.mk>

View File

@ -69,9 +69,11 @@ CFLAGS+= -I${.OBJDIR} -I${.CURDIR} \
#CFLAGS+= -DYYDEBUG
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/i386
.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH}
.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
.elif ${MACHINE_CPUARCH} == "sparc64"
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc

View File

@ -281,7 +281,7 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
armv6-*-freebsd*)
armv6-*-freebsd* | armv6hf-*-freebsd*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: absolute value */
@ -30,4 +30,5 @@ __absvti2(ti_int a)
return (a ^ s) - s;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: a + b */
@ -37,4 +37,4 @@ __addvti3(ti_int a, ti_int b)
return s;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: a << b */
@ -42,4 +42,4 @@ __ashlti3(ti_int a, si_int b)
return result.all;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: arithmetic a >> b */
@ -43,4 +43,4 @@ __ashrti3(ti_int a, si_int b)
return result.all;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: the number of leading 0-bits */
@ -30,4 +30,4 @@ __clzti2(ti_int a)
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: if (a < b) returns 0
* if (a == b) returns 1
@ -39,4 +39,4 @@ __cmpti2(ti_int a, ti_int b)
return 1;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: the number of trailing 0-bits */
@ -30,4 +30,4 @@ __ctzti2(ti_int a)
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@ -32,4 +32,4 @@ __divti3(ti_int a, ti_int b)
return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: the index of the least significant 1-bit in a, or
* the value zero if a is zero. The least significant bit is index one.
@ -34,4 +34,4 @@ __ffsti2(ti_int a)
return __builtin_ctzll(x.s.low) + 1;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@ -42,4 +42,4 @@ __fixdfti(double a)
return (r ^ s) - s;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@ -42,4 +42,4 @@ __fixsfti(float a)
return (r ^ s) - s;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@ -44,4 +44,4 @@ __fixunsdfti(double a)
return r;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@ -44,4 +44,4 @@ __fixunssfti(float a)
return r;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@ -46,4 +46,4 @@ __fixunsxfti(long double a)
return r;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@ -44,4 +44,4 @@ __fixxfti(long double a)
return (r ^ s) - s;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a double, rounding toward even.*/
@ -82,4 +82,4 @@ __floattidf(ti_int a)
return fb.f;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a float, rounding toward even. */
@ -81,4 +81,4 @@ __floattisf(ti_int a)
return fb.f;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a long double, rounding toward even. */
@ -47,7 +47,7 @@ __floattixf(ti_int a)
* P = bit LDBL_MANT_DIG-1 bits to the right of 1
* Q = bit LDBL_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q
*/
*/
switch (sd)
{
case LDBL_MANT_DIG + 1:
@ -83,4 +83,4 @@ __floattixf(ti_int a)
return fb.f;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a double, rounding toward even. */
@ -43,7 +43,7 @@ __floatuntidf(tu_int a)
* P = bit DBL_MANT_DIG-1 bits to the right of 1
* Q = bit DBL_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q
*/
*/
switch (sd)
{
case DBL_MANT_DIG + 1:
@ -79,4 +79,4 @@ __floatuntidf(tu_int a)
return fb.f;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a float, rounding toward even. */
@ -78,4 +78,4 @@ __floatuntisf(tu_int a)
return fb.f;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: convert a to a long double, rounding toward even. */

View File

@ -56,8 +56,11 @@ typedef union
}s;
} udwords;
#if __x86_64
#if __LP64__
#define CRT_HAS_128BIT
#endif
#ifdef CRT_HAS_128BIT
typedef int ti_int __attribute__ ((mode (TI)));
typedef unsigned tu_int __attribute__ ((mode (TI)));
@ -105,7 +108,7 @@ static inline tu_int make_tu(du_int h, du_int l) {
return r.all;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */
typedef union
{

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: logical a >> b */
@ -42,4 +42,4 @@ __lshrti3(ti_int a, si_int b)
return result.all;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@ -33,4 +33,4 @@ __modti3(ti_int a, ti_int b)
return (r ^ s) - s; /* negate if s == -1 */
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@ -59,4 +59,4 @@ __muloti4(ti_int a, ti_int b, int* overflow)
return result;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@ -55,4 +55,4 @@ __multi3(ti_int a, ti_int b)
return r.all;
}
#endif /* __x86_64 */
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@ -57,4 +57,4 @@ __mulvti3(ti_int a, ti_int b)
return a * b;
}
#endif
#endif /* CRT_HAS_128BIT */

View File

@ -14,7 +14,7 @@
#include "int_lib.h"
#if __x86_64
#ifdef CRT_HAS_128BIT
/* Returns: -a */
@ -27,4 +27,4 @@ __negti2(ti_int a)
return -a;
}
#endif
#endif /* CRT_HAS_128BIT */

Some files were not shown because too many files have changed in this diff Show More