Locate the binary tree node_key corresponding to the shared-memory id. */
| 202 | |
| 203 | /* Locate the binary tree node_key corresponding to the shared-memory id. */ |
| 204 | static 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. */ |
| 229 | static int _lwp_shmrm(int id) |
no test coverage detected