.TH erl_global 3erl "erl_interface 3.7.18" "Ericsson AB" "C Library Functions" .SH NAME erl_global \- Access globally registered names .SH DESCRIPTION .LP This module provides support for registering, looking up and unregistering names in the Erlang Global module\&. For more information, see the description of Global in the reference manual\&. .LP Note that the functions below perform an RPC using an open file descriptor provided by the caller\&. This file descriptor must not be used for other traffic during the global operation or the function may receive unexpected data and fail\&. .SH EXPORTS .LP .B char **erl_global_names(fd,count) .br .RS .LP Types: .RS 3 int fd; .br int *count; .br .RE .RE .RS .LP Retrieve a list of all known global names\&. .LP \fIfd\fR\& is an open descriptor to an Erlang connection\&. .LP \fIcount\fR\& is the address of an integer, or NULL\&. If \fIcount\fR\& is not NULL, it will be set by the function to the number of names found\&. .LP On success, the function returns an array of strings, each containing a single registered name, and sets \fIcount\fR\& to the number of names found\&. The array is terminated by a single NULL pointer\&. On failure, the function returns NULL and \fIcount\fR\& is not modified\&. .LP .RS -4 .B Note: .RE It is the caller\&'s responsibility to free the array afterwards\&. It has been allocated by the function with a single call to \fImalloc()\fR\&, so a single \fIfree()\fR\& is all that is necessary\&. .RE .LP .B int erl_global_register(fd,name,pid) .br .RS .LP Types: .RS 3 int fd; .br const char *name; .br ETERM *pid; .br .RE .RE .RS .LP This function registers a name in Global\&. .LP \fIfd\fR\& is an open descriptor to an Erlang connection\&. .LP \fIname\fR\& is the name to register in Global\&. .LP \fIpid\fR\& is the pid that should be associated with \fIname\fR\&\&. This is the value that Global will return when processes request the location of \fIname\fR\&\&. .LP The function returns 0 on success, or -1 on failure\&. .RE .LP .B int erl_global_unregister(fd,name) .br .RS .LP Types: .RS 3 int fd; .br const char *name; .br .RE .RE .RS .LP This function unregisters a name from Global\&. .LP \fIfd\fR\& is an open descriptor to an Erlang connection\&. .LP \fIname\fR\& is the name to unregister from Global\&. .LP The function returns 0 on success, or -1 on failure\&. .RE .LP .B ETERM *erl_global_whereis(fd,name,node) .br .RS .LP Types: .RS 3 int fd; .br const char *name; .br char *node; .br .RE .RE .RS .LP \fIfd\fR\& is an open descriptor to an Erlang connection\&. .LP \fIname\fR\& is the name that is to be looked up in Global\&. .LP If \fInode\fR\& is not NULL, it is a pointer to a buffer where the function can fill in the name of the node where \fIname\fR\& is found\&. \fInode\fR\& can be passed directly to \fIerl_connect()\fR\& if necessary\&. .LP On success, the function returns an Erlang Pid containing the address of the given name, and node will be initialized to the nodename where \fIname\fR\& is found\&. On failure NULL will be returned and \fInode\fR\& will not be modified\&. .RE