Skip to Content.
Sympa Menu

sm-commit - [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (4d366440b80e371c052fb0958bd549e05c7542db)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org, sm-commit AT lists.sourcemage.org
  • Subject: [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (4d366440b80e371c052fb0958bd549e05c7542db)
  • Date: Sat, 19 Sep 2026 06:53:12 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

utils/systemtap/HISTORY
| 16 +
utils/systemtap/PRE_BUILD
| 4

utils/systemtap/patches/0001-Include-sys-types.h-in-staputil.h-for-gid_t-and-frie.patch
| 36 ++
utils/systemtap/patches/0002-Drop-strdupa-from-split_path.patch
| 49 +++

utils/systemtap/patches/0003-Include-limits.h-in-cscommon.cxx-for-PATH_MAX.patch
| 30 ++

utils/systemtap/patches/0004-Stop-relying-on-the-GNU-basename-from-string.h.patch
| 52 +++

utils/systemtap/patches/0005-Use-realpath-instead-of-canonicalize_file_name.patch
| 47 +++

utils/systemtap/patches/0006-Call-open-rather-than-open64-in-setupdwfl.cxx.patch
| 33 ++

utils/systemtap/patches/0007-Make-the-nftw-FTW_ACTIONRETVAL-use-in-main.cxx-optio.patch
| 131 ++++++++++
utils/systemtap/patches/0008-Tolerate-a-C-library-without-FNM_EXTMATCH.patch
| 39 ++

utils/systemtap/patches/0009-Use-the-standard-stdint.h-types-in-sdt_types.h.patch
| 99 +++++++
utils/systemtap/patches/0010-Tolerate-a-C-library-without-NI_IDN.patch
| 39 ++

utils/systemtap/patches/0011-Use-the-POSIX-spellings-poll.h-and-fcntl.h.patch
| 56 ++++
utils/systemtap/patches/0012-Use-off_t-rather-than-__off_t-in-staprun.patch
| 50 +++
14 files changed, 680 insertions(+), 1 deletion(-)

New commits:
commit 4d366440b80e371c052fb0958bd549e05c7542db
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

systemtap: Fix build against musl

diff --git a/utils/systemtap/HISTORY b/utils/systemtap/HISTORY
index 013451d..e40b757 100644
--- a/utils/systemtap/HISTORY
+++ b/utils/systemtap/HISTORY
@@ -1,6 +1,20 @@
2026-09-19 Ismael Luceno <ismael AT sourcemage.org>
- * PRE_BUILD, git_version.patch, eigler.gpg: removed, no longer needed
+ * git_version.patch, eigler.gpg: removed, no longer needed
* DETAILS: updated spell to 5.6
+ * PRE_BUILD: use apply_patch_dir
+ *
patches/0001-Include-sys-types.h-in-staputil.h-for-gid_t-and-frie.patch,
+ patches/0002-Drop-strdupa-from-split_path.patch,
+ patches/0003-Include-limits.h-in-cscommon.cxx-for-PATH_MAX.patch,
+ patches/0004-Stop-relying-on-the-GNU-basename-from-string.h.patch,
+ patches/0005-Use-realpath-instead-of-canonicalize_file_name.patch,
+ patches/0006-Call-open-rather-than-open64-in-setupdwfl.cxx.patch,
+
patches/0007-Make-the-nftw-FTW_ACTIONRETVAL-use-in-main.cxx-optio.patch,
+ patches/0008-Tolerate-a-C-library-without-FNM_EXTMATCH.patch,
+ patches/0009-Use-the-standard-stdint.h-types-in-sdt_types.h.patch,
+ patches/0010-Tolerate-a-C-library-without-NI_IDN.patch,
+ patches/0011-Use-the-POSIX-spellings-poll.h-and-fcntl.h.patch,
+ patches/0012-Use-off_t-rather-than-__off_t-in-staprun.patch:
+ fixed build against musl

2022-12-20 Florian Franzmann <bwlf AT bandrate.org>
* TRIGGERS: on cast boost check self
diff --git a/utils/systemtap/PRE_BUILD b/utils/systemtap/PRE_BUILD
new file mode 100755
index 0000000..f80ee7d
--- /dev/null
+++ b/utils/systemtap/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "${SOURCE_DIRECTORY}" &&
+
+apply_patch_dir patches
diff --git
a/utils/systemtap/patches/0001-Include-sys-types.h-in-staputil.h-for-gid_t-and-frie.patch

b/utils/systemtap/patches/0001-Include-sys-types.h-in-staputil.h-for-gid_t-and-frie.patch
new file mode 100644
index 0000000..70b9608
--- /dev/null
+++
b/utils/systemtap/patches/0001-Include-sys-types.h-in-staputil.h-for-gid_t-and-frie.patch
@@ -0,0 +1,36 @@
+From 8a7b88087b59f94dd3e794ab91e272bf759ed0a2 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:50:28 +0200
+Subject: [PATCH 01/12] Include <sys/types.h> in staputil.h for gid_t and
+ friends
+
+staputil.h declares get_gid(), in_group_id() and run_unprivileged()
+using gid_t, uid_t and pid_t, but it only includes <signal.h>,
+<stdint.h>, <spawn.h>, <assert.h> and <poll.h>.
+
+glibc happens to define all three types as a side effect of <signal.h>.
+musl does not: its <signal.h> declares pid_t and uid_t but never gid_t,
+so every translation unit that includes staputil.h fails with
+
+ staputil.h:100:12: error: 'gid_t' does not name a type
+
+Include <sys/types.h>, which POSIX makes the home of these types.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ staputil.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/staputil.h b/staputil.h
+index 6dee9cbc..b0dad86d 100644
+--- a/staputil.h
++++ b/staputil.h
+@@ -27,6 +27,7 @@ extern "C" {
+ #include <spawn.h>
+ #include <assert.h>
+ #include <poll.h>
++#include <sys/types.h>
+ }
+
+ // Sanity check C++11 support. We're only requiring GCC 4.4's level of
diff --git a/utils/systemtap/patches/0002-Drop-strdupa-from-split_path.patch
b/utils/systemtap/patches/0002-Drop-strdupa-from-split_path.patch
new file mode 100644
index 0000000..275efec
--- /dev/null
+++ b/utils/systemtap/patches/0002-Drop-strdupa-from-split_path.patch
@@ -0,0 +1,49 @@
+From ba6955b9d8ab96977e3ec444674b0b41ebcdaee0 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:50:43 +0200
+Subject: [PATCH 02/12] Drop strdupa() from split_path()
+
+strdupa() is a GNU extension. musl provides it, but as
+
+ #define strdupa(x) strcpy(alloca(strlen(x)+1),x)
+
+and alloca() returns void*, which C++ will not convert implicitly:
+
+ staputil.cxx:300:10: error: invalid conversion from 'void*' to 'char*'
+
+Use a std::vector<char> for each of the two writable copies that
+dirname() and basename() need. This also removes the unbounded
+stack allocation, which was proportional to the path length.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ staputil.cxx | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/staputil.cxx b/staputil.cxx
+index be162d58..63a2b184 100644
+--- a/staputil.cxx
++++ b/staputil.cxx
+@@ -295,14 +295,13 @@ remove_file_or_dir (const char *name)
+ void
+ split_path (string &path, string &directory, string &entry)
+ {
+- char *dirc, *basec, *bname, *dname;
+-
+- dirc = strdupa (path.c_str());
+- basec = strdupa (path.c_str());
+- dname = dirname (dirc);
+- bname = basename (basec);
+- directory = dname;
+- entry = bname;
++ // dirname() and basename() are allowed to modify their argument, so
++ // give each one a private, writable copy of the path.
++ vector<char> dirc (path.c_str(), path.c_str() + path.size() + 1);
++ vector<char> basec (dirc);
++
++ directory = dirname (dirc.data());
++ entry = basename (basec.data());
+ }
+
+
diff --git
a/utils/systemtap/patches/0003-Include-limits.h-in-cscommon.cxx-for-PATH_MAX.patch

b/utils/systemtap/patches/0003-Include-limits.h-in-cscommon.cxx-for-PATH_MAX.patch
new file mode 100644
index 0000000..58f26a2
--- /dev/null
+++
b/utils/systemtap/patches/0003-Include-limits.h-in-cscommon.cxx-for-PATH_MAX.patch
@@ -0,0 +1,30 @@
+From f38c06ffa615b0704db48395036d79f9abc2946b Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:50:56 +0200
+Subject: [PATCH 03/12] Include <limits.h> in cscommon.cxx for PATH_MAX
+
+generate_mok() declares "char tmpdir[PATH_MAX]" and passes PATH_MAX to
+snprintf(), but nothing in the include list defines PATH_MAX. glibc
+leaks it in through <ssl.h> -> ... -> <limits.h>; musl does not, so the
+file fails to compile:
+
+ cscommon.cxx:300:15: error: 'PATH_MAX' was not declared in this scope
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ cscommon.cxx | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cscommon.cxx b/cscommon.cxx
+index 5b46ee83..2301d420 100644
+--- a/cscommon.cxx
++++ b/cscommon.cxx
+@@ -29,6 +29,7 @@ extern "C"
+ #include <ssl.h>
+ #include <sys/stat.h>
+ #include <dirent.h>
++#include <limits.h>
+ #include <unistd.h>
+ }
+
diff --git
a/utils/systemtap/patches/0004-Stop-relying-on-the-GNU-basename-from-string.h.patch

b/utils/systemtap/patches/0004-Stop-relying-on-the-GNU-basename-from-string.h.patch
new file mode 100644
index 0000000..5b228e5
--- /dev/null
+++
b/utils/systemtap/patches/0004-Stop-relying-on-the-GNU-basename-from-string.h.patch
@@ -0,0 +1,52 @@
+From 320a0076e9b674554c7170787c69ed5a29157d0d Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:51:17 +0200
+Subject: [PATCH 04/12] Stop relying on the GNU basename() from <string.h>
+
+buildrun.cxx and remote.cxx call basename() on a "const char *" without
+including <libgen.h>. That only works with glibc, which offers a second,
+non-modifying basename() from <string.h> whenever _GNU_SOURCE is set.
+musl has only the POSIX one, and it lives in <libgen.h> and takes a
+"char *", so both files fail:
+
+ buildrun.cxx:1062:53: error: 'basename' was not declared in this scope
+
+Including <libgen.h> is not a fix here: the POSIX basename() may modify
+its argument, which these two call sites are not prepared for. Use the
+same std::string idiom the rest of buildrun.cxx already uses instead.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ buildrun.cxx | 3 ++-
+ remote.cxx | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/buildrun.cxx b/buildrun.cxx
+index 93e2e9f4..99cc2eb9 100644
+--- a/buildrun.cxx
++++ b/buildrun.cxx
+@@ -1059,7 +1059,8 @@ make_kernel_run_command (systemtap_session& s, const
string& remotedir,
+ if (remotedir.empty())
+ opt_u.append(s.uprobes_path);
+ else
+- opt_u.append(remotedir + "/" +
basename(s.uprobes_path.c_str()));
++ opt_u.append(remotedir + "/"
++ +
s.uprobes_path.substr(s.uprobes_path.rfind('/')+1)); // basename
+ }
+ cmd.push_back(opt_u);
+ }
+diff --git a/remote.cxx b/remote.cxx
+index 86fae247..95a90764 100644
+--- a/remote.cxx
++++ b/remote.cxx
+@@ -538,7 +538,8 @@ class stapsh : public remote {
+
+ if (!s->uprobes_path.empty())
+ {
+- string remoteuprobes = basename(s->uprobes_path.c_str());
++ string remoteuprobes =
++ s->uprobes_path.substr(s->uprobes_path.rfind('/')+1); //
basename
+ if ((rc = send_file(s->uprobes_path, remoteuprobes)))
+ return rc;
+
diff --git
a/utils/systemtap/patches/0005-Use-realpath-instead-of-canonicalize_file_name.patch

b/utils/systemtap/patches/0005-Use-realpath-instead-of-canonicalize_file_name.patch
new file mode 100644
index 0000000..74fc5d7
--- /dev/null
+++
b/utils/systemtap/patches/0005-Use-realpath-instead-of-canonicalize_file_name.patch
@@ -0,0 +1,47 @@
+From d493979e8c4419b3bde09228c594ea84cd842aaa Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:51:43 +0200
+Subject: [PATCH 05/12] Use realpath() instead of canonicalize_file_name()
+
+canonicalize_file_name() is a GNU extension. musl does not provide it,
+so client-nss.cxx and session.cxx fail to compile there:
+
+ session.cxx:1565:15: error: 'canonicalize_file_name' was not declared
+
+POSIX.1-2008 realpath(path, NULL) is defined to do the same thing --
+resolve the path and return a malloc'd buffer -- and both call sites
+already free() the result, so the change is a straight substitution.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ client-nss.cxx | 2 +-
+ session.cxx | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/client-nss.cxx b/client-nss.cxx
+index ecc45dd4..f2beea3e 100644
+--- a/client-nss.cxx
++++ b/client-nss.cxx
+@@ -577,7 +577,7 @@ nss_client_backend::include_file_or_directory (const
string &subdir,
+
+ // Canonicalize the given path and remove the leading /.
+ string rpath;
+- char *cpath = canonicalize_file_name (path.c_str ());
++ char *cpath = realpath (path.c_str (), NULL);
+ if (! cpath)
+ {
+ // It can not be canonicalized. Use the name relative to
+diff --git a/session.cxx b/session.cxx
+index 881b87f8..2aa504ef 100644
+--- a/session.cxx
++++ b/session.cxx
+@@ -1562,7 +1562,7 @@ systemtap_session::parse_cmdline (int argc, char *
const argv [])
+ } else {
+ char *spath;
+ assert(optarg);
+- spath = canonicalize_file_name (optarg);
++ spath = realpath (optarg, NULL);
+ if (spath == NULL) {
+ cerr << _F("ERROR: %s is an invalid directory for
--sysroot", optarg) << endl;
+ return 1;
diff --git
a/utils/systemtap/patches/0006-Call-open-rather-than-open64-in-setupdwfl.cxx.patch

b/utils/systemtap/patches/0006-Call-open-rather-than-open64-in-setupdwfl.cxx.patch
new file mode 100644
index 0000000..d708ce1
--- /dev/null
+++
b/utils/systemtap/patches/0006-Call-open-rather-than-open64-in-setupdwfl.cxx.patch
@@ -0,0 +1,33 @@
+From 249cac44eac9a5e706b41a7b7fb8b006192441ea Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:51:55 +0200
+Subject: [PATCH 06/12] Call open() rather than open64() in setupdwfl.cxx
+
+open64() is an LFS64 alias that only glibc defines; musl dropped the
+LFS64 aliases entirely, so setupdwfl.cxx fails there:
+
+ setupdwfl.cxx:1649:17: error: 'open64' was not declared in this scope
+
+configure.ac already runs AC_SYS_LARGEFILE, so plain open() is the
+64-bit one everywhere systemtap builds, and /sys/kernel/notes is a few
+hundred bytes in any case.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ setupdwfl.cxx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setupdwfl.cxx b/setupdwfl.cxx
+index 02b94a7c..48dbe5ec 100644
+--- a/setupdwfl.cxx
++++ b/setupdwfl.cxx
+@@ -1646,7 +1646,7 @@ get_kernel_build_id(systemtap_session &s)
+ << endl;
+
+ const char *notesfile = "/sys/kernel/notes";
+- int fd = open64 (notesfile, O_RDONLY);
++ int fd = open (notesfile, O_RDONLY);
+ if (fd >= 0)
+ {
+ assert (sizeof (Elf32_Nhdr) == sizeof (GElf_Nhdr));
diff --git
a/utils/systemtap/patches/0007-Make-the-nftw-FTW_ACTIONRETVAL-use-in-main.cxx-optio.patch

b/utils/systemtap/patches/0007-Make-the-nftw-FTW_ACTIONRETVAL-use-in-main.cxx-optio.patch
new file mode 100644
index 0000000..4ec713a
--- /dev/null
+++
b/utils/systemtap/patches/0007-Make-the-nftw-FTW_ACTIONRETVAL-use-in-main.cxx-optio.patch
@@ -0,0 +1,131 @@
+From 8669c305d9741329237723424221f7af528cfad3 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:52:34 +0200
+Subject: [PATCH 07/12] Make the nftw() FTW_ACTIONRETVAL use in main.cxx
+ optional
+
+FTW_ACTIONRETVAL, FTW_CONTINUE and FTW_SKIP_SUBTREE are GNU extensions.
+musl has none of them, so main.cxx does not compile there:
+
+ main.cxx:499:16: error: 'FTW_SKIP_SUBTREE' was not declared in this scope
+
+Simply #defining the three constants, as some distributions do, is wrong:
+without FTW_ACTIONRETVAL a non-zero callback return aborts the whole walk
+instead of pruning one subtree, so the tapset search would stop at the
+first directory outside PATH.
+
+Instead, hoist the pruning rule into a want_path() predicate applied to
+each candidate file, which gives the same set of files whether or not the
+subtree was pruned, and make the FTW_SKIP_SUBTREE return a pure
+optimisation used only where the extension exists.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ main.cxx | 43 ++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 34 insertions(+), 9 deletions(-)
+
+diff --git a/main.cxx b/main.cxx
+index e9a005ef..29befe83 100644
+-- a/main.cxx
++++ b/main.cxx
+@@ -482,13 +482,38 @@ run_sdt_benchmark(systemtap_session& s)
+ static set<string> files;
+ static string path_dir;
+
++// FTW_ACTIONRETVAL and its return codes are GNU extensions. Where they
++// are missing (e.g. musl) fall back to walking the whole tree and
++// let want_path() below do the filtering the skip was there to do.
++#ifdef FTW_ACTIONRETVAL
++#define STAP_FTW_FLAGS FTW_ACTIONRETVAL
++#define STAP_FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
++#define STAP_FTW_CONTINUE FTW_CONTINUE
++#else
++#define STAP_FTW_FLAGS 0
++#define STAP_FTW_SKIP_SUBTREE 0
++#define STAP_FTW_CONTINUE 0
++#endif
++
++// True for the files the collect_* callbacks are allowed to pick up:
++// those sitting directly in the directory being walked, plus anything
++// below the PATH subdirectory. This mirrors the FTW_SKIP_SUBTREE test
++// below, so the result is the same with or without FTW_ACTIONRETVAL.
++static bool want_path(const char* fpath, struct FTW* ftwbuf)
++{
++ if (ftwbuf->level <= 1)
++ return true;
++ return strncmp(path_dir.c_str(), fpath, path_dir.size()) == 0 &&
++ fpath[path_dir.size()] == '/';
++}
++
+ static int collect_stp(const char* fpath, const struct stat*,
+ int typeflag, struct FTW* ftwbuf)
+ {
+ if (typeflag == FTW_F)
+ {
+ const char* ext = strrchr(fpath, '.');
+- if (ext && (strcmp(".stp", ext) == 0))
++ if (ext && (strcmp(".stp", ext) == 0) && want_path(fpath, ftwbuf))
+ files.insert(fpath);
+ }
+ else if (typeflag == FTW_D && ftwbuf->level > 0)
+@@ -496,9 +521,9 @@ static int collect_stp(const char* fpath, const struct
stat*,
+ // Only recurse for PATH root directory
+ if (strncmp(path_dir.c_str(), fpath, path_dir.size()) != 0 ||
+ (fpath[path_dir.size()] != '/' && fpath[path_dir.size()] != '\0'))
+- return FTW_SKIP_SUBTREE;
++ return STAP_FTW_SKIP_SUBTREE;
+ }
+- return FTW_CONTINUE;
++ return STAP_FTW_CONTINUE;
+ }
+
+ static int collect_stpm(const char* fpath, const struct stat*,
+@@ -507,7 +532,7 @@ static int collect_stpm(const char* fpath, const struct
stat*,
+ if (typeflag == FTW_F)
+ {
+ const char* ext = strrchr(fpath, '.');
+- if (ext && (strcmp(".stpm", ext) == 0))
++ if (ext && (strcmp(".stpm", ext) == 0) && want_path(fpath, ftwbuf))
+ files.insert(fpath);
+ }
+ else if (typeflag == FTW_D && ftwbuf->level > 0)
+@@ -515,9 +540,9 @@ static int collect_stpm(const char* fpath, const struct
stat*,
+ // Only recurse for PATH root directory
+ if (strncmp(path_dir.c_str(), fpath, path_dir.size()) != 0 ||
+ (fpath[path_dir.size()] != '/' && fpath[path_dir.size()] != '\0'))
+- return FTW_SKIP_SUBTREE;
++ return STAP_FTW_SKIP_SUBTREE;
+ }
+- return FTW_CONTINUE;
++ return STAP_FTW_CONTINUE;
+ }
+
+ #if !HAVE_BPF_DECLS
+@@ -638,7 +663,7 @@ passes_0_4 (systemtap_session &s)
+ {
+ files.clear();
+ path_dir = string(PKGDATADIR) + "/examples";
+- (void) nftw(path_dir.c_str(), collect_stp, 1,
FTW_ACTIONRETVAL);
++ (void) nftw(path_dir.c_str(), collect_stp, 1, STAP_FTW_FLAGS);
+
+ vector<string> examples;
+ for (auto it = files.begin(); it != files.end(); ++it)
+@@ -730,7 +755,7 @@ passes_0_4 (systemtap_session &s)
+ // now iterate upon it
+ for (unsigned k=0; k<version_suffixes.size(); k++)
+ {
+- int flags = FTW_ACTIONRETVAL;
++ int flags = STAP_FTW_FLAGS;
+ string dir = s.include_path[i] + version_suffixes[k];
+ files.clear();
+ // we need to set this for the nftw() callback
+@@ -812,7 +837,7 @@ passes_0_4 (systemtap_session &s)
+ // now iterate upon it
+ for (unsigned k=0; k<version_suffixes.size(); k++)
+ {
+- int flags = FTW_ACTIONRETVAL;
++ int flags = STAP_FTW_FLAGS;
+ string dir = s.include_path[i] + version_suffixes[k];
+ files.clear();
+ // we need to set this for the nftw() callback
diff --git
a/utils/systemtap/patches/0008-Tolerate-a-C-library-without-FNM_EXTMATCH.patch

b/utils/systemtap/patches/0008-Tolerate-a-C-library-without-FNM_EXTMATCH.patch
new file mode 100644
index 0000000..3154609
--- /dev/null
+++
b/utils/systemtap/patches/0008-Tolerate-a-C-library-without-FNM_EXTMATCH.patch
@@ -0,0 +1,39 @@
+From 58fd33186c111c53b3fd1280cbbad0f0dd5342ec Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:53:08 +0200
+Subject: [PATCH 08/12] Tolerate a C library without FNM_EXTMATCH
+
+tapsets.cxx passes FNM_EXTMATCH to fnmatch() when matching kernel
+function names. The flag is a GNU extension; musl does not
+have it, so the build stops with
+
+ tapsets.cxx:12341:71: error: 'FNM_EXTMATCH' was not declared in this scope
+
+Define it to 0 when absent. Ordinary glob patterns keep working; only
+the ksh-style !(...) / @(...) extended patterns are unavailable, and
+those cannot be supported without an extended fnmatch() in any case.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ tapsets.cxx | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/tapsets.cxx b/tapsets.cxx
+index 3c96d828..b72a680c 100644
+--- a/tapsets.cxx
++++ b/tapsets.cxx
+@@ -118,6 +118,13 @@ extern "C" {
+ #include <inttypes.h>
+ }
+
++// FNM_EXTMATCH (ksh-style !(...), @(...) and friends) is a GNU extension.
++// Where it is missing, fall back to matching the pattern as a plain glob,
++// which is all a non-glibc C library can offer.
++#ifndef FNM_EXTMATCH
++#define FNM_EXTMATCH 0
++#endif
++
+ using namespace std;
+ using namespace __gnu_cxx;
+
diff --git
a/utils/systemtap/patches/0009-Use-the-standard-stdint.h-types-in-sdt_types.h.patch

b/utils/systemtap/patches/0009-Use-the-standard-stdint.h-types-in-sdt_types.h.patch
new file mode 100644
index 0000000..33f7ddd
--- /dev/null
+++
b/utils/systemtap/patches/0009-Use-the-standard-stdint.h-types-in-sdt_types.h.patch
@@ -0,0 +1,99 @@
+From 1f6968ee4620c253d5a38a32b0ef8689d9f61ea7 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:53:24 +0200
+Subject: [PATCH 09/12] Use the standard <stdint.h> types in sdt_types.h
+
+sdt_types.h describes the on-disk layout of the .probes section with
+__uint32_t and __uint64_t. Those are glibc's internal typedefs from
+<sys/types.h>; they are not standard and musl does not define them, so
+the header and its user tapsets.cxx both fail:
+
+ sdt_types.h:23:3: error: '__uint32_t' does not name a type
+
+Include <stdint.h> and spell the types uint32_t and uint64_t. They are
+the same types, so the layout is unchanged.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ sdt_types.h | 26 ++++++++++++++------------
+ tapsets.cxx | 8 ++++----
+ 2 files changed, 18 insertions(+), 16 deletions(-)
+
+diff --git a/sdt_types.h b/sdt_types.h
+index 171395b4..1667e367 100644
+--- a/sdt_types.h
++++ b/sdt_types.h
+@@ -6,6 +6,8 @@
+ #ifndef _SDT_TYPES_H
+ #define _SDT_TYPES_H 1
+
++#include <stdint.h>
++
+ #define UPROBE1_TYPE 0x31425250 /* "PRB1" (little-endian) */
+ #define UPROBE2_TYPE 0x32425055 /* "UPB2" */
+ #define UPROBE3_TYPE 0x33425055 /* "UPB3" */
+@@ -20,22 +22,22 @@ typedef enum
+
+ typedef struct
+ {
+- __uint32_t type_a;
+- __uint32_t type_b;
+- __uint64_t name;
+- __uint64_t arg;
++ uint32_t type_a;
++ uint32_t type_b;
++ uint64_t name;
++ uint64_t arg;
+ } stap_sdt_probe_entry_v1;
+
+ typedef struct
+ {
+- __uint32_t type_a;
+- __uint32_t type_b;
+- __uint64_t name;
+- __uint64_t provider;
+- __uint64_t arg_count;
+- __uint64_t arg_string;
+- __uint64_t pc;
+- __uint64_t semaphore;
++ uint32_t type_a;
++ uint32_t type_b;
++ uint64_t name;
++ uint64_t provider;
++ uint64_t arg_count;
++ uint64_t arg_string;
++ uint64_t pc;
++ uint64_t semaphore;
+ } stap_sdt_probe_entry_v2;
+
+ #endif /* _SDT_TYPES_H */
+diff --git a/tapsets.cxx b/tapsets.cxx
+index b72a680c..4334efc9 100644
+--- a/tapsets.cxx
++++ b/tapsets.cxx
+@@ -9607,12 +9607,12 @@ sdt_query::iterate_over_probe_entries()
+ // the sentinel.
+ if (sess.verbose > 5)
+ clog << _F("got unknown probe_type : 0x%x", probe_type) << endl;
+- probe_scn_offset += sizeof(__uint32_t);
++ probe_scn_offset += sizeof(uint32_t);
+ continue;
+ }
+- if ((long)pbe_v1 % sizeof(__uint64_t)) // we have
stap_sdt_probe_entry_v1.type_b
++ if ((long)pbe_v1 % sizeof(uint64_t)) // we have
stap_sdt_probe_entry_v1.type_b
+ {
+- pbe_v1 = (stap_sdt_probe_entry_v1*)((char*)pbe_v1 -
sizeof(__uint32_t));
++ pbe_v1 = (stap_sdt_probe_entry_v1*)((char*)pbe_v1 -
sizeof(uint32_t));
+ if (pbe_v1->type_b != uprobe1_type)
+ continue;
+ }
+@@ -9641,7 +9641,7 @@ sdt_query::iterate_over_probe_entries()
+ arg_string = (char*)((char*)pdata->d_buf + pbe_v2->arg_string -
(char*)probe_scn_addr);
+ // skip over pbe_v2, probe_name text and provider text
+ probe_scn_offset = ((long)(pbe_v2->name) - (long)(probe_scn_addr))
+ probe_name.length();
+- probe_scn_offset += sizeof (__uint32_t) - probe_scn_offset % sizeof
(__uint32_t);
++ probe_scn_offset += sizeof (uint32_t) - probe_scn_offset % sizeof
(uint32_t);
+ }
+ if (sess.verbose > 4)
+ clog << _("saw .probes ") << probe_name << (provider_name != "" ? _("
(provider ")+provider_name+") " : "")
diff --git
a/utils/systemtap/patches/0010-Tolerate-a-C-library-without-NI_IDN.patch
b/utils/systemtap/patches/0010-Tolerate-a-C-library-without-NI_IDN.patch
new file mode 100644
index 0000000..1704051
--- /dev/null
+++ b/utils/systemtap/patches/0010-Tolerate-a-C-library-without-NI_IDN.patch
@@ -0,0 +1,39 @@
+From 322e7ae824021797f8ee92b39490fce386cb71ed Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:53:42 +0200
+Subject: [PATCH 10/12] Tolerate a C library without NI_IDN
+
+nss-server-info.cxx passes NI_NAMEREQD|NI_IDN to getnameinfo() when
+resolving a compile server's host name. NI_IDN is a GNU extension and
+musl does not define it:
+
+ nss-server-info.cxx:1971:55: error: 'NI_IDN' was not declared in this scope
+
+Define it to 0 when absent. The lookup still works; an internationalised
+host name is just reported in its ACE ("xn--...") form rather than
+decoded to Unicode.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ nss-server-info.cxx | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/nss-server-info.cxx b/nss-server-info.cxx
+index 444773ef..1f1c62d4 100644
+--- a/nss-server-info.cxx
++++ b/nss-server-info.cxx
+@@ -41,6 +41,13 @@ extern "C" {
+ #include <pwd.h>
+ }
+
++// NI_IDN asks getnameinfo() to convert an internationalised host name to
++// its Unicode form. It is a GNU extension; where it is missing the name
++// is simply left in its IDN/ACE encoding.
++#ifndef NI_IDN
++#define NI_IDN 0
++#endif
++
+ #if HAVE_AVAHI
+ extern "C" {
+ #include <avahi-client/client.h>
diff --git
a/utils/systemtap/patches/0011-Use-the-POSIX-spellings-poll.h-and-fcntl.h.patch

b/utils/systemtap/patches/0011-Use-the-POSIX-spellings-poll.h-and-fcntl.h.patch
new file mode 100644
index 0000000..a539843
--- /dev/null
+++
b/utils/systemtap/patches/0011-Use-the-POSIX-spellings-poll.h-and-fcntl.h.patch
@@ -0,0 +1,56 @@
+From c47d49ef7e63046a6f60aefef5ff2eedeb3c2458 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:58:53 +0200
+Subject: [PATCH 11/12] Use the POSIX spellings <poll.h> and <fcntl.h>
+
+<sys/poll.h> and <sys/fcntl.h> are pre-POSIX spellings. musl keeps them
+only as compatibility shims that emit
+
+ #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
+
+which -Werror turns into a build failure -- for every staprun object
+file, and for stapbpf. The POSIX headers <poll.h> and <fcntl.h> have
+been the right spelling everywhere for decades, glibc included.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ stapbpf/stapbpf.cxx | 2 +-
+ staprun/staprun.h | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/stapbpf/stapbpf.cxx b/stapbpf/stapbpf.cxx
+index 4991c136..773b6693 100644
+--- a/stapbpf/stapbpf.cxx
++++ b/stapbpf/stapbpf.cxx
+@@ -34,7 +34,7 @@
+ #include <limits.h>
+ #include <inttypes.h>
+ #include <getopt.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <sys/syscall.h>
+diff --git a/staprun/staprun.h b/staprun/staprun.h
+index db24e1f2..bcf7ea75 100644
+--- a/staprun/staprun.h
++++ b/staprun/staprun.h
+@@ -30,7 +30,7 @@
+ #include <errno.h>
+ #include <linux/fd.h>
+ #include <sys/mman.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <pthread.h>
+ #include <sys/socket.h>
+ #include <linux/limits.h>
+@@ -234,7 +234,7 @@ int insert_module(const char *path, const char
*special_options,
+ privilege_t *user_credentials
+ );
+
+-int rename_module(void* module_file, const __off_t st_size);
++int rename_module(void* module_file, const off_t st_size);
+
+ int mountfs(void);
+ void start_symbol_thread(void);
diff --git
a/utils/systemtap/patches/0012-Use-off_t-rather-than-__off_t-in-staprun.patch
b/utils/systemtap/patches/0012-Use-off_t-rather-than-__off_t-in-staprun.patch
new file mode 100644
index 0000000..554642b
--- /dev/null
+++
b/utils/systemtap/patches/0012-Use-off_t-rather-than-__off_t-in-staprun.patch
@@ -0,0 +1,50 @@
+From 7c2a6f2cfa2112598ba89e76c9e8f9afe40d0ac2 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Sat, 19 Sep 2026 05:58:53 +0200
+Subject: [PATCH 12/12] Use off_t rather than __off_t in staprun
+
+__off_t is a glibc internal typedef. musl does not define it, so
+staprun.h and staprun_funcs.c fail to compile:
+
+ staprun/staprun.h:237:44: error: unknown type name '__off_t'
+
+off_t is the standard name for the same type, and stat.st_size -- the
+value every one of these parameters receives -- is already an off_t.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ staprun/staprun_funcs.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/staprun/staprun_funcs.c b/staprun/staprun_funcs.c
+index 8cc4acfe..d0d66468 100644
+--- a/staprun/staprun_funcs.c
++++ b/staprun/staprun_funcs.c
+@@ -207,7 +207,7 @@ int insert_module(
+ }
+
+ static Elf_Scn *
+-find_section_in_module(const void* module_file, const __off_t st_size,
const char *section_name)
++find_section_in_module(const void* module_file, const off_t st_size, const
char *section_name)
+ {
+ char *name;
+ size_t shstrndx;
+@@ -246,7 +246,7 @@ find_section_in_module(const void* module_file, const
__off_t st_size, const cha
+ }
+
+ int
+-rename_module(void* module_file, const __off_t st_size)
++rename_module(void* module_file, const off_t st_size)
+ {
+ int length_to_replace;
+ char newname[MODULE_NAME_LEN];
+@@ -585,7 +585,7 @@ check_uprobes_module_path (
+ static privilege_t get_module_required_credentials (
+ const char *module_path,
+ const void* module_file __attribute__ ((unused)),
+- const __off_t st_size __attribute__ ((unused))
++ const off_t st_size __attribute__ ((unused))
+ )
+ {
+ Elf_Scn *scn = 0;


  • [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (4d366440b80e371c052fb0958bd549e05c7542db), Ismael Luceno, 09/19/2026

Archive powered by MHonArc 2.6.24.

Top of Page