OLD | NEW |
1 /* upstart | 1 /* upstart |
2 * | 2 * |
3 * job.c - core state machine of tasks and services | 3 * job.c - core state machine of tasks and services |
4 * | 4 * |
5 * Copyright © 2009 Canonical Ltd. | 5 * Copyright © 2009 Canonical Ltd. |
6 * Author: Scott James Remnant <scott@netsplit.com>. | 6 * Author: Scott James Remnant <scott@netsplit.com>. |
7 * | 7 * |
8 * This program is free software; you can redistribute it and/or modify | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License version 2, as | 9 * it under the terms of the GNU General Public License version 2, as |
10 * published by the Free Software Foundation. | 10 * published by the Free Software Foundation. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "events.h" | 47 #include "events.h" |
48 #include "environ.h" | 48 #include "environ.h" |
49 #include "process.h" | 49 #include "process.h" |
50 #include "job_class.h" | 50 #include "job_class.h" |
51 #include "job.h" | 51 #include "job.h" |
52 #include "job_process.h" | 52 #include "job_process.h" |
53 #include "event.h" | 53 #include "event.h" |
54 #include "event_operator.h" | 54 #include "event_operator.h" |
55 #include "blocked.h" | 55 #include "blocked.h" |
56 #include "control.h" | 56 #include "control.h" |
| 57 #include "perf_log.h" |
57 | 58 |
58 #include "com.ubuntu.Upstart.Job.h" | 59 #include "com.ubuntu.Upstart.Job.h" |
59 #include "com.ubuntu.Upstart.Instance.h" | 60 #include "com.ubuntu.Upstart.Instance.h" |
60 | 61 |
61 | 62 |
62 /** | 63 /** |
63 * job_new: | 64 * job_new: |
64 * @class: class of job, | 65 * @class: class of job, |
65 * @name: name for new instance. | 66 * @name: name for new instance. |
66 * | 67 * |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 nih_assert (job != NULL); | 278 nih_assert (job != NULL); |
278 | 279 |
279 while (job->state != state) { | 280 while (job->state != state) { |
280 JobState old_state; | 281 JobState old_state; |
281 int unused; | 282 int unused; |
282 | 283 |
283 nih_assert (job->blocker == NULL); | 284 nih_assert (job->blocker == NULL); |
284 | 285 |
285 nih_info (_("%s state changed from %s to %s"), job_name (job), | 286 nih_info (_("%s state changed from %s to %s"), job_name (job), |
286 job_state_name (job->state), job_state_name (state)); | 287 job_state_name (job->state), job_state_name (state)); |
| 288 perf_log_job_state_change(job, state); |
287 | 289 |
288 old_state = job->state; | 290 old_state = job->state; |
289 job->state = state; | 291 job->state = state; |
290 | 292 |
291 /* Perform whatever action is necessary to enter the new | 293 /* Perform whatever action is necessary to enter the new |
292 * state, such as executing a process or emitting an event. | 294 * state, such as executing a process or emitting an event. |
293 */ | 295 */ |
294 switch (job->state) { | 296 switch (job->state) { |
295 case JOB_STARTING: | 297 case JOB_STARTING: |
296 nih_assert (job->goal == JOB_START); | 298 nih_assert (job->goal == JOB_START); |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 return -1; | 1405 return -1; |
1404 } | 1406 } |
1405 | 1407 |
1406 *processes = tmp; | 1408 *processes = tmp; |
1407 (*processes)[num_processes++] = process; | 1409 (*processes)[num_processes++] = process; |
1408 (*processes)[num_processes] = NULL; | 1410 (*processes)[num_processes] = NULL; |
1409 } | 1411 } |
1410 | 1412 |
1411 return 0; | 1413 return 0; |
1412 } | 1414 } |
OLD | NEW |