Changeset 17879f4 in rtems


Ignore:
Timestamp:
Nov 18, 1999, 7:43:13 PM (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
105d7872
Parents:
c9ae846
Message:

+ Debuged to the point that you could open, unlink and close a semaphore.

but all paths have not been checked, yet.

Files:
8 edited

Legend:

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

    rc9ae846 r17879f4  
    4444 
    4545  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
    46  
    47   if ( !status )
     46   if ( status != 0 )
    4847    set_errno_and_return_minus_one( status );
    4948 
  • c/src/exec/posix/src/semaphorenametoid.c

    rc9ae846 r17879f4  
    2121 *  _POSIX_Semaphore_Name_to_id
    2222 *
    23  *  XXX
     23 *  Look up the specified name and attempt to locate the id
     24 *  for the associated semaphore.
    2425 */
    2526
     
    3132  Objects_Name_to_id_errors  status;
    3233
    33   status = _Objects_Name_to_id( &_POSIX_Semaphore_Information, (char *)name, 0, id );
     34  status = _Objects_Name_to_id(
     35    &_POSIX_Semaphore_Information, (char *)name, 0, id );
    3436
    35   if ( status == OBJECTS_SUCCESSFUL ) {
    36           return 0;
    37   } else {
    38           return EINVAL;
    39   }
     37  if ( status == OBJECTS_SUCCESSFUL )
     38    return 0;
     39
     40  return EINVAL;
    4041}
    4142
  • c/src/exec/posix/src/semopen.c

    rc9ae846 r17879f4  
    4444  if ( oflag & O_CREAT ) {
    4545    va_start(arg, oflag);
    46     /*mode = (mode_t) va_arg( arg, mode_t * );*/
    4746    mode = va_arg( arg, mode_t );
    48     /*value = (unsigned int) va_arg( arg, unsigned int * );*/
    4947    value = va_arg( arg, unsigned int );
    5048    va_end(arg);
     
    6260  if ( status ) {
    6361
    64     if ( status == EINVAL ) {      /* name -> ID translation failed */
    65       if ( !(oflag & O_CREAT) ) {  /* willing to create it? */
     62    /*
     63     * Unless we are willing to create name -> ID translation failure is
     64     * an error.
     65     */
     66
     67    if ( status == EINVAL ) {
     68      if ( !(oflag & O_CREAT) ) {
    6669        set_errno_and_return_minus_one_cast( ENOENT, sem_t * );
    6770      }
    68       /* we are willing to create it */
    6971    }
    70     /* some type of error */
    71     /*set_errno_and_return_minus_one_cast( status, sem_t * );*/
    7272
    73   } else {                /* name -> ID translation succeeded */
     73  } else {
     74
     75    /*
     76     * Check for existence with creation.
     77     */
    7478
    7579    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
     
    7781    }
    7882
    79     /*
    80      * XXX In this case we need to do an ID->pointer conversion to
    81      *     check the mode.   This is probably a good place for a subroutine.
    82      */
    83 
    8483    the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
    8584    the_semaphore->open_count += 1;
    86 
    8785    return (sem_t *)&the_semaphore->Object.id;
    8886
    8987  }
    9088 
    91   /* XXX verify this comment...
    92    *
     89  /*
    9390   *  At this point, the semaphore does not exist and everything has been
    9491   *  checked. We should go ahead and create a semaphore.
     
    10299  );
    103100 
     101  /*
     102   * errno was set by Create_support, so don't set it again.
     103   */
     104
    104105  if ( status == -1 )
    105     return (sem_t *) -1;
     106    return SEM_FAILED;
    106107
    107108  return (sem_t *) &the_semaphore->Object.id;
    108  
    109109}
  • c/src/exec/posix/src/semunlink.c

    rc9ae846 r17879f4  
    3232 
    3333  status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
    34    
    35   if ( !status )
     34  if ( status != 0 )
    3635    set_errno_and_return_minus_one( status );
    3736
     
    5655
    5756      the_semaphore->linked = FALSE;
    58 
     57      _POSIX_Semaphore_Namespace_remove( the_semaphore );
    5958      _POSIX_Semaphore_Delete( the_semaphore );
    6059
  • cpukit/posix/src/mqueueunlink.c

    rc9ae846 r17879f4  
    4444 
    4545  status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id );
    46  
    47   if ( !status )
     46   if ( status != 0 )
    4847    set_errno_and_return_minus_one( status );
    4948 
  • cpukit/posix/src/semaphorenametoid.c

    rc9ae846 r17879f4  
    2121 *  _POSIX_Semaphore_Name_to_id
    2222 *
    23  *  XXX
     23 *  Look up the specified name and attempt to locate the id
     24 *  for the associated semaphore.
    2425 */
    2526
     
    3132  Objects_Name_to_id_errors  status;
    3233
    33   status = _Objects_Name_to_id( &_POSIX_Semaphore_Information, (char *)name, 0, id );
     34  status = _Objects_Name_to_id(
     35    &_POSIX_Semaphore_Information, (char *)name, 0, id );
    3436
    35   if ( status == OBJECTS_SUCCESSFUL ) {
    36           return 0;
    37   } else {
    38           return EINVAL;
    39   }
     37  if ( status == OBJECTS_SUCCESSFUL )
     38    return 0;
     39
     40  return EINVAL;
    4041}
    4142
  • cpukit/posix/src/semopen.c

    rc9ae846 r17879f4  
    4444  if ( oflag & O_CREAT ) {
    4545    va_start(arg, oflag);
    46     /*mode = (mode_t) va_arg( arg, mode_t * );*/
    4746    mode = va_arg( arg, mode_t );
    48     /*value = (unsigned int) va_arg( arg, unsigned int * );*/
    4947    value = va_arg( arg, unsigned int );
    5048    va_end(arg);
     
    6260  if ( status ) {
    6361
    64     if ( status == EINVAL ) {      /* name -> ID translation failed */
    65       if ( !(oflag & O_CREAT) ) {  /* willing to create it? */
     62    /*
     63     * Unless we are willing to create name -> ID translation failure is
     64     * an error.
     65     */
     66
     67    if ( status == EINVAL ) {
     68      if ( !(oflag & O_CREAT) ) {
    6669        set_errno_and_return_minus_one_cast( ENOENT, sem_t * );
    6770      }
    68       /* we are willing to create it */
    6971    }
    70     /* some type of error */
    71     /*set_errno_and_return_minus_one_cast( status, sem_t * );*/
    7272
    73   } else {                /* name -> ID translation succeeded */
     73  } else {
     74
     75    /*
     76     * Check for existence with creation.
     77     */
    7478
    7579    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
     
    7781    }
    7882
    79     /*
    80      * XXX In this case we need to do an ID->pointer conversion to
    81      *     check the mode.   This is probably a good place for a subroutine.
    82      */
    83 
    8483    the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location );
    8584    the_semaphore->open_count += 1;
    86 
    8785    return (sem_t *)&the_semaphore->Object.id;
    8886
    8987  }
    9088 
    91   /* XXX verify this comment...
    92    *
     89  /*
    9390   *  At this point, the semaphore does not exist and everything has been
    9491   *  checked. We should go ahead and create a semaphore.
     
    10299  );
    103100 
     101  /*
     102   * errno was set by Create_support, so don't set it again.
     103   */
     104
    104105  if ( status == -1 )
    105     return (sem_t *) -1;
     106    return SEM_FAILED;
    106107
    107108  return (sem_t *) &the_semaphore->Object.id;
    108  
    109109}
  • cpukit/posix/src/semunlink.c

    rc9ae846 r17879f4  
    3232 
    3333  status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id );
    34    
    35   if ( !status )
     34  if ( status != 0 )
    3635    set_errno_and_return_minus_one( status );
    3736
     
    5655
    5756      the_semaphore->linked = FALSE;
    58 
     57      _POSIX_Semaphore_Namespace_remove( the_semaphore );
    5958      _POSIX_Semaphore_Delete( the_semaphore );
    6059
Note: See TracChangeset for help on using the changeset viewer.