Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
34bffcda
Commit
34bffcda
authored
Nov 06, 2010
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Modified some log messages and shell output to make more sense.
parent
8471c08b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
os/ass3/fishbones.c
os/ass3/fishbones.c
+8
-7
No files found.
os/ass3/fishbones.c
View file @
34bffcda
...
@@ -57,6 +57,7 @@ static void gup(FILE * log1, FILE * log2, int pipe_id[2], int myNumber)
...
@@ -57,6 +57,7 @@ static void gup(FILE * log1, FILE * log2, int pipe_id[2], int myNumber)
fprintf
(
log1
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log1
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log2
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log2
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log3
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log3
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
break
;
}
}
else
else
{
{
...
@@ -149,7 +150,7 @@ main(int argc, char * argv[])
...
@@ -149,7 +150,7 @@ main(int argc, char * argv[])
*/
*/
/* Ignore newlines and spaces */
/* Ignore newlines and spaces */
if
(
c
==
'\n'
||
(
int
)
c
==
32
)
if
(
c
==
'\n'
||
c
==
32
)
{
{
continue
;
continue
;
}
}
...
@@ -172,8 +173,8 @@ main(int argc, char * argv[])
...
@@ -172,8 +173,8 @@ main(int argc, char * argv[])
}
}
else
else
{
{
if
(
c
==
'P'
)
//
if( c == 'P' )
wait
(
NULL
);
//
wait(NULL);
pid_t
child_id
;
pid_t
child_id
;
...
@@ -182,7 +183,7 @@ main(int argc, char * argv[])
...
@@ -182,7 +183,7 @@ main(int argc, char * argv[])
/* When you fork, be sure to print the process id of the child
/* When you fork, be sure to print the process id of the child
(if the fork succeeds) and an error message otherwise */
(if the fork succeeds) and an error message otherwise */
switch
(
fork
(
)
)
switch
(
(
child_id
=
fork
()
)
)
{
{
case
-
1
:
case
-
1
:
perror
(
"Child could not be created
\n
"
);
perror
(
"Child could not be created
\n
"
);
...
@@ -191,8 +192,8 @@ main(int argc, char * argv[])
...
@@ -191,8 +192,8 @@ main(int argc, char * argv[])
gup
(
log1
,
log2
,
pipe_id
,
getpid
());
gup
(
log1
,
log2
,
pipe_id
,
getpid
());
break
;
break
;
default:
default:
fp
uts
(
"Parent process continuing...
\n
"
,
log1
);
fp
rintf
(
log1
,
"Started child process %d
\n
"
,
child_id
);
fp
uts
(
"Parent process continuing...
\n
"
,
log2
);
fp
rintf
(
log2
,
"Started child process %d
\n
"
,
child_id
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment