diff --git a/sched/mq_descreate.c b/sched/mq_descreate.c index 69ddf999c2..47b9397d5e 100644 --- a/sched/mq_descreate.c +++ b/sched/mq_descreate.c @@ -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 * * 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 /* va_list */ #include @@ -53,27 +53,27 @@ #include #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) { diff --git a/sched/mq_open.c b/sched/mq_open.c index 8290aa0d2a..2179178d04 100644 --- a/sched/mq_open.c +++ b/sched/mq_open.c @@ -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 * * 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 /* uint32, etc. */ #include /* 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 */ diff --git a/sched/mq_rcvinternal.c b/sched/mq_rcvinternal.c index 853ac0bc1e..7440943222 100644 --- a/sched/mq_rcvinternal.c +++ b/sched/mq_rcvinternal.c @@ -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 * * 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 #include /* 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) {