Changeset 17879f4 in rtems for c/src/exec/posix/src/semopen.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.