Changeset f0ff18e in rtems


Ignore:
Timestamp:
Mar 9, 2015, 12:18:32 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
60bded9
Parents:
34e0a569
git-author:
Sebastian Huber <sebastian.huber@…> (03/09/15 12:18:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/10/15 07:55:10)
Message:

score: Add rtems_set_errno_and_return_value()

Remove rtems_set_errno_and_return_minus_one_cast().

Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/mqueueopen.c

    r34e0a569 rf0ff18e  
    4545#include <rtems/seterr.h>
    4646
     47#define MQ_OPEN_FAILED ((mqd_t) -1)
     48
    4749/*
    4850 *  15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
     
    8385  if ( !the_mq_fd ) {
    8486    _Objects_Allocator_unlock();
    85     rtems_set_errno_and_return_minus_one( ENFILE );
     87    rtems_set_errno_and_return_value( ENFILE, MQ_OPEN_FAILED );
    8688  }
    8789  the_mq_fd->oflag = oflag;
     
    103105      _POSIX_Message_queue_Free_fd( the_mq_fd );
    104106      _Objects_Allocator_unlock();
    105       rtems_set_errno_and_return_minus_one_cast( status, mqd_t );
     107      rtems_set_errno_and_return_value( status, MQ_OPEN_FAILED );
    106108    }
    107109
     
    113115      _POSIX_Message_queue_Free_fd( the_mq_fd );
    114116      _Objects_Allocator_unlock();
    115       rtems_set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
     117      rtems_set_errno_and_return_value( EEXIST, MQ_OPEN_FAILED );
    116118    }
    117119
     
    130132    _Thread_Enable_dispatch();
    131133    _Objects_Allocator_unlock();
    132     return (mqd_t)the_mq_fd->Object.id;
     134    return the_mq_fd->Object.id;
    133135
    134136  }
     
    152154    _POSIX_Message_queue_Free_fd( the_mq_fd );
    153155    _Objects_Allocator_unlock();
    154     return (mqd_t) -1;
     156    return MQ_OPEN_FAILED;
    155157  }
    156158
     
    164166  _Objects_Allocator_unlock();
    165167
    166   return (mqd_t) the_mq_fd->Object.id;
     168  return the_mq_fd->Object.id;
    167169}
  • cpukit/posix/src/semopen.c

    r34e0a569 rf0ff18e  
    9393    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
    9494      _Objects_Allocator_unlock();
    95       rtems_set_errno_and_return_minus_one_cast( status, sem_t * );
     95      rtems_set_errno_and_return_value( status, SEM_FAILED );
    9696    }
    9797  } else {
     
    103103    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
    104104      _Objects_Allocator_unlock();
    105       rtems_set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
     105      rtems_set_errno_and_return_value( EEXIST, SEM_FAILED );
    106106    }
    107107
  • cpukit/score/include/rtems/seterr.h

    r34e0a569 rf0ff18e  
    3232/**
    3333 *  This is a helper macro which will set the variable errno and return
    34  *  -1 to the caller.  This pattern is common to many POSIX methods.
     34 *  the specified value to the caller.
    3535 *
    3636 *  @param[in] _error is the error code
     37 *  @param[in] _value is the value to return
    3738 */
    38 #define rtems_set_errno_and_return_minus_one( _error ) \
    39   do { errno = (_error); return -1; } while(0)
     39#define rtems_set_errno_and_return_value( _error, _value ) \
     40  do { errno = ( _error ); return ( _value ); } while ( 0 )
    4041
    4142/**
     
    4445 *
    4546 *  @param[in] _error is the error code
    46  *  @param[in] _cast is the type to which -1 must be cast
    47  *
    48  *  @note It is similar to @ref rtems_set_errno_and_return_minus_one but
    49  *        this -1 value is cast to something other than an int.
    5047 */
    51 #define rtems_set_errno_and_return_minus_one_cast( _error, _cast ) \
    52   do { errno = (_error); return (_cast) -1; } while(0)
     48#define rtems_set_errno_and_return_minus_one( _error ) \
     49  rtems_set_errno_and_return_value( _error, -1 )
    5350
    5451/**@}*/
Note: See TracChangeset for help on using the changeset viewer.