Changeset 7fbef786 in rtems


Ignore:
Timestamp:
Dec 23, 1999, 10:09:36 PM (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
afebb3f
Parents:
8f12d069
Message:

+ Debugged.

Files:
4 edited

Legend:

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

    r8f12d069 r7fbef786  
    4848  Objects_Id                     the_mq_id;
    4949  POSIX_Message_queue_Control   *the_mq;
     50  Objects_Locations              location;
    5051 
     52  _Thread_Disable_dispatch();
     53
    5154  if ( oflag & O_CREAT ) {
    5255    va_start(arg, oflag);
     
    6770  if ( status ) {
    6871 
    69     if ( status == EINVAL ) {      /* name -> ID translation failed */
    70       if ( !(oflag & O_CREAT) ) {  /* willing to create it? */
    71         set_errno_and_return_minus_one( ENOENT );
    72         return (mqd_t) -1;
    73       }
    74       /* we are willing to create it */
     72    /*
     73     * Unless provided a valid name that did not already exist
     74     * and we are willing to create then it is an error.
     75     */
     76
     77    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
     78      _Thread_Enable_dispatch();
     79      set_errno_and_return_minus_one_cast( status, mqd_t );
    7580    }
    76     set_errno_and_return_minus_one( status ); /* some type of error */
    77     return (mqd_t) -1;
    78  
     81
    7982  } else {                /* name -> ID translation succeeded */
    8083 
     84    /*
     85     * Check for existence with creation.
     86     */
     87
    8188    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
    82       set_errno_and_return_minus_one( EEXIST );
    83       return (mqd_t) -1;
     89      _Thread_Enable_dispatch();
     90      set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
    8491    }
    85  
     92
    8693    /*
    8794     * XXX In this case we need to do an ID->pointer conversion to
    8895     *     check the mode.   This is probably a good place for a subroutine.
    8996     */
    90  
     97
     98    the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
    9199    the_mq->open_count += 1;
    92  
    93     return (mqd_t)&the_mq->Object.id;
     100    _Thread_Enable_dispatch();
     101    _Thread_Enable_dispatch();
     102    return (mqd_t)the_mq->Object.id;
    94103 
    95104  }
     
    109118  );
    110119 
     120  /*
     121   * errno was set by Create_support, so don't set it again.
     122   */
     123
     124  _Thread_Enable_dispatch();
     125
    111126  if ( status == -1 )
    112127    return (mqd_t) -1;
    113128 
    114   return (mqd_t) &the_mq->Object.id;
     129  return (mqd_t) the_mq->Object.id;
    115130}
    116131
  • c/src/exec/posix/src/mqueueunlink.c

    r8f12d069 r7fbef786  
    4343  Objects_Locations                 location;
    4444 
     45  _Thread_Disable_dispatch();
     46
    4547  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
    46    if ( status != 0 )
     48   if ( status != 0 ) {
     49    _Thread_Enable_dispatch();
    4750    set_errno_and_return_minus_one( status );
     51   }
     52
     53  /*
     54   *  Don't support unlinking a remote message queue.
     55   */
     56
     57  if ( !_Objects_Is_local_id(the_mq_id) ) {
     58    _Thread_Enable_dispatch();
     59    set_errno_and_return_minus_one( ENOSYS );
     60  }
     61
     62  the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
     63    &_POSIX_Message_queue_Information,
     64    _Objects_Get_index( the_mq_id )
     65  );
     66 
     67#if defined(RTEMS_MULTIPROCESSING)
     68  if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
     69    _Objects_MP_Close( &_POSIX_Message_queue_Information, the_mq_id );
     70  }
     71#endif
     72
    4873 
    49   the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
    50   switch ( location ) {
    51     case OBJECTS_ERROR:
    52       set_errno_and_return_minus_one( EINVAL );
    53     case OBJECTS_REMOTE:
    54       _Thread_Dispatch();
    55       return POSIX_MP_NOT_IMPLEMENTED();
    56       set_errno_and_return_minus_one( EINVAL );
    57     case OBJECTS_LOCAL:
    58  
    59 #if defined(RTEMS_MULTIPROCESSING)
    60       _Objects_MP_Close(
    61         &_POSIX_Message_queue_Information,
    62         the_mq->Object.id
    63       );
    64 #endif
    65  
    66       the_mq->linked = FALSE;
    67  
    68       _POSIX_Message_queue_Delete( the_mq );
    69  
    70       _Thread_Enable_dispatch();
    71       return 0;
    72   }
    73   return POSIX_BOTTOM_REACHED();
     74  the_mq->linked = FALSE;
     75  _POSIX_Message_queue_Namespace_remove( the_mq );
     76  _POSIX_Message_queue_Delete( the_mq );
     77
     78  _Thread_Enable_dispatch();
     79  return 0;
    7480}
    7581
  • cpukit/posix/src/mqueueopen.c

    r8f12d069 r7fbef786  
    4848  Objects_Id                     the_mq_id;
    4949  POSIX_Message_queue_Control   *the_mq;
     50  Objects_Locations              location;
    5051 
     52  _Thread_Disable_dispatch();
     53
    5154  if ( oflag & O_CREAT ) {
    5255    va_start(arg, oflag);
     
    6770  if ( status ) {
    6871 
    69     if ( status == EINVAL ) {      /* name -> ID translation failed */
    70       if ( !(oflag & O_CREAT) ) {  /* willing to create it? */
    71         set_errno_and_return_minus_one( ENOENT );
    72         return (mqd_t) -1;
    73       }
    74       /* we are willing to create it */
     72    /*
     73     * Unless provided a valid name that did not already exist
     74     * and we are willing to create then it is an error.
     75     */
     76
     77    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
     78      _Thread_Enable_dispatch();
     79      set_errno_and_return_minus_one_cast( status, mqd_t );
    7580    }
    76     set_errno_and_return_minus_one( status ); /* some type of error */
    77     return (mqd_t) -1;
    78  
     81
    7982  } else {                /* name -> ID translation succeeded */
    8083 
     84    /*
     85     * Check for existence with creation.
     86     */
     87
    8188    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
    82       set_errno_and_return_minus_one( EEXIST );
    83       return (mqd_t) -1;
     89      _Thread_Enable_dispatch();
     90      set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
    8491    }
    85  
     92
    8693    /*
    8794     * XXX In this case we need to do an ID->pointer conversion to
    8895     *     check the mode.   This is probably a good place for a subroutine.
    8996     */
    90  
     97
     98    the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
    9199    the_mq->open_count += 1;
    92  
    93     return (mqd_t)&the_mq->Object.id;
     100    _Thread_Enable_dispatch();
     101    _Thread_Enable_dispatch();
     102    return (mqd_t)the_mq->Object.id;
    94103 
    95104  }
     
    109118  );
    110119 
     120  /*
     121   * errno was set by Create_support, so don't set it again.
     122   */
     123
     124  _Thread_Enable_dispatch();
     125
    111126  if ( status == -1 )
    112127    return (mqd_t) -1;
    113128 
    114   return (mqd_t) &the_mq->Object.id;
     129  return (mqd_t) the_mq->Object.id;
    115130}
    116131
  • cpukit/posix/src/mqueueunlink.c

    r8f12d069 r7fbef786  
    4343  Objects_Locations                 location;
    4444 
     45  _Thread_Disable_dispatch();
     46
    4547  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
    46    if ( status != 0 )
     48   if ( status != 0 ) {
     49    _Thread_Enable_dispatch();
    4750    set_errno_and_return_minus_one( status );
     51   }
     52
     53  /*
     54   *  Don't support unlinking a remote message queue.
     55   */
     56
     57  if ( !_Objects_Is_local_id(the_mq_id) ) {
     58    _Thread_Enable_dispatch();
     59    set_errno_and_return_minus_one( ENOSYS );
     60  }
     61
     62  the_mq = (POSIX_Message_queue_Control *) _Objects_Get_local_object(
     63    &_POSIX_Message_queue_Information,
     64    _Objects_Get_index( the_mq_id )
     65  );
     66 
     67#if defined(RTEMS_MULTIPROCESSING)
     68  if ( the_mq->process_shared == PTHREAD_PROCESS_SHARED ) {
     69    _Objects_MP_Close( &_POSIX_Message_queue_Information, the_mq_id );
     70  }
     71#endif
     72
    4873 
    49   the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
    50   switch ( location ) {
    51     case OBJECTS_ERROR:
    52       set_errno_and_return_minus_one( EINVAL );
    53     case OBJECTS_REMOTE:
    54       _Thread_Dispatch();
    55       return POSIX_MP_NOT_IMPLEMENTED();
    56       set_errno_and_return_minus_one( EINVAL );
    57     case OBJECTS_LOCAL:
    58  
    59 #if defined(RTEMS_MULTIPROCESSING)
    60       _Objects_MP_Close(
    61         &_POSIX_Message_queue_Information,
    62         the_mq->Object.id
    63       );
    64 #endif
    65  
    66       the_mq->linked = FALSE;
    67  
    68       _POSIX_Message_queue_Delete( the_mq );
    69  
    70       _Thread_Enable_dispatch();
    71       return 0;
    72   }
    73   return POSIX_BOTTOM_REACHED();
     74  the_mq->linked = FALSE;
     75  _POSIX_Message_queue_Namespace_remove( the_mq );
     76  _POSIX_Message_queue_Delete( the_mq );
     77
     78  _Thread_Enable_dispatch();
     79  return 0;
    7480}
    7581
Note: See TracChangeset for help on using the changeset viewer.