diff --git a/lib/stdio/lib_syslogstream.c b/lib/stdio/lib_syslogstream.c index 9cfb1536757..a3fa5546dc3 100644 --- a/lib/stdio/lib_syslogstream.c +++ b/lib/stdio/lib_syslogstream.c @@ -78,7 +78,7 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch) * Name: lib_syslogstream * * Description: - * Initializes a stream for use with the coinfigured syslog interface. + * Initializes a stream for use with the configured syslog interface. * * Input parameters: * lowoutstream - User allocated, uninitialized instance of struct diff --git a/sched/mq_rcvinternal.c b/sched/mq_rcvinternal.c index 74409432220..8ec066da898 100644 --- a/sched/mq_rcvinternal.c +++ b/sched/mq_rcvinternal.c @@ -1,8 +1,8 @@ /**************************************************************************** * sched/mq_rcvinternal.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,15 +37,19 @@ * Included Files ****************************************************************************/ +#include + #include -#include /* O_NONBLOCK */ +#include #include #include #include #include #include #include + #include + #include "os_internal.h" #include "mq_internal.h" @@ -105,19 +109,19 @@ int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen) if (!msg || !mqdes) { - *get_errno_ptr() = EINVAL; + set_errno(EINVAL); return ERROR; } if ((mqdes->oflags & O_RDOK) == 0) { - *get_errno_ptr() = EPERM; + set_errno(EPERM); return ERROR; } if (msglen < (size_t)mqdes->msgq->maxmsgsize) { - *get_errno_ptr() = EMSGSIZE; + set_errno(EMSGSIZE); return ERROR; } @@ -178,7 +182,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes) rtcb->msgwaitq = msgq; msgq->nwaitnotempty++; - *get_errno_ptr() = OK; + set_errno(OK); up_block_task(rtcb, TSTATE_WAIT_MQNOTEMPTY); /* When we resume at this point, either (1) the message queue @@ -187,7 +191,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes) * errno value (should be either EINTR or ETIMEDOUT). */ - if (*get_errno_ptr() != OK) + if (get_errno() != OK) { break; } @@ -198,7 +202,7 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes) * message queue description referred to by 'mqdes'. */ - *get_errno_ptr() = EAGAIN; + set_errno(EAGAIN); break; } } diff --git a/sched/mq_send.c b/sched/mq_send.c index 3a228403397..921ff7fccaf 100644 --- a/sched/mq_send.c +++ b/sched/mq_send.c @@ -2,7 +2,7 @@ * sched/mq_send.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,11 +38,14 @@ ****************************************************************************/ #include + #include #include #include #include + #include + #include "os_internal.h" #include "mq_internal.h" diff --git a/sched/mq_sndinternal.c b/sched/mq_sndinternal.c index b359f6f17ab..3d9c8876993 100644 --- a/sched/mq_sndinternal.c +++ b/sched/mq_sndinternal.c @@ -2,7 +2,7 @@ * sched/mq_send.c * * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -417,6 +417,7 @@ int mq_dosend(mqd_t mqdes, FAR mqmsg_t *mqmsg, const void *msg, size_t msglen, i #endif } #endif + /* Check if any tasks are waiting for the MQ not empty event. */ saved_state = irqsave(); @@ -445,6 +446,7 @@ int mq_dosend(mqd_t mqdes, FAR mqmsg_t *mqmsg, const void *msg, size_t msglen, i up_unblock_task(btcb); } } + irqrestore(saved_state); sched_unlock(); return OK;