Changeset 652524d9 in rtems


Ignore:
Timestamp:
Feb 26, 2004, 2:28:56 PM (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
54a43fe4
Parents:
68cc3ad
Message:

2004-02-26 Joel Sherrill <joel@…>

PR 582/core

  • posix/src/mqueue.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueueunlink.c: Use memory from workspace to avoid use of mutex during dispatch disable critical section. Besides memory for object names should come from the Workspace anyway.
Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r68cc3ad r652524d9  
     12004-02-26      Joel Sherrill <joel@OARcorp.com>
     2
     3        PR 582/core
     4        * posix/src/mqueue.c, posix/src/mqueuecreatesupp.c,
     5        posix/src/mqueuedeletesupp.c, posix/src/mqueueunlink.c: Use memory
     6        from workspace to avoid use of mutex during dispatch disable critical
     7        section. Besides memory for object names should come from the
     8        Workspace anyway.
     9
    1102004-02-12      Ralf Corsepius <corsepiu@faw.uni-ulm.de>
    211
  • cpukit/posix/src/mqueue.c

    r68cc3ad r652524d9  
    2626#include <fcntl.h>
    2727#include <mqueue.h>
     28#include <limits.h>
    2829
    2930#include <rtems/system.h>
     
    7172    sizeof( POSIX_Message_queue_Control_fd ),
    7273                                /* size of this object's control block */
    73     FALSE,                      /* TRUE if names for this object are strings */
    74     0                           /* maximum length of each object's name */
     74    TRUE,                       /* TRUE if names for this object are strings */
     75    NAME_MAX                    /* maximum length of each object's name */
    7576#if defined(RTEMS_MULTIPROCESSING)
    7677    ,
  • cpukit/posix/src/mqueuecreatesupp.c

    r68cc3ad r652524d9  
    1919#endif
    2020
     21#include <string.h>
    2122#include <stdarg.h>
    2223#include <stdlib.h>
     
    3031#include <rtems/system.h>
    3132#include <rtems/score/watchdog.h>
     33#include <rtems/score/wkspace.h>
    3234#include <rtems/seterr.h>
    3335#include <rtems/posix/mqueue.h>
    3436#include <rtems/posix/time.h>
     37
     38/* pure ANSI mode does not have this prototype */
     39size_t strnlen(const char *, size_t);
    3540
    3641/*PAGE
     
    4348 
    4449int _POSIX_Message_queue_Create_support(
    45   const char                    *_name,
     50  const char                    *name_arg,
    4651  int                            pshared,
    4752  struct mq_attr                *attr_ptr,
     
    5257  CORE_message_queue_Attributes *the_mq_attr;
    5358  struct mq_attr                 attr;
    54   char *name;
     59  char                          *name;
     60  size_t                         n;
     61
     62  n = strnlen( name_arg, NAME_MAX );
     63  if ( n > NAME_MAX )
     64    return ENAMETOOLONG;
    5565
    5666  _Thread_Disable_dispatch();
     
    101111  the_mq->linked = TRUE;
    102112
     113  /*
     114   * Make a copy of the user's string for name just in case it was
     115   * dynamically constructed.
     116   */
     117
     118  name = _Workspace_Allocate(n);
     119  if (!name) {
     120    _POSIX_Message_queue_Free( the_mq );
     121    _Thread_Enable_dispatch();
     122    rtems_set_errno_and_return_minus_one( ENOMEM );
     123  }
     124  strcpy( name, name_arg );
    103125 
    104126  /* XXX
     
    124146 
    125147    _POSIX_Message_queue_Free( the_mq );
     148    _Workspace_Free(name);
    126149    _Thread_Enable_dispatch();
    127150    rtems_set_errno_and_return_minus_one( ENOSPC );
    128151  }
    129152
    130   name = malloc(256);
    131   strcpy( name, _name );
    132153  _Objects_Open(
    133154    &_POSIX_Message_queue_Information,
  • cpukit/posix/src/mqueuedeletesupp.c

    r68cc3ad r652524d9  
    2929#include <rtems/system.h>
    3030#include <rtems/score/watchdog.h>
     31#include <rtems/score/wkspace.h>
    3132#include <rtems/seterr.h>
    3233#include <rtems/posix/mqueue.h>
     
    4344{
    4445  if ( !the_mq->linked && !the_mq->open_count ) {
     46      /* the name memory may have been freed by unlink. */
     47      if ( the_mq->Object.name )
     48        _Workspace_Free( the_mq->Object.name );
     49
    4550      _Objects_Close( &_POSIX_Message_queue_Information, &the_mq->Object );
    4651 
  • cpukit/posix/src/mqueueunlink.c

    r68cc3ad r652524d9  
    2929#include <rtems/system.h>
    3030#include <rtems/score/watchdog.h>
     31#include <rtems/score/wkspace.h>
    3132#include <rtems/seterr.h>
    3233#include <rtems/posix/mqueue.h>
     
    7677 
    7778  the_mq->linked = FALSE;
     79  _Workspace_Free( the_mq->Object.name );
    7880  _POSIX_Message_queue_Namespace_remove( the_mq );
    7981  _POSIX_Message_queue_Delete( the_mq );
Note: See TracChangeset for help on using the changeset viewer.