19982009 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. erl_global Gordon Beaton Gordon Beaton Gordon Beaton Gordon Beaton 980703 A erl_global.sgml
erl_global Access globally registered names

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.

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.

char **erl_global_names(fd,count) Obtain list of Global names int fd; int *count;

Retrieve a list of all known global names.

is an open descriptor to an Erlang connection.

is the address of an integer, or NULL. If is not NULL, it will be set by the function to the number of names found.

On success, the function returns an array of strings, each containing a single registered name, and sets to the number of names found. The array is terminated by a single NULL pointer. On failure, the function returns NULL and is not modified.

It is the caller's responsibility to free the array afterwards. It has been allocated by the function with a single call to , so a single is all that is necessary.

interl_global_register(fd,name,pid) Register a name in Global int fd; const char *name; ETERM *pid;

This function registers a name in Global.

is an open descriptor to an Erlang connection.

is the name to register in Global.

is the pid that should be associated with . This is the value that Global will return when processes request the location of .

The function returns 0 on success, or -1 on failure.

interl_global_unregister(fd,name) Unregister a name in Global int fd; const char *name;

This function unregisters a name from Global.

is an open descriptor to an Erlang connection.

is the name to unregister from Global.

The function returns 0 on success, or -1 on failure.

ETERM *erl_global_whereis(fd,name,node) Look up a name in global int fd; const char *name; char *node;

is an open descriptor to an Erlang connection.

is the name that is to be looked up in Global.

If is not NULL, it is a pointer to a buffer where the function can fill in the name of the node where is found. can be passed directly to if necessary.

On success, the function returns an Erlang Pid containing the address of the given name, and node will be initialized to the nodename where is found. On failure NULL will be returned and will not be modified.