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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>erl_global</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>erl_global</H1>
</CENTER>
<H3>C LIBRARY</H3>
<DIV CLASS=REFBODY>
erl_global
</DIV>
<H3>C LIBRARY SUMMARY</H3>
<DIV CLASS=REFBODY>
Access globally registered names
</DIV>
<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>
<P>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.
<P>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.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="erl_global_names/2"><STRONG><CODE>char **erl_global_names(fd,count)</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>int fd;</CODE></STRONG><BR>
<STRONG><CODE>int *count;</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Retrieve a list of all known global names.
<P><CODE>fd</CODE> is an open descriptor to an Erlang connection.
<P><CODE>count</CODE> is the address of an integer, or NULL. If
<CODE>count</CODE> is not NULL, it will be set by the function to
the number of names found.
<P>On success, the function returns an array of strings, each
containing a single registered name, and sets <CODE>count</CODE> to
the number of names found. The array is terminated
by a single NULL pointer. On failure, the function returns
NULL and <CODE>count</CODE> is not modified.
<P>
<TABLE CELLPADDING=4>
<TR>
<TD VALIGN=TOP><IMG ALT="Note!" SRC="note.gif"></TD>
<TD>
<P>It is the caller's responsibility to free the array
afterwards. It has been allocated by the function with a
single call to <CODE>malloc()</CODE>, so a single <CODE>free()</CODE> is
all that is necessary. </TD>
</TR>
</TABLE>
</DIV>
<P><A NAME="erl_global_register/3"><STRONG><CODE>int erl_global_register(fd,name,pid)</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>int fd;</CODE></STRONG><BR>
<STRONG><CODE>const char *name;</CODE></STRONG><BR>
<STRONG><CODE>ETERM *pid;</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>This function registers a name in Global.
<P><CODE>fd</CODE> is an open descriptor to an Erlang connection.
<P><CODE>name</CODE> is the name to register in Global.
<P><CODE>pid</CODE> is the pid that should be associated with
<CODE>name</CODE>. This is the value that Global will return when
processes request the location of <CODE>name</CODE>.
<P>The function returns 0 on success, or -1 on failure.
</DIV>
<P><A NAME="erl_global_unregister/2"><STRONG><CODE>int erl_global_unregister(fd,name)</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>int fd;</CODE></STRONG><BR>
<STRONG><CODE>const char *name;</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>This function unregisters a name from Global.
<P><CODE>fd</CODE> is an open descriptor to an Erlang connection.
<P><CODE>name</CODE> is the name to unregister from Global.
<P>The function returns 0 on success, or -1 on failure.
</DIV>
<P><A NAME="erl_global_whereis/3"><STRONG><CODE>ETERM *erl_global_whereis(fd,name,node)</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>int fd;</CODE></STRONG><BR>
<STRONG><CODE>const char *name;</CODE></STRONG><BR>
<STRONG><CODE>char *node;</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P><CODE>fd</CODE> is an open descriptor to an Erlang connection.
<P><CODE>name</CODE> is the name that is to be looked up in Global.
<P>If <CODE>node</CODE> is not NULL, it is a pointer to a buffer
where the function can fill in the name of the node where
<CODE>name</CODE> is found. <CODE>node</CODE> can be passed directly to
<CODE>erl_connect()</CODE> if necessary.
<P>On success, the function returns an Erlang Pid containing the address
of the given name, and node will be initialized to
the nodename where <CODE>name</CODE> is found. On failure NULL will be
returned and <CODE>node</CODE> will not be modified.
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Gordon Beaton - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>erl_interface 3.5.5.2<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|