ham_action_fail_execute()
Add an execute action to an action, which executes if the corresponding action fails
Synopsis:
#include <ha/ham.h> int ham_action_fail_execute( ham_action_t *ahdl, const char *aname, const char *path, unsigned flags);
Arguments:
- ahdl
- The HAM action handle.
- aname
- The action fail item to add to the action handle.
- path
- The FULL path to the executable along with all parameters to be passed to it.
- flags
- Currently not used.
Library:
libham
Description:
The ham_action_fail_execute() function adds an action-fail item (aname) to the specified action. The action will execute an external program or command specified by path. The path parameter must contain the FULL path to the executable along with all parameters to be passed to it. If either the pathname or the arguments contain spaces that need to be passed on literally to the spawn call, then they need to be quoted.
As long as the subcomponents within the path arguments are quoted, using either of the following methods:
\'path with space\'
or \"path with space\"
the following is allowed:
"\'path with space\' arg1 arg2 \"arg3 with space\""
This would be parsed as:
"path with space" -> path
arg1 = arg1
arg2 = arg2
arg3 = "arg3 with space"
The command line is in turn passed onto a spawn() command by the HAM to create a new process that will execute the command.
The handle (ahdl) is obtained either:
-
from one of the ham_action*() functions to add actions
or:
- by calling any of the ham_action_handle() functions to request a handle to a specific action.
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EBADF
- Couldn't connect to the HAM.
- EEXIST
- The aname name already exists for the specified ahdl action.
- EINVAL
-
The name given in aname is invalid (e.g., it contains
the
character) or is NULL./
- ENAMETOOLONG
-
The name given (in aname) is too long (i.e., it exceeds
_POSIX_PATH_MAX, defined in <limits.h>).
Note:The combined name length of an entity, condition, or action is also limited by _POSIX_PATH_MAX.
- ENOENT
- There's no entity or condition specified by the given handle (ahdl).
- ENOMEM
- Not enough memory to create a new handle.
In addition to the above errors, the HAM returns any error it encounters while servicing this request.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | Yes |