Ticket #2228: 0005-Posix-signals-2-Use-siginfo-from-queue-in-sigtimedwa.patch

File 0005-Posix-signals-2-Use-siginfo-from-queue-in-sigtimedwa.patch, 1.6 KB (added by Daniel Krüger, on Dec 17, 2014 at 12:44:50 PM)
  • cpukit/posix/src/sigtimedwait.c

    From 854f237ea94321afa9f6e9559485bf3954387dd0 Mon Sep 17 00:00:00 2001
    From: Daniel Krueger <daniel.krueger@systec-electronic.com>
    Date: Tue, 9 Dec 2014 16:13:17 +0000
    Subject: [PATCH 5/6] Posix signals [2]: Use siginfo from queue in
     sigtimedwait()
    
    If siginfo structure is set by _POSIX_signals_Clear_signals(), then
    use it. Especially the element si_value is important. si_code is
    currently always SI_USER, because it is not set properly by producer.
    
    Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com>
    ---
     cpukit/posix/src/sigtimedwait.c |   12 +++++++-----
     1 file changed, 7 insertions(+), 5 deletions(-)
    
    diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
    index 4c456dd..21f79af 100644
    a b int sigtimedwait( 
    117117
    118118  /* API signals pending? */
    119119
     120  the_info->si_signo = -1;
     121
    120122  _POSIX_signals_Acquire( &lock_context );
    121123  if ( *set & api->signals_pending ) {
    122124    /* XXX real info later */
    int sigtimedwait( 
    143145    _POSIX_signals_Clear_signals( api, signo, the_info, true, false, false );
    144146    _POSIX_signals_Release( &lock_context );
    145147
    146     the_info->si_signo = signo;
    147     the_info->si_code = SI_USER;
    148     the_info->si_value.sival_int = 0;
     148    if (the_info->si_signo == -1) {
     149      the_info->si_signo = signo;
     150      the_info->si_code = SI_USER;
     151      the_info->si_value.sival_int = 0;
     152    }
    149153    return signo;
    150154  }
    151155
    152   the_info->si_signo = -1;
    153 
    154156  _Thread_Disable_dispatch();
    155157    executing->Wait.queue           = &_POSIX_signals_Wait_queue;
    156158    executing->Wait.return_code     = EINTR;