sigalarm
This commit is contained in:
parent
0c10cbe829
commit
9110f40b7d
1 changed files with 7 additions and 6 deletions
|
@ -143,12 +143,12 @@ void test0()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
printf(1, "test0 start\n");
|
printf(1, "test0 start\n");
|
||||||
alarm(2, periodic);
|
sigalarm(2, periodic);
|
||||||
for(i = 0; i < 1000*500000; i++){
|
for(i = 0; i < 1000*500000; i++){
|
||||||
if((i % 250000) == 0)
|
if((i % 250000) == 0)
|
||||||
write(2, ".", 1);
|
write(2, ".", 1);
|
||||||
}
|
}
|
||||||
alarm(0, 0);
|
sigalarm(0, 0);
|
||||||
printf(1, "test0 done\n");
|
printf(1, "test0 done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ void test1() {
|
||||||
|
|
||||||
printf(1, "test1 start\n");
|
printf(1, "test1 start\n");
|
||||||
j = 0;
|
j = 0;
|
||||||
alarm(2, periodic);
|
sigalarm(2, periodic);
|
||||||
for(i = 0; i < 1000*500000; i++){
|
for(i = 0; i < 1000*500000; i++){
|
||||||
foo(i, &j);
|
foo(i, &j);
|
||||||
}
|
}
|
||||||
|
@ -237,13 +237,14 @@ alarmtest starting
|
||||||
<li>You'll need to modify the Makefile to cause <tt>alarmtest.c</tt>
|
<li>You'll need to modify the Makefile to cause <tt>alarmtest.c</tt>
|
||||||
to be compiled as an xv6 user program.
|
to be compiled as an xv6 user program.
|
||||||
|
|
||||||
<li>The right declaration to put in <tt>user/user.h</tt> is:
|
<li>The right declarations to put in <tt>user/user.h</tt> is:
|
||||||
<pre>
|
<pre>
|
||||||
int sigalarm(int ticks, void (*handler)());
|
int sigalarm(int ticks, void (*handler)());
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<li>Update kernel/syscall.h and user/usys.S (update usys.pl to update
|
<li>Update user/sys.pl (which generates user/usys.S),
|
||||||
usys.S) to allow <tt>alarmtest</tt> to invoke the sigalarm system
|
kernel/syscall.h, and kernel/syscall.c
|
||||||
|
to allow <tt>alarmtest</tt> to invoke the sigalarm system
|
||||||
call.
|
call.
|
||||||
|
|
||||||
<li>Your <tt>sys_sigalarm()</tt> should store the alarm interval and
|
<li>Your <tt>sys_sigalarm()</tt> should store the alarm interval and
|
||||||
|
|
Loading…
Reference in a new issue