mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
Provide `kill' only if supported by the host
* libguile/posix.c (scm_kill): Only provide if the host has `kill'. An incompatible change on MinGW, where this function would work only if the PID was the current PID, but that will be fixed by the next process.
This commit is contained in:
parent
509c4205ba
commit
2247a56d5d
1 changed files with 2 additions and 19 deletions
|
@ -626,6 +626,7 @@ SCM_DEFINE (scm_setrlimit, "setrlimit", 3, 0, 0,
|
||||||
#endif /* HAVE_GETRLIMIT */
|
#endif /* HAVE_GETRLIMIT */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_KILL
|
||||||
SCM_DEFINE (scm_kill, "kill", 2, 0, 0,
|
SCM_DEFINE (scm_kill, "kill", 2, 0, 0,
|
||||||
(SCM pid, SCM sig),
|
(SCM pid, SCM sig),
|
||||||
"Sends a signal to the specified process or group of processes.\n\n"
|
"Sends a signal to the specified process or group of processes.\n\n"
|
||||||
|
@ -653,30 +654,12 @@ SCM_DEFINE (scm_kill, "kill", 2, 0, 0,
|
||||||
#define FUNC_NAME s_scm_kill
|
#define FUNC_NAME s_scm_kill
|
||||||
{
|
{
|
||||||
/* Signal values are interned in scm_init_posix(). */
|
/* Signal values are interned in scm_init_posix(). */
|
||||||
#ifdef HAVE_KILL
|
|
||||||
if (kill (scm_to_int (pid), scm_to_int (sig)) != 0)
|
if (kill (scm_to_int (pid), scm_to_int (sig)) != 0)
|
||||||
SCM_SYSERROR;
|
SCM_SYSERROR;
|
||||||
#else
|
|
||||||
/* Mingw has raise(), but not kill(). (Other raw DOS environments might
|
|
||||||
be similar.) Use raise() when the requested pid is our own process,
|
|
||||||
otherwise bomb. */
|
|
||||||
if (scm_to_int (pid) == getpid ())
|
|
||||||
{
|
|
||||||
if (raise (scm_to_int (sig)) != 0)
|
|
||||||
{
|
|
||||||
err:
|
|
||||||
SCM_SYSERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errno = ENOSYS;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WAITPID
|
#ifdef HAVE_WAITPID
|
||||||
SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
|
SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue