1 /*
2  * %CopyrightBegin%
3  *
4  * Copyright Ericsson AB 1996-2016. All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * %CopyrightEnd%
19  */
20 
21 /*
22 ** Registered processes
23 */
24 
25 #ifndef __REGPROC_H__
26 #define __REGPROC_H__
27 
28 #include "sys.h"
29 #include "hash.h"
30 #include "erl_process.h"
31 #define ERL_PORT_GET_PORT_TYPE_ONLY__
32 #include "erl_port.h"
33 #undef ERL_PORT_GET_PORT_TYPE_ONLY__
34 
35 typedef struct reg_proc
36 {
37     HashBucket bucket;  /* MUST BE LOCATED AT TOP OF STRUCT!!! */
38     Process *p;         /* The process registered (only one of this and
39 			   'pt' is non-NULL */
40     Port *pt;		/* The port registered */
41     Eterm name;         /* Atom name */
42 } RegProc;
43 
44 int process_reg_size(void);
45 int process_reg_sz(void);
46 void init_register_table(void);
47 void register_info(fmtfn_t, void *);
48 int erts_register_name(Process *, Eterm, Eterm);
49 Eterm erts_whereis_name_to_id(Process *, Eterm);
50 void erts_whereis_name(Process *, ErtsProcLocks,
51 		       Eterm, Process**, ErtsProcLocks, int,
52 		       Port**, int);
53 Process *erts_whereis_process(Process *,
54 			      ErtsProcLocks,
55 			      Eterm,
56 			      ErtsProcLocks,
57 			      int);
58 int erts_unregister_name(Process *, ErtsProcLocks, Port *, Eterm);
59 
60 #endif
61