1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*++ |
6 | |
7 | |
8 | |
9 | Module Name: |
10 | |
11 | shmobjectmanager.hpp |
12 | |
13 | Abstract: |
14 | Shared memory based object manager |
15 | |
16 | |
17 | |
18 | --*/ |
19 | |
20 | #ifndef _PAL_SHMOBJECTMANAGER_HPP_ |
21 | #define _PAL_SHMOBJECTMANAGER_HPP_ |
22 | |
23 | #include "pal/corunix.hpp" |
24 | #include "pal/handlemgr.hpp" |
25 | #include "pal/list.h" |
26 | #include "shmobject.hpp" |
27 | |
28 | namespace CorUnix |
29 | { |
30 | class CSharedMemoryObjectManager : public IPalObjectManager |
31 | { |
32 | protected: |
33 | |
34 | CRITICAL_SECTION m_csListLock; |
35 | bool m_fListLockInitialized; |
36 | LIST_ENTRY m_leNamedObjects; |
37 | LIST_ENTRY m_leAnonymousObjects; |
38 | |
39 | CSimpleHandleManager m_HandleManager; |
40 | |
41 | PAL_ERROR |
42 | ImportSharedObjectIntoProcess( |
43 | CPalThread *pthr, |
44 | CObjectType *pot, |
45 | CObjectAttributes *poa, |
46 | SHMPTR shmSharedObjectData, |
47 | SHMObjData *psmod, |
48 | bool fAddRefSharedData, |
49 | CSharedMemoryObject **ppshmobj |
50 | ); |
51 | |
52 | public: |
53 | |
54 | CSharedMemoryObjectManager() |
55 | : |
56 | m_fListLockInitialized(FALSE) |
57 | { |
58 | }; |
59 | |
60 | virtual ~CSharedMemoryObjectManager() |
61 | { |
62 | }; |
63 | |
64 | PAL_ERROR |
65 | Initialize( |
66 | void |
67 | ); |
68 | |
69 | PAL_ERROR |
70 | Shutdown( |
71 | CPalThread *pthr |
72 | ); |
73 | |
74 | // |
75 | // IPalObjectManager routines |
76 | // |
77 | |
78 | virtual |
79 | PAL_ERROR |
80 | AllocateObject( |
81 | CPalThread *pthr, |
82 | CObjectType *pot, |
83 | CObjectAttributes *poa, |
84 | IPalObject **ppobjNew |
85 | ); |
86 | |
87 | virtual |
88 | PAL_ERROR |
89 | RegisterObject( |
90 | CPalThread *pthr, |
91 | IPalObject *pobjToRegister, |
92 | CAllowedObjectTypes *paot, |
93 | DWORD dwRightsRequested, |
94 | HANDLE *pHandle, |
95 | IPalObject **ppobjRegistered |
96 | ); |
97 | |
98 | virtual |
99 | PAL_ERROR |
100 | LocateObject( |
101 | CPalThread *pthr, |
102 | CPalString *psObjectToLocate, |
103 | CAllowedObjectTypes *paot, |
104 | IPalObject **ppobj |
105 | ); |
106 | |
107 | virtual |
108 | PAL_ERROR |
109 | ObtainHandleForObject( |
110 | CPalThread *pthr, |
111 | IPalObject *pobj, |
112 | DWORD dwRightsRequested, |
113 | bool fInheritHandle, |
114 | IPalProcess *pProcessForHandle, // IN, OPTIONAL |
115 | HANDLE *pNewHandle |
116 | ); |
117 | |
118 | virtual |
119 | PAL_ERROR |
120 | RevokeHandle( |
121 | CPalThread *pthr, |
122 | HANDLE hHandleToRevoke |
123 | ); |
124 | |
125 | virtual |
126 | PAL_ERROR |
127 | ReferenceObjectByHandle( |
128 | CPalThread *pthr, |
129 | HANDLE hHandleToReference, |
130 | CAllowedObjectTypes *paot, |
131 | DWORD dwRightsRequired, |
132 | IPalObject **ppobj |
133 | ); |
134 | |
135 | virtual |
136 | PAL_ERROR |
137 | ReferenceMultipleObjectsByHandleArray( |
138 | CPalThread *pthr, |
139 | HANDLE rghHandlesToReference[], |
140 | DWORD dwHandleCount, |
141 | CAllowedObjectTypes *paot, |
142 | DWORD dwRightsRequired, |
143 | IPalObject *rgpobjs[] |
144 | ); |
145 | |
146 | virtual |
147 | PAL_ERROR |
148 | ReferenceObjectByForeignHandle( |
149 | CPalThread *pthr, |
150 | HANDLE hForeignHandle, |
151 | IPalProcess *pForeignProcess, |
152 | CAllowedObjectTypes *paot, |
153 | DWORD dwRightsRequired, |
154 | IPalObject **ppobj |
155 | ); |
156 | }; |
157 | } |
158 | |
159 | #endif // _PAL_SHMOBJECTMANAGER_HPP_ |
160 | |
161 | |