shmctl01.c: fix error of the case need sighandler()
PATCH 1/1 shmctl01.c: fix error of the case need sighandler()
The case expect the signal "SIGUSR1" to wake up child process, so should add sighandler().
--- testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/ipc/shmctl/shmctl01.c +13 -5
@@ -138,9 +138,9 @@ int main(int ac, char **av)void check_functionality (void );/* parse standard options */ -if ((msg =parse_opts (ac, av,NULL ,NULL )) !=NULL ) { +if ((msg =parse_opts (ac, av,NULL ,NULL )) !=NULL )tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg); - } +#ifdef UCLINUX argv0 = av[0 ];maybe_run_child (do_child,"ddd" , &stat_i, &stat_time, &shm_id_1);
@@ -231,8 +231,7 @@ void *set_shmat()* print a message to that effect. */ if (rval == (void *)-1 ) { -tst_resm (TBROK ,"shmat() failed - %s" ,strerror (errno)); -cleanup (); +tst_brkm (TBROK , cleanup,"shmat() failed - %s" ,strerror (errno)); }return rval;
@@ -485,10 +484,19 @@ void func_rmid() shm_id_1 =-1 ; } +/* +* sighandler() - handle signals, in this case SIGUSR1 is the only one expected +*/ +void sighandler (sig ) +{ +if (sig !=SIGUSR1 ) +tst_resm (TINFO ,"received unexpected signal %d" , sig); +} +void setup (void ) { -tst_sig (FORK ,DEF_HANDLER , cleanup); +tst_sig (FORK , sighandler, cleanup);TEST_PAUSE ;
Signature · 16 lines
1.7.1 -- Best Regards, Peng Haitao ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 5 lines · Peng Haitao
The case expect the signal "SIGUSR1" to wake up child process, so should add
sighandler().Signed-off-by Peng Haitao <[email protected]>
Confirmed the patch works in RHEL6.
Quoted 51 lines
--- testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)testcases/kernel/syscalls/ipc/shmctl/shmctl01.c +13
-5@@ -138,9 +138,9 @@ int main(int ac, char **av)void check_functionality (void );/* parse standard options */ -if ((msg =parse_opts (ac, av,NULL ,NULL )) !=NULL ) { +if ((msg =parse_opts (ac, av,NULL ,NULL )) !=NULL )tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg); - } +#ifdef UCLINUX argv0 = av[0 ];maybe_run_child (do_child,"ddd" , &stat_i, &stat_time, &shm_id_1);@@ -231,8 +231,7 @@ void *set_shmat()* print a message to that effect. */ if (rval == (void *)-1 ) { -tst_resm (TBROK ,"shmat() failed - %s" ,strerror (errno)); -cleanup (); +tst_brkm (TBROK , cleanup,"shmat() failed - %s" ,strerror (errno)); }return rval;@@ -485,10 +484,19 @@ void func_rmid() shm_id_1 =-1 ; } +/* +* sighandler() - handle signals, in this case SIGUSR1 is the only one expected +*/ +void sighandler (sig ) +{ +if (sig !=SIGUSR1 ) +tst_resm (TINFO ,"received unexpected signal %d" , sig); +} +void setup (void ) { -tst_sig (FORK ,DEF_HANDLER , cleanup); +tst_sig (FORK , sighandler, cleanup);TEST_PAUSE ;
Signature · 14 lines
Quality Engineer (Kernel) in Red Hat Software (Beijing) Co., R&D Branch http://www.cn.redhat.com/ TEL: +86-10-62608150 ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 3 lines · Peng Haitao
The case expect the signal "SIGUSR1" to wake up child process, so should add
sighandler().
Committed a modified patch that calls tst_resm(TBROK, ...) in the signal handler as it's an unexpected signal.
Thanks,
-Garrett
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list