* Re: [LTP] [PATCH] Don't read errno unless the syscall failed
@ 2010-02-17 8:11 Rishikesh
2010-02-17 17:27 ` Garrett Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Rishikesh @ 2010-02-17 8:11 UTC (permalink / raw)
To: jpalecek; +Cc: LTP
Hi Jiri,
Thanks for patch ( ref:
http://marc.info/?l=ltp-list&m=126415968820646&w=2 ). It will be merged
in feb 2010 release. please verify once it is out.
Acked By: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
--
Thanks& Regards
Rishi Kesh K Rajak
IBM LTC, Bangalore
LTP Maintainer
Please join IRC: #ltp @ freenode.net
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] Don't read errno unless the syscall failed
2010-02-17 8:11 [LTP] [PATCH] Don't read errno unless the syscall failed Rishikesh
@ 2010-02-17 17:27 ` Garrett Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Garrett Cooper @ 2010-02-17 17:27 UTC (permalink / raw)
To: Rishikesh; +Cc: jpalecek, LTP
On Wed, Feb 17, 2010 at 12:11 AM, Rishikesh <risrajak@linux.vnet.ibm.com> wrote:
> Hi Jiri,
>
> Thanks for patch ( ref:
> http://marc.info/?l=ltp-list&m=126415968820646&w=2 ). It will be merged
> in feb 2010 release. please verify once it is out.
I took a bit different route to arrive at the same conclusion as more
spots could be affected by this POSIX ambiguity. I also fixed a
compiler warning and bumped _XOPEN_SOURCE to 600 as per my manpage for
mq_timedsend:
gcooper@orangebox /scratch/ltp-git/ltp-dev $ sudo
testcases/kernel/syscalls/mq_notify/mq_notify01
mq_notify01 0 TINFO : (case00) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)= 0 errno=0 (Success)
mq_notify01 0 TINFO : (case00) END => OK
mq_notify01 0 TINFO : (case01) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)= 0 errno=0 (Success)
mq_notify01 0 TINFO : (case01) END => OK
mq_notify01 0 TINFO : (case02) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)= 0 errno=0 (Success)
mq_notify01 0 TINFO : (case02) END => OK
mq_notify01 0 TINFO : (case03) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01 0 TINFO : (case03) END => OK
mq_notify01 0 TINFO : (case04) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01 0 TINFO : (case04) END => OK
mq_notify01 0 TINFO : (case05) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01 0 TINFO : (case05) END => OK
mq_notify01 0 TINFO : (case06) START
EXPECT: return value(ret)=-1 errno=16 (Device or resource busy)
RESULT: return value(ret)=-1 errno=16 (Device or resource busy)
mq_notify01 0 TINFO : (case06) END => OK
mq_notify01 1 TPASS : mq_notify call succeeded
diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
index 6004373..0370740 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -45,7 +45,7 @@
/* History: Porting from Crackerjack to LTP is done by
*/
/* Manas Kumar Nayak maknayak@in.ibm.com>
*/
/******************************************************************************/
-#define _XOPEN_SOURCE 500
+#define _XOPEN_SOURCE 600
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -262,15 +262,20 @@ static int do_test(struct test_case *tc)
int rc, i, fd = -1;
struct sigevent ev;
struct sigaction sigact;
+ struct timespec abs_timeout;
char smsg[MAX_MSGSIZE];
notified = cmp_ok = 1;
+ /* Don't timeout. */
+ abs_timeout.tv_sec = 0;
+ abs_timeout.tv_nsec = 0;
+
/*
* When test ended with SIGTERM etc, mq discriptor is left remains.
* So we delete it first.
*/
- TEST(mq_unlink(QUEUE_NAME));
+ mq_unlink(QUEUE_NAME);
switch (tc->ttype) {
case FD_NOT_EXIST:
@@ -345,7 +350,7 @@ static int do_test(struct test_case *tc)
*/
for (i = 0; i < MSG_SIZE; i++)
smsg[i] = i;
- TEST(rc = mq_timedsend(fd, smsg, MSG_SIZE, 0, NULL));
+ TEST(rc = mq_timedsend(fd, smsg, MSG_SIZE, 0, &abs_timeout));
if (rc < 0) {
tst_resm(TFAIL,"mq_timedsend failed errno = %d :
%s",TEST_ERRNO, strerror(TEST_ERRNO));
result = 1;
@@ -359,7 +364,7 @@ TEST_END:
/*
* Check results
*/
- result |= (sys_errno != tc->err) || !cmp_ok;
+ result |= (sys_ret != 0 && sys_errno != tc->err) || !cmp_ok;
PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
cmp_ok);
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-17 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-17 8:11 [LTP] [PATCH] Don't read errno unless the syscall failed Rishikesh
2010-02-17 17:27 ` Garrett Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox