aboutsummaryrefslogtreecommitdiff
path: root/src/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/job.c')
-rw-r--r--src/job.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/job.c b/src/job.c
index 4a97f88..3fae432 100644
--- a/src/job.c
+++ b/src/job.c
@@ -22,24 +22,25 @@
22#define STATE_ACTIVE 0x04 22#define STATE_ACTIVE 0x04
23 23
24struct job 24struct job
25{ 25{
26 struct job *next, *prev; 26 struct job *next, *prev;
27 int state; 27 int state;
28 const struct spool *spool; 28 struct spool *spool;
29 uid_t uid; 29 uid_t uid;
30 pid_t pid; 30 pid_t pid;
31 time_t timestamp; 31 time_t timestamp;
32 int exit_status; 32 int exit_status;
33}; 33};
34 34
35struct job *queue; 35struct job *queue;
36size_t jobmax; 36size_t jobmax;
37size_t jobcnt; 37size_t jobcnt;
38 38
39static struct spool fake_spool = { "all spools" }; 39struct spool fake_spool = { "all spools" },
40 inotify_spool = { "inotify" } ;
40 41
41static int wakeup; 42static int wakeup;
42 43
43RETSIGTYPE 44RETSIGTYPE
44queue_signal (int sig) 45queue_signal (int sig)
45{ 46{
@@ -73,19 +74,28 @@ job_active_count ()
73 for (job = queue; job; job = job->next) 74 for (job = queue; job; job = job->next)
74 if (job->state & STATE_ACTIVE) 75 if (job->state & STATE_ACTIVE)
75 count++; 76 count++;
76 return count; 77 return count;
77} 78}
78 79
80static int
81procspool (struct spool *spool, void *data)
82{
83 spool_commit_triplets (spool);
84 return 0;
85}
86
79int 87int
80wydawca_scanner (struct job *job) 88wydawca_scanner (struct job *job)
81{ 89{
82 int rc; 90 int rc;
83 initstats(); 91 initstats();
84 timer_start ("wydawca"); 92 timer_start ("wydawca");
85 if (job->spool == &fake_spool) 93 if (job->spool == &inotify_spool)
94 rc = for_each_spool (procspool, NULL);
95 else if (job->spool == &fake_spool)
86 rc = scan_all_spools (1, &job->uid); 96 rc = scan_all_spools (1, &job->uid);
87 else 97 else
88 { 98 {
89 spool_create_timers (); 99 spool_create_timers ();
90 rc = scan_spool (job->spool, 1, &job->uid); 100 rc = scan_spool (job->spool, 1, &job->uid);
91 } 101 }
@@ -188,13 +198,13 @@ job_insert (struct job *job, struct job *elt)
188 198
189 if (p) 199 if (p)
190 p->prev = job; 200 p->prev = job;
191} 201}
192 202
193void 203void
194schedule_job (const struct spool *spool, uid_t uid) 204schedule_job (struct spool *spool, uid_t uid)
195{ 205{
196 struct job *job; 206 struct job *job;
197 207
198 if (!spool) 208 if (!spool)
199 spool = &fake_spool; 209 spool = &fake_spool;
200 210

Return to:

Send suggestions and report system problems to the System administrator.