Changeset b98d399f in rtems


Ignore:
Timestamp:
Dec 13, 2011, 12:56:53 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
03cc73a
Parents:
3007610
Message:

2011-12-13 Sebastian Huber <sebastian.huber@…>

  • posix/src/mqueuenametoid.c, posix/src/semaphorenametoid.c: Removed files.
  • posix/src/psxnametoid.c: New file.
  • posix/Makefile.am: Reflect changes above.
  • posix/include/rtems/posix/config.h: Fixed integer types.
  • posix/include/rtems/posix/posixapi.h: Declare _POSIX_Name_to_id().
  • posix/include/rtems/posix/mqueue.h, posix/inline/rtems/posix/mqueue.inl: Changed parameter of _POSIX_Message_queue_Create_support(). _POSIX_Message_queue_Name_to_id() is now inline.
  • posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/semaphore.inl: Changed parameter of _POSIX_Semaphore_Create_support(). _POSIX_Semaphore_Name_to_id() is now inline.
  • posix/src/mqueuecreatesupp.c, posix/src/semaphorecreatesupp.c: Use _Workspace_String_duplicate().
  • posix/src/mqueuesendsupp.c, posix/src/mqueueopen.c, posix/src/mqueueunlink.c, posix/src/seminit.c, posix/src/semopen.c, posix/src/semunlink.c: Update due to API changes.
