summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mqueueopen.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-09 13:18:32 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-10 08:55:10 +0100
commitf0ff18e03572debbbe7dc0132cf54a0eb03f0276 (patch)
treea3bc877513cb3414de45bb9bf11b11a133dc8d0c /cpukit/posix/src/mqueueopen.c
parentcpukit/libmisc/fsmount/fsmount.h: Remove duplicate comments and copyright (diff)
downloadrtems-f0ff18e03572debbbe7dc0132cf54a0eb03f0276.tar.bz2
score: Add rtems_set_errno_and_return_value()
Remove rtems_set_errno_and_return_minus_one_cast().
Diffstat (limited to 'cpukit/posix/src/mqueueopen.c')
-rw-r--r--cpukit/posix/src/mqueueopen.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c
index 43e4082b63..96721d1f8e 100644
--- a/cpukit/posix/src/mqueueopen.c
+++ b/cpukit/posix/src/mqueueopen.c
@@ -44,6 +44,8 @@
#include <rtems/posix/time.h>
#include <rtems/seterr.h>
+#define MQ_OPEN_FAILED ((mqd_t) -1)
+
/*
* 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
*/
@@ -82,7 +84,7 @@ mqd_t mq_open(
the_mq_fd = _POSIX_Message_queue_Allocate_fd();
if ( !the_mq_fd ) {
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_minus_one( ENFILE );
+ rtems_set_errno_and_return_value( ENFILE, MQ_OPEN_FAILED );
}
the_mq_fd->oflag = oflag;
@@ -102,7 +104,7 @@ mqd_t mq_open(
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
_POSIX_Message_queue_Free_fd( the_mq_fd );
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_minus_one_cast( status, mqd_t );
+ rtems_set_errno_and_return_value( status, MQ_OPEN_FAILED );
}
} else { /* name -> ID translation succeeded */
@@ -112,7 +114,7 @@ mqd_t mq_open(
if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
_POSIX_Message_queue_Free_fd( the_mq_fd );
_Objects_Allocator_unlock();
- rtems_set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
+ rtems_set_errno_and_return_value( EEXIST, MQ_OPEN_FAILED );
}
/*
@@ -129,7 +131,7 @@ mqd_t mq_open(
);
_Thread_Enable_dispatch();
_Objects_Allocator_unlock();
- return (mqd_t)the_mq_fd->Object.id;
+ return the_mq_fd->Object.id;
}
@@ -151,7 +153,7 @@ mqd_t mq_open(
if ( status == -1 ) {
_POSIX_Message_queue_Free_fd( the_mq_fd );
_Objects_Allocator_unlock();
- return (mqd_t) -1;
+ return MQ_OPEN_FAILED;
}
the_mq_fd->Queue = the_mq;
@@ -163,5 +165,5 @@ mqd_t mq_open(
_Objects_Allocator_unlock();
- return (mqd_t) the_mq_fd->Object.id;
+ return the_mq_fd->Object.id;
}