diff options
author | Robert Collins <rbtcollins@hotmail.com> | 2002-03-04 11:45:40 +0300 |
---|---|---|
committer | Robert Collins <rbtcollins@hotmail.com> | 2002-03-04 11:45:40 +0300 |
commit | 7c3617cc0a471bbd484538ea7d2b8a8f1e123e42 (patch) | |
tree | 14e9696a79c42bbadc4adfa47f7c46b6304feb4b /winsup/cygwin/cygserver_shm.cc | |
parent | 038c71f10c12a60698a801a95321e874e30e50d4 (diff) |
2002-03-04 Robert Collins <rbtcollins@hotmail.com>
* cygserver_shm.cc (delete_shmnode): New function.
(client_request_shm::serve): Use it.
Diffstat (limited to 'winsup/cygwin/cygserver_shm.cc')
-rwxr-xr-x | winsup/cygwin/cygserver_shm.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/winsup/cygwin/cygserver_shm.cc b/winsup/cygwin/cygserver_shm.cc index 50ca42e0e..97f05f9d9 100755 --- a/winsup/cygwin/cygserver_shm.cc +++ b/winsup/cygwin/cygserver_shm.cc @@ -170,6 +170,35 @@ static long new_private_key = 0; +static void +delete_shmnode (shmnode **nodeptr) +{ + shmnode *node = *nodeptr; + + // remove from the list + if (node == shm_head) + shm_head = shm_head->next; + else + { + shmnode *tempnode = shm_head; + while (tempnode && tempnode->next != node) + tempnode = tempnode->next; + if (tempnode) + tempnode->next = node->next; + // else log the unexpected ! + } + + // release the shared data view + UnmapViewOfFile (node->shmds->mapptr); + delete node->shmds; + CloseHandle (node->filemap); + CloseHandle (node->attachmap); + + // free the memory + delete node; + nodeptr = NULL; +} + void client_request_shm::serve (transport_layer_base * conn, process_cache * cache) { @@ -326,6 +355,14 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache) deleted_head = temp2; // FIXME: when/where do we delete the handles? + if (temp2->shmds->shm_nattch) + { + // FIXME: add to a pending queue? + } + else + { + delete_shmnode (&temp2); + } header.error_code = 0; CloseHandle (token_handle); |