Hi Raghuveer,I have looked into the same and tried to figure out the problem. I introduced some printf()s:
1) After both the alarm() calls, 2) Before and after both the sleep() calls,3) Inside 'sigproc()' function to print the value of 'almreceived', to check how/when 'sigproc()' is called when 'SIGALRM' is received.
I ran the testcase 'alarm05' on 2 different machines with 2 different distros and kernel. Please find attached the files for the same. But to my contrary i found that sleep() is not interferring into alarm() calls, suggesting that sleep() may not be implementing[not sure] alarm() and pause() internally, though
man pages suggests that alarm() and sleep should not be used simultaneuosly.The second alarm(5) returns 7 because already 3 seconds has passed [sleep(3)] after the first alarm(10) is called. Now, 'sigproc()' prints before second sleep(6) because the second alarm(5) makes it to receive 'SIGALRM' in 5 secs even before sleep(6) has completed. In both the cases, if sleep() implemented alarm() and pause() inside, then our own alarm(10) and alarm(5) would have been replaced by both the sleep()s'
alarm(3) and alarm(6), in which case we will not get the desired result.I have ran the same with 30 instances as well as for 1 continuous minute. Please see attached the output i got.
May be if your error can be reproduced, we can investigate further. Kindly provide some instances of your error.
Regards-- Subrata Modak Subrata Modak1 wrote:
Hi,
Please find Raghu's observation on the following issue:
========================================================================================
I was looking at the failure of alarm05 i.e.,
'/rhcc/lspp/tests/LTP/ltp-merged/testcases/kernel/syscalls/alarm/alarm05'
test in LTP.
An (modified) extract from the test case is given below.
TEST(alarm(10));
ret_val1 = TEST_RETURN; /* retval is 0 here (no alarm
was set previously) */
/* Wait for signal SIGALARM */almreceived
sleep(3); /* waiting for alarm signal using sleep -
not allowed */
/*
* Call Second alarm() with non-zero time parameter
* 'time_sec2' to send SIGALRM to the calling process.
*/
TEST(alarm(5));
ret_val2 = TEST_RETURN; /* ret_val2 = 7 in this case
but need not be*/
/* Wait for signal SIGALRM */
sleep(sleep_time2);
pause();
The test case uses sleep() to wait for SIGALARM which is set using
alarm(). The man page of alarm() clearly says, mixing of sleep() and
alarm() is not good.
Extract from NOTES section of alarm() man page:
sleep() may be implemented using SIGALRM; mixing calls to alarm() and
sleep() is a bad idea.
The test case has to be corrected.
Thanks,
Raghuveer
========================================================================================
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
alarm05-test-results.tgz
Description: application/compressed-tar
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
