mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-24 05:21:20 -08:00
si_wait: move to external, its called from the outside
This commit is contained in:
parent
91c45d09cd
commit
bcacc6bdb0
7 changed files with 19 additions and 24 deletions
|
|
@ -1233,6 +1233,7 @@ cl_symbols[] = {
|
|||
{SYS_ "REPLACE-ARRAY", SI_ORDINARY, si_replace_array, 2, OBJNULL},
|
||||
{SYS_ "ROW-MAJOR-ASET", SI_ORDINARY, si_row_major_aset, 3, OBJNULL},
|
||||
{EXT_ "RUN-PROGRAM", EXT_ORDINARY, ECL_NAME(si_run_program), -1, OBJNULL},
|
||||
{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_ "TERMINATE-PROCESS", EXT_ORDINARY, si_terminate_process, -1, OBJNULL},
|
||||
|
|
|
|||
|
|
@ -1233,6 +1233,7 @@ cl_symbols[] = {
|
|||
{SYS_ "REPLACE-ARRAY","si_replace_array"},
|
||||
{SYS_ "ROW-MAJOR-ASET","si_row_major_aset"},
|
||||
{EXT_ "RUN-PROGRAM","ECL_NAME(si_run_program)"},
|
||||
{SYS_ "WAITPID","si_waitpid"},
|
||||
{SYS_ "RUN-PROGRAM-INNER","si_run_program_inner"},
|
||||
{SYS_ "SPAWN-SUBPROCESS","si_spawn_subprocess"},
|
||||
{EXT_ "TERMINATE-PROCESS","si_terminate_process"},
|
||||
|
|
|
|||
|
|
@ -145,12 +145,6 @@ from_list_to_execve_argument(cl_object l, char ***environp)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static cl_object
|
||||
external_process_pid(cl_object p)
|
||||
{
|
||||
return ecl_structure_ref(p, @'ext::external-process', 0);
|
||||
}
|
||||
|
||||
cl_object
|
||||
si_waitpid(cl_object pid, cl_object wait)
|
||||
{
|
||||
|
|
@ -220,7 +214,7 @@ si_waitpid(cl_object pid, cl_object wait)
|
|||
cl_env_ptr env = ecl_process_env();
|
||||
bool error_encountered = FALSE;
|
||||
|
||||
cl_object pid = external_process_pid(process);
|
||||
cl_object pid = ecl_structure_ref(process, @'ext::external-process', 0);
|
||||
if (!Null(pid)) {
|
||||
int ret;
|
||||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
|
|
|
|||
|
|
@ -1329,6 +1329,10 @@
|
|||
(values (or null two-way-stream)
|
||||
(or null integer)
|
||||
ext:external-process))
|
||||
(proclamation si:waitpid (fixnum gen-bool) (values
|
||||
(or null keyword)
|
||||
(or null fixnum)
|
||||
(or null 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)
|
||||
|
|
|
|||
|
|
@ -1884,9 +1884,17 @@ extern ECL_API void ecl_check_pending_interrupts(cl_env_ptr env);
|
|||
extern ECL_API cl_object si_system(cl_object cmd);
|
||||
extern ECL_API cl_object si_make_pipe();
|
||||
extern ECL_API cl_object si_run_program _ECL_ARGS((cl_narg narg, cl_object command, cl_object args, ...));
|
||||
extern ECL_API cl_object si_external_process_wait _ECL_ARGS((cl_narg narg, cl_object h, ...));
|
||||
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_run_program_inner
|
||||
(cl_object command, cl_object argv, cl_object environ);
|
||||
|
||||
extern ECL_API cl_object si_spawn_subprocess
|
||||
(cl_object command, cl_object argv, cl_object environ,
|
||||
cl_object input, cl_object output, cl_object error);
|
||||
|
||||
|
||||
/* unicode -- no particular file, but we group these changes here */
|
||||
|
||||
|
|
|
|||
|
|
@ -526,14 +526,6 @@ extern cl_object mp_get_rwlock_write_wait(cl_object lock);
|
|||
extern void ecl_interrupt_process(cl_object process, cl_object function);
|
||||
|
||||
/* unixsys.d */
|
||||
extern cl_object si_waitpid(cl_object pid, cl_object wait);
|
||||
|
||||
extern cl_object si_run_program_inner
|
||||
(cl_object command, cl_object argv, cl_object environ);
|
||||
|
||||
extern cl_object si_spawn_subprocess
|
||||
(cl_object command, cl_object argv, cl_object environ,
|
||||
cl_object input, cl_object output, cl_object error);
|
||||
|
||||
/*
|
||||
* Fake several ISO C99 mathematical functions if not available
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
(values status (external-process-%code external-process)))))
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
;;; ecl-waitpid -> (values status code pid)
|
||||
;;; si:waitpid -> (values status code pid)
|
||||
;;; ---------------------------------------------------------------------------
|
||||
;;; nochg :: (values nil nil nil)
|
||||
;;; error :: (values (member :abort :error) nil nil)
|
||||
|
|
@ -39,9 +39,9 @@
|
|||
(defun external-process-wait (process &optional wait)
|
||||
(let ((pid (external-process-pid process)))
|
||||
(when pid
|
||||
(multiple-value-bind (status code pid) (ecl-waitpid pid wait)
|
||||
(multiple-value-bind (status code pid) (si:waitpid pid wait)
|
||||
(unless (and wait (null status) (null code) (null pid))
|
||||
(setf (external-process-pid process) nil
|
||||
(setf (external-process-pid process) pid
|
||||
(external-process-%status process) status
|
||||
(external-process-%code process) code)))))
|
||||
(values (external-process-%status process)
|
||||
|
|
@ -196,11 +196,6 @@
|
|||
"ecl_make_stream_from_fd(#0, #1, ecl_smm_output, 8, ECL_STREAM_DEFAULT_FORMAT, #2)"
|
||||
:one-liner t))
|
||||
|
||||
(defun ecl-waitpid (pid wait)
|
||||
(ffi:c-inline
|
||||
(pid wait) (:object :object) (values :object :object :object)
|
||||
"si_waitpid(#0, #1)" :one-liner t))
|
||||
|
||||
(defun null-stream ()
|
||||
(ffi:c-inline () () :object "cl_core.null_stream" :one-liner t :side-effects nil))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue