Page MenuHomeFreeBSD

D53500.id175184.diff
No OneTemporary

D53500.id175184.diff

diff --git a/share/man/man7/d.7 b/share/man/man7/d.7
--- a/share/man/man7/d.7
+++ b/share/man/man7/d.7
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.\" Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org>
+.\" Copyright (c) 2025-2026 Mateusz Piotrowski <0mp@FreeBSD.org>
.\"
.Dd October 28, 2025
.Dt D 7
@@ -198,9 +198,135 @@
Suitable for timestamping logs.
.El
.Sh BUILT-IN FUNCTIONS
+.Bl -tag -width indent
+.It Ft "string" Fn json "const char *json_string" "const char *key"
+Return the value of the given
+.Fa key
+from
+.Fa json_string .
+Return
+.Dv NULL
+if
+.Fa key
+does not exist.
+.Pp
+For example,
+.Bd -literal -compact -offset indent
+json("{\e"a\e": 1024}", "a");
+.Ed
+returns
+.Ql 1024 .
+.It Ft int Fn progenyof "pid_t pid"
+Return non-zero if
+the process associted with the specified
+.Fa pid
+is either the current thread itself
+or its progeny
+.Pq i.e., a child, grandchild, ... .
+Return zero otherwise.
+.Pp
+For example,
+.Bd -literal -compact -offset indent
+progenyof(ppid);
+.Ed
+returns non-zero as the current thread is always a child process of its parent
+process.
+.It Ft int Fn rand
+Return a pseudo-random integer.
+.Pp
+For example,
+.Bd -literal -compact -offset indent
+rand();
+.Ed
+returns
+.Ql 67
+once in a while.
+.It Ft int Fn speculation
+Allocate a new speculative trace buffer
+and return a unique speculation identifier for that buffer.
+.El
+.Ss Memory Functions
+.Bl -tag -width indent
+.It Ft "void *" Fn alloca "size_t nbytes"
+Allocate a scratch buffer of
+.Fa nbytes
+in size.
+.Pp
+For example:
+.Bd -literal -compact -offset indent
+this->s = (int *)alloca(sizeof (int));
+.Ed
+.It Ft "void" Fn bcopy "void *src" "void *dst" "size_t size"
+Copy
+.Fa size
+bytes
+from
+address
+.Fa src
+to address dst.
+The
+.Fa src Ap s
+and
+.Fa dst Ap s
+regions ranges may overlap.
+The
+.Fa dst Ap s
+region must be in the scratch region.
+.Pp
+For example,
+.Bd -literal -compact -offset indent
+this->s = (char *)alloca(2 * sizeof (char));
+this->d = (char *)alloca(sizeof (char));
+this->s[0] = 'A';
+this->s[1] = 'B';
+bcopy(this->s + 1, this->d, 1);
+printf("%c\en", *this->d);
+.Ed
+prints
+.Dq B .
+.It Ft "uintptr_t *" Fn memref "void *address" "size_t length"
+Create a memory reference in the scratch space for a memory buffer of a given
+.Fa address
+and
+.Fa length .
+This is a helper subroutine for
+.Fn printm .
+.It Ft "string" Fn memstr "void *" "char" "size_t"
+.El
+.Ss Network Functions
+.Bl -tag -width indent
+.It Ft "uint32_t" Fn htonl "uint32_t"
+.It Ft "uint64_t" Fn htonll "uint64_t"
+.It Ft "uint16_t" Fn htons "uint16_t"
+.It Ft "string" Fn inet_ntoa "in_addr_t * address"
+Return a dotted quad decimal representation of the provided
+IPv4
+.Fa address .
+.It Ft "string" Fn inet_ntoa6 "in6_addr *address"
+.It Ft "string" Fn inet_ntop "int" "void *"
+.El
+.Ss File Functions
+.Bl -tag -width indent
+.\" XXX(0mp): See https://www.illumos.org/issues/2916 for more details about getf().
+.It Ft "file_t *" Fn getf "int fd"
+Return a
+.Ft "file_t *"
+to the file descriptor of the current thread.
+The underlying
+.Ft file_t
+structure
+will not freed until it is no longer in use by the probe.
+.It Ft "string" Fn basename "const char *"
+.It Ft "string" Fn cleanpath "const char *"
+.It Ft "string" Fn dirname "const char *"
+.El
+.Ss String Functions
.\" Keep the indentation wide enough for the reader to be able to skim through
.\" function names quickly.
.Bl -tag -width "size_t strlen"
+.It Ft "int" Fn index "const char *" "const char *" "[int]"
+.It Ft "string" Fn lltostr "int64_t" "[int]"
+.It Ft "int" Fn rindex "const char *" "const char *" "[int]"
.It Ft string Fn strchr "string s" "char c"
Return a substring of
.Fa s
@@ -321,6 +447,9 @@
substr("abcd", 99)
.Ed
returns an empty string.
+.It Ft int64_t Fn strtoll "const char *" "[int]"
+.It Ft string Fn tolower "const char *"
+.It Ft string Fn toupper "const char *"
.El
.Ss Aggregation Functions
.Bl -tag -compact -width "llquantize(value, factor, low, high, nsteps)"
@@ -343,6 +472,14 @@
.It Fn sum value
Sum
.El
+.Ss Kernel Copy Functions
+.Bl -tag -width indent
+.It Ft "void *" Fn copyin "uintptr_t" "size_t"
+.It Ft "string" Fn copyinstr "uintptr_t" "[size_t]"
+.It Ft "void" Fn copyintro "uintptr_t" "size_t" "void *"
+.It Ft "void" Fn copyout "void *" "uintptr_t" "size_t"
+.It Ft "void" Fn copyoutstr "char *" "uintptr_t" "size_t"
+.El
.Ss Kernel Destructive Functions
By default,
.Xr dtrace 1
@@ -359,6 +496,24 @@
.It Fn panic
Panic the kernel.
.El
+.Ss Kernel Synchronization Functions
+The following functions are related to
+.Xr locking 9
+in the
+.Fx
+kernel:
+.Bl -tag -width indent
+.It Ft intmtx_str Fn mutex_owned
+.It Ft threadmtx_str Fn mutex_owner
+.It Ft intmtx_str Fn mutex_type_adaptive
+.It Ft intmtx_str Fn mutex_type_spin
+.It Ft rwlock_str Fn rw_iswriter
+.It Ft rwlock_str Fn rw_read_held
+.It Ft rwlock_str Fn rw_write_held
+.It Ft sxlock_str Fn sx_isexclusive
+.It Ft sxlock_str Fn sx_shared_held
+.It Ft sxlock_str Fn sx_exclusive_held
+.El
.Sh FILES
.Bl -tag -width /usr/share/dtrace
.It Pa /usr/share/dtrace
@@ -411,3 +566,11 @@
not supported on
.Fx
at the moment.
+.Pp
+Functions
+.\" Device functions
+.Fn ddi_pathname ,
+.Fn getmajor ,
+and
+.Fn getminor
+are currently not supported on FreeBSD.

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 19, 8:09 AM (14 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35227237
Default Alt Text
D53500.id175184.diff (5 KB)

Event Timeline