mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-29 16:00:17 +00:00
2010-06-24 Bharath Suri <bharath.s.jois@gmail.com>
PR 1542/filesystem PR 1585/filesystem * libfs/src/pipe/fifo.c: pipe_control_t was not deallocated if fifo_open() was attempted with (O_WRONLY|O_NONBLOCK). Mutex was locked too many times on this path and we needed an unlock.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2010-06-24 Bharath Suri <bharath.s.jois@gmail.com>
|
||||
|
||||
PR 1542/filesystem
|
||||
PR 1585/filesystem
|
||||
* libfs/src/pipe/fifo.c: pipe_control_t was not deallocated if
|
||||
fifo_open() was attempted with (O_WRONLY|O_NONBLOCK).
|
||||
Mutex was locked too many times on this path and we needed an unlock.
|
||||
|
||||
2010-06-24 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||
|
||||
PR 1587/filesystem
|
||||
|
||||
@@ -102,6 +102,7 @@ static int pipe_alloc(
|
||||
if (! pipe->Buffer)
|
||||
goto err_buf;
|
||||
|
||||
err = -ENOMEM;
|
||||
if (rtems_barrier_create(
|
||||
rtems_build_name ('P', 'I', 'r', c),
|
||||
RTEMS_BARRIER_MANUAL_RELEASE, 0,
|
||||
@@ -301,15 +302,17 @@ int fifo_open(
|
||||
break;
|
||||
|
||||
case LIBIO_FLAGS_WRITE:
|
||||
pipe->writerCounter ++;
|
||||
|
||||
if (pipe->Writers ++ == 0)
|
||||
PIPE_WAKEUPREADERS(pipe);
|
||||
|
||||
if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) {
|
||||
PIPE_UNLOCK(pipe);
|
||||
err = -ENXIO;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
pipe->writerCounter ++;
|
||||
if (pipe->Writers ++ == 0)
|
||||
PIPE_WAKEUPREADERS(pipe);
|
||||
|
||||
if (pipe->Readers == 0) {
|
||||
prevCounter = pipe->readerCounter;
|
||||
err = -EINTR;
|
||||
|
||||
Reference in New Issue
Block a user