+2021-06-23 Mike Frysinger <vapier@gentoo.org>
+
+ * sim/callback.h (struct host_callback_struct): Add kill.
+
2021-06-22 Mike Frysinger <vapier@gentoo.org>
* sim/callback.h (struct host_callback_struct): Add getpid.
int (*ftruncate) (host_callback *, int, int64_t);
int (*truncate) (host_callback *, const char *, int64_t);
int (*getpid) (host_callback *);
+ int (*kill) (host_callback *, int, int);
int (*pipe) (host_callback *, int *);
/* Called by the framework when a read call has emptied a pipe buffer. */
+2021-06-23 Mike Frysinger <vapier@gentoo.org>
+
+ * callback.c (os_kill): New function.
+ (default_callback): Add os_kill.
+ * syscall.c (cb_syscall): Handle CB_SYS_kill.
+
2021-06-23 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (srcdir): Change to abs_srcdir.
return result;
}
+static int
+os_kill (host_callback *p, int pid, int signum)
+{
+ int result;
+
+ result = kill (pid, signum);
+ p->last_errno = errno;
+ return result;
+}
+
static int
os_pipe (host_callback *p, int *filedes)
{
os_truncate,
os_getpid,
+ os_kill,
os_pipe,
os_pipe_empty,
result = (*cb->getpid) (cb);
break;
+ case CB_SYS_kill:
+ /* If killing self, leave it to the caller to process so it can send the
+ signal to the engine. */
+ if (sc->arg1 == (*cb->getpid) (cb))
+ {
+ result = -1;
+ errcode = ENOSYS;
+ }
+ else
+ {
+ int signum = cb_target_to_host_signal (cb, sc->arg2);
+
+ result = (*cb->kill) (cb, sc->arg1, signum);
+ cb->last_errno = errno;
+ goto ErrorFinish;
+ }
+ break;
+
case CB_SYS_time :
{
/* FIXME: May wish to change CB_SYS_time to something else.