2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
#include <Efl.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
|
2006-01-06 05:56:47 -08:00
|
|
|
#include "Ecore.h"
|
2009-12-22 13:15:12 -08:00
|
|
|
#include "ecore_private.h"
|
2005-10-24 07:47:25 -07:00
|
|
|
|
2014-08-07 06:57:50 -07:00
|
|
|
#define MY_CLASS ECORE_EXE_CLASS
|
|
|
|
|
2014-08-26 08:48:07 -07:00
|
|
|
#include "ecore_exe_private.h"
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2006-04-05 18:16:02 -07:00
|
|
|
/* TODO: Something to let people build a command line and does auto escaping -
|
|
|
|
*
|
|
|
|
* ecore_exe_snprintf()
|
|
|
|
*
|
|
|
|
* OR
|
|
|
|
*
|
|
|
|
* cmd = ecore_exe_comand_parameter_append(cmd, "firefox");
|
|
|
|
* cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes");
|
2007-08-26 04:17:21 -07:00
|
|
|
* each parameter appended is one argument, and it gets escaped, quoted, and
|
2010-09-08 04:23:42 -07:00
|
|
|
* appended with a preceding space. The first is the command off course.
|
2006-04-05 18:16:02 -07:00
|
|
|
*/
|
|
|
|
|
2006-01-01 12:09:47 -08:00
|
|
|
struct _ecore_exe_dead_exe
|
|
|
|
{
|
2010-01-08 11:49:05 -08:00
|
|
|
pid_t pid;
|
|
|
|
char *cmd;
|
2006-01-01 12:09:47 -08:00
|
|
|
};
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI int ECORE_EXE_EVENT_ADD = 0;
|
|
|
|
EAPI int ECORE_EXE_EVENT_DEL = 0;
|
|
|
|
EAPI int ECORE_EXE_EVENT_DATA = 0;
|
|
|
|
EAPI int ECORE_EXE_EVENT_ERROR = 0;
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
Eina_List *_ecore_exe_exes = NULL;
|
2008-11-01 18:29:08 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
ecore_exe_run_priority_set(int pri)
|
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_run_priority_set(pri);
|
2008-11-01 18:29:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
ecore_exe_run_priority_get(void)
|
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_run_priority_get();
|
2008-11-01 18:29:08 -07:00
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI Ecore_Exe *
|
2011-10-20 22:40:39 -07:00
|
|
|
ecore_exe_run(const char *exe_cmd,
|
|
|
|
const void *data)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2006-01-10 08:46:07 -08:00
|
|
|
return ecore_exe_pipe_run(exe_cmd, 0, data);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI Ecore_Exe *
|
2011-10-20 22:40:39 -07:00
|
|
|
ecore_exe_pipe_run(const char *exe_cmd,
|
|
|
|
Ecore_Exe_Flags flags,
|
|
|
|
const void *data)
|
2005-10-24 01:53:50 -07:00
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe *ret = eo_add(MY_CLASS, NULL, ecore_obj_exe_command_set(exe_cmd, flags));
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
Ecore_Exe_Data *pd = eo_data_scope_get(ret, MY_CLASS);
|
|
|
|
pd->data = (void *) data;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_command_set(Eo *obj EINA_UNUSED, Ecore_Exe_Data *pd, const char *cmd, Ecore_Exe_Flags flags)
|
|
|
|
{
|
|
|
|
pd->cmd = strdup(cmd);
|
|
|
|
pd->flags = flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_command_get(Eo *obj EINA_UNUSED, Ecore_Exe_Data *pd, const char **cmd, Ecore_Exe_Flags *flags)
|
|
|
|
{
|
|
|
|
if (cmd) *cmd = pd->cmd;
|
|
|
|
if (flags) *flags = pd->flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
|
|
|
_ecore_exe_eo_base_finalize(Eo *obj, Ecore_Exe_Data *exe)
|
|
|
|
{
|
2014-08-26 08:48:07 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2015-02-23 08:38:00 -08:00
|
|
|
eo_do_super(obj, MY_CLASS, obj = eo_finalize());
|
2011-10-20 22:40:39 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
if (!obj)
|
|
|
|
return obj;
|
2008-11-29 03:23:17 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_eo_base_finalize(obj, exe);
|
2005-10-24 01:53:50 -07:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:16:59 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_callback_pre_free_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
Ecore_Exe_Cb func)
|
2010-01-05 21:16:59 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2010-01-05 21:16:59 -08:00
|
|
|
exe->pre_free_cb = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_send(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
const void *data,
|
|
|
|
int size)
|
2005-10-24 01:53:50 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(EINA_FALSE);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return EINA_FALSE;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2010-01-05 21:16:59 -08:00
|
|
|
if (exe->close_stdin)
|
2011-10-20 22:40:39 -07:00
|
|
|
{
|
|
|
|
ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p",
|
|
|
|
exe, size, data);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2010-01-05 21:16:59 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_send(obj, exe, data, size);
|
2005-10-24 01:53:50 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_close_stdin(Ecore_Exe *obj)
|
2005-12-30 11:17:21 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2006-01-04 12:53:07 -08:00
|
|
|
exe->close_stdin = 1;
|
2005-12-30 11:17:21 -08:00
|
|
|
}
|
|
|
|
|
2006-01-16 05:21:52 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_auto_limits_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
int start_bytes,
|
|
|
|
int end_bytes,
|
|
|
|
int start_lines,
|
|
|
|
int end_lines)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-27 03:00:11 -07:00
|
|
|
|
|
|
|
_impl_ecore_exe_auto_limits_set(obj, exe, start_bytes, end_bytes, start_lines, end_lines);
|
2006-01-16 05:21:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Ecore_Exe_Event_Data *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_event_data_get(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
Ecore_Exe_Flags flags)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return NULL;
|
2006-01-19 20:42:35 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
return _impl_ecore_exe_event_data_get(obj, exe, flags);
|
2006-01-16 05:21:52 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_tag_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
const char *tag)
|
2005-09-28 06:09:09 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2005-12-24 04:13:12 -08:00
|
|
|
IF_FREE(exe->tag);
|
2006-02-28 21:05:58 -08:00
|
|
|
if (tag)
|
2011-10-20 22:40:39 -07:00
|
|
|
exe->tag = strdup(tag);
|
2010-01-05 21:16:59 -08:00
|
|
|
else
|
2011-10-20 22:40:39 -07:00
|
|
|
exe->tag = NULL;
|
2005-09-28 06:09:09 -07:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:16:59 -08:00
|
|
|
EAPI const char *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_tag_get(const Ecore_Exe *obj)
|
2005-09-28 06:09:09 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return NULL;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2005-09-28 06:09:09 -07:00
|
|
|
return exe->tag;
|
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_free(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return NULL;
|
2006-01-15 19:20:36 -08:00
|
|
|
|
2014-08-26 08:36:25 -07:00
|
|
|
void *data = exe->data;
|
|
|
|
eo_del(obj);
|
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_eo_base_destructor(Eo *obj, Ecore_Exe_Data *exe)
|
|
|
|
{
|
2014-08-27 01:04:01 -07:00
|
|
|
eo_do_super(obj, ECORE_EXE_CLASS, eo_destructor());
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_eo_base_destructor(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-16 05:21:52 -08:00
|
|
|
EAPI void
|
2009-12-06 19:06:50 -08:00
|
|
|
ecore_exe_event_data_free(Ecore_Exe_Event_Data *e)
|
2006-01-16 05:21:52 -08:00
|
|
|
{
|
2010-01-05 21:16:59 -08:00
|
|
|
if (!e) return;
|
2006-01-16 05:21:52 -08:00
|
|
|
IF_FREE(e->lines);
|
|
|
|
IF_FREE(e->data);
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI pid_t
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_pid_get(const Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return -1;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
return exe->pid;
|
|
|
|
}
|
|
|
|
|
2010-01-05 21:16:59 -08:00
|
|
|
EAPI const char *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_cmd_get(const Ecore_Exe *obj)
|
2006-04-15 05:44:31 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
const char *ret = NULL;
|
|
|
|
|
|
|
|
eo_do(obj, ecore_obj_exe_command_get(&ret, NULL));
|
|
|
|
|
|
|
|
return ret;
|
2006-04-15 05:44:31 -07:00
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
EAPI void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_data_get(const Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return NULL;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
return exe->data;
|
|
|
|
}
|
|
|
|
|
2011-04-19 14:38:24 -07:00
|
|
|
EAPI void *
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_data_set(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *data)
|
2011-04-19 14:38:24 -07:00
|
|
|
{
|
|
|
|
void *ret;
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return NULL;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2011-04-19 14:38:24 -07:00
|
|
|
ret = exe->data;
|
|
|
|
exe->data = data;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-01-03 13:55:50 -08:00
|
|
|
EAPI Ecore_Exe_Flags
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_flags_get(const Ecore_Exe *obj)
|
2010-01-03 13:55:50 -08:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN_VAL(0);
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return 0;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2010-01-03 13:55:50 -08:00
|
|
|
return exe->flags;
|
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_pause(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2014-08-08 07:13:05 -07:00
|
|
|
eo_do(obj, efl_control_suspend_set(EINA_TRUE));
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_continue(Ecore_Exe *obj)
|
2014-08-08 07:13:05 -07:00
|
|
|
{
|
|
|
|
eo_do(obj, efl_control_suspend_set(EINA_FALSE));
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_ecore_exe_efl_control_suspend_set(Eo *obj EINA_UNUSED, Ecore_Exe_Data *exe, Eina_Bool suspend)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-08 07:13:05 -07:00
|
|
|
if (suspend)
|
2014-08-26 08:48:07 -07:00
|
|
|
{
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_pause(obj, exe);
|
2014-08-26 08:48:07 -07:00
|
|
|
}
|
2014-08-08 07:13:05 -07:00
|
|
|
else
|
2014-08-26 08:48:07 -07:00
|
|
|
{
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_continue(obj, exe);
|
2014-08-26 08:48:07 -07:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_interrupt(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_interrupt(obj, exe);
|
2008-07-29 15:07:19 -07:00
|
|
|
}
|
2006-01-01 12:09:47 -08:00
|
|
|
|
2008-07-29 15:07:19 -07:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_quit(Ecore_Exe *obj)
|
2008-07-29 15:07:19 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_quit(obj, exe);
|
2008-07-29 15:07:19 -07:00
|
|
|
}
|
2006-01-10 08:46:07 -08:00
|
|
|
|
2008-07-29 15:07:19 -07:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_terminate(Ecore_Exe *obj)
|
2008-07-29 15:07:19 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_terminate(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_kill(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2006-01-01 12:09:47 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_kill(obj, exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_signal(Ecore_Exe *obj,
|
2011-10-20 22:40:39 -07:00
|
|
|
int num)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_signal(obj, exe, num);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI void
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_hup(Ecore_Exe *obj)
|
2003-09-23 01:09:32 -07:00
|
|
|
{
|
2012-03-29 01:52:25 -07:00
|
|
|
EINA_MAIN_LOOP_CHECK_RETURN;
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
|
|
|
if (!eo_isa(obj, MY_CLASS))
|
2011-10-20 22:40:39 -07:00
|
|
|
return;
|
2014-08-07 06:57:50 -07:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
_impl_ecore_exe_hup(obj, exe);
|
2006-01-01 12:09:47 -08:00
|
|
|
}
|
|
|
|
|
2006-01-12 20:31:41 -08:00
|
|
|
void
|
|
|
|
_ecore_exe_init(void)
|
|
|
|
{
|
2006-01-13 05:18:36 -08:00
|
|
|
ECORE_EXE_EVENT_ADD = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_DEL = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_DATA = ecore_event_type_new();
|
|
|
|
ECORE_EXE_EVENT_ERROR = ecore_event_type_new();
|
2006-01-12 20:31:41 -08:00
|
|
|
}
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
void
|
|
|
|
_ecore_exe_shutdown(void)
|
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe *exe = NULL;
|
|
|
|
Eina_List *l1, *l2;
|
2014-08-27 03:00:11 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(_ecore_exe_exes, l1, l2, exe)
|
2014-08-07 06:57:50 -07:00
|
|
|
ecore_exe_free(exe);
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|
|
|
|
|
2009-12-06 19:06:50 -08:00
|
|
|
Ecore_Exe *
|
2003-09-23 01:09:32 -07:00
|
|
|
_ecore_exe_find(pid_t pid)
|
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Eina_List *itr;
|
|
|
|
Ecore_Exe *obj;
|
2009-12-06 19:06:50 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
EINA_LIST_FOREACH(_ecore_exe_exes, itr, obj)
|
2011-10-20 22:40:39 -07:00
|
|
|
{
|
2014-08-07 06:57:50 -07:00
|
|
|
Ecore_Exe_Data *exe = eo_data_scope_get(obj, MY_CLASS);
|
2011-10-20 22:40:39 -07:00
|
|
|
if (exe->pid == pid)
|
2014-08-07 06:57:50 -07:00
|
|
|
return obj;
|
2011-10-20 22:40:39 -07:00
|
|
|
}
|
2003-09-23 01:09:32 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void *
|
|
|
|
_ecore_exe_event_del_new(void)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2014-08-27 03:00:11 -07:00
|
|
|
Ecore_Exe_Event_Del *e;
|
2005-12-30 11:17:21 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
e = calloc(1, sizeof(Ecore_Exe_Event_Del));
|
|
|
|
return e;
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
|
|
|
_ecore_exe_event_del_free(void *data EINA_UNUSED,
|
|
|
|
void *ev)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2014-08-27 03:00:11 -07:00
|
|
|
Ecore_Exe_Event_Del *e;
|
2005-12-10 14:39:51 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
e = ev;
|
|
|
|
if (e->exe)
|
|
|
|
ecore_exe_free(e->exe);
|
|
|
|
free(e);
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_exe_event_exe_data_free(void *data EINA_UNUSED,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *ev)
|
2005-12-10 14:39:51 -08:00
|
|
|
{
|
2006-01-15 03:27:19 -08:00
|
|
|
Ecore_Exe_Event_Data *e;
|
2005-12-10 14:39:51 -08:00
|
|
|
|
|
|
|
e = ev;
|
2006-01-16 05:21:52 -08:00
|
|
|
ecore_exe_event_data_free(e);
|
2005-12-10 14:39:51 -08:00
|
|
|
}
|
2006-01-13 05:18:36 -08:00
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
Ecore_Exe_Event_Add *
|
2006-01-13 05:18:36 -08:00
|
|
|
_ecore_exe_event_add_new(void)
|
|
|
|
{
|
|
|
|
Ecore_Exe_Event_Add *e;
|
2006-02-28 21:05:58 -08:00
|
|
|
|
2006-01-13 05:18:36 -08:00
|
|
|
e = calloc(1, sizeof(Ecore_Exe_Event_Add));
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:00:11 -07:00
|
|
|
void
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_exe_event_add_free(void *data EINA_UNUSED,
|
2011-10-20 22:40:39 -07:00
|
|
|
void *ev)
|
2006-01-13 05:18:36 -08:00
|
|
|
{
|
|
|
|
Ecore_Exe_Event_Add *e;
|
2006-02-28 21:05:58 -08:00
|
|
|
|
2006-01-13 05:18:36 -08:00
|
|
|
e = ev;
|
|
|
|
free(e);
|
|
|
|
}
|
2006-01-15 19:20:36 -08:00
|
|
|
|
2014-08-07 06:57:50 -07:00
|
|
|
#include "ecore_exe.eo.c"
|