errno revision 333617
1218885Sdim# -*- tab-width: 4 -*- ;; Emacs 2218885Sdim# vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM 3218885Sdim############################################################ IDENT(1) 4218885Sdim# 5218885Sdim# $Title: dwatch(8) module for syscall errno logging $ 6218885Sdim# $Copyright: 2014-2018 Devin Teske. All rights reserved. $ 7218885Sdim# $FreeBSD: stable/11/cddl/usr.sbin/dwatch/libexec/errno 333617 2018-05-15 00:00:44Z dteske $ 8218885Sdim# 9218885Sdim############################################################ DESCRIPTION 10218885Sdim# 11218885Sdim# Print when syscall returns with non-zero errno (default) or other condition. 12218885Sdim# To override the default test condition, use (for example) `-t errno==2' to 13218885Sdim# test for specific value or simply `-t 1' to unconditionally show all values. 14218885Sdim# 15218885Sdim############################################################ PROBE 16218885Sdim 17218885Sdim: ${PROBE:=syscall:::return} 18218885Sdim 19221345Sdim############################################################ EVENT ACTION 20218885Sdim 21234353Sdim[ "$CUSTOM_TEST" ] || EVENT_TEST="errno > 0" 22218885Sdim 23218885Sdim############################################################ EVENT DETAILS 24218885Sdim 25218885Sdimif [ ! "$CUSTOM_DETAILS" ]; then 26218885Sdimexec 9<<EOF 27218885Sdim /* 28218885Sdim * Print errno details 29218885Sdim */ 30218885Sdim printf("%s: %s (%i)", probefunc, strerror[errno], errno); 31218885SdimEOF 32218885SdimEVENT_DETAILS=$( cat <&9 ) 33218885Sdimfi 34221345Sdim 35221345Sdim################################################################################ 36221345Sdim# END 37218885Sdim################################################################################ 38218885Sdim