Changeset 2545646 in rtems


Ignore:
Timestamp:
Nov 22, 1999, 4:12:19 PM (22 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
cb3c1718
Parents:
94f81bbd
Message:

+ Updated comments.
+ Corrected enable/disable of dispatch.

Files:
2 edited

Legend:

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

    r94f81bbd r2545646  
    1818
    1919/*PAGE
     20 *
     21 *  sem_open
     22 * 
     23 *  Opens a named semaphore.  Used in conjunction with the sem_close
     24 *  and sem_unlink commands.
    2025 *
    2126 *  11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
     
    4045  POSIX_Semaphore_Control   *the_semaphore;
    4146  Objects_Locations          location;
    42  
     47   
     48  _Thread_Disable_dispatch();
    4349
    4450  if ( oflag & O_CREAT ) {
     
    6167
    6268    /*
    63      * Unless we are willing to create name -> ID translation failure is
    64      * an error.
     69     * Unless provided a valid name that did not already exist
     70     * and we are willing to create then it is an error.
    6571     */
    6672
    67     if ( status == EINVAL ) {
    68       if ( !(oflag & O_CREAT) ) {
    69         set_errno_and_return_minus_one_cast( ENOENT, sem_t * );
    70       }
     73    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
     74      _Thread_Enable_dispatch();
     75      set_errno_and_return_minus_one_cast( status, sem_t * );
    7176    }
    72 
    7377  } else {
    7478
     
    7882
    7983    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
     84      _Thread_Enable_dispatch();
    8085      set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
    8186    }
     
    8388    the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
    8489    the_semaphore->open_count += 1;
     90    _Thread_Enable_dispatch();
     91    _Thread_Enable_dispatch();
    8592    return (sem_t *)&the_semaphore->Object.id;
    8693
     
    9299   */
    93100
    94   status = _POSIX_Semaphore_Create_support(
     101  status =_POSIX_Semaphore_Create_support(
    95102    name,
    96103    FALSE,         /* not shared across processes */
     
    103110   */
    104111
     112  _Thread_Enable_dispatch();
     113
    105114  if ( status == -1 )
    106115    return SEM_FAILED;
     
    108117  return (sem_t *) &the_semaphore->Object.id;
    109118}
     119
     120
  • cpukit/posix/src/semopen.c

    r94f81bbd r2545646  
    1818
    1919/*PAGE
     20 *
     21 *  sem_open
     22 * 
     23 *  Opens a named semaphore.  Used in conjunction with the sem_close
     24 *  and sem_unlink commands.
    2025 *
    2126 *  11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
     
    4045  POSIX_Semaphore_Control   *the_semaphore;
    4146  Objects_Locations          location;
    42  
     47   
     48  _Thread_Disable_dispatch();
    4349
    4450  if ( oflag & O_CREAT ) {
     
    6167
    6268    /*
    63      * Unless we are willing to create name -> ID translation failure is
    64      * an error.
     69     * Unless provided a valid name that did not already exist
     70     * and we are willing to create then it is an error.
    6571     */
    6672
    67     if ( status == EINVAL ) {
    68       if ( !(oflag & O_CREAT) ) {
    69         set_errno_and_return_minus_one_cast( ENOENT, sem_t * );
    70       }
     73    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
     74      _Thread_Enable_dispatch();
     75      set_errno_and_return_minus_one_cast( status, sem_t * );
    7176    }
    72 
    7377  } else {
    7478
     
    7882
    7983    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
     84      _Thread_Enable_dispatch();
    8085      set_errno_and_return_minus_one_cast( EEXIST, sem_t * );
    8186    }
     
    8388    the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
    8489    the_semaphore->open_count += 1;
     90    _Thread_Enable_dispatch();
     91    _Thread_Enable_dispatch();
    8592    return (sem_t *)&the_semaphore->Object.id;
    8693
     
    9299   */
    93100
    94   status = _POSIX_Semaphore_Create_support(
     101  status =_POSIX_Semaphore_Create_support(
    95102    name,
    96103    FALSE,         /* not shared across processes */
     
    103110   */
    104111
     112  _Thread_Enable_dispatch();
     113
    105114  if ( status == -1 )
    106115    return SEM_FAILED;
     
    108117  return (sem_t *) &the_semaphore->Object.id;
    109118}
     119
     120
Note: See TracChangeset for help on using the changeset viewer.