Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
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
Krishna Vinnakota
CSEP551
Commits
b1fb19b6
Commit
b1fb19b6
authored
17 years ago
by
rsc
Browse files
Options
Downloads
Patches
Plain Diff
Use parent pointer instead of ppid.
parent
3a057d12
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
proc.c
+7
-9
7 additions, 9 deletions
proc.c
proc.h
+1
-1
1 addition, 1 deletion
proc.h
with
8 additions
and
10 deletions
proc.c
+
7
−
9
View file @
b1fb19b6
...
...
@@ -118,7 +118,7 @@ copyproc(struct proc *p)
np
->
tf
=
(
struct
trapframe
*
)(
np
->
kstack
+
KSTACKSIZE
)
-
1
;
if
(
p
){
// Copy process state from p.
np
->
p
pid
=
p
->
pid
;
np
->
p
arent
=
p
;
memmove
(
np
->
tf
,
p
->
tf
,
sizeof
(
*
np
->
tf
));
np
->
sz
=
p
->
sz
;
...
...
@@ -366,15 +366,13 @@ proc_exit(void)
acquire
(
&
proc_table_lock
);
// Wake up waiting parent.
for
(
p
=
proc
;
p
<
&
proc
[
NPROC
];
p
++
)
if
(
p
->
pid
==
cp
->
ppid
)
wakeup1
(
p
);
// Parent might be sleeping in proc_wait.
wakeup1
(
cp
->
parent
);
// Pass abandoned children to init.
for
(
p
=
proc
;
p
<
&
proc
[
NPROC
];
p
++
){
if
(
p
->
p
pid
==
cp
->
pid
){
p
->
p
pid
=
initproc
->
pid
;
if
(
p
->
p
arent
==
cp
){
p
->
p
arent
=
initproc
;
if
(
p
->
state
==
ZOMBIE
)
wakeup1
(
initproc
);
}
...
...
@@ -403,7 +401,7 @@ proc_wait(void)
p
=
&
proc
[
i
];
if
(
p
->
state
==
UNUSED
)
continue
;
if
(
p
->
p
pid
==
cp
->
pid
){
if
(
p
->
p
arent
==
cp
){
if
(
p
->
state
==
ZOMBIE
){
// Found one.
kfree
(
p
->
mem
,
p
->
sz
);
...
...
@@ -411,7 +409,7 @@ proc_wait(void)
pid
=
p
->
pid
;
p
->
state
=
UNUSED
;
p
->
pid
=
0
;
p
->
p
pid
=
0
;
p
->
p
arent
=
0
;
p
->
name
[
0
]
=
0
;
release
(
&
proc_table_lock
);
return
pid
;
...
...
This diff is collapsed.
Click to expand it.
proc.h
+
1
−
1
View file @
b1fb19b6
...
...
@@ -33,7 +33,7 @@ struct proc {
char
*
kstack
;
// Bottom of kernel stack for this process
enum
proc_state
state
;
// Process state
int
pid
;
// Process ID
int
ppid
;
// Parent p
id
struct
proc
*
parent
;
// Parent p
rocess
void
*
chan
;
// If non-zero, sleeping on chan
int
killed
;
// If non-zero, have been killed
struct
file
*
ofile
[
NOFILE
];
// Open files
...
...
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