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