Changeset b7a08ad in rtems


Ignore:
Timestamp:
Jan 29, 2009, 5:19:00 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.8
Children:
8303576c
Parents:
c9b28ef
Message:

2009-01-29 Nickolay Semyonov-Kolchin <nbkolchin@…>

PR 1359/cpukit

  • libcsupport/src/libio.c: rtems_libio_allocate: rtems_libio_iop_freelist incorrectly zeroed on semaphore error. Now checks error and does not modify anything until sure it has created semaphore.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rc9b28ef rb7a08ad  
     12009-01-29       Nickolay Semyonov-Kolchin <nbkolchin@gmail.com>
     2
     3        PR 1359/cpukit
     4        * libcsupport/src/libio.c: rtems_libio_allocate:
     5        rtems_libio_iop_freelist incorrectly zeroed on semaphore error. Now
     6        checks error and does not modify anything until sure it has created
     7        semaphore.
     8
    192009-01-29      Gene Smith <gene.smith@siemens.com>
    210
  • cpukit/libcsupport/src/libio.c

    rc9b28ef rb7a08ad  
    150150  rtems_libio_t *iop, *next;
    151151  rtems_status_code rc;
     152  rtems_id sema;
    152153
    153154  rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
    154155
    155156  if (rtems_libio_iop_freelist) {
    156     iop = rtems_libio_iop_freelist;
    157     next = iop->data1;
    158     (void) memset( iop, 0, sizeof(rtems_libio_t) );
    159     iop->flags = LIBIO_FLAGS_OPEN;
    160157    rc = rtems_semaphore_create(
    161       RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
     158      RTEMS_LIBIO_IOP_SEM(rtems_libio_iop_freelist - rtems_libio_iops),
    162159      1,
    163160      RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
    164161      RTEMS_NO_PRIORITY,
    165       &iop->sem
     162      &sema
    166163    );
    167164    if (rc != RTEMS_SUCCESSFUL)
    168165      goto failed;
     166    iop = rtems_libio_iop_freelist;
     167    next = iop->data1;
     168    (void) memset( iop, 0, sizeof(rtems_libio_t) );
     169    iop->flags = LIBIO_FLAGS_OPEN;
     170    iop->sem = sema;
    169171    rtems_libio_iop_freelist = next;
    170172    goto done;
Note: See TracChangeset for help on using the changeset viewer.