author | viric@llimona |
Mon, 02 Apr 2007 17:53:52 +0200 | |
changeset 74 | bb1b20d79acf |
parent 73 | 0c03786ff927 |
child 92 | 05004c52ecff |
permissions | -rw-r--r-- |
31 | 1 |
enum Request |
2 |
{ |
|
3 |
c_QUEUE, |
|
4 |
c_TAIL, |
|
5 |
c_KILL_SERVER, |
|
6 |
c_LIST, |
|
7 |
c_CLEAR_FINISHED, |
|
8 |
c_SHOW_HELP, |
|
37 | 9 |
c_SHOW_VERSION, |
33 | 10 |
c_CAT, |
11 |
c_SHOW_OUTPUT_FILE, |
|
35 | 12 |
c_SHOW_PID, |
42 | 13 |
c_REMOVEJOB, |
53 | 14 |
c_WAITJOB, |
63 | 15 |
c_URGENT, |
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
65
diff
changeset
|
16 |
c_GET_STATE, |
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
65
diff
changeset
|
17 |
c_SWAP_JOBS |
31 | 18 |
}; |
19 |
||
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
20 |
struct Command_line { |
31 | 21 |
enum Request request; |
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
22 |
int need_server; |
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
23 |
int store_output; |
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
24 |
int should_go_background; |
55
678ca291d545
Now the '-nf' doesn't leave a job in 'finished' state.
viric@llimona
parents:
53
diff
changeset
|
25 |
int should_keep_finished; |
71 | 26 |
int send_output_by_mail; |
65 | 27 |
int gzip; |
71 | 28 |
int jobid; /* When queuing a job, main.c will fill it automatically from |
29 |
the server answer to NEWJOB */ |
|
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
65
diff
changeset
|
30 |
int jobid2; |
68
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
31 |
struct { |
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
32 |
char **array; |
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
33 |
int num; |
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
34 |
} command; |
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
35 |
}; |
3 | 36 |
|
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
37 |
extern struct Command_line command_line; |
32 | 38 |
extern int server_socket; |
3 | 39 |
|
40 |
struct msg; |
|
41 |
||
42 |
/* client.c */ |
|
68
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
43 |
void c_new_job(); |
8 | 44 |
void c_list_jobs(); |
44 | 45 |
void c_shutdown_server(); |
5 | 46 |
void c_wait_server_lines(); |
44 | 47 |
void c_clear_finished(); |
68
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
48 |
int c_wait_server_commands(); |
35 | 49 |
void c_send_runjob_ok(const char *ofname, int pid); |
32 | 50 |
void c_tail(); |
33 | 51 |
void c_cat(); |
52 |
void c_show_output_file(); |
|
41 | 53 |
void c_remove_job(); |
44 | 54 |
void c_show_pid(); |
51
aa6e05d77537
'-w' returns the waited errorlevel. Added a testbench.
viric@llimona
parents:
44
diff
changeset
|
55 |
int c_wait_job(); |
53 | 56 |
void c_move_urgent(); |
62 | 57 |
int c_wait_newjob_ok(); |
63 | 58 |
void c_get_state(); |
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
65
diff
changeset
|
59 |
void c_swap_jobs(); |
71 | 60 |
char *build_command_string(); |
3 | 61 |
|
62 |
/* jobs.c */ |
|
63 |
void s_list(int s); |
|
18 | 64 |
int s_newjob(int s, struct msg *m); |
3 | 65 |
void s_removejob(int jobid); |
19
5efc347cca8d
The finished jobs store the errorlevel, and can be listed.
viric@llimona
parents:
18
diff
changeset
|
66 |
void job_finished(int errorlevel); |
8 | 67 |
int next_run_job(); |
19
5efc347cca8d
The finished jobs store the errorlevel, and can be listed.
viric@llimona
parents:
18
diff
changeset
|
68 |
void s_mark_job_running(); |
20
d85b4c0745fa
"-c" added, for clearing the finished tasks' list.
viric@llimona
parents:
19
diff
changeset
|
69 |
void s_clear_finished(); |
35 | 70 |
void s_process_runjob_ok(int jobid, char *oname, int pid); |
32 | 71 |
void s_send_output(int socket, int jobid); |
41 | 72 |
void s_remove_job(int s, int jobid); |
42 | 73 |
void s_remove_notification(int s); |
44 | 74 |
void check_notify_list(int jobid); |
75 |
void s_wait_job(int s, int jobid); |
|
53 | 76 |
void s_move_urgent(int s, int jobid); |
63 | 77 |
void s_send_state(int s, int jobid); |
66
f70a27afd92e
Adding "swap jobs" with -U. Fixed a big problem with fds 0, 1, 2.
viric@mandarina
parents:
65
diff
changeset
|
78 |
void s_swap_jobs(int s, int jobid1, int jobid2); |
3 | 79 |
|
80 |
/* server.c */ |
|
28
107abb4ec98a
Unified socket path, depending on the username and $TMPDIR.
viric@llimona
parents:
27
diff
changeset
|
81 |
void server_main(int notify_fd, char *_path); |
3 | 82 |
|
83 |
/* server_start.c */ |
|
84 |
int try_connect(int s); |
|
85 |
void wait_server_up(); |
|
86 |
int ensure_server_up(); |
|
25 | 87 |
void notify_parent(int fd); |
8 | 88 |
|
89 |
/* execute.c */ |
|
68
3ae9b38d7d30
Now the orders don't run under 'bash'. They run as is.
viric@llimona
parents:
65
diff
changeset
|
90 |
int run_job(); |
32 | 91 |
|
33 | 92 |
/* client_run.c */ |
32 | 93 |
void c_run_tail(const char *filename); |
33 | 94 |
void c_run_cat(const char *filename); |
71 | 95 |
|
96 |
/* mail.c */ |
|
97 |
void send_mail(int jobid, int errorlevel, const char *ofname, |
|
98 |
const char *command); |
|
73 | 99 |
void hook_on_finish(int jobid, int errorlevel, const char *ofname, |
100 |
const char *command); |