summaryrefslogtreecommitdiffstats
path: root/src/background.h
blob: a8b03233e040ccb1e211ae0f7c134c9ea224ec8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/** \file background.h
 *  \brief Header: Background support
 */

#ifndef MC__BACKGROUND_H
#define MC__BACKGROUND_H

#include <sys/types.h>          /* pid_t */
#include "filemanager/fileopctx.h"
/*** typedefs(not structures) and defined constants **********************************************/

enum TaskState
{
    Task_Running,
    Task_Stopped
};

typedef struct TaskList
{
    int fd;
    int to_child_fd;
    pid_t pid;
    int state;
    char *info;
    struct TaskList *next;
} TaskList;

/*** enums ***************************************************************************************/

/*** structures declarations (and typedefs of structures)*****************************************/

/*** global variables defined in .c file *********************************************************/

extern TaskList *task_list;

/*** declarations of public functions ************************************************************/

int do_background (file_op_context_t * ctx, char *info);
int parent_call (void *routine, file_op_context_t * ctx, int argc, ...);
char *parent_call_string (void *routine, int argc, ...);

void unregister_task_running (pid_t pid, int fd);
void unregister_task_with_pid (pid_t pid);

gboolean background_parent_call (const gchar * event_group_name, const gchar * event_name,
                                 gpointer init_data, gpointer data);

gboolean
background_parent_call_string (const gchar * event_group_name, const gchar * event_name,
                               gpointer init_data, gpointer data);

/*** inline functions ****************************************************************************/

#endif /* MC__BACKGROUND_H */