Skip to contentSkip to conversation

Fix to set the signal handler of SIGINT in mq_timedreceive01

PATCH In review Wei Yongjun 3 participants 4 messages Jul 21, 2009 – Jul 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix to set the signal handler of SIGINT in mq_timedreceive01

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

This patch fixed the problem.

testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +9 -11
index dadc38d..beeb298 100644
@@ -106,6 +106,14 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+        return;
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +134,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+        signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -432,17 +441,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi,

Please fix coding style violation.
Use tab instead of spaces.
Subrata should reject this patch with bad coding style. Can you please fix it?

Thanks,
Michal

Quoted 69 lines

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

This patch fixed the problem.

testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +9 -12
index dadc38d..beeb298 100644
@@ -106,6 +106,14 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+        return;
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +134,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+        signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -432,17 +441,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*
 
 
 
 
 
------------------------------------------------------------------------------

Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Signature · 15 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#2 lore raw

Hi,

Quoted 9 lines

Hi,

Please fix coding style violation.
Use tab instead of spaces.
Subrata should reject this patch with bad coding style. Can you please fix it?

Fixed it(the original source is all space, no tab),And also fixed the compile warning.

[PATCHv2] Fix to set the signal handler of SIGINT in mq_timedreceive01

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

This patch fixed the problem. And also fixed the following compile warning.

mq_timedreceive01.c: In function ‘do_test’:
mq_timedreceive01.c:379: warning: null argument where non-null required (argument 5)

testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +10 -13
index dadc38d..d6604d7 100644
@@ -106,6 +106,13 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +133,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+	signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -301,7 +309,7 @@ static int do_test(struct test_case *tc)
 	int oflag;
         int i, rc, cmp_ok = 1, fd = -1;
         char smsg[MAX_MSGSIZE], rmsg[MAX_MSGSIZE];
-        struct timespec ts, *p_ts;
+        struct timespec ts, *p_ts = NULL;
         pid_t pid = 0;
         unsigned prio;
         size_t msg_len;
@@ -368,7 +376,7 @@ switch (tc->ttype) {
         case FD_FILE:
                 break;
         default:
-		TEST(rc = mq_timedsend(fd, smsg, tc->len, tc->prio, NULL));
+		TEST(rc = mq_timedsend(fd, smsg, tc->len, tc->prio, p_ts));
                 if (TEST_RETURN < 0) {
                  	tst_resm(TFAIL, "mq_timedsend failed - errno = %d : %s",TEST_ERRNO, strerror(TEST_ERRNO));
                         result = 1;
@@ -432,17 +440,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*
Quoted 58 lines
Quoted 58 lines

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

This patch fixed the problem.

testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +9 -11
index dadc38d..beeb298 100644
@@ -106,6 +106,14 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+        return;
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +134,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+        signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -432,17 +441,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*
Quoted 15 lines
Quoted 12 lines

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 19 lines · Wei Yongjun

Hi,

Quoted 9 lines

Hi,

Please fix coding style violation.
Use tab instead of spaces.
Subrata should reject this patch with bad coding style. Can you please fix it?

Fixed it(the original source is all space, no tab),And also fixed the compile warning.

[PATCHv2] Fix to set the signal handler of SIGINT in mq_timedreceive01

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

Quoted 7 lines

This patch fixed the problem. And also fixed the following compile warning.

mq_timedreceive01.c: In function ‘do_test’:
mq_timedreceive01.c:379: warning: null argument where non-null required (argument 5)

Thanks.

Regards--
Subrata

Quoted 126 lines
testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +10 -13
index dadc38d..d6604d7 100644
@@ -106,6 +106,13 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +133,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+	signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -301,7 +309,7 @@ static int do_test(struct test_case *tc)
 	int oflag;
         int i, rc, cmp_ok = 1, fd = -1;
         char smsg[MAX_MSGSIZE], rmsg[MAX_MSGSIZE];
-        struct timespec ts, *p_ts;
+        struct timespec ts, *p_ts = NULL;
         pid_t pid = 0;
         unsigned prio;
         size_t msg_len;
@@ -368,7 +376,7 @@ switch (tc->ttype) {
         case FD_FILE:
                 break;
         default:
-		TEST(rc = mq_timedsend(fd, smsg, tc->len, tc->prio, NULL));
+		TEST(rc = mq_timedsend(fd, smsg, tc->len, tc->prio, p_ts));
                 if (TEST_RETURN < 0) {
                  	tst_resm(TFAIL, "mq_timedsend failed - errno = %d : %s",TEST_ERRNO, strerror(TEST_ERRNO));
                         result = 1;
@@ -432,17 +440,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*
Quoted 63 lines
Quoted 63 lines

The test case mq_timedreceive01 does not register the signal handler of SIGINT, so the problam will be terminated by SIGINT from child process.

This patch fixed the problem.

testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c +9 -11
index dadc38d..beeb298 100644
@@ -106,6 +106,14 @@ extern void cleanup() {
         tst_exit();
 }
 
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+        return;
+}
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -126,6 +134,7 @@ extern void cleanup() {
 /******************************************************************************/
 void setup() {
         /* Capture signals if any */
+        signal(SIGINT, sighandler);
         /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
@@ -432,17 +441,6 @@ EXIT:
         return result;
 }
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
 
 
 /*
Quoted 17 lines
Quoted 4 lines
Quoted 4 lines

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have

Quoted 11 lines
Quoted 8 lines

the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list