MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / shm_id_to_node

Function shm_id_to_node

components/lwp/lwp_shm.c:204–226  ·  view source on GitHub ↗

Locate the binary tree node_key corresponding to the shared-memory id. */

Source from the content-addressed store, hash-verified

202
203/* Locate the binary tree node_key corresponding to the shared-memory id. */
204static struct lwp_avl_struct *shm_id_to_node(int id)
205{
206 struct lwp_avl_struct *node_key = 0;
207 struct lwp_shm_struct *p = RT_NULL;
208
209 /* check id */
210 if (id < 0 || id >= RT_LWP_SHM_MAX_NR)
211 {
212 return RT_NULL;
213 }
214
215 p = _shm_ary + id; /* the address of the shared-memory structure */
216 node_key = lwp_avl_find(p->key, shm_tree_key);
217 if (!node_key)
218 {
219 return RT_NULL;
220 }
221 if (node_key->data != (void *)p)
222 {
223 return RT_NULL;
224 }
225 return node_key;
226}
227
228/* Free the shared pages, the shared-memory structure and its binary tree node_key. */
229static int _lwp_shmrm(int id)

Callers 3

_lwp_shmrmFunction · 0.85
_lwp_shmatFunction · 0.85
_lwp_shminfoFunction · 0.85

Calls 1

lwp_avl_findFunction · 0.85

Tested by

no test coverage detected