~vorlon/ubuntu/raring/upstart/lp.1199778

« back to all changes in this revision

Viewing changes to init/job.h

  • Committer: Scott James Remnant
  • Date: 2007-03-02 17:06:44 UTC
  • Revision ID: scott@netsplit.com-20070302170644-dh6hh4b723eyg02q
* init/job.h (Job): Add a unique id to the job structure.
* init/job.c (job_new): Assign an incrementing id to each new job
allocated.
(job_find_by_id): Locate a job by its unique id, sadly not very
efficient in a hash table ;-)
(job_name): New hash key function since name isn't the first entry
anymore.
(job_init): Change hash key function.
* init/tests/test_job.c (test_find_by_id): Make sure we can find a
job by its id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
/**
102
102
 * Job:
103
103
 * @entry: list header,
 
104
 * @id: unique job id,
104
105
 * @name: string name of the job; namespace shared with events,
105
106
 * @description: description of the job; intended for humans,
106
107
 * @author: author of the job; intended for humans,
151
152
typedef struct job Job;
152
153
struct job {
153
154
        NihList         entry;
 
155
        uint32_t        id;
154
156
 
155
157
        char           *name;
156
158
        char           *description;
227
229
 
228
230
Job *       job_find_by_name          (const char *name);
229
231
Job *       job_find_by_pid           (pid_t pid, ProcessType *process);
 
232
Job *       job_find_by_id            (uint32_t id);
230
233
 
231
234
Job *       job_change_goal           (Job *job, JobGoal goal,
232
235
                                       EventEmission *emission);