diff --git a/drivers/pipe.c b/drivers/pipe.c index f51b4db2f1ba22d6fd6379ef1ab4f7330530f88d..4b052e40f5f5687aa1cb81fa38d5a936213e8474 100644 --- a/drivers/pipe.c +++ b/drivers/pipe.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/pipe.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -99,6 +99,7 @@ static uint32 g_pipecreated = 0; /**************************************************************************** * Name: pipe_allocate ****************************************************************************/ + static inline int pipe_allocate(void) { int pipeno; @@ -119,6 +120,7 @@ static inline int pipe_allocate(void) /**************************************************************************** * Name: pipe_free ****************************************************************************/ + static inline void pipe_free(int pipeno) { int ret = sem_wait(&g_pipesem); @@ -132,6 +134,7 @@ static inline void pipe_free(int pipeno) /**************************************************************************** * Name: pipe_close ****************************************************************************/ + static int pipe_close(FAR struct file *filep) { struct inode *inode = filep->f_inode; @@ -179,6 +182,7 @@ static int pipe_close(FAR struct file *filep) * appropriately. * ****************************************************************************/ + int pipe(int filedes[2]) { struct pipe_dev_s *dev = NULL; diff --git a/drivers/pipe_common.c b/drivers/pipe_common.c index 7bfddb7dbd0348e0ca593eddedfa12980f915617..82a822374d6612f5bad613c1e8067425b6fb4c22 100644 --- a/drivers/pipe_common.c +++ b/drivers/pipe_common.c @@ -38,8 +38,8 @@ ****************************************************************************/ #include <nuttx/config.h> - #include <sys/types.h> + #include <sys/stat.h> #include <stdlib.h> #include <string.h> @@ -206,6 +206,7 @@ int pipecommon_open(FAR struct file *filep) /* If this this is the first writer, then the read semaphore indicates the * number of readers waiting for the first writer. Wake them all up. */ + if (dev->d_nwriters == 1) { while (sem_getvalue(&dev->d_rdsem, &sval) == 0 && sval < 0)