[dfs] Fix stdio fd error when POSIX api is used
POSIX api e.g. poll read write
This commit is contained in:
parent
6db31e30c7
commit
0924d277f6
@ -18,6 +18,10 @@
|
|||||||
#include <lwp.h>
|
#include <lwp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RT_USING_DFS_DEVFS
|
||||||
|
#include <libc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX];
|
const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX];
|
||||||
struct dfs_filesystem filesystem_table[DFS_FILESYSTEMS_MAX];
|
struct dfs_filesystem filesystem_table[DFS_FILESYSTEMS_MAX];
|
||||||
@ -212,6 +216,11 @@ struct dfs_fd *fd_get(int fd)
|
|||||||
struct dfs_fd *d;
|
struct dfs_fd *d;
|
||||||
struct dfs_fdtable *fdt;
|
struct dfs_fdtable *fdt;
|
||||||
|
|
||||||
|
#ifdef RT_USING_DFS_DEVFS
|
||||||
|
if ((0 <= fd) && (fd <= 2))
|
||||||
|
fd = libc_stdio_get_console();
|
||||||
|
#endif
|
||||||
|
|
||||||
fdt = dfs_fdtable_get();
|
fdt = dfs_fdtable_get();
|
||||||
fd = fd - DFS_FD_OFFSET;
|
fd = fd - DFS_FD_OFFSET;
|
||||||
if (fd < 0 || fd >= fdt->maxfd)
|
if (fd < 0 || fd >= fdt->maxfd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user