From c74c51510aae0283c9b9e53dffe7c77a7f1205ad Mon Sep 17 00:00:00 2001 From: glenux Date: Mon, 23 Feb 2004 20:22:15 +0000 Subject: [PATCH] *** empty log message *** --- src/iface.h | 1 + src/queueClose.c | 0 src/queueOpen.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/queueClose.c create mode 100644 src/queueOpen.c diff --git a/src/iface.h b/src/iface.h index 3f5dc3a..7a2c43f 100644 --- a/src/iface.h +++ b/src/iface.h @@ -75,6 +75,7 @@ typedef struct MsgQueueElem { } msgQueueElem; typedef struct MsgQueue { + msgQueueId id; int elemCounter; msgQueueElemId head; msgQueueElemId tail; diff --git a/src/queueClose.c b/src/queueClose.c new file mode 100644 index 0000000..e69de29 diff --git a/src/queueOpen.c b/src/queueOpen.c new file mode 100644 index 0000000..2493a85 --- /dev/null +++ b/src/queueOpen.c @@ -0,0 +1,29 @@ +#include "libnazgul.h" +#include "ids.h" + +void * queueOpen(msgQueueId queueId){ + int queueFd; + void * queueAddr; + + queueFd=shm_open(queueId,O_RDWR,SHM_DEFAULT_MODE); + if (queueFd == -1 ) { + NZG_ERROR("shm_open : msgQueue open",queueId); + goto ERROR; + } + + queueAddr=mmap(NULL, + sizeof(msgQueue), + PROT_READ|PROT_WRITE, + MAP_SHARED, + queueFd, + 0); + if( queueAddr == MAP_FAILED ) { + NZG_ERROR("mmap",queueId); + goto ERROR; + } + + close(queueFd); + return queueAddr; +ERROR: + return NULL; +}