mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Move pipe() and mkpipe() to nuttx/libc. Change syscalls to pipe2() and mkfifo2()
This commit is contained in:
@@ -130,38 +130,4 @@ int mkfifo2(FAR const char *pathname, mode_t mode, size_t bufsize)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mkfifo
|
||||
*
|
||||
* Description:
|
||||
* 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 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).
|
||||
*
|
||||
* Inputs:
|
||||
* pathname - The full path to the FIFO instance to attach to or to create
|
||||
* (if not already created).
|
||||
* mode - Ignored for now
|
||||
*
|
||||
* Return:
|
||||
* 0 is returned on success; otherwise, -1 is returned with errno set
|
||||
* appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mkfifo(FAR const char *pathname, mode_t mode)
|
||||
{
|
||||
return mkfifo2(pathname, mode, CONFIG_DEV_FIFO_SIZE);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEV_FIFO_SIZE > 0 */
|
||||
|
||||
@@ -294,26 +294,4 @@ errout:
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pipe2
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Inputs:
|
||||
* fd[2] - The user provided array in which to catch the pipe file
|
||||
* descriptors
|
||||
*
|
||||
* Return:
|
||||
* 0 is returned on success; otherwise, -1 is returned with errno set
|
||||
* appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pipe(int fd[2])
|
||||
{
|
||||
return pipe2(fd, CONFIG_DEV_PIPE_SIZE);
|
||||
}
|
||||
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
||||
|
||||
Reference in New Issue
Block a user