forked from enlightenment/efl
* ecore_exe events now get allocated just like other events.
* added ECORE_EXE_EVENT_ADD and support code. SVN revision: 19758
This commit is contained in:
parent
d08ccf6fa6
commit
8ff26002a5
|
@ -62,15 +62,17 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ECORE_EVENT_NONE 0
|
#define ECORE_EVENT_NONE 0
|
||||||
#define ECORE_EXE_EVENT_DEL 1 /**< Spawned Exe has exit event */
|
#define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */
|
||||||
#define ECORE_EVENT_SIGNAL_USER 2 /**< User signal event */
|
#define ECORE_EVENT_SIGNAL_HUP 2 /**< Hup signal event */
|
||||||
#define ECORE_EVENT_SIGNAL_HUP 3 /**< Hup signal event */
|
#define ECORE_EVENT_SIGNAL_EXIT 3 /**< Exit signal event */
|
||||||
#define ECORE_EVENT_SIGNAL_EXIT 4 /**< Exit signal event */
|
#define ECORE_EVENT_SIGNAL_POWER 4 /**< Power signal event */
|
||||||
#define ECORE_EVENT_SIGNAL_POWER 5 /**< Power signal event */
|
#define ECORE_EVENT_SIGNAL_REALTIME 5 /**< Realtime signal event */
|
||||||
#define ECORE_EVENT_SIGNAL_REALTIME 6 /**< Realtime signal event */
|
#define ECORE_EVENT_COUNT 6
|
||||||
#define ECORE_EXE_EVENT_DATA 7 /**< Data from a child process */
|
|
||||||
#define ECORE_EXE_EVENT_ERROR 8 /**< Error from a child process */
|
EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */
|
||||||
#define ECORE_EVENT_COUNT 9
|
EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistant with the rest of ecore). */
|
||||||
|
EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */
|
||||||
|
EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */
|
||||||
|
|
||||||
#ifndef _ECORE_PRIVATE_H
|
#ifndef _ECORE_PRIVATE_H
|
||||||
enum _Ecore_Fd_Handler_Flags
|
enum _Ecore_Fd_Handler_Flags
|
||||||
|
@ -106,6 +108,7 @@ extern "C" {
|
||||||
typedef void Ecore_Event; /**< A handle for an event */
|
typedef void Ecore_Event; /**< A handle for an event */
|
||||||
typedef void Ecore_Animator; /**< A handle for animators */
|
typedef void Ecore_Animator; /**< A handle for animators */
|
||||||
#endif
|
#endif
|
||||||
|
typedef struct _Ecore_Exe_Event_Add Ecore_Exe_Event_Add; /**< Spawned Exe add event */
|
||||||
typedef struct _Ecore_Event_Exe_Exit Ecore_Event_Exe_Exit; /**< Spawned Exe exit event */
|
typedef struct _Ecore_Event_Exe_Exit Ecore_Event_Exe_Exit; /**< Spawned Exe exit event */
|
||||||
typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User; /**< User signal event */
|
typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User; /**< User signal event */
|
||||||
typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup; /**< Hup signal event */
|
typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup; /**< Hup signal event */
|
||||||
|
@ -116,6 +119,12 @@ extern "C" {
|
||||||
typedef struct _Ecore_Event_Exe_Data Ecore_Event_Exe_Data; /**< Data from a child process */
|
typedef struct _Ecore_Event_Exe_Data Ecore_Event_Exe_Data; /**< Data from a child process */
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
struct _Ecore_Exe_Event_Add /** Process add event */
|
||||||
|
{
|
||||||
|
Ecore_Exe *exe; /**< The handle to the added process */
|
||||||
|
void *ext_data; /**< Extension data - not used */
|
||||||
|
};
|
||||||
|
|
||||||
struct _Ecore_Event_Exe_Exit /** Process exit event */
|
struct _Ecore_Event_Exe_Exit /** Process exit event */
|
||||||
{
|
{
|
||||||
pid_t pid; /**< The process ID of the process that exited */
|
pid_t pid; /**< The process ID of the process that exited */
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
|
|
||||||
struct _ecore_exe_dead_exe
|
struct _ecore_exe_dead_exe
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -22,6 +23,13 @@ static void _ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev);
|
||||||
static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
|
static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
|
||||||
static int _ecore_exe_make_sure_its_dead(void *data);
|
static int _ecore_exe_make_sure_its_dead(void *data);
|
||||||
static int _ecore_exe_make_sure_its_really_dead(void *data);
|
static int _ecore_exe_make_sure_its_really_dead(void *data);
|
||||||
|
static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void);
|
||||||
|
static void _ecore_exe_event_add_free(void *data, void *ev);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
static Ecore_Exe *exes = NULL;
|
static Ecore_Exe *exes = NULL;
|
||||||
static char *shell = NULL;
|
static char *shell = NULL;
|
||||||
|
@ -406,7 +414,16 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
||||||
IF_FN_DEL(_ecore_exe_free, exe);
|
IF_FN_DEL(_ecore_exe_free, exe);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Running as %d for %s.\n", exe->pid, exe->cmd);
|
{
|
||||||
|
Ecore_Exe_Event_Add *e;
|
||||||
|
|
||||||
|
e = _ecore_exe_event_add_new();
|
||||||
|
e->exe = exe;
|
||||||
|
if (e) /* Send the event. */
|
||||||
|
ecore_event_add(ECORE_EXE_EVENT_ADD, e,
|
||||||
|
_ecore_exe_event_add_free, NULL);
|
||||||
|
printf("Running as %d for %s.\n", exe->pid, exe->cmd);
|
||||||
|
}
|
||||||
|
|
||||||
errno = n;
|
errno = n;
|
||||||
return exe;
|
return exe;
|
||||||
|
@ -796,6 +813,10 @@ _ecore_exe_make_sure_its_really_dead(void *data)
|
||||||
void
|
void
|
||||||
_ecore_exe_init(void)
|
_ecore_exe_init(void)
|
||||||
{
|
{
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1211,4 +1232,22 @@ _ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev)
|
||||||
IF_FREE(e->data);
|
IF_FREE(e->data);
|
||||||
free(e);
|
free(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Ecore_Exe_Event_Add *
|
||||||
|
_ecore_exe_event_add_new(void)
|
||||||
|
{
|
||||||
|
Ecore_Exe_Event_Add *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_Exe_Event_Add));
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_exe_event_add_free(void *data __UNUSED__, void *ev)
|
||||||
|
{
|
||||||
|
Ecore_Exe_Event_Add *e;
|
||||||
|
|
||||||
|
e = ev;
|
||||||
|
free(e);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue