1# -*- tab-width: 4 -*- ;; Emacs 2# vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM 3############################################################ IDENT(1) 4# 5# $Title: dwatch(8) module for syscall errno logging $ 6# $Copyright: 2014-2026 Devin Teske. All rights reserved. $ 7# 8############################################################ DESCRIPTION 9# 10# Print when syscall returns with non-zero errno (default) or other condition. 11# To override the default test condition, use (for example) `-t errno==2' to 12# test for specific value or simply `-t 1' to unconditionally show all values. 13# 14# When invoked as errno-NAME, only syscalls returning that errno are shown, 15# where NAME is either a symbolic name from errno.d of libdtrace(1) or a 16# number; e.g., errno-ENOENT for failed pathname lookups, errno-EACCES or 17# errno-EPERM for permission problems, and errno-ENOTCAPABLE or 18# errno-ECAPMODE for capsicum(4) capability-mode violations. Links are 19# installed for the aforementioned; others need only a new link to this 20# module (e.g., `ln -s errno errno-EDEADLK'). 21# 22############################################################ PROBE 23 24: ${PROBE:=syscall:::return} 25 26############################################################ EVENT ACTION 27 28[ "$CUSTOM_TEST" ] || case "$PROFILE" in 29errno) EVENT_TEST="errno > 0" ;; 30 *) EVENT_TEST="errno == ${PROFILE#errno-}" 31esac 32 33############################################################ EVENT DETAILS 34 35if [ ! "$CUSTOM_DETAILS" ]; then 36exec 9<<EOF 37 /* 38 * Print errno details 39 */ 40 printf("%s: %s (%i)", probefunc, strerror[errno], errno); 41EOF 42EVENT_DETAILS=$( cat <&9 ) 43fi 44 45################################################################################ 46# END 47################################################################################ 48