summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwh1 <jwh1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-26 22:15:50 +0000
committerjwh1 <jwh1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-26 22:15:50 +0000
commitc4e265805ea615f017dbd2c86993d6e8a80aa7cf (patch)
treee8b3049f99bbd38b54f670add37bc011d7c42a32
parentc5dab609964dbbfbb7dd586d93fe2daab52f773e (diff)
downloadATCD-c4e265805ea615f017dbd2c86993d6e8a80aa7cf.tar.gz
Wed Jul 26 17:13:51 2000 John Heitmann <jwh1@cs.wustl.edu>
-rw-r--r--PACE/ChangeLog7
-rw-r--r--PACE/pace/emulation/mqueue.c45
2 files changed, 18 insertions, 34 deletions
diff --git a/PACE/ChangeLog b/PACE/ChangeLog
index 1f1201e19ec..76c256b7e56 100644
--- a/PACE/ChangeLog
+++ b/PACE/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jul 26 17:13:51 2000 John Heitmann <jwh1@cs.wustl.edu>
+
+ * pace/emulation/mqueue.c:
+ Removed print_queue(), qualified attrdefault
+ with pace_, fixed memory leaks, and fixed
+ the totally broken mq_unlink.
+
Tue Jul 25 17:09:13 2000 Luther J Baker <luther@cs.wustl.edu>
* pace/win32/mman.c:
diff --git a/PACE/pace/emulation/mqueue.c b/PACE/pace/emulation/mqueue.c
index 93df95a3c87..36b74616f9e 100644
--- a/PACE/pace/emulation/mqueue.c
+++ b/PACE/pace/emulation/mqueue.c
@@ -42,7 +42,7 @@ typedef struct
pace_size_t length;
} message_header;
-struct mq_attr attrdefault = { 0, 32, 256, 0 };
+static struct mq_attr pace_attrdefault = { 0, 32, 256, 0 };
#define PACE_MQ_LOCKPOSTFIX "mqlock9587"
#define PACE_MQ_DATAPOSTFIX "mqdata2355"
@@ -71,7 +71,7 @@ pace_mqd_t mq_open (const char* name,
retry:
if (attr == 0)
{
- attr = &attrdefault;
+ attr = &pace_attrdefault;
}
else
{
@@ -295,7 +295,15 @@ int mq_close (pace_mqd_t mqdes)
#if (PACE_HAS_POSIX_NONUOF_FUNCS)
int mq_unlink (const char* name)
{
- return pace_unlink (name);
+ int result1, result2;
+ char* new_name;
+ new_name = malloc (256);
+ snprintf (new_name, 256, "/tmp%s%s", name, PACE_MQ_DATAPOSTFIX);
+ result1 = pace_unlink (new_name);
+ snprintf (new_name, 256, "/tmp%s%s", name, PACE_MQ_LOCKPOSTFIX);
+ result2 = pace_unlink (new_name);
+ free (new_name);
+ return (result1 == -1 || result2 == -1 ? -1 : 0);
}
#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */
@@ -561,34 +569,3 @@ int mq_notify (pace_mqd_t mqd, const pace_sigevent* notification)
return 0;
}
#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */
-
-#if (PACE_HAS_POSIX_NONUOF_FUNCS)
-void print_queue (pace_mqd_t mqd)
-{
-
- mqfile* queue = ((mqfile*)(mqd->mptr));
- pace_size_t i, index;
- i=0;
- index = queue->freelist;
- while (index != 0)
- {
- i++;
- index = ((message_header*)(&mqd->mptr[index]))->next;
- }
- printf ("There are %li total blacks of size %li.\n", queue->attr.mq_maxmsg, queue->attr.mq_msgsize);
- printf ("There are %i free blocks left.\n", i);
- printf ("There are %li messages on the queue.\n", queue->attr.mq_curmsgs);
-
- i=0;
- index = queue->head;
- while (index != 0)
- {
- i++;
- printf ("Message %i has a prio of %i and len of %i.\n", i,
- ((message_header*)(&mqd->mptr[index]))->priority,
- ((message_header*)(&mqd->mptr[index]))->length);
- index = ((message_header*)(&mqd->mptr[index]))->next;
- }
- printf ("\n");
-}
-#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */