ham_disconnect, ham_disconnect_nd, ham_disconnect_node
![]() |
![]() |
![]() |
![]() |
ham_disconnect(), ham_disconnect_nd(), ham_disconnect_node()
Disconnect from the HAM
Synopsis:
#include <ha/ham.h> int ham_disconnect( unsigned flags); int ham_disconnect_nd( int nd, unsigned flags); int ham_disconnect_node( const char *nodename, unsigned flags);
Library:
libham
Description:
The ham_disconnect() function closes a previously open connection to a HAM. The ham_disconnect_nd() and ham_disconnect_node() functions close previously opened connections to remote HAMs.
The nd specified to ham_disconnect_nd is the node identifier of the remote node at the time the ham_disconnect_nd() call is made.
![]() |
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. |
The ham_disconnect_node() function takes as a parameter a fully qualified node name (FQNN).
Because the library maintains a reference count, the actual connection to the HAM is released only when the number of calls made to ham_disconnect() matches the number of calls previously made to ham_connect().
When a process calls ham_connect() and then calls fork(), the connection is no longer valid in the child process. To reconnect to the HAM, the child process must call either:
- ham_connect()
directly, which will automatically close the existing connection
and reopen a new one
or:
- ham_disconnect(), followed by ham_connect().
There are no flags defined at this time.
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EINVAL
- There's no valid connection to the HAM to disconnect.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
See also:
ham_attach_self(), ham_connect(), ham_connect_nd(), ham_connect_node(), ham_stop()
In the Library Reference: fork()
![]() |
![]() |
![]() |
![]() |
![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
