fs: Remove the unused nx_dup to prefer file_dup for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
cf21319d3a
commit
b22cc1e2b8
@ -77,42 +77,6 @@ int file_dup(FAR struct file *filep, int minfd)
|
|||||||
return fd2;
|
return fd2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nx_dup
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* nx_dup() is similar to the standard 'dup' interface except that is
|
|
||||||
* not a cancellation point and it does not modify the errno variable.
|
|
||||||
*
|
|
||||||
* nx_dup() is an internal NuttX interface and should not be called from
|
|
||||||
* applications.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* The new file descriptor is returned on success; a negated errno value is
|
|
||||||
* returned on any failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int nx_dup(int fd)
|
|
||||||
{
|
|
||||||
FAR struct file *filep;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Get the file structure corresponding to the file descriptor. */
|
|
||||||
|
|
||||||
ret = fs_getfilep(fd, &filep);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUGASSERT(filep != NULL);
|
|
||||||
|
|
||||||
/* Let file_dup() do the real work */
|
|
||||||
|
|
||||||
return file_dup(filep, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: dup
|
* Name: dup
|
||||||
*
|
*
|
||||||
@ -123,14 +87,30 @@ int nx_dup(int fd)
|
|||||||
|
|
||||||
int dup(int fd)
|
int dup(int fd)
|
||||||
{
|
{
|
||||||
|
FAR struct file *filep;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nx_dup(fd);
|
/* Get the file structure corresponding to the file descriptor. */
|
||||||
|
|
||||||
|
ret = fs_getfilep(fd, &filep);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
set_errno(-ret);
|
goto err;
|
||||||
ret = ERROR;
|
}
|
||||||
|
|
||||||
|
DEBUGASSERT(filep != NULL);
|
||||||
|
|
||||||
|
/* Let file_dup() do the real work */
|
||||||
|
|
||||||
|
ret = file_dup(filep, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
err:
|
||||||
|
set_errno(-ret);
|
||||||
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
@ -788,24 +788,6 @@ int files_duplist(FAR struct filelist *plist, FAR struct filelist *clist);
|
|||||||
|
|
||||||
int file_dup(FAR struct file *filep, int minfd);
|
int file_dup(FAR struct file *filep, int minfd);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nx_dup
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* nx_dup() is similar to the standard 'dup' interface except that is
|
|
||||||
* not a cancellation point and it does not modify the errno variable.
|
|
||||||
*
|
|
||||||
* nx_dup() is an internal NuttX interface and should not be called from
|
|
||||||
* applications.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* The new file descriptor is returned on success; a negated errno value is
|
|
||||||
* returned on any failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int nx_dup(int fd);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_dup2
|
* Name: file_dup2
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user