diff --git a/drivers/pipes/fifo.c b/drivers/pipes/fifo.c index 55a9a85144..8a9a080b05 100644 --- a/drivers/pipes/fifo.c +++ b/drivers/pipes/fifo.c @@ -45,7 +45,6 @@ #include #include -#include #include "pipe_common.h" diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c index 3a1b0d4c9f..0812197b92 100644 --- a/drivers/pipes/pipe.c +++ b/drivers/pipes/pipe.c @@ -47,7 +47,6 @@ #include #include -#include #include #include "pipe_common.h" diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c index a750d37ff6..e2e9ce6a7a 100644 --- a/drivers/serial/pty.c +++ b/drivers/serial/pty.c @@ -83,7 +83,6 @@ #include #include #include -#include #include #include "pty.h" diff --git a/include/nuttx/drivers/drivers.h b/include/nuttx/drivers/drivers.h index b1420c29bb..a0d08adf76 100644 --- a/include/nuttx/drivers/drivers.h +++ b/include/nuttx/drivers/drivers.h @@ -217,72 +217,6 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, size_t len); -/**************************************************************************** - * Name: nx_pipe - * - * Description: - * nx_pipe() creates a pair of file descriptors, pointing to a pipe inode, - * and places them in the array pointed to by 'fd'. fd[0] is for reading, - * fd[1] is for writing. - * - * NOTE: nx_pipe is a special, non-standard, NuttX-only interface. Since - * the NuttX FIFOs are based in in-memory, circular buffers, the ability - * to control the size of those buffers is critical for system tuning. - * - * Input Parameters: - * fd[2] - The user provided array in which to catch the pipe file - * descriptors - * bufsize - The size of the in-memory, circular buffer in bytes. - * flags - The file status flags. - * - * Returned Value: - * 0 is returned on success; a negated errno value is returned on a - * failure. - * - ****************************************************************************/ - -#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 -int nx_pipe(int fd[2], size_t bufsize, int flags); -#endif - -/**************************************************************************** - * Name: nx_mkfifo - * - * Description: - * nx_mkfifo() makes a FIFO device driver file with name 'pathname.' Unlike - * Linux, a NuttX FIFO is not a special file type but simply a device - * driver instance. 'mode' specifies the FIFO's permissions. - * - * Once the FIFO has been created by nx_mkfifo(), any thread can open it - * for reading or writing, in the same way as an ordinary file. However, it - * must have been opened from both reading and writing before input or - * output can be performed. This FIFO implementation will block all - * attempts to open a FIFO read-only until at least one thread has opened - * the FIFO for writing. - * - * If all threads that write to the FIFO have closed, subsequent calls to - * read() on the FIFO will return 0 (end-of-file). - * - * NOTE: nx_mkfifo is a special, non-standard, NuttX-only interface. Since - * the NuttX FIFOs are based in in-memory, circular buffers, the ability - * to control the size of those buffers is critical for system tuning. - * - * Input Parameters: - * pathname - The full path to the FIFO instance to attach to or to create - * (if not already created). - * mode - Ignored for now - * bufsize - The size of the in-memory, circular buffer in bytes. - * - * Returned Value: - * 0 is returned on success; a negated errno value is returned on a - * failure. - * - ****************************************************************************/ - -#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 -int nx_mkfifo(FAR const char *pathname, mode_t mode, size_t bufsize); -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 4005e3a75a..71473a2a43 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -1467,6 +1467,72 @@ int nx_stat(FAR const char *path, FAR struct stat *buf, int resolve); int nx_unlink(FAR const char *pathname); +/**************************************************************************** + * Name: nx_pipe + * + * Description: + * nx_pipe() creates a pair of file descriptors, pointing to a pipe inode, + * and places them in the array pointed to by 'fd'. fd[0] is for reading, + * fd[1] is for writing. + * + * NOTE: nx_pipe is a special, non-standard, NuttX-only interface. Since + * the NuttX FIFOs are based in in-memory, circular buffers, the ability + * to control the size of those buffers is critical for system tuning. + * + * Input Parameters: + * fd[2] - The user provided array in which to catch the pipe file + * descriptors + * bufsize - The size of the in-memory, circular buffer in bytes. + * flags - The file status flags. + * + * Returned Value: + * 0 is returned on success; a negated errno value is returned on a + * failure. + * + ****************************************************************************/ + +#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 +int nx_pipe(int fd[2], size_t bufsize, int flags); +#endif + +/**************************************************************************** + * Name: nx_mkfifo + * + * Description: + * nx_mkfifo() makes a FIFO device driver file with name 'pathname.' Unlike + * Linux, a NuttX FIFO is not a special file type but simply a device + * driver instance. 'mode' specifies the FIFO's permissions. + * + * Once the FIFO has been created by nx_mkfifo(), any thread can open it + * for reading or writing, in the same way as an ordinary file. However, it + * must have been opened from both reading and writing before input or + * output can be performed. This FIFO implementation will block all + * attempts to open a FIFO read-only until at least one thread has opened + * the FIFO for writing. + * + * If all threads that write to the FIFO have closed, subsequent calls to + * read() on the FIFO will return 0 (end-of-file). + * + * NOTE: nx_mkfifo is a special, non-standard, NuttX-only interface. Since + * the NuttX FIFOs are based in in-memory, circular buffers, the ability + * to control the size of those buffers is critical for system tuning. + * + * Input Parameters: + * pathname - The full path to the FIFO instance to attach to or to create + * (if not already created). + * mode - Ignored for now + * bufsize - The size of the in-memory, circular buffer in bytes. + * + * Returned Value: + * 0 is returned on success; a negated errno value is returned on a + * failure. + * + ****************************************************************************/ + +#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 +int nx_mkfifo(FAR const char *pathname, mode_t mode, size_t bufsize); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/libs/libc/misc/lib_mkfifo.c b/libs/libc/misc/lib_mkfifo.c index ec2ab01aea..1d743e66a5 100644 --- a/libs/libc/misc/lib_mkfifo.c +++ b/libs/libc/misc/lib_mkfifo.c @@ -43,7 +43,7 @@ #include #include -#include +#include #if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 diff --git a/libs/libc/unistd/lib_pipe.c b/libs/libc/unistd/lib_pipe.c index 0bf8d30677..d7655cf9be 100644 --- a/libs/libc/unistd/lib_pipe.c +++ b/libs/libc/unistd/lib_pipe.c @@ -27,7 +27,7 @@ #include #include -#include +#include #if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 diff --git a/libs/libc/unistd/lib_pipe2.c b/libs/libc/unistd/lib_pipe2.c index 982da82ef3..04af09e8d5 100644 --- a/libs/libc/unistd/lib_pipe2.c +++ b/libs/libc/unistd/lib_pipe2.c @@ -27,7 +27,7 @@ #include #include -#include +#include #if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0 diff --git a/syscall/syscall.csv b/syscall/syscall.csv index cd592d2b11..213a782f52 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -63,8 +63,8 @@ "mq_timedsend","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","FAR const char *","size_t","unsigned int","FAR const struct timespec *" "mq_unlink","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","FAR const char *" "munmap","sys/mman.h","defined(CONFIG_FS_RAMMAP)","int","FAR void *","size_t" -"nx_mkfifo","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t" -"nx_pipe","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int" +"nx_mkfifo","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t" +"nx_pipe","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int" "nx_task_spawn","nuttx/spawn.h","defined(CONFIG_LIB_SYSCALL) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const struct spawn_syscall_parms_s *" "nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *" "nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"