1ei_global(3) C Library Functions ei_global(3)
2
3
4
6 ei_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 de‐
14 scriptor provided by the caller. This file descriptor must not be used
15 for other traffic during the global operation, as the function can then
16 receive unexpected data and fail.
17
19 char **ei_global_names(ec,fd,count)
20
21 Types:
22
23 ei_cnode *ec;
24 int fd;
25 int *count;
26
27 Retrieves a list of all known global names.
28
29 * ec is the ei_cnode representing the current cnode.
30
31 * fd is an open descriptor to an Erlang connection.
32
33 * count is the address of an integer, or NULL. If count is not
34 NULL, it is set by the function to the number of names
35 found.
36
37 On success, the function returns an array of strings, each con‐
38 taining a single registered name, and sets count to the number
39 of names found. The array is terminated by a single NULL
40 pointer. On failure, the function returns NULL and count is not
41 modified.
42
43 Note:
44 It is the caller's responsibility to free the array afterwards.
45 It has been allocated by the function with a single call to mal‐
46 loc(), so a single free() is all that is necessary.
47
48
49 int ei_global_register(fd,name,pid)
50
51 Types:
52
53 int fd;
54 const char *name;
55 erlang_pid *pid;
56
57 Registers a name in global.
58
59 * fd is an open descriptor to an Erlang connection.
60
61 * name is the name to register in global.
62
63 * pid is the pid that is to be associated with name. This
64 value is returned by global when processes request the loca‐
65 tion of name.
66
67 Returns 0 on success, otherwise -1.
68
69 int ei_global_unregister(ec,fd,name)
70
71 Types:
72
73 ei_cnode *ec;
74 int fd;
75 const char *name;
76
77 Unregisters a name from global.
78
79 * ec is the ei_cnode representing the current cnode.
80
81 * fd is an open descriptor to an Erlang connection.
82
83 * name is the name to unregister from global.
84
85 Returns 0 on success, otherwise -1.
86
87 int ei_global_whereis(ec,fd,name,pid,node)
88
89 Types:
90
91 ei_cnode *ec;
92 int fd;
93 const char *name;
94 erlang_pid *pid;
95 char *node;
96
97 Looks up a name in global.
98
99 * ec is the ei_cnode representing the current cnode.
100
101 * fd is an open descriptor to an Erlang connection.
102
103 * name is the name that is to be looked up in global.
104
105 The pid parameter is a pointer to a erlang_pid that the function
106 will update with the pid associated with the global name, if
107 successful.
108
109 If node is not NULL, it is a pointer to a buffer where the func‐
110 tion can fill in the name of the node where name is found. node
111 can be passed directly to ei_connect() if necessary.
112
113 On success, the function returns 0, updates the erlang_pid
114 pointed to by the pid parameter, and the node parameter is ini‐
115 tialized to the node name where name is found. On failure, a
116 negative number is returned.
117
118
119
120Ericsson AB erl_interface 5.2.2 ei_global(3)