Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add rumpuser_kill, which sends a signal to a host process.



details:   https://anonhg.NetBSD.org/src/rev/9aa1035c4ac3
branches:  trunk
changeset: 754129:9aa1035c4ac3
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Apr 21 11:13:29 2010 +0000

description:
Add rumpuser_kill, which sends a signal to a host process.

diffstat:

 lib/librumpuser/rumpuser.c       |  16 ++++++++++++++--
 sys/rump/include/rump/rumpuser.h |   5 ++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diffs (60 lines):

diff -r a5bb3d95d96c -r 9aa1035c4ac3 lib/librumpuser/rumpuser.c
--- a/lib/librumpuser/rumpuser.c        Wed Apr 21 11:11:32 2010 +0000
+++ b/lib/librumpuser/rumpuser.c        Wed Apr 21 11:13:29 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.c,v 1.1 2010/02/26 18:54:20 pooka Exp $       */
+/*     $NetBSD: rumpuser.c,v 1.2 2010/04/21 11:13:29 pooka Exp $       */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.1 2010/02/26 18:54:20 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.2 2010/04/21 11:13:29 pooka Exp $");
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -53,6 +53,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <poll.h>
+#include <signal.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -571,3 +572,14 @@
 
        return rv;
 }
+
+int
+rumpuser_kill(int64_t pid, int sig, int *error)
+{
+
+       if (pid == RUMPUSER_PID_SELF) {
+               DOCALL(int, raise(sig));
+       } else {
+               DOCALL(int, kill((pid_t)pid, sig));
+       }
+}
diff -r a5bb3d95d96c -r 9aa1035c4ac3 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Wed Apr 21 11:11:32 2010 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Wed Apr 21 11:13:29 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.38 2010/03/05 18:47:49 pooka Exp $      */
+/*     $NetBSD: rumpuser.h,v 1.39 2010/04/21 11:13:29 pooka Exp $      */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -97,6 +97,9 @@
 
 int rumpuser_putchar(int, int *);
 
+#define RUMPUSER_PID_SELF ((int64_t)-1)
+int rumpuser_kill(int64_t, int, int *);
+
 #define RUMPUSER_PANIC (-1)
 void rumpuser_exit(int);
 void rumpuser_seterrno(int);



Home | Main Index | Thread Index | Old Index