OpenSolaris

sh Provider

The sh provider makes available probes that can be used to observe the behaviour of bourne shell scripts.

Overview

The sh provider makes available the following probes:


builtin-entryProbe that fires on entry to a shell builtin command.
builtin-returnProbe that fires on return from a shell builtin command.

command-entryProbe that fires when the shell execs an external command.
command-returnProbe that fires on return from an external command.

function-entryProbe that fires on entry into a shell function.
function-returnProbe that fires on return from a shell function.

lineProbe that fires before commands on a particular line of code are executed.

subshell-entryProbe that fires when the shell forks a subshell.
subshell-returnProbe that fires on return from a forked subshell.

script-startProbe that fires before any commands in a script are executed.
script-doneProbe that fires on script exit.

Arguments

The argument types to the sh provider are listed in the below table.


Probeargs[0]args[1]args[2]args[3]args[4]

builtin-entry,
command-entry,
function-entry
char *char *intintchar **

builtin-return,
command-return,
function-return
char *char *int

linechar *int

script-startchar *

script-donechar *int

subshell-entrychar *pid_t
subshell-returnchar *int

arg0 in all probes is the script name.

In the builtin, exec, and function entry and return probes, arg1 is the name of the function, builtin or program being called. In the entry probes, arg2 is the line number and and arg3 & arg4 are the argument count and a pointer to the argument list. In these return probes, arg2 is the return code from the function, builtin or program.

In the subshell-entry, arg1 is the pid of the forked subshell and in subshell-return probes, arg1 is the return code from the subshell.

In the line probe, arg1 is the line number.

In the script-done probe, arg1 is the exit code of the script.

Stability

The sh provider uses DTrace's stability mechanism to describe its stabilities, as shown in the following table. For more information on the stability mechanism see Chapter 39 of the Solaris Dynamic Tracing guide.

ElementName ClassData ClassDependancy Class
ProviderUnstableUnstableCommon
ModulePrivatePrivateUnknown
FunctionPrivatePrivateUnknown
NameUnstableUnstableCommon
ArgumentsUnstableUnstableCommon