mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2009-12-28 Shrikant Gaikwad <n3oo3n@gmail.com>
* cpukit/libfs/src/pipe/pipe.c Restructured code to remove the goto statements.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2009-12-28 Shrikant Gaikwad <n3oo3n@gmail.com>
|
||||||
|
|
||||||
|
* cpukit/libfs/src/pipe/pipe.c Restructured code to remove the
|
||||||
|
goto statements.
|
||||||
|
|
||||||
2009-12-21 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2009-12-21 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* libnetworking/lib/ftpfs.c: Use EINVAL not EBADRQC.
|
* libnetworking/lib/ftpfs.c: Use EINVAL not EBADRQC.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ extern "C" {
|
|||||||
* This macro defines the standard device driver table entry for
|
* This macro defines the standard device driver table entry for
|
||||||
* a frame buffer device driver.
|
* a frame buffer device driver.
|
||||||
*/
|
*/
|
||||||
#define FRAMEBUFFER_DRIVER_TABLE_ENTRY \
|
#define FRAME_BUFFER_DRIVER_TABLE_ENTRY \
|
||||||
{ frame_buffer_initialize, frame_buffer_open, frame_buffer_close, \
|
{ frame_buffer_initialize, frame_buffer_open, frame_buffer_close, \
|
||||||
frame_buffer_read, frame_buffer_write, frame_buffer_control }
|
frame_buffer_read, frame_buffer_write, frame_buffer_control }
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ int pipe_create(
|
|||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
rtems_libio_t *iop;
|
rtems_libio_t *iop;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
/* Create /tmp if not exists */
|
/* Create /tmp if not exists */
|
||||||
if (rtems_filesystem_evaluate_path("/tmp", 3, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
|
if (rtems_filesystem_evaluate_path("/tmp", 3, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
|
||||||
!= 0) {
|
!= 0) {
|
||||||
@@ -47,8 +46,9 @@ int pipe_create(
|
|||||||
|
|
||||||
/* Try creating FIFO file until find an available file name */
|
/* Try creating FIFO file until find an available file name */
|
||||||
while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) {
|
while (mkfifo(fifopath, S_IRUSR|S_IWUSR) != 0) {
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST){
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
/* Just try once... */
|
/* Just try once... */
|
||||||
return -1;
|
return -1;
|
||||||
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
|
sprintf(fifopath + 10, "%04x", rtems_pipe_no ++);
|
||||||
@@ -58,26 +58,24 @@ int pipe_create(
|
|||||||
filsdes[0] = open(fifopath, O_RDONLY | O_NONBLOCK);
|
filsdes[0] = open(fifopath, O_RDONLY | O_NONBLOCK);
|
||||||
if (filsdes[0] < 0) {
|
if (filsdes[0] < 0) {
|
||||||
err = errno;
|
err = errno;
|
||||||
goto out;
|
/* Delete file at errors, or else if pipe is successfully created
|
||||||
|
the file node will be deleted after it is closed by all. */
|
||||||
|
unlink(fifopath);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
/* Reset open file to blocking mode */
|
/* Reset open file to blocking mode */
|
||||||
iop = rtems_libio_iop(filsdes[0]);
|
iop = rtems_libio_iop(filsdes[0]);
|
||||||
iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
|
iop->flags &= ~LIBIO_FLAGS_NO_DELAY;
|
||||||
|
|
||||||
filsdes[1] = open(fifopath, O_WRONLY);
|
filsdes[1] = open(fifopath, O_WRONLY);
|
||||||
|
|
||||||
if (filsdes[1] < 0) {
|
if (filsdes[1] < 0) {
|
||||||
err = errno;
|
err = errno;
|
||||||
close(filsdes[0]);
|
close(filsdes[0]);
|
||||||
|
}
|
||||||
|
unlink(fifopath);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
/* Delete file at errors, or else if pipe is successfully created
|
|
||||||
the file node will be deleted after it is closed by all. */
|
|
||||||
unlink(fifopath);
|
|
||||||
|
|
||||||
if (! err)
|
|
||||||
return 0;
|
|
||||||
rtems_set_errno_and_return_minus_one(err);
|
rtems_set_errno_and_return_minus_one(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user