Erlang -- ei_global

Erl_Interface

Reference Manual

Version 4.0

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- ei
  - Top of manual page
  - ei_cmp_pids()
  - ei_cmp_ports()
  - ei_cmp_refs()
  - ei_decode_atom()
  - ei_decode_atom_as()
  - ei_decode_bignum()
  - ei_decode_binary()
  - ei_decode_bitstring()
  - ei_decode_boolean()
  - ei_decode_char()
  - ei_decode_double()
  - ei_decode_ei_term()
  - ei_decode_fun()
  - ei_decode_iodata()
  - ei_decode_list_header()
  - ei_decode_long()
  - ei_decode_longlong()
  - ei_decode_map_header()
  - ei_decode_pid()
  - ei_decode_port()
  - ei_decode_ref()
  - ei_decode_string()
  - ei_decode_trace()
  - ei_decode_tuple_header()
  - ei_decode_ulong()
  - ei_decode_ulonglong()
  - ei_decode_version()
  - ei_encode_atom()
  - ei_encode_atom_as()
  - ei_encode_atom_len()
  - ei_encode_atom_len_as()
  - ei_encode_bignum()
  - ei_encode_binary()
  - ei_encode_bitstring()
  - ei_encode_boolean()
  - ei_encode_char()
  - ei_encode_double()
  - ei_encode_empty_list()
  - ei_encode_fun()
  - ei_encode_list_header()
  - ei_encode_long()
  - ei_encode_longlong()
  - ei_encode_map_header()
  - ei_encode_pid()
  - ei_encode_port()
  - ei_encode_ref()
  - ei_encode_string()
  - ei_encode_string_len()
  - ei_encode_trace()
  - ei_encode_tuple_header()
  - ei_encode_ulong()
  - ei_encode_ulonglong()
  - ei_encode_version()
  - ei_get_type()
  - ei_init()
  - ei_print_term()
  - ei_s_print_term()
  - ei_set_compat_rel()
  - ei_skip_term()
  - ei_x_append()
  - ei_x_append_buf()
  - ei_x_encode_atom()
  - ei_x_encode_atom_as()
  - ei_x_encode_atom_len()
  - ei_x_encode_atom_len_as()
  - ei_x_encode_bignum()
  - ei_x_encode_binary()
  - ei_x_encode_bitstring()
  - ei_x_encode_boolean()
  - ei_x_encode_char()
  - ei_x_encode_double()
  - ei_x_encode_empty_list()
  - ei_x_encode_fun()
  - ei_x_encode_list_header()
  - ei_x_encode_long()
  - ei_x_encode_longlong()
  - ei_x_encode_map_header()
  - ei_x_encode_pid()
  - ei_x_encode_port()
  - ei_x_encode_ref()
  - ei_x_encode_string()
  - ei_x_encode_string_len()
  - ei_x_encode_trace()
  - ei_x_encode_tuple_header()
  - ei_x_encode_ulong()
  - ei_x_encode_ulonglong()
  - ei_x_encode_version()
  - ei_x_format()
  - ei_x_format_wo_ver()
  - ei_x_free()
  - ei_x_new()
  - ei_x_new_with_version()
  - free_fun()
- ei_connect
  - Top of manual page
  - ei_accept()
  - ei_accept_tmo()
  - ei_close_connection()
  - ei_connect()
  - ei_connect_host_port()
  - ei_connect_host_port_tmo()
  - ei_connect_init()
  - ei_connect_init_ussi()
  - ei_connect_tmo()
  - ei_connect_xinit()
  - ei_connect_xinit_ussi()
  - ei_get_tracelevel()
  - ei_gethostbyaddr()
  - ei_gethostbyaddr_r()
  - ei_gethostbyname()
  - ei_gethostbyname_r()
  - ei_listen()
  - ei_make_pid()
  - ei_make_ref()
  - ei_publish()
  - ei_publish_tmo()
  - ei_receive()
  - ei_receive_encoded()
  - ei_receive_encoded_tmo()
  - ei_receive_msg()
  - ei_receive_msg_tmo()
  - ei_receive_tmo()
  - ei_reg_send()
  - ei_reg_send_tmo()
  - ei_rpc()
  - ei_rpc_from()
  - ei_rpc_to()
  - ei_self()
  - ei_send()
  - ei_send_encoded()
  - ei_send_encoded_tmo()
  - ei_send_reg_encoded()
  - ei_send_reg_encoded_tmo()
  - ei_send_tmo()
  - ei_set_tracelevel()
  - ei_thisalivename()
  - ei_thishostname()
  - ei_thisnodename()
  - ei_unpublish()
  - ei_unpublish_tmo()
  - ei_xconnect()
  - ei_xconnect_host_port()
  - ei_xconnect_host_port_tmo()
  - ei_xconnect_tmo()
  - ei_xlisten()
  - ei_xreceive_msg()
  - ei_xreceive_msg_tmo()
- registry
  - Top of manual page
  - ei_reg_close()
  - ei_reg_delete()
  - ei_reg_dump()
  - ei_reg_getfval()
  - ei_reg_getival()
  - ei_reg_getpval()
  - ei_reg_getsval()
  - ei_reg_getval()
  - ei_reg_markdirty()
  - ei_reg_open()
  - ei_reg_purge()
  - ei_reg_resize()
  - ei_reg_restore()
  - ei_reg_setfval()
  - ei_reg_setival()
  - ei_reg_setpval()
  - ei_reg_setsval()
  - ei_reg_setval()
  - ei_reg_stat()
  - ei_reg_tabstat()
- ei_global
  - Top of manual page
  - ei_global_names()
  - ei_global_register()
  - ei_global_unregister()
  - ei_global_whereis()
- erl_call

# ei_global

### C Library

ei_global

### Library Summary

Access globally registered names.

### Description

This module provides support for registering, looking up, and unregistering names in the global module. For more information, see kernel:global.

Notice 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, as the function can then receive unexpected data and fail.

### Exports

char **ei_global_names( ec, fd, count) |

### Types

ei_cnode *ec;
int fd;
int *count;

Retrieves a list of all known global names.

- ec is the ei_cnode representing the current cnode.
- fd is an open descriptor to an Erlang connection.
- count is the address of an integer, or NULL. If count is not NULL, it is 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 count to the number of names found. The array is terminated by a single NULL pointer. On failure, the function returns NULL and count is not modified.

Note

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

int ei_global_register( fd, name, pid) |

### Types

int fd;
const char *name;
erlang_pid *pid;

Registers a name in global.

- fd is an open descriptor to an Erlang connection.
- name is the name to register in global.
- pid is the pid that is to be associated with name. This value is returned by global when processes request the location of name.

Returns 0 on success, otherwise -1.

int ei_global_unregister( ec, fd, name) |

### Types

ei_cnode *ec;
int fd;
const char *name;

Unregisters a name from global.

- ec is the ei_cnode representing the current cnode.
- fd is an open descriptor to an Erlang connection.
- name is the name to unregister from global.

Returns 0 on success, otherwise -1.

int ei_global_whereis( ec, fd, name, pid, node) |

### Types

ei_cnode *ec;
int fd;
const char *name;
erlang_pid *pid;
char *node;

Looks up a name in global.

- ec is the ei_cnode representing the current cnode.
- fd is an open descriptor to an Erlang connection.
- name is the name that is to be looked up in global.

The pid parameter is a pointer to a erlang_pid that the function will update with the pid associated with the global name, if successful.

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

On success, the function returns 0, updates the erlang_pid pointed to by the pid parameter, and the node parameter is initialized to the node name where name is found. On failure, a negative number is returned.