]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix SystemTap dtrace warning about smgr probe argument types. master github/master
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 30 Jul 2026 00:25:54 +0000 (20:25 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 30 Jul 2026 00:25:54 +0000 (20:25 -0400)
Commits ca326e903 and 1f8c504e3 widened the byte-count arguments of
smgr__md__read__done and smgr__md__write__done to "long long int".
SystemTap's dtrace(1) fails on that specific spelling 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 probes.d's note about which types are usable as probe
arguments: recommend using system-supplied type names (macOS dtrace
rejects names like PostgreSQL's uint64), and call out "long long int"
as a known SystemTap failure case rather than a wider failure mode.

Also, update the monitoring.sgml entries for these probes,
which were missed by the prior commits.

Reported-by: Laurenz Albe <laurenz.albe@cybertec.at>
Author: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/697d3c88568442cd637d8453d129f1bb14bbd2a8.camel@cybertec.at

doc/src/sgml/monitoring.sgml
src/backend/utils/probes.d

index a209e891b181ac23f719304b5e5d362982eaf871..f1422826d2960ed0e9c2397dc1108a47361187a5 100644 (file)
@@ -8745,7 +8745,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
@@ -8767,7 +8767,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
index 2d8f12cbe30b2fb1d37cbf5d5e6b3eb1abcaecc0..f70577b38f28b51442f55e0390f831eec6ede289 100644 (file)
 /*
  * 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: Prefer system-supplied type names in probe definitions (e.g.
+ * uint64_t, not PostgreSQL's uint64); macOS' dtrace rejects the latter.
+ * Also avoid "long long int", as SystemTap's dtrace(1) fails on that
+ * specific spelling.
+ *
+ * But we can use some PG type aliases by #define'ing them here so that
+ * cpp expands them before dtrace sees the file.  Curiously, macOS' dtrace
+ * rejects "bool", so we handle that with a #define too.
  */
 #define LocalTransactionId unsigned int
 #define LWLockMode int
@@ -83,9 +89,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();