1erl_global(3) C Library Functions erl_global(3)
2
3
4
6 erl_global - Access globally registered names.
7
9 This module provides support for registering, looking up, and unregis‐
10 tering names in the global module. For more information, see ker‐
11 nel:global.
12
13 Notice that the functions below perform an RPC using an open file
14 descriptor provided by the caller. This file descriptor must not be
15 used for other traffic during the global operation, as the function can
16 then receive unexpected data and fail.
17
19 char **erl_global_names(fd,count)
20
21 Types:
22
23 int fd;
24 int *count;
25
26 Retrieves a list of all known global names.
27
28 * fd is an open descriptor to an Erlang connection.
29
30 * count is the address of an integer, or NULL. If count is not
31 NULL, it is set by the function to the number of names
32 found.
33
34 On success, the function returns an array of strings, each con‐
35 taining a single registered name, and sets count to the number
36 of names found. The array is terminated by a single NULL
37 pointer. On failure, the function returns NULL and count is not
38 modified.
39
40 Note:
41 It is the caller's responsibility to free the array afterwards.
42 It has been allocated by the function with a single call to mal‐
43 loc(), so a single free() is all that is necessary.
44
45
46 int erl_global_register(fd,name,pid)
47
48 Types:
49
50 int fd;
51 const char *name;
52 ETERM *pid;
53
54 Registers a name in global.
55
56 * fd is an open descriptor to an Erlang connection.
57
58 * name is the name to register in global.
59
60 * pid is the pid that is to be associated with name. This
61 value is returned by global when processes request the loca‐
62 tion of name.
63
64 Returns 0 on success, otherwise -1.
65
66 int erl_global_unregister(fd,name)
67
68 Types:
69
70 int fd;
71 const char *name;
72
73 Unregisters a name from global.
74
75 * fd is an open descriptor to an Erlang connection.
76
77 * name is the name to unregister from global.
78
79 Returns 0 on success, otherwise -1.
80
81 ETERM *erl_global_whereis(fd,name,node)
82
83 Types:
84
85 int fd;
86 const char *name;
87 char *node;
88
89 Looks up a name in global.
90
91 * fd is an open descriptor to an Erlang connection.
92
93 * name is the name that is to be looked up in global.
94
95 If node is not NULL, it is a pointer to a buffer where the func‐
96 tion can fill in the name of the node where name is found. node
97 can be passed directly to erl_connect() if necessary.
98
99 On success, the function returns an Erlang pid containing the
100 address of the specified name, and the node is initialized to
101 the node name where name is found. On failure, NULL is returned
102 and node is not modified.
103
104
105
106Ericsson AB erl_interface 3.10.2.2 erl_global(3)