aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/Makefile1
-rw-r--r--libexec/blacklistd-helper/Makefile2
-rw-r--r--libexec/flua/Makefile46
-rw-r--r--libexec/flua/Makefile.inc7
-rw-r--r--libexec/flua/bootstrap.h32
-rw-r--r--libexec/flua/lfbsd/Makefile5
-rw-r--r--libexec/flua/lfbsd/Makefile.inc2
-rw-r--r--libexec/flua/lfbsd/lfbsd.c (renamed from libexec/flua/modules/lfbsd.c)4
-rw-r--r--libexec/flua/lfbsd/lfbsd.h (renamed from libexec/flua/modules/lfbsd.h)0
-rw-r--r--libexec/flua/lfs/Makefile5
-rw-r--r--libexec/flua/lfs/Makefile.inc2
-rw-r--r--libexec/flua/lfs/lfs.c (renamed from libexec/flua/modules/lfs.c)7
-rw-r--r--libexec/flua/lfs/lfs.h (renamed from libexec/flua/modules/lfs.h)0
-rw-r--r--libexec/flua/libfreebsd/kenv/Makefile2
-rw-r--r--libexec/flua/libfreebsd/kenv/Makefile.inc2
-rw-r--r--libexec/flua/libfreebsd/kenv/kenv.c4
-rw-r--r--libexec/flua/libfreebsd/sys/linker/Makefile3
-rw-r--r--libexec/flua/libfreebsd/sys/linker/Makefile.inc2
-rw-r--r--libexec/flua/libfreebsd/sys/linker/linker.c4
-rw-r--r--libexec/flua/libhash/Makefile5
-rw-r--r--libexec/flua/libhash/Makefile.inc3
-rw-r--r--libexec/flua/libhash/lhash.c6
-rw-r--r--libexec/flua/libjail/Makefile5
-rw-r--r--libexec/flua/libjail/Makefile.inc3
-rw-r--r--libexec/flua/libjail/lua_jail.c4
-rw-r--r--libexec/flua/liblyaml/Makefile20
-rw-r--r--libexec/flua/liblyaml/Makefile.inc20
-rw-r--r--libexec/flua/libucl/Makefile12
-rw-r--r--libexec/flua/libucl/Makefile.inc12
-rw-r--r--libexec/flua/linit_flua.c33
-rw-r--r--libexec/kgdb/Makefile5
-rw-r--r--libexec/kgdb/acttrace.py63
-rwxr-xr-xlibexec/nuageinit/nuageinit1
-rw-r--r--libexec/rc/rc.conf3
-rw-r--r--libexec/rc/rc.d/Makefile2
-rwxr-xr-xlibexec/rc/rc.d/netwait86
36 files changed, 264 insertions, 149 deletions
diff --git a/libexec/Makefile b/libexec/Makefile
index 7ce78321f08e..e87b48b153a8 100644
--- a/libexec/Makefile
+++ b/libexec/Makefile
@@ -10,7 +10,6 @@ SUBDIR= ${_atf} \
flua \
getty \
${_hyperv} \
- kgdb \
${_mail.local} \
${_makewhatis.local} \
${_mknetid} \
diff --git a/libexec/blacklistd-helper/Makefile b/libexec/blacklistd-helper/Makefile
index 50fd3b5c982b..d32b69c278a8 100644
--- a/libexec/blacklistd-helper/Makefile
+++ b/libexec/blacklistd-helper/Makefile
@@ -1,5 +1,7 @@
BLOCKLIST_DIR=${SRCTOP}/contrib/blocklist
+PACKAGE= blocklist
+
SCRIPTS= ${BLOCKLIST_DIR}/libexec/blacklistd-helper
.include <bsd.prog.mk>
diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile
index 86d27c0653d4..23de404710d0 100644
--- a/libexec/flua/Makefile
+++ b/libexec/flua/Makefile
@@ -1,10 +1,42 @@
.include <src.lua.mk>
-SUBDIR+= libfreebsd
-SUBDIR+= libhash
-SUBDIR+= libjail
-SUBDIR+= libucl
-SUBDIR+= liblyaml
+# New flua modules should be added here rather than to SUBDIR so that we can do
+# the right thing for both bootstrap flua and target flua. The former does not
+# do any shared libs, so we just build them all straight into flua itself rather
+# than mucking about with the infrastructure to make them linkable -- thus, why
+# these are all structured to have a Makefile that describes what we want
+# *installed*, and a Makefile.inc that describes what we need to *build*.
+FLUA_MODULES+= lfbsd
+FLUA_MODULES+= lfs
+FLUA_MODULES+= libhash
+.ifndef BOOTSTRAPPING
+# Bootstrap flua can't usefully do anything with libjail anyways, because it
+# can't assume it's being run on a system that even supports jails.
+FLUA_MODULES+= libjail
+.endif
+FLUA_MODULES+= libucl
+FLUA_MODULES+= liblyaml
+
+.ifdef BOOTSTRAPPING
+# libfreebsd is generally omitted from the bootstrap flua because its
+# functionality largely assumes a FreeBSD kernel/system headers, so it doesn't
+# really offer functionality that we can use in bootstrap.
+CFLAGS+= -I${.CURDIR} -DBOOTSTRAPPING
+
+SHAREDIR= ${WORLDTMP}/legacy/usr/share/flua
+FLUA_PATH= ${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
+CFLAGS+= -DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
+
+.for mod in ${FLUA_MODULES}
+.include "${mod}/Makefile.inc"
+.endfor
+
+.else
+
+FLUA_MODULES+= libfreebsd
+SUBDIR+= ${FLUA_MODULES}
+
+.endif
LUASRC?= ${SRCTOP}/contrib/lua/src
.PATH: ${LUASRC}
@@ -14,7 +46,7 @@ WARNS?= 3
CWARNFLAGS.gcc+= -Wno-format-nonliteral
-LIBADD= lua
+LIBADD+= lua
# Entry point
SRCS+= lua.c
@@ -22,7 +54,7 @@ SRCS+= lua.c
# FreeBSD Extensions
.PATH: ${.CURDIR}/modules
SRCS+= linit_flua.c
-SRCS+= lfs.c lposix.c lfbsd.c
+SRCS+= lposix.c
CFLAGS+= -I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
CFLAGS+= -DLUA_PROGNAME="\"${PROG}\""
diff --git a/libexec/flua/Makefile.inc b/libexec/flua/Makefile.inc
index 34505d54d7df..37a49e258ecb 100644
--- a/libexec/flua/Makefile.inc
+++ b/libexec/flua/Makefile.inc
@@ -2,4 +2,9 @@ SHLIBDIR?= ${LIBDIR}/flua
CFLAGS+= \
-I${SRCTOP}/contrib/lua/src \
- -I${SRCTOP}/lib/liblua
+ -I${SRCTOP}/lib/liblua \
+ -I${SRCTOP}/libexec/flua
+
+.ifdef BOOTSTRAPPING
+CFLAGS+= -DBOOTSTRAPPING
+.endif
diff --git a/libexec/flua/bootstrap.h b/libexec/flua/bootstrap.h
new file mode 100644
index 000000000000..caf00518c1e0
--- /dev/null
+++ b/libexec/flua/bootstrap.h
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2025 Kyle Evans <kevans@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#ifndef FLUA_BOOTSTRAP_H
+#define FLUA_BOOTSTRAP_H
+
+#ifdef BOOTSTRAPPING
+#include <sys/linker_set.h>
+
+#include <lauxlib.h>
+
+#define FLUA_MODULE_SETNAME flua_modules
+
+SET_DECLARE(FLUA_MODULE_SETNAME, const luaL_Reg);
+#define FLUA_MODULE_DEF(ident, modname, openfn) \
+ static const luaL_Reg ident = { modname, openfn }; \
+ DATA_SET(FLUA_MODULE_SETNAME, ident)
+
+#define FLUA_MODULE_NAMED(mod, name) \
+ FLUA_MODULE_DEF(module_ ## mod, name, luaopen_ ## mod)
+#define FLUA_MODULE(mod) \
+ FLUA_MODULE_DEF(module_ ## mod, #mod, luaopen_ ## mod)
+#else /* !BOOTSTRAPPING */
+#define FLUA_MODULE_DEF(ident, modname, openfn)
+#define FLUA_MODULE_NAMED(mod, name)
+#define FLUA_MODULE(modname)
+#endif /* BOOTSTRAPPING */
+
+#endif /* FLUA_BOOTSTRAP_H */
diff --git a/libexec/flua/lfbsd/Makefile b/libexec/flua/lfbsd/Makefile
new file mode 100644
index 000000000000..e2a4aae14bcd
--- /dev/null
+++ b/libexec/flua/lfbsd/Makefile
@@ -0,0 +1,5 @@
+SHLIB_NAME= fbsd.so
+WARNS?= 3
+
+.include "Makefile.inc"
+.include <bsd.lib.mk>
diff --git a/libexec/flua/lfbsd/Makefile.inc b/libexec/flua/lfbsd/Makefile.inc
new file mode 100644
index 000000000000..7a78ef82e0fc
--- /dev/null
+++ b/libexec/flua/lfbsd/Makefile.inc
@@ -0,0 +1,2 @@
+.PATH: ${.PARSEDIR}
+SRCS+= lfbsd.c
diff --git a/libexec/flua/modules/lfbsd.c b/libexec/flua/lfbsd/lfbsd.c
index ef660ba9fd77..541b6c9611df 100644
--- a/libexec/flua/modules/lfbsd.c
+++ b/libexec/flua/lfbsd/lfbsd.c
@@ -40,6 +40,8 @@
#include "lauxlib.h"
#include "lfbsd.h"
+#include "bootstrap.h"
+
#define FBSD_PROCESSHANDLE "fbsd_process_t*"
struct fbsd_process {
@@ -283,3 +285,5 @@ luaopen_fbsd(lua_State *L)
return (1);
}
+
+FLUA_MODULE(fbsd);
diff --git a/libexec/flua/modules/lfbsd.h b/libexec/flua/lfbsd/lfbsd.h
index 01034a3ad7cd..01034a3ad7cd 100644
--- a/libexec/flua/modules/lfbsd.h
+++ b/libexec/flua/lfbsd/lfbsd.h
diff --git a/libexec/flua/lfs/Makefile b/libexec/flua/lfs/Makefile
new file mode 100644
index 000000000000..3df83d6d2fc1
--- /dev/null
+++ b/libexec/flua/lfs/Makefile
@@ -0,0 +1,5 @@
+SHLIB_NAME= lfs.so
+WARNS?= 3
+
+.include "Makefile.inc"
+.include <bsd.lib.mk>
diff --git a/libexec/flua/lfs/Makefile.inc b/libexec/flua/lfs/Makefile.inc
new file mode 100644
index 000000000000..9d40c42dc0e6
--- /dev/null
+++ b/libexec/flua/lfs/Makefile.inc
@@ -0,0 +1,2 @@
+.PATH: ${.PARSEDIR}
+SRCS+= lfs.c
diff --git a/libexec/flua/modules/lfs.c b/libexec/flua/lfs/lfs.c
index 8cb8d6fc9fed..517e16ae65c8 100644
--- a/libexec/flua/modules/lfs.c
+++ b/libexec/flua/lfs/lfs.c
@@ -66,9 +66,10 @@
#ifdef _STANDALONE
#include "lstd.h"
#include "lutils.h"
-#include "bootstrap.h"
#endif
+#include "bootstrap.h"
+
#ifndef nitems
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
#endif
@@ -446,3 +447,7 @@ luaopen_lfs(lua_State *L)
#endif
return 1;
}
+
+#ifndef _STANDALONE
+FLUA_MODULE(lfs);
+#endif
diff --git a/libexec/flua/modules/lfs.h b/libexec/flua/lfs/lfs.h
index a99e66d7f601..a99e66d7f601 100644
--- a/libexec/flua/modules/lfs.h
+++ b/libexec/flua/lfs/lfs.h
diff --git a/libexec/flua/libfreebsd/kenv/Makefile b/libexec/flua/libfreebsd/kenv/Makefile
index 1726c892c515..a1b388bb3612 100644
--- a/libexec/flua/libfreebsd/kenv/Makefile
+++ b/libexec/flua/libfreebsd/kenv/Makefile
@@ -1,5 +1,5 @@
SHLIB_NAME= kenv.so
-SRCS+= kenv.c
MAN= freebsd.kenv.3lua
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/libfreebsd/kenv/Makefile.inc b/libexec/flua/libfreebsd/kenv/Makefile.inc
new file mode 100644
index 000000000000..05819c5280d9
--- /dev/null
+++ b/libexec/flua/libfreebsd/kenv/Makefile.inc
@@ -0,0 +1,2 @@
+.PATH: ${.PARSEDIR}
+SRCS+= kenv.c
diff --git a/libexec/flua/libfreebsd/kenv/kenv.c b/libexec/flua/libfreebsd/kenv/kenv.c
index 954baa00facb..56b24c72904a 100644
--- a/libexec/flua/libfreebsd/kenv/kenv.c
+++ b/libexec/flua/libfreebsd/kenv/kenv.c
@@ -14,6 +14,8 @@
#include <lualib.h>
#include <lauxlib.h>
+#include "bootstrap.h"
+
int luaopen_freebsd_kenv(lua_State *L);
static int
@@ -94,3 +96,5 @@ luaopen_freebsd_kenv(lua_State *L)
return (1);
}
+
+FLUA_MODULE_NAMED(freebsd_kenv, "freebsd.kenv");
diff --git a/libexec/flua/libfreebsd/sys/linker/Makefile b/libexec/flua/libfreebsd/sys/linker/Makefile
index 1adf547b503c..f1f65ad5f6c1 100644
--- a/libexec/flua/libfreebsd/sys/linker/Makefile
+++ b/libexec/flua/libfreebsd/sys/linker/Makefile
@@ -1,7 +1,6 @@
SHLIB_NAME= linker.so
-SRCS+= linker.c
-
MAN= freebsd.sys.linker.3lua
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/libfreebsd/sys/linker/Makefile.inc b/libexec/flua/libfreebsd/sys/linker/Makefile.inc
new file mode 100644
index 000000000000..da65c0070170
--- /dev/null
+++ b/libexec/flua/libfreebsd/sys/linker/Makefile.inc
@@ -0,0 +1,2 @@
+.PATH: ${.PARSEDIR}
+SRCS+= linker.c
diff --git a/libexec/flua/libfreebsd/sys/linker/linker.c b/libexec/flua/libfreebsd/sys/linker/linker.c
index 87eccfb651f0..c78fbb2b39d2 100644
--- a/libexec/flua/libfreebsd/sys/linker/linker.c
+++ b/libexec/flua/libfreebsd/sys/linker/linker.c
@@ -15,6 +15,8 @@
#include <lualib.h>
#include <lauxlib.h>
+#include "bootstrap.h"
+
int luaopen_freebsd_sys_linker(lua_State *L);
static int
@@ -80,3 +82,5 @@ luaopen_freebsd_sys_linker(lua_State *L)
return (1);
}
+
+FLUA_MODULE_NAMED(freebsd_sys_linker, "freebsd.sys.linker");
diff --git a/libexec/flua/libhash/Makefile b/libexec/flua/libhash/Makefile
index b7c8d7ee9948..9cbd6f15acae 100644
--- a/libexec/flua/libhash/Makefile
+++ b/libexec/flua/libhash/Makefile
@@ -1,9 +1,6 @@
SHLIB_NAME= hash.so
-SRCS+= lhash.c
-
-LIBADD+= md
-
MAN= hash.3lua
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/libhash/Makefile.inc b/libexec/flua/libhash/Makefile.inc
new file mode 100644
index 000000000000..d112dfe7df33
--- /dev/null
+++ b/libexec/flua/libhash/Makefile.inc
@@ -0,0 +1,3 @@
+.PATH: ${.PARSEDIR}
+SRCS+= lhash.c
+LIBADD+= md
diff --git a/libexec/flua/libhash/lhash.c b/libexec/flua/libhash/lhash.c
index 4587961fe8a0..f455f006bf27 100644
--- a/libexec/flua/libhash/lhash.c
+++ b/libexec/flua/libhash/lhash.c
@@ -11,6 +11,8 @@
#include <sha256.h>
#include <string.h>
+#include "bootstrap.h"
+
#define SHA256_META "SHA256 meta table"
#define SHA256_DIGEST_LEN 32
@@ -175,3 +177,7 @@ luaopen_hash(lua_State *L)
return 1;
}
+
+#ifndef _STANDALONE
+FLUA_MODULE(hash);
+#endif
diff --git a/libexec/flua/libjail/Makefile b/libexec/flua/libjail/Makefile
index 20cd9f5f1429..b9c8bdc39095 100644
--- a/libexec/flua/libjail/Makefile
+++ b/libexec/flua/libjail/Makefile
@@ -1,9 +1,6 @@
SHLIB_NAME= jail.so
-SRCS+= lua_jail.c
-
-LIBADD+= jail
-
MAN= jail.3lua
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/libjail/Makefile.inc b/libexec/flua/libjail/Makefile.inc
new file mode 100644
index 000000000000..a896bf38c65b
--- /dev/null
+++ b/libexec/flua/libjail/Makefile.inc
@@ -0,0 +1,3 @@
+.PATH: ${.PARSEDIR}
+SRCS+= lua_jail.c
+LIBADD+= jail
diff --git a/libexec/flua/libjail/lua_jail.c b/libexec/flua/libjail/lua_jail.c
index 9632db795775..8c3ec6c1d500 100644
--- a/libexec/flua/libjail/lua_jail.c
+++ b/libexec/flua/libjail/lua_jail.c
@@ -38,6 +38,8 @@
#include <lauxlib.h>
#include <lualib.h>
+#include "bootstrap.h"
+
#define JAIL_METATABLE "jail iterator metatable"
/*
@@ -716,3 +718,5 @@ luaopen_jail(lua_State *L)
return (1);
}
+
+FLUA_MODULE(jail);
diff --git a/libexec/flua/liblyaml/Makefile b/libexec/flua/liblyaml/Makefile
index e7a89d09bb9e..8d1432acd325 100644
--- a/libexec/flua/liblyaml/Makefile
+++ b/libexec/flua/liblyaml/Makefile
@@ -1,22 +1,4 @@
SHLIB_NAME= yaml.so
-WARNS= 1
-LYAMLSRC?= ${SRCTOP}/contrib/lyaml
-.PATH: ${LYAMLSRC}/ext/yaml ${LYAMLSRC}/lib/lyaml
-SRCS= emitter.c \
- parser.c \
- scanner.c \
- yaml.c
-CFLAGS+= \
- -I${LYAMLSRC}/ext/yaml \
- -I${SRCTOP}/contrib/libyaml/include \
- -DVERSION=\"6.2.8\"
-LIBADD+= yaml
-
-FILES= explicit.lua \
- functional.lua \
- implicit.lua \
- init.lua
-FILESDIR= ${SHAREDIR}/flua/lyaml
-
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/liblyaml/Makefile.inc b/libexec/flua/liblyaml/Makefile.inc
new file mode 100644
index 000000000000..caa1f37b57eb
--- /dev/null
+++ b/libexec/flua/liblyaml/Makefile.inc
@@ -0,0 +1,20 @@
+WARNS= 1
+
+LYAMLSRC?= ${SRCTOP}/contrib/lyaml
+.PATH: ${LYAMLSRC}/ext/yaml ${LYAMLSRC}/lib/lyaml
+SRCS+= emitter.c \
+ parser.c \
+ scanner.c \
+ yaml.c
+CFLAGS+= \
+ -I${LYAMLSRC}/ext/yaml \
+ -I${SRCTOP}/contrib/libyaml/include \
+ -DVERSION=\"6.2.8\"
+LIBADD+= yaml
+
+FILESGROUPS+= YAML
+YAML= explicit.lua \
+ functional.lua \
+ implicit.lua \
+ init.lua
+YAMLDIR= ${SHAREDIR}/flua/lyaml
diff --git a/libexec/flua/libucl/Makefile b/libexec/flua/libucl/Makefile
index a88c8bda6bfc..32d76d1ea1ad 100644
--- a/libexec/flua/libucl/Makefile
+++ b/libexec/flua/libucl/Makefile
@@ -1,14 +1,4 @@
SHLIB_NAME= ucl.so
-WARNS= 2
-
-UCLSRC?= ${SRCTOP}/contrib/libucl
-.PATH: ${UCLSRC}/lua
-SRCS+= lua_ucl.c
-CFLAGS+= \
- -I${UCLSRC}/include \
- -I${UCLSRC}/src \
- -I${UCLSRC}/uthash
-LIBADD+= ucl
-
+.include "Makefile.inc"
.include <bsd.lib.mk>
diff --git a/libexec/flua/libucl/Makefile.inc b/libexec/flua/libucl/Makefile.inc
new file mode 100644
index 000000000000..70fb0f265635
--- /dev/null
+++ b/libexec/flua/libucl/Makefile.inc
@@ -0,0 +1,12 @@
+.if ${WARNS:U6} > 2
+WARNS= 2
+.endif
+
+UCLSRC?= ${SRCTOP}/contrib/libucl
+.PATH: ${UCLSRC}/lua
+SRCS+= lua_ucl.c
+CFLAGS+= \
+ -I${UCLSRC}/include \
+ -I${UCLSRC}/src \
+ -I${UCLSRC}/uthash
+LIBADD+= ucl
diff --git a/libexec/flua/linit_flua.c b/libexec/flua/linit_flua.c
index b466b7872158..65356c938671 100644
--- a/libexec/flua/linit_flua.c
+++ b/libexec/flua/linit_flua.c
@@ -26,16 +26,16 @@
#include "lprefix.h"
-
#include <stddef.h>
+#include <stdlib.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
-#include "lfs.h"
#include "lposix.h"
-#include "lfbsd.h"
+
+#include "bootstrap.h"
/*
** these libs are loaded by lua.c and are readily available to any Lua
@@ -56,12 +56,32 @@ static const luaL_Reg loadedlibs[] = {
{LUA_BITLIBNAME, luaopen_bit32},
#endif
/* FreeBSD Extensions */
- {"lfs", luaopen_lfs},
{"posix", luaopen_posix},
- {"fbsd", luaopen_fbsd},
{NULL, NULL}
};
+#ifdef BOOTSTRAPPING
+static void __attribute__((constructor)) flua_init_env(void) {
+ /*
+ * This happens in the middle of luaopen_package(). We could move it into
+ * flua_setup_mods(), but it seems better to avoid its timing being so
+ * important that it would break some of our bootstrap modules if someone
+ * were to reorder things.
+ */
+ if (getenv("LUA_PATH") == NULL)
+ setenv("LUA_PATH", BOOTSTRAP_FLUA_PATH, 1);
+}
+
+static void flua_setup_mods (lua_State *L) {
+ const luaL_Reg **flib;
+
+ SET_FOREACH(flib, FLUA_MODULE_SETNAME) {
+ luaL_requiref(L, (*flib)->name, (*flib)->func, 1);
+ lua_pop(L, 1); /* remove lib */
+ }
+};
+#endif
+
LUALIB_API void luaL_openlibs (lua_State *L) {
const luaL_Reg *lib;
/* "require" functions from 'loadedlibs' and set results to global table */
@@ -69,4 +89,7 @@ LUALIB_API void luaL_openlibs (lua_State *L) {
luaL_requiref(L, lib->name, lib->func, 1);
lua_pop(L, 1); /* remove lib */
}
+#ifdef BOOTSTRAPPING
+ flua_setup_mods(L);
+#endif
}
diff --git a/libexec/kgdb/Makefile b/libexec/kgdb/Makefile
deleted file mode 100644
index f6b255ab4f60..000000000000
--- a/libexec/kgdb/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-FILESDIR?= /usr/libexec/kgdb
-
-FILES= acttrace.py
-
-.include <bsd.prog.mk>
diff --git a/libexec/kgdb/acttrace.py b/libexec/kgdb/acttrace.py
deleted file mode 100644
index 3229ff708de1..000000000000
--- a/libexec/kgdb/acttrace.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#-
-# Copyright (c) 2022 The FreeBSD Foundation
-#
-# This software was developed by Mark Johnston under sponsorship from the
-# FreeBSD Foundation.
-#
-
-import gdb
-
-
-def symval(name):
- return gdb.lookup_global_symbol(name).value()
-
-
-def tid_to_gdb_thread(tid):
- for thread in gdb.inferiors()[0].threads():
- if thread.ptid[2] == tid:
- return thread
- else:
- return None
-
-
-def all_pcpus():
- mp_maxid = symval("mp_maxid")
- cpuid_to_pcpu = symval("cpuid_to_pcpu")
-
- cpu = 0
- while cpu <= mp_maxid:
- pcpu = cpuid_to_pcpu[cpu]
- if pcpu:
- yield pcpu
- cpu = cpu + 1
-
-
-class acttrace(gdb.Command):
- def __init__(self):
- super(acttrace, self).__init__("acttrace", gdb.COMMAND_USER)
-
- def invoke(self, arg, from_tty):
- # Save the current thread so that we can switch back after.
- curthread = gdb.selected_thread()
-
- for pcpu in all_pcpus():
- td = pcpu['pc_curthread']
- tid = td['td_tid']
-
- gdb_thread = tid_to_gdb_thread(tid)
- if gdb_thread is None:
- print("failed to find GDB thread with TID {}".format(tid))
- else:
- gdb_thread.switch()
-
- p = td['td_proc']
- print("Tracing command {} pid {} tid {} (CPU {})".format(
- p['p_comm'], p['p_pid'], td['td_tid'], pcpu['pc_cpuid']))
- gdb.execute("bt")
- print()
-
- curthread.switch()
-
-
-# Registers the command with gdb, doesn't do anything.
-acttrace()
diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit
index 29340a3d91ea..f29fa8ba1bac 100755
--- a/libexec/nuageinit/nuageinit
+++ b/libexec/nuageinit/nuageinit
@@ -6,6 +6,7 @@
-- Copyright(c) 2025 Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
local nuage = require("nuage")
+local lfs = require("lfs")
local ucl = require("ucl")
local yaml = require("lyaml")
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index c354aec44430..c776a815003c 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -500,6 +500,9 @@ netwait_enable="NO" # Enable rc.d/netwait (or NO)
netwait_timeout="60" # Total number of seconds to perform pings.
#netwait_if="" # Wait for active link on each intf in this list.
netwait_if_timeout="30" # Total number of seconds to monitor link state.
+netwait_dad="NO" # Wait for DAD to complete
+netwait_dad_timeout="" # Total number of seconds to wait for DAD, zero
+ # or unset to autodetect
### Miscellaneous network options: ###
icmp_bmcastecho="NO" # respond to broadcast ping packets
diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile
index cd55a05f545e..03f0933533ca 100644
--- a/libexec/rc/rc.d/Makefile
+++ b/libexec/rc/rc.d/Makefile
@@ -218,7 +218,7 @@ CCDPACKAGE= ccdconfig
.if ${MK_CUSE} != "no"
CONFGROUPS+= VOSS
VOSS= virtual_oss
-VOSSPACKAGE= virtual_oss
+VOSSPACKAGE= sound
.endif
.if ${MK_KERBEROS_SUPPORT} != "no"
diff --git a/libexec/rc/rc.d/netwait b/libexec/rc/rc.d/netwait
index 3f374806d97c..05874552cf1c 100755
--- a/libexec/rc/rc.d/netwait
+++ b/libexec/rc/rc.d/netwait
@@ -2,12 +2,14 @@
#
# PROVIDE: netwait
# REQUIRE: devd ipfw pf routing
-# KEYWORD: nojail
#
-# The netwait script helps handle two situations:
+# The netwait script helps handle three situations:
# - Systems with USB or other late-attaching network hardware which
# is initialized by devd events. The script waits for all the
# interfaces named in the netwait_if list to appear.
+# - Systems with IPv6 addresses, especially jails, where we need to
+# wait for DAD to complete before starting daemons, as they will
+# otherwise fail to bind to IN6ADDR_ANY.
# - Systems with statically-configured IP addresses in rc.conf(5).
# The IP addresses in the netwait_ip list are pinged. The script
# waits for any single IP in the list to respond to the ping. If your
@@ -29,28 +31,38 @@ netwait_start()
{
local ip rc count output link wait_if got_if any_error
- if [ -z "${netwait_if}" ] && [ -z "${netwait_ip}" ]; then
- err 1 "No interface or IP addresses listed, nothing to wait for"
+ if [ -z "${netwait_if}" ] && [ -z "${netwait_ip}" ] &&
+ ! checkyesno netwait_dad ; then
+ err 1 "Nothing to wait for"
fi
- if [ ${netwait_timeout} -lt 1 ]; then
+ if ! [ "${netwait_if_timeout:=0}" -ge 1 ]; then
+ err 1 "netwait_if_timeout must be >= 1"
+ fi
+ if ! check_kern_features inet6; then
+ netwait_dad="NO"
+ elif ! [ "${netwait_dad_timeout:=0}" -ge 1 ]; then
+ netwait_dad_timeout=$(($(sysctl -n net.inet6.ip6.dad_count)+1))
+ fi
+ if ! [ "${netwait_timeout:=0}" -ge 1 ]; then
err 1 "netwait_timeout must be >= 1"
fi
+ any_error=false
+
if [ -n "${netwait_if}" ]; then
- any_error=0
for wait_if in ${netwait_if}; do
echo -n "Waiting for ${wait_if}"
link=""
- got_if=0
+ got_if=false
count=1
- # Handle SIGINT (Ctrl-C); force abort of while() loop
+ # Handle SIGINT (Ctrl-C); force abort of while loop
trap break SIGINT
while [ ${count} -le ${netwait_if_timeout} ]; do
if output=`/sbin/ifconfig ${wait_if} 2>/dev/null`; then
- if [ ${got_if} -eq 0 ]; then
+ if ! ${got_if}; then
echo -n ", interface present"
- got_if=1
+ got_if=true
fi
link=`expr "${output}" : '.*[[:blank:]]status: \(no carrier\)'`
if [ -z "${link}" ]; then
@@ -63,22 +75,45 @@ netwait_start()
done
# Restore default SIGINT handler
trap - SIGINT
- if [ ${got_if} -eq 0 ]; then
+ if ! ${got_if}; then
echo ", wait failed: interface never appeared."
- any_error=1
+ any_error=true
elif [ -n "${link}" ]; then
echo ", wait failed: interface still has no link."
- any_error=1
+ any_error=true
fi
done
- if [ ${any_error} -eq 1 ]; then
- warn "Continuing with startup, but be aware you may not have "
- warn "a fully functional networking layer at this point."
- fi
fi
+ if checkyesno netwait_dad; then
+ got_dad=false
+ # Handle SIGINT (Ctrl-C); force abort of while loop
+ trap break SIGINT
+
+ echo -n "Waiting for DAD to complete"
+ count=1
+ while [ ${count} -le ${netwait_dad_timeout} ]; do
+ if ! ifconfig | grep -q 'inet6.*tentative'; then
+ echo ', done.'
+ got_dad=true
+ break
+ fi
+ sleep 1
+ count=$((count+1))
+ done
+
+ # Restore default SIGINT handler
+ trap - SIGINT
+
+ if ! ${got_dad}; then
+ echo ', timed out.'
+ any_error=true
+ fi
+ fi
+
if [ -n "${netwait_ip}" ]; then
- # Handle SIGINT (Ctrl-C); force abort of for() loop
+ got_ip=false
+ # Handle SIGINT (Ctrl-C); force abort of for loop
trap break SIGINT
for ip in ${netwait_ip}; do
@@ -90,11 +125,9 @@ netwait_start()
rc=$?
if [ $rc -eq 0 ]; then
- # Restore default SIGINT handler
- trap - SIGINT
-
echo ', got response.'
- return
+ got_ip=false
+ break 2
fi
count=$((count+1))
done
@@ -104,10 +137,15 @@ netwait_start()
# Restore default SIGINT handler
trap - SIGINT
- warn "Exhausted IP list. Continuing with startup, but be aware you may"
- warn "not have a fully functional networking layer at this point."
+ if ! ${got_ip}; then
+ any_error=true
+ fi
fi
+ if ${any_error}; then
+ warn "Continuing with startup, but be aware you may not have "
+ warn "a fully functional networking layer at this point."
+ fi
}
load_rc_config $name