| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) | 
Attach an entity
#include <ha/ham.h>
ham_entity_t *ham_attach( const char *ename, 
                          int nd,
                          pid_t pid,  
                          const char *line, 
                          unsigned flags );
ham_entity_t *ham_attach_node( const char *ename, 
                          const char *nodename, 
                          pid_t pid,  
                          const char *line, 
                          unsigned flags );
libham
You use the ham_attach() function to attach an entity to the HAM. The ham_attach_node() function is used when a nodename is used to specify a remote HAM instead of a node identifier (nd). An entity can be any process on the system. You can use this function to:
or:
Once an entity has been attached, you can add conditions and actions to it. For arbitrary processes, the HAM can monitor either:
or:
|  | Since the ham_attach*() functions open a connection to the HAM, for convenience they also perform the initial ham_connect() call. So any client that makes a ham_attach() call doesn't need to call ham_connect() or ham_disconnect() before and after the call to ham_attach(). | 
The arguments are as follows:
|  | Since node identifiers are transient objects, you should obtain the value for nd immediately before the call, using netmgr_strtond() or another function that converts nodenames into node identifiers. | 
\'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".
A valid handle to an entity on success; otherwise, NULL (errno is set).
The pid provided is ≤ 0, but no line was provided.
In addition to the above errors, the HAM returns any error it encounters while servicing the request to add a new entity to its context.
| Safety: | |
|---|---|
| Cancellation point | No | 
| Interrupt handler | Yes | 
| Signal handler | Yes | 
| Thread | Yes | 
ham_attach(), ham_connect(), ham_detach(), ham_detach_self(), ham_disconnect()
procmgr_daemon() in the QNX Neutrino Library Reference
| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) |