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_sz(void);
45 void init_register_table(void);
46 void register_info(fmtfn_t, void *);
47 int erts_register_name(Process *, Eterm, Eterm);
48 Eterm erts_whereis_name_to_id(Process *, Eterm);
49 void erts_whereis_name(Process *, ErtsProcLocks,
50 		       Eterm, Process**, ErtsProcLocks, int,
51 		       Port**, int);
52 Process *erts_whereis_process(Process *,
53 			      ErtsProcLocks,
54 			      Eterm,
55 			      ErtsProcLocks,
56 			      int);
57 int erts_unregister_name(Process *, ErtsProcLocks, Port *, Eterm);
58 
59 #endif
60