Location:
cpukit
Files:
1 added
2 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r3007610 rb98d399f  
     12011-12-13      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * posix/src/mqueuenametoid.c,
     4        posix/src/semaphorenametoid.c: Removed files.
     5        * posix/src/psxnametoid.c: New file.
     6        * posix/Makefile.am: Reflect changes above.
     7        * posix/include/rtems/posix/config.h: Fixed integer types.
     8        * posix/include/rtems/posix/posixapi.h: Declare _POSIX_Name_to_id().
     9        * posix/include/rtems/posix/mqueue.h,
     10        posix/inline/rtems/posix/mqueue.inl: Changed parameter of
     11        _POSIX_Message_queue_Create_support().
     12        _POSIX_Message_queue_Name_to_id() is now inline.
     13        * posix/include/rtems/posix/semaphore.h,
     14        posix/inline/rtems/posix/semaphore.inl: Changed parameter of
     15        _POSIX_Semaphore_Create_support().  _POSIX_Semaphore_Name_to_id() is
     16        now inline.
     17        * posix/src/mqueuecreatesupp.c, posix/src/semaphorecreatesupp.c: Use
     18        _Workspace_String_duplicate().
     19        * posix/src/mqueuesendsupp.c, posix/src/mqueueopen.c,
     20        posix/src/mqueueunlink.c, posix/src/seminit.c, posix/src/semopen.c,
     21        posix/src/semunlink.c: Update due to API changes.
     22
    1232011-12-13      Sebastian Huber <sebastian.huber@embedded-brains.de>
    224
  • cpukit/posix/Makefile.am

    r3007610 rb98d399f  
    107107libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
    108108    src/mqueuecreatesupp.c src/mqueuedeletesupp.c src/mqueuegetattr.c \
    109     src/mqueuenametoid.c src/mqueuenotify.c src/mqueueopen.c \
     109    src/mqueuenotify.c src/mqueueopen.c \
    110110    src/mqueuereceive.c src/mqueuerecvsupp.c src/mqueuesend.c \
    111111    src/mqueuesendsupp.c src/mqueuesetattr.c src/mqueuetimedreceive.c \
     
    171171## SEMAPHORE_C_FILES
    172172libposix_a_SOURCES += src/semaphore.c src/semaphorecreatesupp.c \
    173     src/semaphoredeletesupp.c src/semaphorenametoid.c \
     173    src/semaphoredeletesupp.c \
    174174    src/semaphoretranslatereturncode.c src/semaphorewaitsupp.c \
    175175    src/semclose.c src/semdestroy.c src/semgetvalue.c src/seminit.c \
     
    196196## SUPPORT_C_FILES
    197197libposix_a_SOURCES += src/psxpriorityisvalid.c
     198libposix_a_SOURCES += src/psxnametoid.c
    198199
    199200EXTRA_DIST += src/README.mqueue
  • cpukit/posix/include/rtems/posix/config.h

    r3007610 rb98d399f  
    4646
    4747typedef struct {
    48   int                                 maximum_threads;
    49   int                                 maximum_mutexes;
    50   int                                 maximum_condition_variables;
    51   int                                 maximum_keys;
    52   int                                 maximum_timers;
    53   int                                 maximum_queued_signals;
    54   int                                 maximum_message_queues;
    55   int                                 maximum_message_queue_descriptors;
    56   int                                 maximum_semaphores;
    57   int                                 maximum_barriers;
    58   int                                 maximum_rwlocks;
    59   int                                 maximum_spinlocks;
    60   int                                 number_of_initialization_threads;
     48  uint32_t                            maximum_threads;
     49  uint32_t                            maximum_mutexes;
     50  uint32_t                            maximum_condition_variables;
     51  uint32_t                            maximum_keys;
     52  uint32_t                            maximum_timers;
     53  uint32_t                            maximum_queued_signals;
     54  uint32_t                            maximum_message_queues;
     55  uint32_t                            maximum_message_queue_descriptors;
     56  uint32_t                            maximum_semaphores;
     57  uint32_t                            maximum_barriers;
     58  uint32_t                            maximum_rwlocks;
     59  uint32_t                            maximum_spinlocks;
     60  uint32_t                            number_of_initialization_threads;
    6161  posix_initialization_threads_table *User_initialization_threads_table;
    6262} posix_api_configuration_table;
  • cpukit/posix/include/rtems/posix/mqueue.h

    r3007610 rb98d399f  
    2424#include <rtems/score/coremsg.h>
    2525#include <rtems/score/object.h>
     26#include <rtems/posix/posixapi.h>
    2627
    2728#ifdef __cplusplus
     
    8081int _POSIX_Message_queue_Create_support(
    8182  const char                    *name,
     83  size_t                         name_len,
    8284  int                            pshared,
    8385  struct mq_attr                *attr,
     
    127129  const char         *msg_ptr,
    128130  size_t              msg_len,
    129   uint32_t            msg_prio,
     131  unsigned int        msg_prio,
    130132  bool                wait,
    131133  Watchdog_Interval   timeout
     
    188190
    189191/*
    190  *  _POSIX_Message_queue_Name_to_id
    191  *
    192  *  DESCRIPTION:
    193  *
    194  *  This routine looks up the specified name for a message queue and returns the
    195  *  id of the message queue associated with it.
    196  */
    197 
    198 int _POSIX_Message_queue_Name_to_id(
    199   const char          *name,
    200   Objects_Id          *id
    201 );
    202 
    203 /*
    204192 *  _POSIX_Message_queue_Priority_to_core
    205193 *
  • cpukit/posix/include/rtems/posix/posixapi.h

    r3007610 rb98d399f  
    2121
    2222#include <rtems/config.h>
     23#include <rtems/score/object.h>
    2324
    2425/**
     
    3031void _POSIX_API_Initialize(void);
    3132
     33/**
     34 *  @brief Queries the object identifier @a id for a @a name.
     35 *
     36 *  @param[in] information Object information.
     37 *  @param[in] name Zero terminated name string to look up.
     38 *  @param[out] id Pointer for identifier.  The pointer must be valid.
     39 *  @param[out] len Pointer for string length.  The pointer must be valid.
     40 *
     41 *  @retval 0 Successful operation.
     42 *  @retval EINVAL The @a name pointer is @c NULL or the @a name string has
     43 *  zero length.
     44 *  @retval ENAMETOOLONG The @a name string length is greater than or equal to
     45 *  @c NAME_MAX.
     46 *  @retval ENOENT Found no corresponding identifier.
     47 */
     48int _POSIX_Name_to_id(
     49  Objects_Information *information,
     50  const char          *name,
     51  Objects_Id          *id,
     52  size_t              *len
     53);
     54
    3255#endif
    3356/* end of include file */
  • cpukit/posix/include/rtems/posix/semaphore.h

    r3007610 rb98d399f  
    2626#include <semaphore.h>
    2727#include <rtems/score/coresem.h>
     28#include <rtems/posix/posixapi.h>
    2829
    2930/*
     
    130131int _POSIX_Semaphore_Create_support(
    131132  const char                *name,
     133  size_t                     name_len,
    132134  int                        pshared,
    133135  unsigned int               value,
     
    163165
    164166/*
    165  *  _POSIX_Semaphore_Name_to_id
    166  *
    167  *  DESCRIPTION:
    168  *
    169  *  This routine performs name to id translation.
    170  */
    171 
    172 int _POSIX_Semaphore_Name_to_id(
    173   const char          *name,
    174   sem_t          *id
    175 );
    176 
    177 /*
    178167 *  _POSIX_Semaphore_Translate_core_semaphore_return_code
    179168 *
  • cpukit/posix/inline/rtems/posix/mqueue.inl

    r3007610 rb98d399f  
    128128)
    129129{
    130   return priority * -1;
     130  return (CORE_message_queue_Submit_types) priority * -1;
    131131}
    132132
     
    144144{
    145145  /* absolute value without a library dependency */
    146   return ((priority >= 0) ? priority : -priority);
     146  return (unsigned int) ((priority >= 0) ? priority : -priority);
     147}
     148
     149/**
     150 * @see _POSIX_Name_to_id().
     151 */
     152RTEMS_INLINE_ROUTINE int _POSIX_Message_queue_Name_to_id(
     153  const char          *name,
     154  Objects_Id          *id,
     155  size_t              *len
     156)
     157{
     158  return _POSIX_Name_to_id( &_POSIX_Message_queue_Information, name, id, len );
    147159}
    148160
  • cpukit/posix/inline/rtems/posix/semaphore.inl

    r3007610 rb98d399f  
    8282}
    8383
     84/**
     85 * @see _POSIX_Name_to_id().
     86 */
     87RTEMS_INLINE_ROUTINE int _POSIX_Semaphore_Name_to_id(
     88  const char *name,
     89  Objects_Id *id,
     90  size_t     *len
     91)
     92{
     93  return _POSIX_Name_to_id( &_POSIX_Semaphore_Information, name, id, len );
     94}
     95
    8496#endif
    8597/*  end of include file */
  • cpukit/posix/src/mqueuecreatesupp.c

    r3007610 rb98d399f  
    4343#include <rtems/posix/time.h>
    4444
    45 /* pure ANSI mode does not have this prototype */
    46 size_t strnlen(const char *, size_t);
    47 
    4845/*
    4946 *  _POSIX_Message_queue_Create_support
     
    5552int _POSIX_Message_queue_Create_support(
    5653  const char                    *name_arg,
     54  size_t                         name_len,
    5755  int                            pshared,
    5856  struct mq_attr                *attr_ptr,
     
    6462  struct mq_attr                 attr;
    6563  char                          *name;
    66   size_t                         n;
    6764
    68   n = strnlen( name_arg, NAME_MAX );
    6965  /* length of name has already been validated */
    7066
     
    10096  }
    10197
     98  /*
     99   * Make a copy of the user's string for name just in case it was
     100   * dynamically constructed.
     101   */
     102  name = _Workspace_String_duplicate( name_arg, name_len );
     103  if ( !name ) {
     104    _POSIX_Message_queue_Free( the_mq );
     105    _Thread_Enable_dispatch();
     106    rtems_set_errno_and_return_minus_one( ENOMEM );
     107  }
     108
    102109  the_mq->process_shared  = pshared;
    103110  the_mq->named = true;
    104111  the_mq->open_count = 1;
    105112  the_mq->linked = true;
    106 
    107   /*
    108    * Make a copy of the user's string for name just in case it was
    109    * dynamically constructed.
    110    */
    111   name = _Workspace_Allocate(n+1);
    112   if (!name) {
    113     _POSIX_Message_queue_Free( the_mq );
    114     _Thread_Enable_dispatch();
    115     rtems_set_errno_and_return_minus_one( ENOMEM );
    116   }
    117   strncpy( name, name_arg, n+1 );
    118113
    119114  /*
  • cpukit/posix/src/mqueueopen.c

    r3007610 rb98d399f  
    5959  POSIX_Message_queue_Control_fd *the_mq_fd;
    6060  Objects_Locations               location;
     61  size_t                          name_len;
    6162
    6263  _Thread_Disable_dispatch();
     
    7677  the_mq_fd->oflag = oflag;
    7778
    78   status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
     79  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id, &name_len );
    7980
    8081  /*
     
    129130  status = _POSIX_Message_queue_Create_support(
    130131    name,
     132    name_len,
    131133    true,         /* shared across processes */
    132134    attr,
  • cpukit/posix/src/mqueuesendsupp.c

    r3007610 rb98d399f  
    4949  const char         *msg_ptr,
    5050  size_t              msg_len,
    51   uint32_t            msg_prio,
     51  unsigned int        msg_prio,
    5252  bool                wait,
    5353  Watchdog_Interval   timeout
     
    9292      msg_status = _CORE_message_queue_Submit(
    9393        &the_mq->Message_queue,
    94         (void *)msg_ptr,
     94        msg_ptr,
    9595        msg_len,
    9696        mqdes,      /* mqd_t is an object id */
  • cpukit/posix/src/mqueueunlink.c

    r3007610 rb98d399f  
    5252  register POSIX_Message_queue_Control *the_mq;
    5353  Objects_Id                            the_mq_id;
     54  size_t                                name_len;
    5455
    5556  _Thread_Disable_dispatch();
    5657
    57   status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
     58  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id, &name_len );
    5859   if ( status != 0 ) {
    5960    _Thread_Enable_dispatch();
  • cpukit/posix/src/semaphorecreatesupp.c

    r3007610 rb98d399f  
    2525#include <rtems/system.h>
    2626#include <rtems/score/object.h>
     27#include <rtems/score/wkspace.h>
    2728#include <rtems/posix/semaphore.h>
    2829#include <rtems/posix/time.h>
    2930#include <rtems/seterr.h>
    30 
    31 /* pure ANSI mode does not have this prototype */
    32 size_t strnlen(const char *, size_t);
    3331
    3432/*
     
    4038 */
    4139int _POSIX_Semaphore_Create_support(
    42   const char                *name,
     40  const char                *name_arg,
     41  size_t                     name_len,
    4342  int                        pshared,
    4443  unsigned int               value,
     
    4847  POSIX_Semaphore_Control   *the_semaphore;
    4948  CORE_semaphore_Attributes *the_sem_attr;
    50   char                      *name_p = (char *)name;
     49  char                      *name;
    5150
    5251  /* Sharing semaphores among processes is not currently supported */
     
    5453    rtems_set_errno_and_return_minus_one( ENOSYS );
    5554
    56   if ( name ) {
    57     if ( strnlen( name, NAME_MAX ) >= NAME_MAX )
    58       rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
    59   }
    60 
    6155  _Thread_Disable_dispatch();
    6256
    6357  the_semaphore = _POSIX_Semaphore_Allocate();
    64 
    6558  if ( !the_semaphore ) {
    6659    _Thread_Enable_dispatch();
    6760    rtems_set_errno_and_return_minus_one( ENOSPC );
     61  }
     62
     63  /*
     64   * Make a copy of the user's string for name just in case it was
     65   * dynamically constructed.
     66   */
     67  if ( name_arg != NULL ) {
     68    name = _Workspace_String_duplicate( name_arg, name_len );
     69    if ( !name ) {
     70      _POSIX_Semaphore_Free( the_semaphore );
     71      _Thread_Enable_dispatch();
     72      rtems_set_errno_and_return_minus_one( ENOMEM );
     73    }
     74  } else {
     75    name = NULL;
    6876  }
    6977
     
    104112    &_POSIX_Semaphore_Information,
    105113    &the_semaphore->Object,
    106     name_p
     114    name
    107115  );
    108116
  • cpukit/posix/src/seminit.c

    r3007610 rb98d399f  
    4646  status = _POSIX_Semaphore_Create_support(
    4747    NULL,
     48    0,
    4849    pshared,
    4950    value,
  • cpukit/posix/src/semopen.c

    r3007610 rb98d399f  
    5252  unsigned int               value = 0;
    5353  int                        status;
    54   sem_t                      the_semaphore_id;
    55   sem_t                     *id;
     54  Objects_Id                 the_semaphore_id;
    5655  POSIX_Semaphore_Control   *the_semaphore;
    5756  Objects_Locations          location;
     57  size_t                     name_len;
    5858
    5959  _Thread_Disable_dispatch();
     
    6666  }
    6767
    68   status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
     68  status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id, &name_len );
    6969
    7070  /*
     
    9797    }
    9898
    99     the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
     99    the_semaphore = _POSIX_Semaphore_Get( (sem_t *) &the_semaphore_id, &location );
    100100    the_semaphore->open_count += 1;
    101101    _Thread_Enable_dispatch();
     
    111111  status =_POSIX_Semaphore_Create_support(
    112112    name,
     113    name_len,
    113114    false,         /* not shared across processes */
    114115    value,
     
    128129  #if defined(RTEMS_USE_16_BIT_OBJECT)
    129130    the_semaphore->Semaphore_id = the_semaphore->Object.id;
    130     id = &the_semaphore->Semaphore_id;
     131    return &the_semaphore->Semaphore_id;
    131132  #else
    132     id = (sem_t *)&the_semaphore->Object.id;
     133    return (sem_t *)&the_semaphore->Object.id;
    133134  #endif
    134   return id;
    135135}
  • cpukit/posix/src/semunlink.c

    r3007610 rb98d399f  
    4343  int  status;
    4444  register POSIX_Semaphore_Control *the_semaphore;
    45   sem_t                        the_semaphore_id;
     45  Objects_Id the_semaphore_id;
     46  size_t name_len;
    4647
    4748  _Thread_Disable_dispatch();
    4849
    49   status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
     50  status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id, &name_len );
    5051  if ( status != 0 ) {
    5152    _Thread_Enable_dispatch();
Note: See TracChangeset for help on using the changeset viewer.