Commit f0ad7b95 authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

killpid: add internal interface to kill

parent 500a7b7d
......@@ -1232,14 +1232,6 @@ cl_symbols[] = {
{SYS_ "REM-SYSPROP", SI_ORDINARY, si_rem_sysprop, 2, OBJNULL},
{SYS_ "REPLACE-ARRAY", SI_ORDINARY, si_replace_array, 2, OBJNULL},
{SYS_ "ROW-MAJOR-ASET", SI_ORDINARY, si_row_major_aset, 3, OBJNULL},
/* process.lsp */
{EXT_ "RUN-PROGRAM", EXT_ORDINARY, ECL_NAME(si_run_program), -1, OBJNULL},
{EXT_ "TERMINATE-PROCESS", EXT_ORDINARY, ECL_NAME(si_terminate_process), -1, OBJNULL},
/* unixsys.d */
{SYS_ "WAITPID", SI_ORDINARY, si_waitpid, 2, OBJNULL},
{SYS_ "RUN-PROGRAM-INNER", SI_ORDINARY, si_run_program_inner, 3, OBJNULL},
{SYS_ "SPAWN-SUBPROCESS", SI_ORDINARY, si_spawn_subprocess, 6, OBJNULL},
/* ~ */
{EXT_ "SAFE-EVAL", EXT_ORDINARY, ECL_NAME(si_safe_eval), -1, OBJNULL},
{SYS_ "SCH-FRS-BASE", SI_ORDINARY, si_sch_frs_base, 2, OBJNULL},
{SYS_ "SCHAR-SET", SI_ORDINARY, si_char_set, 3, OBJNULL},
......@@ -1988,6 +1980,8 @@ cl_symbols[] = {
{EXT_ "EXTERNAL-PROCESS-ERROR-STREAM", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "EXTERNAL-PROCESS-STATUS", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "EXTERNAL-PROCESS-WAIT", EXT_ORDINARY, NULL, -1, OBJNULL},
{EXT_ "TERMINATE-PROCESS", EXT_ORDINARY, ECL_NAME(si_terminate_process), -1, OBJNULL},
{EXT_ "RUN-PROGRAM", EXT_ORDINARY, ECL_NAME(si_run_program), -1, OBJNULL},
{KEY_ "RUNNING", KEYWORD, NULL, -1, OBJNULL},
{KEY_ "EXITED", KEYWORD, NULL, -1, OBJNULL},
......@@ -1995,12 +1989,21 @@ cl_symbols[] = {
{KEY_ "STOPPED", KEYWORD, NULL, -1, OBJNULL},
/* ~ external-process extension */
/* unixsys.d */
{SYS_ "WAITPID", SI_ORDINARY, si_waitpid, 2, OBJNULL},
#if !defined(ECL_MS_WINDOWS_HOST)
{SYS_ "KILLPID", SI_ORDINARY, si_killpid, 2, OBJNULL},
#else
{SYS_ "KILLPID", SI_ORDINARY, NULL, 2, OBJNULL},
#endif
{SYS_ "RUN-PROGRAM-INNER", SI_ORDINARY, si_run_program_inner, 3, OBJNULL},
{SYS_ "SPAWN-SUBPROCESS", SI_ORDINARY, si_spawn_subprocess, 6, OBJNULL},
#if defined(ECL_MS_WINDOWS_HOST) || defined(cygwin)
{SYS_ "CLOSE-WINDOWS-HANDLE", SI_ORDINARY, si_close_windows_handle, 1, OBJNULL},
#else
{SYS_ "CLOSE-WINDOWS-HANDLE", SI_ORDINARY, NULL, -1, OBJNULL},
#endif
/* ~ */
{EXT_ "*INVOKE-DEBUGGER-HOOK*", EXT_SPECIAL, NULL, -1, ECL_NIL},
......
......@@ -1232,14 +1232,6 @@ cl_symbols[] = {
{SYS_ "REM-SYSPROP","si_rem_sysprop"},
{SYS_ "REPLACE-ARRAY","si_replace_array"},
{SYS_ "ROW-MAJOR-ASET","si_row_major_aset"},
/* process.lsp */
{EXT_ "RUN-PROGRAM","ECL_NAME(si_run_program)"},
{EXT_ "TERMINATE-PROCESS","ECL_NAME(si_terminate_process)"},
/* unixsys.d */
{SYS_ "WAITPID","si_waitpid"},
{SYS_ "RUN-PROGRAM-INNER","si_run_program_inner"},
{SYS_ "SPAWN-SUBPROCESS","si_spawn_subprocess"},
/* ~ */
{EXT_ "SAFE-EVAL","ECL_NAME(si_safe_eval)"},
{SYS_ "SCH-FRS-BASE","si_sch_frs_base"},
{SYS_ "SCHAR-SET","si_char_set"},
......@@ -1988,6 +1980,8 @@ cl_symbols[] = {
{EXT_ "EXTERNAL-PROCESS-ERROR-STREAM",NULL},
{EXT_ "EXTERNAL-PROCESS-STATUS",NULL},
{EXT_ "EXTERNAL-PROCESS-WAIT",NULL},
{EXT_ "TERMINATE-PROCESS","ECL_NAME(si_terminate_process)"},
{EXT_ "RUN-PROGRAM","ECL_NAME(si_run_program)"},
{KEY_ "RUNNING",NULL},
{KEY_ "EXITED",NULL},
......@@ -1995,12 +1989,21 @@ cl_symbols[] = {
{KEY_ "STOPPED",NULL},
/* ~ external-process extension */
/* unixsys.d */
{SYS_ "WAITPID","si_waitpid"},
#if !defined(ECL_MS_WINDOWS_HOST)
{SYS_ "KILLPID","si_killpid"},
#else
{SYS_ "KILLPID",NULL},
#endif
{SYS_ "RUN-PROGRAM-INNER","si_run_program_inner"},
{SYS_ "SPAWN-SUBPROCESS","si_spawn_subprocess"},
#if defined(ECL_MS_WINDOWS_HOST) || defined(cygwin)
{SYS_ "CLOSE-WINDOWS-HANDLE","si_close_windows_handle"},
#else
{SYS_ "CLOSE-WINDOWS-HANDLE",NULL},
#endif
/* ~ */
{EXT_ "*INVOKE-DEBUGGER-HOOK*",NULL},
......
......@@ -208,6 +208,14 @@ si_waitpid(cl_object pid, cl_object wait)
@(return status code pid);
}
#if !defined(ECL_MS_WINDOWS_HOST)
cl_object
si_killpid(cl_object pid, cl_object signal) {
int ret = kill(ecl_fixnum(pid), ecl_fixnum(signal));
return ecl_make_fixnum(ret);
}
#endif
#if defined(ECL_MS_WINDOWS_HOST) || defined(cygwin)
cl_object
si_close_windows_handle(cl_object h)
......
......@@ -1333,6 +1333,7 @@
(or null keyword)
(or null fixnum)
(or null fixnum)))
(proclamation si:killpid (fixnum fixnum) fixnum)
(proclamation si:run-program-inner (string (or list string) list)
(values two-way-stream integer))
(proclamation si:spawn-subprocess (string (or list string) list t t t)
......
......@@ -1887,6 +1887,7 @@ extern ECL_API cl_object si_run_program _ECL_ARGS((cl_narg narg, cl_object comma
extern ECL_API cl_object si_close_windows_handle(cl_object h);
extern ECL_API cl_object si_terminate_process _ECL_ARGS((cl_narg narg, cl_object process, ...));
extern ECL_API cl_object si_waitpid(cl_object pid, cl_object wait);
extern ECL_API cl_object si_killpid(cl_object pid, cl_object signal);
extern ECL_API cl_object si_run_program_inner
(cl_object command, cl_object argv, cl_object environ);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment