aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/linux/zfs
diff options
context:
space:
mode:
authorRob Norris <[email protected]>2024-05-10 13:58:26 +1000
committerBrian Behlendorf <[email protected]>2024-05-14 09:49:00 -0700
commit3c941d18183455138f7c5dcc212177bd3cea8afc (patch)
treec53a01b7b96915f25a4bb3b0c53a620bffd9c70f /module/os/linux/zfs
parentfa99d9cd9cbc6aca3245afcfe321b8226985597d (diff)
zdb/ztest: send dbgmsg output to stderr
And, make the output fd an arg to zfs_dbgmsg_print(). This is a change in behaviour, but keeps it consistent with where crash traces go, and it's easy to argue this is what we want anyway; this is information about the task, not the actual output of the task. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #16181
Diffstat (limited to 'module/os/linux/zfs')
-rw-r--r--module/os/linux/zfs/zfs_debug.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/module/os/linux/zfs/zfs_debug.c b/module/os/linux/zfs/zfs_debug.c
index bc5c028dc..9ee40771f 100644
--- a/module/os/linux/zfs/zfs_debug.c
+++ b/module/os/linux/zfs/zfs_debug.c
@@ -221,7 +221,7 @@ __dprintf(boolean_t dprint, const char *file, const char *func,
#else
void
-zfs_dbgmsg_print(const char *tag)
+zfs_dbgmsg_print(int fd, const char *tag)
{
ssize_t ret __attribute__((unused));
@@ -231,20 +231,19 @@ zfs_dbgmsg_print(const char *tag)
* We use write() in this function instead of printf()
* so it is safe to call from a signal handler.
*/
- ret = write(STDOUT_FILENO, "ZFS_DBGMSG(", 11);
- ret = write(STDOUT_FILENO, tag, strlen(tag));
- ret = write(STDOUT_FILENO, ") START:\n", 9);
+ ret = write(fd, "ZFS_DBGMSG(", 11);
+ ret = write(fd, tag, strlen(tag));
+ ret = write(fd, ") START:\n", 9);
for (zfs_dbgmsg_t *zdm = list_head(&zfs_dbgmsgs.pl_list); zdm != NULL;
zdm = list_next(&zfs_dbgmsgs.pl_list, zdm)) {
- ret = write(STDOUT_FILENO, zdm->zdm_msg,
- strlen(zdm->zdm_msg));
- ret = write(STDOUT_FILENO, "\n", 1);
+ ret = write(fd, zdm->zdm_msg, strlen(zdm->zdm_msg));
+ ret = write(fd, "\n", 1);
}
- ret = write(STDOUT_FILENO, "ZFS_DBGMSG(", 11);
- ret = write(STDOUT_FILENO, tag, strlen(tag));
- ret = write(STDOUT_FILENO, ") END\n", 6);
+ ret = write(fd, "ZFS_DBGMSG(", 11);
+ ret = write(fd, tag, strlen(tag));
+ ret = write(fd, ") END\n", 6);
mutex_exit(&zfs_dbgmsgs.pl_lock);
}