git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@589 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-01-30 14:01:22 +00:00
parent 715cc89148
commit 59451ae6c0
3 changed files with 74 additions and 74 deletions

View file

@ -1,7 +1,7 @@
/************************************************************
/****************************************************************************
* mq_descreate.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <stdarg.h> /* va_list */
#include <unistd.h>
@ -53,27 +53,27 @@
#include <nuttx/kmalloc.h>
#include "mq_internal.h"
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: mq_desalloc
*
* Description:
@ -85,7 +85,7 @@
* Return Value:
* Reference to the allocated mq descriptor.
*
************************************************************/
****************************************************************************/
static mqd_t mq_desalloc(void)
{
@ -111,11 +111,11 @@ static mqd_t mq_desalloc(void)
return mqdes;
}
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: mq_descreate
*
* Description:
@ -129,7 +129,7 @@ static mqd_t mq_desalloc(void)
* Return Value:
*
*
************************************************************/
****************************************************************************/
mqd_t mq_descreate(FAR _TCB* mtcb, FAR msgq_t* msgq, int oflags)
{

View file

@ -1,7 +1,7 @@
/************************************************************
/****************************************************************************
* mq_open.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <sys/types.h> /* uint32, etc. */
#include <stdarg.h> /* va_list */
@ -49,31 +49,31 @@
#include "os_internal.h"
#include "mq_internal.h"
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: mq_open
*
* Description:
@ -100,7 +100,7 @@
*
* Assumptions:
*
************************************************************/
****************************************************************************/
mqd_t mq_open(const char *mq_name, int oflags, ...)
{
@ -125,11 +125,11 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
msgq = mq_findnamed(mq_name);
if (msgq)
{
/* It does. Check if the caller wanted to create
* a new message queue with this name.
/* It does. Check if the caller wanted to create a new
* message queue with this name (i.e., O_CREAT|O_EXCL)
*/
if (!(oflags & O_CREAT) || !(oflags & O_EXCL))
if ((oflags & O_CREAT) == 0 || (oflags & O_EXCL) == 0)
{
/* Create a message queue descriptor for the TCB */

View file

@ -1,7 +1,7 @@
/************************************************************
* mq_rcvinternal.c
/****************************************************************************
* sched/mq_rcvinternal.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <sys/types.h>
#include <fcntl.h> /* O_NONBLOCK */
@ -49,31 +49,31 @@
#include "os_internal.h"
#include "mq_internal.h"
/************************************************************
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Type Declarations
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Global Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Variables
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Name: mq_verifyreceive
*
* Description:
@ -97,7 +97,7 @@
*
* Assumptions:
*
************************************************************/
****************************************************************************/
int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen)
{
@ -124,7 +124,7 @@ int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen)
return OK;
}
/************************************************************
/****************************************************************************
* Function: mq_waitreceive
*
* Description:
@ -150,7 +150,7 @@ int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen)
* - For mq_timedreceive, setting of the timer and this wait
* must be atomic.
*
************************************************************/
****************************************************************************/
FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
{
@ -166,13 +166,13 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
while ((rcvmsg = (FAR mqmsg_t*)sq_remfirst(&msgq->msglist)) == NULL)
{
/* Should we block until there the above condition has been
* satisfied?
/* The queue is empty! Should we block until there the above condition
* has been satisfied?
*/
if (!(mqdes->oflags & O_NONBLOCK))
if ((mqdes->oflags & O_NONBLOCK) == 0)
{
/* Block and try again */
/* Yes.. Block and try again */
rtcb = (FAR _TCB*)g_readytorun.head;
rtcb->msgwaitq = msgq;
@ -214,7 +214,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
return rcvmsg;
}
/************************************************************
/****************************************************************************
* Function: mq_doreceive
*
* Description:
@ -245,7 +245,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
* message queue
* - Pre-emption should be disabled throughout this call.
*
************************************************************/
****************************************************************************/
ssize_t mq_doreceive(mqd_t mqdes, mqmsg_t *mqmsg, void *ubuffer, int *prio)
{