Changeset 3507c6df in rtems


Ignore:
Timestamp:
Jan 5, 2009, 8:26:01 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
eaef4657
Parents:
449ba1b
Message:

2009-01-05 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/gxx_wrappers.c, posix/include/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/key.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, posix/src/condget.c, posix/src/mqueuenametoid.c, posix/src/mutexget.c, posix/src/semaphorenametoid.c, posix/src/semopen.c, sapi/src/itronapi.c, sapi/src/posixapi.c: Make changes necessary for all tests to run on SPARC with 16-bit Ids. This required ensuring that all POSIX and compilering binding code makes a distinction between the public Id type (e.g. pthread_t, etc.) and the RTEMS Object_Id type. All POSIX Object Get routines should not take the POSIX Id type as the argument. Sixteen bit RTEMS Ids should be placed into the 32-bits reserved by the POSIX API type in a uniform manner now. This removed all assumptions that the external Id types in POSIX and ITRON are the same as the internal Object Id type.
Location:
cpukit
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r449ba1b r3507c6df  
     12009-01-05      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libcsupport/src/gxx_wrappers.c, posix/include/mqueue.h,
     4        posix/include/rtems/posix/semaphore.h,
     5        posix/inline/rtems/posix/barrier.inl,
     6        posix/inline/rtems/posix/key.inl,
     7        posix/inline/rtems/posix/mqueue.inl,
     8        posix/inline/rtems/posix/rwlock.inl,
     9        posix/inline/rtems/posix/semaphore.inl,
     10        posix/inline/rtems/posix/spinlock.inl,
     11        posix/inline/rtems/posix/timer.inl, posix/src/condget.c,
     12        posix/src/mqueuenametoid.c, posix/src/mutexget.c,
     13        posix/src/semaphorenametoid.c, posix/src/semopen.c,
     14        sapi/src/itronapi.c, sapi/src/posixapi.c: Make changes necessary for
     15        all tests to run on SPARC with 16-bit Ids. This required ensuring
     16        that all POSIX and compilering binding code makes a distinction
     17        between the public Id type (e.g. pthread_t, etc.) and the RTEMS
     18        Object_Id type. All POSIX Object Get routines should not take the
     19        POSIX Id type as the argument. Sixteen bit RTEMS Ids should be placed
     20        into the 32-bits reserved by the POSIX API type in a uniform manner
     21        now. This removed all assumptions that the external Id types in POSIX
     22        and ITRON are the same as the internal Object Id type.
     23
    1242009-01-05      Joel Sherrill <joel.sherrill@oarcorp.com>
    225
  • cpukit/libcsupport/src/gxx_wrappers.c

    r449ba1b r3507c6df  
    210210  printk( "gxx_wrappers: lock mutex=%X\n", *mutex );
    211211#endif
    212   return ( rtems_semaphore_obtain( (rtems_id)*mutex,
     212  return ( rtems_semaphore_obtain( *(rtems_id *)mutex,
    213213            RTEMS_WAIT, RTEMS_NO_TIMEOUT ) ==  RTEMS_SUCCESSFUL) ? 0 : -1;
    214214}
     
    219219  printk( "gxx_wrappers: destroy mutex=%X\n", *mutex );
    220220#endif
    221   return ( rtems_semaphore_delete((rtems_id)*mutex)
     221  return ( rtems_semaphore_delete(*(rtems_id *)mutex)
    222222             ==  RTEMS_SUCCESSFUL) ? 0 : -1;
    223223}
     
    228228  printk( "gxx_wrappers: trylock mutex=%X\n", *mutex );
    229229#endif
    230   return (rtems_semaphore_obtain ((rtems_id)*mutex,
     230  return (rtems_semaphore_obtain (*(rtems_id *)mutex,
    231231               RTEMS_NO_WAIT, 0) == RTEMS_SUCCESSFUL) ? 0 : -1;
    232232}
     
    237237   printk( "gxx_wrappers: unlock mutex=%X\n", *mutex );
    238238#endif
    239   return (rtems_semaphore_release( (rtems_id)*mutex ) ==  RTEMS_SUCCESSFUL) ? 0 :-1;
     239  return (rtems_semaphore_release( *(rtems_id *)mutex )
     240      == RTEMS_SUCCESSFUL) ? 0 :-1;
    240241}
    241242
  • cpukit/posix/include/mqueue.h

    r449ba1b r3507c6df  
    3535
    3636/**
    37  *  Message queue id type
     37 *  Message queue id type.
     38 *
     39 *  @note Use uint32_t since all POSIX Ids are 32-bit currently.
    3840 */
    39 typedef Objects_Id  mqd_t;
     41typedef uint32_t  mqd_t;
    4042
    4143/**
  • cpukit/posix/include/rtems/posix/semaphore.h

    r449ba1b r3507c6df  
    4141   uint32_t                open_count;
    4242   CORE_semaphore_Control  Semaphore;
     43   /*
     44    *  sem_t is 32-bit.  If Object_Id is 16-bit, then they are not
     45    *  interchangeable.  We have to be able to return a pointer to
     46    *  a 32-bit form of the 16-bit Id.
     47    */
     48   #if defined(RTEMS_USE_16_BIT_OBJECT)
     49     sem_t                 Semaphore_id;
     50   #endif
    4351}  POSIX_Semaphore_Control;
    4452
  • cpukit/posix/inline/rtems/posix/barrier.inl

    r449ba1b r3507c6df  
    6969  return (POSIX_Barrier_Control *) _Objects_Get(
    7070      &_POSIX_Barrier_Information,
    71       *((Objects_Id *)barrier),
     71      (Objects_Id) *barrier,
    7272      location
    7373  );
  • cpukit/posix/inline/rtems/posix/key.inl

    r449ba1b r3507c6df  
    11/**
    2  * @file rtems/posix/key.inl
    3  */
    4 
    5 /*  rtems/posix/key.inl
     2 *  @file rtems/posix/key.inl
    63 *
    74 *  This include file contains the static inline implementation of the private
    85 *  inlined routines for POSIX key's.
    9  *
     6 */
     7
     8/*
    109 *  COPYRIGHT (c) 1989-1999.
    1110 *  On-Line Applications Research Corporation (OAR).
     
    2524#define _RTEMS_POSIX_KEY_INL
    2625 
    27 /*PAGE
     26/**
     27 *  @brief _POSIX_Keys_Allocate
    2828 *
    29  *  _POSIX_Keys_Allocate
     29 *  This function allocates a keys control block from
     30 *  the inactive chain of free keys control blocks.
    3031 */
    3132 
     
    3536}
    3637 
    37 /*PAGE
     38/**
     39 *  @brief _POSIX_Keys_Free
    3840 *
    39  *  _POSIX_Keys_Free
     41 *  This routine frees a keys control block to the
     42 *  inactive chain of free keys control blocks.
    4043 */
    41  
    4244RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
    4345  POSIX_Keys_Control *the_key
     
    4749}
    4850 
    49 /*PAGE
     51/**
     52 *  @brief _POSIX_Keys_Get
    5053 *
    51  *  _POSIX_Keys_Get
     54 *  This function maps key IDs to key control blocks.
     55 *  If ID corresponds to a local keys, then it returns
     56 *  the_key control pointer which maps to ID and location
     57 *  is set to OBJECTS_LOCAL.  if the keys ID is global and
     58 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
     59 *  and the_key is undefined.  Otherwise, location is set
     60 *  to OBJECTS_ERROR and the_key is undefined.
    5261 */
    5362 
    5463RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
    55   Objects_Id         id,
     64  pthread_key_t      id,
    5665  Objects_Locations *location
    5766)
    5867{
    5968  return (POSIX_Keys_Control *)
    60     _Objects_Get( &_POSIX_Keys_Information, id, location );
     69    _Objects_Get( &_POSIX_Keys_Information, (Objects_Id) id, location );
    6170}
    6271 
    63 /*PAGE
     72/**
     73 *  @brief _POSIX_Keys_Is_null
    6474 *
    65  *  _POSIX_Keys_Is_null
     75 *  This function returns TRUE if the_key is NULL and FALSE otherwise.
    6676 */
    67  
    6877RTEMS_INLINE_ROUTINE bool _POSIX_Keys_Is_null (
    6978  POSIX_Keys_Control *the_key
  • cpukit/posix/inline/rtems/posix/mqueue.inl

    r449ba1b r3507c6df  
    106106 
    107107RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control_fd *_POSIX_Message_queue_Get_fd (
    108   Objects_Id         id,
     108  mqd_t              id,
    109109  Objects_Locations *location
    110110)
    111111{
    112   return (POSIX_Message_queue_Control_fd *)
    113     _Objects_Get( &_POSIX_Message_queue_Information_fds, id, location );
     112  return (POSIX_Message_queue_Control_fd *) _Objects_Get(
     113    &_POSIX_Message_queue_Information_fds,
     114    (Objects_Id)id,
     115    location
     116  );
    114117}
    115118 
  • cpukit/posix/inline/rtems/posix/rwlock.inl

    r449ba1b r3507c6df  
    6969  return (POSIX_RWLock_Control *) _Objects_Get(
    7070      &_POSIX_RWLock_Information,
    71       *((Objects_Id *)RWLock),
     71      (Objects_Id) *RWLock,
    7272      location
    7373  );
  • cpukit/posix/inline/rtems/posix/semaphore.inl

    r449ba1b r3507c6df  
    6767 *  _POSIX_Semaphore_Get
    6868 */
    69  
    7069RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
    7170  sem_t             *id,
     
    7473{
    7574  return (POSIX_Semaphore_Control *)
    76     _Objects_Get( &_POSIX_Semaphore_Information, *id, location );
     75    _Objects_Get( &_POSIX_Semaphore_Information, (Objects_Id)*id, location );
    7776}
    7877 
  • cpukit/posix/inline/rtems/posix/spinlock.inl

    r449ba1b r3507c6df  
    6969  return (POSIX_Spinlock_Control *) _Objects_Get(
    7070      &_POSIX_Spinlock_Information,
    71       *((Objects_Id *)spinlock),
     71      (Objects_Id) *spinlock,
    7272      location
    7373  );
  • cpukit/posix/inline/rtems/posix/timer.inl

    r449ba1b r3507c6df  
    7171
    7272RTEMS_INLINE_ROUTINE POSIX_Timer_Control *_POSIX_Timer_Get (
    73   Objects_Id         id,
     73  timer_t            id,
    7474  Objects_Locations *location
    7575)
    7676{
    7777  return (POSIX_Timer_Control *)
    78     _Objects_Get( &_POSIX_Timer_Information, id, location );
     78    _Objects_Get( &_POSIX_Timer_Information, (Objects_Id) id, location );
    7979}
    8080
  • cpukit/posix/src/condget.c

    r449ba1b r3507c6df  
    3030)
    3131{
    32   Objects_Id        *id = (Objects_Id *)cond;
    3332  int status;
    3433
    35   if ( !id ) {
     34  if ( !cond ) {
    3635    *location = OBJECTS_ERROR;
    3736    return (POSIX_Condition_variables_Control *) 0;
    3837  }
    3938
    40   if ( *id == PTHREAD_COND_INITIALIZER ) {
     39  if ( *cond == PTHREAD_COND_INITIALIZER ) {
    4140    /*
    4241     *  Do an "auto-create" here.
    4342     */
    4443
    45     status = pthread_cond_init( (pthread_cond_t *)id, 0 );
     44    status = pthread_cond_init( cond, 0 );
    4645    if ( status ) {
    4746      *location = OBJECTS_ERROR;
     
    5352   *  Now call Objects_Get()
    5453   */
    55 
    56   return (POSIX_Condition_variables_Control *)
    57     _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
     54  return (POSIX_Condition_variables_Control *)_Objects_Get(
     55    &_POSIX_Condition_variables_Information,
     56    (Objects_Id) *cond,
     57    location
     58  );
    5859}
    5960 
  • cpukit/posix/src/mqueuenametoid.c

    r449ba1b r3507c6df  
    5454{
    5555  Objects_Name_or_id_lookup_errors  status;
     56  Objects_Id                        the_id;
    5657
    5758   if ( !name )
     
    6566
    6667  status = _Objects_Name_to_id_string(
    67     &_POSIX_Message_queue_Information, name, id );
     68    &_POSIX_Message_queue_Information,
     69    name,
     70    &the_id
     71  );
     72  *id = the_id;
    6873
    6974  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
  • cpukit/posix/src/mutexget.c

    r449ba1b r3507c6df  
    6262)
    6363{
    64   Objects_Id *id = (Objects_Id *)mutex;
    65 
    66   ___POSIX_Mutex_Get_support( id, location );
     64  ___POSIX_Mutex_Get_support( mutex, location );
    6765
    6866  return (POSIX_Mutex_Control *)
    69     _Objects_Get( &_POSIX_Mutex_Information, *id, location );
     67    _Objects_Get( &_POSIX_Mutex_Information, (Objects_Id) *mutex, location );
    7068}
    7169
     
    7674)
    7775{
    78   Objects_Id *id = (Objects_Id *)mutex;
     76  ___POSIX_Mutex_Get_support( mutex, location );
    7977
    80   ___POSIX_Mutex_Get_support( id, location );
    81 
    82   return (POSIX_Mutex_Control *)
    83     _Objects_Get_isr_disable( &_POSIX_Mutex_Information, *id, location, level );
     78  return (POSIX_Mutex_Control *) _Objects_Get_isr_disable(
     79    &_POSIX_Mutex_Information,
     80    (Objects_Id) *mutex,
     81    location,
     82    level
     83  );
    8484}
  • cpukit/posix/src/semaphorenametoid.c

    r449ba1b r3507c6df  
    3737
    3838int _POSIX_Semaphore_Name_to_id(
    39   const char          *name,
     39  const char     *name,
    4040  sem_t          *id
    4141)
    4242{
    4343  Objects_Name_or_id_lookup_errors  status;
     44  Objects_Id                        the_id;
    4445
    4546   if ( !name )
     
    5051
    5152  status = _Objects_Name_to_id_string(
    52     &_POSIX_Semaphore_Information, name, (Objects_Id*)id );
     53    &_POSIX_Semaphore_Information,
     54    name,
     55    &the_id
     56  );
     57  *id = the_id;
    5358
    5459  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
  • cpukit/posix/src/semopen.c

    r449ba1b r3507c6df  
    5454  int                        status;
    5555  sem_t                      the_semaphore_id;
    56   Objects_Id                *id;
     56  sem_t                     *id;
    5757  POSIX_Semaphore_Control   *the_semaphore;
    5858  Objects_Locations          location;
     
    102102    _Thread_Enable_dispatch();
    103103    _Thread_Enable_dispatch();
    104     id = &the_semaphore->Object.id;
    105     return (sem_t *)id;
    106 
     104    goto return_id;
    107105  }
    108106
     
    128126    return SEM_FAILED;
    129127
    130   id = &the_semaphore->Object.id;
    131   return (sem_t *)id;
     128return_id:
     129  #if defined(RTEMS_USE_16_BIT_OBJECT)
     130    the_semaphore->Semaphore_id = the_semaphore->Object.id;
     131    id = &the_semaphore->Semaphore_id;
     132  #else
     133    id = &the_semaphore->Object.id;
     134  #endif
     135  return id;
    132136}
  • cpukit/sapi/src/itronapi.c

    r449ba1b r3507c6df  
    5757void _ITRON_API_Initialize(void)
    5858{
    59   /* XXX need to assert here based on size assumptions */
    60 
    61   assert( sizeof(ID) == sizeof(Objects_Id) );
     59  /*
     60   * If there are any type size assumptions in the ITRON API, this is
     61   * the appropriate place to place them.
     62   *
     63   * Currently, there are no none type size assumptions.
     64   */
    6265
    6366  /*
  • cpukit/sapi/src/posixapi.c

    r449ba1b r3507c6df  
    6161void _POSIX_API_Initialize(void)
    6262{
    63   const posix_api_configuration_table *api;
    64 
    65   /* XXX need to assert here based on size assumptions */
    66 
    67   assert( sizeof(pthread_t) == sizeof(Objects_Id) );
     63  /*
     64   * If there are any type size assumptions in the POSIX API, this is
     65   * the appropriate place to place them.
     66   *
     67   * Currently, there are no none type size assumptions.
     68   */
    6869
    6970  /*
     
    7172   * various managers.
    7273   */
    73   api = &Configuration_POSIX_API;
    74 
    7574  _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
    7675
Note: See TracChangeset for help on using the changeset viewer.