Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
5c31e01c
提交
5c31e01c
3月 23, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Covert sys_mkdir to sys_mkdirat
上级
d2e856e0
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
27 行增加
和
6 行删除
+27
-6
kern_c.h
include/kern_c.h
+1
-1
syscall.h
include/syscall.h
+1
-1
user.h
include/user.h
+1
-0
bootdata.c
kernel/bootdata.c
+1
-1
sysfile.cc
kernel/sysfile.cc
+16
-2
ulib.c
lib/ulib.c
+6
-0
usys.S
lib/usys.S
+1
-1
没有找到文件。
include/kern_c.h
浏览文件 @
5c31e01c
...
...
@@ -29,7 +29,7 @@ long sys_fstat(int, struct stat*);
long
sys_getpid
(
void
);
long
sys_kill
(
int
);
long
sys_link
(
const
char
*
,
const
char
*
);
long
sys_mkdir
(
const
char
*
);
long
sys_mkdir
at
(
int
,
const
char
*
);
long
sys_mknod
(
const
char
*
,
int
,
int
);
long
sys_openat
(
int
,
const
char
*
,
int
);
long
sys_pipe
(
int
*
);
...
...
include/syscall.h
浏览文件 @
5c31e01c
...
...
@@ -13,7 +13,7 @@
#define SYS_unlink 12
#define SYS_fstat 13
#define SYS_link 14
#define SYS_mkdir
15
#define SYS_mkdir
at
15
#define SYS_chdir 16
#define SYS_dup 17
#define SYS_getpid 18
...
...
include/user.h
浏览文件 @
5c31e01c
...
...
@@ -18,6 +18,7 @@ int unlink(const char*);
int
fstat
(
int
fd
,
struct
stat
*
);
int
link
(
const
char
*
,
const
char
*
);
int
mkdir
(
const
char
*
);
int
mkdirat
(
int
dirfd
,
const
char
*
pathname
);
int
chdir
(
const
char
*
);
int
dup
(
int
);
int
getpid
(
void
);
...
...
kernel/bootdata.c
浏览文件 @
5c31e01c
...
...
@@ -39,7 +39,7 @@ long (*syscalls[])(u64, u64, u64, u64, u64) = {
SYSCALL
(
getpid
),
SYSCALL
(
kill
),
SYSCALL
(
link
),
SYSCALL
(
mkdir
),
SYSCALL
(
mkdir
at
),
SYSCALL
(
mknod
),
SYSCALL
(
openat
),
SYSCALL
(
pipe
),
...
...
kernel/sysfile.cc
浏览文件 @
5c31e01c
...
...
@@ -328,11 +328,25 @@ sys_openat(int dirfd, const char *path, int omode)
}
long
sys_mkdir
(
const
char
*
path
)
sys_mkdir
at
(
int
dirfd
,
const
char
*
path
)
{
struct
inode
*
cwd
;
struct
inode
*
ip
;
if
(
argcheckstr
(
path
)
<
0
||
(
ip
=
create
(
myproc
()
->
cwd
,
path
,
T_DIR
,
0
,
0
))
==
0
)
if
(
dirfd
==
AT_FDCWD
)
{
cwd
=
myproc
()
->
cwd
;
}
else
{
// XXX(sbw) do we need the sref while we touch fdir->ip?
sref
<
file
>
fdir
;
if
(
!
getfile
(
dirfd
,
&
fdir
)
||
fdir
->
type
!=
file
::
FD_INODE
)
return
-
1
;
cwd
=
fdir
->
ip
;
}
if
(
argcheckstr
(
path
)
<
0
)
return
-
1
;
ip
=
create
(
cwd
,
path
,
T_DIR
,
0
,
0
);
if
(
ip
==
nullptr
)
return
-
1
;
iunlockput
(
ip
);
return
0
;
...
...
lib/ulib.c
浏览文件 @
5c31e01c
...
...
@@ -151,6 +151,12 @@ open(const char *path, int omode)
return
openat
(
AT_FDCWD
,
path
,
omode
);
}
int
mkdir
(
const
char
*
path
)
{
return
mkdirat
(
AT_FDCWD
,
path
);
}
extern
void
__cxa_pure_virtual
(
void
);
void
__cxa_pure_virtual
(
void
)
{
...
...
lib/usys.S
浏览文件 @
5c31e01c
...
...
@@ -30,7 +30,7 @@ SYSCALL(mknod)
SYSCALL(unlink)
SYSCALL(fstat)
SYSCALL(link)
SYSCALL(mkdir)
SYSCALL(mkdir
at
)
SYSCALL(chdir)
SYSCALL(dup)
SYSCALL(getpid)
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论