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
5b5248e7
Commit
5b5248e7
authored
Nov 07, 2010
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Some final changes to OS ass3.
parent
cfbf4096
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
41 deletions
+40
-41
os/ass3/fishbones.c
os/ass3/fishbones.c
+40
-41
No files found.
os/ass3/fishbones.c
View file @
5b5248e7
...
...
@@ -103,7 +103,7 @@ static void gup(FILE * log1, FILE * log2, int pipe_id[2], int myNumber)
void
signal_handler
(
int
signum
)
{
char
*
sig
=
"TERM"
;
char
*
sig
=
"TERM"
;
pid_t
pid
;
switch
(
signum
)
...
...
@@ -129,8 +129,6 @@ signal_handler(int signum)
default:
puts
(
"This handler is unapplicable for this type of signal"
);
}
errno
=
0
;
}
/*
...
...
@@ -148,11 +146,7 @@ main(int argc, char * argv[])
/* Save parent process id for signal handler */
parent_pid
=
getpid
();
/* Open one buffered and one unbuffered log */
printf
(
"argc: %d
\n
"
,
argc
);
log1
=
fopen
(
"child.log1"
,
"wt+"
);
log2
=
fopen
(
"child.log2"
,
"wt+"
);
setvbuf
(
log2
,
NULL
,
_IONBF
,
BUFSIZ
);
/* Create pipe, exit with error on failure */
if
(
pipe
(
pipe_id
)
)
...
...
@@ -164,13 +158,18 @@ main(int argc, char * argv[])
/* Bind signal handlers */
if
(
sigaction
(
SIGINT
,
&
action
,
NULL
)
+
sigaction
(
SIGTERM
,
&
action
,
NULL
)
+
sigaction
(
SIGCHLD
,
&
action
,
NULL
)
<
0
)
||
sigaction
(
SIGTERM
,
&
action
,
NULL
)
||
sigaction
(
SIGCHLD
,
&
action
,
NULL
)
)
{
perror
(
"An error occured while binding the signal handlers
\n
"
);
exit
(
1
);
}
/* Open one buffered and one unbuffered log */
log1
=
fopen
(
"child.log1"
,
"wt+"
);
log2
=
fopen
(
"child.log2"
,
"wt+"
);
setvbuf
(
log2
,
NULL
,
_IONBF
,
BUFSIZ
);
/* Keep reading input */
while
(
(
c
=
getchar
())
)
{
...
...
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