2015-12-17 20:56:48 +03:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 - 1996 Rick Sladkey < jrs @ world . std . com >
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
* Copyright ( c ) 2005 - 2015 Dmitry V . Levin < ldv @ altlinux . org >
* Copyright ( c ) 2015 Elvira Khabirova < lineprinter0 @ gmail . com >
2018-12-25 02:46:43 +03:00
* Copyright ( c ) 2015 - 2018 The strace developers .
2015-12-17 20:56:48 +03:00
* All rights reserved .
*
2018-12-10 03:00:00 +03:00
* SPDX - License - Identifier : LGPL - 2.1 - or - later
2015-12-17 20:56:48 +03:00
*/
2015-03-26 16:03:25 +03:00
# include "defs.h"
2015-07-18 02:56:54 +03:00
2015-08-04 02:16:29 +03:00
# include DEF_MPERS_TYPE(stack_t)
2015-07-18 02:56:54 +03:00
# include <signal.h>
2015-08-04 02:16:29 +03:00
# include MPERS_DEFS
2015-03-26 16:03:25 +03:00
# include "xlat/sigaltstack_flags.h"
static void
2016-12-26 13:26:03 +03:00
print_stack_t ( struct tcb * const tcp , const kernel_ulong_t addr )
2015-03-26 16:03:25 +03:00
{
stack_t ss ;
2015-07-17 04:05:46 +03:00
if ( umove_or_printaddr ( tcp , addr , & ss ) )
return ;
tprints ( " {ss_sp= " ) ;
2016-12-26 04:37:21 +03:00
printaddr ( ptr_to_kulong ( ss . ss_sp ) ) ;
2015-07-17 04:05:46 +03:00
tprints ( " , ss_flags= " ) ;
printflags ( sigaltstack_flags , ss . ss_flags , " SS_??? " ) ;
2016-12-26 13:16:35 +03:00
tprintf ( " , ss_size=% " PRI_klu " } " , ( kernel_ulong_t ) ss . ss_size ) ;
2015-03-26 16:03:25 +03:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( sigaltstack )
2015-03-26 16:03:25 +03:00
{
if ( entering ( tcp ) ) {
print_stack_t ( tcp , tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
2015-07-17 04:05:46 +03:00
} else {
2015-03-26 16:03:25 +03:00
print_stack_t ( tcp , tcp - > u_arg [ 1 ] ) ;
}
return 0 ;
}