[posix]修复消息队列返回长度异常 (#8014)
This commit is contained in:
parent
dfc8994ea2
commit
0b9a808cca
|
@ -130,7 +130,7 @@ ssize_t mq_receive(mqd_t id, char *msg_ptr, size_t msg_len, unsigned *msg_prio)
|
|||
|
||||
result = rt_mq_recv_prio(mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, RT_WAITING_FOREVER, RT_UNINTERRUPTIBLE);
|
||||
if (result >= 0)
|
||||
return rt_strlen(msg_ptr);
|
||||
return result;
|
||||
|
||||
rt_set_errno(EBADF);
|
||||
return -1;
|
||||
|
@ -186,7 +186,7 @@ ssize_t mq_timedreceive(mqd_t id,
|
|||
result = rt_mq_recv_prio(mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, tick, RT_UNINTERRUPTIBLE);
|
||||
|
||||
if (result >= 0)
|
||||
return rt_strlen(msg_ptr);
|
||||
return result;
|
||||
|
||||
if (result == -RT_ETIMEOUT)
|
||||
rt_set_errno(ETIMEDOUT);
|
||||
|
|
|
@ -125,7 +125,7 @@ static void mq_send_entry(void *param)
|
|||
static void mq_recv_case(rt_mq_t testmq)
|
||||
{
|
||||
rt_uint32_t recv_buf[MAX_MSGS+1] = {0};
|
||||
rt_err_t ret = RT_EOK;
|
||||
rt_ssize_t ret = RT_EOK;
|
||||
|
||||
for (int var = 0; var < MAX_MSGS + 1; ++var)
|
||||
{
|
||||
|
|
|
@ -517,12 +517,12 @@ rt_err_t rt_mq_send_wait_prio(rt_mq_t mq,
|
|||
rt_int32_t prio,
|
||||
rt_int32_t timeout,
|
||||
int suspend_flag);
|
||||
rt_err_t rt_mq_recv_prio(rt_mq_t mq,
|
||||
void *buffer,
|
||||
rt_size_t size,
|
||||
rt_int32_t *prio,
|
||||
rt_int32_t timeout,
|
||||
int suspend_flag);
|
||||
rt_ssize_t rt_mq_recv_prio(rt_mq_t mq,
|
||||
void *buffer,
|
||||
rt_size_t size,
|
||||
rt_int32_t *prio,
|
||||
rt_int32_t timeout,
|
||||
int suspend_flag);
|
||||
#endif /* RT_USING_MESSAGEQUEUE_PRIORITY */
|
||||
#endif /* RT_USING_MESSAGEQUEUE */
|
||||
|
||||
|
|
12
src/ipc.c
12
src/ipc.c
|
@ -3805,12 +3805,12 @@ rt_err_t rt_mq_send_wait_prio(rt_mq_t mq,
|
|||
{
|
||||
return _rt_mq_send_wait(mq, buffer, size, prio, timeout, suspend_flag);
|
||||
}
|
||||
rt_err_t rt_mq_recv_prio(rt_mq_t mq,
|
||||
void *buffer,
|
||||
rt_size_t size,
|
||||
rt_int32_t *prio,
|
||||
rt_int32_t timeout,
|
||||
int suspend_flag)
|
||||
rt_ssize_t rt_mq_recv_prio(rt_mq_t mq,
|
||||
void *buffer,
|
||||
rt_size_t size,
|
||||
rt_int32_t *prio,
|
||||
rt_int32_t timeout,
|
||||
int suspend_flag)
|
||||
{
|
||||
return _rt_mq_recv(mq, buffer, size, prio, timeout, suspend_flag);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue