Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-19au
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
csep551
xv6-19au
Commits
f2f062da
Commit
f2f062da
authored
17 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
check p->killed for long-lived sleeps
parent
1cb183a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
console.c
+7
-1
7 additions, 1 deletion
console.c
pipe.c
+2
-2
2 additions, 2 deletions
pipe.c
proc.c
+1
-1
1 addition, 1 deletion
proc.c
with
10 additions
and
4 deletions
console.c
+
7
−
1
View file @
f2f062da
...
...
@@ -6,6 +6,7 @@
#include
"dev.h"
#include
"param.h"
#include
"mmu.h"
#include
"proc.h"
struct
spinlock
console_lock
;
int
panicked
=
0
;
...
...
@@ -395,8 +396,13 @@ console_read(int minor, char *dst, int n)
target
=
n
;
acquire
(
&
kbd_lock
);
while
(
n
>
0
){
while
(
kbd_r
==
kbd_w
)
while
(
kbd_r
==
kbd_w
){
if
(
curproc
[
cpu
()]
->
killed
){
release
(
&
kbd_lock
);
return
-
1
;
}
sleep
(
&
kbd_r
,
&
kbd_lock
);
}
c
=
kbd_buf
[
kbd_r
++
];
if
(
c
==
C
(
'D'
)){
// EOF
if
(
n
<
target
){
...
...
This diff is collapsed.
Click to expand it.
pipe.c
+
2
−
2
View file @
f2f062da
...
...
@@ -86,7 +86,7 @@ pipe_write(struct pipe *p, char *addr, int n)
for
(
i
=
0
;
i
<
n
;
i
++
){
while
(((
p
->
writep
+
1
)
%
PIPESIZE
)
==
p
->
readp
){
if
(
p
->
readopen
==
0
){
if
(
p
->
readopen
==
0
||
curproc
[
cpu
()]
->
killed
){
release
(
&
p
->
lock
);
return
-
1
;
}
...
...
@@ -110,7 +110,7 @@ pipe_read(struct pipe *p, char *addr, int n)
acquire
(
&
p
->
lock
);
while
(
p
->
readp
==
p
->
writep
){
if
(
p
->
writeopen
==
0
){
if
(
p
->
writeopen
==
0
||
curproc
[
cpu
()]
->
killed
){
release
(
&
p
->
lock
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
proc.c
+
1
−
1
View file @
f2f062da
...
...
@@ -405,7 +405,7 @@ proc_wait(void)
}
// No point waiting if we don't have any children.
if
(
!
havekids
){
if
(
!
havekids
||
cp
->
killed
){
release
(
&
proc_table_lock
);
return
-
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment