File: erl_global.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (108 lines) | stat: -rw-r--r-- 3,015 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.TH erl_global 3 "erl_interface  3.5.7" "Ericsson AB" "C LIBRARY FUNCTIONS"
.SH NAME
erl_global \- Access globally registered names
.SH DESCRIPTION
.LP
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\&.
.LP
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\&.

.SH EXPORTS
.LP
.B
char ** erl_global_names(fd,count)
.br
.RS
.TP
Types
int fd;
.br
int *count;
.br
.RE
.RS
.LP
Retrieve a list of all known global names\&. 
.LP
\fIfd\fR is an open descriptor to an Erlang connection\&. 
.LP
\fIcount\fR is the address of an integer, or NULL\&. If \fIcount\fR is not NULL, it will be set by the function to the number of names found\&. 
.LP
On success, the function returns an array of strings, each containing a single registered name, and sets \fIcount\fR to the number of names found\&. The array is terminated by a single NULL pointer\&. On failure, the function returns NULL and \fIcount\fR is not modified\&. 
.SS Note:
.LP
It is the caller\&'s responsibility to free the array afterwards\&. It has been allocated by the function with a single call to \fImalloc()\fR, so a single \fIfree()\fR is all that is necessary\&.

.RE
.LP
.B
int erl_global_register(fd,name,pid)
.br
.RS
.TP
Types
int fd;
.br
const char *name;
.br
ETERM *pid;
.br
.RE
.RS
.LP
This function registers a name in Global\&. 
.LP
\fIfd\fR is an open descriptor to an Erlang connection\&. 
.LP
\fIname\fR is the name to register in Global\&. 
.LP
\fIpid\fR is the pid that should be associated with \fIname\fR\&. This is the value that Global will return when processes request the location of \fIname\fR\&. 
.LP
The function returns 0 on success, or -1 on failure\&.
.RE
.LP
.B
int erl_global_unregister(fd,name)
.br
.RS
.TP
Types
int fd;
.br
const char *name;
.br
.RE
.RS
.LP
This function unregisters a name from Global\&. 
.LP
\fIfd\fR is an open descriptor to an Erlang connection\&. 
.LP
\fIname\fR is the name to unregister from Global\&. 
.LP
The function returns 0 on success, or -1 on failure\&.
.RE
.LP
.B
ETERM * erl_global_whereis(fd,name,node)
.br
.RS
.TP
Types
int fd;
.br
const char *name;
.br
char *node;
.br
.RE
.RS
.LP
\fIfd\fR is an open descriptor to an Erlang connection\&. 
.LP
\fIname\fR is the name that is to be looked up in Global\&. 
.LP
If \fInode\fR is not NULL, it is a pointer to a buffer where the function can fill in the name of the node where \fIname\fR is found\&. \fInode\fR can be passed directly to \fIerl_connect()\fR if necessary\&. 
.LP
On success, the function returns an Erlang Pid containing the address of the given name, and node will be initialized to the nodename where \fIname\fR is found\&. On failure NULL will be returned and \fInode\fR will not be modified\&.
.RE