[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    Re: [LTP] signal_test_01 failure
From:       Subrata Modak <subrata () linux ! vnet ! ibm ! com>
Date:       2008-05-28 9:32:13
Message-ID: 1211966414.4801.19.camel () subratamodak ! linux ! ibm ! com
[Download RAW message or body]

On Wed, 2008-05-28 at 14:14 +0530, Subrata Modak wrote:
> And here goes the patch for the signal_test_failure.
> 
> Signed-off-by: Suzuki KP <suzuki@in.ibm.com>
Tested and merged.

Regards--
Subrata

> 
> --- signal_test_01.c.orig	2008-05-20 14:52:55.884753744 +0530
> +++ signal_test_01.c	2008-05-20 15:00:18.117524144 +0530
> @@ -251,18 +251,16 @@ int main (int argc, char **argv)
> 
> 	/* Change the process signal mask:
> 	 *
> -	 * Now specifiy a new process signal mask to allow the SIGINT signal
> -	 * to interrupt the process.  Thus by using sigpause (), force the
> -	 * process to suspend execution until delivery of an unblocked
> -	 * signal (SIGINT in this case).
> +	 * Now allow the SIGINT signal to interrupt the process.
> +	 * Thus by using sigpause (), force the process to suspend
> +	 * execution until delivery of an unblocked signal (here SIGINT).
> 	 *
> 	 * Additionally, verify that the SIGINT signal was received.
> 	 */
> 	valid_sig [SIGINT] = 1;
> 
> 	printf ("\n\tChange signal mask & wait until signal interrupts process
> \n");
> -	mask = 0xFFFF ^ SIGINT;
> -	if (sigpause (mask) != -1 || errno != 4)
> +	if (sigpause (SIGINT) != -1 || errno != 4)
> 		sys_error ("sigpause failed", __LINE__);
> 
> 	if (valid_sig [SIGINT])
> 
> 
> ============================================================
> Solution Description:
> ============================================================
> man sigpause() says :
> 
> 
> DESCRIPTION
> Don't use this function. Use sigsuspend(2) instead. :)
> 
> There are two variants of sigpause. The code in signal_test_01.c assumes the
> argument is sigmask. While, upon testing I could figure out that the argument is
> interpreted as the signal.
> 
> This is an issue with the testcase. 
> 
> According to man sigpause :
> 
> int sigpause(int sigmask);  /* BSD */
> 
> int sigpause(int sig);      /* System V / Unix95 */
> 
> 
> [...]
> Linux Notes
> On Linux, this routine is a system call only on the Sparc (sparc64)
> architecture.
> 
> Libc4 and libc5 only know about the BSD version.
> 
> Glibc uses the BSD version if the _BSD_SOURCE feature test macro is
> defined and none of _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _GNU_SOURCE,
> or _SVID_SOURCE is defined.  The System V version is used if _XOPEN_SOURCE is
> defined.
> 
> Since the _BSD_SOURCE_ is not defined for LTP testcases, rather they define
> _XOPEN_SOURCE_, the behaviour is System V, where they expect a signal number
> instead of signal mask.
> 
> Thanks
> 
> Suzuki
> ============================================================================
> Regards--
> Subrata
> 
> On Mon, 2008-05-19 at 13:37 +0530, Subrata Modak wrote:
> > On Fri, 2008-05-16 at 16:59 -0300, Edjunior Barbosa Machado wrote:
> > > Hi,
> > > 
> > > running signal_test_01 IPC stress testcase in x86 and x86_64 machines, we faced \
> > > the messages below: 
> > > # cd ltp-full-20080430/testcases/kernel/ipc/ipc_stress/
> > > # ./signal_test_01 
> > > ./signal_test_01: IPC Signals TestSuite program
> > > 
> > > 	Send SIGILL, SIGALRM, SIGIOT signals to process
> > > 	received signal: (SIGILL)
> > > 	received signal: (SIGALRM)
> > > 	received signal: (SIGIOT/SIGABRT)
> > > 
> > > 	Block SIGILL, SIGALRM, SIGIOT signals, and resend signals + others
> > > 	received signal: (SIGFPE)
> > > 	received signal: (SIGTERM)
> > > 	received signal: (SIGINT)
> > > 
> > > 	Block rest of signals
> > > 
> > > 	Change signal mask & wait until signal interrupts process
> > > ERROR [line: 266] sigpause failed: Invalid argument
> > > 
> > > > Invalid argument
> > > 
> > > 
> > > The problems seems to be related to this piece of code:
> > > 
> > > /* Change the process signal mask:
> > > *
> > > * Now specifiy a new process signal mask to allow the SIGINT signal
> > > * to interrupt the process.  Thus by using sigpause (), force the
> > > * process to suspend execution until delivery of an unblocked
> > > * signal (SIGINT in this case).
> > > *
> > > * Additionally, verify that the SIGINT signal was received.
> > > */
> > > valid_sig [SIGINT] = 1;
> > > 
> > > printf ("\n\tChange signal mask & wait until signal interrupts process\n");
> > > mask = 0xFFFF ^ SIGINT;
> > > if (sigpause (mask) != -1 || errno != 4)
> > > sys_error ("sigpause failed", __LINE__);
> > > 
> > > if (valid_sig [SIGINT])
> > > error ("failed to receive SIGINT signal!", __LINE__);
> > > 
> > > 
> > > `man sigpause` says there are 2 versions of this function: one considering a \
> > > signal as parameter (afaik, the default model) and another using a mask. In \
> > > this case, sigpause() uses this second version. I've already test it using \
> > > SIGINT as parameter and it seemed OK. I've also tried to force to sigpause() to \
> > > use a mask adding defines mentioned in manpage, without success.  
> > > In addiction, the manpage also advices to don't use this function and use \
> > > sigsuspend() instead. However, I'm not sure if substitute a focused system call \
> > > (like sigpause() in this case) is reasonable for LTP testsuits.  
> > > Would you please suggest what could be an acceptable solution for this issue?
> > 
> > Yes, that can be.
> > 
> > Mike,
> > What do you say ?
> > 
> > Regards--
> > Subrata
> > 
> > > 
> > > Thanks in advance,
> > > 
> > > --
> > > Edjunior
> > > 
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Microsoft 
> > > Defy all challenges. Microsoft(R) Visual Studio 2008. 
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > > _______________________________________________
> > > Ltp-list mailing list
> > > Ltp-list@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/ltp-list
> > 
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft 
> > Defy all challenges. Microsoft(R) Visual Studio 2008. 
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic