Skip to contentSkip to conversation

ppoll01: Fix to set the signal handler of SIGINT

PATCH In review liubo 3 participants 4 messages Oct 12, 2009 – Oct 13, 2009

lore
Share & tools
lore

liubo

author
#0 lore raw

PATCH 1/1 ppoll01: Fix to set the signal handler of SIGINT

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

Then, the rest cases will not be tested.

This patch fixed the problem.

---

testcases/kernel/syscalls/ppoll/ppoll01.c +9 -11
index f76d61f..585297c 100644
@@ -124,9 +124,17 @@ extern void cleanup() {
 /*              On success - returns 0.                                       */
 /*                                                                            */
 /******************************************************************************/
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+       return;
+}
 void setup() {
         /* Capture signals if any */
-        /* Create temporary directories */
+       signal(SIGINT, sighandler);
+       /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
 }
@@ -404,16 +412,6 @@ TEST_END:
 }
 
 
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
 
 
 /*

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 37 lines · liubo

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

Then, the rest cases will not be tested.

This patch fixed the problem.

---

testcases/kernel/syscalls/ppoll/ppoll01.c +9 -1
index f76d61f..585297c 100644
@@ -124,9 +124,17 @@ extern void cleanup() {
  /*              On success - returns 0.                                       */
  /*                                                                            */
  /******************************************************************************/
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+       return;
+}
  void setup() {
         /* Capture signals if any */
-        /* Create temporary directories */
+       signal(SIGINT, sighandler);
+       /* Create temporary directories */
         TEST_PAUSE;
         tst_tmpdir();
  }
@@ -404,16 +412,6 @@ TEST_END:
  }
 
 

testcases/kernel/syscalls/ppoll/ppoll01.c TEST_END: · line 416

Quoted 10 lines
testcases/kernel/syscalls/ppoll/ppoll01.c +0 -10
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}

1. If all that the signal handler does is just return, it should have been doing SIG_IGN from the beginning.
2. I don't understand how your change fixes this because the signal handler's function is almost the same (the original handler was more generic).
Thanks,
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 31 lines · On Monday 12 October 2009 14:28:02 Garrett Cooper wrote:
Quoted 30 lines · liubo

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

Then, the rest cases will not be tested.

This patch fixed the problem.

testcases/kernel/syscalls/ppoll/ppoll01.c +9 -1
@@ -124,9 +124,17 @@ extern void cleanup() {
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+       return;
+}
 void setup() {
        /* Capture signals if any */
-        /* Create temporary directories */
+       signal(SIGINT, sighandler);
+       /* Create temporary directories */
        TEST_PAUSE;
        tst_tmpdir();
 }
@@ -404,16 +412,6 @@ TEST_END:
 }
 
 
Quoted 16 lines

testcases/kernel/syscalls/ppoll/ppoll01.c TEST_END: · line 416

Quoted 10 lines
testcases/kernel/syscalls/ppoll/ppoll01.c +0 -10
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}

1. If all that the signal handler does is just return, it should have been doing SIG_IGN from the beginning.
2. I don't understand how your change fixes this because the signal handler's function is almost the same (the original handler was more generic).

default behavior with SIGINT is to terminate, and going by this patch, no one set up a signal handler for SIGINT. so the fix as you implied sounds like:
- call signal(SIGINT, SIG_IGN);
- delete sighandlerr()
-mike

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

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

author
#3 lore raw
Quoted 52 lines · Mike Frysinger
Quoted 32 lines · On Monday 12 October 2009 14:28:02 Garrett Cooper wrote:
Quoted 30 lines · liubo

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

Then, the rest cases will not be tested.

This patch fixed the problem.

testcases/kernel/syscalls/ppoll/ppoll01.c +9 -1
@@ -124,9 +124,17 @@ extern void cleanup() {
+/*
+ * sighandler()
+ */
+void sighandler(int sig)
+{
+       return;
+}
 void setup() {
        /* Capture signals if any */
-        /* Create temporary directories */
+       signal(SIGINT, sighandler);
+       /* Create temporary directories */
        TEST_PAUSE;
        tst_tmpdir();
 }
@@ -404,16 +412,6 @@ TEST_END:
 }
 
 
Quoted 17 lines

testcases/kernel/syscalls/ppoll/ppoll01.c TEST_END: · line 415

Quoted 11 lines
testcases/kernel/syscalls/ppoll/ppoll01.c +0 -10
-/*
- * sighandler()
- */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
 

1. If all that the signal handler does is just return, it should have been doing SIG_IGN from the beginning.
2. I don't understand how your change fixes this because the signal handler's function is almost the same (the original handler was more generic).

Quoted 7 lines

default behavior with SIGINT is to terminate, and going by this patch, no one set up a signal handler for SIGINT. so the fix as you implied sounds like:
- call signal(SIGINT, SIG_IGN);
- delete sighandlerr()
-mike

Mike,

I apply your suggestions on a X86_64 system, and it shows signal(SIGINT, SIG_IGN) also blocks the case04 itself.

{ // case04
.ttype = SEND_SIGINT,
.ret = -1,
.err = EINTR,
},

Then, the testcase will hang on here.

So, I suggest we remain "void sighandler(int sig)" to fix the problem.

Thanks,

Quoted 10 lines

------------------------------------------------------------------------

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
------------------------------------------------------------------------

Quoted 5 lines

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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

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