IFH@204581
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
The compilation of software known as FreeBSD is distributed under the
|
||||
following terms:
|
||||
|
||||
Copyright (c) 1992-2009 The FreeBSD Project. All rights reserved.
|
||||
Copyright (c) 1992-2010 The FreeBSD Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
||||
+8
-1
@@ -48,7 +48,6 @@ iostat(8) ken Pre-commit review requested.
|
||||
cd(4) ken Pre-commit review requested.
|
||||
pass(4) ken Pre-commit review requested.
|
||||
ch(4) ken Pre-commit review requested.
|
||||
isp(4) mjacob Pre-commit review requested.
|
||||
em(4) jfv Pre-commit review requested.
|
||||
tdfx(4) cokane Just keep me informed of changes, try not to break it.
|
||||
sendmail gshapiro Pre-commit review requested.
|
||||
@@ -124,6 +123,14 @@ usr.bin/bluetooth emax Pre-commit review preferred.
|
||||
usr.sbin/bluetooth emax Pre-commit review preferred.
|
||||
gnu/usr.bin/send-pr bugmaster Pre-commit review requested.
|
||||
ncurses rafan Heads-up appreciated, try not to break it.
|
||||
*env(3) secteam Due to the problematic security history of this
|
||||
code, please have patches reviewed by secteam.
|
||||
share/zoneinfo edwin Heads-up appreciated, since our data is coming
|
||||
from a third party source.
|
||||
usr.sbin/zic edwin Heads-up appreciated, since this code is
|
||||
maintained by a third party source.
|
||||
lib/libc/stdtime edwin Heads-up appreciated, since parts of this code
|
||||
is maintained by a third party source.
|
||||
|
||||
Following are the entries from the Makefiles, and a few other sources.
|
||||
Please remove stale entries from both their origin, and this file.
|
||||
|
||||
@@ -278,7 +278,7 @@ tinderbox:
|
||||
# with a reasonable chance of success, regardless of how old your
|
||||
# existing system is.
|
||||
#
|
||||
.if make(universe) || make(tinderbox)
|
||||
.if make(universe) || make(universe_kernels) || make(tinderbox)
|
||||
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
|
||||
|
||||
.if defined(DOING_TINDERBOX)
|
||||
@@ -297,10 +297,6 @@ universe_prologue:
|
||||
rm -f ${FAILFILE}
|
||||
.endif
|
||||
.for target in ${TARGETS}
|
||||
KERNCONFS!= cd ${.CURDIR}/sys/${target}/conf && \
|
||||
find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
|
||||
! -name DEFAULTS ! -name LINT
|
||||
KERNCONFS:= ${KERNCONFS:S/^NOTES$/LINT/}
|
||||
universe: universe_${target}
|
||||
.ORDER: universe_prologue universe_${target} universe_epilogue
|
||||
universe_${target}:
|
||||
@@ -320,16 +316,26 @@ universe_${target}:
|
||||
(echo "${target} 'make LINT' failed," \
|
||||
"check _.${target}.makeLINT for details"| ${MAKEFAIL}))
|
||||
.endif
|
||||
@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
|
||||
universe_kernels
|
||||
@echo ">> ${target} completed on `LC_ALL=C date`"
|
||||
.endfor
|
||||
universe_kernels: universe_kernconfs
|
||||
.if !defined(TARGET)
|
||||
TARGET!= uname -m
|
||||
.endif
|
||||
KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \
|
||||
find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
|
||||
! -name DEFAULTS ! -name NOTES
|
||||
universe_kernconfs:
|
||||
.for kernel in ${KERNCONFS}
|
||||
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
|
||||
${MAKE} ${JFLAG} buildkernel \
|
||||
TARGET=${target} \
|
||||
TARGET=${TARGET} \
|
||||
KERNCONF=${kernel} \
|
||||
> _.${target}.${kernel} 2>&1 || \
|
||||
(echo "${target} ${kernel} kernel failed," \
|
||||
"check _.${target}.${kernel} for details"| ${MAKEFAIL}))
|
||||
.endfor
|
||||
@echo ">> ${target} completed on `LC_ALL=C date`"
|
||||
> _.${TARGET}.${kernel} 2>&1 || \
|
||||
(echo "${TARGET} ${kernel} kernel failed," \
|
||||
"check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
|
||||
.endfor
|
||||
universe: universe_epilogue
|
||||
universe_epilogue:
|
||||
|
||||
+38
-20
@@ -5,10 +5,11 @@
|
||||
# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
|
||||
# -DNO_CLEAN do not clean at all
|
||||
# -DNO_SHARE do not go into share subdir
|
||||
# -DKERNFAST define NO_KERNELCONFIG, NO_KERNELCLEAN and NO_KERNELDEPEND
|
||||
# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
|
||||
# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
|
||||
# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
|
||||
# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
|
||||
# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
|
||||
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
|
||||
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
|
||||
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects
|
||||
@@ -272,7 +273,7 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
|
||||
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
|
||||
.endif
|
||||
LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
|
||||
-iprefix ${LIB32TMP}/usr/ \
|
||||
-isystem ${LIB32TMP}/usr/include/ \
|
||||
-L${LIB32TMP}/usr/lib32 \
|
||||
-B${LIB32TMP}/usr/lib32
|
||||
|
||||
@@ -599,11 +600,14 @@ installcheck_UGID:
|
||||
.if ${MK_INFO} != "no"
|
||||
_install-info= install-info
|
||||
.endif
|
||||
.if ${MK_ZONEINFO} != "no"
|
||||
_zoneinfo= zic tzsetup
|
||||
.endif
|
||||
|
||||
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
|
||||
date echo egrep find grep ${_install-info} \
|
||||
ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
|
||||
test true uname wc zic
|
||||
test true uname wc ${_zoneinfo}
|
||||
|
||||
#
|
||||
# distributeworld
|
||||
@@ -691,6 +695,7 @@ distrib-dirs distribution:
|
||||
NO_KERNELCLEAN= t
|
||||
NO_KERNELCONFIG= t
|
||||
NO_KERNELDEPEND= t
|
||||
NO_KERNELOBJ= t
|
||||
# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
|
||||
.if !defined(KERNCONF) && ${KERNFAST} != "1"
|
||||
KERNCONF=${KERNFAST}
|
||||
@@ -760,11 +765,13 @@ buildkernel:
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
|
||||
.endif
|
||||
.if !defined(NO_KERNELOBJ)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> stage 2.2: rebuilding the object tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> stage 2.3: build tools"
|
||||
@@ -929,6 +936,15 @@ _ar= usr.bin/ar
|
||||
_mklocale= usr.bin/mklocale
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 900002
|
||||
_sed= usr.bin/sed
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 900006
|
||||
_lex= usr.bin/lex
|
||||
_yacc= usr.bin/yacc
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 700018
|
||||
_gensnmptree= usr.sbin/bsnmpd/gensnmptree
|
||||
.endif
|
||||
@@ -954,6 +970,9 @@ bootstrap-tools:
|
||||
usr.bin/makewhatis \
|
||||
${_mklocale} \
|
||||
usr.bin/rpcgen \
|
||||
${_sed} \
|
||||
${_lex} \
|
||||
${_yacc} \
|
||||
usr.bin/xinstall \
|
||||
${_gensnmptree} \
|
||||
usr.sbin/config \
|
||||
@@ -1033,7 +1052,6 @@ cross-tools:
|
||||
.for _tool in \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/sed \
|
||||
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
|
||||
${_btxld} \
|
||||
${_crunchide} \
|
||||
@@ -1087,19 +1105,19 @@ _startup_libs+= lib/libc
|
||||
|
||||
gnu/lib/libgcc__L: lib/libc__L
|
||||
|
||||
_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
|
||||
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libroken} \
|
||||
${_kerberos5_lib_libheimntlm} ${_kerberos5_lib_libgssapi_krb5} \
|
||||
lib/libbz2 lib/libcom_err lib/libcrypt lib/libelf \
|
||||
_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
|
||||
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
|
||||
${_kerberos5_lib_libroken} \
|
||||
lib/libbz2 lib/libcom_err lib/libcrypt \
|
||||
lib/libexpat \
|
||||
${_lib_cddl} ${_lib_libgssapi} ${_lib_libipx} \
|
||||
${_lib_libgssapi} ${_lib_libipx} \
|
||||
lib/libkiconv lib/libkvm lib/libmd \
|
||||
lib/ncurses/ncurses lib/ncurses/ncursesw \
|
||||
lib/libopie lib/libpam ${_lib_libthr} \
|
||||
lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
|
||||
${_lib_libypclnt} lib/libz lib/msun \
|
||||
lib/libradius lib/libsbuf lib/libtacplus \
|
||||
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
|
||||
${_secure_lib_libcrypto} ${_secure_lib_libssh} \
|
||||
${_secure_lib_libssl} lib/libdwarf lib/libproc
|
||||
${_secure_lib_libssl}
|
||||
|
||||
.if ${MK_LIBTHR} != "no"
|
||||
_lib_libthr= lib/libthr
|
||||
@@ -1121,18 +1139,20 @@ lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
|
||||
.if ${MK_OPENSSH} != "no"
|
||||
_secure_lib_libssh= secure/lib/libssh
|
||||
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
|
||||
.if ${MK_KERBEROS} != "no"
|
||||
kerberos5/lib/libgssapi_krb5__L: kerberos5/lib/libkrb5__L \
|
||||
.if ${MK_KERBEROS_SUPPORT} != "no"
|
||||
secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
|
||||
kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
|
||||
lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \
|
||||
lib/libcrypt__L
|
||||
secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libgssapi_krb5__L
|
||||
lib/libmd__L kerberos5/lib/libroken__L
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
_secure_lib= secure/lib
|
||||
.endif
|
||||
|
||||
.if ${MK_GSSAPI} != "no"
|
||||
_lib_libgssapi= lib/libgssapi
|
||||
.endif
|
||||
|
||||
.if ${MK_IPX} != "no"
|
||||
_lib_libipx= lib/libipx
|
||||
.endif
|
||||
@@ -1144,8 +1164,6 @@ _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
|
||||
_kerberos5_lib_libhx509= kerberos5/lib/libhx509
|
||||
_kerberos5_lib_libroken= kerberos5/lib/libroken
|
||||
_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
|
||||
_kerberos5_lib_libgssapi_krb5= kerberos5/lib/libgssapi_krb5
|
||||
_lib_libgssapi= lib/libgssapi
|
||||
.endif
|
||||
|
||||
.if ${MK_NIS} != "no"
|
||||
@@ -1248,7 +1266,7 @@ delete-old-files:
|
||||
fi; \
|
||||
done
|
||||
# Remove catpages without corresponding manpages.
|
||||
@3<&0; \
|
||||
@exec 3<&0; \
|
||||
find ${DESTDIR}/usr/share/man/cat* ! -type d | \
|
||||
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
|
||||
while read catpage; do \
|
||||
|
||||
+129
-1
@@ -14,6 +14,89 @@
|
||||
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
|
||||
#
|
||||
|
||||
# 20100227: [ia64] removed <machine/sapicreg.h> and <machine/sapicvar.h>
|
||||
.if ${TARGET_ARCH} == "ia64"
|
||||
OLD_FILES+=usr/include/machine/sapicreg.h
|
||||
OLD_FILES+=usr/include/machine/sapicvar.h
|
||||
.endif
|
||||
# 20100208: man pages moved
|
||||
.if ${TARGET_ARCH} == "i386"
|
||||
OLD_FILES+=usr/share/man/man4/i386/alpm.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/amdpm.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/mcd.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/padlock.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/pcf.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/scd.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/i386/viapm.4.gz
|
||||
.endif
|
||||
# 20100122: move BSDL bc/dc USD documents to /usr/share/doc/usd
|
||||
OLD_FILES+=usr/share/doc/papers/bc.ascii.gz
|
||||
OLD_FILES+=usr/share/doc/papers/dc.ascii.gz
|
||||
# 20100120: replacing GNU bc/dc with BSDL versions
|
||||
OLD_FILES+=usr/share/examples/bc/ckbook.b
|
||||
OLD_FILES+=usr/share/examples/bc/pi.b
|
||||
OLD_FILES+=usr/share/examples/bc/primes.b
|
||||
OLD_FILES+=usr/share/examples/bc/twins.b
|
||||
OLD_FILES+=usr/share/info/dc.info.gz
|
||||
OLD_DIRS+=usr/share/examples/bc
|
||||
# 20100114: removal of ttyslot(3)
|
||||
OLD_FILES+=usr/share/man/man3/ttyslot.3.gz
|
||||
# 20100113: remove utmp.h, replace it by utmpx.h
|
||||
OLD_FILES+=usr/share/man/man3/login.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/logout.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/logwtmp.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_endutxent.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_getutxent.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_getutxline.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_getutxuser.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_pututxline.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_setutxent.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/ulog_setutxfile.3.gz
|
||||
OLD_FILES+=usr/share/man/man5/lastlog.5.gz
|
||||
OLD_FILES+=usr/share/man/man5/utmp.5.gz
|
||||
OLD_FILES+=usr/share/man/man5/wtmp.5.gz
|
||||
OLD_LIBS+=lib/libutil.so.8
|
||||
# 20100105: new userland semaphore implementation
|
||||
OLD_FILES+=usr/include/sys/semaphore.h
|
||||
# 20100103: ntptrace(8) removed
|
||||
OLD_FILES+=usr/sbin/ntptrace
|
||||
OLD_FILES+=usr/share/man/man8/ntptrace.8.gz
|
||||
# 20091229: remove no longer relevant examples
|
||||
OLD_FILES+=usr/share/examples/pppd/auth-down.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/auth-up.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/chap-secrets.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/chat.sh.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/ip-down.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/ip-up.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/options.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/pap-secrets.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/ppp.deny.sample
|
||||
OLD_FILES+=usr/share/examples/pppd/ppp.shells.sample
|
||||
OLD_DIRS+=usr/share/examples/pppd
|
||||
OLD_FILES+=usr/share/examples/slattach/unit-command.sh
|
||||
OLD_DIRS+=usr/share/examples/slattach
|
||||
OLD_FILES+=usr/share/examples/sliplogin/slip.hosts
|
||||
OLD_FILES+=usr/share/examples/sliplogin/slip.login
|
||||
OLD_FILES+=usr/share/examples/sliplogin/slip.logout
|
||||
OLD_FILES+=usr/share/examples/sliplogin/slip.slparms
|
||||
OLD_DIRS+=usr/share/examples/sliplogin
|
||||
OLD_FILES+=usr/share/examples/startslip/sldown.sh
|
||||
OLD_FILES+=usr/share/examples/startslip/slip.sh
|
||||
OLD_FILES+=usr/share/examples/startslip/slup.sh
|
||||
OLD_DIRS+=usr/share/examples/startslip
|
||||
# 20091202: unify rc.firewall and rc.firewall6.
|
||||
OLD_FILES+=etc/rc.d/ip6fw
|
||||
OLD_FILES+=etc/rc.firewall6
|
||||
OLD_FILES+=usr/share/examples/etc/rc.firewall6
|
||||
# 20091117: removal of rc.early(8) link
|
||||
OLD_FILES+=usr/share/man/man8/rc.early.8.gz
|
||||
# 20091117: usr/share/zoneinfo/GMT link removed
|
||||
OLD_FILES+=usr/share/zoneinfo/GMT
|
||||
# 20091027: pselect.3 implemented as syscall
|
||||
OLD_FILES+=usr/share/man/man3/pselect.3.gz
|
||||
# 20091005: fusword.9 and susword.9 removed
|
||||
OLD_FILES+=usr/share/man/man9/fusword.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/susword.9.gz
|
||||
# 20090909: vesa and dpms promoted to be i386/amd64 common
|
||||
OLD_FILES+=usr/include/machine/pc/vesa.h
|
||||
OLD_FILES+=usr/share/man/man4/i386/dpms.4.gz
|
||||
@@ -26,6 +109,49 @@ OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz
|
||||
OLD_FILES+=etc/mtree/BSD.local.dist
|
||||
OLD_FILES+=etc/mtree/BSD.x11.dist
|
||||
OLD_FILES+=etc/mtree/BSD.x11-4.dist
|
||||
# 20090812: net80211 documentation overhaul
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_add_rates.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_add_xrates.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_alloc_node.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_attach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_begin_scan.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_cfgget.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_cfgset.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_chan2ieee.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_chan2mode.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_create_ibss.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_crypto_attach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_crypto_detach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_decap.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_dump_pkt.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_dup_bss.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_encap.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_end_scan.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_find_node.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_fix_rate.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_free_allnodes.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_ieee2mhz.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_ioctl.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_lookup_node.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_media2rate.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_media_change.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_media_init.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_media_status.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_mhz2ieee.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_next_scan.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_node_attach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_node_detach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_node_lateattach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_print_essid.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_proto_attach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_proto_detach.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_rate2media.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_recv_mgmt.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_send_mgmt.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_setmode.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_timeout_nodes.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_watchdog.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/ieee80211_wep_crypt.9.gz
|
||||
# 20090801: vimage.h removed in favour of vnet.h
|
||||
OLD_FILES+=usr/include/sys/vimage.h
|
||||
# 20090719: library version bump for 8.0
|
||||
@@ -503,6 +629,8 @@ OLD_FILES+=usr/include/dev/usb/usb_quirks.h
|
||||
OLD_FILES+=usr/include/dev/usb/usbcdc.h
|
||||
OLD_FILES+=usr/include/dev/usb/usbdivar.h
|
||||
OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h
|
||||
OLD_FILES+=usr/sbin/usbdevs
|
||||
OLD_FILES+=usr/share/man/man8/usbdevs.8.gz
|
||||
# 20090203: removal of pccard header files
|
||||
OLD_FILES+=usr/include/pccard/cardinfo.h
|
||||
OLD_FILES+=usr/include/pccard/cis.h
|
||||
@@ -2162,7 +2290,7 @@ OLD_FILES+=usr/lib/libpam_ssh.a
|
||||
OLD_FILES+=usr/lib/libpam_ssh_p.a
|
||||
OLD_FILES+=usr/bin/help
|
||||
OLD_FILES+=usr/bin/sccs
|
||||
.if ${TARGET_ARCH} != "arm" && ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "powerpc"
|
||||
.if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "arm" && ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "powerpc"
|
||||
OLD_FILES+=usr/bin/gdbserver
|
||||
.endif
|
||||
OLD_FILES+=usr/bin/ssh-keysign
|
||||
|
||||
@@ -22,6 +22,75 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
|
||||
machines to maximize performance. (To disable malloc debugging, run
|
||||
ln -s aj /etc/malloc.conf.)
|
||||
|
||||
20100113:
|
||||
The utmp user accounting database has been replaced with utmpx,
|
||||
the user accounting interface standardized by POSIX.
|
||||
Unfortunately the semantics of utmp and utmpx don't match,
|
||||
making it practically impossible to support both interfaces.
|
||||
The user accounting database is used by tools like finger(1),
|
||||
last(1), talk(1), w(1) and ac(8).
|
||||
|
||||
All applications in the base system use utmpx. This means only
|
||||
local binaries (e.g. from the ports tree) may still use these
|
||||
utmp database files. These applications must be rebuilt to make
|
||||
use of utmpx.
|
||||
|
||||
After the system has been upgraded, it is safe to remove the old
|
||||
log files (/var/run/utmp, /var/log/lastlog and /var/log/wtmp*),
|
||||
assuming their contents is of no importance anymore. Old wtmp
|
||||
databases can only be used by last(1) and ac(8) after they have
|
||||
been converted to the new format using wtmpcvt(1).
|
||||
|
||||
20100108:
|
||||
Introduce the kernel thread "deadlock resolver" (which can be enabled
|
||||
via the DEADLKRES option, see NOTES for more details) and the
|
||||
sleepq_type() function for sleepqueues.
|
||||
|
||||
20091202:
|
||||
The rc.firewall and rc.firewall6 were unified, and
|
||||
rc.firewall6 and rc.d/ip6fw were removed.
|
||||
According to the removal of rc.d/ip6fw, ipv6_firewall_* rc
|
||||
variables are obsoleted. Instead, the following new rc
|
||||
variables are added to rc.d/ipfw:
|
||||
|
||||
firewall_client_net_ipv6, firewall_simple_iif_ipv6,
|
||||
firewall_simple_inet_ipv6, firewall_simple_oif_ipv6,
|
||||
firewall_simple_onet_ipv6, firewall_trusted_ipv6
|
||||
|
||||
The meanings correspond to the relevant IPv4 variables.
|
||||
|
||||
20091113:
|
||||
The default terminal emulation for syscons(4) has been changed
|
||||
from cons25 to xterm on all platforms except pc98. This means
|
||||
that the /etc/ttys file needs to be updated to ensure correct
|
||||
operation of applications on the console.
|
||||
|
||||
The terminal emulation style can be toggled per window by using
|
||||
vidcontrol(1)'s -T flag. The TEKEN_CONS25 kernel configuration
|
||||
options can be used to change the compile-time default back to
|
||||
cons25.
|
||||
|
||||
To prevent graphical artifacts, make sure the TERM environment
|
||||
variable is set to match the terminal emulation that is being
|
||||
performed by syscons(4).
|
||||
|
||||
20091109:
|
||||
The layout of the structure ieee80211req_scan_result has changed.
|
||||
Applications that require wireless scan results (e.g. ifconfig(8))
|
||||
from net80211 need to be recompiled.
|
||||
|
||||
Applications such as wpa_supplicant(8) may require a full world
|
||||
build without using NO_CLEAN in order to get synchronized with the
|
||||
new structure.
|
||||
|
||||
20091025:
|
||||
The iwn(4) driver has been updated to support the 5000 and 5150 series.
|
||||
There's one kernel module for each firmware. Adding "device iwnfw"
|
||||
to the kernel configuration file means including all three firmware
|
||||
images inside the kernel. If you want to include just the one for
|
||||
your wireless card, use the the devices iwn4965fw, iwn5000fw or
|
||||
iwn5150fw.
|
||||
|
||||
20090926:
|
||||
The rc.d/network_ipv6, IPv6 configuration script has been integrated
|
||||
into rc.d/netif. The changes are the following:
|
||||
@@ -116,7 +185,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
|
||||
20090712:
|
||||
Padding has been added to struct tcpcb, sackhint and tcpstat in
|
||||
<netinet/tcp_var.h> to facilitate future MFCs and bug fixes whilst
|
||||
maintainig the ABI. However, this change breaks the ABI, so bump
|
||||
maintaining the ABI. However, this change breaks the ABI, so bump
|
||||
__FreeBSD_version to 800102. User space tools that rely on the size of
|
||||
any of these structs (e.g. sockstat) need to be recompiled.
|
||||
|
||||
@@ -529,6 +598,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
|
||||
# Map old usb library to new one for usb2 stack
|
||||
libusb-0.1.so.8 libusb20.so.1
|
||||
|
||||
20090209:
|
||||
All USB ethernet devices now attach as interfaces under the name ueN
|
||||
(eg. ue0). This is to provide a predictable name as vendors often
|
||||
change usb chipsets in a product without notice.
|
||||
|
||||
20090203:
|
||||
The ichsmb(4) driver has been changed to require SMBus slave
|
||||
addresses be left-justified (xxxxxxx0b) rather than right-justified.
|
||||
@@ -624,6 +698,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
|
||||
userland (libpmc(3)) and the kernel module (hwpmc(4)) in
|
||||
sync.
|
||||
|
||||
20081009:
|
||||
atapci kernel module now includes only generic PCI ATA
|
||||
driver. AHCI driver moved to ataahci kernel module.
|
||||
All vendor-specific code moved into separate kernel modules:
|
||||
ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek,
|
||||
atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron,
|
||||
atamarvell, atamicron, atanational, atanetcell, atanvidia,
|
||||
atapromise, ataserverworks, atasiliconimage, atasis, atavia
|
||||
|
||||
20080820:
|
||||
The TTY subsystem of the kernel has been replaced by a new
|
||||
implementation, which provides better scalability and an
|
||||
@@ -836,7 +919,7 @@ COMMON ITEMS:
|
||||
-------------
|
||||
Avoid using make -j when upgrading. While generally safe, there are
|
||||
sometimes problems using -j to upgrade. If your upgrade fails with
|
||||
-j, please try again wtihout -j. From time to time in the past there
|
||||
-j, please try again without -j. From time to time in the past there
|
||||
have been problems using -j with buildworld and/or installworld. This
|
||||
is especially true when upgrading between "distant" versions (eg one
|
||||
that cross a major release boundary or several minor releases, or when
|
||||
|
||||
@@ -27,6 +27,7 @@ SUBDIR= cat \
|
||||
pax \
|
||||
pkill \
|
||||
ps \
|
||||
pwait \
|
||||
pwd \
|
||||
${_rcp} \
|
||||
realpath \
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= cat
|
||||
WARNS?= 6
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
+5
-3
@@ -32,7 +32,7 @@
|
||||
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 27, 2006
|
||||
.Dd January 17, 2010
|
||||
.Dt CP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -45,7 +45,7 @@
|
||||
.Op Fl H | Fl L | Fl P
|
||||
.Oc
|
||||
.Op Fl f | i | n
|
||||
.Op Fl alpv
|
||||
.Op Fl alpvx
|
||||
.Ar source_file target_file
|
||||
.Nm
|
||||
.Oo
|
||||
@@ -53,7 +53,7 @@
|
||||
.Op Fl H | Fl L | Fl P
|
||||
.Oc
|
||||
.Op Fl f | i | n
|
||||
.Op Fl alpv
|
||||
.Op Fl alpvx
|
||||
.Ar source_file ... target_directory
|
||||
.Sh DESCRIPTION
|
||||
In the first synopsis form, the
|
||||
@@ -183,6 +183,8 @@ permissions.
|
||||
Cause
|
||||
.Nm
|
||||
to be verbose, showing files as they are copied.
|
||||
.It Fl x
|
||||
File system mount points are not traversed.
|
||||
.El
|
||||
.Pp
|
||||
For each destination file that already exists, its contents are
|
||||
|
||||
+5
-2
@@ -101,8 +101,9 @@ main(int argc, char *argv[])
|
||||
int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
|
||||
char *target;
|
||||
|
||||
fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
|
||||
Hflag = Lflag = Pflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
|
||||
while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
@@ -150,6 +151,9 @@ main(int argc, char *argv[])
|
||||
case 'v':
|
||||
vflag = 1;
|
||||
break;
|
||||
case 'x':
|
||||
fts_options |= FTS_XDEV;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@@ -160,7 +164,6 @@ main(int argc, char *argv[])
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
|
||||
if (Rflag && rflag)
|
||||
errx(1, "the -R and -r options may not be specified together");
|
||||
if (rflag)
|
||||
|
||||
+2
-2
@@ -518,8 +518,8 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
|
||||
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
|
||||
"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file",
|
||||
" cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... "
|
||||
"target_directory");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
+5
-5
@@ -54,7 +54,7 @@
|
||||
#define HAVE_GETPWENT 1
|
||||
|
||||
/* Define to 1 if you have the `getutent' function. */
|
||||
/* #undef HAVE_GETUTENT */
|
||||
#define HAVE_GETUTENT 1
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
/* #undef HAVE_ICONV */
|
||||
@@ -130,10 +130,10 @@
|
||||
#define HAVE_STRUCT_UTMP_UT_HOST 1
|
||||
|
||||
/* Define to 1 if `ut_tv' is member of `struct utmp'. */
|
||||
/* #undef HAVE_STRUCT_UTMP_UT_TV */
|
||||
#define HAVE_STRUCT_UTMP_UT_TV 1
|
||||
|
||||
/* Define to 1 if `ut_user' is member of `struct utmp'. */
|
||||
/* #undef HAVE_STRUCT_UTMP_UT_USER */
|
||||
#define HAVE_STRUCT_UTMP_UT_USER 1
|
||||
|
||||
/* Define to 1 if `ut_xtime' is member of `struct utmp'. */
|
||||
/* #undef HAVE_STRUCT_UTMP_UT_XTIME */
|
||||
@@ -159,10 +159,10 @@
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the <utmpx.h> header file. */
|
||||
/* #undef HAVE_UTMPX_H */
|
||||
#define HAVE_UTMPX_H 1
|
||||
|
||||
/* Define to 1 if you have the <utmp.h> header file. */
|
||||
#define HAVE_UTMP_H 1
|
||||
/* #undef HAVE_UTMP_H */
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
/* Use LC_MESSAGES locale category to open the message catalog */
|
||||
#define MCLoadBySet NL_CAT_LOCALE
|
||||
#define BUFSIZE 8192
|
||||
#define UTMPX_FILE "/var/run/utx.active"
|
||||
#endif
|
||||
|
||||
#if defined(__bsdi__)
|
||||
|
||||
@@ -61,9 +61,20 @@ dl_iconv_open(const char *tocode, const char *fromcode)
|
||||
if (iconvlib == NULL)
|
||||
return (iconv_t)-1;
|
||||
iconv_open = (iconv_open_t *)dlfunc(iconvlib, ICONV_OPEN);
|
||||
if (iconv_open == NULL)
|
||||
goto dlfunc_err;
|
||||
dl_iconv = (dl_iconv_t *)dlfunc(iconvlib, ICONV_ENGINE);
|
||||
if (dl_iconv == NULL)
|
||||
goto dlfunc_err;
|
||||
dl_iconv_close = (dl_iconv_close_t *)dlfunc(iconvlib,
|
||||
ICONV_CLOSE);
|
||||
if (dl_iconv_close == NULL)
|
||||
goto dlfunc_err;
|
||||
}
|
||||
return iconv_open(tocode, fromcode);
|
||||
|
||||
dlfunc_err:
|
||||
dlclose(iconvlib);
|
||||
iconvlib = NULL;
|
||||
return (iconv_t)-1;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,5 @@
|
||||
|
||||
PROG= date
|
||||
SRCS= date.c netdate.c vary.c
|
||||
DPADD= ${LIBUTIL}
|
||||
LDADD= -lutil
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
+2
-2
@@ -299,7 +299,7 @@ for more information.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/log/messages -compact
|
||||
.It Pa /var/log/wtmp
|
||||
.It Pa /var/log/utx.log
|
||||
record of date resets and time changes
|
||||
.It Pa /var/log/messages
|
||||
record of the user setting the time
|
||||
@@ -406,9 +406,9 @@ fails.
|
||||
.Sh SEE ALSO
|
||||
.Xr locale 1 ,
|
||||
.Xr gettimeofday 2 ,
|
||||
.Xr getutxent 3 ,
|
||||
.Xr strftime 3 ,
|
||||
.Xr strptime 3 ,
|
||||
.Xr utmp 5 ,
|
||||
.Xr timed 8
|
||||
.Rs
|
||||
.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
|
||||
|
||||
+8
-3
@@ -48,12 +48,12 @@ __FBSDID("$FreeBSD$");
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <locale.h>
|
||||
#include <libutil.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <utmpx.h>
|
||||
|
||||
#include "extern.h"
|
||||
#include "vary.h"
|
||||
@@ -181,6 +181,7 @@ main(int argc, char *argv[])
|
||||
static void
|
||||
setthetime(const char *fmt, const char *p, int jflag, int nflag)
|
||||
{
|
||||
struct utmpx utx;
|
||||
struct tm *lt;
|
||||
struct timeval tv;
|
||||
const char *dot, *t;
|
||||
@@ -271,12 +272,16 @@ setthetime(const char *fmt, const char *p, int jflag, int nflag)
|
||||
if (!jflag) {
|
||||
/* set the time */
|
||||
if (nflag || netsettime(tval)) {
|
||||
logwtmp("|", "date", "");
|
||||
utx.ut_type = OLD_TIME;
|
||||
gettimeofday(&utx.ut_tv, NULL);
|
||||
pututxline(&utx);
|
||||
tv.tv_sec = tval;
|
||||
tv.tv_usec = 0;
|
||||
if (settimeofday(&tv, (struct timezone *)NULL))
|
||||
err(1, "settimeofday (timeval)");
|
||||
logwtmp("{", "date", "");
|
||||
utx.ut_type = NEW_TIME;
|
||||
gettimeofday(&utx.ut_tv, NULL);
|
||||
pututxline(&utx);
|
||||
}
|
||||
|
||||
if ((p = getlogin()) == NULL)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" Developed by the TrustedBSD Project.
|
||||
.\" Support for POSIX.1e access control lists.
|
||||
.\"
|
||||
.Dd September 04, 2009
|
||||
.Dd September 4, 2009
|
||||
.Dt GETFACL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
static int
|
||||
kdumpenv()
|
||||
kdumpenv(void)
|
||||
{
|
||||
char *buf, *cp;
|
||||
int buflen, envlen;
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
|
||||
numsig = strtol(*argv, &ep, 10);
|
||||
if (!**argv || *ep)
|
||||
errx(1, "illegal signal number: %s", *argv);
|
||||
if (numsig < 0 || numsig >= sys_nsig)
|
||||
if (numsig < 0)
|
||||
nosig(*argv);
|
||||
} else
|
||||
nosig(*argv);
|
||||
|
||||
+27
-11
@@ -113,6 +113,7 @@ static int f_listdir; /* list actual directory, not contents */
|
||||
static int f_listdot; /* list files beginning with . */
|
||||
static int f_noautodot; /* do not automatically enable -A for root */
|
||||
int f_longform; /* long listing format */
|
||||
static int f_nofollow; /* don't follow symbolic link arguments */
|
||||
int f_nonprint; /* show unprintables as ? */
|
||||
static int f_nosort; /* don't sort output */
|
||||
int f_notabs; /* don't use tab-separated multi-col output */
|
||||
@@ -234,6 +235,7 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'H':
|
||||
fts_options |= FTS_COMFOLLOW;
|
||||
f_nofollow = 0;
|
||||
break;
|
||||
case 'G':
|
||||
setenv("CLICOLOR", "", 1);
|
||||
@@ -241,11 +243,13 @@ main(int argc, char *argv[])
|
||||
case 'L':
|
||||
fts_options &= ~FTS_PHYSICAL;
|
||||
fts_options |= FTS_LOGICAL;
|
||||
f_nofollow = 0;
|
||||
break;
|
||||
case 'P':
|
||||
fts_options &= ~FTS_COMFOLLOW;
|
||||
fts_options &= ~FTS_LOGICAL;
|
||||
fts_options |= FTS_PHYSICAL;
|
||||
f_nofollow = 1;
|
||||
break;
|
||||
case 'R':
|
||||
f_recursive = 1;
|
||||
@@ -396,10 +400,10 @@ main(int argc, char *argv[])
|
||||
fts_options |= FTS_NOSTAT;
|
||||
|
||||
/*
|
||||
* If not -F, -d or -l options, follow any symbolic links listed on
|
||||
* If not -F, -P, -d or -l options, follow any symbolic links listed on
|
||||
* the command line.
|
||||
*/
|
||||
if (!f_longform && !f_listdir && !f_type)
|
||||
if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash))
|
||||
fts_options |= FTS_COMFOLLOW;
|
||||
|
||||
/*
|
||||
@@ -508,7 +512,7 @@ traverse(int argc, char *argv[], int options)
|
||||
break;
|
||||
case FTS_DNR:
|
||||
case FTS_ERR:
|
||||
warnx("%s: %s", p->fts_name, strerror(p->fts_errno));
|
||||
warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
|
||||
rval = 1;
|
||||
break;
|
||||
case FTS_D:
|
||||
@@ -559,7 +563,8 @@ display(const FTSENT *p, FTSENT *list, int options)
|
||||
long maxblock;
|
||||
u_long btotal, labelstrlen, maxinode, maxlen, maxnlink;
|
||||
u_long maxlabelstr;
|
||||
int bcfile, maxflags;
|
||||
u_int devstrlen;
|
||||
int maxflags;
|
||||
gid_t maxgroup;
|
||||
uid_t maxuser;
|
||||
size_t flen, ulen, glen;
|
||||
@@ -651,7 +656,7 @@ display(const FTSENT *p, FTSENT *list, int options)
|
||||
MAKENINES(maxsize);
|
||||
free(jinitmax);
|
||||
}
|
||||
bcfile = 0;
|
||||
devstrlen = 0;
|
||||
flags = NULL;
|
||||
for (cur = list, entries = 0; cur; cur = cur->fts_link) {
|
||||
if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) {
|
||||
@@ -791,9 +796,15 @@ display(const FTSENT *p, FTSENT *list, int options)
|
||||
np->group = &np->data[ulen + 1];
|
||||
(void)strcpy(np->group, group);
|
||||
|
||||
if (S_ISCHR(sp->st_mode) ||
|
||||
S_ISBLK(sp->st_mode))
|
||||
bcfile = 1;
|
||||
if ((S_ISCHR(sp->st_mode) ||
|
||||
S_ISBLK(sp->st_mode)) &&
|
||||
devstrlen < DEVSTR_HEX_LEN) {
|
||||
if (minor(sp->st_rdev) > 255 ||
|
||||
minor(sp->st_rdev) < 0)
|
||||
devstrlen = DEVSTR_HEX_LEN;
|
||||
else
|
||||
devstrlen = DEVSTR_LEN;
|
||||
}
|
||||
|
||||
if (f_flags) {
|
||||
np->flags = &np->data[ulen + glen + 2];
|
||||
@@ -825,7 +836,6 @@ display(const FTSENT *p, FTSENT *list, int options)
|
||||
d.entries = entries;
|
||||
d.maxlen = maxlen;
|
||||
if (needstats) {
|
||||
d.bcfile = bcfile;
|
||||
d.btotal = btotal;
|
||||
(void)snprintf(buf, sizeof(buf), "%lu", maxblock);
|
||||
d.s_block = strlen(buf);
|
||||
@@ -836,8 +846,14 @@ display(const FTSENT *p, FTSENT *list, int options)
|
||||
d.s_inode = strlen(buf);
|
||||
(void)snprintf(buf, sizeof(buf), "%lu", maxnlink);
|
||||
d.s_nlink = strlen(buf);
|
||||
(void)snprintf(buf, sizeof(buf), "%ju", maxsize);
|
||||
d.s_size = strlen(buf);
|
||||
if (f_humanval)
|
||||
d.s_size = HUMANVALSTR_LEN;
|
||||
else {
|
||||
(void)snprintf(buf, sizeof(buf), "%ju", maxsize);
|
||||
d.s_size = strlen(buf);
|
||||
}
|
||||
if (d.s_size < devstrlen)
|
||||
d.s_size = devstrlen;
|
||||
d.s_user = maxuser;
|
||||
}
|
||||
printfcn(&d);
|
||||
|
||||
+4
-1
@@ -35,6 +35,10 @@
|
||||
|
||||
#define NO_PRINT 1
|
||||
|
||||
#define HUMANVALSTR_LEN 5
|
||||
#define DEVSTR_LEN 8
|
||||
#define DEVSTR_HEX_LEN 15
|
||||
|
||||
extern long blocksize; /* block size units */
|
||||
|
||||
extern int f_accesstime; /* use time of last access */
|
||||
@@ -62,7 +66,6 @@ extern int f_color; /* add type in color for non-regular files */
|
||||
typedef struct {
|
||||
FTSENT *list;
|
||||
u_long btotal;
|
||||
int bcfile;
|
||||
int entries;
|
||||
int maxlen;
|
||||
u_int s_block;
|
||||
|
||||
+26
-12
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "extern.h"
|
||||
|
||||
static int printaname(const FTSENT *, u_long, u_long);
|
||||
static void printdev(size_t, dev_t);
|
||||
static void printlink(const FTSENT *);
|
||||
static void printtime(time_t);
|
||||
static int printtype(u_int);
|
||||
@@ -165,16 +166,7 @@ printlong(const DISPLAY *dp)
|
||||
if (f_label)
|
||||
(void)printf("%-*s ", dp->s_label, np->label);
|
||||
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
|
||||
if (minor(sp->st_rdev) > 255 || minor(sp->st_rdev) < 0)
|
||||
(void)printf("%3d, 0x%08x ",
|
||||
major(sp->st_rdev),
|
||||
(u_int)minor(sp->st_rdev));
|
||||
else
|
||||
(void)printf("%3d, %3d ",
|
||||
major(sp->st_rdev), minor(sp->st_rdev));
|
||||
else if (dp->bcfile)
|
||||
(void)printf("%*s%*jd ",
|
||||
8 - dp->s_size, "", dp->s_size, sp->st_size);
|
||||
printdev(dp->s_size, sp->st_rdev);
|
||||
else
|
||||
printsize(dp->s_size, sp->st_size);
|
||||
if (f_accesstime)
|
||||
@@ -353,6 +345,24 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
|
||||
return (chcnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print device special file major and minor numbers.
|
||||
*/
|
||||
static void
|
||||
printdev(size_t width, dev_t dev)
|
||||
{
|
||||
char buf[DEVSTR_HEX_LEN + 1];
|
||||
|
||||
if (minor(dev) > 255 || minor(dev) < 0)
|
||||
(void)snprintf(buf, sizeof(buf), "%3d, 0x%08x",
|
||||
major(dev), (u_int)minor(dev));
|
||||
else
|
||||
(void)snprintf(buf, sizeof(buf), "%3d, %3d",
|
||||
major(dev), minor(dev));
|
||||
|
||||
(void)printf("%*s ", (u_int)width, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
printtime(time_t ftime)
|
||||
{
|
||||
@@ -592,11 +602,15 @@ printsize(size_t width, off_t bytes)
|
||||
{
|
||||
|
||||
if (f_humanval) {
|
||||
char buf[5];
|
||||
/*
|
||||
* Reserve one space before the size and allocate room for
|
||||
* the trailing '\0'.
|
||||
*/
|
||||
char buf[HUMANVALSTR_LEN - 1 + 1];
|
||||
|
||||
humanize_number(buf, sizeof(buf), (int64_t)bytes, "",
|
||||
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
|
||||
(void)printf("%5s ", buf);
|
||||
(void)printf("%*s ", (u_int)width, buf);
|
||||
} else
|
||||
(void)printf("%*jd ", (u_int)width, bytes);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,4 @@ SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
|
||||
#MAN= pax.1 tar.1 cpio.1
|
||||
#LINKS= ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio
|
||||
|
||||
.if ${MACHINE_ARCH} == "arm"
|
||||
WARNS?= 3
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
+3
-3
@@ -67,7 +67,7 @@ typedef struct {
|
||||
char c_mtime[11]; /* modification time */
|
||||
char c_namesize[6]; /* length of pathname */
|
||||
char c_filesize[11]; /* length of file in bytes */
|
||||
} HD_CPIO;
|
||||
} HD_CPIO __aligned(1);
|
||||
|
||||
#define MAGIC 070707 /* transportable archive id */
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef struct {
|
||||
u_char h_namesize[2];
|
||||
u_char h_filesize_1[2];
|
||||
u_char h_filesize_2[2];
|
||||
} HD_BCPIO;
|
||||
} HD_BCPIO __aligned(1);
|
||||
|
||||
#ifdef _PAX_
|
||||
/*
|
||||
@@ -136,7 +136,7 @@ typedef struct {
|
||||
char c_rmin[8]; /* special file minor # */
|
||||
char c_namesize[8]; /* length of pathname */
|
||||
char c_chksum[8]; /* 0 OR CRC of bytes of FILE data */
|
||||
} HD_VCPIO;
|
||||
} HD_VCPIO __aligned(1);
|
||||
|
||||
#define VMAGIC 070701 /* sVr4 new portable archive id */
|
||||
#define VCMAGIC 070702 /* sVr4 new portable archive id CRC */
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ ftree_sel(ARCHD *arcn)
|
||||
*/
|
||||
|
||||
void
|
||||
ftree_notsel()
|
||||
ftree_notsel(void)
|
||||
{
|
||||
if (ftent != NULL)
|
||||
(void)fts_set(ftsp, ftent, FTS_SKIP);
|
||||
|
||||
+2
-8
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <langinfo.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <utmp.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -66,10 +65,6 @@ __FBSDID("$FreeBSD$");
|
||||
#define OLDFRMTM "%b %e %Y"
|
||||
#define CURFRMTD "%e %b %H:%M"
|
||||
#define OLDFRMTD "%e %b %Y"
|
||||
#ifndef UT_NAMESIZE
|
||||
#define UT_NAMESIZE 8
|
||||
#endif
|
||||
#define UT_GRPSIZE 6
|
||||
|
||||
static int d_first = -1;
|
||||
|
||||
@@ -116,9 +111,8 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
|
||||
*/
|
||||
if (strftime(f_date,DATELEN,timefrmt,localtime(&(sbp->st_mtime))) == 0)
|
||||
f_date[0] = '\0';
|
||||
(void)fprintf(fp, "%s%2u %-*s %-*s ", f_mode, sbp->st_nlink,
|
||||
UT_NAMESIZE, name_uid(sbp->st_uid, 1), UT_GRPSIZE,
|
||||
name_gid(sbp->st_gid, 1));
|
||||
(void)fprintf(fp, "%s%2u %-12s %-12s ", f_mode, sbp->st_nlink,
|
||||
name_uid(sbp->st_uid, 1), name_gid(sbp->st_gid, 1));
|
||||
|
||||
/*
|
||||
* print device id's for devices, or sizes for other nodes
|
||||
|
||||
@@ -396,6 +396,7 @@ trng_add(char *str)
|
||||
default:
|
||||
paxwarn(1, "Bad option %c with time range %s",
|
||||
*flgpt, str);
|
||||
free(pt);
|
||||
goto out;
|
||||
}
|
||||
++flgpt;
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ typedef struct {
|
||||
char chksum[CHK_LEN]; /* checksum */
|
||||
char linkflag; /* norm, hard, or sym. */
|
||||
char linkname[TNMSZ]; /* linked to name */
|
||||
} HD_TAR;
|
||||
} HD_TAR __aligned(1);
|
||||
|
||||
#ifdef _PAX_
|
||||
/*
|
||||
@@ -142,4 +142,4 @@ typedef struct {
|
||||
char devmajor[8]; /* major device number */
|
||||
char devminor[8]; /* minor device number */
|
||||
char prefix[TPFSZ]; /* linked to name */
|
||||
} HD_USTAR;
|
||||
} HD_USTAR __aligned(1);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= pkill
|
||||
WARNS?= 5
|
||||
|
||||
DPADD= ${LIBKVM}
|
||||
LDADD= -lkvm
|
||||
|
||||
+4
-9
@@ -16,13 +16,6 @@
|
||||
.\" 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 the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@@ -36,7 +29,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd May 16, 2009
|
||||
.Dd February 11, 2010
|
||||
.Dt PKILL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -44,7 +37,7 @@
|
||||
.Nd find or signal processes by name
|
||||
.Sh SYNOPSIS
|
||||
.Nm pgrep
|
||||
.Op Fl LSafilnovx
|
||||
.Op Fl LSafilnoqvx
|
||||
.Op Fl F Ar pidfile
|
||||
.Op Fl G Ar gid
|
||||
.Op Fl M Ar core
|
||||
@@ -175,6 +168,8 @@ command.
|
||||
Select only the newest (most recently started) of the matching processes.
|
||||
.It Fl o
|
||||
Select only the oldest (least recently started) of the matching processes.
|
||||
.It Fl q
|
||||
Do not write anything to standard output.
|
||||
.It Fl s Ar sid
|
||||
Restrict matches to processes with a session ID in the comma-separated
|
||||
list
|
||||
|
||||
+39
-21
@@ -16,13 +16,6 @@
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@@ -49,6 +42,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/time.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
@@ -110,17 +104,18 @@ static int matchargs;
|
||||
static int fullmatch;
|
||||
static int kthreads;
|
||||
static int cflags = REG_EXTENDED;
|
||||
static int quiet;
|
||||
static kvm_t *kd;
|
||||
static pid_t mypid;
|
||||
|
||||
static struct listhead euidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead ruidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead rgidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead pgrplist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead sidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead jidlist = SLIST_HEAD_INITIALIZER(list);
|
||||
static struct listhead euidlist = SLIST_HEAD_INITIALIZER(euidlist);
|
||||
static struct listhead ruidlist = SLIST_HEAD_INITIALIZER(ruidlist);
|
||||
static struct listhead rgidlist = SLIST_HEAD_INITIALIZER(rgidlist);
|
||||
static struct listhead pgrplist = SLIST_HEAD_INITIALIZER(pgrplist);
|
||||
static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(ppidlist);
|
||||
static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(tdevlist);
|
||||
static struct listhead sidlist = SLIST_HEAD_INITIALIZER(sidlist);
|
||||
static struct listhead jidlist = SLIST_HEAD_INITIALIZER(jidlist);
|
||||
|
||||
static void usage(void) __attribute__((__noreturn__));
|
||||
static int killact(const struct kinfo_proc *);
|
||||
@@ -180,9 +175,11 @@ main(int argc, char **argv)
|
||||
debug_opt = 0;
|
||||
pidfile = NULL;
|
||||
pidfilelock = 0;
|
||||
execf = coref = _PATH_DEVNULL;
|
||||
quiet = 0;
|
||||
execf = NULL;
|
||||
coref = _PATH_DEVNULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnos:t:u:vx")) != -1)
|
||||
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnoqs:t:u:vx")) != -1)
|
||||
switch (ch) {
|
||||
case 'D':
|
||||
debug_opt++;
|
||||
@@ -257,6 +254,11 @@ main(int argc, char **argv)
|
||||
oldest = 1;
|
||||
criteria = 1;
|
||||
break;
|
||||
case 'q':
|
||||
if (!pgrep)
|
||||
usage();
|
||||
quiet = 1;
|
||||
break;
|
||||
case 's':
|
||||
makelist(&sidlist, LT_SID, optarg);
|
||||
criteria = 1;
|
||||
@@ -548,7 +550,7 @@ usage(void)
|
||||
const char *ustr;
|
||||
|
||||
if (pgrep)
|
||||
ustr = "[-LSfilnovx] [-d delim]";
|
||||
ustr = "[-LSfilnoqvx] [-d delim]";
|
||||
else
|
||||
ustr = "[-signal] [-ILfinovx]";
|
||||
|
||||
@@ -566,6 +568,10 @@ show_process(const struct kinfo_proc *kp)
|
||||
{
|
||||
char **argv;
|
||||
|
||||
if (quiet) {
|
||||
assert(pgrep);
|
||||
return;
|
||||
}
|
||||
if ((longfmt || !pgrep) && matchargs &&
|
||||
(argv = kvm_getargv(kd, kp, 0)) != NULL) {
|
||||
printf("%d ", (int)kp->ki_pid);
|
||||
@@ -622,7 +628,8 @@ grepact(const struct kinfo_proc *kp)
|
||||
{
|
||||
|
||||
show_process(kp);
|
||||
printf("%s", delim);
|
||||
if (!quiet)
|
||||
printf("%s", delim);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -671,8 +678,19 @@ makelist(struct listhead *head, enum listtype type, char *src)
|
||||
li->li_number = -1; /* any jail */
|
||||
break;
|
||||
case LT_TTY:
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
if (li->li_number < 0)
|
||||
errx(STATUS_BADUSAGE,
|
||||
"Negative /dev/pts tty `%s'", sp);
|
||||
snprintf(buf, sizeof(buf), _PATH_DEV "pts/%s",
|
||||
sp);
|
||||
if (stat(buf, &st) != -1)
|
||||
goto foundtty;
|
||||
if (errno == ENOENT)
|
||||
errx(STATUS_BADUSAGE, "No such tty: `"
|
||||
_PATH_DEV "pts/%s'", sp);
|
||||
err(STATUS_ERROR, "Cannot access `"
|
||||
_PATH_DEV "pts/%s'", sp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+4
-3
@@ -70,7 +70,7 @@ static int vcmp(const void *, const void *);
|
||||
|
||||
/* PLEASE KEEP THE TABLE BELOW SORTED ALPHABETICALLY!!! */
|
||||
static VAR var[] = {
|
||||
{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 4, 0, CHAR, NULL, 0},
|
||||
{"%cpu", "%CPU", NULL, 0, pcpu, NULL, 5, 0, CHAR, NULL, 0},
|
||||
{"%mem", "%MEM", NULL, 0, pmem, NULL, 4, 0, CHAR, NULL, 0},
|
||||
{"acflag", "ACFLG", NULL, 0, kvar, NULL, 3, KOFF(ki_acflag), USHORT,
|
||||
"x", 0},
|
||||
@@ -159,7 +159,7 @@ static VAR var[] = {
|
||||
UINT, UIDFMT, 0},
|
||||
{"rgroup", "RGROUP", NULL, LJUST|DSIZ, rgroupname, s_rgroupname,
|
||||
USERLEN, 0, CHAR, NULL, 0},
|
||||
{"rss", "RSS", NULL, 0, kvar, NULL, 5, KOFF(ki_rssize), PGTOK, "ld", 0},
|
||||
{"rss", "RSS", NULL, 0, kvar, NULL, 6, KOFF(ki_rssize), PGTOK, "ld", 0},
|
||||
{"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR,
|
||||
NULL, 0},
|
||||
{"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid),
|
||||
@@ -207,7 +207,7 @@ static VAR var[] = {
|
||||
NULL, 0},
|
||||
{"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"vsize", "", "vsz", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"vsz", "VSZ", NULL, 0, vsize, NULL, 5, 0, CHAR, NULL, 0},
|
||||
{"vsz", "VSZ", NULL, 0, vsize, NULL, 6, 0, CHAR, NULL, 0},
|
||||
{"wchan", "WCHAN", NULL, LJUST, wchan, NULL, 6, 0, CHAR, NULL, 0},
|
||||
{"xstat", "XSTAT", NULL, 0, kvar, NULL, 4, KOFF(ki_xstat), USHORT,
|
||||
"x", 0},
|
||||
@@ -330,6 +330,7 @@ findvar(char *p, int user, char **header)
|
||||
errx(1, "malloc failed");
|
||||
snprintf(realfmt, rflen, "%s=%s", v->alias, hp);
|
||||
parsefmt(realfmt, user);
|
||||
free(realfmt);
|
||||
}
|
||||
return ((VAR *)NULL);
|
||||
}
|
||||
|
||||
+2
-1
@@ -212,7 +212,8 @@ main(int argc, char *argv[])
|
||||
init_list(&sesslist, addelem_pid, sizeof(pid_t), "session id");
|
||||
init_list(&ttylist, addelem_tty, sizeof(dev_t), "tty");
|
||||
init_list(&uidlist, addelem_uid, sizeof(uid_t), "user");
|
||||
memf = nlistf = _PATH_DEVNULL;
|
||||
memf = _PATH_DEVNULL;
|
||||
nlistf = NULL;
|
||||
while ((ch = getopt(argc, argv, PS_ARGS)) != -1)
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= pwait
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -0,0 +1,78 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2004-2009, Jilles Tjoelker
|
||||
.\" 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 OWNER 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$
|
||||
.\"
|
||||
.Dd November 1, 2009
|
||||
.Os
|
||||
.Dt PWAIT 1
|
||||
.Sh NAME
|
||||
.Nm pwait
|
||||
.Nd wait for processes to terminate
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl v
|
||||
.Ar pid
|
||||
\&...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility will wait until each of the given processes has terminated.
|
||||
.Pp
|
||||
The following option is available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl v
|
||||
Print the exit status when each process terminates.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility returns 0 on success, and >0 if an error occurs.
|
||||
.Pp
|
||||
Invalid pids elicit a warning message but are otherwise ignored.
|
||||
.Sh SEE ALSO
|
||||
.Xr kill 1 ,
|
||||
.Xr pkill 1 ,
|
||||
.Xr ps 1 ,
|
||||
.Xr wait 1 ,
|
||||
.Xr kqueue 2
|
||||
.Sh NOTES
|
||||
.Nm
|
||||
is not a substitute for the
|
||||
.Xr wait 1
|
||||
builtin
|
||||
as it will not clean up any zombies or state in the parent process.
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
command first appeared in SunOS 5.8.
|
||||
@@ -0,0 +1,145 @@
|
||||
/*-
|
||||
* Copyright (c) 2004-2009, Jilles Tjoelker
|
||||
* 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 OWNER 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/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: pwait [-v] pid ...\n");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
* pwait - wait for processes to terminate
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int kq;
|
||||
struct kevent *e;
|
||||
int verbose = 0;
|
||||
int opt, nleft, n, i, duplicate, status;
|
||||
long pid;
|
||||
char *s, *end;
|
||||
|
||||
while ((opt = getopt(argc, argv, "v")) != -1) {
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc == 0)
|
||||
usage();
|
||||
|
||||
kq = kqueue();
|
||||
if (kq == -1)
|
||||
err(1, "kqueue");
|
||||
|
||||
e = malloc(argc * sizeof(struct kevent));
|
||||
if (e == NULL)
|
||||
err(1, "malloc");
|
||||
nleft = 0;
|
||||
for (n = 0; n < argc; n++) {
|
||||
s = argv[n];
|
||||
if (!strncmp(s, "/proc/", 6)) /* Undocumented Solaris compat */
|
||||
s += 6;
|
||||
errno = 0;
|
||||
pid = strtol(s, &end, 10);
|
||||
if (pid < 0 || *end != '\0' || errno != 0) {
|
||||
warnx("%s: bad process id", s);
|
||||
continue;
|
||||
}
|
||||
duplicate = 0;
|
||||
for (i = 0; i < nleft; i++)
|
||||
if (e[i].ident == (uintptr_t)pid)
|
||||
duplicate = 1;
|
||||
if (!duplicate) {
|
||||
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT,
|
||||
0, NULL);
|
||||
if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
|
||||
warn("%ld", pid);
|
||||
else
|
||||
nleft++;
|
||||
}
|
||||
}
|
||||
|
||||
while (nleft > 0) {
|
||||
n = kevent(kq, NULL, 0, e, nleft, NULL);
|
||||
if (n == -1)
|
||||
err(1, "kevent");
|
||||
if (verbose)
|
||||
for (i = 0; i < n; i++) {
|
||||
status = e[i].data;
|
||||
if (WIFEXITED(status))
|
||||
printf("%ld: exited with status %d.\n",
|
||||
(long)e[i].ident,
|
||||
WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
printf("%ld: killed by signal %d.\n",
|
||||
(long)e[i].ident,
|
||||
WTERMSIG(status));
|
||||
else
|
||||
printf("%ld: terminated.\n",
|
||||
(long)e[i].ident);
|
||||
}
|
||||
nleft -= n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ PROG= rmail
|
||||
SRCS= rmail.c
|
||||
MAN= rmail.8
|
||||
|
||||
WARNS?= 0
|
||||
WARNS?= 2
|
||||
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
|
||||
|
||||
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
|
||||
|
||||
+5
-5
@@ -100,11 +100,10 @@ merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
|
||||
acl_get_brand_np(acl, &acl_brand);
|
||||
acl_get_brand_np(*prev_acl, &prev_acl_brand);
|
||||
|
||||
if (acl_brand != prev_acl_brand) {
|
||||
if (branding_mismatch(acl_brand, prev_acl_brand)) {
|
||||
warnx("%s: branding mismatch; existing ACL is %s, "
|
||||
"entry to be merged is %s", filename,
|
||||
prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
|
||||
acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
|
||||
brand_name(prev_acl_brand), brand_name(acl_brand));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -252,9 +251,10 @@ add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (acl_brand != ACL_BRAND_NFS4) {
|
||||
if (branding_mismatch(acl_brand, ACL_BRAND_NFS4)) {
|
||||
warnx("%s: branding mismatch; existing ACL is NFSv4, "
|
||||
"entry to be added is POSIX.1e", filename);
|
||||
"entry to be added is %s", filename,
|
||||
brand_name(acl_brand));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,11 +53,10 @@ remove_acl(acl_t acl, acl_t *prev_acl, const char *filename)
|
||||
acl_get_brand_np(acl, &acl_brand);
|
||||
acl_get_brand_np(*prev_acl, &prev_acl_brand);
|
||||
|
||||
if (acl_brand != prev_acl_brand) {
|
||||
if (branding_mismatch(acl_brand, prev_acl_brand)) {
|
||||
warnx("%s: branding mismatch; existing ACL is %s, "
|
||||
"entry to be removed is %s", filename,
|
||||
prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
|
||||
acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
|
||||
brand_name(prev_acl_brand), brand_name(acl_brand));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ void remove_ext(acl_t *prev_acl, const char *filename);
|
||||
int set_acl_mask(acl_t *prev_acl, const char *filename);
|
||||
/* util.c */
|
||||
void *zmalloc(size_t size);
|
||||
const char *brand_name(int brand);
|
||||
int branding_mismatch(int brand1, int brand2);
|
||||
|
||||
uint have_mask;
|
||||
uint need_mask;
|
||||
|
||||
@@ -43,3 +43,26 @@ zmalloc(size_t size)
|
||||
err(1, "calloc() failed");
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
const char *
|
||||
brand_name(int brand)
|
||||
{
|
||||
switch (brand) {
|
||||
case ACL_BRAND_NFS4:
|
||||
return "NFSv4";
|
||||
case ACL_BRAND_POSIX:
|
||||
return "POSIX.1e";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
branding_mismatch(int brand1, int brand2)
|
||||
{
|
||||
if (brand1 == ACL_BRAND_UNKNOWN || brand2 == ACL_BRAND_UNKNOWN)
|
||||
return (0);
|
||||
if (brand1 != brand2)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,13 +52,13 @@ __FBSDID("$FreeBSD$");
|
||||
STATIC struct alias *atab[ATABSIZE];
|
||||
STATIC int aliases;
|
||||
|
||||
STATIC void setalias(char *, char *);
|
||||
STATIC void setalias(const char *, const char *);
|
||||
STATIC int unalias(const char *);
|
||||
STATIC struct alias **hashalias(const char *);
|
||||
|
||||
STATIC
|
||||
void
|
||||
setalias(char *name, char *val)
|
||||
setalias(const char *name, const char *val)
|
||||
{
|
||||
struct alias *ap, **app;
|
||||
|
||||
@@ -176,7 +176,7 @@ rmaliases(void)
|
||||
}
|
||||
|
||||
struct alias *
|
||||
lookupalias(char *name, int check)
|
||||
lookupalias(const char *name, int check)
|
||||
{
|
||||
struct alias *ap = *hashalias(name);
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ struct alias {
|
||||
int flag;
|
||||
};
|
||||
|
||||
struct alias *lookupalias(char *, int);
|
||||
struct alias *lookupalias(const char *, int);
|
||||
int aliascmd(int, char **);
|
||||
int unaliascmd(int, char **);
|
||||
void rmaliases(void);
|
||||
|
||||
+2
-2
@@ -34,8 +34,8 @@
|
||||
|
||||
#define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
|
||||
|
||||
extern char *arith_buf, *arith_startbuf;
|
||||
extern const char *arith_buf, *arith_startbuf;
|
||||
|
||||
arith_t arith(char *);
|
||||
arith_t arith(const char *);
|
||||
void arith_lex_reset(void);
|
||||
int expcmd(int, char **);
|
||||
|
||||
+7
-7
@@ -85,9 +85,9 @@ expr:
|
||||
ARITH_LPAREN expr ARITH_RPAREN
|
||||
{ $$ = $2; } |
|
||||
expr ARITH_OR expr
|
||||
{ $$ = $1 ? $1 : $3 ? $3 : 0; } |
|
||||
{ $$ = $1 || $3; } |
|
||||
expr ARITH_AND expr
|
||||
{ $$ = $1 ? ( $3 ? $3 : 0 ) : 0; } |
|
||||
{ $$ = $1 && $3; } |
|
||||
expr ARITH_BOR expr
|
||||
{ $$ = $1 | $3; } |
|
||||
expr ARITH_BXOR expr
|
||||
@@ -265,7 +265,7 @@ expr:
|
||||
#define YYPARSE_PARAM_TYPE arith_t *
|
||||
#define YYPARSE_PARAM result
|
||||
|
||||
char *arith_buf, *arith_startbuf;
|
||||
const char *arith_buf, *arith_startbuf;
|
||||
|
||||
int yylex(void);
|
||||
int yyparse(YYPARSE_PARAM_TYPE);
|
||||
@@ -284,7 +284,7 @@ arith_assign(char *name, arith_t value)
|
||||
}
|
||||
|
||||
arith_t
|
||||
arith(char *s)
|
||||
arith(const char *s)
|
||||
{
|
||||
arith_t result;
|
||||
|
||||
@@ -299,7 +299,7 @@ arith(char *s)
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror(char *s)
|
||||
yyerror(const char *s)
|
||||
{
|
||||
|
||||
yyerrok;
|
||||
@@ -314,7 +314,7 @@ yyerror(char *s)
|
||||
int
|
||||
expcmd(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
char *concat;
|
||||
char **ap;
|
||||
arith_t i;
|
||||
@@ -354,7 +354,7 @@ main(int argc, char *argv[])
|
||||
printf("%d\n", exp(argv[1]));
|
||||
}
|
||||
|
||||
error(char *s)
|
||||
error(const char *s)
|
||||
{
|
||||
fprintf(stderr, "exp: %s\n", s);
|
||||
exit(1);
|
||||
|
||||
+23
-3
@@ -51,6 +51,13 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
int yylex(void);
|
||||
|
||||
struct varname
|
||||
{
|
||||
struct varname *next;
|
||||
char name[1];
|
||||
};
|
||||
static struct varname *varnames;
|
||||
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(buf,result,max) \
|
||||
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
|
||||
@@ -80,11 +87,14 @@ int yylex(void);
|
||||
* If variable doesn't exist, we should initialize
|
||||
* it to zero.
|
||||
*/
|
||||
char *temp;
|
||||
struct varname *temp;
|
||||
if (lookupvar(yytext) == NULL)
|
||||
setvarsafe(yytext, "0", 0);
|
||||
temp = (char *)ckmalloc(strlen(yytext) + 1);
|
||||
yylval.s_value = strcpy(temp, yytext);
|
||||
temp = ckmalloc(sizeof(struct varname) +
|
||||
strlen(yytext));
|
||||
temp->next = varnames;
|
||||
varnames = temp;
|
||||
yylval.s_value = strcpy(temp->name, yytext);
|
||||
|
||||
return ARITH_VAR;
|
||||
}
|
||||
@@ -130,5 +140,15 @@ int yylex(void);
|
||||
void
|
||||
arith_lex_reset(void)
|
||||
{
|
||||
struct varname *name, *next;
|
||||
|
||||
YY_NEW_FILE;
|
||||
|
||||
name = varnames;
|
||||
while (name != NULL) {
|
||||
next = name->next;
|
||||
ckfree(name);
|
||||
name = next;
|
||||
}
|
||||
varnames = NULL;
|
||||
}
|
||||
|
||||
+30
-23
@@ -70,7 +70,7 @@ STATIC int docd(char *, int, int);
|
||||
STATIC char *getcomponent(void);
|
||||
STATIC char *findcwd(char *);
|
||||
STATIC void updatepwd(char *);
|
||||
STATIC char *getpwd2(char *, size_t);
|
||||
STATIC char *getpwd2(void);
|
||||
|
||||
STATIC char *curdir = NULL; /* current working directory */
|
||||
STATIC char *prevdir; /* previous working directory */
|
||||
@@ -79,8 +79,8 @@ STATIC char *cdcomppath;
|
||||
int
|
||||
cdcmd(int argc, char **argv)
|
||||
{
|
||||
char *dest;
|
||||
char *path;
|
||||
const char *dest;
|
||||
const char *path;
|
||||
char *p;
|
||||
struct stat statb;
|
||||
int ch, phys, print = 0;
|
||||
@@ -263,10 +263,8 @@ findcwd(char *dir)
|
||||
* any more because we traversed a symbolic link or something
|
||||
* we couldn't stat().
|
||||
*/
|
||||
if (dir == NULL || curdir == NULL) {
|
||||
p = stalloc(PATH_MAX);
|
||||
return getpwd2(p, PATH_MAX);
|
||||
}
|
||||
if (dir == NULL || curdir == NULL)
|
||||
return getpwd2();
|
||||
cdcomppath = stalloc(strlen(dir) + 1);
|
||||
scopy(dir, cdcomppath);
|
||||
STARTSTACKSTR(new);
|
||||
@@ -313,7 +311,7 @@ updatepwd(char *dir)
|
||||
int
|
||||
pwdcmd(int argc, char **argv)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char *p;
|
||||
int ch, phys;
|
||||
|
||||
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
||||
@@ -341,9 +339,9 @@ pwdcmd(int argc, char **argv)
|
||||
out1str(curdir);
|
||||
out1c('\n');
|
||||
} else {
|
||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||
if ((p = getpwd2()) == NULL)
|
||||
error(".: %s", strerror(errno));
|
||||
out1str(buf);
|
||||
out1str(p);
|
||||
out1c('\n');
|
||||
}
|
||||
|
||||
@@ -356,36 +354,45 @@ pwdcmd(int argc, char **argv)
|
||||
char *
|
||||
getpwd(void)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char *p;
|
||||
|
||||
if (curdir)
|
||||
return curdir;
|
||||
|
||||
p = getpwd2(buf, sizeof(buf));
|
||||
p = getpwd2();
|
||||
if (p != NULL)
|
||||
curdir = savestr(p);
|
||||
|
||||
return curdir;
|
||||
}
|
||||
|
||||
#define MAXPWD 256
|
||||
|
||||
/*
|
||||
* Return the current directory.
|
||||
*/
|
||||
STATIC char *
|
||||
getpwd2(char *buf, size_t size)
|
||||
getpwd2(void)
|
||||
{
|
||||
if (getcwd(buf, size) == NULL) {
|
||||
char *pwd = getenv("PWD");
|
||||
struct stat stdot, stpwd;
|
||||
struct stat stdot, stpwd;
|
||||
char *pwd;
|
||||
int i;
|
||||
|
||||
if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
|
||||
stat(pwd, &stpwd) != -1 &&
|
||||
stdot.st_dev == stpwd.st_dev &&
|
||||
stdot.st_ino == stpwd.st_ino) {
|
||||
for (i = MAXPWD;; i *= 2) {
|
||||
pwd = stalloc(i);
|
||||
if (getcwd(pwd, i) != NULL)
|
||||
return pwd;
|
||||
}
|
||||
return NULL;
|
||||
stunalloc(pwd);
|
||||
if (errno != ERANGE)
|
||||
break;
|
||||
}
|
||||
return buf;
|
||||
|
||||
pwd = getenv("PWD");
|
||||
if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
|
||||
stat(pwd, &stpwd) != -1 &&
|
||||
stdot.st_dev == stpwd.st_dev &&
|
||||
stdot.st_ino == stpwd.st_ino) {
|
||||
return pwd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+16
-5
@@ -67,17 +67,21 @@ volatile sig_atomic_t intpending;
|
||||
char *commandname;
|
||||
|
||||
|
||||
static void exverror(int, const char *, va_list) __printf0like(2, 0);
|
||||
static void exverror(int, const char *, va_list) __printf0like(2, 0) __dead2;
|
||||
|
||||
/*
|
||||
* Called to raise an exception. Since C doesn't include exceptions, we
|
||||
* just do a longjmp to the exception handler. The type of exception is
|
||||
* stored in the global variable "exception".
|
||||
*
|
||||
* Interrupts are disabled; they should be reenabled when the exception is
|
||||
* caught.
|
||||
*/
|
||||
|
||||
void
|
||||
exraise(int e)
|
||||
{
|
||||
INTOFF;
|
||||
if (handler == NULL)
|
||||
abort();
|
||||
exception = e;
|
||||
@@ -138,8 +142,15 @@ onint(void)
|
||||
static void
|
||||
exverror(int cond, const char *msg, va_list ap)
|
||||
{
|
||||
CLEAR_PENDING_INT;
|
||||
INTOFF;
|
||||
/*
|
||||
* An interrupt trumps an error. Certain places catch error
|
||||
* exceptions or transform them to a plain nonzero exit code
|
||||
* in child processes, and if an error exception can be handled,
|
||||
* an interrupt can be handled as well.
|
||||
*
|
||||
* exraise() will disable interrupts for the exception handler.
|
||||
*/
|
||||
FORCEINTON;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (msg)
|
||||
@@ -149,8 +160,8 @@ exverror(int cond, const char *msg, va_list ap)
|
||||
#endif
|
||||
if (msg) {
|
||||
if (commandname)
|
||||
outfmt(&errout, "%s: ", commandname);
|
||||
doformat(&errout, msg, ap);
|
||||
outfmt(out2, "%s: ", commandname);
|
||||
doformat(out2, msg, ap);
|
||||
out2c('\n');
|
||||
}
|
||||
flushall();
|
||||
|
||||
+5
-3
@@ -72,14 +72,16 @@ extern volatile sig_atomic_t intpending;
|
||||
|
||||
#define INTOFF suppressint++
|
||||
#define INTON { if (--suppressint == 0 && intpending) onint(); }
|
||||
#define is_int_on() suppressint
|
||||
#define SETINTON(s) suppressint = (s)
|
||||
#define FORCEINTON {suppressint = 0; if (intpending) onint();}
|
||||
#define CLEAR_PENDING_INT intpending = 0
|
||||
#define int_pending() intpending
|
||||
|
||||
void exraise(int);
|
||||
void exraise(int) __dead2;
|
||||
void onint(void);
|
||||
void error(const char *, ...) __printf0like(1, 2);
|
||||
void exerror(int, const char *, ...) __printf0like(2, 3);
|
||||
void error(const char *, ...) __printf0like(1, 2) __dead2;
|
||||
void exerror(int, const char *, ...) __printf0like(2, 3) __dead2;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+37
-33
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
|
||||
MKINIT int evalskip; /* set if we are skipping commands */
|
||||
int evalskip; /* set if we are skipping commands */
|
||||
STATIC int skipcount; /* number of levels to skip */
|
||||
MKINIT int loopnest; /* current loop nesting level */
|
||||
int funcnest; /* depth of function calls */
|
||||
@@ -407,8 +407,7 @@ evalsubshell(union node *n, int flags)
|
||||
flags &=~ EV_TESTED;
|
||||
redirect(n->nredir.redirect, 0);
|
||||
evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */
|
||||
}
|
||||
if (! backgnd) {
|
||||
} else if (! backgnd) {
|
||||
INTOFF;
|
||||
exitstatus = waitforjob(jp, (int *)NULL);
|
||||
INTON;
|
||||
@@ -593,6 +592,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
char *savecmdname;
|
||||
struct shparam saveparam;
|
||||
struct localvar *savelocalvars;
|
||||
struct parsefile *savetopfile;
|
||||
volatile int e;
|
||||
char *lastarg;
|
||||
int realstatus;
|
||||
@@ -646,7 +646,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
out2str(ps4val());
|
||||
for (sp = varlist.list ; sp ; sp = sp->next) {
|
||||
if (sep != 0)
|
||||
outc(' ', &errout);
|
||||
out2c(' ');
|
||||
p = sp->text;
|
||||
while (*p != '=' && *p != '\0')
|
||||
out2c(*p++);
|
||||
@@ -658,7 +658,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
}
|
||||
for (sp = arglist.list ; sp ; sp = sp->next) {
|
||||
if (sep != 0)
|
||||
outc(' ', &errout);
|
||||
out2c(' ');
|
||||
/* Disambiguate command looking like assignment. */
|
||||
if (sp == arglist.list &&
|
||||
strchr(sp->text, '=') != NULL &&
|
||||
@@ -670,7 +670,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
out2qstr(sp->text);
|
||||
sep = ' ';
|
||||
}
|
||||
outc('\n', &errout);
|
||||
out2c('\n');
|
||||
flushout(&errout);
|
||||
}
|
||||
|
||||
@@ -713,12 +713,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
do_clearcmdentry = 1;
|
||||
}
|
||||
|
||||
find_command(argv[0], &cmdentry, 1, path);
|
||||
if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */
|
||||
exitstatus = 127;
|
||||
flushout(&errout);
|
||||
return;
|
||||
}
|
||||
find_command(argv[0], &cmdentry, 0, path);
|
||||
/* implement the bltin builtin here */
|
||||
if (cmdentry.cmdtype == CMDBUILTIN && cmdentry.u.index == BLTINCMD) {
|
||||
for (;;) {
|
||||
@@ -727,10 +722,10 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
break;
|
||||
if ((cmdentry.u.index = find_builtin(*argv,
|
||||
&cmdentry.special)) < 0) {
|
||||
outfmt(&errout, "%s: not found\n", *argv);
|
||||
exitstatus = 127;
|
||||
flushout(&errout);
|
||||
return;
|
||||
cmdentry.u.index = BLTINCMD;
|
||||
argv--;
|
||||
argc++;
|
||||
break;
|
||||
}
|
||||
if (cmdentry.u.index != BLTINCMD)
|
||||
break;
|
||||
@@ -740,7 +735,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
|
||||
/* Fork off a child process if necessary. */
|
||||
if (cmd->ncmd.backgnd
|
||||
|| (cmdentry.cmdtype == CMDNORMAL
|
||||
|| ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
|
||||
&& ((flags & EV_EXIT) == 0 || have_traps()))
|
||||
|| ((flags & EV_BACKCMD) != 0
|
||||
&& (cmdentry.cmdtype != CMDBUILTIN
|
||||
@@ -786,7 +781,6 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
savelocalvars = localvars;
|
||||
localvars = NULL;
|
||||
reffunc(cmdentry.u.func);
|
||||
INTON;
|
||||
savehandler = handler;
|
||||
if (setjmp(jmploc.loc)) {
|
||||
if (exception == EXSHELLPROC)
|
||||
@@ -798,19 +792,20 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
unreffunc(cmdentry.u.func);
|
||||
poplocalvars();
|
||||
localvars = savelocalvars;
|
||||
funcnest--;
|
||||
handler = savehandler;
|
||||
longjmp(handler->loc, 1);
|
||||
}
|
||||
handler = &jmploc;
|
||||
funcnest++;
|
||||
INTON;
|
||||
for (sp = varlist.list ; sp ; sp = sp->next)
|
||||
mklocal(sp->text);
|
||||
funcnest++;
|
||||
exitstatus = oexitstatus;
|
||||
if (flags & EV_TESTED)
|
||||
evaltree(getfuncnode(cmdentry.u.func), EV_TESTED);
|
||||
else
|
||||
evaltree(getfuncnode(cmdentry.u.func), 0);
|
||||
funcnest--;
|
||||
INTOFF;
|
||||
unreffunc(cmdentry.u.func);
|
||||
poplocalvars();
|
||||
@@ -818,6 +813,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
freeparam(&shellparam);
|
||||
shellparam = saveparam;
|
||||
handler = savehandler;
|
||||
funcnest--;
|
||||
popredir();
|
||||
INTON;
|
||||
if (evalskip == SKIPFUNC) {
|
||||
@@ -836,8 +832,10 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
memout.nextc = memout.buf;
|
||||
memout.bufsize = 64;
|
||||
mode |= REDIR_BACKQ;
|
||||
cmdentry.special = 0;
|
||||
}
|
||||
savecmdname = commandname;
|
||||
savetopfile = getcurrentfile();
|
||||
cmdenviron = varlist.list;
|
||||
e = -1;
|
||||
savehandler = handler;
|
||||
@@ -852,7 +850,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
listsetvar(cmdenviron);
|
||||
commandname = argv[0];
|
||||
argptr = argv + 1;
|
||||
optptr = NULL; /* initialize nextopt */
|
||||
nextopt_optptr = NULL; /* initialize nextopt */
|
||||
builtin_flags = flags;
|
||||
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
|
||||
flushall();
|
||||
@@ -868,24 +866,25 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
}
|
||||
}
|
||||
handler = savehandler;
|
||||
if (e != -1) {
|
||||
if ((e != EXERROR && e != EXEXEC)
|
||||
|| cmdentry.special)
|
||||
exraise(e);
|
||||
FORCEINTON;
|
||||
}
|
||||
if (cmdentry.u.index != EXECCMD)
|
||||
popredir();
|
||||
if (flags == EV_BACKCMD) {
|
||||
backcmd->buf = memout.buf;
|
||||
backcmd->nleft = memout.nextc - memout.buf;
|
||||
memout.buf = NULL;
|
||||
}
|
||||
if (e != -1) {
|
||||
if ((e != EXERROR && e != EXEXEC)
|
||||
|| cmdentry.special)
|
||||
exraise(e);
|
||||
popfilesupto(savetopfile);
|
||||
if (flags != EV_BACKCMD)
|
||||
FORCEINTON;
|
||||
}
|
||||
if (cmdentry.u.index != EXECCMD)
|
||||
popredir();
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
trputs("normal command: "); trargs(argv);
|
||||
#endif
|
||||
clearredir();
|
||||
redirect(cmd->ncmd.redirect, 0);
|
||||
for (sp = varlist.list ; sp ; sp = sp->next)
|
||||
setvareq(sp->text, VEXPORT|VSTACK);
|
||||
@@ -946,12 +945,17 @@ prehash(union node *n)
|
||||
*/
|
||||
|
||||
/*
|
||||
* No command given, or a bltin command with no arguments.
|
||||
* No command given, a bltin command with no arguments, or a bltin command
|
||||
* with an invalid name.
|
||||
*/
|
||||
|
||||
int
|
||||
bltincmd(int argc __unused, char **argv __unused)
|
||||
bltincmd(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1) {
|
||||
out2fmt_flush("%s: not found\n", argv[1]);
|
||||
return 127;
|
||||
}
|
||||
/*
|
||||
* Preserve exitstatus of a previous possible redirection
|
||||
* as POSIX mandates
|
||||
@@ -1026,7 +1030,7 @@ commandcmd(int argc, char **argv)
|
||||
if (cmd != -1) {
|
||||
if (argc != 1)
|
||||
error("wrong number of arguments");
|
||||
return typecmd_impl(2, argv - 1, cmd);
|
||||
return typecmd_impl(2, argv - 1, cmd, path);
|
||||
}
|
||||
if (argc != 0) {
|
||||
old = handler;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
extern char *commandname; /* currently executing command */
|
||||
extern int exitstatus; /* exit status of last command */
|
||||
extern int oexitstatus; /* saved exit status */
|
||||
extern struct strlist *cmdenviron; /* environment for builtin command */
|
||||
|
||||
|
||||
|
||||
+51
-42
@@ -98,7 +98,7 @@ int exerrno = 0; /* Last exec error */
|
||||
|
||||
STATIC void tryexec(char *, char **, char **);
|
||||
STATIC void printentry(struct tblentry *, int);
|
||||
STATIC struct tblentry *cmdlookup(char *, int);
|
||||
STATIC struct tblentry *cmdlookup(const char *, int);
|
||||
STATIC void delete_cmd_entry(void);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void);
|
||||
*/
|
||||
|
||||
void
|
||||
shellexec(char **argv, char **envp, char *path, int index)
|
||||
shellexec(char **argv, char **envp, const char *path, int idx)
|
||||
{
|
||||
char *cmdname;
|
||||
int e;
|
||||
@@ -120,7 +120,7 @@ shellexec(char **argv, char **envp, char *path, int index)
|
||||
} else {
|
||||
e = ENOENT;
|
||||
while ((cmdname = padvance(&path, argv[0])) != NULL) {
|
||||
if (--index < 0 && pathopt == NULL) {
|
||||
if (--idx < 0 && pathopt == NULL) {
|
||||
tryexec(cmdname, argv, envp);
|
||||
if (errno != ENOENT && errno != ENOTDIR)
|
||||
e = errno;
|
||||
@@ -175,13 +175,13 @@ tryexec(char *cmd, char **argv, char **envp)
|
||||
* NULL.
|
||||
*/
|
||||
|
||||
char *pathopt;
|
||||
const char *pathopt;
|
||||
|
||||
char *
|
||||
padvance(char **path, char *name)
|
||||
padvance(const char **path, const char *name)
|
||||
{
|
||||
char *p, *q;
|
||||
char *start;
|
||||
const char *p, *start;
|
||||
char *q;
|
||||
int len;
|
||||
|
||||
if (*path == NULL)
|
||||
@@ -255,7 +255,7 @@ hashcmd(int argc __unused, char **argv __unused)
|
||||
if (cmdp != NULL)
|
||||
printentry(cmdp, verbose);
|
||||
else
|
||||
outfmt(&errout, "%s: not found\n", name);
|
||||
outfmt(out2, "%s: not found\n", name);
|
||||
}
|
||||
flushall();
|
||||
}
|
||||
@@ -268,17 +268,17 @@ hashcmd(int argc __unused, char **argv __unused)
|
||||
STATIC void
|
||||
printentry(struct tblentry *cmdp, int verbose)
|
||||
{
|
||||
int index;
|
||||
char *path;
|
||||
int idx;
|
||||
const char *path;
|
||||
char *name;
|
||||
|
||||
if (cmdp->cmdtype == CMDNORMAL) {
|
||||
index = cmdp->param.index;
|
||||
idx = cmdp->param.index;
|
||||
path = pathval();
|
||||
do {
|
||||
name = padvance(&path, cmdp->cmdname);
|
||||
stunalloc(name);
|
||||
} while (--index >= 0);
|
||||
} while (--idx >= 0);
|
||||
out1str(name);
|
||||
} else if (cmdp->cmdtype == CMDBUILTIN) {
|
||||
out1fmt("builtin %s", cmdp->cmdname);
|
||||
@@ -310,10 +310,11 @@ printentry(struct tblentry *cmdp, int verbose)
|
||||
*/
|
||||
|
||||
void
|
||||
find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
find_command(const char *name, struct cmdentry *entry, int printerr,
|
||||
const char *path)
|
||||
{
|
||||
struct tblentry *cmdp;
|
||||
int index;
|
||||
int idx;
|
||||
int prev;
|
||||
char *fullname;
|
||||
struct stat statb;
|
||||
@@ -353,11 +354,11 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
}
|
||||
|
||||
e = ENOENT;
|
||||
index = -1;
|
||||
idx = -1;
|
||||
loop:
|
||||
while ((fullname = padvance(&path, name)) != NULL) {
|
||||
stunalloc(fullname);
|
||||
index++;
|
||||
idx++;
|
||||
if (pathopt) {
|
||||
if (prefix("builtin", pathopt)) {
|
||||
if ((i = find_builtin(name, &spec)) < 0)
|
||||
@@ -376,8 +377,8 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
}
|
||||
}
|
||||
/* if rehash, don't redo absolute path names */
|
||||
if (fullname[0] == '/' && index <= prev) {
|
||||
if (index < prev)
|
||||
if (fullname[0] == '/' && idx <= prev) {
|
||||
if (idx < prev)
|
||||
goto loop;
|
||||
TRACE(("searchexec \"%s\": no change\n", name));
|
||||
goto success;
|
||||
@@ -414,7 +415,7 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
INTOFF;
|
||||
cmdp = cmdlookup(name, 1);
|
||||
cmdp->cmdtype = CMDNORMAL;
|
||||
cmdp->param.index = index;
|
||||
cmdp->param.index = idx;
|
||||
INTON;
|
||||
goto success;
|
||||
}
|
||||
@@ -429,6 +430,7 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
outfmt(out2, "%s: %s\n", name, strerror(e));
|
||||
}
|
||||
entry->cmdtype = CMDUNKNOWN;
|
||||
entry->u.index = 0;
|
||||
return;
|
||||
|
||||
success:
|
||||
@@ -445,7 +447,7 @@ find_command(char *name, struct cmdentry *entry, int printerr, char *path)
|
||||
*/
|
||||
|
||||
int
|
||||
find_builtin(char *name, int *special)
|
||||
find_builtin(const char *name, int *special)
|
||||
{
|
||||
const struct builtincmd *bp;
|
||||
|
||||
@@ -492,18 +494,18 @@ void
|
||||
changepath(const char *newval)
|
||||
{
|
||||
const char *old, *new;
|
||||
int index;
|
||||
int idx;
|
||||
int firstchange;
|
||||
int bltin;
|
||||
|
||||
old = pathval();
|
||||
new = newval;
|
||||
firstchange = 9999; /* assume no change */
|
||||
index = 0;
|
||||
idx = 0;
|
||||
bltin = -1;
|
||||
for (;;) {
|
||||
if (*old != *new) {
|
||||
firstchange = index;
|
||||
firstchange = idx;
|
||||
if ((*old == '\0' && *new == ':')
|
||||
|| (*old == ':' && *new == '\0'))
|
||||
firstchange++;
|
||||
@@ -512,9 +514,9 @@ changepath(const char *newval)
|
||||
if (*new == '\0')
|
||||
break;
|
||||
if (*new == '%' && bltin < 0 && prefix("builtin", new + 1))
|
||||
bltin = index;
|
||||
bltin = idx;
|
||||
if (*new == ':') {
|
||||
index++;
|
||||
idx++;
|
||||
}
|
||||
new++, old++;
|
||||
}
|
||||
@@ -607,10 +609,10 @@ STATIC struct tblentry **lastcmdentry;
|
||||
|
||||
|
||||
STATIC struct tblentry *
|
||||
cmdlookup(char *name, int add)
|
||||
cmdlookup(const char *name, int add)
|
||||
{
|
||||
int hashval;
|
||||
char *p;
|
||||
const char *p;
|
||||
struct tblentry *cmdp;
|
||||
struct tblentry **pp;
|
||||
|
||||
@@ -663,7 +665,7 @@ delete_cmd_entry(void)
|
||||
*/
|
||||
|
||||
void
|
||||
addcmdentry(char *name, struct cmdentry *entry)
|
||||
addcmdentry(const char *name, struct cmdentry *entry)
|
||||
{
|
||||
struct tblentry *cmdp;
|
||||
|
||||
@@ -683,7 +685,7 @@ addcmdentry(char *name, struct cmdentry *entry)
|
||||
*/
|
||||
|
||||
void
|
||||
defun(char *name, union node *func)
|
||||
defun(const char *name, union node *func)
|
||||
{
|
||||
struct cmdentry entry;
|
||||
|
||||
@@ -700,7 +702,7 @@ defun(char *name, union node *func)
|
||||
*/
|
||||
|
||||
int
|
||||
unsetfunc(char *name)
|
||||
unsetfunc(const char *name)
|
||||
{
|
||||
struct tblentry *cmdp;
|
||||
|
||||
@@ -718,19 +720,21 @@ unsetfunc(char *name)
|
||||
*/
|
||||
|
||||
int
|
||||
typecmd_impl(int argc, char **argv, int cmd)
|
||||
typecmd_impl(int argc, char **argv, int cmd, const char *path)
|
||||
{
|
||||
struct cmdentry entry;
|
||||
struct tblentry *cmdp;
|
||||
char **pp;
|
||||
const char *const *pp;
|
||||
struct alias *ap;
|
||||
int i;
|
||||
int error = 0;
|
||||
extern char *const parsekwd[];
|
||||
int error1 = 0;
|
||||
|
||||
if (path != pathval())
|
||||
clearcmdentry(0);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
/* First look at the keywords */
|
||||
for (pp = (char **)parsekwd; *pp; pp++)
|
||||
for (pp = parsekwd; *pp; pp++)
|
||||
if (**pp == *argv[i] && equal(*pp, argv[i]))
|
||||
break;
|
||||
|
||||
@@ -760,16 +764,17 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
}
|
||||
else {
|
||||
/* Finally use brute force */
|
||||
find_command(argv[i], &entry, 0, pathval());
|
||||
find_command(argv[i], &entry, 0, path);
|
||||
}
|
||||
|
||||
switch (entry.cmdtype) {
|
||||
case CMDNORMAL: {
|
||||
if (strchr(argv[i], '/') == NULL) {
|
||||
char *path = pathval(), *name;
|
||||
const char *path2 = path;
|
||||
char *name;
|
||||
int j = entry.u.index;
|
||||
do {
|
||||
name = padvance(&path, argv[i]);
|
||||
name = padvance(&path2, argv[i]);
|
||||
stunalloc(name);
|
||||
} while (--j >= 0);
|
||||
if (cmd == TYPECMD_SMALLV)
|
||||
@@ -790,7 +795,7 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
if (cmd != TYPECMD_SMALLV)
|
||||
outfmt(out2, "%s: %s\n",
|
||||
argv[i], strerror(errno));
|
||||
error |= 127;
|
||||
error1 |= 127;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -815,11 +820,15 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
default:
|
||||
if (cmd != TYPECMD_SMALLV)
|
||||
outfmt(out2, "%s: not found\n", argv[i]);
|
||||
error |= 127;
|
||||
error1 |= 127;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
|
||||
if (path != pathval())
|
||||
clearcmdentry(0);
|
||||
|
||||
return error1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -829,5 +838,5 @@ typecmd_impl(int argc, char **argv, int cmd)
|
||||
int
|
||||
typecmd(int argc, char **argv)
|
||||
{
|
||||
return typecmd_impl(argc, argv, TYPECMD_TYPE);
|
||||
return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1));
|
||||
}
|
||||
|
||||
+9
-9
@@ -57,20 +57,20 @@ struct cmdentry {
|
||||
};
|
||||
|
||||
|
||||
extern char *pathopt; /* set by padvance */
|
||||
extern const char *pathopt; /* set by padvance */
|
||||
extern int exerrno; /* last exec error */
|
||||
|
||||
void shellexec(char **, char **, char *, int);
|
||||
char *padvance(char **, char *);
|
||||
void shellexec(char **, char **, const char *, int) __dead2;
|
||||
char *padvance(const char **, const char *);
|
||||
int hashcmd(int, char **);
|
||||
void find_command(char *, struct cmdentry *, int, char *);
|
||||
int find_builtin(char *, int *);
|
||||
void find_command(const char *, struct cmdentry *, int, const char *);
|
||||
int find_builtin(const char *, int *);
|
||||
void hashcd(void);
|
||||
void changepath(const char *);
|
||||
void deletefuncs(void);
|
||||
void addcmdentry(char *, struct cmdentry *);
|
||||
void defun(char *, union node *);
|
||||
int unsetfunc(char *);
|
||||
int typecmd_impl(int, char **, int);
|
||||
void addcmdentry(const char *, struct cmdentry *);
|
||||
void defun(const char *, union node *);
|
||||
int unsetfunc(const char *);
|
||||
int typecmd_impl(int, char **, int, const char *);
|
||||
int typecmd(int, char **);
|
||||
void clearcmdentry(int);
|
||||
|
||||
+16
-12
@@ -107,7 +107,7 @@ STATIC void expmeta(char *, char *);
|
||||
STATIC void addfname(char *);
|
||||
STATIC struct strlist *expsort(struct strlist *);
|
||||
STATIC struct strlist *msort(struct strlist *, int);
|
||||
STATIC int pmatch(char *, char *, int);
|
||||
STATIC int pmatch(const char *, const char *, int);
|
||||
STATIC char *cvtnum(int, char *);
|
||||
STATIC int collate_range_cmp(int, int);
|
||||
|
||||
@@ -271,8 +271,13 @@ exptilde(char *p, int flag)
|
||||
|
||||
while ((c = *p) != '\0') {
|
||||
switch(c) {
|
||||
case CTLESC:
|
||||
return (startp);
|
||||
case CTLESC: /* This means CTL* are always considered quoted. */
|
||||
case CTLVAR:
|
||||
case CTLENDVAR:
|
||||
case CTLBACKQ:
|
||||
case CTLBACKQ | CTLQUOTE:
|
||||
case CTLARI:
|
||||
case CTLENDARI:
|
||||
case CTLQUOTEMARK:
|
||||
return (startp);
|
||||
case ':':
|
||||
@@ -521,7 +526,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
|
||||
|
||||
case VSQUESTION:
|
||||
if (*p != CTLENDVAR) {
|
||||
outfmt(&errout, "%s\n", startp);
|
||||
outfmt(out2, "%s\n", startp);
|
||||
error((char *)NULL);
|
||||
}
|
||||
error("%.*s: parameter %snot set", (int)(p - str - 1),
|
||||
@@ -657,7 +662,7 @@ evalvar(char *p, int flag)
|
||||
}
|
||||
varlen = 0;
|
||||
startloc = expdest - stackblock();
|
||||
if (!set && uflag) {
|
||||
if (!set && uflag && *var != '@' && *var != '*') {
|
||||
switch (subtype) {
|
||||
case VSNORMAL:
|
||||
case VSTRIMLEFT:
|
||||
@@ -850,7 +855,6 @@ varvalue(char *name, int quoted, int subtype, int flag)
|
||||
int num;
|
||||
char *p;
|
||||
int i;
|
||||
extern int oexitstatus;
|
||||
char sep;
|
||||
char **ap;
|
||||
char const *syntax;
|
||||
@@ -974,7 +978,7 @@ ifsbreakup(char *string, struct arglist *arglist)
|
||||
char *start;
|
||||
char *p;
|
||||
char *q;
|
||||
char *ifs;
|
||||
const char *ifs;
|
||||
const char *ifsspc;
|
||||
int had_param_ch = 0;
|
||||
|
||||
@@ -1338,7 +1342,7 @@ msort(struct strlist *list, int len)
|
||||
*/
|
||||
|
||||
int
|
||||
patmatch(char *pattern, char *string, int squoted)
|
||||
patmatch(const char *pattern, const char *string, int squoted)
|
||||
{
|
||||
#ifdef notdef
|
||||
if (pattern[0] == '!' && pattern[1] == '!')
|
||||
@@ -1350,9 +1354,9 @@ patmatch(char *pattern, char *string, int squoted)
|
||||
|
||||
|
||||
STATIC int
|
||||
pmatch(char *pattern, char *string, int squoted)
|
||||
pmatch(const char *pattern, const char *string, int squoted)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
char c;
|
||||
|
||||
p = pattern;
|
||||
@@ -1400,7 +1404,7 @@ pmatch(char *pattern, char *string, int squoted)
|
||||
} while (*q++ != '\0');
|
||||
return 0;
|
||||
case '[': {
|
||||
char *endp;
|
||||
const char *endp;
|
||||
int invert, found;
|
||||
char chr;
|
||||
|
||||
@@ -1504,7 +1508,7 @@ rmescapes(char *str)
|
||||
*/
|
||||
|
||||
int
|
||||
casematch(union node *pattern, char *val)
|
||||
casematch(union node *pattern, const char *val)
|
||||
{
|
||||
struct stackmark smark;
|
||||
int result;
|
||||
|
||||
+2
-2
@@ -58,7 +58,7 @@ union node;
|
||||
void expandhere(union node *, int);
|
||||
void expandarg(union node *, struct arglist *, int);
|
||||
void expari(int);
|
||||
int patmatch(char *, char *, int);
|
||||
int patmatch(const char *, const char *, int);
|
||||
void rmescapes(char *);
|
||||
int casematch(union node *, char *);
|
||||
int casematch(union node *, const char *);
|
||||
int wordexpcmd(int, char **);
|
||||
|
||||
+10
-9
@@ -92,7 +92,7 @@ histedit(void)
|
||||
if (hist != NULL)
|
||||
sethistsize(histsizeval());
|
||||
else
|
||||
out2str("sh: can't initialize history\n");
|
||||
out2fmt_flush("sh: can't initialize history\n");
|
||||
}
|
||||
if (editing && !el && isatty(0)) { /* && isatty(2) ??? */
|
||||
/*
|
||||
@@ -114,7 +114,7 @@ histedit(void)
|
||||
el_set(el, EL_PROMPT, getprompt);
|
||||
} else {
|
||||
bad:
|
||||
out2str("sh: can't initialize editing\n");
|
||||
out2fmt_flush("sh: can't initialize editing\n");
|
||||
}
|
||||
INTON;
|
||||
} else if (!editing && el) {
|
||||
@@ -164,19 +164,19 @@ int
|
||||
histcmd(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
char *editor = NULL;
|
||||
const char *editor = NULL;
|
||||
HistEvent he;
|
||||
int lflg = 0, nflg = 0, rflg = 0, sflg = 0;
|
||||
int i, retval;
|
||||
char *firststr, *laststr;
|
||||
const char *firststr, *laststr;
|
||||
int first, last, direction;
|
||||
char *pat = NULL, *repl;
|
||||
char *pat = NULL, *repl = NULL;
|
||||
static int active = 0;
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *savehandler;
|
||||
char editfilestr[PATH_MAX];
|
||||
char *volatile editfile;
|
||||
FILE *efp;
|
||||
FILE *efp = NULL;
|
||||
int oldhistnum;
|
||||
|
||||
if (hist == NULL)
|
||||
@@ -336,6 +336,7 @@ histcmd(int argc, char **argv)
|
||||
if (sflg) {
|
||||
if (displayhist) {
|
||||
out2str(s);
|
||||
flushout(out2);
|
||||
}
|
||||
evalstring(s, 0);
|
||||
if (displayhist && hist) {
|
||||
@@ -405,7 +406,7 @@ fc_replace(const char *s, char *p, char *r)
|
||||
}
|
||||
|
||||
int
|
||||
not_fcnumber(char *s)
|
||||
not_fcnumber(const char *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
return (0);
|
||||
@@ -415,10 +416,10 @@ not_fcnumber(char *s)
|
||||
}
|
||||
|
||||
int
|
||||
str_to_event(char *str, int last)
|
||||
str_to_event(const char *str, int last)
|
||||
{
|
||||
HistEvent he;
|
||||
char *s = str;
|
||||
const char *s = str;
|
||||
int relative = 0;
|
||||
int i, retval;
|
||||
|
||||
|
||||
+33
-7
@@ -93,7 +93,7 @@ struct parsefile {
|
||||
|
||||
|
||||
int plinno = 1; /* input line number */
|
||||
MKINIT int parsenleft; /* copy of parsefile->nleft */
|
||||
int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
char *parsenextc; /* copy of parsefile->nextc */
|
||||
MKINIT struct parsefile basepf; /* top level input file */
|
||||
@@ -111,9 +111,9 @@ static int preadfd(void);
|
||||
INCLUDE "input.h"
|
||||
INCLUDE "error.h"
|
||||
|
||||
INIT {
|
||||
extern char basebuf[];
|
||||
MKINIT char basebuf[];
|
||||
|
||||
INIT {
|
||||
basepf.nextc = basepf.buf = basebuf;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ preadfd(void)
|
||||
if (flags >= 0 && flags & O_NONBLOCK) {
|
||||
flags &=~ O_NONBLOCK;
|
||||
if (fcntl(0, F_SETFL, flags) >= 0) {
|
||||
out2str("sh: turning off NDELAY mode\n");
|
||||
out2fmt_flush("sh: turning off NDELAY mode\n");
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ pushstring(char *s, int len, void *ap)
|
||||
struct strpush *sp;
|
||||
|
||||
INTOFF;
|
||||
/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
|
||||
/*out2fmt_flush("*** calling pushstring: %s, %d\n", s, len);*/
|
||||
if (parsefile->strpush) {
|
||||
sp = ckmalloc(sizeof (struct strpush));
|
||||
sp->prev = parsefile->strpush;
|
||||
@@ -386,7 +386,7 @@ popstring(void)
|
||||
parsenextc = sp->prevstring;
|
||||
parsenleft = sp->prevnleft;
|
||||
parselleft = sp->prevlleft;
|
||||
/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
|
||||
/*out2fmt_flush("*** calling popstring: restoring to '%s'\n", parsenextc);*/
|
||||
if (sp->ap)
|
||||
sp->ap->flag &= ~ALIASINUSE;
|
||||
parsefile->strpush = sp->prev;
|
||||
@@ -401,7 +401,7 @@ popstring(void)
|
||||
*/
|
||||
|
||||
void
|
||||
setinputfile(char *fname, int push)
|
||||
setinputfile(const char *fname, int push)
|
||||
{
|
||||
int fd;
|
||||
int fd2;
|
||||
@@ -508,6 +508,32 @@ popfile(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return current file (to go back to it later using popfilesupto()).
|
||||
*/
|
||||
|
||||
struct parsefile *
|
||||
getcurrentfile(void)
|
||||
{
|
||||
return parsefile;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pop files until the given file is on top again. Useful for regular
|
||||
* builtins that read shell commands from files or strings.
|
||||
* If the given file is not an active file, an error is raised.
|
||||
*/
|
||||
|
||||
void
|
||||
popfilesupto(struct parsefile *file)
|
||||
{
|
||||
while (parsefile != file && parsefile != &basepf)
|
||||
popfile();
|
||||
if (parsefile != file)
|
||||
error("popfilesupto() misused");
|
||||
}
|
||||
|
||||
/*
|
||||
* Return to top level.
|
||||
*/
|
||||
|
||||
+5
-1
@@ -45,6 +45,8 @@ extern int parsenleft; /* number of characters left in input buffer */
|
||||
extern char *parsenextc; /* next character in input buffer */
|
||||
extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */
|
||||
|
||||
struct parsefile;
|
||||
|
||||
char *pfgets(char *, int);
|
||||
int pgetc(void);
|
||||
int preadbuffer(void);
|
||||
@@ -52,10 +54,12 @@ int preadateof(void);
|
||||
void pungetc(void);
|
||||
void pushstring(char *, int, void *);
|
||||
void popstring(void);
|
||||
void setinputfile(char *, int);
|
||||
void setinputfile(const char *, int);
|
||||
void setinputfd(int, int);
|
||||
void setinputstring(char *, int);
|
||||
void popfile(void);
|
||||
struct parsefile *getcurrentfile(void);
|
||||
void popfilesupto(struct parsefile *);
|
||||
void popallfiles(void);
|
||||
void closescript(void);
|
||||
|
||||
|
||||
+8
-6
@@ -92,7 +92,7 @@ STATIC struct job *getjob(char *);
|
||||
STATIC pid_t dowait(int, struct job *);
|
||||
STATIC pid_t waitproc(int, int *);
|
||||
STATIC void cmdtxt(union node *);
|
||||
STATIC void cmdputs(char *);
|
||||
STATIC void cmdputs(const char *);
|
||||
#if JOBS
|
||||
STATIC void setcurjob(struct job *);
|
||||
STATIC void deljob(struct job *);
|
||||
@@ -146,7 +146,7 @@ setjobctl(int on)
|
||||
do { /* while we are in the background */
|
||||
initialpgrp = tcgetpgrp(ttyfd);
|
||||
if (initialpgrp < 0) {
|
||||
out: out2str("sh: can't access tty; job control turned off\n");
|
||||
out: out2fmt_flush("sh: can't access tty; job control turned off\n");
|
||||
mflag = 0;
|
||||
return;
|
||||
}
|
||||
@@ -757,6 +757,7 @@ forkshell(struct job *jp, union node *n, int mode)
|
||||
TRACE(("Child shell %d\n", (int)getpid()));
|
||||
wasroot = rootshell;
|
||||
rootshell = 0;
|
||||
handler = &main_handler;
|
||||
closescript();
|
||||
INTON;
|
||||
clear_traps();
|
||||
@@ -1046,7 +1047,7 @@ stoppedjobs(void)
|
||||
if (jp->used == 0)
|
||||
continue;
|
||||
if (jp->state == JOBSTOPPED) {
|
||||
out2str("You have stopped jobs.\n");
|
||||
out2fmt_flush("You have stopped jobs.\n");
|
||||
job_warning = 2;
|
||||
return (1);
|
||||
}
|
||||
@@ -1082,7 +1083,7 @@ cmdtxt(union node *n)
|
||||
{
|
||||
union node *np;
|
||||
struct nodelist *lp;
|
||||
char *p;
|
||||
const char *p;
|
||||
int i;
|
||||
char s[2];
|
||||
|
||||
@@ -1211,9 +1212,10 @@ cmdtxt(union node *n)
|
||||
|
||||
|
||||
STATIC void
|
||||
cmdputs(char *s)
|
||||
cmdputs(const char *s)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p;
|
||||
char *q;
|
||||
char c;
|
||||
int subtype = 0;
|
||||
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ void
|
||||
chkmail(int silent)
|
||||
{
|
||||
int i;
|
||||
char *mpath;
|
||||
const char *mpath;
|
||||
char *p;
|
||||
char *q;
|
||||
struct stackmark smark;
|
||||
|
||||
+11
-15
@@ -75,8 +75,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
int rootpid;
|
||||
int rootshell;
|
||||
struct jmploc main_handler;
|
||||
|
||||
STATIC void read_profile(char *);
|
||||
STATIC void read_profile(const char *);
|
||||
STATIC char *find_dot_file(char *);
|
||||
|
||||
/*
|
||||
@@ -90,14 +91,13 @@ STATIC char *find_dot_file(char *);
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct jmploc jmploc;
|
||||
struct stackmark smark;
|
||||
volatile int state;
|
||||
char *shinit;
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
state = 0;
|
||||
if (setjmp(jmploc.loc)) {
|
||||
if (setjmp(main_handler.loc)) {
|
||||
/*
|
||||
* When a shell procedure is executed, we raise the
|
||||
* exception EXSHELLPROC to clean up before executing
|
||||
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
|
||||
else
|
||||
goto state4;
|
||||
}
|
||||
handler = &jmploc;
|
||||
handler = &main_handler;
|
||||
#ifdef DEBUG
|
||||
opentrace();
|
||||
trputs("Shell args: "); trargs(argv);
|
||||
@@ -154,9 +154,11 @@ main(int argc, char *argv[])
|
||||
setstackmark(&smark);
|
||||
procargs(argc, argv);
|
||||
if (getpwd() == NULL && iflag)
|
||||
out2str("sh: cannot determine working directory\n");
|
||||
out2fmt_flush("sh: cannot determine working directory\n");
|
||||
if (getpwd() != NULL)
|
||||
setvar ("PWD", getpwd(), VEXPORT);
|
||||
if (iflag)
|
||||
chkmail(1);
|
||||
if (argv[0] && argv[0][0] == '-') {
|
||||
state = 1;
|
||||
read_profile("/etc/profile");
|
||||
@@ -223,7 +225,7 @@ cmdloop(int top)
|
||||
if (!stoppedjobs()) {
|
||||
if (!Iflag)
|
||||
break;
|
||||
out2str("\nUse \"exit\" to leave shell.\n");
|
||||
out2fmt_flush("\nUse \"exit\" to leave shell.\n");
|
||||
}
|
||||
numeof++;
|
||||
} else if (n != NULL && nflag == 0) {
|
||||
@@ -248,7 +250,7 @@ cmdloop(int top)
|
||||
*/
|
||||
|
||||
STATIC void
|
||||
read_profile(char *name)
|
||||
read_profile(const char *name)
|
||||
{
|
||||
int fd;
|
||||
|
||||
@@ -269,7 +271,7 @@ read_profile(char *name)
|
||||
*/
|
||||
|
||||
void
|
||||
readcmdfile(char *name)
|
||||
readcmdfile(const char *name)
|
||||
{
|
||||
int fd;
|
||||
|
||||
@@ -296,7 +298,7 @@ find_dot_file(char *basename)
|
||||
{
|
||||
static char localname[FILENAME_MAX+1];
|
||||
char *fullname;
|
||||
char *path = pathval();
|
||||
const char *path = pathval();
|
||||
struct stat statb;
|
||||
|
||||
/* don't try this for absolute or relative paths */
|
||||
@@ -315,7 +317,6 @@ find_dot_file(char *basename)
|
||||
int
|
||||
dotcmd(int argc, char **argv)
|
||||
{
|
||||
struct strlist *sp;
|
||||
char *fullname;
|
||||
|
||||
if (argc < 2)
|
||||
@@ -323,9 +324,6 @@ dotcmd(int argc, char **argv)
|
||||
|
||||
exitstatus = 0;
|
||||
|
||||
for (sp = cmdenviron; sp ; sp = sp->next)
|
||||
setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
|
||||
|
||||
fullname = find_dot_file(argv[1]);
|
||||
setinputfile(fullname, 1);
|
||||
commandname = fullname;
|
||||
@@ -338,8 +336,6 @@ dotcmd(int argc, char **argv)
|
||||
int
|
||||
exitcmd(int argc, char **argv)
|
||||
{
|
||||
extern int oexitstatus;
|
||||
|
||||
if (stoppedjobs())
|
||||
return 0;
|
||||
if (argc > 1)
|
||||
|
||||
+2
-1
@@ -35,8 +35,9 @@
|
||||
|
||||
extern int rootpid; /* pid of main shell */
|
||||
extern int rootshell; /* true if we aren't a child of the main shell */
|
||||
extern struct jmploc main_handler; /* top level exception handler */
|
||||
|
||||
void readcmdfile(char *);
|
||||
void readcmdfile(const char *);
|
||||
void cmdloop(int);
|
||||
int dotcmd(int, char **);
|
||||
int exitcmd(int, char **);
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ ckfree(pointer p)
|
||||
*/
|
||||
|
||||
char *
|
||||
savestr(char *s)
|
||||
savestr(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ extern int herefd;
|
||||
pointer ckmalloc(size_t);
|
||||
pointer ckrealloc(pointer, int);
|
||||
void ckfree(pointer);
|
||||
char *savestr(char *);
|
||||
char *savestr(const char *);
|
||||
pointer stalloc(int);
|
||||
void stunalloc(pointer);
|
||||
void setstackmark(struct stackmark *);
|
||||
|
||||
+2
-2
@@ -93,7 +93,7 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
char c;
|
||||
int rflag;
|
||||
char *prompt;
|
||||
char *ifs;
|
||||
const char *ifs;
|
||||
char *p;
|
||||
int startword;
|
||||
int status;
|
||||
@@ -254,7 +254,7 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
|
||||
|
||||
int
|
||||
umaskcmd(int argc __unused, char **argv)
|
||||
umaskcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
char *ap;
|
||||
int mask;
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ < $temp |
|
||||
awk '{ printf "#define %s %d\n", $1, NR-1}'
|
||||
echo '
|
||||
struct builtincmd {
|
||||
char *name;
|
||||
const char *name;
|
||||
int code;
|
||||
int special;
|
||||
};
|
||||
|
||||
+26
-26
@@ -102,9 +102,9 @@ struct block {
|
||||
*/
|
||||
|
||||
struct event {
|
||||
char *name; /* name of event (e.g. INIT) */
|
||||
char *routine; /* name of routine called on event */
|
||||
char *comment; /* comment describing routine */
|
||||
const char *name; /* name of event (e.g. INIT) */
|
||||
const char *routine; /* name of routine called on event */
|
||||
const char *comment; /* comment describing routine */
|
||||
struct text code; /* code for handling event */
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ struct event event[] = {
|
||||
};
|
||||
|
||||
|
||||
char *curfile; /* current file */
|
||||
const char *curfile; /* current file */
|
||||
int linno; /* current line */
|
||||
char *header_files[200]; /* list of header files */
|
||||
struct text defines; /* #define statements */
|
||||
@@ -148,20 +148,20 @@ struct text decls; /* declarations */
|
||||
int amiddecls; /* for formatting */
|
||||
|
||||
|
||||
void readfile(char *);
|
||||
int match(char *, char *);
|
||||
int gooddefine(char *);
|
||||
void doevent(struct event *, FILE *, char *);
|
||||
void readfile(const char *);
|
||||
int match(const char *, const char *);
|
||||
int gooddefine(const char *);
|
||||
void doevent(struct event *, FILE *, const char *);
|
||||
void doinclude(char *);
|
||||
void dodecl(char *, FILE *);
|
||||
void output(void);
|
||||
void addstr(char *, struct text *);
|
||||
void addstr(const char *, struct text *);
|
||||
void addchar(int, struct text *);
|
||||
void writetext(struct text *, FILE *);
|
||||
FILE *ckfopen(char *, char *);
|
||||
FILE *ckfopen(const char *, const char *);
|
||||
void *ckmalloc(size_t);
|
||||
char *savestr(char *);
|
||||
void error(char *);
|
||||
char *savestr(const char *);
|
||||
void error(const char *);
|
||||
|
||||
#define equal(s1, s2) (strcmp(s1, s2) == 0)
|
||||
|
||||
@@ -170,9 +170,9 @@ main(int argc __unused, char *argv[])
|
||||
{
|
||||
char **ap;
|
||||
|
||||
header_files[0] = "\"shell.h\"";
|
||||
header_files[1] = "\"mystring.h\"";
|
||||
header_files[2] = "\"init.h\"";
|
||||
header_files[0] = savestr("\"shell.h\"");
|
||||
header_files[1] = savestr("\"mystring.h\"");
|
||||
header_files[2] = savestr("\"init.h\"");
|
||||
for (ap = argv + 1 ; *ap ; ap++)
|
||||
readfile(*ap);
|
||||
output();
|
||||
@@ -186,7 +186,7 @@ main(int argc __unused, char *argv[])
|
||||
*/
|
||||
|
||||
void
|
||||
readfile(char *fname)
|
||||
readfile(const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[1024];
|
||||
@@ -230,9 +230,9 @@ readfile(char *fname)
|
||||
|
||||
|
||||
int
|
||||
match(char *name, char *line)
|
||||
match(const char *name, const char *line)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
|
||||
p = name, q = line;
|
||||
while (*p) {
|
||||
@@ -246,9 +246,9 @@ match(char *name, char *line)
|
||||
|
||||
|
||||
int
|
||||
gooddefine(char *line)
|
||||
gooddefine(const char *line)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
if (! match("#define", line))
|
||||
return 0; /* not a define */
|
||||
@@ -269,11 +269,11 @@ gooddefine(char *line)
|
||||
|
||||
|
||||
void
|
||||
doevent(struct event *ep, FILE *fp, char *fname)
|
||||
doevent(struct event *ep, FILE *fp, const char *fname)
|
||||
{
|
||||
char line[1024];
|
||||
int indent;
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
sprintf(line, "\n /* from %s: */\n", fname);
|
||||
addstr(line, &ep->code);
|
||||
@@ -407,7 +407,7 @@ output(void)
|
||||
*/
|
||||
|
||||
void
|
||||
addstr(char *s, struct text *text)
|
||||
addstr(const char *s, struct text *text)
|
||||
{
|
||||
while (*s) {
|
||||
if (--text->nleft < 0)
|
||||
@@ -452,7 +452,7 @@ writetext(struct text *text, FILE *fp)
|
||||
}
|
||||
|
||||
FILE *
|
||||
ckfopen(char *file, char *mode)
|
||||
ckfopen(const char *file, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
@@ -474,7 +474,7 @@ ckmalloc(size_t nbytes)
|
||||
}
|
||||
|
||||
char *
|
||||
savestr(char *s)
|
||||
savestr(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@@ -484,7 +484,7 @@ savestr(char *s)
|
||||
}
|
||||
|
||||
void
|
||||
error(char *msg)
|
||||
error(const char *msg)
|
||||
{
|
||||
if (curfile != NULL)
|
||||
fprintf(stderr, "%s:%d: ", curfile, linno);
|
||||
|
||||
+11
-11
@@ -55,8 +55,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
struct synclass {
|
||||
char *name;
|
||||
char *comment;
|
||||
const char *name;
|
||||
const char *comment;
|
||||
};
|
||||
|
||||
/* Syntax classes */
|
||||
@@ -101,16 +101,16 @@ static char writer[] = "\
|
||||
|
||||
static FILE *cfile;
|
||||
static FILE *hfile;
|
||||
static char *syntax[513];
|
||||
static const char *syntax[513];
|
||||
static int base;
|
||||
static int size; /* number of values which a char variable can have */
|
||||
static int nbits; /* number of bits in a character */
|
||||
static int digit_contig;/* true if digits are contiguous */
|
||||
|
||||
static void filltable(char *);
|
||||
static void filltable(const char *);
|
||||
static void init(void);
|
||||
static void add(char *, char *);
|
||||
static void print(char *);
|
||||
static void add(const char *, const char *);
|
||||
static void print(const char *);
|
||||
static void output_type_macros(void);
|
||||
static void digit_convert(void);
|
||||
|
||||
@@ -259,7 +259,7 @@ main(int argc __unused, char **argv __unused)
|
||||
*/
|
||||
|
||||
static void
|
||||
filltable(char *dftval)
|
||||
filltable(const char *dftval)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -293,7 +293,7 @@ init(void)
|
||||
*/
|
||||
|
||||
static void
|
||||
add(char *p, char *type)
|
||||
add(const char *p, const char *type)
|
||||
{
|
||||
while (*p)
|
||||
syntax[*p++ + base] = type;
|
||||
@@ -306,7 +306,7 @@ add(char *p, char *type)
|
||||
*/
|
||||
|
||||
static void
|
||||
print(char *name)
|
||||
print(const char *name)
|
||||
{
|
||||
int i;
|
||||
int col;
|
||||
@@ -338,7 +338,7 @@ print(char *name)
|
||||
* contiguous, we can test for them quickly.
|
||||
*/
|
||||
|
||||
static char *macro[] = {
|
||||
static const char *macro[] = {
|
||||
"#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)",
|
||||
"#define is_eof(c)\t((c) == PEOF)",
|
||||
"#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))",
|
||||
@@ -351,7 +351,7 @@ static char *macro[] = {
|
||||
static void
|
||||
output_type_macros(void)
|
||||
{
|
||||
char **pp;
|
||||
const char **pp;
|
||||
|
||||
if (digit_contig)
|
||||
macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ extern int displayhist;
|
||||
void histedit(void);
|
||||
void sethistsize(const char *);
|
||||
int histcmd(int, char **);
|
||||
int not_fcnumber(char *);
|
||||
int str_to_event(char *, int);
|
||||
int not_fcnumber(const char *);
|
||||
int str_to_event(const char *, int);
|
||||
int bindcmd(int, char **);
|
||||
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ int
|
||||
number(const char *s)
|
||||
{
|
||||
if (! is_number(s))
|
||||
error("Illegal number: %s", (char *)s);
|
||||
error("Illegal number: %s", s);
|
||||
return atoi(s);
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -64,7 +64,7 @@ char *arg0; /* value of $0 */
|
||||
struct shparam shellparam; /* current positional parameters */
|
||||
char **argptr; /* argument list for builtin commands */
|
||||
char *shoptarg; /* set by nextopt (like getopt) */
|
||||
char *optptr; /* used by nextopt */
|
||||
char *nextopt_optptr; /* used by nextopt */
|
||||
|
||||
char *minusc; /* argument to -c option */
|
||||
|
||||
@@ -554,12 +554,13 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
||||
*/
|
||||
|
||||
int
|
||||
nextopt(char *optstring)
|
||||
nextopt(const char *optstring)
|
||||
{
|
||||
char *p, *q;
|
||||
char *p;
|
||||
const char *q;
|
||||
char c;
|
||||
|
||||
if ((p = optptr) == NULL || *p == '\0') {
|
||||
if ((p = nextopt_optptr) == NULL || *p == '\0') {
|
||||
p = *argptr;
|
||||
if (p == NULL || *p != '-' || *++p == '\0')
|
||||
return '\0';
|
||||
@@ -580,6 +581,6 @@ nextopt(char *optstring)
|
||||
shoptarg = p;
|
||||
p = NULL;
|
||||
}
|
||||
optptr = p;
|
||||
nextopt_optptr = p;
|
||||
return c;
|
||||
}
|
||||
|
||||
+2
-2
@@ -102,7 +102,7 @@ extern char *arg0; /* $0 */
|
||||
extern struct shparam shellparam; /* $@ */
|
||||
extern char **argptr; /* argument list for builtin commands */
|
||||
extern char *shoptarg; /* set by nextopt */
|
||||
extern char *optptr; /* used by nextopt */
|
||||
extern char *nextopt_optptr; /* used by nextopt */
|
||||
|
||||
void procargs(int, char **);
|
||||
void optschanged(void);
|
||||
@@ -111,5 +111,5 @@ void freeparam(struct shparam *);
|
||||
int shiftcmd(int, char **);
|
||||
int setcmd(int, char **);
|
||||
int getoptscmd(int, char **);
|
||||
int nextopt(char *);
|
||||
int nextopt(const char *);
|
||||
void getoptsreset(const char *);
|
||||
|
||||
+3
-5
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
|
||||
static int doformat_wr(void *, const char *, int);
|
||||
|
||||
struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
|
||||
struct output errout = {NULL, 0, NULL, 100, 2, 0};
|
||||
struct output errout = {NULL, 0, NULL, 256, 2, 0};
|
||||
struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
|
||||
struct output *out1 = &output;
|
||||
struct output *out2 = &errout;
|
||||
@@ -124,8 +124,6 @@ outstr(const char *p, struct output *file)
|
||||
{
|
||||
while (*p)
|
||||
outc(*p++, file);
|
||||
if (file == out2)
|
||||
flushout(file);
|
||||
}
|
||||
|
||||
/* Like outstr(), but quote for re-input into the shell. */
|
||||
@@ -255,7 +253,7 @@ out1fmt(const char *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
dprintf(const char *fmt, ...)
|
||||
out2fmt_flush(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -316,7 +314,7 @@ doformat(struct output *dest, const char *f, va_list ap)
|
||||
*/
|
||||
|
||||
int
|
||||
xwrite(int fd, char *buf, int nbytes)
|
||||
xwrite(int fd, const char *buf, int nbytes)
|
||||
{
|
||||
int ntry;
|
||||
int i;
|
||||
|
||||
+7
-7
@@ -46,13 +46,13 @@ struct output {
|
||||
short flags;
|
||||
};
|
||||
|
||||
extern struct output output;
|
||||
extern struct output errout;
|
||||
extern struct output output; /* to fd 1 */
|
||||
extern struct output errout; /* to fd 2 */
|
||||
extern struct output memout;
|
||||
extern struct output *out1;
|
||||
extern struct output *out2;
|
||||
extern struct output *out1; /* &memout if backquote, otherwise &output */
|
||||
extern struct output *out2; /* &memout if backquote with 2>&1, otherwise
|
||||
&errout */
|
||||
|
||||
void open_mem(char *, int, struct output *);
|
||||
void out1str(const char *);
|
||||
void out1qstr(const char *);
|
||||
void out2str(const char *);
|
||||
@@ -65,10 +65,10 @@ void flushout(struct output *);
|
||||
void freestdout(void);
|
||||
void outfmt(struct output *, const char *, ...) __printflike(2, 3);
|
||||
void out1fmt(const char *, ...) __printflike(1, 2);
|
||||
void dprintf(const char *, ...) __printflike(1, 2);
|
||||
void out2fmt_flush(const char *, ...) __printflike(1, 2);
|
||||
void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
|
||||
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
|
||||
int xwrite(int, char *, int);
|
||||
int xwrite(int, const char *, int);
|
||||
|
||||
#define outc(c, file) (--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
|
||||
#define out1c(c) outc(c, out1);
|
||||
|
||||
+46
-31
@@ -82,7 +82,6 @@ struct heredoc {
|
||||
|
||||
|
||||
STATIC struct heredoc *heredoclist; /* list of here documents to read */
|
||||
STATIC int parsebackquote; /* nonzero if we are inside backquotes */
|
||||
STATIC int doprompt; /* if set, prompt the user */
|
||||
STATIC int needprompt; /* true if interactive and at start of line */
|
||||
STATIC int lasttoken; /* last token read */
|
||||
@@ -114,7 +113,7 @@ STATIC int xxreadtoken(void);
|
||||
STATIC int readtoken1(int, char const *, char *, int);
|
||||
STATIC int noexpand(char *);
|
||||
STATIC void synexpect(int);
|
||||
STATIC void synerror(char *);
|
||||
STATIC void synerror(const char *);
|
||||
STATIC void setprompt(int);
|
||||
|
||||
|
||||
@@ -365,7 +364,9 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
n1 = (union node *)stalloc(sizeof (struct nfor));
|
||||
n1->type = NFOR;
|
||||
n1->nfor.var = wordtext;
|
||||
if (readtoken() == TWORD && ! quoteflag && equal(wordtext, "in")) {
|
||||
while (readtoken() == TNL)
|
||||
;
|
||||
if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) {
|
||||
app = ≈
|
||||
while (readtoken() == TWORD) {
|
||||
n2 = (union node *)stalloc(sizeof (struct narg));
|
||||
@@ -1043,7 +1044,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
|
||||
endword:
|
||||
if (syntax == ARISYNTAX)
|
||||
synerror("Missing '))'");
|
||||
if (syntax != BASESYNTAX && ! parsebackquote && eofmark == NULL)
|
||||
if (syntax != BASESYNTAX && eofmark == NULL)
|
||||
synerror("Unterminated quoted string");
|
||||
if (varnest != 0) {
|
||||
startlinno = plinno;
|
||||
@@ -1303,24 +1304,31 @@ parsesub: {
|
||||
|
||||
parsebackq: {
|
||||
struct nodelist **nlpp;
|
||||
int savepbq;
|
||||
union node *n;
|
||||
char *volatile str;
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *const savehandler = handler;
|
||||
int savelen;
|
||||
int saveprompt;
|
||||
const int bq_startlinno = plinno;
|
||||
char *volatile ostr = NULL;
|
||||
struct parsefile *const savetopfile = getcurrentfile();
|
||||
|
||||
savepbq = parsebackquote;
|
||||
str = NULL;
|
||||
if (setjmp(jmploc.loc)) {
|
||||
popfilesupto(savetopfile);
|
||||
if (str)
|
||||
ckfree(str);
|
||||
parsebackquote = 0;
|
||||
if (ostr)
|
||||
ckfree(ostr);
|
||||
handler = savehandler;
|
||||
if (exception == EXERROR) {
|
||||
startlinno = bq_startlinno;
|
||||
synerror("Error in command substitution");
|
||||
}
|
||||
longjmp(handler->loc, 1);
|
||||
}
|
||||
INTOFF;
|
||||
str = NULL;
|
||||
savelen = out - stackblock();
|
||||
if (savelen > 0) {
|
||||
str = ckmalloc(savelen);
|
||||
@@ -1332,13 +1340,12 @@ parsebackq: {
|
||||
/* We must read until the closing backquote, giving special
|
||||
treatment to some slashes, and then push the string and
|
||||
reread it as input, interpreting it normally. */
|
||||
char *out;
|
||||
char *oout;
|
||||
int c;
|
||||
int savelen;
|
||||
char *str;
|
||||
int olen;
|
||||
|
||||
|
||||
STARTSTACKSTR(out);
|
||||
STARTSTACKSTR(oout);
|
||||
for (;;) {
|
||||
if (needprompt) {
|
||||
setprompt(2);
|
||||
@@ -1365,7 +1372,7 @@ parsebackq: {
|
||||
}
|
||||
if (c != '\\' && c != '`' && c != '$'
|
||||
&& (!dblquote || c != '"'))
|
||||
STPUTC('\\', out);
|
||||
STPUTC('\\', oout);
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
@@ -1381,23 +1388,22 @@ parsebackq: {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
STPUTC(c, out);
|
||||
STPUTC(c, oout);
|
||||
}
|
||||
done:
|
||||
STPUTC('\0', out);
|
||||
savelen = out - stackblock();
|
||||
if (savelen > 0) {
|
||||
str = ckmalloc(savelen);
|
||||
memcpy(str, stackblock(), savelen);
|
||||
setinputstring(str, 1);
|
||||
}
|
||||
STPUTC('\0', oout);
|
||||
olen = oout - stackblock();
|
||||
INTOFF;
|
||||
ostr = ckmalloc(olen);
|
||||
memcpy(ostr, stackblock(), olen);
|
||||
setinputstring(ostr, 1);
|
||||
INTON;
|
||||
}
|
||||
nlpp = &bqlist;
|
||||
while (*nlpp)
|
||||
nlpp = &(*nlpp)->next;
|
||||
*nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist));
|
||||
(*nlpp)->next = NULL;
|
||||
parsebackquote = oldstyle;
|
||||
|
||||
if (oldstyle) {
|
||||
saveprompt = doprompt;
|
||||
@@ -1433,7 +1439,12 @@ parsebackq: {
|
||||
str = NULL;
|
||||
INTON;
|
||||
}
|
||||
parsebackquote = savepbq;
|
||||
if (ostr) {
|
||||
INTOFF;
|
||||
ckfree(ostr);
|
||||
ostr = NULL;
|
||||
INTON;
|
||||
}
|
||||
handler = savehandler;
|
||||
if (arinest || dblquote)
|
||||
USTPUTC(CTLBACKQ | CTLQUOTE, out);
|
||||
@@ -1509,9 +1520,9 @@ noexpand(char *text)
|
||||
*/
|
||||
|
||||
int
|
||||
goodname(char *name)
|
||||
goodname(const char *name)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
p = name;
|
||||
if (! is_name(*p))
|
||||
@@ -1546,11 +1557,11 @@ synexpect(int token)
|
||||
|
||||
|
||||
STATIC void
|
||||
synerror(char *msg)
|
||||
synerror(const char *msg)
|
||||
{
|
||||
if (commandname)
|
||||
outfmt(&errout, "%s: %d: ", commandname, startlinno);
|
||||
outfmt(&errout, "Syntax error: %s\n", msg);
|
||||
outfmt(out2, "%s: %d: ", commandname, startlinno);
|
||||
outfmt(out2, "Syntax error: %s\n", msg);
|
||||
error((char *)NULL);
|
||||
}
|
||||
|
||||
@@ -1562,7 +1573,10 @@ setprompt(int which)
|
||||
#ifndef NO_HISTORY
|
||||
if (!el)
|
||||
#endif
|
||||
{
|
||||
out2str(getprompt(NULL));
|
||||
flushout(out2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1575,13 +1589,14 @@ getprompt(void *unused __unused)
|
||||
static char ps[PROMPTLEN];
|
||||
char *fmt;
|
||||
int i, j, trim;
|
||||
static char internal_error[] = "<internal prompt error>";
|
||||
|
||||
/*
|
||||
* Select prompt format.
|
||||
*/
|
||||
switch (whichprompt) {
|
||||
case 0:
|
||||
fmt = "";
|
||||
fmt = nullstr;
|
||||
break;
|
||||
case 1:
|
||||
fmt = ps1val();
|
||||
@@ -1590,7 +1605,7 @@ getprompt(void *unused __unused)
|
||||
fmt = ps2val();
|
||||
break;
|
||||
default:
|
||||
return "<internal prompt error>";
|
||||
return internal_error;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1626,7 +1641,7 @@ getprompt(void *unused __unused)
|
||||
case 'w':
|
||||
ps[i] = '\0';
|
||||
getcwd(&ps[i], PROMPTLEN - i);
|
||||
if (*fmt == 'W') {
|
||||
if (*fmt == 'W' && ps[i + 1] != '\0') {
|
||||
/* Final path component only. */
|
||||
trim = 1;
|
||||
for (j = i; ps[j] != '\0'; j++)
|
||||
|
||||
+2
-1
@@ -73,9 +73,10 @@
|
||||
extern int tokpushback;
|
||||
#define NEOF ((union node *)&tokpushback)
|
||||
extern int whichprompt; /* 1 == PS1, 2 == PS2 */
|
||||
extern const char *const parsekwd[];
|
||||
|
||||
|
||||
union node *parsecmd(int);
|
||||
void fixredir(union node *, const char *, int);
|
||||
int goodname(char *);
|
||||
int goodname(const char *);
|
||||
char *getprompt(void *);
|
||||
|
||||
+12
-17
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
#define EMPTY -2 /* marks an unused slot in redirtab */
|
||||
#define CLOSED -1 /* fd was not open before redir */
|
||||
#define PIPESIZE 4096 /* amount of buffering in a pipe */
|
||||
|
||||
|
||||
@@ -101,7 +102,6 @@ redirect(union node *redir, int flags)
|
||||
struct redirtab *sv = NULL;
|
||||
int i;
|
||||
int fd;
|
||||
int try;
|
||||
char memory[10]; /* file descriptors to write to memory */
|
||||
|
||||
for (i = 10 ; --i >= 0 ; )
|
||||
@@ -116,38 +116,30 @@ redirect(union node *redir, int flags)
|
||||
}
|
||||
for (n = redir ; n ; n = n->nfile.next) {
|
||||
fd = n->nfile.fd;
|
||||
try = 0;
|
||||
if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) &&
|
||||
n->ndup.dupfd == fd)
|
||||
continue; /* redirect from/to same file descriptor */
|
||||
|
||||
if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) {
|
||||
INTOFF;
|
||||
again:
|
||||
if ((i = fcntl(fd, F_DUPFD, 10)) == -1) {
|
||||
switch (errno) {
|
||||
case EBADF:
|
||||
if (!try) {
|
||||
openredirect(n, memory);
|
||||
try++;
|
||||
goto again;
|
||||
}
|
||||
/* FALLTHROUGH*/
|
||||
i = CLOSED;
|
||||
break;
|
||||
default:
|
||||
INTON;
|
||||
error("%d: %s", fd, strerror(errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!try) {
|
||||
sv->renamed[fd] = i;
|
||||
}
|
||||
} else
|
||||
(void)fcntl(i, F_SETFD, FD_CLOEXEC);
|
||||
sv->renamed[fd] = i;
|
||||
INTON;
|
||||
}
|
||||
if (fd == 0)
|
||||
fd0_redirected++;
|
||||
if (!try)
|
||||
openredirect(n, memory);
|
||||
openredirect(n, memory);
|
||||
}
|
||||
if (memory[1])
|
||||
out1 = &memout;
|
||||
@@ -166,8 +158,11 @@ openredirect(union node *redir, char memory[10])
|
||||
|
||||
/*
|
||||
* We suppress interrupts so that we won't leave open file
|
||||
* descriptors around. This may not be such a good idea because
|
||||
* an open of a device or a fifo can block indefinitely.
|
||||
* 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;
|
||||
|
||||
+14
-5
@@ -32,7 +32,7 @@
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 31, 2009
|
||||
.Dd December 31, 2009
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -296,7 +296,10 @@ sh -T -c "trap 'exit 1' 2 ; some-blocking-program"
|
||||
.Ed
|
||||
.It Fl u Li nounset
|
||||
Write a message to standard error when attempting
|
||||
to expand a variable that is not set, and if the
|
||||
to expand a variable, a positional parameter or
|
||||
the special parameter
|
||||
.Va \&!
|
||||
that is not set, and if the
|
||||
shell is not interactive, exit immediately.
|
||||
.It Fl V Li vi
|
||||
Enable the built-in
|
||||
@@ -862,7 +865,7 @@ command is:
|
||||
If
|
||||
.Ic in
|
||||
and the following words are omitted,
|
||||
.Ic in Li $@
|
||||
.Ic in Li \&"$@\&"
|
||||
is used instead.
|
||||
The words are expanded, and then the list is executed
|
||||
repeatedly with the variable set to each word in turn.
|
||||
@@ -1077,7 +1080,7 @@ and
|
||||
is
|
||||
.Dq Li "def ghi" ,
|
||||
then
|
||||
.Dq Li $@
|
||||
.Li \&"$@\&"
|
||||
expands to
|
||||
the two arguments:
|
||||
.Bd -literal -offset indent
|
||||
@@ -1227,6 +1230,9 @@ In all cases, the
|
||||
final value of
|
||||
.Ar parameter
|
||||
is substituted.
|
||||
Quoting inside
|
||||
.Ar word
|
||||
does not prevent field splitting or pathname expansion.
|
||||
Only variables, not positional
|
||||
parameters or special parameters, can be
|
||||
assigned in this way.
|
||||
@@ -2131,7 +2137,7 @@ and not found.
|
||||
For aliases the alias expansion is printed;
|
||||
for commands and tracked aliases
|
||||
the complete pathname of the command is printed.
|
||||
.It Ic ulimit Oo Fl HSabcdflmnpstuv Oc Op Ar limit
|
||||
.It Ic ulimit Oo Fl HSabcdflmnpstuvw Oc Op Ar limit
|
||||
Set or display resource limits (see
|
||||
.Xr getrlimit 2 ) .
|
||||
If
|
||||
@@ -2195,6 +2201,9 @@ The maximal amount of CPU time to be used by each process, in seconds.
|
||||
The maximal number of simultaneous processes for this user ID.
|
||||
.It Fl v Ar virtualmem
|
||||
The maximal virtual size of a process, in kilobytes.
|
||||
.It Fl w Ar swapuse
|
||||
The maximum amount of swap space reserved or used for this user ID,
|
||||
in kilobytes.
|
||||
.El
|
||||
.It Ic umask Oo Fl S Oc Op Ar mask
|
||||
Set the file creation mask (see
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ sh_trace(const char *fmt, ...)
|
||||
|
||||
|
||||
void
|
||||
trputs(char *s)
|
||||
trputs(const char *s)
|
||||
{
|
||||
if (tracefile == NULL)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -35,6 +35,6 @@ void showtree(union node *);
|
||||
void sh_trace(const char *, ...) __printflike(1, 2);
|
||||
void trargs(char **);
|
||||
void trputc(int);
|
||||
void trputs(char *);
|
||||
void trputs(const char *);
|
||||
void opentrace(void);
|
||||
#endif
|
||||
|
||||
+12
-7
@@ -149,6 +149,7 @@ trapcmd(int argc, char **argv)
|
||||
{
|
||||
char *action;
|
||||
int signo;
|
||||
int errors = 0;
|
||||
|
||||
if (argc <= 1) {
|
||||
for (signo = 0 ; signo < sys_nsig ; signo++) {
|
||||
@@ -183,8 +184,10 @@ trapcmd(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
while (*argv) {
|
||||
if ((signo = sigstring_to_signum(*argv)) == -1)
|
||||
error("bad signal %s", *argv);
|
||||
if ((signo = sigstring_to_signum(*argv)) == -1) {
|
||||
out2fmt_flush("trap: bad signal %s\n", *argv);
|
||||
errors = 1;
|
||||
}
|
||||
INTOFF;
|
||||
if (action)
|
||||
action = savestr(action);
|
||||
@@ -196,7 +199,7 @@ trapcmd(int argc, char **argv)
|
||||
INTON;
|
||||
argv++;
|
||||
}
|
||||
return 0;
|
||||
return errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +247,8 @@ void
|
||||
setsignal(int signo)
|
||||
{
|
||||
int action;
|
||||
sig_t sig, sigact = SIG_DFL;
|
||||
sig_t sigact = SIG_DFL;
|
||||
struct sigaction sa;
|
||||
char *t;
|
||||
|
||||
if ((t = trap[signo]) == NULL)
|
||||
@@ -320,9 +324,10 @@ setsignal(int signo)
|
||||
case S_IGN: sigact = SIG_IGN; break;
|
||||
}
|
||||
*t = action;
|
||||
sig = signal(signo, sigact);
|
||||
if (sig != SIG_ERR && action == S_CATCH)
|
||||
siginterrupt(signo, 1);
|
||||
sa.sa_handler = sigact;
|
||||
sa.sa_flags = 0;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(signo, &sa, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -45,4 +45,4 @@ void ignoresig(int);
|
||||
void onsig(int);
|
||||
void dotrap(void);
|
||||
void setinteractive(int);
|
||||
void exitshell(int);
|
||||
void exitshell(int) __dead2;
|
||||
|
||||
+45
-39
@@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
|
||||
struct varinit {
|
||||
struct var *var;
|
||||
int flags;
|
||||
char *text;
|
||||
const char *text;
|
||||
void (*func)(const char *);
|
||||
};
|
||||
|
||||
@@ -94,27 +94,27 @@ STATIC struct var voptind;
|
||||
|
||||
STATIC const struct varinit varinit[] = {
|
||||
#ifndef NO_HISTORY
|
||||
{ &vhistsize, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE=",
|
||||
{ &vhistsize, VUNSET, "HISTSIZE=",
|
||||
sethistsize },
|
||||
#endif
|
||||
{ &vifs, VSTRFIXED|VTEXTFIXED, "IFS= \t\n",
|
||||
{ &vifs, 0, "IFS= \t\n",
|
||||
NULL },
|
||||
{ &vmail, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL=",
|
||||
{ &vmail, VUNSET, "MAIL=",
|
||||
NULL },
|
||||
{ &vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH=",
|
||||
{ &vmpath, VUNSET, "MAILPATH=",
|
||||
NULL },
|
||||
{ &vpath, VSTRFIXED|VTEXTFIXED, "PATH=" _PATH_DEFPATH,
|
||||
{ &vpath, 0, "PATH=" _PATH_DEFPATH,
|
||||
changepath },
|
||||
{ &vppid, VSTRFIXED|VTEXTFIXED|VUNSET, "PPID=",
|
||||
{ &vppid, VUNSET, "PPID=",
|
||||
NULL },
|
||||
/*
|
||||
* vps1 depends on uid
|
||||
*/
|
||||
{ &vps2, VSTRFIXED|VTEXTFIXED, "PS2=> ",
|
||||
{ &vps2, 0, "PS2=> ",
|
||||
NULL },
|
||||
{ &vps4, VSTRFIXED|VTEXTFIXED, "PS4=+ ",
|
||||
{ &vps4, 0, "PS4=+ ",
|
||||
NULL },
|
||||
{ &voptind, VSTRFIXED|VTEXTFIXED, "OPTIND=1",
|
||||
{ &voptind, 0, "OPTIND=1",
|
||||
getoptsreset },
|
||||
{ NULL, 0, NULL,
|
||||
NULL }
|
||||
@@ -122,9 +122,9 @@ STATIC const struct varinit varinit[] = {
|
||||
|
||||
STATIC struct var *vartab[VTABSIZE];
|
||||
|
||||
STATIC struct var **hashvar(char *);
|
||||
STATIC int varequal(char *, char *);
|
||||
STATIC int localevar(char *);
|
||||
STATIC struct var **hashvar(const char *);
|
||||
STATIC int varequal(const char *, const char *);
|
||||
STATIC int localevar(const char *);
|
||||
|
||||
/*
|
||||
* Initialize the variable symbol tables and import the environment.
|
||||
@@ -132,9 +132,9 @@ STATIC int localevar(char *);
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "var.h"
|
||||
MKINIT char **environ;
|
||||
INIT {
|
||||
char **envp;
|
||||
extern char **environ;
|
||||
|
||||
initvar();
|
||||
for (envp = environ ; *envp ; envp++) {
|
||||
@@ -164,8 +164,8 @@ initvar(void)
|
||||
vpp = hashvar(ip->text);
|
||||
vp->next = *vpp;
|
||||
*vpp = vp;
|
||||
vp->text = ip->text;
|
||||
vp->flags = ip->flags;
|
||||
vp->text = __DECONST(char *, ip->text);
|
||||
vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED;
|
||||
vp->func = ip->func;
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ initvar(void)
|
||||
vpp = hashvar("PS1=");
|
||||
vps1.next = *vpp;
|
||||
*vpp = &vps1;
|
||||
vps1.text = geteuid() ? "PS1=$ " : "PS1=# ";
|
||||
vps1.text = __DECONST(char *, geteuid() ? "PS1=$ " : "PS1=# ");
|
||||
vps1.flags = VSTRFIXED|VTEXTFIXED;
|
||||
}
|
||||
if ((vppid.flags & VEXPORT) == 0) {
|
||||
@@ -190,12 +190,14 @@ initvar(void)
|
||||
*/
|
||||
|
||||
int
|
||||
setvarsafe(char *name, char *val, int flags)
|
||||
setvarsafe(const char *name, const char *val, int flags)
|
||||
{
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *const savehandler = handler;
|
||||
int err = 0;
|
||||
int inton;
|
||||
|
||||
inton = is_int_on();
|
||||
if (setjmp(jmploc.loc))
|
||||
err = 1;
|
||||
else {
|
||||
@@ -203,6 +205,7 @@ setvarsafe(char *name, char *val, int flags)
|
||||
setvar(name, val, flags);
|
||||
}
|
||||
handler = savehandler;
|
||||
SETINTON(inton);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -212,9 +215,9 @@ setvarsafe(char *name, char *val, int flags)
|
||||
*/
|
||||
|
||||
void
|
||||
setvar(char *name, char *val, int flags)
|
||||
setvar(const char *name, const char *val, int flags)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p;
|
||||
int len;
|
||||
int namelen;
|
||||
char *nameeq;
|
||||
@@ -242,25 +245,24 @@ setvar(char *name, char *val, int flags)
|
||||
} else {
|
||||
len += strlen(val);
|
||||
}
|
||||
p = nameeq = ckmalloc(len);
|
||||
q = name;
|
||||
while (--namelen >= 0)
|
||||
*p++ = *q++;
|
||||
*p++ = '=';
|
||||
*p = '\0';
|
||||
nameeq = ckmalloc(len);
|
||||
memcpy(nameeq, name, namelen);
|
||||
nameeq[namelen] = '=';
|
||||
if (val)
|
||||
scopy(val, p);
|
||||
scopy(val, nameeq + namelen + 1);
|
||||
else
|
||||
nameeq[namelen + 1] = '\0';
|
||||
setvareq(nameeq, flags);
|
||||
}
|
||||
|
||||
STATIC int
|
||||
localevar(char *s)
|
||||
localevar(const char *s)
|
||||
{
|
||||
static char *lnames[7] = {
|
||||
static const char *lnames[7] = {
|
||||
"ALL", "COLLATE", "CTYPE", "MONETARY",
|
||||
"NUMERIC", "TIME", NULL
|
||||
};
|
||||
char **ss;
|
||||
const char **ss;
|
||||
|
||||
if (*s != 'L')
|
||||
return 0;
|
||||
@@ -280,7 +282,7 @@ localevar(char *s)
|
||||
* pointer into environ where the string should not be manipulated.
|
||||
*/
|
||||
static void
|
||||
change_env(char *s, int set)
|
||||
change_env(const char *s, int set)
|
||||
{
|
||||
char *eqp;
|
||||
char *ss;
|
||||
@@ -335,8 +337,13 @@ setvareq(char *s, int flags)
|
||||
/*
|
||||
* We could roll this to a function, to handle it as
|
||||
* a regular variable function callback, but why bother?
|
||||
*
|
||||
* Note: this assumes iflag is not set to 1 initially.
|
||||
* As part of init(), this is called before arguments
|
||||
* are looked at.
|
||||
*/
|
||||
if (vp == &vmpath || (vp == &vmail && ! mpathset()))
|
||||
if ((vp == &vmpath || (vp == &vmail && ! mpathset())) &&
|
||||
iflag == 1)
|
||||
chkmail(1);
|
||||
if ((vp->flags & VEXPORT) && localevar(s)) {
|
||||
change_env(s, 1);
|
||||
@@ -386,7 +393,7 @@ listsetvar(struct strlist *list)
|
||||
*/
|
||||
|
||||
char *
|
||||
lookupvar(char *name)
|
||||
lookupvar(const char *name)
|
||||
{
|
||||
struct var *v;
|
||||
|
||||
@@ -409,7 +416,7 @@ lookupvar(char *name)
|
||||
*/
|
||||
|
||||
char *
|
||||
bltinlookup(char *name, int doall)
|
||||
bltinlookup(const char *name, int doall)
|
||||
{
|
||||
struct strlist *sp;
|
||||
struct var *v;
|
||||
@@ -467,9 +474,9 @@ environment(void)
|
||||
* VSTACK set since these are currently allocated on the stack.
|
||||
*/
|
||||
|
||||
#ifdef mkinit
|
||||
MKINIT void shprocvar(void);
|
||||
|
||||
#ifdef mkinit
|
||||
SHELLPROC {
|
||||
shprocvar();
|
||||
}
|
||||
@@ -604,7 +611,6 @@ exportcmd(int argc, char **argv)
|
||||
|
||||
if (values && argc != 0)
|
||||
error("-p requires no arguments");
|
||||
listsetvar(cmdenviron);
|
||||
if (argc != 0) {
|
||||
while ((name = *argv++) != NULL) {
|
||||
if ((p = strchr(name, '=')) != NULL) {
|
||||
@@ -794,7 +800,7 @@ unsetcmd(int argc __unused, char **argv __unused)
|
||||
*/
|
||||
|
||||
int
|
||||
unsetvar(char *s)
|
||||
unsetvar(const char *s)
|
||||
{
|
||||
struct var **vpp;
|
||||
struct var *vp;
|
||||
@@ -834,7 +840,7 @@ unsetvar(char *s)
|
||||
*/
|
||||
|
||||
STATIC struct var **
|
||||
hashvar(char *p)
|
||||
hashvar(const char *p)
|
||||
{
|
||||
unsigned int hashval;
|
||||
|
||||
@@ -853,7 +859,7 @@ hashvar(char *p)
|
||||
*/
|
||||
|
||||
STATIC int
|
||||
varequal(char *p, char *q)
|
||||
varequal(const char *p, const char *q)
|
||||
{
|
||||
while (*p == *q++) {
|
||||
if (*p++ == '=')
|
||||
|
||||
+5
-6
@@ -101,14 +101,13 @@ extern struct var vhistsize;
|
||||
#define mpathset() ((vmpath.flags & VUNSET) == 0)
|
||||
|
||||
void initvar(void);
|
||||
void setvar(char *, char *, int);
|
||||
void setvar(const char *, const char *, int);
|
||||
void setvareq(char *, int);
|
||||
struct strlist;
|
||||
void listsetvar(struct strlist *);
|
||||
char *lookupvar(char *);
|
||||
char *bltinlookup(char *, int);
|
||||
char *lookupvar(const char *);
|
||||
char *bltinlookup(const char *, int);
|
||||
char **environment(void);
|
||||
void shprocvar(void);
|
||||
int showvarscmd(int, char **);
|
||||
int exportcmd(int, char **);
|
||||
int localcmd(int, char **);
|
||||
@@ -116,5 +115,5 @@ void mklocal(char *);
|
||||
void poplocalvars(void);
|
||||
int setvarcmd(int, char **);
|
||||
int unsetcmd(int, char **);
|
||||
int unsetvar(char *);
|
||||
int setvarsafe(char *, char *, int);
|
||||
int unsetvar(const char *);
|
||||
int setvarsafe(const char *, const char *, int);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= uuidgen
|
||||
WARNS?= 6
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* Print intent log header and statistics.
|
||||
*/
|
||||
@@ -345,8 +343,10 @@ dump_intent_log(zilog_t *zilog)
|
||||
if (zh->zh_log.blk_birth == 0 || verbose < 2)
|
||||
return;
|
||||
|
||||
(void) printf("\n ZIL header: claim_txg %llu, seq %llu\n",
|
||||
(u_longlong_t)zh->zh_claim_txg, (u_longlong_t)zh->zh_replay_seq);
|
||||
(void) printf("\n ZIL header: claim_txg %llu, claim_seq %llu",
|
||||
(u_longlong_t)zh->zh_claim_txg, (u_longlong_t)zh->zh_claim_seq);
|
||||
(void) printf(" replay_seq %llu, flags 0x%llx\n",
|
||||
(u_longlong_t)zh->zh_replay_seq, (u_longlong_t)zh->zh_flags);
|
||||
|
||||
if (verbose >= 4)
|
||||
print_log_bp(&zh->zh_log, "\n\tfirst block: ");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -2457,7 +2457,7 @@ zfs_do_receive(int argc, char **argv)
|
||||
|
||||
bzero(&flags, sizeof (recvflags_t));
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, ":dnvF")) != -1) {
|
||||
while ((c = getopt(argc, argv, ":dnuvF")) != -1) {
|
||||
switch (c) {
|
||||
case 'd':
|
||||
flags.isprefix = B_TRUE;
|
||||
@@ -2465,6 +2465,9 @@ zfs_do_receive(int argc, char **argv)
|
||||
case 'n':
|
||||
flags.dryrun = B_TRUE;
|
||||
break;
|
||||
case 'u':
|
||||
flags.nomount = B_TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
flags.verbose = B_TRUE;
|
||||
break;
|
||||
|
||||
@@ -3488,6 +3488,8 @@ zpool_do_upgrade(int argc, char **argv)
|
||||
(void) printf(gettext(" 11 Improved scrub performance\n"));
|
||||
(void) printf(gettext(" 12 Snapshot properties\n"));
|
||||
(void) printf(gettext(" 13 snapused property\n"));
|
||||
(void) printf(gettext(" 14 passthrough-x aclinherit "
|
||||
"support\n"));
|
||||
(void) printf(gettext("For more information on a particular "
|
||||
"version, including supported releases, see:\n\n"));
|
||||
(void) printf("http://www.opensolaris.org/os/community/zfs/"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -457,6 +457,9 @@ typedef struct recvflags {
|
||||
|
||||
/* byteswap flag is used internally; callers need not specify */
|
||||
int byteswap : 1;
|
||||
|
||||
/* do not mount file systems as they are extracted (private) */
|
||||
int nomount : 1;
|
||||
} recvflags_t;
|
||||
|
||||
extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,
|
||||
|
||||
@@ -1790,11 +1790,14 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
|
||||
|
||||
/* We don't support those properties on FreeBSD. */
|
||||
switch (prop) {
|
||||
case ZFS_PROP_SHAREISCSI:
|
||||
case ZFS_PROP_DEVICES:
|
||||
case ZFS_PROP_ACLMODE:
|
||||
case ZFS_PROP_ACLINHERIT:
|
||||
case ZFS_PROP_ZONED:
|
||||
case ZFS_PROP_SHAREISCSI:
|
||||
case ZFS_PROP_ISCSIOPTIONS:
|
||||
case ZFS_PROP_XATTR:
|
||||
case ZFS_PROP_VSCAN:
|
||||
case ZFS_PROP_NBMAND:
|
||||
case ZFS_PROP_SHARESMB:
|
||||
(void) snprintf(errbuf, sizeof (errbuf),
|
||||
"property '%s' not supported on FreeBSD", propname);
|
||||
ret = zfs_error(hdl, EZFS_PERM, errbuf);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
@@ -2080,7 +2080,7 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, recvflags_t flags,
|
||||
|
||||
err = zfs_receive_impl(hdl, tosnap, flags, infd, stream_avl, &top_zfs);
|
||||
|
||||
if (err == 0 && top_zfs) {
|
||||
if (err == 0 && !flags.nomount && top_zfs) {
|
||||
zfs_handle_t *zhp;
|
||||
prop_changelist_t *clp;
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
|
||||
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
|
||||
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
|
||||
|
||||
LDADD+= -lctf -ldwarf -lelf -lz -lthr
|
||||
DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
|
||||
LDADD= -lctf -ldwarf -lelf -lz -lpthread
|
||||
|
||||
.PATH: ${.CURDIR}
|
||||
.PATH: ${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common
|
||||
|
||||
@@ -19,9 +19,8 @@ CFLAGS+= -I${OPENSOLARIS_USR_DISTDIR} \
|
||||
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common \
|
||||
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
|
||||
|
||||
LDFLAGS+= -pthread
|
||||
|
||||
LDADD+= -lelf -lz
|
||||
DPADD= ${LIBPTHREAD} ${LIBELF} ${LIBZ}
|
||||
LDADD= -lpthread -lelf -lz
|
||||
|
||||
.PATH: ${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common
|
||||
.PATH: ${OPENSOLARIS_USR_DISTDIR}/tools/ctf/dump
|
||||
|
||||
@@ -37,7 +37,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
|
||||
-I${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt \
|
||||
-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
|
||||
|
||||
LDADD+= -lctf -ldwarf -lelf -lz -lthr
|
||||
DPADD= ${LIBCTF} ${LIBDWARF} ${LIBELF} ${LIBZ} ${LIBPTHREAD}
|
||||
LDADD= -lctf -ldwarf -lelf -lz -lpthread
|
||||
|
||||
.PATH: ${OPENSOLARIS_USR_DISTDIR}/tools/ctf/common
|
||||
.PATH: ${OPENSOLARIS_USR_DISTDIR}/tools/ctf/cvt
|
||||
|
||||
@@ -19,7 +19,7 @@ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
|
||||
CFLAGS+= -I${.CURDIR}/../../lib/libumem
|
||||
|
||||
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
|
||||
${LIBZFS} ${LIBZPOOL} ${LIBUUTIL}
|
||||
${LIBZFS} ${LIBZPOOL}
|
||||
LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -24,14 +24,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
|
||||
#CFLAGS+= -DNEED_ERRLOC
|
||||
#YFLAGS+= -d
|
||||
|
||||
LDFLAGS+= -pthread \
|
||||
-L${.OBJDIR}/../../lib/libdtrace \
|
||||
-L${.OBJDIR}/../../lib/libproc \
|
||||
-L${.OBJDIR}/../../lib/libctf \
|
||||
-L${.OBJDIR}/../../../lib/libelf
|
||||
|
||||
LDADD+= -ldtrace -ly -ll -lproc -lctf -lelf -lz
|
||||
|
||||
DPADD+= ${LIBDTRACE} ${LIBCTF} ${LIBELF} ${LIBPTHREAD} ${LIBL} ${LIBY} ${LIBZ}
|
||||
DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} ${LIBCTF} ${LIBELF} ${LIBZ}
|
||||
LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -25,15 +25,8 @@ CFLAGS+= -DNEED_ERRLOC -g
|
||||
|
||||
#YFLAGS+= -d
|
||||
|
||||
LDFLAGS+= -pthread \
|
||||
-L${.OBJDIR}/../../lib/libdtrace \
|
||||
-L${.OBJDIR}/../../lib/libproc \
|
||||
-L${.OBJDIR}/../../lib/libctf \
|
||||
-L${.OBJDIR}/../../../lib/libelf
|
||||
|
||||
LDADD+= -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt
|
||||
|
||||
#DPADD+= ${LIBDTRACE} ${LIBPTHREAD} ${LIBL} ${LIBY} ${LIBZ}
|
||||
DPADD= ${LIBPTHREAD} ${LIBDTRACE} ${LIBY} ${LIBL} ${LIBPROC} ${LIBCTF} ${LIBELF} ${LIBZ} ${LIBRT}
|
||||
LDADD= -lpthread -ldtrace -ly -ll -lproc -lctf -lelf -lz -lrt
|
||||
|
||||
NO_MAN=
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
Phil Nelson <philnelson@acm.org> wrote bc, including the number.c
|
||||
source in the "lib" directory.
|
||||
|
||||
Ken Pizzini wrote dc.
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user