diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-09 13:18:32 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-10 08:55:10 +0100 |
commit | f0ff18e03572debbbe7dc0132cf54a0eb03f0276 (patch) | |
tree | a3bc877513cb3414de45bb9bf11b11a133dc8d0c /cpukit/posix | |
parent | cpukit/libmisc/fsmount/fsmount.h: Remove duplicate comments and copyright (diff) | |
download | rtems-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')
-rw-r--r-- | cpukit/posix/src/mqueueopen.c | 14 | ||||
-rw-r--r-- | cpukit/posix/src/semopen.c | 4 |
2 files changed, 10 insertions, 8 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; } diff --git a/cpukit/posix/src/semopen.c b/cpukit/posix/src/semopen.c index 0b98ca60f9..0568ee69ec 100644 --- a/cpukit/posix/src/semopen.c +++ b/cpukit/posix/src/semopen.c @@ -92,7 +92,7 @@ sem_t *sem_open( if ( !( status == ENOENT && (oflag & O_CREAT) ) ) { _Objects_Allocator_unlock(); - rtems_set_errno_and_return_minus_one_cast( status, sem_t * ); + rtems_set_errno_and_return_value( status, SEM_FAILED ); } } else { @@ -102,7 +102,7 @@ sem_t *sem_open( if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { _Objects_Allocator_unlock(); - rtems_set_errno_and_return_minus_one_cast( EEXIST, sem_t * ); + rtems_set_errno_and_return_value( EEXIST, SEM_FAILED ); } the_semaphore = _POSIX_Semaphore_Get( (sem_t *) &the_semaphore_id, &location ); |