137
137
typedef void (*JobProcessErrorHandler) (Job *job, JobState state, ProcessType process);
140
* JobProcessHandlerData:
143
* @required_state: state job is attempting to move to,
144
* @process: current job process,
145
* @error_handler: handler to call if job process cannot be started,
146
* @script: optional script that job should run with,
147
* @shell_fd: file descriptor attached to child that @script should be
148
* written to (or -1 when @script is NULL).
150
typedef struct job_process_handler_data {
152
JobState required_state;
154
JobProcessErrorHandler error_handler;
157
} JobProcessHandlerData;
162
142
job_process_start (Job *job,
165
JobProcessErrorHandler error_handler);
167
void job_process_run_bottom (Job *job, ProcessType process, const char *script, int shell_fd);
169
void job_process_child_reader (JobProcessHandlerData *handler_data, NihIo *io,
144
ProcessType process);
146
void job_process_run_bottom (JobProcessData *handler_data);
148
void job_process_child_reader (JobProcessData *handler_data, NihIo *io,
170
149
const char *buf, size_t len);
172
void job_process_close_handler (JobProcessHandlerData *handler_data, NihIo *io);
153
void job_process_child_error_handler (JobProcessData *handler_data, NihIo *io);
156
void job_process_close_handler (JobProcessData *handler_data, NihIo *io);
174
158
pid_t job_process_spawn (Job *job, char * const argv[],
175
159
char * const *env, int trace, int script_fd,
197
181
void job_process_stop_all (void);
184
job_process_data_new (void *parent, Job *job, JobState state,
185
ProcessType process, int job_process_fd)
186
__attribute__ ((warn_unused_result));
189
job_process_data_serialise (const Job *job, const JobProcessData *handler_data)
190
__attribute__ ((warn_unused_result));
193
job_process_data_deserialise (void *parent, Job *job, json_object *json)
194
__attribute__ ((warn_unused_result));
196
void job_process_error_handler (const char *buf, size_t len);
201
200
#endif /* INIT_JOB_PROCESS_H */