Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party NuttX
提交
6314fde1
T
Third Party NuttX
项目概览
OpenHarmony
/
Third Party NuttX
大约 1 年 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party NuttX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6314fde1
编写于
3月 25, 2021
作者:
M
maguangyao
提交者:
YOUR_NAME
4月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Nuttx adapt for mksh & toybox
Change-Id: Ia46512ceb07333b3c51ff57d41ef8993f1ca6495
上级
bf2478ca
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
34 addition
and
27 deletion
+34
-27
fs/dirent/fs_opendir.c
fs/dirent/fs_opendir.c
+0
-2
fs/inode/fs_files.c
fs/inode/fs_files.c
+8
-1
fs/vfs/fs_fcntl.c
fs/vfs/fs_fcntl.c
+17
-1
fs/vfs/fs_getfilep.c
fs/vfs/fs_getfilep.c
+5
-3
fs/vfs/fs_open.c
fs/vfs/fs_open.c
+4
-19
include/nuttx/fs/file.h
include/nuttx/fs/file.h
+0
-1
未找到文件。
fs/dirent/fs_opendir.c
浏览文件 @
6314fde1
...
@@ -186,14 +186,12 @@ int do_opendir(const char *path, int oflags)
...
@@ -186,14 +186,12 @@ int do_opendir(const char *path, int oflags)
ret
=
VnodeLookup
(
path
,
&
vp
,
0
);
ret
=
VnodeLookup
(
path
,
&
vp
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
{
{
PRINT_ERR
(
"Failed to find vnode %s
\n
"
,
path
);
VnodeDrop
();
VnodeDrop
();
goto
errout
;
goto
errout
;
}
}
if
(
vp
->
type
!=
VNODE_TYPE_DIR
)
if
(
vp
->
type
!=
VNODE_TYPE_DIR
)
{
{
ret
=
-
ENOTDIR
;
ret
=
-
ENOTDIR
;
PRINT_ERR
(
"opendir (%s) failed, err=%d
\n
"
,
path
,
ret
);
VnodeDrop
();
VnodeDrop
();
goto
errout
;
goto
errout
;
}
}
...
...
fs/inode/fs_files.c
浏览文件 @
6314fde1
...
@@ -701,13 +701,20 @@ int close_files(struct Vnode *vnode)
...
@@ -701,13 +701,20 @@ int close_files(struct Vnode *vnode)
void
files_refer
(
int
fd
)
void
files_refer
(
int
fd
)
{
{
struct
file
*
filep
=
NULL
;
FAR
struct
filelist
*
list
=
sched_getfiles
();
FAR
struct
filelist
*
list
=
sched_getfiles
();
if
(
!
list
||
fd
<
0
||
fd
>=
CONFIG_NFILE_DESCRIPTORS
)
if
(
!
list
||
fd
<
0
||
fd
>=
CONFIG_NFILE_DESCRIPTORS
)
{
{
return
;
return
;
}
}
_files_semtake
(
list
);
_files_semtake
(
list
);
list
->
fl_files
[
fd
].
f_refcount
++
;
(
void
)
fs_getfilep
(
fd
,
&
filep
);
if
(
filep
!=
NULL
)
{
filep
->
f_refcount
++
;
}
_files_semgive
(
list
);
_files_semgive
(
list
);
}
}
...
...
fs/vfs/fs_fcntl.c
浏览文件 @
6314fde1
...
@@ -121,6 +121,11 @@ int file_vfcntl(struct file *filep, int cmd, va_list ap)
...
@@ -121,6 +121,11 @@ int file_vfcntl(struct file *filep, int cmd, va_list ap)
* that refer to the same file.
* that refer to the same file.
*/
*/
{
ret
=
(
filep
->
f_oflags
&
O_CLOEXEC
)
?
FD_CLOEXEC
:
0
;
}
break
;
case
F_SETFD
:
case
F_SETFD
:
/* Set the file descriptor flags defined in <fcntl.h>, that are associated
/* Set the file descriptor flags defined in <fcntl.h>, that are associated
* with fd, to the third argument, arg, taken as type int. If the
* with fd, to the third argument, arg, taken as type int. If the
...
@@ -129,7 +134,18 @@ int file_vfcntl(struct file *filep, int cmd, va_list ap)
...
@@ -129,7 +134,18 @@ int file_vfcntl(struct file *filep, int cmd, va_list ap)
* successful execution of one of the exec functions.
* successful execution of one of the exec functions.
*/
*/
err
=
ENOSYS
;
{
int
oflags
=
va_arg
(
ap
,
int
);
if
(
oflags
&
FD_CLOEXEC
)
{
filep
->
f_oflags
|=
O_CLOEXEC
;
}
else
{
err
=
EPERM
;
/* Not support */
}
}
break
;
break
;
case
F_GETFL
:
case
F_GETFL
:
...
...
fs/vfs/fs_getfilep.c
浏览文件 @
6314fde1
...
@@ -37,9 +37,6 @@
...
@@ -37,9 +37,6 @@
* Included Files
* Included Files
****************************************************************************/
****************************************************************************/
#include "vfs_config.h"
#include "sys/types.h"
#include "errno.h"
#include "errno.h"
#include "unistd.h"
#include "unistd.h"
#include "console.h"
#include "console.h"
...
@@ -76,6 +73,11 @@ static int fs_getfilep_normal(int fd, struct file **filep)
...
@@ -76,6 +73,11 @@ static int fs_getfilep_normal(int fd, struct file **filep)
*
filep
=
(
struct
file
*
)
NULL
;
*
filep
=
(
struct
file
*
)
NULL
;
if
(
fd
>=
STDIN_FILENO
&&
fd
<=
STDERR_FILENO
)
{
fd
=
ConsoleUpdateFd
();
}
if
((
unsigned
int
)
fd
>=
CONFIG_NFILE_DESCRIPTORS
)
if
((
unsigned
int
)
fd
>=
CONFIG_NFILE_DESCRIPTORS
)
{
{
return
-
EBADF
;
return
-
EBADF
;
...
...
fs/vfs/fs_open.c
浏览文件 @
6314fde1
...
@@ -124,23 +124,8 @@ int get_path_from_fd(int fd, char **path)
...
@@ -124,23 +124,8 @@ int get_path_from_fd(int fd, char **path)
return
VFS_ERROR
;
return
VFS_ERROR
;
}
}
char
*
endptr
=
copypath
+
strlen
(
copypath
)
-
1
;
//the ptr before '\0'
/* strip out the file name, for example:/usr/lib/xx.so, final get /usr/lib/ */
while
(
endptr
>
copypath
)
{
if
(
*
endptr
==
'/'
&&
endptr
>
copypath
)
{
*
(
endptr
+
1
)
=
'\0'
;
*
path
=
copypath
;
*
path
=
copypath
;
return
OK
;
return
OK
;
}
endptr
--
;
}
free
(
copypath
);
return
-
ENOENT
;
}
}
static
int
do_creat
(
struct
Vnode
**
node
,
char
*
fullpath
,
mode_t
mode
)
static
int
do_creat
(
struct
Vnode
**
node
,
char
*
fullpath
,
mode_t
mode
)
...
...
include/nuttx/fs/file.h
浏览文件 @
6314fde1
...
@@ -110,7 +110,6 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count);
...
@@ -110,7 +110,6 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count);
*/
*/
extern
int
get_path_from_fd
(
int
fd
,
char
**
path
);
extern
int
get_path_from_fd
(
int
fd
,
char
**
path
);
extern
int
get_path_from_dirfd
(
int
fd
,
char
**
path
);
bool
get_bit
(
int
i
);
bool
get_bit
(
int
i
);
/****************************************************************************
/****************************************************************************
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录