version 1.740, 2017/04/19 14:00:28 |
version 1.741, 2017/04/20 09:20:22 |
|
|
}; |
}; |
|
|
/* Scheduled job. */ |
/* Scheduled job. */ |
|
struct job; |
|
typedef void (*job_update_cb) (struct job *); |
|
typedef void (*job_complete_cb) (struct job *); |
|
typedef void (*job_free_cb) (void *); |
struct job { |
struct job { |
enum { |
enum { |
JOB_RUNNING, |
JOB_RUNNING, |
|
|
JOB_CLOSED |
JOB_CLOSED |
} state; |
} state; |
|
|
char *cmd; |
char *cmd; |
pid_t pid; |
pid_t pid; |
int status; |
int status; |
|
|
int fd; |
int fd; |
struct bufferevent *event; |
struct bufferevent *event; |
|
|
void (*callbackfn)(struct job *); |
job_update_cb updatecb; |
void (*freefn)(void *); |
job_complete_cb completecb; |
void *data; |
job_free_cb freecb; |
|
void *data; |
|
|
LIST_ENTRY(job) lentry; |
LIST_ENTRY(job) entry; |
}; |
}; |
LIST_HEAD(joblist, job); |
LIST_HEAD(joblist, job); |
|
|
|
|
|
|
/* job.c */ |
/* job.c */ |
extern struct joblist all_jobs; |
extern struct joblist all_jobs; |
struct job *job_run(const char *, struct session *, const char *, |
struct job *job_run(const char *, struct session *, const char *, |
void (*)(struct job *), void (*)(void *), void *); |
job_update_cb, job_complete_cb, job_free_cb, void *); |
void job_free(struct job *); |
void job_free(struct job *); |
void job_died(struct job *, int); |
void job_died(struct job *, int); |
|
|
/* environ.c */ |
/* environ.c */ |
struct environ *environ_create(void); |
struct environ *environ_create(void); |