mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
fs/dup3: impletement dup3/nx_dup3_from_tcb function
refs: https://man7.org/linux/man-pages/man2/dup.2.html Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
+19
-1
@@ -911,7 +911,7 @@ int file_allocate(FAR struct inode *inode, int oflags, off_t pos,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int file_dup(FAR struct file *filep, int minfd, bool cloexec);
|
||||
int file_dup(FAR struct file *filep, int minfd, int flags);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_dup2
|
||||
@@ -970,6 +970,24 @@ int nx_dup2_from_tcb(FAR struct tcb_s *tcb, int fd1, int fd2);
|
||||
|
||||
int nx_dup2(int fd1, int fd2);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_dup3
|
||||
*
|
||||
* Description:
|
||||
* Assign an inode to a specific files structure. This is the heart of
|
||||
* dup3.
|
||||
*
|
||||
* Equivalent to the non-standard dup3() function except that it
|
||||
* accepts struct file instances instead of file descriptors.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is return on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int file_dup3(FAR struct file *filep1, FAR struct file *filep2, int flags);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_open
|
||||
*
|
||||
|
||||
@@ -328,6 +328,7 @@ int daemon(int nochdir, int noclose);
|
||||
int close(int fd);
|
||||
int dup(int fd);
|
||||
int dup2(int fd1, int fd2);
|
||||
int dup3(int fd1, int fd2, int flags);
|
||||
int fsync(int fd);
|
||||
off_t lseek(int fd, off_t offset, int whence);
|
||||
ssize_t read(int fd, FAR void *buf, size_t nbytes);
|
||||
|
||||
Reference in New Issue
Block a user