summaryrefslogtreecommitdiff
path: root/components/pthreads/mqueue.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-11-24 23:59:27 +0000
committer[email protected] <[email protected]>2010-11-24 23:59:27 +0000
commit7191e2220fe1dc6e7ae4ff0af657bfe25b43379f (patch)
treed3f066721f6e5b6b9672a82da4c361a961bbcc93 /components/pthreads/mqueue.c
parentf5d2b36adb96c7fc2b8984ef7c9c34ec23edb497 (diff)
add pthread magic assert.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1112 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/pthreads/mqueue.c')
-rw-r--r--components/pthreads/mqueue.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/components/pthreads/mqueue.c b/components/pthreads/mqueue.c
index bd31b4450a..f4869a0476 100644
--- a/components/pthreads/mqueue.c
+++ b/components/pthreads/mqueue.c
@@ -55,13 +55,15 @@ static posix_mq_t *posix_mq_find(const char* name)
for (iter = posix_mq_list; iter != RT_NULL; iter = iter->next)
{
- object = (rt_object_t)&(iter->mq);
+ object = (rt_object_t)(iter->mq);
if (strncmp(object->name, name, RT_NAME_MAX) == 0)
{
return iter;
}
}
+
+ return RT_NULL;
}
int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
@@ -193,13 +195,6 @@ ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_pri
return -1;
}
- /* permission check */
- if (!(mqdes->flags & O_RDONLY))
- {
- rt_set_errno(EBADF);
- return -1;
- }
-
result = rt_mq_recv(mqdes->mq->mq, msg_ptr, msg_len, RT_WAITING_FOREVER);
if (result == RT_EOK)
return msg_len;
@@ -218,13 +213,6 @@ int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
return -1;
}
- /* permission check */
- if (!(mqdes->flags & O_WRONLY))
- {
- rt_set_errno(EBADF);
- return -1;
- }
-
result = rt_mq_send(mqdes->mq->mq, (void*)msg_ptr, msg_len);
if (result == RT_EOK)
return 0;
@@ -245,12 +233,6 @@ ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
rt_set_errno(EINVAL);
return -1;
}
- /* permission check */
- if (!(mqdes->flags & O_RDONLY))
- {
- rt_set_errno(EBADF);
- return -1;
- }
tick = libc_time_to_tick(abs_timeout);