[binutils-gdb] sim: callback: add check for HAVE_KILL

Michael Frysinger vapier@sourceware.org
Wed Jun 30 00:14:45 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=999b474b8aa49f522984b2f4c1d954a2229882b9

commit 999b474b8aa49f522984b2f4c1d954a2229882b9
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Tue Jun 29 03:13:54 2021 -0400

    sim: callback: add check for HAVE_KILL
    
    Fix building on systems w/out a kill function (e.g. Windows).

Diff:
---
 sim/common/ChangeLog  | 4 ++++
 sim/common/callback.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 7b21b00c880..da6511c89c9 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+	* callback.c [!HAVE_KILL] (os_kill): Return ENOSYS.
+
 2021-06-29  Mike Frysinger  <vapier@gentoo.org>
 
 	* sim-model.c (model_option_handler): Make machp const.
diff --git a/sim/common/callback.c b/sim/common/callback.c
index f773de1c19f..39d068c4866 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -544,11 +544,16 @@ os_getpid (host_callback *p)
 static int
 os_kill (host_callback *p, int pid, int signum)
 {
+#ifdef HAVE_KILL
   int result;
 
   result = kill (pid, signum);
   p->last_errno = errno;
   return result;
+#else
+  p->last_errno = ENOSYS;
+  return -1;
+#endif
 }
 
 static int


More information about the Gdb-cvs mailing list