Patchwork [2/4] Handle SIGKILL and SIGCHLD

login
register
mail settings
Submitter Maxim Kuvyrkov
Date March 1, 2010, 7:32 p.m.
Message ID <4B8C1640.1090509@codesourcery.com>
Download mbox | patch
Permalink /patch/46599/
State New
Headers show

Comments

Maxim Kuvyrkov - March 1, 2010, 7:32 p.m.
From a659ff77804712826c1c1fe739339f1b1a172ed6 Mon Sep 17 00:00:00 2001
From: Maxim Kuvyrkov <maxim@codesourcery.com>
Date: Mon, 1 Mar 2010 02:39:48 -0800
Subject: [PATCH 2/4] Handle SIGKILL and SIGCHLD

Handle SIGKILL and SIGCHLD in linux user-space emulation.

Signed-off-by: Maxim Kuvyrkov <maxim@codesourcery.com>
---
 linux-user/signal.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index a560a5c..8f9da80 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -213,6 +213,15 @@  static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
         /* should never come here, but who knows. The information for
            the target is irrelevant */
         tinfo->_sifields._sigfault._addr = 0;
+    } else if (sig == SIGKILL || sig == SIGCHLD) {
+        tinfo->_sifields._kill._pid = info->si_pid;
+        tinfo->_sifields._kill._uid = info->si_uid;
+
+        if (sig == SIGCHLD) {
+            tinfo->_sifields._sigchld._status = info->si_status;
+            tinfo->_sifields._sigchld._utime = info->si_utime;
+            tinfo->_sifields._sigchld._stime = info->si_stime;
+        }
     } else if (sig == SIGIO) {
 	tinfo->_sifields._sigpoll._fd = info->si_fd;
     } else if (sig >= TARGET_SIGRTMIN) {
@@ -236,6 +245,18 @@  static void tswap_siginfo(target_siginfo_t *tinfo,
         sig == SIGBUS || sig == SIGTRAP) {
         tinfo->_sifields._sigfault._addr =
             tswapl(info->_sifields._sigfault._addr);
+    } else if (sig == SIGKILL || sig == SIGCHLD) {
+        tinfo->_sifields._kill._pid = tswap32(info->_sifields._kill._pid);
+        tinfo->_sifields._kill._uid = tswap32(info->_sifields._kill._uid);
+
+        if (sig == SIGCHLD) {
+            tinfo->_sifields._sigchld._status
+                = tswap32(info->_sifields._sigchld._status);
+            tinfo->_sifields._sigchld._utime
+                = tswap32(info->_sifields._sigchld._utime);
+            tinfo->_sifields._sigchld._stime
+                = tswap32(info->_sifields._sigchld._stime);
+        }
     } else if (sig == SIGIO) {
 	tinfo->_sifields._sigpoll._fd = tswap32(info->_sifields._sigpoll._fd);
     } else if (sig >= TARGET_SIGRTMIN) {