Match the options of the kernel.
This commit is contained in:
parent
7c42edf9b8
commit
e5e0ffd044
@ -25,10 +25,11 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/param.h>
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include "opt_compat.h"
|
||||||
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include "opt_compat.h"
|
||||||
|
|
||||||
#if __FreeBSD_version > 800032
|
#if __FreeBSD_version > 800032
|
||||||
#define FILEMON_HAS_LINKAT
|
#define FILEMON_HAS_LINKAT
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
KMOD= filemon
|
KMOD= filemon
|
||||||
SRCS= ${KMOD}.c
|
SRCS= ${KMOD}.c
|
||||||
SRCS+= vnode_if.h opt_compat.h opt_capsicum.h
|
SRCS+= opt_compat.h
|
||||||
|
|
||||||
.include <bsd.kmod.mk>
|
.include <bsd.kmod.mk>
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
BINS= \
|
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64"
|
||||||
filemontest \
|
BI_BITS=
|
||||||
timed-forkb
|
.endif
|
||||||
|
|
||||||
bins: filemontest timed-forkb
|
_BINS= \
|
||||||
|
filemontest \
|
||||||
|
timed-forkb \
|
||||||
|
sizeof_long
|
||||||
|
|
||||||
|
BINS= ${_BINS}
|
||||||
|
.if defined(BI_BITS)
|
||||||
|
BINS+= ${_BINS:C/$/32/g}
|
||||||
|
.endif
|
||||||
|
|
||||||
|
bins: ${BINS}
|
||||||
all: bins
|
all: bins
|
||||||
|
|
||||||
NO_MAN=
|
NO_MAN=
|
||||||
@ -18,20 +28,25 @@ WITHOUT_CDDL=
|
|||||||
|
|
||||||
CLEANFILES+= ${BINS}
|
CLEANFILES+= ${BINS}
|
||||||
|
|
||||||
tests: bins
|
|
||||||
|
.for f32 in ${BINS}
|
||||||
|
${f32}32: ${f32}.c
|
||||||
|
${CC} -m32 -DBIT=\"32\" -o ${.TARGET} ${CFLAGS} ${.ALLSRC}
|
||||||
|
.endfor
|
||||||
|
|
||||||
|
tests:
|
||||||
kldstat | grep filemon
|
kldstat | grep filemon
|
||||||
${MAKE} test
|
@echo ""
|
||||||
@echo "Without filemon(4) active:"
|
${MAKE} test01
|
||||||
./timed-forkb
|
${MAKE} test02
|
||||||
@echo "With filemon(4) active:"
|
.if defined(BI_BITS)
|
||||||
script -f typescript-timed-forkb ./timed-forkb
|
${MAKE} test32
|
||||||
ls -l typescript-timed-forkb.filemon
|
.endif
|
||||||
@echo "filemon(4) tests passed."
|
@echo "filemon(4) tests passed."
|
||||||
|
|
||||||
# Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in .
|
# Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in .
|
||||||
#FILEMONTEST32= filemontest32
|
test01: ${BINS:Mfilemontest*} ${BINS:Msizeof_long*} clean-test
|
||||||
test: filemontest clean-test
|
.for BIN in ${BINS:Mfilemontest}
|
||||||
.for BIN in filemontest ${FILEMONTEST32}
|
|
||||||
cd ${.CURDIR} ; \
|
cd ${.CURDIR} ; \
|
||||||
for A in 1 2 3 4 5 6 7 8 9 0; do \
|
for A in 1 2 3 4 5 6 7 8 9 0; do \
|
||||||
for B in 1 2 3 4 5 6 7 8 9 0; do \
|
for B in 1 2 3 4 5 6 7 8 9 0; do \
|
||||||
@ -41,13 +56,30 @@ test: filemontest clean-test
|
|||||||
done ;\
|
done ;\
|
||||||
done
|
done
|
||||||
@cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \
|
@cd ${.CURDIR} ; set +e ; egrep '(Start|Stop) .*\.' filemon_log.* | \
|
||||||
grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || echo "Time stamp format OK"
|
grep -q -v '\.[0-9][0-9][0-9][0-9][0-9][0-9]$$' || printf "Time stamp format OK\n\n"
|
||||||
.endfor
|
.endfor
|
||||||
|
@cd ${.CURDIR} ; set +e ; for F in filemon_log.* ; do \
|
||||||
|
tail -1 $$F | grep -q '# Bye bye' || echo "$$F missing filemon bye-bye" ; \
|
||||||
|
NL=`wc -l $$F | awk '{print $$1}'` ; \
|
||||||
|
if [ "$${NL}" != 97 ]; then echo "$$F BAD, contains $${NL} lines" ; exit 1 ; fi ; done
|
||||||
|
|
||||||
|
test02: ${BINS:Mtimed-forkb*}
|
||||||
|
@echo "Without filemon(4) active:"
|
||||||
|
./timed-forkb
|
||||||
|
@echo "With filemon(4) active:"
|
||||||
|
script -f typescript-timed-forkb ./timed-forkb
|
||||||
|
ls -l typescript-timed-forkb.filemon
|
||||||
|
|
||||||
|
test32: ${BINS:M*32*}
|
||||||
|
script -f typescript.${.TARGET} ./sizeof_long32 >/dev/null
|
||||||
|
@tail -1 typescript.test32.filemon | grep -q '# Bye bye' || (echo '32-bit comapt filemon Missing "bye-bye"' ; exit 1)
|
||||||
|
@egrep -q '^X [0-9]+ 0$$' typescript.test32.filemon || (echo "32-bit binary exit ERROR" ; exit 1)
|
||||||
|
@printf "filemon(4) 32bit FreeBSD support passed.\n\n"
|
||||||
|
|
||||||
CLEANFILES+= typescript-timed-forkb typescript-timed-forkb.filemon
|
CLEANFILES+= typescript-timed-forkb typescript-timed-forkb.filemon
|
||||||
|
|
||||||
clean-test:
|
clean-test:
|
||||||
cd ${.CURDIR} ; rm -f filemon_log.*
|
cd ${.CURDIR} ; rm -f filemon_log*.*
|
||||||
|
|
||||||
clean-tests: clean-test
|
clean-tests: clean-test
|
||||||
|
|
||||||
|
@ -43,9 +43,13 @@ __FBSDID("$FreeBSD$");
|
|||||||
* "test_script.sh" in the cwd.
|
* "test_script.sh" in the cwd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef BIT
|
||||||
|
#define BIT ""
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void) {
|
main(void) {
|
||||||
char log_name[] = "filemon_log.XXXXXX";
|
char log_name[] = "filemon_log" BIT ".XXXXXX";
|
||||||
pid_t child;
|
pid_t child;
|
||||||
int fm_fd, fm_log;
|
int fm_fd, fm_log;
|
||||||
|
|
||||||
@ -66,7 +70,7 @@ main(void) {
|
|||||||
child = getpid();
|
child = getpid();
|
||||||
if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1)
|
if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1)
|
||||||
err(1, "Cannot set filemon PID to %d", child);
|
err(1, "Cannot set filemon PID to %d", child);
|
||||||
system("./test_script.sh");
|
system("env BIT=" BIT " ./test_script.sh");
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
err(1, "Cannot fork");
|
err(1, "Cannot fork");
|
||||||
|
@ -41,3 +41,4 @@ ed -s $f1 < $f2
|
|||||||
#w" | ed -s $f1
|
#w" | ed -s $f1
|
||||||
#rm $f1 $f2
|
#rm $f1 $f2
|
||||||
uptime > /dev/null
|
uptime > /dev/null
|
||||||
|
sizeof_long${BIT} > /dev/null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user