sh Provider
The sh provider makes available probes that can be used to observe the behaviour of bourne shell scripts.
The sh provider makes available the following probes:
builtin-entry | Probe that fires on entry to a shell builtin command. |
builtin-return | Probe that fires on return from a shell builtin command. |
command-entry | Probe that fires when the shell execs an external command. |
command-return | Probe that fires on return from an external command. |
function-entry | Probe that fires on entry into a shell function. |
function-return | Probe that fires on return from a shell function. |
line | Probe that fires before commands on a particular line of code are executed. |
subshell-entry | Probe that fires when the shell forks a subshell. |
subshell-return | Probe that fires on return from a forked subshell. |
script-start | Probe that fires before any commands in a script are executed. |
script-done | Probe that fires on script exit. |
The argument types to the sh provider are listed in the below table.
| Probe | args[0] | args[1] | args[2] | args[3] | args[4] |
|---|---|---|---|---|---|
| builtin-entry, command-entry, function-entry | char * | char * | int | int | char ** |
| builtin-return, command-return, function-return | char * | char * | int | ||
| line | char * | int | |||
| script-start | char * | ||||
| script-done | char * | int | |||
| subshell-entry | char * | pid_t | |||
| subshell-return | char * | 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.
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.
| Element | Name Class | Data Class | Dependancy Class | |
|---|---|---|---|---|
| Provider | Unstable | Unstable | Common | |
| Module | Private | Private | Unknown | |
| Function | Private | Private | Unknown | |
| Name | Unstable | Unstable | Common | |
| Arguments | Unstable | Unstable | Common |