On 01/26/2012 12:26 AM, Cyril Hrubis wrote:
> Hi!
>> ---
>> .../conformance/interfaces/aio_suspend/8-1.c | 39
>> +++-----------------
>> 1 files changed, 6 insertions(+), 33 deletions(-)
>>
>> diff --git
>> a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/8-1.c
>> b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/8-1.c
>> index e39581f..4023a42 100644
>> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/8-1.c
>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_suspend/8-1.c
>> @@ -51,13 +51,6 @@ int received_all = 0;
>> void
>> sigrt1_handler(int signum, siginfo_t *info, void *context)
>> {
>> - if (info->si_value.sival_int == WAIT_FOR_AIOCB)
>> - received_selected = 1;
>> -}
>> -
>> -void
>> -sigrt2_handler(int signum, siginfo_t *info, void *context)
>> -{
>> received_all = 1;
>> }
>>
>> @@ -121,30 +114,19 @@ main ()
>> aiocbs[i]->aio_buf = &bufs[i * BUF_SIZE];
>> aiocbs[i]->aio_nbytes = BUF_SIZE;
>> aiocbs[i]->aio_lio_opcode = LIO_READ;
>> -
>> - /* Use SIRTMIN+1 for individual completions */
>> - aiocbs[i]->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
>> - aiocbs[i]->aio_sigevent.sigev_signo = SIGRTMIN + 1;
>> - aiocbs[i]->aio_sigevent.sigev_value.sival_int = i;
>> }
>>
>> - /* Use SIGRTMIN+2 for list completion */
>> + /* Use SIGRTMIN + 1 for list completion */
>> event.sigev_notify = SIGEV_SIGNAL;
>> - event.sigev_signo = SIGRTMIN + 2;
>> + event.sigev_signo = SIGRTMIN + 1;
>> event.sigev_value.sival_ptr = NULL;
>>
>> - /* Setup handler for individual operation completion */
>> + /* Setup handler for list completion */
>> action.sa_sigaction = sigrt1_handler;
>> sigemptyset(&action.sa_mask);
>> action.sa_flags = SA_SIGINFO | SA_RESTART;
>> sigaction(SIGRTMIN + 1, &action, NULL);
>>
>> - /* Setup handler for list completion */
>> - action.sa_sigaction = sigrt2_handler;
>> - sigemptyset(&action.sa_mask);
>> - action.sa_flags = SA_SIGINFO | SA_RESTART;
>> - sigaction(SIGRTMIN + 2, &action, NULL);
>> -
>> /* Setup suspend list */
>> plist[0] = NULL;
>> plist[1] = aiocbs[WAIT_FOR_AIOCB];
>> @@ -162,21 +144,12 @@ main ()
>> exit(PTS_UNRESOLVED);
>> }
>>
>> - /* Check selected request has not completed yet */
>> - if (received_selected) {
>> - printf(TNAME " Error : AIOCB %d already completed before
>> suspend\n",
>> - WAIT_FOR_AIOCB);
>> - for (i = 0; i < NUM_AIOCBS; i++)
>> - free (aiocbs[i]);
>> - free(bufs);
>> - free(aiocbs);
>> - close(fd);
>> - exit(PTS_FAIL);
>> - }
>> + do {
>> + ret = aio_error(aiocbs[WAIT_FOR_AIOCB]);
>> + } while (ret != EINPROGRESS);
>
> I think that the original code was trying to assert that the operation
> wasn't completed yet (in that case this would be infinite loop, or am I
> mistaken?).
It'll just assert the INPROGRESS one, so IMHO, it wouldn't be indefinite loop.
but since I'm not sure, if you like, I can remove this loop, it'll be harmless
for the test result mostly.
Thanks
-Wanlong Gao
>
>> /* Suspend on selected request */
>> ret = aio_suspend((const struct aiocb **)plist, 2, NULL);
>> -
>> if (ret) {
>> printf(TNAME " Error at aio_suspend() %d: %s\n", errno,
>> strerror(errno));
>> for (i=0; i<NUM_AIOCBS; i++)
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list