public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: michal.simek@petalogix.com
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] Fix to set the signal handler of SIGINT in mq_timedreceive01
Date: Wed, 22 Jul 2009 13:47:30 +0800	[thread overview]
Message-ID: <4A66A7F2.7020802@cn.fujitsu.com> (raw)
In-Reply-To: <4A65BD95.7070001@petalogix.com>

Hi,
> 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)

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

diff --git a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
index dadc38d..d6604d7 100644
--- a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
+++ b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
@@ -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;
-}
-
 
 
 /*





>> 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.
>>
>> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
>>
>> diff --git a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
>> index dadc38d..beeb298 100644
>> --- a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
>> +++ b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
>> @@ -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
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>   
>>     
>
>
>   



------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2009-07-22  5:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  2:28 [LTP] [PATCH] Fix to set the signal handler of SIGINT in mq_timedreceive01 Wei Yongjun
2009-07-21 13:07 ` Michal Simek
2009-07-22  5:47   ` Wei Yongjun [this message]
2009-07-30 18:29     ` Subrata Modak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A66A7F2.7020802@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=michal.simek@petalogix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox