Squashed commit of the following:
sched/mqueue: Rename all private static functions for use the nxmq_ vs. mq_ naming. sched/mqueue: Rename all OS internal functions declared in sched/mqueue/mqueue.h to begin with nxmq_ vs. mq_. The mq_ prefix is reserved for standard application interfaces.
This commit is contained in:
parent
01a4060a1b
commit
e7c52bac60
25 changed files with 112 additions and 112 deletions
|
@ -175,7 +175,7 @@ echo "EXTERN(sem_initialize)" >>ld-locked.inc
|
|||
|
||||
answer=$(checkconfig CONFIG_DISABLE_MQUEUE)
|
||||
if [ "$answer" = n ]; then
|
||||
echo "EXTERN(mq_initialize)" >>ld-locked.inc
|
||||
echo "EXTERN(nxmq_initialize)" >>ld-locked.inc
|
||||
fi
|
||||
|
||||
answer=$(checkconfig CONFIG_DISABLE_PTHREAD)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* sched/group/group_leave.c
|
||||
*
|
||||
* Copyright (C) 2013-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -190,7 +190,7 @@ static inline void group_release(FAR struct task_group_s *group)
|
|||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
/* Close message queues opened by members of the group */
|
||||
|
||||
mq_release(group);
|
||||
nxmq_release(group);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_SHM)
|
||||
|
|
|
@ -649,10 +649,10 @@ void os_start(void)
|
|||
/* Initialize the named message queue facility (if in link) */
|
||||
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
if (mq_initialize != NULL)
|
||||
if (nxmq_initialize != NULL)
|
||||
#endif
|
||||
{
|
||||
mq_initialize();
|
||||
nxmq_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_desalloc
|
||||
* Name: nxmq_alloc_des
|
||||
*
|
||||
* Description:
|
||||
* Allocate a message queue descriptor.
|
||||
|
@ -75,7 +75,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static mqd_t mq_desalloc(void)
|
||||
static mqd_t nxmq_alloc_des(void)
|
||||
{
|
||||
mqd_t mqdes;
|
||||
|
||||
|
@ -89,7 +89,7 @@ static mqd_t mq_desalloc(void)
|
|||
{
|
||||
/* Add another block of message descriptors to the list */
|
||||
|
||||
mq_desblockalloc();
|
||||
nxmq_alloc_desblock();
|
||||
|
||||
/* And try again */
|
||||
|
||||
|
@ -140,7 +140,7 @@ mqd_t mq_descreate(FAR struct tcb_s *mtcb, FAR struct mqueue_inode_s *msgq,
|
|||
|
||||
/* Create a message queue descriptor for the TCB */
|
||||
|
||||
mqdes = mq_desalloc();
|
||||
mqdes = nxmq_alloc_des();
|
||||
if (mqdes)
|
||||
{
|
||||
/* Initialize the message queue descriptor */
|
||||
|
|
|
@ -149,7 +149,7 @@ mq_msgblockalloc(FAR sq_queue_t *queue, uint16_t nmsgs,
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_initialize
|
||||
* Name: nxmq_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function initializes the messasge system. This function must
|
||||
|
@ -164,7 +164,7 @@ mq_msgblockalloc(FAR sq_queue_t *queue, uint16_t nmsgs,
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_initialize(void)
|
||||
void nxmq_initialize(void)
|
||||
{
|
||||
/* Initialize the message free lists */
|
||||
|
||||
|
@ -188,11 +188,11 @@ void mq_initialize(void)
|
|||
|
||||
/* Allocate a block of message queue descriptors */
|
||||
|
||||
mq_desblockalloc();
|
||||
nxmq_alloc_desblock();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_desblockalloc
|
||||
* Name: nxmq_alloc_desblock
|
||||
*
|
||||
* Description:
|
||||
* Allocate a block of message descriptors and place them on the free
|
||||
|
@ -206,7 +206,7 @@ void mq_initialize(void)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_desblockalloc(void)
|
||||
void nxmq_alloc_desblock(void)
|
||||
{
|
||||
FAR struct mq_des_block_s *mqdesblock;
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_msgfree
|
||||
* Name: nxmq_free_msg
|
||||
*
|
||||
* Description:
|
||||
* The mq_msgfree function will return a message to the free pool of
|
||||
* The nxmq_free_msg function will return a message to the free pool of
|
||||
* messages if it was a pre-allocated message. If the message was
|
||||
* allocated dynamically it will be deallocated.
|
||||
*
|
||||
|
@ -67,7 +67,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_msgfree(FAR struct mqueue_msg_s *mqmsg)
|
||||
void nxmq_free_msg(FAR struct mqueue_msg_s *mqmsg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void mq_msgqfree(FAR struct mqueue_inode_s *msgq)
|
|||
/* Deallocate the message structure. */
|
||||
|
||||
next = curr->next;
|
||||
mq_msgfree(curr);
|
||||
nxmq_free_msg(curr);
|
||||
curr = next;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_verifyreceive
|
||||
* Name: nxmq_verify_receive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
|
@ -85,7 +85,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_verifyreceive(mqd_t mqdes, FAR char *msg, size_t msglen)
|
||||
int nxmq_verify_receive(mqd_t mqdes, FAR char *msg, size_t msglen)
|
||||
{
|
||||
/* Verify the input parameters */
|
||||
|
||||
|
@ -111,7 +111,7 @@ int mq_verifyreceive(mqd_t mqdes, FAR char *msg, size_t msglen)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_waitreceive
|
||||
* Name: nxmq_wait_receive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
|
@ -129,20 +129,20 @@ int mq_verifyreceive(mqd_t mqdes, FAR char *msg, size_t msglen)
|
|||
*
|
||||
* Assumptions:
|
||||
* - The caller has provided all validity checking of the input parameters
|
||||
* using mq_verifyreceive.
|
||||
* using nxmq_verify_receive.
|
||||
* - Interrupts should be disabled throughout this call. This is necessary
|
||||
* because messages can be sent from interrupt level processing.
|
||||
* - For mq_timedreceive, setting of the timer and this wait must be atomic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
||||
FAR struct mqueue_msg_s *nxmq_wait_receive(mqd_t mqdes)
|
||||
{
|
||||
FAR struct tcb_s *rtcb;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
FAR struct mqueue_msg_s *rcvmsg;
|
||||
|
||||
/* mq_waitreceive() is not a cancellation point, but it is always called
|
||||
/* nxmq_wait_receive() is not a cancellation point, but it is always called
|
||||
* from a cancellation point.
|
||||
*/
|
||||
|
||||
|
@ -218,7 +218,7 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_doreceive
|
||||
* Name: nxmq_do_receive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
|
@ -238,15 +238,15 @@ FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes)
|
|||
*
|
||||
* Assumptions:
|
||||
* - The caller has provided all validity checking of the input parameters
|
||||
* using mq_verifyreceive.
|
||||
* using nxmq_verify_receive.
|
||||
* - The user buffer, ubuffer, is known to be large enough to accept the
|
||||
* largest message that an be sent on this message queue
|
||||
* - Pre-emption should be disabled throughout this call.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t mq_doreceive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR char *ubuffer, int *prio)
|
||||
ssize_t nxmq_do_receive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR char *ubuffer, int *prio)
|
||||
{
|
||||
FAR struct tcb_s *btcb;
|
||||
irqstate_t flags;
|
||||
|
@ -270,7 +270,7 @@ ssize_t mq_doreceive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
|||
|
||||
/* We are done with the message. Deallocate it now. */
|
||||
|
||||
mq_msgfree(mqmsg);
|
||||
nxmq_free_msg(mqmsg);
|
||||
|
||||
/* Check if any tasks are waiting for the MQ not full event. */
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
* errno appropriately.
|
||||
*/
|
||||
|
||||
if (mq_verifyreceive(mqdes, msg, msglen) != OK)
|
||||
if (nxmq_verify_receive(mqdes, msg, msglen) != OK)
|
||||
{
|
||||
leave_cancellation_point();
|
||||
return ERROR;
|
||||
|
@ -127,7 +127,7 @@ ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
sched_lock();
|
||||
|
||||
/* Furthermore, mq_waitreceive() expects to have interrupts disabled
|
||||
/* Furthermore, nxmq_wait_receive() expects to have interrupts disabled
|
||||
* because messages can be sent from interrupt level.
|
||||
*/
|
||||
|
||||
|
@ -135,7 +135,7 @@ ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
/* Get the message from the message queue */
|
||||
|
||||
mqmsg = mq_waitreceive(mqdes);
|
||||
mqmsg = nxmq_wait_receive(mqdes);
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Check if we got a message from the message queue. We might
|
||||
|
@ -147,7 +147,7 @@ ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
if (mqmsg)
|
||||
{
|
||||
ret = mq_doreceive(mqdes, mqmsg, msg, prio);
|
||||
ret = nxmq_do_receive(mqdes, mqmsg, msg, prio);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_recover
|
||||
* Name: nxmq_recover
|
||||
*
|
||||
* Description:
|
||||
* This function is called when a task is deleted via task_deleted or
|
||||
|
@ -69,7 +69,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_recover(FAR struct tcb_s *tcb)
|
||||
void nxmq_recover(FAR struct tcb_s *tcb)
|
||||
{
|
||||
/* If were were waiting for a timed message queue event, then the
|
||||
* timer was canceled and deleted in task_recover() before this
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* sched/mqueue/mq_release.c
|
||||
*
|
||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -48,7 +48,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_release
|
||||
* Name: nxmq_release
|
||||
*
|
||||
* Description:
|
||||
* This function is called when the final member of a task group exits.
|
||||
|
@ -63,7 +63,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_release(FAR struct task_group_s *group)
|
||||
void nxmq_release(FAR struct task_group_s *group)
|
||||
{
|
||||
while (group->tg_msgdesq.head)
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
* on any failures to verify.
|
||||
*/
|
||||
|
||||
if (mq_verifysend(mqdes, msg, msglen, prio) != OK)
|
||||
if (nxmq_verify_send(mqdes, msg, msglen, prio) != OK)
|
||||
{
|
||||
leave_cancellation_point();
|
||||
return ERROR;
|
||||
|
@ -133,18 +133,18 @@ int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
flags = enter_critical_section();
|
||||
if (up_interrupt_context() || /* In an interrupt handler */
|
||||
msgq->nmsgs < msgq->maxmsgs || /* OR Message queue not full */
|
||||
mq_waitsend(mqdes) == OK) /* OR Successfully waited for mq not full */
|
||||
nxmq_wait_send(mqdes) == OK) /* OR Successfully waited for mq not full */
|
||||
{
|
||||
/* Allocate the message */
|
||||
|
||||
leave_critical_section(flags);
|
||||
mqmsg = mq_msgalloc();
|
||||
mqmsg = nxmq_alloc_msg();
|
||||
|
||||
/* Check if the message was sucessfully allocated */
|
||||
|
||||
if (mqmsg == NULL)
|
||||
{
|
||||
/* No... mq_msgalloc() does not set the errno value */
|
||||
/* No... nxmq_alloc_msg() does not set the errno value */
|
||||
|
||||
set_errno(ENOMEM);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
* - The message queue is full AND
|
||||
* - When we tried waiting, the wait was unsuccessful.
|
||||
*
|
||||
* In this case mq_waitsend() has already set the errno value.
|
||||
* In this case nxmq_wait_send() has already set the errno value.
|
||||
*/
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
@ -175,11 +175,11 @@ int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
*
|
||||
* NOTE: There is a race condition here: What if a message is added by
|
||||
* interrupt related logic so that queue again becomes non-empty.
|
||||
* That is handled because mq_dosend() will permit the maxmsgs limit
|
||||
* That is handled because nxmq_do_send() will permit the maxmsgs limit
|
||||
* to be exceeded in that case.
|
||||
*/
|
||||
|
||||
ret = mq_dosend(mqdes, mqmsg, msg, msglen, prio);
|
||||
ret = nxmq_do_send(mqdes, mqmsg, msg, msglen, prio);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_verifysend
|
||||
* Name: nxmq_verify_send
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_send and mq_timesend.
|
||||
|
@ -92,7 +92,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_verifysend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
||||
int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen,
|
||||
int prio)
|
||||
{
|
||||
/* Verify the input parameters */
|
||||
|
||||
|
@ -118,10 +119,10 @@ int mq_verifysend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_msgalloc
|
||||
* Name: nxmq_alloc_msg
|
||||
*
|
||||
* Description:
|
||||
* The mq_msgalloc function will get a free message for use by the
|
||||
* The nxmq_alloc_msg function will get a free message for use by the
|
||||
* operating system. The message will be allocated from the g_msgfree
|
||||
* list.
|
||||
*
|
||||
|
@ -144,7 +145,7 @@ int mq_verifysend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mqueue_msg_s *mq_msgalloc(void)
|
||||
FAR struct mqueue_msg_s *nxmq_alloc_msg(void)
|
||||
{
|
||||
FAR struct mqueue_msg_s *mqmsg;
|
||||
irqstate_t flags;
|
||||
|
@ -203,7 +204,7 @@ FAR struct mqueue_msg_s *mq_msgalloc(void)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_waitsend
|
||||
* Name: nxmq_wait_send
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_send and mq_timesend.
|
||||
|
@ -223,17 +224,17 @@ FAR struct mqueue_msg_s *mq_msgalloc(void)
|
|||
* (mq_timedsend only).
|
||||
*
|
||||
* Assumptions/restrictions:
|
||||
* - The caller has verified the input parameters using mq_verifysend().
|
||||
* - The caller has verified the input parameters using nxmq_verify_send().
|
||||
* - Executes within a critical section established by the caller.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_waitsend(mqd_t mqdes)
|
||||
int nxmq_wait_send(mqd_t mqdes)
|
||||
{
|
||||
FAR struct tcb_s *rtcb;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
|
||||
/* mq_waitsend() is not a cancellation point, but it is always called from
|
||||
/* nxmq_wait_send() is not a cancellation point, but it is always called from
|
||||
* a cancellation point.
|
||||
*/
|
||||
|
||||
|
@ -314,7 +315,7 @@ int mq_waitsend(mqd_t mqdes)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_dosend
|
||||
* Name: nxmq_do_send
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_send and mq_timesend.
|
||||
|
@ -336,8 +337,8 @@ int mq_waitsend(mqd_t mqdes)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, FAR const char *msg,
|
||||
size_t msglen, int prio)
|
||||
int nxmq_do_send(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR const char *msg, size_t msglen, int prio)
|
||||
{
|
||||
FAR struct tcb_s *btcb;
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_rcvtimeout
|
||||
* Name: nxmq_rcvtimeout
|
||||
*
|
||||
* Description:
|
||||
* This function is called if the timeout elapses before the message queue
|
||||
|
@ -78,7 +78,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void mq_rcvtimeout(int argc, wdparm_t pid)
|
||||
static void nxmq_rcvtimeout(int argc, wdparm_t pid)
|
||||
{
|
||||
FAR struct tcb_s *wtcb;
|
||||
irqstate_t flags;
|
||||
|
@ -103,7 +103,7 @@ static void mq_rcvtimeout(int argc, wdparm_t pid)
|
|||
{
|
||||
/* Restart with task with a timeout error */
|
||||
|
||||
mq_waitirq(wtcb, ETIMEDOUT);
|
||||
nxmq_wait_irq(wtcb, ETIMEDOUT);
|
||||
}
|
||||
|
||||
/* Interrupts may now be re-enabled. */
|
||||
|
@ -183,7 +183,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
* errno appropriately.
|
||||
*/
|
||||
|
||||
if (mq_verifyreceive(mqdes, msg, msglen) != OK)
|
||||
if (nxmq_verify_receive(mqdes, msg, msglen) != OK)
|
||||
{
|
||||
leave_cancellation_point();
|
||||
return ERROR;
|
||||
|
@ -218,7 +218,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
sched_lock();
|
||||
|
||||
/* Furthermore, mq_waitreceive() expects to have interrupts disabled
|
||||
/* Furthermore, nxmq_wait_receive() expects to have interrupts disabled
|
||||
* because messages can be sent from interrupt level.
|
||||
*/
|
||||
|
||||
|
@ -264,12 +264,13 @@ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
/* Start the watchdog */
|
||||
|
||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)mq_rcvtimeout, 1, getpid());
|
||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_rcvtimeout,
|
||||
1, getpid());
|
||||
}
|
||||
|
||||
/* Get the message from the message queue */
|
||||
|
||||
mqmsg = mq_waitreceive(mqdes);
|
||||
mqmsg = nxmq_wait_receive(mqdes);
|
||||
|
||||
/* Stop the watchdog timer (this is not harmful in the case where
|
||||
* it was never started)
|
||||
|
@ -291,7 +292,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
|
|||
|
||||
if (mqmsg)
|
||||
{
|
||||
ret = mq_doreceive(mqdes, mqmsg, msg, prio);
|
||||
ret = nxmq_do_receive(mqdes, mqmsg, msg, prio);
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_sndtimeout
|
||||
* Name: nxmq_sndtimeout
|
||||
*
|
||||
* Description:
|
||||
* This function is called if the timeout elapses before the message queue
|
||||
|
@ -78,7 +78,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void mq_sndtimeout(int argc, wdparm_t pid)
|
||||
static void nxmq_sndtimeout(int argc, wdparm_t pid)
|
||||
{
|
||||
FAR struct tcb_s *wtcb;
|
||||
irqstate_t flags;
|
||||
|
@ -103,7 +103,7 @@ static void mq_sndtimeout(int argc, wdparm_t pid)
|
|||
{
|
||||
/* Restart with task with a timeout error */
|
||||
|
||||
mq_waitirq(wtcb, ETIMEDOUT);
|
||||
nxmq_wait_irq(wtcb, ETIMEDOUT);
|
||||
}
|
||||
|
||||
/* Interrupts may now be re-enabled. */
|
||||
|
@ -187,9 +187,9 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
* on any failures to verify.
|
||||
*/
|
||||
|
||||
if (mq_verifysend(mqdes, msg, msglen, prio) != OK)
|
||||
if (nxmq_verify_send(mqdes, msg, msglen, prio) != OK)
|
||||
{
|
||||
/* mq_verifysend() will set the errno appropriately */
|
||||
/* nxmq_verify_send() will set the errno appropriately */
|
||||
|
||||
leave_cancellation_point();
|
||||
return ERROR;
|
||||
|
@ -197,10 +197,10 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
|
||||
/* Pre-allocate a message structure */
|
||||
|
||||
mqmsg = mq_msgalloc();
|
||||
mqmsg = nxmq_alloc_msg();
|
||||
if (mqmsg == NULL)
|
||||
{
|
||||
/* Failed to allocate the message. mq_msgalloc() does not set the
|
||||
/* Failed to allocate the message. nxmq_alloc_msg() does not set the
|
||||
* errno value.
|
||||
*/
|
||||
|
||||
|
@ -224,17 +224,17 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
*
|
||||
* NOTE: There is a race condition here: What if a message is added by
|
||||
* interrupt related logic so that queue again becomes non-empty. That
|
||||
* is handled because mq_dosend() will permit the maxmsgs limit to be
|
||||
* is handled because nxmq_do_send() will permit the maxmsgs limit to be
|
||||
* exceeded in that case.
|
||||
*/
|
||||
|
||||
if (msgq->nmsgs < msgq->maxmsgs || up_interrupt_context())
|
||||
{
|
||||
/* Do the send with no further checks (possibly exceeding maxmsgs)
|
||||
* Currently mq_dosend() always returns OK.
|
||||
* Currently nxmq_do_send() always returns OK.
|
||||
*/
|
||||
|
||||
ret = mq_dosend(mqdes, mqmsg, msg, msglen, prio);
|
||||
ret = nxmq_do_send(mqdes, mqmsg, msg, msglen, prio);
|
||||
sched_unlock();
|
||||
leave_cancellation_point();
|
||||
return ret;
|
||||
|
@ -290,11 +290,11 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
|
||||
/* Start the watchdog and begin the wait for MQ not full */
|
||||
|
||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)mq_sndtimeout, 1, getpid());
|
||||
wd_start(rtcb->waitdog, ticks, (wdentry_t)nxmq_sndtimeout, 1, getpid());
|
||||
|
||||
/* And wait for the message queue to be non-empty */
|
||||
|
||||
ret = mq_waitsend(mqdes);
|
||||
ret = nxmq_wait_send(mqdes);
|
||||
|
||||
/* This may return with an error and errno set to either EINTR
|
||||
* or ETIMEOUT. Cancel the watchdog timer in any event.
|
||||
|
@ -302,11 +302,11 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
|
||||
wd_cancel(rtcb->waitdog);
|
||||
|
||||
/* Check if mq_waitsend() failed */
|
||||
/* Check if nxmq_wait_send() failed */
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
/* mq_waitsend() will set the errno, but the error exit will reset it */
|
||||
/* nxmq_wait_send() will set the errno, but the error exit will reset it */
|
||||
|
||||
result = get_errno();
|
||||
goto errout_in_critical_section;
|
||||
|
@ -320,10 +320,10 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
|
|||
* be space for another message in the message queue. NOW we can allocate
|
||||
* the message structure.
|
||||
*
|
||||
* Currently mq_dosend() always returns OK.
|
||||
* Currently nxmq_do_send() always returns OK.
|
||||
*/
|
||||
|
||||
ret = mq_dosend(mqdes, mqmsg, msg, msglen, prio);
|
||||
ret = nxmq_do_send(mqdes, mqmsg, msg, msglen, prio);
|
||||
|
||||
sched_unlock();
|
||||
wd_delete(rtcb->waitdog);
|
||||
|
@ -346,7 +346,7 @@ errout_in_critical_section:
|
|||
*/
|
||||
|
||||
errout_with_mqmsg:
|
||||
mq_msgfree(mqmsg);
|
||||
nxmq_free_msg(mqmsg);
|
||||
sched_unlock();
|
||||
|
||||
set_errno(result);
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mq_waitirq
|
||||
* Name: nxmq_wait_irq
|
||||
*
|
||||
* Description:
|
||||
* This function is called when a signal or a timeout is received by a
|
||||
|
@ -71,7 +71,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mq_waitirq(FAR struct tcb_s *wtcb, int errcode)
|
||||
void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode)
|
||||
{
|
||||
FAR struct mqueue_inode_s *msgq;
|
||||
irqstate_t flags;
|
||||
|
|
|
@ -141,38 +141,36 @@ struct task_group_s; /* Forward reference */
|
|||
|
||||
/* Functions defined in mq_initialize.c ************************************/
|
||||
|
||||
void weak_function mq_initialize(void);
|
||||
void mq_desblockalloc(void);
|
||||
|
||||
FAR struct mqueue_inode_s *mq_findnamed(FAR const char *mq_name);
|
||||
void mq_msgfree(FAR struct mqueue_msg_s *mqmsg);
|
||||
void weak_function nxmq_initialize(void);
|
||||
void nxmq_alloc_desblock(void);
|
||||
void nxmq_free_msg(FAR struct mqueue_msg_s *mqmsg);
|
||||
|
||||
/* mq_waitirq.c ************************************************************/
|
||||
|
||||
void mq_waitirq(FAR struct tcb_s *wtcb, int errcode);
|
||||
void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode);
|
||||
|
||||
/* mq_rcvinternal.c ********************************************************/
|
||||
|
||||
int mq_verifyreceive(mqd_t mqdes, FAR char *msg, size_t msglen);
|
||||
FAR struct mqueue_msg_s *mq_waitreceive(mqd_t mqdes);
|
||||
ssize_t mq_doreceive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR char *ubuffer, FAR int *prio);
|
||||
int nxmq_verify_receive(mqd_t mqdes, FAR char *msg, size_t msglen);
|
||||
FAR struct mqueue_msg_s *nxmq_wait_receive(mqd_t mqdes);
|
||||
ssize_t nxmq_do_receive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR char *ubuffer, FAR int *prio);
|
||||
|
||||
/* mq_sndinternal.c ********************************************************/
|
||||
|
||||
int mq_verifysend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio);
|
||||
FAR struct mqueue_msg_s *mq_msgalloc(void);
|
||||
int mq_waitsend(mqd_t mqdes);
|
||||
int mq_dosend(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR const char *msg, size_t msglen, int prio);
|
||||
int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio);
|
||||
FAR struct mqueue_msg_s *nxmq_alloc_msg(void);
|
||||
int nxmq_wait_send(mqd_t mqdes);
|
||||
int nxmq_do_send(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg,
|
||||
FAR const char *msg, size_t msglen, int prio);
|
||||
|
||||
/* mq_release.c ************************************************************/
|
||||
|
||||
void mq_release(FAR struct task_group_s *group);
|
||||
void nxmq_release(FAR struct task_group_s *group);
|
||||
|
||||
/* mq_recover.c ************************************************************/
|
||||
|
||||
void mq_recover(FAR struct tcb_s *tcb);
|
||||
void nxmq_recover(FAR struct tcb_s *tcb);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1113,7 +1113,7 @@ void nxsem_restorebaseprio(FAR struct tcb_s *stcb, FAR sem_t *sem)
|
|||
* Name: nxsem_canceled
|
||||
*
|
||||
* Description:
|
||||
* Called from nxsem_waitirq() after a thread that was waiting for a semaphore
|
||||
* Called from nxsem_wait_irq() after a thread that was waiting for a semaphore
|
||||
* count was awakened because of a signal and the semaphore wait has been
|
||||
* cancelled. This function restores the correct thread priority of each
|
||||
* holder of the semaphore.
|
||||
|
|
|
@ -81,7 +81,7 @@ void nxsem_recover(FAR struct tcb_s *tcb)
|
|||
|
||||
/* The task is being deleted. If it is waiting for a semphore, then
|
||||
* increment the count on the semaphores. This logic is almost identical
|
||||
* to what you see in nxsem_waitirq() except that no attempt is made to
|
||||
* to what you see in nxsem_wait_irq() except that no attempt is made to
|
||||
* restart the exiting task.
|
||||
*
|
||||
* NOTE: In the case that the task is waiting we can assume: (1) That the
|
||||
|
|
|
@ -94,7 +94,7 @@ void nxsem_timeout(int argc, wdparm_t pid)
|
|||
{
|
||||
/* Cancel the semaphore wait */
|
||||
|
||||
nxsem_waitirq(wtcb, ETIMEDOUT);
|
||||
nxsem_wait_irq(wtcb, ETIMEDOUT);
|
||||
}
|
||||
|
||||
/* Interrupts may now be enabled. */
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsem_waitirq
|
||||
* Name: nxsem_wait_irq
|
||||
*
|
||||
* Description:
|
||||
* This function is called when either:
|
||||
|
@ -77,7 +77,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxsem_waitirq(FAR struct tcb_s *wtcb, int errcode)
|
||||
void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ void nxsem_initialize(void);
|
|||
|
||||
/* Wake up a thread that is waiting on semaphore */
|
||||
|
||||
void nxsem_waitirq(FAR struct tcb_s *wtcb, int errcode);
|
||||
void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode);
|
||||
|
||||
/* Handle semaphore timer expiration */
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
|
|||
|
||||
if (stcb->task_state == TSTATE_WAIT_SEM)
|
||||
{
|
||||
nxsem_waitirq(stcb, EINTR);
|
||||
nxsem_wait_irq(stcb, EINTR);
|
||||
}
|
||||
|
||||
/* If the task is blocked waiting on a message queue, then that task
|
||||
|
@ -420,7 +420,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
|
|||
if (stcb->task_state == TSTATE_WAIT_MQNOTEMPTY ||
|
||||
stcb->task_state == TSTATE_WAIT_MQNOTFULL)
|
||||
{
|
||||
mq_waitirq(stcb, EINTR);
|
||||
nxmq_wait_irq(stcb, EINTR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ void notify_cancellation(FAR struct tcb_s *tcb)
|
|||
|
||||
if (tcb->task_state == TSTATE_WAIT_SEM)
|
||||
{
|
||||
nxsem_waitirq(tcb, ECANCELED);
|
||||
nxsem_wait_irq(tcb, ECANCELED);
|
||||
}
|
||||
|
||||
/* If the thread is blocked waiting on a message queue, then the
|
||||
|
@ -313,7 +313,7 @@ void notify_cancellation(FAR struct tcb_s *tcb)
|
|||
if (tcb->task_state == TSTATE_WAIT_MQNOTEMPTY ||
|
||||
tcb->task_state == TSTATE_WAIT_MQNOTFULL)
|
||||
{
|
||||
mq_waitirq(tcb, ECANCELED);
|
||||
nxmq_wait_irq(tcb, ECANCELED);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void task_recover(FAR struct tcb_s *tcb)
|
|||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
/* Handle cases where the thread was waiting for a message queue event */
|
||||
|
||||
mq_recover(tcb);
|
||||
nxmq_recover(tcb);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_SPORADIC
|
||||
|
|
Loading…
Reference in a new issue