Ignore:
Timestamp:
08/11/95 14:27:23 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c1403ef1
Parents:
0e4c603
Message:

Initialization of semaphores was incorrect. It did not force
the count to "1" to indicate availability.

Interrupt support was added.

Problem where newlib's errno "overrides" that set by system calls
was addressed.

Fixed bug which resulted in all nodes using the same semaphore although
an array of semaphores was allocated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/unix/posix/shmsupp/lock.c

    r0e4c603 raa9f194  
    4242)
    4343{
    44   lq_cb->lock =
    45     ( lq_cb - Shm_Locked_queues ) / sizeof( Shm_Locked_queue_Control );
     44  lq_cb->lock = lq_cb - Shm_Locked_queues;
    4645}
    4746
     
    6160    int                status;
    6261
    63     isr_level = 0;
    64 
    6562    sb.sem_num = lq_cb->lock;
    6663    sb.sem_op  = -1;
    6764    sb.sem_flg = 0;
     65
    6866    rtems_interrupt_disable( isr_level );
    6967
     
    7270    while (1) {
    7371      status = semop(semid, &sb, 1);
    74       if ( status == 0 )
     72      if ( status >= 0 )
    7573        break;
    76       if ( status == -1 && errno == EINTR )
    77         continue;
    78 
    79       fprintf( stderr, "shm lock(%d %d)\n", status, errno );
    80       exit( 0 );
     74      if ( status == -1 ) {
     75         fix_syscall_errno();    /* in case of newlib */
     76          if (errno == EINTR)
     77              continue;
     78          perror("shm lock");
     79          rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
     80      }
    8181    }
    8282}
     
    9696    int                status;
    9797
    98     isr_level = 0;
    99 
    10098    sb.sem_num = lq_cb->lock;
    10199    sb.sem_op  = 1;
     
    104102    while (1) {
    105103      status = semop(semid, &sb, 1);
    106       if ( status == 0 )
     104      if ( status >= 0 )
    107105        break;
    108       if ( status == -1 && errno == EINTR )
    109         continue;
    110106
    111       fprintf( stderr, "shm unlock(%d %d)\n", status, errno );
    112       exit( 0 );
     107      if ( status == -1 ) {
     108          fix_syscall_errno();    /* in case of newlib */
     109          if (errno == EINTR)
     110              continue;
     111          perror("shm unlock");
     112          rtems_fatal_error_occurred(RTEMS_UNSATISFIED);
     113      }
    113114    }
    114115
Note: See TracChangeset for help on using the changeset viewer.