svn commit: r361288 - in vendor/NetBSD/bmake/dist: . filemon mk mk/sys unit-tests
Simon J. Gerraty
sjg at FreeBSD.org
Wed May 20 19:34:52 UTC 2020
Author: sjg
Date: Wed May 20 19:34:48 2020
New Revision: 361288
URL: https://svnweb.freebsd.org/changeset/base/361288
Log:
Import bmake-20200517
Changes since 20181221 are mostly portability related
hence the large gap in versions imported.
There are however some bug fixes, and a rework of filemon handling.
In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
and elimination of filemon(4) which has not had the TLC it needs.
FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
allows use of that, with a bit less overhead than the ktrace model.
Summary of changes from ChangeLog
o str.c: empty string does not match % pattern
plus unit-test changes
o var.c: import handling of old sysV style modifier using '%'
o str.c: refactor brk_string
o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
a blank command is perfectly valid.
o meta.c: meta_oodate, check for corrupted meta file
earlier and more often.
* meta.c: meta_compat_parent check for USE_FILEMON
patch from Soeren Tempel
o meta.c: fix compat mode, need to call meta_job_output()
o job.c: extra fds for meta mode not needed if using filemon_dev
o meta.c: avoid passing NULL to filemon_*() when meta_needed()
returns FALSE.
o filemon/filemon_{dev,ktrace}.c: allow selection of
filemon implementation. filemon_dev.c uses the kernel module
while filemon_ktrace.c leverages the fktrace api available in
NetBSD. filemon_ktrace.c can hopefully form the basis for
adding support for other tracing mechanisms such as strace on
Linux.
o meta.c: when target is out-of-date per normal make rules
record value of .OODATE in meta file.
o parse.c: don't pass NULL to realpath(3)
some versions cannot handle it.
o parse.c: ParseDoDependency: free paths rather than assert
plus more unit-tests
Added:
vendor/NetBSD/bmake/dist/filemon/
vendor/NetBSD/bmake/dist/filemon/filemon.h (contents, props changed)
vendor/NetBSD/bmake/dist/filemon/filemon_dev.c (contents, props changed)
vendor/NetBSD/bmake/dist/filemon/filemon_ktrace.c (contents, props changed)
vendor/NetBSD/bmake/dist/mk/compiler.mk (contents, props changed)
vendor/NetBSD/bmake/dist/mk/dirdeps-targets.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/Makefile (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/Makefile.config.in (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/cond-late.exp
vendor/NetBSD/bmake/dist/unit-tests/cond-late.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/dollar.exp
vendor/NetBSD/bmake/dist/unit-tests/dollar.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/include-main.exp
vendor/NetBSD/bmake/dist/unit-tests/include-main.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/include-sub.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/include-subsub.mk (contents, props changed)
vendor/NetBSD/bmake/dist/unit-tests/varmod-edge.exp
vendor/NetBSD/bmake/dist/unit-tests/varmod-edge.mk (contents, props changed)
Deleted:
vendor/NetBSD/bmake/dist/unit-tests/Makefile.in
Modified:
vendor/NetBSD/bmake/dist/ChangeLog
vendor/NetBSD/bmake/dist/FILES
vendor/NetBSD/bmake/dist/Makefile
vendor/NetBSD/bmake/dist/Makefile.config.in
vendor/NetBSD/bmake/dist/VERSION
vendor/NetBSD/bmake/dist/arch.c
vendor/NetBSD/bmake/dist/boot-strap
vendor/NetBSD/bmake/dist/bsd.after-import.mk
vendor/NetBSD/bmake/dist/compat.c
vendor/NetBSD/bmake/dist/config.h.in
vendor/NetBSD/bmake/dist/configure
vendor/NetBSD/bmake/dist/configure.in
vendor/NetBSD/bmake/dist/job.c
vendor/NetBSD/bmake/dist/make-bootstrap.sh.in
vendor/NetBSD/bmake/dist/make.1
vendor/NetBSD/bmake/dist/make.h
vendor/NetBSD/bmake/dist/meta.c
vendor/NetBSD/bmake/dist/meta.h
vendor/NetBSD/bmake/dist/mk/ChangeLog
vendor/NetBSD/bmake/dist/mk/FILES
vendor/NetBSD/bmake/dist/mk/autodep.mk
vendor/NetBSD/bmake/dist/mk/dirdeps.mk
vendor/NetBSD/bmake/dist/mk/doc.mk
vendor/NetBSD/bmake/dist/mk/dpadd.mk
vendor/NetBSD/bmake/dist/mk/gendirdeps.mk
vendor/NetBSD/bmake/dist/mk/init.mk
vendor/NetBSD/bmake/dist/mk/install-mk
vendor/NetBSD/bmake/dist/mk/lib.mk
vendor/NetBSD/bmake/dist/mk/meta.stage.mk
vendor/NetBSD/bmake/dist/mk/meta.sys.mk
vendor/NetBSD/bmake/dist/mk/meta2deps.py
vendor/NetBSD/bmake/dist/mk/options.mk
vendor/NetBSD/bmake/dist/mk/sys.mk
vendor/NetBSD/bmake/dist/mk/sys.vars.mk
vendor/NetBSD/bmake/dist/mk/sys/AIX.mk
vendor/NetBSD/bmake/dist/mk/sys/Darwin.mk
vendor/NetBSD/bmake/dist/mk/sys/Generic.mk
vendor/NetBSD/bmake/dist/mk/sys/HP-UX.mk
vendor/NetBSD/bmake/dist/mk/sys/IRIX.mk
vendor/NetBSD/bmake/dist/mk/sys/Linux.mk
vendor/NetBSD/bmake/dist/mk/sys/NetBSD.mk
vendor/NetBSD/bmake/dist/mk/sys/OSF1.mk
vendor/NetBSD/bmake/dist/mk/sys/OpenBSD.mk
vendor/NetBSD/bmake/dist/mk/sys/SunOS.mk
vendor/NetBSD/bmake/dist/mk/sys/UnixWare.mk
vendor/NetBSD/bmake/dist/mk/whats.mk
vendor/NetBSD/bmake/dist/nonints.h
vendor/NetBSD/bmake/dist/parse.c
vendor/NetBSD/bmake/dist/str.c
vendor/NetBSD/bmake/dist/unit-tests/escape.mk
vendor/NetBSD/bmake/dist/unit-tests/forloop.exp
vendor/NetBSD/bmake/dist/unit-tests/forloop.mk
vendor/NetBSD/bmake/dist/unit-tests/modorder.mk
vendor/NetBSD/bmake/dist/unit-tests/sysv.exp
vendor/NetBSD/bmake/dist/unit-tests/sysv.mk
vendor/NetBSD/bmake/dist/util.c
vendor/NetBSD/bmake/dist/var.c
Modified: vendor/NetBSD/bmake/dist/ChangeLog
==============================================================================
--- vendor/NetBSD/bmake/dist/ChangeLog Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/ChangeLog Wed May 20 19:34:48 2020 (r361288)
@@ -1,3 +1,138 @@
+2020-05-17 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200517
+ Merge with NetBSD make, pick up
+ o modified dollar tests to avoid shell dependencies
+ o new tests for .INCLUDEFROM
+
+2020-05-16 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * unit-tests/dollar.mk: tweak '1 dollar literal' test
+ to not depend so much on shell behavior
+
+2020-05-10 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200510
+ Merge with NetBSD make, pick up
+ o unit test for dollar handling
+
+2020-05-06 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200506
+ Merge with NetBSD make, pick up
+ o str.c: empty string does not match % pattern
+ plus unit-test changes
+
+2020-05-04 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200504
+ May the 4th be with you
+ Merge with NetBSD make, pick up
+ o var.c: import handling of old sysV style modifier using '%'
+ o str.c: refactor brk_string
+ o unit-tests: add test case for lazy conditions
+
+2020-04-18 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200418
+
+ * configure.in: use_makefile=no for cygwin et al.
+ case insensitive filesystems just don't work if both
+ makefile and Makefile exist.
+ NOTE: bmake does not support cygwin and likely never will,
+ but if brave souls want to try it - help them out.
+
+2020-04-02 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200402
+ Merge with NetBSD make, pick up
+ o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
+ a blank command is perfectly valid.
+
+2020-03-30 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200330
+ Merge with NetBSD make, pick up
+ o make.h: extern debug_file
+
+2020-03-18 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200318
+ Merge with NetBSD make, pick up
+ o meta.c: meta_oodate, check for corrupted meta file
+ earlier and more often.
+
+2020-02-20 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200220
+
+2020-02-19 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * boot-strap: unset MAKEFLAGS
+
+2020-02-12 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION (_MAKE_VERSION): 20200212
+ * meta.c: meta_compat_parent check for USE_FILEMON
+ patch from Soeren Tempel
+
+2020-02-05 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20200205
+ Merge with NetBSD make, pick up
+ o meta.c: fix compat mode, need to call meta_job_output()
+ o job.c: extra fds for meta mode not needed if using filemon_dev
+
+2020-01-22 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20200122
+ Merge with NetBSD make, pick up
+ o meta.c: avoid passing NULL to filemon_*() when meta_needed()
+ returns FALSE.
+
+2020-01-21 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20200121
+ Merge with NetBSD make, pick up
+ o filemon/filemon_{dev,ktrace}.c: allow selection of
+ filemon implementation. filemon_dev.c uses the kernel module
+ while filemon_ktrace.c leverages the fktrace api available in
+ NetBSD. filemon_ktrace.c can hopefully form the basis for
+ adding support for other tracing mechanisms such as strace on
+ Linux.
+ o meta.c: when target is out-of-date per normal make rules
+ record value of .OODATE in meta file.
+
+2019-09-26 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20190926
+ Merge with NetBSD make, pick up
+ o parse.c: don't pass NULL to realpath(3)
+ some versions cannot handle it.
+
+2019-04-09 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20190409
+ Merge with NetBSD make, pick up
+ o parse.c: ParseDoDependency: free paths rather than assert
+
+2018-12-22 Simon J Gerraty <sjg at beast.crufty.net>
+
+ * VERSION: 20181222
+
+ * configure.in: add --without-makefile to avoid generating
+ makefile and make-bootstrap.sh
+
+ * include Makefile.inc if it exists
+
+ * Use Makefile and Makefile.config.in in unit-tests
+ so we can use just: make obj && make && make test
+ when bmake is already available.
+ We add --without-makefile to CONFIGURE_ARGS in this case.
+
+ * tweak bsd.after-import.mk (captures Makefile.config etc
+ after import to FreeBSD for example) to cope with all the above.
+
2018-12-21 Simon J Gerraty <sjg at beast.crufty.net>
* VERSION: 20181221
Modified: vendor/NetBSD/bmake/dist/FILES
==============================================================================
--- vendor/NetBSD/bmake/dist/FILES Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/FILES Wed May 20 19:34:48 2020 (r361288)
@@ -22,6 +22,9 @@ configure.in
dir.c
dir.h
dirname.c
+filemon/filemon.h
+filemon/filemon_dev.c
+filemon/filemon_ktrace.c
find_lib.sh
for.c
getopt.c
@@ -94,13 +97,18 @@ suff.c
targ.c
trace.c
trace.h
-unit-tests/Makefile.in
+unit-tests/Makefile
+unit-tests/Makefile.config.in
unit-tests/comment.exp
unit-tests/comment.mk
unit-tests/cond1.exp
unit-tests/cond1.mk
unit-tests/cond2.exp
unit-tests/cond2.mk
+unit-tests/cond-late.mk
+unit-tests/cond-late.exp
+unit-tests/dollar.exp
+unit-tests/dollar.mk
unit-tests/doterror.exp
unit-tests/doterror.mk
unit-tests/dotwait.exp
@@ -123,6 +131,10 @@ unit-tests/hash.exp
unit-tests/hash.mk
unit-tests/impsrc.exp
unit-tests/impsrc.mk
+unit-tests/include-main.exp
+unit-tests/include-main.mk
+unit-tests/include-sub.mk
+unit-tests/include-subsub.mk
unit-tests/misc.exp
unit-tests/misc.mk
unit-tests/moderrs.exp
@@ -163,6 +175,8 @@ unit-tests/varcmd.exp
unit-tests/varcmd.mk
unit-tests/varmisc.exp
unit-tests/varmisc.mk
+unit-tests/varmod-edge.exp
+unit-tests/varmod-edge.mk
unit-tests/varquote.exp
unit-tests/varquote.mk
unit-tests/varshell.exp
Modified: vendor/NetBSD/bmake/dist/Makefile
==============================================================================
--- vendor/NetBSD/bmake/dist/Makefile Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/Makefile Wed May 20 19:34:48 2020 (r361288)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $
+# $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $
PROG= bmake
@@ -56,6 +56,7 @@ SRCS+= \
lstSucc.c
.-include "VERSION"
+.-include "Makefile.inc"
# this file gets generated by configure
.-include "Makefile.config"
@@ -77,12 +78,24 @@ CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
-# meta mode can be useful even without filemon
+# meta mode can be useful even without filemon
+# should be set by now
+USE_FILEMON ?= no
+.if ${USE_FILEMON:tl} != "no"
+.PATH: ${.CURDIR}/filemon
+SRCS+= filemon_${USE_FILEMON}.c
+COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
+COPTS.job.c+= ${COPTS.meta.c}
+
+.if ${USE_FILEMON} == "dev"
FILEMON_H ?= /usr/include/dev/filemon/filemon.h
.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
-COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
+COPTS.filemon_dev.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
.endif
+.endif # USE_FILEMON == dev
+.endif # USE_FILEMON
+
.PATH: ${srcdir}
.PATH: ${srcdir}/lst.lib
@@ -198,6 +211,8 @@ main.o: ${SRCS} ${.CURDIR}/VERSION
.if ${MK_AUTOCONF_MK} == "yes"
CONFIGURE_DEPS += ${.CURDIR}/VERSION
+# we do not need or want the generated makefile
+CONFIGURE_ARGS += --without-makefile
.include <autoconf.mk>
.endif
SHARE_MK?=${SHAREDIR}/mk
Modified: vendor/NetBSD/bmake/dist/Makefile.config.in
==============================================================================
--- vendor/NetBSD/bmake/dist/Makefile.config.in Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/Makefile.config.in Wed May 20 19:34:48 2020 (r361288)
@@ -14,7 +14,8 @@ CFLAGS+= ${CPPFLAGS} @DEFS@
LDFLAGS+= @LDFLAGS@
LIBOBJS+= @LIBOBJS@
LDADD+= @LIBS@
-USE_META= @use_meta@
+USE_META?= @use_meta@
+USE_FILEMON?= @use_filemon@
FILEMON_H?= @filemon_h@
BMAKE_PATH_MAX?= @bmake_path_max@
# used if MAXPATHLEN not defined
Modified: vendor/NetBSD/bmake/dist/VERSION
==============================================================================
--- vendor/NetBSD/bmake/dist/VERSION Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/VERSION Wed May 20 19:34:48 2020 (r361288)
@@ -1,2 +1,2 @@
# keep this compatible with sh and make
-_MAKE_VERSION=20181221
+_MAKE_VERSION=20200517
Modified: vendor/NetBSD/bmake/dist/arch.c
==============================================================================
--- vendor/NetBSD/bmake/dist/arch.c Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/arch.c Wed May 20 19:34:48 2020 (r361288)
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $ */
+/* $NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $");
+__RCSID("$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $");
#endif
#endif /* not lint */
#endif
@@ -682,7 +682,7 @@ ArchStatMember(char *archive, char *member, Boolean ha
arh.AR_SIZE[sizeof(arh.AR_SIZE)-1] = '\0';
size = (int)strtol(arh.AR_SIZE, NULL, 10);
- (void)strncpy(memName, arh.AR_NAME, sizeof(arh.AR_NAME));
+ memcpy(memName, arh.AR_NAME, sizeof(arh.AR_NAME));
for (cp = &memName[AR_MAX_NAME_LEN]; *cp == ' '; cp--) {
continue;
}
Modified: vendor/NetBSD/bmake/dist/boot-strap
==============================================================================
--- vendor/NetBSD/bmake/dist/boot-strap Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/boot-strap Wed May 20 19:34:48 2020 (r361288)
@@ -89,6 +89,10 @@
# disable use of filemon(9) which is currently only
# available for NetBSD and FreeBSD.
#
+# --with-filemon=ktrace
+# on NetBSD or others with fktrace(2), use ktrace
+# version of filemon.
+#
# --with-filemon="path/to/filemon.h"
# enables use of filemon(9) by meta mode.
#
@@ -111,7 +115,7 @@
# Simon J. Gerraty <sjg at crufty.net>
# RCSid:
-# $Id: boot-strap,v 1.49 2016/05/29 00:09:14 sjg Exp $
+# $Id: boot-strap,v 1.51 2020/02/19 16:46:23 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@@ -161,6 +165,8 @@ cmd_args="$@"
# clear some things from the environment that we care about
unset MAKEOBJDIR MAKEOBJDIRPREFIX
+# or that might be incompatible
+unset MAKE MAKEFLAGS
# --install[-host-target] will set this
INSTALL_PREFIX=
Modified: vendor/NetBSD/bmake/dist/bsd.after-import.mk
==============================================================================
--- vendor/NetBSD/bmake/dist/bsd.after-import.mk Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/bsd.after-import.mk Wed May 20 19:34:48 2020 (r361288)
@@ -1,4 +1,4 @@
-# $Id: bsd.after-import.mk,v 1.13 2017/08/13 00:56:10 sjg Exp $
+# $Id: bsd.after-import.mk,v 1.15 2018/12/30 17:14:24 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake.
@@ -63,7 +63,7 @@ MAKEFILE_SED = sed -e '/^MACHINE/d' \
-e 's,${SRCTOP},$${SRCTOP},g'
# These are the simple files we want to capture
-configured_files= config.h Makefile.config unit-tests/Makefile
+configured_files= config.h Makefile.config unit-tests/Makefile.config
after-import: bootstrap ${MAKEFILE}
.for f in ${configured_files:M*.[ch]}
@@ -87,7 +87,6 @@ _makefile: bootstrap ${MAKEFILE}
@(echo '# This is a generated file, do NOT edit!'; \
echo '# See ${_this:S,${SRCTOP}/,,}'; \
echo '#'; echo '# $$${HOST_OS}$$'; \
- echo; echo '.sinclude "Makefile.inc"'; \
echo; echo 'SRCTOP?= $${.CURDIR:${.CURDIR:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; \
echo; echo '# look here first for config.h'; \
echo 'CFLAGS+= -I$${.CURDIR}'; echo; \
Modified: vendor/NetBSD/bmake/dist/compat.c
==============================================================================
--- vendor/NetBSD/bmake/dist/compat.c Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/compat.c Wed May 20 19:34:48 2020 (r361288)
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $ */
+/* $NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.107 2017/07/20 19:29:54 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $");
#endif
#endif /* not lint */
#endif
@@ -407,7 +407,7 @@ again:
#ifdef USE_META
if (useMeta) {
- meta_compat_parent();
+ meta_compat_parent(cpid);
}
#endif
Modified: vendor/NetBSD/bmake/dist/config.h.in
==============================================================================
--- vendor/NetBSD/bmake/dist/config.h.in Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/config.h.in Wed May 20 19:34:48 2020 (r361288)
@@ -143,7 +143,7 @@
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
-/* Define to 1 if `struct stat' is a member of `st_rdev'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
Modified: vendor/NetBSD/bmake/dist/configure
==============================================================================
Binary file (source and/or target). No diff available.
Modified: vendor/NetBSD/bmake/dist/configure.in
==============================================================================
--- vendor/NetBSD/bmake/dist/configure.in Wed May 20 18:29:23 2020 (r361287)
+++ vendor/NetBSD/bmake/dist/configure.in Wed May 20 19:34:48 2020 (r361288)
@@ -1,11 +1,11 @@
dnl
dnl RCSid:
-dnl $Id: configure.in,v 1.59 2017/11/26 22:39:20 sjg Exp $
+dnl $Id: configure.in,v 1.63 2020/04/19 05:17:57 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
-AC_INIT([bmake], [20171126], [sjg at NetBSD.org])
+AC_INIT([bmake], [20200418], [sjg at NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@@ -16,6 +16,7 @@ esac
dnl get _MAKE_VERSION
. $srcdir/VERSION
+OS=`uname -s`
dnl
AC_ARG_WITH(defshell,
@@ -32,6 +33,17 @@ no) ;;
;;
esac])
dnl
+case "$OS" in
+CYGWIN*|MINGW*) use_makefile=no;;
+*) use_makefile=yes;;
+esac
+AC_ARG_WITH(makefile,
+[ --without-makefile dissable use of generated makefile],
+[case "${withval}" in
+yes|no) use_makefile=${withval};;
+*) AC_MSG_ERROR(bad value ${withval} given for makefile) ;;
+esac])
+dnl
use_meta=yes
AC_ARG_WITH(meta,
[ --without-meta dissable use of meta-mode],
@@ -41,30 +53,41 @@ yes|no) use_meta=${withval};;
esac])
dnl
AC_ARG_WITH(filemon,
-[ --with-filemon=path/filemon.h indicate path to filemon.h for meta-mode],
+[ --with-filemon={no,dev,ktrace,path/filemon.h} indicate filemon method for meta-mode. Path to filemon.h implies dev],
[ case "/${withval}" in
-/no|*/filemon.h) filemon_h="${withval}";;
+/no) use_filemon=no;;
+/*trace) filemon_h=no use_filemon="${withval}";;
+*/filemon.h) filemon_h="${withval}";;
*/filemon*) filemon_h="${withval}/filemon.h";;
*) AC_MSG_ERROR(bad value ${withval} given for filemon) ;;
esac],
[
-OS=`uname -s`
-for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/filemon" "$srcdir/../filemon" "$srcdir/../../sys/dev/filemon"
-do
- for x in "/$OS" ""
- do
- filemon_h="$d$x/filemon.h"
- test -s "$filemon_h" && break
- done
- test -s "$filemon_h" && break
-done
-test -s "${filemon_h:-/dev/null}" || filemon_h=no
+case "$OS" in
+NetBSD) filemon_h=no use_filemon=ktrace;;
+*)
+ for d in "/usr/include/dev/filemon" "$prefix/include/dev/filemon" "$srcdir/../../sys/dev/filemon"
+ do
+ for x in "/$OS" ""
+ do
+ filemon_h="$d$x/filemon.h"
+ test -s "$filemon_h" && break
+ done
+ test -s "$filemon_h" && { use_filemon=dev; break; }
+ done
+ ;;
+esac
+use_filemon=${use_filemon:-no}
+case "$use_filemon" in
+dev) ;;
+*) filemon_h=no;;
+esac
])
-dnl echo "Note: use_meta=$use_meta filemon_h=$filemon_h" >&6
+dnl echo "Note: use_meta=$use_meta use_filemon=$use_filemon filemon_h=$filemon_h" >&6
case "$use_meta" in
yes)
- case "$filemon_h" in
- *.h) echo "Using: filemon=$filemon_h" >&6;;
+ case "$use_filemon" in
+ no) ;;
+ *) echo "Using: filemon_${use_filemon}.c" >&6;;
esac
;;
esac
@@ -388,10 +411,14 @@ AC_SUBST(INSTALL)
AC_SUBST(GCC)
AC_SUBST(diff_u)
AC_SUBST(use_meta)
+AC_SUBST(use_filemon)
AC_SUBST(filemon_h)
AC_SUBST(_MAKE_VERSION)
-AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile)
-
+bm_outfiles="Makefile.config unit-tests/Makefile.config make-bootstrap.sh"
+if test $use_makefile = yes; then
+ bm_outfiles="makefile $bm_outfiles"
+fi
+AC_OUTPUT($bm_outfiles)
cat <<EOF
You can now run
Added: vendor/NetBSD/bmake/dist/filemon/filemon.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/NetBSD/bmake/dist/filemon/filemon.h Wed May 20 19:34:48 2020 (r361288)
@@ -0,0 +1,53 @@
+/* $NetBSD: filemon.h,v 1.2 2020/01/22 22:10:36 sjg Exp $ */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FILEMON_H_
+#define FILEMON_H_
+
+#include <sys/types.h>
+
+struct filemon;
+
+const char *
+ filemon_path(void);
+
+struct filemon *
+ filemon_open(void);
+int filemon_close(struct filemon *);
+
+int filemon_setfd(struct filemon *, int);
+void filemon_setpid_parent(struct filemon *, pid_t);
+int filemon_setpid_child(const struct filemon *, pid_t);
+
+int filemon_readfd(const struct filemon *);
+int filemon_process(struct filemon *);
+
+#endif /* FILEMON_H_ */
Added: vendor/NetBSD/bmake/dist/filemon/filemon_dev.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/NetBSD/bmake/dist/filemon/filemon_dev.c Wed May 20 19:34:48 2020 (r361288)
@@ -0,0 +1,151 @@
+/* $NetBSD: filemon_dev.c,v 1.1 2020/01/19 19:49:37 riastradh Exp $ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "filemon.h"
+
+#include <sys/ioctl.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifdef HAVE_FILEMON_H
+# include <filemon.h>
+#endif
+
+#ifndef _PATH_FILEMON
+#define _PATH_FILEMON "/dev/filemon"
+#endif
+
+struct filemon {
+ int fd;
+};
+
+const char *
+filemon_path(void)
+{
+
+ return _PATH_FILEMON;
+}
+
+struct filemon *
+filemon_open(void)
+{
+ struct filemon *F;
+ unsigned i;
+ int error;
+
+ /* Allocate and zero a struct filemon object. */
+ F = calloc(1, sizeof(*F));
+ if (F == NULL)
+ return NULL;
+
+ /* Try opening /dev/filemon, up to six times (cargo cult!). */
+ for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR)) == -1; i++) {
+ if (i == 5) {
+ error = errno;
+ goto fail0;
+ }
+ }
+
+ /* Success! */
+ return F;
+
+fail0: free(F);
+ errno = error;
+ return NULL;
+}
+
+int
+filemon_setfd(struct filemon *F, int fd)
+{
+
+ /* Point the kernel at this file descriptor. */
+ if (ioctl(F->fd, FILEMON_SET_FD, &fd) == -1)
+ return -1;
+
+ /* No need for it in userland any more; close it. */
+ (void)close(fd);
+
+ /* Success! */
+ return 0;
+}
+
+void
+filemon_setpid_parent(struct filemon *F, pid_t pid)
+{
+ /* Nothing to do! */
+}
+
+int
+filemon_setpid_child(const struct filemon *F, pid_t pid)
+{
+
+ /* Just pass it on to the kernel. */
+ return ioctl(F->fd, FILEMON_SET_PID, &pid);
+}
+
+int
+filemon_close(struct filemon *F)
+{
+ int error = 0;
+
+ /* Close the filemon device fd. */
+ if (close(F->fd) == -1 && error == 0)
+ error = errno;
+
+ /* Free the filemon descriptor. */
+ free(F);
+
+ /* Set errno and return -1 if anything went wrong. */
+ if (error) {
+ errno = error;
+ return -1;
+ }
+
+ /* Success! */
+ return 0;
+}
+
+int
+filemon_readfd(const struct filemon *F)
+{
+
+ return -1;
+}
+
+int
+filemon_process(struct filemon *F)
+{
+
+ return 0;
+}
Added: vendor/NetBSD/bmake/dist/filemon/filemon_ktrace.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/NetBSD/bmake/dist/filemon/filemon_ktrace.c Wed May 20 19:34:48 2020 (r361288)
@@ -0,0 +1,878 @@
+/* $NetBSD: filemon_ktrace.c,v 1.2 2020/01/19 20:22:57 riastradh Exp $ */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Taylor R. Campbell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define _KERNTYPES /* register_t */
+
+#include "filemon.h"
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/rbtree.h>
+#include <sys/syscall.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/wait.h>
+
+#include <sys/ktrace.h>
+
+#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef AT_CWD
+#define AT_CWD -1
+#endif
+
+struct filemon;
+struct filemon_key;
+struct filemon_state;
+
+typedef struct filemon_state *filemon_syscall_t(struct filemon *,
+ const struct filemon_key *, const struct ktr_syscall *);
+
+static filemon_syscall_t filemon_sys_chdir;
+static filemon_syscall_t filemon_sys_execve;
+static filemon_syscall_t filemon_sys_exit;
+static filemon_syscall_t filemon_sys_fork;
+static filemon_syscall_t filemon_sys_link;
+static filemon_syscall_t filemon_sys_open;
+static filemon_syscall_t filemon_sys_openat;
+static filemon_syscall_t filemon_sys_symlink;
+static filemon_syscall_t filemon_sys_unlink;
+static filemon_syscall_t filemon_sys_rename;
+
+static filemon_syscall_t *const filemon_syscalls[] = {
+ [SYS_chdir] = &filemon_sys_chdir,
+ [SYS_execve] = &filemon_sys_execve,
+ [SYS_exit] = &filemon_sys_exit,
+ [SYS_fork] = &filemon_sys_fork,
+ [SYS_link] = &filemon_sys_link,
+ [SYS_open] = &filemon_sys_open,
+ [SYS_openat] = &filemon_sys_openat,
+ [SYS_symlink] = &filemon_sys_symlink,
+ [SYS_unlink] = &filemon_sys_unlink,
+ [SYS_rename] = &filemon_sys_rename,
+};
+
+struct filemon {
+ int ktrfd; /* kernel writes ktrace events here */
+ FILE *in; /* we read ktrace events from here */
+ FILE *out; /* we write filemon events to here */
+ rb_tree_t active;
+ pid_t child;
+
+ /* I/O state machine. */
+ enum {
+ FILEMON_START = 0,
+ FILEMON_HEADER,
+ FILEMON_PAYLOAD,
+ FILEMON_ERROR,
+ } state;
+ unsigned char *p;
+ size_t resid;
+
+ /* I/O buffer. */
+ struct ktr_header hdr;
+ union {
+ struct ktr_syscall syscall;
+ struct ktr_sysret sysret;
+ char namei[PATH_MAX];
+ unsigned char buf[4096];
+ } payload;
+};
+
+struct filemon_state {
+ struct filemon_key {
+ pid_t pid;
+ lwpid_t lid;
+ } key;
+ struct rb_node node;
+ int syscode;
+ void (*show)(struct filemon *, const struct filemon_state *,
+ const struct ktr_sysret *);
+ unsigned i;
+ unsigned npath;
+ char *path[/*npath*/];
+};
+
+static int
+compare_filemon_states(void *cookie, const void *na, const void *nb)
+{
+ const struct filemon_state *Sa = na;
+ const struct filemon_state *Sb = nb;
+
+ if (Sa->key.pid < Sb->key.pid)
+ return -1;
+ if (Sa->key.pid > Sb->key.pid)
+ return +1;
+ if (Sa->key.lid < Sb->key.lid)
+ return -1;
+ if (Sa->key.lid > Sb->key.lid)
+ return +1;
+ return 0;
+}
+
+static int
+compare_filemon_key(void *cookie, const void *n, const void *k)
+{
+ const struct filemon_state *S = n;
+ const struct filemon_key *key = k;
+
+ if (S->key.pid < key->pid)
+ return -1;
+ if (S->key.pid > key->pid)
+ return +1;
+ if (S->key.lid < key->lid)
+ return -1;
+ if (S->key.lid > key->lid)
+ return +1;
+ return 0;
+}
+
+static const rb_tree_ops_t filemon_rb_ops = {
+ .rbto_compare_nodes = &compare_filemon_states,
+ .rbto_compare_key = &compare_filemon_key,
+ .rbto_node_offset = offsetof(struct filemon_state, node),
+ .rbto_context = NULL,
+};
+
+/*
+ * filemon_path()
+ *
+ * Return a pointer to a constant string denoting the `path' of
+ * the filemon.
+ */
+const char *
+filemon_path(void)
+{
+
+ return "ktrace";
+}
+
+/*
+ * filemon_open()
+ *
+ * Allocate a filemon descriptor. Returns NULL and sets errno on
+ * failure.
+ */
+struct filemon *
+filemon_open(void)
+{
+ struct filemon *F;
+ int ktrpipe[2];
+ int error;
+
+ /* Allocate and zero a struct filemon object. */
+ F = calloc(1, sizeof(*F));
+ if (F == NULL)
+ return NULL;
+
+ /* Create a pipe for ktrace events. */
+ if (pipe2(ktrpipe, O_CLOEXEC|O_NONBLOCK) == -1) {
+ error = errno;
+ goto fail0;
+ }
+
+ /* Create a file stream for reading the ktrace events. */
+ if ((F->in = fdopen(ktrpipe[0], "r")) == NULL) {
+ error = errno;
+ goto fail1;
+ }
+ ktrpipe[0] = -1; /* claimed by fdopen */
+
+ /*
+ * Set the fd for writing ktrace events and initialize the
+ * rbtree. The rest can be safely initialized to zero.
+ */
+ F->ktrfd = ktrpipe[1];
+ rb_tree_init(&F->active, &filemon_rb_ops);
+
+ /* Success! */
+ return F;
+
+fail2: __unused
+ (void)fclose(F->in);
+fail1: (void)close(ktrpipe[0]);
+ (void)close(ktrpipe[1]);
+fail0: free(F);
+ errno = error;
+ return NULL;
+}
+
+/*
+ * filemon_closefd(F)
+ *
+ * Internal subroutine to try to flush and close the output file.
+ * If F is not open for output, do nothing. Never leaves F open
+ * for output even on failure. Returns 0 on success; sets errno
+ * and return -1 on failure.
+ */
+static int
+filemon_closefd(struct filemon *F)
+{
+ int error = 0;
+
+ /* If we're not open, nothing to do. */
+ if (F->out == NULL)
+ return 0;
+
+ /*
+ * Flush it, close it, and null it unconditionally, but be
+ * careful to return the earliest error in errno.
+ */
+ if (fflush(F->out) == EOF && error == 0)
+ error = errno;
+ if (fclose(F->out) == EOF && error == 0)
+ error = errno;
+ F->out = NULL;
+
+ /* Set errno and return -1 if anything went wrong. */
+ if (error) {
+ errno = error;
+ return -1;
+ }
+
+ /* Success! */
+ return 0;
+}
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list