> This seems to me to be a fundamentally broken, hence short-lived > workaround. I think we need another way. As you mention upthread, > we document that system-header types such as ssize_t should not be > used in probes.d because "they cause compilation errors on macOS". > But I tried it just now and it compiles fine on current Tahoe. > Maybe that note is obsolete?
Agreed that "long" was only papering over SystemTap's parser. v2 uses the real call-site types instead: ``` probe smgr__md__read__done(..., int, ssize_t, size_t); probe smgr__md__write__done(..., int, ssize_t, size_t); ``` nbytes is ssize_t (and can be negative: we fire the probe before the nbytes < 0 check). The "bytes requested" argument is size_this_segment - transferred_this_segment, which is size_t. ssize_t, ssize_t would also silence SystemTap, but wouldn't match md.c. On the probes.d note: it originally named Mac OS X 10.5 (e04810e8c4). The concrete complaints from that era were about uintptr_t / uint32_t and about needing #define rather than typedef for our PG aliases (Robert Lor). da6c4f6ca88 only rebranded the wording to "macOS 10.5"; later ff43b3e88ec dropped the "10.5" while touching the nearby bool #define, without re-checking the restriction. ssize_t and size_t, by contrast, are first-class types in Apple's DTrace typedef tables. Your Tahoe result fits that; I don't have a Mac here to re-check myself. I've revised the note to warn against multi-word types like "long long int" (what SystemTap rejects) rather than blanket-banning system typedefs. Verified on Fedora 43 / systemtap-sdt-devel: unpatched probes.d still gets the pyparsing fallback warning; with ssize_t, size_t both dtrace -C -h and meson probes.h generation are clean, as is a full configure --enable-dtrace build. --- Regards, Rachitskiy Andrey ср, 29 июл. 2026 г. в 09:14, Tom Lane <[email protected]>: > Andrey Rachitskiy <[email protected]> writes: > > Hi, Laurenz! > > Thanks for the report. I tried to fix the patch in the attachment. > > BF animals caiman, midge, tayra, timberworm are all complaining about > this. In keeping with meson's general habit of verbose yet largely > useless configuration reporting, it's impossible to tell exactly what > OS versions those are running, though their possibly-outdated BF > metadata claims recent Red Hat versions. However, I also reproduced > the warning with an autoconf build on current Fedora 43 / x86_64. > > > Commits ca326e903d and 1f8c504e308 widened the byte-count arguments of > > smgr__md__read__done and smgr__md__write__done to "long long int". > > SystemTap's dtrace(1) pyparsing grammar rejects that multi-word type and > > falls back with a warning (misreported near the previous probe). Use > > "long" instead, which matches ssize_t on our LP64 DTrace platforms and > > is already used elsewhere in probes.d. > > This seems to me to be a fundamentally broken, hence short-lived > workaround. I think we need another way. As you mention upthread, > we document that system-header types such as ssize_t should not be > used in probes.d because "they cause compilation errors on macOS". > But I tried it just now and it compiles fine on current Tahoe. > Maybe that note is obsolete? > > regards, tom lane >
From 9ae90aed9b1df0fb8ac044a715aacc917a05482a Mon Sep 17 00:00:00 2001 From: Andrey Rachitskiy <[email protected]> Date: Wed, 29 Jul 2026 12:32:49 +0500 Subject: [PATCH] Fix SystemTap dtrace warning for smgr probe argument types Commits ca326e903d and 1f8c504e308 widened the byte-count arguments of smgr__md__read__done and smgr__md__write__done to "long long int". SystemTap's dtrace(1) pyparsing grammar rejects that multi-word type and falls back with a warning (misreported near the previous probe). Use ssize_t and size_t instead, matching the md.c call sites. Revise the probes.d note: avoid multi-word types for SystemTap, and drop the old blanket ban on system typedefs that appears obsolete on current macOS. Author: Andrey Rachitskiy <[email protected]> Reported-by: Laurenz Albe <[email protected]> Discussion: https://postgr.es/m/[email protected] --- doc/src/sgml/monitoring.sgml | 4 ++-- src/backend/utils/probes.d | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 074a821a68e..0c7107d400b 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -8595,7 +8595,7 @@ FROM pg_stat_get_backend_idset() AS backendid; </row> <row> <entry><literal>smgr-md-read-done</literal></entry> - <entry><literal>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int, int)</literal></entry> + <entry><literal>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, ssize_t, size_t)</literal></entry> <entry>Probe that fires when a block read is complete. arg0 and arg1 contain the fork and block numbers of the page. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs @@ -8617,7 +8617,7 @@ FROM pg_stat_get_backend_idset() AS backendid; </row> <row> <entry><literal>smgr-md-write-done</literal></entry> - <entry><literal>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, int, int)</literal></entry> + <entry><literal>(ForkNumber, BlockNumber, Oid, Oid, Oid, int, ssize_t, size_t)</literal></entry> <entry>Probe that fires when a block write is complete. arg0 and arg1 contain the fork and block numbers of the page. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs diff --git a/src/backend/utils/probes.d b/src/backend/utils/probes.d index 2d8f12cbe30..c69803db438 100644 --- a/src/backend/utils/probes.d +++ b/src/backend/utils/probes.d @@ -11,8 +11,12 @@ /* * Typedefs used in PostgreSQL probes. * - * NOTE: Do not use system-provided typedefs (e.g. uintptr_t, uint32_t, etc) - * in probe definitions, as they cause compilation errors on macOS. + * NOTE: Avoid multi-word C types such as "long long" / "long long int" in + * probe definitions; SystemTap's dtrace(1) pyparsing grammar rejects them + * and falls back with a warning. Prefer single-token types, including + * system typedefs such as ssize_t and size_t when those match the C + * call sites. (An older restriction against all system typedefs on + * macOS appears obsolete on current releases.) */ #define LocalTransactionId unsigned int #define LWLockMode int @@ -83,9 +87,9 @@ provider postgresql { probe twophase__checkpoint__done(); probe smgr__md__read__start(ForkNumber, BlockNumber, Oid, Oid, Oid, int); - probe smgr__md__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, long long int, long long int); + probe smgr__md__read__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, ssize_t, size_t); probe smgr__md__write__start(ForkNumber, BlockNumber, Oid, Oid, Oid, int); - probe smgr__md__write__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, long long int, long long int); + probe smgr__md__write__done(ForkNumber, BlockNumber, Oid, Oid, Oid, int, ssize_t, size_t); probe wal__insert(unsigned char, unsigned char); probe wal__switch(); -- 2.53.0
