Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
3a2310f7
提交
3a2310f7
8月 27, 2007
创建
作者:
rsc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make code match comment
上级
64c47374
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
8 行删除
+7
-8
syscall.c
syscall.c
+6
-7
sysfile.c
sysfile.c
+1
-1
没有找到文件。
syscall.c
浏览文件 @
3a2310f7
...
@@ -42,20 +42,20 @@ fetchstr(struct proc *p, uint addr, char **pp)
...
@@ -42,20 +42,20 @@ fetchstr(struct proc *p, uint addr, char **pp)
// Fetch the argno'th 32-bit system call argument.
// Fetch the argno'th 32-bit system call argument.
int
int
argint
(
int
argno
,
int
*
ip
)
argint
(
int
n
,
int
*
ip
)
{
{
return
fetchint
(
cp
,
cp
->
tf
->
esp
+
4
+
4
*
argno
,
ip
);
return
fetchint
(
cp
,
cp
->
tf
->
esp
+
4
+
4
*
n
,
ip
);
}
}
// Fetch the nth word-sized system call argument as a pointer
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes. Check that the pointer
// to a block of memory of size n bytes. Check that the pointer
// lies within the process address space.
// lies within the process address space.
int
int
argptr
(
int
argno
,
char
**
pp
,
int
size
)
argptr
(
int
n
,
char
**
pp
,
int
size
)
{
{
int
i
;
int
i
;
if
(
argint
(
argno
,
&
i
)
<
0
)
if
(
argint
(
n
,
&
i
)
<
0
)
return
-
1
;
return
-
1
;
if
((
uint
)
i
>=
cp
->
sz
||
(
uint
)
i
+
size
>=
cp
->
sz
)
if
((
uint
)
i
>=
cp
->
sz
||
(
uint
)
i
+
size
>=
cp
->
sz
)
return
-
1
;
return
-
1
;
...
@@ -68,10 +68,10 @@ argptr(int argno, char **pp, int size)
...
@@ -68,10 +68,10 @@ argptr(int argno, char **pp, int size)
// (There is no shared writable memory, so the string can't change
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
// between this check and being used by the kernel.)
int
int
argstr
(
int
argno
,
char
**
pp
)
argstr
(
int
n
,
char
**
pp
)
{
{
int
addr
;
int
addr
;
if
(
argint
(
argno
,
&
addr
)
<
0
)
if
(
argint
(
n
,
&
addr
)
<
0
)
return
-
1
;
return
-
1
;
return
fetchstr
(
cp
,
addr
,
pp
);
return
fetchstr
(
cp
,
addr
,
pp
);
}
}
...
@@ -88,7 +88,6 @@ extern int sys_kill(void);
...
@@ -88,7 +88,6 @@ extern int sys_kill(void);
extern
int
sys_link
(
void
);
extern
int
sys_link
(
void
);
extern
int
sys_mkdir
(
void
);
extern
int
sys_mkdir
(
void
);
extern
int
sys_mknod
(
void
);
extern
int
sys_mknod
(
void
);
//PAGEBREAK: 0
extern
int
sys_open
(
void
);
extern
int
sys_open
(
void
);
extern
int
sys_pipe
(
void
);
extern
int
sys_pipe
(
void
);
extern
int
sys_read
(
void
);
extern
int
sys_read
(
void
);
...
...
sysfile.c
浏览文件 @
3a2310f7
...
@@ -17,7 +17,7 @@ argfd(int n, int *pfd, struct file **pf)
...
@@ -17,7 +17,7 @@ argfd(int n, int *pfd, struct file **pf)
int
fd
;
int
fd
;
struct
file
*
f
;
struct
file
*
f
;
if
(
argint
(
argno
,
&
fd
)
<
0
)
if
(
argint
(
n
,
&
fd
)
<
0
)
return
-
1
;
return
-
1
;
if
(
fd
<
0
||
fd
>=
NOFILE
||
(
f
=
cp
->
ofile
[
fd
])
==
0
)
if
(
fd
<
0
||
fd
>=
NOFILE
||
(
f
=
cp
->
ofile
[
fd
])
==
0
)
return
-
1
;
return
-
1
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论