Skip to contentSkip to conversation

aio_suspend-4: we just need care the selected request.

LTP Bian Naimeng 1 participant 1 message Oct 27, 2010

lore
Share & tools
lore
#0 lore raw

At linux, the aio_suspend tests report following error:
aio_suspend/4-1.c aio_suspend() should set errno to EAGAIN: 4 (Interrupted system call)

Man page said:
The aio_suspend() function suspends the calling process until at least one of the asynchronous I/O requests in the list cblist of length n have completed, a signal is delivered, or timeout is not NULL and the time interval it indicates has passed.

When a signal is delivered, whether should aio_suspend return immediately although we have set a SA_RESTART flag for this signal action?

Maybe the followed path is necessary.
------------------------------------------------------------------------------------------------------
We just care the selected IO request, and set a little timeout.

---
 conformance/interfaces/aio_suspend/4-1.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
conformance/interfaces/aio_suspend/4-1.c +7 -6
index 260c26a..dd8e5f0 100644
@@ -47,8 +47,7 @@ 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;
+	received_selected = 1;
 }
 
 void
@@ -68,7 +67,7 @@ main ()
 	char *bufs;
 	struct sigaction action;
 	struct sigevent event;
-	struct timespec ts = {0, 10000000}; /* 10 ms */
+	struct timespec ts = {0, 1000}; /* 1 us */
 	int errors = 0;
 	int ret;
 	int err;
@@ -123,9 +122,11 @@ main ()
 		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;
+		if (i == WAIT_FOR_AIOCB) {
+			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 */
Signature · 19 lines
1.7.0.4



-- 
Regards
Bian Naimeng


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list