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

1447 by Steve Langasek
Attempt to cherry-pick fixes for bug #1199778 to raring; something is still
1
2013-07-17  James Hunt  <james.hunt@ubuntu.com>
2
3
	* init/tests/test_state.c:
4
	  - test_session_serialise(): Added new test "Ensure session
5
	    deserialisation does not create JobClasses" to assert
6
	    new session deserialisation behaviour.
7
	  - test_session_upgrade2(): Finished writing this test - it now creates
8
	    a fake chroot path, updates the JSON so that all references to the
9
	    chroot session refer to the temporary chroot path, creates 2 jobs
10
	    and then performs the serialisation/deserialisation.
11
	* init/tests/test_util.c:
12
	  - ensure_env_clean():
13
	    - Comments.
14
	    - Added log_unflushed_files.
15
	  - clean_env(): New function that re-initialises the common
16
	    data structures.
17
	* test/test_util_common.c: search_and_replace(): New function.
18
19
2013-07-16  James Hunt  <james.hunt@ubuntu.com>
20
21
	* init/tests/data/upstart-session2.json: New JSON used by
22
	  test_session_upgrade2().
23
	* init/Makefile.am: Added upstart-session.json and upstart-session2.json
24
	  to TEST_DATA_FILES.
25
	* init/conf.c: conf_source_deserialise_all(): Assert that no conf
26
	  sources have yet been deserialised since now session deserialisation
27
	  avoids creating chroot conf sources (see below).
28
	* init/job_class.c: job_class_deserialise_all(): Formatting.
29
	* init/session.c: session_deserialise_all(): Don't create ConfSources
30
	  for each Session (since they are not actually used).
31
	* init/tests/test_state.c:
32
	  - test_upgrade(): Call ensure_env_clean() both before each test and
33
	    after the last test to ensure it left the environment clean.
34
	  - test_session_upgrade(): Clear up sessions.
35
	  - test_session_upgrade2(): New test.
36
	* init/tests/test_util.c: ensure_env_clean(): New function abstracted
37
	  from code in test_upgrade().
38
39
2013-07-15  James Hunt  <james.hunt@ubuntu.com>
40
41
	* init/state.c:
42
	  - state_deserialise_resolve_deps(): Look up class
43
	    conventionally using name and session since existing indexing
44
	    code unreliable as referencing a hash.
45
	  - state_index_to_job_class(): Removed.
46
	* init/tests/test_state.c: test_session_upgrade(): Add check to ensure
47
	  session job with same name as NULL session job does not stop latter
48
	  being deserialised.
49
50
2013-07-12  Dmitrijs Ledkovs  <xnox@ubuntu.com>
51
52
	* init/tests/data: upstart-session.json: add stateful re-exec
53
	tests with chroot session. (LP: #1200264)
54
55
	* init/state.c: state_deserialise_resolve_deps(): properly account
56
	at dependency resolution stage for skipped job_classes from chroot
57
	sessions when those got deserialised. Fixes above unit test.
58
59
2013-07-11  James Hunt  <james.hunt@ubuntu.com>
60
61
	* init/conf.c: conf_source_deserialise_all(): Assert that any
62
	  existing ConfSources relate to chroot sessions, created as
63
	  part of the earlier Session deserialisation. (LP: #1199778)
64
	* init/state.c: Formatting.
65
1445 by Dmitrijs Ledkovs
* Correct typo in the upstart postinstall script. (LP: #1195955).
66
2013-06-05  James Hunt  <james.hunt@ubuntu.com>
67
68
	* init/tests/data/upstart-1.8+apparmor.json: New test data file.
69
	* init/tests/data/upstart-1.8+full_serialisation-apparmor.json:
70
	  New test data file.
71
	* init/tests/data/upstart-1.8+full_serialisation+apparmor.json:
72
	  New test data file.
73
	* init/tests/test_state.c:
74
	  - test_upgrade(): Re-initialise lists and hashes as a convenience to
75
	    the tests.
76
	  - test_upstart_with_apparmor_upgrade(): New test to ensure Upstart can
77
	    parse the current 1.8 format JSON with the addition of the AppArmor
78
	    serialisation (but crucially *without* the full serialisation data
79
	    (EventOperator, etc).
80
	  - test_upstart_full_serialise_without_apparmor_upgrade(): New test to
81
	    ensure Upstart can parse the current 1.8 format JSON with the
82
	    addition of the full serialisation data (EventOperator, etc),
83
	    but _without_ the AppArmor serialisation.
84
	  - test_upstart_full_serialise_with_apparmor_upgrade(): New test to
85
	    ensure Upstart can parse the current 1.8 format JSON with the
86
	    addition of the full serialisation data (EventOperator, etc),
87
	    and the AppArmor serialisation.
88
	* init/state.c: state_from_string(): Check if ConfSources
89
	  exist in the serialisation data to allow distinction between
90
	  ConfSources not present and failing to deserialise them.
91
92
2013-06-04  James Hunt  <james.hunt@ubuntu.com>
93
94
	* init/event.c: event_deserialise(): Revert to checking JSON for
95
	  blockers to avoid reliance on JSON serialisation data format version.
96
	* init/event_operator.h: Fix misplacement of NIH_END_EXTERN.
97
	* init/state.c: Remove serialisation version code since the autoconf
98
	  approach of detecting the format of the JSON is safer.
99
	* init/state.h: Remove STATE_VERSION.
100
101
2013-05-13  James Hunt  <james.hunt@ubuntu.com>
102
103
	* init/state.c: stateful_reexec(): Specify all values for array
104
	  initialiser.
105
106
2013-05-10  James Hunt  <james.hunt@ubuntu.com>
107
108
	Revert to not supporting deserialisation of JobClasses with associated
109
	user/chroot sessions to avoid behavioural change for now.
110
	
111
	* init/job_class.c: 
112
	  - job_class_deserialise(): Revert to failing if associated session is
113
	    non-NULL.
114
	  - job_class_deserialise_all(): Revert to ignoring failure to
115
	    deserialise a JobClass iff it has a non-NULL associated session.
116
	* init/state.c: 
117
	  - state_to_string(): Provide some diagnostics if serialisation fails.
118
	  - state_from_string(): Provide some diagnostics if deserialisation fails.
119
	  - state_deserialise_resolve_deps(): Ignore failure to lookup JobClass
120
	    iff it has an associated user/chroot session.
121
	  - state_deserialise_blocking(): Revert to ignoring failure to
122
	    deserialise a Blocked object that is associated with a Job whose
123
	    JobClass has a non-NULL session.
124
	* init/tests/test_state.c: test_blocking(): Revert test to assert that
125
	  blocked job with non-NULL session is ignored.
126
127
2013-05-09  James Hunt  <james.hunt@ubuntu.com>
128
129
	* init/job.c: job_serialise(): Corrected logic for handling 'stop on'
130
	  condition.
131
	* init/job_class.c: job_class_deserialise(): Only check type after JSON
132
	  queried (thanks Coverity).
133
134
2013-05-08  James Hunt  <james.hunt@ubuntu.com>
135
136
	* init/Makefile.am: Link test_util to test_event_operator.
137
	* init/conf.c: conf_source_deserialise_all(): Assert conf_sources is
138
	  empty.
139
	* init/control.h: control_get_job(): Use job_class_get_registered()
140
	  rather than redundant job_class_find().
141
	* init/event_operator.c:
142
	  - Typos and formatting.
143
	  - event_operator_serialise(): Conditionally encode name and env.
144
	  - event_operator_deserialise(): Treat env as a string array, not an
145
	    environ array to ensure values are not discarded unless they contain '='.
146
	* init/job.c:
147
	  - job_deserialise(): Check JSON type for 'stop on' prior to attempting value extraction.
148
	  - job_find():
149
	    - Make job_class const.
150
	    - Use job_class_get_registered() rather than job_class_find().
151
	* init/job_class.c:
152
	  - job_class_get_registered(): Rework.
153
	  - job_class_add_safe(): Re-add since required to support old
154
	    serialisation formats that do not encode ConfSource and ConfFile
155
	    objects.
156
	  - job_class_deserialise():
157
	    - Take care to only associate ConfFile with JobClass if JSON encodes
158
	      ConfFile objects.
159
	    - Check JSON type for 'start/stop on' prior to attempting value extraction.
160
	  - job_class_find(): Remove (redundant due to job_class_get_registered()).
161
	* init/state.c:
162
	  - Set serialisation_version to an invalid value to detect if it was
163
	    never set (to handle old serialisation formats).
164
	  - state_from_string():
165
	    - Make failure to read header and ConfSources warnings only, to support old
166
	      serialisation formats that do not encode this information.
167
	  - state_deserialise_blocked(): Fix bug where event blocker was being
168
	    incremented twice. Now, just assert it is set.
169
	  - state_deserialise_blocking(): Failure to deserialise a Blocked object 
170
	    is no longer ignored since sessions are supported.
171
	* init/state.h: STATE_VERSION history and notes.
172
	* init/tests/test_conf.c: Replace calls to job_class_find() with
173
	  job_class_get_registered().
174
	* init/tests/test_event_operator.c:
175
	  - test_operator_serialisation(): Check both the original string
176
	    serialisation format and the new full EventOperator serialisation.
177
	    type.
178
	* init/tests/test_job.c:
179
	  - test_deserialise_ptrace():
180
	    - Comments and more checks.
181
	    - Create ConfSource, ConfFile and JobClass manually.
182
	    - Call job_class_consider() as we now have a backing ConfFile.
183
	    - Wait for childs child.
184
	* init/tests/test_state.c:
185
	  - Simplify TestDataFile.
186
	  - Ensure files passed to conf_file_new() provide expected suffix.
187
	  - job_class_diff(): Add event_operator_diff() call.
188
	  - conf_source_diff(): New function.
189
	  - conf_file_diff(): New function.
190
	  - test_blocking():
191
	    - Extra checks.
192
	    - Expect ConfFiles to be recreated on re-exec.
193
	  - test_upgrade(): Check environment is clean before running the next test.
194
	  - test_upstart1_8_upgrade(): New Upstart-1.8 serialisation format test.
195
	  - conf_source_from_path(): New utility function.
196
	* init/tests/test_util.c:
197
	  - event_operator_diff(): New function.
198
	  - session_from_chroot(): New function.
199
	* init/tests/data/upstart-1.8.json: New test file.
200
201
2013-05-08  James Hunt  <james.hunt@ubuntu.com>
202
203
	* init/conf.c:
204
	  - conf_source_serialise_all(): Make failures fatal.
205
	* init/event_operator.c: event_operator_collapse(): Unhide but mark as
206
	  unused (it's still used by the tests).
207
	* init/job.c:
208
	  - job_serialise(): Remove unused variable.
209
	  - job_deserialise(): Check the type of the start/stop on condition in
210
	    the json, not the json passed to the function.
211
	* init/job_class.c: job_class_deserialise(): Check the type of the
212
	  start/stop on condition in the json, not the json passed to the
213
	  function.
214
	* init/state.c:
215
	  - Comments.
216
	  - state_read_header(): Extract header from JSON before checking for
217
	    serialisation version.
218
219
2013-05-02  James Hunt  <james.hunt@ubuntu.com>
220
221
	* init/event.c: event_deserialise(): Only set blockers if EventOperators
222
	  are serialised.
223
	* init/event_operator.c: event_operator_collapse(): Now only needed for
224
	  DEBUG.
225
	* init/job.c:
226
	  - job_deserialise(): Support old string format for 'stop_on'
227
	    EventOperator as well as new array format.
228
	* init/job_class.c:
229
	* init/state.c: Create a meta-header containing a serialisation version
230
	  number.
231
232
2013-05-02  James Hunt  <james.hunt@ubuntu.com>
233
234
	* init/conf.c:
235
	  - New serialisation and support functions:
236
	    - conf_source_serialise()
237
	    - conf_source_serialise_all()
238
	    - conf_source_deserialise()
239
	    - conf_source_deserialise_all()
240
	    - conf_source_type_enum_to_str()
241
	    - conf_source_type_str_to_enum()
242
	    - conf_file_serialise()
243
	    - conf_file_deserialise()
244
	    - conf_file_deserialise_all()
245
	    - conf_source_get_index()
246
	    - conf_file_find()
247
	    - debug_show_event_operator()
248
	    - debug_show_event_operators()
249
	* init/event_operator.c:
250
	  - event_deserialise():
251
	    - Fix leaked env array.
252
	    - Deserialise blockers count now EventOperators are also serialised.
253
	  - event_operator_type_enum_to_str()
254
	  - event_operator_type_str_to_enum()
255
	  - event_operator_serialise()
256
	  - event_operator_serialise_all()
257
	  - event_operator_deserialise()
258
	  - event_operator_deserialise_all()
259
	* init/job_class.c:
260
	  - job_class_add_safe(): Remove as no longer required.
261
	  - job_class_get(): Must call job_class_init().
262
	  - job_class_serialise():
263
	    - Remove error case if chroot session specified now that ConfSources
264
	      are serialised.
265
	    - Serialise start/stop on fully (as EventOperators) rather than just the original
266
	      string condition (LP: #1103881).
267
	  - job_class_deserialise():
268
	    - Remove error case if chroot session specified now that ConfSources
269
	      are serialised.
270
	    - Associate the JobClass with its ConfFile.
271
	  - job_class_serialise_all():
272
	    - Comments.
273
	    - Failure to serialise a JobClass is now a hard error since we now
274
	      serialise all JobClasses.
275
	  - job_class_deserialise():
276
	    - Deserialise start/stop on conditions as EventOperators rather than as a
277
	      string condition.
278
	    - Since ConfFiles are now serialised, call job_class_consider()
279
	      rather than job_class_add_safe().
280
	  - job_class_deserialise_all():
281
	    - Failure to deserialise a JobClass is now a hard error since we now
282
	      serialise all JobClasses.
283
	  - job_class_get_index(): New function.
284
	* init/state.c:
285
	  - state_to_string(): Serialise ConfSources and ConfFiles.
286
	  - state_from_string(): Deserialise ConfSources and ConfFiles.
287
	  - state_deserialise_resolve_deps(): Allow chroot sessions to be
288
	    handled now we serialise ConfSources and ConfFiles.
289
290
2013-04-30  James Hunt  <james.hunt@ubuntu.com>
291
1447 by Steve Langasek
Attempt to cherry-pick fixes for bug #1199778 to raring; something is still
292
	* init/Makefile.am: Added test_main.
293
	* init/tests/test_main.c: New test.
294
	* init/tests/test_job_process.c: strcmp_compar() moved to test_util.c.
295
	* util/tests/test_initctl.c: strcmp_compar() removed.
296
	* init/xdg.c: Disable loading of jobs from SYSTEM_USERCONFDIR if
297
	  "UPSTART_NO_SYSTEM_USERCONFDIR" envvar set (required for testing).
298
	* test/test_util.c: Added strcmp_compar() and get_session_file().
299
	* util/tests/test_initctl.c: Use get_session_file().
300
301
2013-04-30  James Hunt  <james.hunt@ubuntu.com>
302
303
	* Makefile.am: Added 'test'.
304
	* configure.ac: Added 'test/Makefile'.
305
	* init/Makefile.am: Depend on test_util archive rather than source
306
	  files.
307
	* init/state.c: Added missing config.h include.
308
	* util/Makefile.am: Depend on test_util archive rather than source
309
	  files.
310
	* util/tests/test_initctl.c: Moved common utility code to
311
	  test/test_util.c and replaced INITCTL_BINARY by get_initctl_binary().
312
	* test/test_util.[ch]: New location for init/tests/test_util.[ch] to
313
	  allow all tests access to common functionality.
314
315
2013-04-30  James Hunt  <james.hunt@ubuntu.com>
316
1445 by Dmitrijs Ledkovs
* Correct typo in the upstart postinstall script. (LP: #1195955).
317
	* init/job.c: job_serialise_all(): Really serialise all JobClasses,
318
	* init/main.c: Add 'write-state-file' command-line option.
319
	  regardless of whether they have associated Jobs.
320
	* init/paths.h: Added STATE_FILE_ENV.
321
	* init/state.c:
322
	  - state_read_objects(): Write state file if 'write-state-file'
323
	    specified or STATE_FILE_ENV set.
324
	  - event_deserialise():
325
	    - Preserve the pre-reexec blockers count until JobClasses
326
	      are deserialised and reverse-dependencies resolved.
327
	    - Fix incorrect calls for failed and blockers Event attributes.
328
	* init/state.h: Comments.
329
	* init/tests/test_state.c:
330
	  - test_job_class_serialise(): Ensure that all JobClasses get
331
	    serialised, regardless of whether they have any associated
332
	    Jobs.
333
	  - test_event_serialise(): New "with failed" test.
334
	* init/event.c: event_deserialise(): Don't deserialise Event->blockers -
335
	  there is no point until we serialise EventOperators.
336
337
2013-04-29  James Hunt  <james.hunt@ubuntu.com>
338
339
	* init/conf.c:
340
	  - conf_reload(): Explanation of how reload works.
341
	  - conf_reload_path(): Defer destruction of original ConfFile until
342
	    newly-loaded .conf file has a chance to reference any events its
343
	    'start on' condition requires (LP: 1124384).
344
	  - debug_show_jobs(): Return if no instances.
345
	  - debug_show_events(): New function.
346
	* init/event.c: Comments.
347
	* init/job.c: Comment.
348
	* init/job_class.c:
349
	  - job_class_get_registered(): New function resulting from refactor of
350
	    job_class_consider() and job_class_reconsider().
351
	  - job_class_consider():
352
	    - Use job_class_get_registered().
353
	    - Call job_class_event_block() to avoid premature event destruction.
354
	  - job_class_reconsider(): Use job_class_get_registered().
355
	  - job_class_event_block(): New function to increase reference count
356
	    for events new JobClass specifies in its 'start on' condition that
357
	    old JobClass has also referenced (second part of LP: #1124384).
358
	* init/tests/test_conf.c:
359
	  - test_source_reload(): New tests:
360
	    - "ensure reload does not destroy a blocked event used by another job"
361
	    - "ensure .conf reload causes waiting job to run when 'start on' matches"
362
	* init/tests/test_conf.h: TEST_ENSURE_CLEAN_ENV(): Check
363
	  nih_child_watches too.
364
1438 by James Hunt
Cherry-pick man page related fixes from upstream.
365
2013-03-25  James Hunt  <james.hunt@ubuntu.com>
366
367
	* extra/man/socket-event.7: Correct section number.
368
	* init/man/init.5: Correct section number.
369
370
2013-03-22  James Hunt  <james.hunt@ubuntu.com>
371
372
	* scripts/Makefile.am: Added missing entry for
373
	  man/upstart-monitor.8.
374
1436.1.2 by Steve Langasek
Import upstream version 1.8
375
2013-03-22  James Hunt  <james.hunt@ubuntu.com>
376
377
	* NEWS: Release 1.8
378
379
2013-03-22  James Hunt  <james.hunt@ubuntu.com>
380
381
	* scripts/initctl2dot.py:
382
	  - footer(): Add details of session.
383
	  - sanitise(): Handle jobs in sub-directories.
384
	  - main(): Add --user and --system options and determine
385
	    correct session to connect to.
386
	* scripts/man/initctl2dot.8:
387
	  - Added --user and --system options.
388
	  - Escape dashes in options.
389
	  - Update date.
390
391
2013-03-21  James Hunt  <james.hunt@ubuntu.com>
392
393
	* po/POTFILES.in:
394
	  - Added missing entries for init/quiesce.c and init/state.c.
395
	  - Added upstart-monitor.py.
396
	* scripts/upstart-monitor.py: UpstartEventsGui(): Removed class
397
	  attributes and added explicit instance ones in __init__().
398
399
2013-03-18  James Hunt  <james.hunt@ubuntu.com>
400
401
	* configure.ac: Added scripts/data/Makefile.
402
	* scripts/Makefile.am: Added SUBDIRS=data.
403
	* scripts/data/Makefile.am: New Makefile.
404
	* scripts/data/upstart-monitor.desktop: Desktop file for
405
	  upstart-monitor.
406
407
2013-03-15  James Hunt  <james.hunt@ubuntu.com>
408
409
	* extra/upstart-file-bridge.c:
410
	  - main(): String safety for home_dir.
411
	  - job_add_file():
412
	    - Initialise events.
413
	    - Use nih_strdup() rather than arrays for paths.
414
	    - Removed unecessary error label.
415
	  - {create_handler,modify_handler,delete_handler}(): Remove strcpy().
416
	  - watched_dir_new(): Use nih_strdup() rather than arrays for path.
417
	  - find_first_parent(): Replace strcpy with strncpy().
418
419
2013-03-15  James Hunt  <james.hunt@ubuntu.com>
420
421
	* extra/man/file-event.7: Simplify language.
422
	* extra/upstart-file-bridge.c:
423
	  - skip_slashes(): New macro to make path matching more reliable.
424
	  - file_filter(): Call skip_slashes().
425
	  - create_handler(): Call skip_slashes().
426
	  - modify_handler(): Call skip_slashes().
427
	  - delete_handler(): Call skip_slashes().
428
	  - watched_dir_new(): Special case watching the root directory.
429
	* extra/conf/upstart-file-bridge.conf: Change start on condition
430
	  to ensure all filesystems are mounted before it starts.
431
432
2013-03-13  James Hunt  <james.hunt@ubuntu.com>
433
434
	* scripts/man/upstart-monitor.8: New manpage.
435
	* scripts/upstart-monitor.py: New cli+gui tool to monitor
436
	  Upstart events.
437
	* scripts/Makefile.am: Updated for upstart-monitor.
438
439
2013-03-11  James Hunt  <james.hunt@ubuntu.com>
440
441
	* extra/Makefile.am: Add file bridge and conf file.
442
	* extra/upstart-file-bridge.c: Inotify file bridge.
443
	* extra/conf/upstart-file-bridge.conf: Conf file for
444
	  file bridge.
445
	* extra/man/file-event.7: New man page.
446
	* extra/man/upstart-file-bridge.8: New man page.
447
1182.56.50 by James Hunt
* init/session.c: session_from_dbus(): Fixed off-by-one
448
2013-03-04  James Hunt  <james.hunt@ubuntu.com>
449
1182.56.52 by James Hunt
* ChangeLog: Collapse multiple entries for today into one.
450
	* init/session.c: session_from_dbus(): Fixed off-by-one
451
	  readlink error.
1182.93.1 by James Hunt
* configure.ac: Only add sbin to path if exec_prefix specified
452
	* configure.ac: Only add sbin to path if exec_prefix specified
453
	  (LP: #1122510).
1182.56.54 by James Hunt
* ChangeLog: Release entry.
454
	* NEWS: Release 1.7
455
	* configure.ac (NIH_COPYRIGHT): Update
1182.93.1 by James Hunt
* configure.ac: Only add sbin to path if exec_prefix specified
456
1182.56.46 by James Hunt
* Removal of gcc 'malloc' function attribute resulting from
457
2013-02-27  James Hunt  <james.hunt@ubuntu.com>
458
459
	* Removal of gcc 'malloc' function attribute resulting from
460
	  a clarification in its description which makes its use invalid.
461
	  (LP: #1123588).
462
1182.56.44 by James Hunt
* util/tests/test_initctl.c: test_upstart_open(): Unset UPSTART_SESSION
463
2013-02-26  James Hunt  <james.hunt@ubuntu.com>
464
465
	* util/tests/test_initctl.c: test_upstart_open(): Unset
466
	  UPSTART_SESSION to avoid session-init environment affecting
467
	  test run.
468
1182.86.4 by James Hunt
* util/tests/test_initctl.c:
469
2013-02-15  James Hunt  <james.hunt@ubuntu.com>
470
471
	* util/tests/test_initctl.c:
472
	  - timed_waitpid(): Back off if no status change.
473
	  - test_quiesce():
474
	    - Set XDG_RUNTIME_DIR to a temporary value.
475
	    - Remove stale session files.
476
	  - test_job_env(): Remove stale session files.
477
1182.56.41 by James Hunt
* Merge of lp:~jamesodhunt/upstart/set-env--global-apply-to-running-jobs
478
2013-02-15  James Hunt  <james.hunt@ubuntu.com>
479
1182.87.1 by James Hunt
* init/event_operator.c: Typo.
480
	* init/event_operator.c: Typo.
481
	* init/job_class.c:
482
	  - job_class_environment_reset(): Comments.
483
	  - job_class_environment_set(): Apply to all running job objects too.
484
	  - job_class_environment_unset(): Apply to all running job objects too.
485
	* util/man/initctl.8: Updated on environment command semantics.
486
	* util/tests/test_initctl.c: test_global_and_local_job_env(): Modified
487
	  test for new semantics.
1182.56.42 by James Hunt
* Merge of lp:~jamesodhunt/upstart/upstart-no-inherit-env.
488
2013-02-15  James Hunt  <james.hunt@ubuntu.com>
489
1182.88.1 by James Hunt
* init/job_process.c: job_process_run(): Invert meaning.
490
	* init/job_process.c: job_process_run(): Invert meaning.
491
	* init/main.c: Change '--inherit-env' to '--no-inherit-env'
492
	  such that inheriting inits environment is now the default
493
	  for Session Inits.
494
	* init/man/init.8: Update for '--no-inherit-env'.
1182.87.1 by James Hunt
* init/event_operator.c: Typo.
495
1182.86.2 by James Hunt
* init/Makefile.am: Added quiesce.o, now required by control.o.
496
2013-02-14  James Hunt  <james.hunt@ubuntu.com>
497
1182.86.3 by James Hunt
* util/tests/test_initctl.c:
498
	* util/tests/test_initctl.c:
499
	  - wait_for_upstart(): Functional replacement of WAIT_FOR_UPSTART()
500
	    macro. Now accepts @user.
501
	  - set_upstart_session(): Poll to ensure we give Upstart time to
502
	    initialise and write the session file.
503
	  - _start_upstart(): Extra @user parameter.
504
505
2013-02-14  James Hunt  <james.hunt@ubuntu.com>
506
1182.86.2 by James Hunt
* init/Makefile.am: Added quiesce.o, now required by control.o.
507
	* init/Makefile.am: Added quiesce.o, now required by control.o.
508
	* init/main.c: main():
509
	  - SIGHUP+SIGUSR1 handling now applies however you run init (since
510
	    it should react to these signals when run as a Session Init).
511
	  - Qualified sessions message to avoid confusion.
512
	* util/initctl.c: upstart_open(): Better handling for user_mode.
513
	* util/tests/test_initctl.c:
514
	  - WAIT_FOR_UPSTART(): Made session-aware.
515
	  - KILL_UPSTART(): Reset user mode flag (taken from STOP_UPSTART()).
516
	  - set_upstart_session(): New function.
517
	  - self_pipe_write(): New Function.
518
	  - self_pipe_setup(): New Function.
519
	  - timed_waitpid(): New function.
520
	  - _start_upstart():
521
	     - Signal handling and extra checks.
522
	     - Discard init output (unless UPSTART_TEST_VERBOSE set)
523
	       for saner logs.
524
	  - test_list_sessions():
525
	    - Removed need for a dbus-daemon.
526
	    - Added required initctl reset.
527
	  - test_quiesce(): Tests for Session Init shutdown (both
528
	    system-initiated and end-session request).
529
	  - test_usage(): Added extra checks and tidyup.
530
	  - main(): Added call to test_quiesce().
531
1182.92.1 by James Hunt
* init/log.c: log_serialise(): Handle re-exec scenario where
532
2013-02-11  James Hunt  <james.hunt@ubuntu.com>
533
534
	* init/log.c: log_serialise(): Handle re-exec scenario where
535
	  jobs producing output have finished but where log data cannot
536
	  be persisted (for example where disk is full or log directory
537
	  is inaccessible). (LP: #1120660)
538
1182.86.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml: Added 'EndSession' method.
539
2013-02-08  James Hunt  <james.hunt@ubuntu.com>
540
541
	* dbus/com.ubuntu.Upstart.xml: Added 'EndSession' method.
542
	* init/Makefile.am: Updated for quiesce.[ch].
543
	* init/conf.c: conf_destroy(): Cleanup function.
544
	* init/conf.h: Prototype.
545
	* init/control.c: control_end_session(): 'EndSession' implemenation.
546
	* init/control.h: Include.
547
	* init/events.h: Added SESSION_END_EVENT.
548
	* init/job_class.c: job_class_max_kill_timeout(): New function.
549
	* init/job_class.h: Prototype.
550
	* init/job_process.c:
551
	  - Added disable_respawn to disallow respawns.
552
	  - job_process_jobs_running(): New function.
553
	  - job_process_stop_all(): New function.
554
	  - job_process_terminated(): Honours disable_respawn.
555
	* init/job_process.h: Prototypes.
556
	* init/main.c:
557
	  - Typos.
558
	  - term_handler(): Quiesce rather than re-exec on receipt of SIGTERM
559
	    when running as a Session Init.
560
	  - main(): Make quiesce() handle cleanup.
561
	* init/man/init.8: Update for Session Init SIGTERM handling.
562
	* init/man/startup.7: Update for Session Init.
563
	* init/session.c: session_destroy(): New function.
564
	* init/session.h: Prototype.
565
	* init/man/session-end.7: New man page.
566
	* init/quiesce.[ch]: New files.
567
1182.83.1 by James Hunt
* init/job_process.c: job_process_run(): Copy parent environment if
568
2013-02-08  James Hunt  <james.hunt@ubuntu.com>
569
570
	* init/job_process.c: job_process_run(): Copy parent environment if
571
	  inherit_env in operation for a Session Init.
572
	* init/main.c: Added 'inherit-env' command-line option.
573
	* init/man/init.8: Documented --inherit-env.
574
1182.82.1 by James Hunt
* util/initctl.c: Remove ability to specify explicitly job and/or job
575
2013-02-02  James Hunt  <james.hunt@ubuntu.com>
576
577
	* util/initctl.c: Remove ability to specify explicitly job and/or job
578
	  instance values to the job environment commands.
579
	* util/man/initctl.8: Remove job and job instance value command-line
580
	  options.
581
	* util/tests/test_initctl.c: test_global_and_local_job_env(): Remove
582
	  tests for --job/--instance.
583
1182.56.33 by James Hunt
* init/control.c:
584
2013-01-31  James Hunt  <james.hunt@ubuntu.com>
585
586
	* init/control.c:
587
	  - Use control_check_permission() rather than
588
	    control_get_origin_uid() directly.
589
	* init/control.h: Prototypes.
590
	* init/job_class.c: Change calls to job_class_environment_init()
591
	  to asserts as the former only needs to be called once.
592
	* init/main.c: main(): Make job_class_environment_init() call as
593
	  early as possible.
594
	* init/tests/test_event.c: main(): Call
595
	  job_class_environment_init().
596
	* util/tests/test_initctl.c:
597
	  - test_default_job_env():
598
	    - Set TERM and PATH if not set.
599
	    - Check line counts before checking expected output.
600
	  - test_clear_job_env():
601
	    - Make use of TEST_INITCTL_DEFAULT_PATH.
602
1182.58.26 by James Hunt
* init/control.c:
603
2013-01-30  James Hunt  <james.hunt@ubuntu.com>
604
1182.75.8 by James Hunt
* TESTING.sessions: Removed as basic sessions have now gone.
605
	* TESTING.sessions: Removed as basic sessions have now gone.
606
607
2013-01-30  James Hunt  <james.hunt@ubuntu.com>
608
1182.58.26 by James Hunt
* init/control.c:
609
	* init/control.c:
610
	  - Typos.
611
	  - Improved uid checks.
612
	  - Replaced direct call to control_get_origin_uid() with call to new
613
	    control_check_permission() (as early as possible) for clarity and
614
	    to confine policy to one location. 
615
	  - control_set_log_prioity(): Added missing call to
616
	    control_check_permission().
617
	  - control_get_origin_uid(): Check message contents before allowing
618
	    D-Bus calls.
619
1182.58.25 by James Hunt
* init/control.c: More careful uid checking.
620
2013-01-29  James Hunt  <james.hunt@ubuntu.com>
621
622
	* init/control.c: More careful uid checking.
623
1182.80.4 by James Hunt
* init/xdg.c:
624
2013-01-28  James Hunt  <james.hunt@ubuntu.com>
625
626
	* init/xdg.c:
627
	  - get_subdir(): Remove double-check on @dir.
628
	  - xdg_get_runtime_dir():
629
	    - Don't attempt to create as unlikely to be able to if it
630
	      doesn't already exist.
631
	    - Simplify logic.
632
1182.81.3 by James Hunt
* util/initctl.c: list_session_action():
633
2013-01-28  James Hunt  <james.hunt@ubuntu.com>
634
635
	* util/initctl.c: list_session_action():
636
	  - Test for stale session earlier.
637
	  - Simplify checks on "UPSTART_SESSION".
638
	* util/tests/test_initctl.c: test_list_sessions():
639
	  - Added test with XDG_RUNTIME_DIR explicitly unset.
640
	  - Changed "with no instances" test to set XDG_RUNTIME_DIR to a
641
	    temporary value.
642
	  - Revert XDG_RUNTIME_DIR on cleanup.
643
1182.56.29 by James Hunt
* init/control.c:
644
2013-01-28  James Hunt  <james.hunt@ubuntu.com>
645
646
	* init/control.c:
647
	  - control_get_env(): Allow PID 1 environment to be queried for
648
	    consistency with control_list_env().
649
	* init/man/initctl.8:
650
	  - Added --job, --instance, --global options for list-env, set-env,
651
	    get-env, unset-env, reset-env.
652
	  - Explain PID 1 limitation for set-env, unset-env, reset-env.
1182.56.30 by James Hunt
* util/initctl.c:
653
	* util/initctl.c:
654
	  - get_job_details(): Fix order in which arguments are
655
	    checked.
1182.56.31 by James Hunt
* util/Makefile.am: Define INITCTL_BINARY and UPSTART_BINARY to ensure
656
	* util/Makefile.am: Define INITCTL_BINARY and UPSTART_BINARY to ensure
657
	  full path available to tests.
658
	* util/tests/test_initctl.c:
659
	  - New macros:
660
	    - _TEST_STR_ARRAY_CONTAINS()
661
	    - TEST_STR_ARRAY_CONTAINS()
662
	    - TEST_STR_ARRAY_NOT_CONTAINS()
663
	    - _TEST_FILE_CONTAINS()
664
	    - TEST_FILE_CONTAINS()
665
	    - TEST_FILE_NOT_CONTAINS()
666
	  - get_initctl(): Function to replace original INITCTL_BINARY define.
667
	  - test_global_and_local_job_env(): New function to test initctl
668
	    '--global', '--job' and '--instance' options from within and without
669
	    a job.
1182.56.29 by James Hunt
* init/control.c:
670
1182.58.22 by James Hunt
* init/control.c:
671
2013-01-25  James Hunt  <james.hunt@ubuntu.com>
672
1182.81.2 by James Hunt
* init/control.c: control_session_file_create(): Simplified.
673
	* init/control.c: control_session_file_create(): Simplified.
674
	* init/xdg.c: Added check for INITCTL_BUILD to hide certain symbols when
675
	  building with initctl.
676
	* util/Makefile.am:
677
	  - Define INITCTL_BUILD.
678
	  - Make use of xdg.[ch] in build of initctl and its test.
679
	* util/initctl.c:
680
	  - list_session_action(): Implementation of 'list-sessions' command.
681
	* util/man/initctl.8: Updated for 'list-sessions' command.
682
	* util/tests/test_initctl.c:
683
	  - _start_upstart(): Replacement for _START_UPSTART() macro.
684
	  - start_upstart_common(): Start an instance with common options.
685
	  - start_upstart(): Simplest way to start an instance.
686
	  - START_UPSTART(): Now calls start_upstart_common().
687
	  - test_list_sessions(): Test 'list-sessions' command.
688
689
2013-01-25  James Hunt  <james.hunt@ubuntu.com>
690
1182.56.28 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
691
	* dbus/com.ubuntu.Upstart.xml:
692
	  - Added 'job_details' string array as first parameter for GetEnv,
693
	    SetEnv, UnsetEnv, ListEnv and ResetEnv to allow methods to either
694
	    act globally or on a specific job environment.
695
	* init/control.c:
696
	  - control_set_env():
697
	  - control_unset_env():
698
	  - control_get_env():
699
	  - control_list_env():
700
	  - control_reset_env():
701
	    - Disallow setting for PID 1.
702
	    - Operate globally or on specified job.
703
	* init/control.h: control_get_job(): Macro to simplify extracting job
704
	  from provided job details.
705
	* init/job.c: job_find(): New function.
706
	* init/job_class.c:
707
	  - job_class_environment_set(): Delimiter handling now moved to
708
	    control_set_env() so it can be shared by job and global logic.
709
	  - job_class_find(): New function.
710
	* init/state.c:
711
	  - Removed state_get_job() and replaced calls with job_find().
712
	* util/initctl.c:
713
	  - Updated *_action() functions for new D-Bus parameters and made use
714
	    of new function get_job_details().
715
716
2013-01-25  James Hunt  <james.hunt@ubuntu.com>
717
1182.80.2 by James Hunt
* init/tests/test_xdg.c: Added test_get_session_dir().
718
	* init/tests/test_xdg.c: Added test_get_session_dir().
719
	* init/xdg.c: get_home_subdir(): Handle unset 'HOME' immediately.
1182.80.3 by James Hunt
* init/control.c: Make use of SESSION_EXT.
720
	* init/control.c: Make use of SESSION_EXT.
721
	* init/man/init.5: Added session files.
722
	* init/paths.h:
723
	  - Comments.
724
	  - Added SESSION_EXT.
1182.80.2 by James Hunt
* init/tests/test_xdg.c: Added test_get_session_dir().
725
1182.58.22 by James Hunt
* init/control.c:
726
2013-01-25  James Hunt  <james.hunt@ubuntu.com>
727
728
	* init/control.c:
729
	  - control_reload_configuration(): Added missing permission checks.
730
	  - control_emit_event_with_file(): Added missing permission checks.
731
	  - Added calls to new function control_get_origin_uid() to allow
732
	    D-Bus methods to be policed by filtering on uid, rather than
733
	    relying on the same information that used to be stored in the
734
	    old Session object.
735
	* init/job.c: Typo.
736
	* init/job_class.c:
737
	  - job_class_new(): Removed user elements from session code.
738
	  - job_class_serialise(): Comments.
739
	  - job_class_deserialise(): Comments.
740
	* init/job_process.c: job_process_spawn(): Removed user session
741
	  handling.
742
	* init/session.c: Removed user session handling since it is
743
	  about to be replaced by the ability to run Upstart as a
744
	  non-privileged user (aka a 'Session Init').
745
	* init/session.h: Updated prototypes.
746
	* init/state.h: Comments.
747
	* init/tests/test_conf.c: test_source_reload_job_dir(): Added missing
748
	  check.
749
	* init/tests/test_state.c:
750
	  - session_diff(): Removed user check.
751
	  - Updated all calls to session_new().
752
	* util/tests/test_initctl.c: test_notify_disk_writeable(): Ensure this
753
	  test is not run as root.
1182.58.24 by James Hunt
* util/tests/test_user_sessions.sh: Removed.
754
	* util/tests/test_user_sessions.sh: Removed.
755
	* init/man/init.5: Updated to reflect removal of user jobs.
1182.58.22 by James Hunt
* init/control.c:
756
1182.80.1 by James Hunt
* init/control.c:
757
2013-01-24  James Hunt  <james.hunt@ubuntu.com>
758
759
	* init/control.c:
760
	  - control_init(): Create session file in user mode.
761
	  - control_cleanup(): New function for cleanup activities.
762
	  - control_session_file_create(): Create session file containing
763
	    UPSTART_SESSION details.
764
	  - control_session_file_remove(): Delete the session file.
765
	* init/main.c: Call control_cleanup() to remove session file.
766
	* init/paths.h: Added INIT_XDG_SESSION_SUBDIR and SESSION_ENV.
767
	* init/xdg.c:
768
	  - get_subdir(): Refactor of get_home_subdir().
769
	  - get_home_subdir(): Now calls get_subdir().
770
	  - Replaced mkdir mode values with INIT_XDG_PATH_MODE.
771
	  - xdg_get_runtime_dir(): Obtain XDG_RUNTIME_DIR value.
772
	  - get_session_dir(): Obtain path to session directory.
773
	* init/xdg.h: Added INIT_XDG_PATH_MODE.
774
1182.76.7 by Dmitrijs Ledkovs
merge trunk
775
2013-01-21  Dmitrijs Ledkovs  <xnox@ubuntu.com>
1182.76.1 by Dmitrijs Ledkovs
* init/xdg.[ch]: add xdg_get_cache_home and get_user_log_dir
776
777
	* init/xdg.[ch]: add xdg_get_cache_home and get_user_log_dir
778
	  functions. These retrieve XDG_CACHE_HOME and a subdir inside it
779
	  for upstart.
780
	* init/tests/test_xdg.c: reuse test_get_config_home to test both
781
	  xdg_get_cache_home and xdg_get_config_home. Add test for
782
	  get_user_log_dir.
783
	* init/main.c: use get_user_log_dir to setup logging
784
	  directory in user_mode. For now, command line argument is
785
	  honoured, while the environment override is not.
786
1182.58.21 by James Hunt
* init/log.c:log_clear_unflushed(): Simplify asserts.
787
2013-01-21  James Hunt  <james.hunt@ubuntu.com>
788
789
	* init/log.c:log_clear_unflushed(): Simplify asserts.
790
1182.58.20 by James Hunt
* init/log.c:
791
2013-01-15  James Hunt  <james.hunt@ubuntu.com>
792
793
	* init/log.c:
794
	  - log_clear_unflushed(): Correct remote_closed assertion to handle
795
	    early-job-logging scenario where a job satisfies both of the
796
	    following conditions:
797
	    - ends before the log directory becomes writeable.
798
	    - has spawned one or more processes that continue to run after the
799
	      job itself has exited and which produce output before the log
800
	      directory becomes writeable.
801
	    (LP: #1096531).
802
1182.56.26 by James Hunt
* util/initctl.c:
803
2013-01-14  James Hunt  <james.hunt@ubuntu.com>
804
805
	* util/initctl.c:
806
	  - Grouped all environment commands in usage output.
807
	  - Added --global, --job and --instance options for all environment
808
	    commands. These are currently dummies, but --global will soon be
809
	    required to make changes to the global job environment table when
810
	    initctl is invoked from within a job.
811
1182.56.25 by James Hunt
* util/tests/test_initctl.c:
812
2013-01-11  James Hunt  <james.hunt@ubuntu.com>
813
814
	* util/tests/test_initctl.c:
815
	  - Lots of new job environment table tests.
816
1182.56.24 by James Hunt
* init/man/init.5: Define job environment table.
817
2013-01-10  James Hunt  <james.hunt@ubuntu.com>
818
819
	* init/man/init.5: Define job environment table.
820
	* init/tests/test_job_class.c(): test_environment(): Added call
821
	  to job_class_environment_init() which is now required to avoid
822
	  confusing TEST_ALLOC_FAIL().
823
	* util/man/initctl.8:
824
	  - Further details in list-env section.
825
	  - Escape dashes in command names.
826
	* util/tests/test_initctl.c:
827
	  - New utility macros: _WAIT_FOR_FILE(), WAIT_FOR_FILE()
828
	    and TEST_STR_MATCH().
829
	  - Initial tests for testing job environment table commands.
830
1182.56.23 by James Hunt
* init/job_class.c:
831
2013-01-09  James Hunt  <james.hunt@ubuntu.com>
1182.56.22 by James Hunt
* init/man/init.5:
832
1182.78.1 by James Hunt
* scripts/init-checkconf.sh:
833
	* scripts/init-checkconf.sh:
834
	  - Check copy is successful.
835
	  - Auto-start dbus-launch if not running and command is available (for
836
	    example in non-desktop environments) (LP: #881885).
837
	  - Auto-stop dbus-daemon if we started it.
1182.56.22 by James Hunt
* init/man/init.5:
838
	* init/man/init.5:
839
	  - Overhauled 'Job environment' section.
840
	* util/initctl.c:
841
	  - Added 'unset-env' and 'reset-env' commands.
842
	  - Added missing periods in usage text.
1182.56.23 by James Hunt
* init/job_class.c:
843
	  - list_env_qsort_compar(): Renamed from list_env_strcmp_compar(). Now
844
	    uses strcoll(3) for locale-awareness.
845
	* init/job_class.c:
846
	  - job_class_environment_set():
847
	    - Comments.
848
	    - Handle scenario where user specifies a variable without an equals.
849
	* util/man/initctl.8:
850
	  - Added details for 'get-env', 'set-env', 'unset-env', 'list-env' and
851
	    'reset-env'.
852
	  - Tidied up 'usage' stanza section.
1182.56.22 by James Hunt
* init/man/init.5:
853
1182.56.21 by James Hunt
Add missing entries.
854
2013-01-08  James Hunt  <james.hunt@ubuntu.com>
855
856
	* dbus/com.ubuntu.Upstart.xml:
857
	  - Added UnsetEnv and ResetEnv methods.
858
	* init/control.c:
859
	  - control_set_env(): Now uses job_class_environment_set() rather than
860
	    directly manipulating job_environ array.
861
	  - control_unset_env(): New function.
862
	  - control_get_env(): Now calls job_class_environment_get().
863
	  - control_list_env(): Now calls job_class_environment_get_all().
864
	    Comments.
865
	  - control_reset_env(): New function.
866
	* init/environ.c:
867
	  - environ_remove(): New function.
868
	* init/job_class.c:
869
	  - job_environ now static.
870
	  - job_class_environment_reset(): New function.
871
	  - job_class_environment_set(): New function.
872
	  - job_class_environment_unset(): New function.
873
	  - job_class_environment_get(): Simplified.
874
	  - job_class_environment_get_all(): New function.
875
	* util/initctl.c:
876
	  - Added following new commands:
877
	    - 'get-env'
878
	    - 'set-env'
879
	    - 'list-env'
880
1182.72.1 by Dmitrijs Ledkovs
Apply override files from same or higher priority configuration sources.
881
2013-01-04  Dmitrijs Ledkovs  <xnox@ubuntu.com>
882
883
	* init/conf.c: add ability to apply override files from higher
1182.72.2 by Dmitrijs Ledkovs
Review comments
884
	  priority configuration sources.
1182.72.1 by Dmitrijs Ledkovs
Apply override files from same or higher priority configuration sources.
885
	* init/tests/test_conf.c: test that multiple override files are
1182.72.2 by Dmitrijs Ledkovs
Review comments
886
	  correctly applied and removed.
1182.72.1 by Dmitrijs Ledkovs
Apply override files from same or higher priority configuration sources.
887
	* init/tests/test_conf_static.c: test override file detection.
888
1182.56.21 by James Hunt
Add missing entries.
889
2012-12-19  James Hunt  <james.hunt@ubuntu.com>
890
891
	* dbus/com.ubuntu.Upstart.xml: Added ListEnv method.
892
	* init/control.c:
893
	  - Fixed comments.
894
	  - control_list_end(): New function.
895
	* init/control.h:
896
	  - Added missing prototypes for control_set_env() and
897
	    control_get_env().
898
	  - Added control_list_env().
899
	* init/job_class.c:
900
	  - job_class_environment_get(): New function.
901
	* init/job_class.h: Added job_class_environment_get().
902
1182.58.5 by James Hunt
* init/man/init.5: Document that User Jobs are not supported
903
2012-12-17  James Hunt  <james.hunt@ubuntu.com>
904
905
	* init/man/init.5: Document that User Jobs are not supported
906
	  within a chroot environment.
1182.56.21 by James Hunt
Add missing entries.
907
	* dbus/com.ubuntu.Upstart.xml: Added "GetEnv" and "SetEnv" methods.
908
	* init/control.c:
909
	  - control_set_env(): Implementation of "SetEnv" D-Bus method.
910
	  - control_get_env(): Implementation of "GetEnv" D-Bus method.
911
	* init/job_class.c:
912
	  - Added job_environ environment table.
913
	  - job_class_environ_init(): Initialise job_environ.
914
	  - job_class_environment: Use job_environ.
915
	* init/main.c: main(): Call job_class_environ_init().
1182.58.5 by James Hunt
* init/man/init.5: Document that User Jobs are not supported
916
1182.63.4 by Steve Langasek
Sync up with trunk
917
2012-12-14  Steve Langasek  <steve.langasek@ubuntu.com>
1182.63.1 by Steve Langasek
instead of assuming a fixed value (0) as the default nice value for job
918
	* init/job_class.[ch]: instead of assuming a fixed value (0) as the
919
	  default nice value for job processes, use whatever the nice value
920
	  of the current process is.  This will be important later for user
921
	  sessions where an entire session may be started with a higher nice
922
	  value; and it fixes running the test suite as part of a nice'd
923
	  build.
1182.63.2 by Steve Langasek
update test suite to match handling of default priority.
924
	* init/tests/test_job_class.c: update test suite to match.
1182.14.127 by Steve Langasek
fix test which was accidentally relying on a variable persisting after
925
1182.56.12 by James Hunt
* init/Makefile.am: Add explicit -lrt for tests (LP: #1088863)
926
2012-12-11  James Hunt  <james.hunt@ubuntu.com>
927
928
	* init/Makefile.am: Add explicit -lrt for tests (LP: #1088863)
1182.56.13 by James Hunt
* dbus/com.ubuntu.Upstart.xml: Added "GetEnv" and "SetEnv" methods.
929
	* dbus/com.ubuntu.Upstart.xml: Added "GetEnv" and "SetEnv" methods.
930
	* init/control.c:
931
	  - control_set_env(): Implementation of "SetEnv" D-Bus method.
932
	  - control_get_env(): Implementation of "GetEnv" D-Bus method.
933
	* init/job_class.c:
934
	  - Added job_environ environment table.
935
	  - job_class_environ_init(): Initialise job_environ.
936
	  - job_class_environment: Use job_environ.
937
	* init/main.c: main(): Call job_class_environ_init().
1182.56.12 by James Hunt
* init/Makefile.am: Add explicit -lrt for tests (LP: #1088863)
938
1182.14.136 by James Hunt
* ChangeLog: Updated with missing entry.
939
2012-12-07  James Hunt  <james.hunt@ubuntu.com>
940
1182.14.139 by James Hunt
* NEWS: Release version 1.6.1
941
	* NEWS: Release 1.6.1
942
	* configure.ac: Change version to 1.6.1
943
944
2012-12-07  James Hunt  <james.hunt@ubuntu.com>
945
1182.14.136 by James Hunt
* ChangeLog: Updated with missing entry.
946
	* init/Makefile.am:
947
	  - TEST_DATA_DIR: use $srcdir, not $PWD.
948
	  - TEST_DATA_FILES: Corrected filename.
1182.52.7 by James Hunt
* ChangeLog: Added missing entry for bzr log.
949
	* dbus/com.ubuntu.Upstart.xml: Restart: Add annotation to make it
950
	  manifest this is an async call.
951
	* util/telinit.c: restart_upstart(): Use the async call to avoid the
952
	  client-side complaining if it detects that Upstart has severed all
953
	  D-Bus connections in preparation for the re-exec.
1182.14.136 by James Hunt
* ChangeLog: Updated with missing entry.
954
1182.56.5 by Steve Langasek
Merge fix for bug #1079715
955
2012-12-06  James Hunt  <james.hunt@ubuntu.com>
956
957
	* init/job_class.c:
958
	  - job_class_add_safe(): Don't assert on name collisions for jobs
1182.14.134 by Steve Langasek
Merge fix for bug #1083723
959
	    associated with a different session.  (LP: #1079715).
1182.56.5 by Steve Langasek
Merge fix for bug #1079715
960
	  - job_class_serialise(): Explicitly disallow user and chroot
961
	    sessions from being serialised since this scenario is not
962
	    supported (due to our not serialising ConfSource objects yet).
963
	  - job_class_deserialise(): Assert that we do not have user and
964
	    chroot sessions to deal with, and fix potential invalid free if
965
	    error occurs before JobClass is created.
966
	  - job_class_deserialise_all(): Explicitly ignore attempted
967
	    deserialisation of user and chroot sessions.
968
	* init/state.c:
969
	  - state_deserialise_resolve_deps(): Ignore classes associated with
970
	    a user or chroot session.  Specify new session parameter to
971
	    state_get_job().
972
	  - state_serialise_blocked(): Encode session index for BLOCKED_JOB.
973
	    Make function non-static for testing.
974
	  - state_deserialise_blocked(): Extract session from index index for
975
	    BLOCKED_JOB to pass to state_get_job().  Default session to NULL
976
	    to handle upstart 1.6 serialization.  Make function non-static
977
	    for testing.
978
	  - state_get_job(): Add @session parameter to allow exact job match.
979
	  - state_read_objects(): Attempt to write the state to file
980
	    STATE_FILE if deserialisation fails as an aid to diagnosing the
981
	    cause of the failure.
982
	* init/tests/test_state.c: test_blocking(): Additional tests to check
983
	  that it is possible to deserialise Upstart 1.6 JSON format (which
984
	  does not include the "session" JSON attribute for blocked objects.
985
	  Add infrastructure for testing deserialization of reference json
986
	  files from disk.
987
	  New tests:
988
	    - "BLOCKED_JOB serialisation and deserialisation".
989
	    - "BLOCKED_EVENT serialisation and deserialisation".
990
	    - "BLOCKED_JOB with JSON session object".
991
	    - "ensure BLOCKED_JOB with non-NULL session is ignored".
992
	* dbus/com.ubuntu.Upstart.xml: Added 'GetState' method that returns
993
	  internal state in JSON format.
994
	* init/Makefile.am:
995
	  - Added TEST_DATA_DIR to allow tests to find data files.
996
	  - Added test data files to distribution.
997
	* init/control.c: control_get_state(): Implementation for D-Bus
998
	  'GetState' method.
999
	* init/tests/data/upstart-1.6.json: Test data used by test_state.c
1000
	  for upgrade testing the upstart 1.6 serialization format.
1182.14.134 by Steve Langasek
Merge fix for bug #1083723
1001
	* dbus/com.ubuntu.Upstart.xml: New 'Restart' method.
1002
	* init/control.c: control_restart(): New function to request Upstart
1003
	  restart itself.
1004
	* util/telinit.c: use the new dbus interface for restarts;
1005
	  'telinit u' now fails with an error when PID 1 is not upstart,
1006
	  instead of sending it a signal with undefined behavior.
1007
	  (LP: #1083723)
1008
	* util/man/telinit.8: Update for 'telinit u' behaviour if PID 1 is
1009
	  not Upstart.
1182.56.5 by Steve Langasek
Merge fix for bug #1079715
1010
1182.14.131 by James Hunt
[ Colin King <colin.king@ubuntu.com> ]
1011
2012-11-23  James Hunt  <james.hunt@ubuntu.com>
1012
1013
	[ Colin King <colin.king@ubuntu.com> ]
1014
1015
	* init/log.c: log_serialise(): smatch-found issue where
1016
	  additional checks required for log->unflushed to avoid any
1017
	  possibility of NULL dereference.
1018
	* init/state.c: state_read_objects(): smatch-found issue
1019
	  to correct read size and ensure optimal throughput.
1020
1182.14.127 by Steve Langasek
fix test which was accidentally relying on a variable persisting after
1021
2012-11-18  Steve Langasek  <steve.langasek@ubuntu.com>
1022
1023
	* init/tests/test_job_process.c: fix test which was accidentally
1024
	  relying on a variable persisting after it's gone out of scope.
1182.14.128 by Steve Langasek
don't test the blocked/ignored signal list in a spawned job; this is not
1025
	* init/tests/test_job_process.c: don't test the blocked/ignored
1026
	  signal list in a spawned job; this is not testing the upstart code
1027
	  but the characteristics of the system, and the test is wrong
1028
	  because it assumes the signal lists in /proc/self/status fit in an
1029
	  unsigned long int - patently untrue on mips, where we have 128
1030
	  signals for historical reasons.
1182.14.127 by Steve Langasek
fix test which was accidentally relying on a variable persisting after
1031
1182.14.126 by Steve Langasek
init/Makefile.am: set TERM=xterm, so that tests which rely on TERM being
1032
2012-11-17  Steve Langasek  <steve.langasek@ubuntu.com>
1033
1034
	* init/Makefile.am: set TERM=xterm, so that tests which rely on
1035
	  TERM being set in the environment don't give different results and
1036
	  gratuitously fail.
1037
1182.14.124 by James Hunt
* NEWS: Release version 1.6.
1038
2012-11-15  James Hunt  <james.hunt@ubuntu.com>
1039
1040
	* NEWS: Release 1.6
1182.14.125 by James Hunt
* configure.ac: Bump version to 1.7
1041
	* configure.ac: Bump version to 1.7
1042
	* NEWS: Begin new release
1182.14.124 by James Hunt
* NEWS: Release version 1.6.
1043
1182.40.101 by James Hunt
* Changelog: Summary of stateful re-exec feature.
1044
2012-11-07  James Hunt  <james.hunt@ubuntu.com>
1045
1046
	* Added stateful re-exec support such that when Upstart is asked
1047
	  to restart itself using 'telinit u', the new instance of PID 1
1048
	  will retain knowledge of all system jobs and running instances.
1049
1182.40.63 by James Hunt
Merged lp:~jconti/upstart/fix_empty_chroot.
1050
2012-09-10  James Hunt  <james.hunt@ubuntu.com>
1051
1052
	* Merged lp:~jconti/upstart/fix_empty_chroot.
1053
1182.40.1 by James Hunt
* init/main.c: Add in "bare" re-exec handling from Ubuntu
1054
2012-05-23  James Hunt  <james.hunt@ubuntu.com>
1055
1056
	* init/main.c: Add in "bare" re-exec handling from Ubuntu
1057
	  branch.
1182.40.2 by James Hunt
* init/main.c: Unhide "restart" option.
1058
	* init/main.c: Unhide "restart" option.
1182.40.1 by James Hunt
* init/main.c: Add in "bare" re-exec handling from Ubuntu
1059
1182.14.121 by James Hunt
* init/parse_job.c: stanza_kill(): Actually save parsed value to avoid
1060
2012-10-22  James Hunt  <james.hunt@ubuntu.com>
1061
1062
	* init/parse_job.c: stanza_kill(): Actually save parsed
1063
	  value to avoid crash if kill signal given as a numeric
1064
	  (LP: #1049820).
1065
	* init/tests/test_parse_job.c: test_stanza_kill(): New test:
1066
	  "with signal and single numeric argument".
1182.14.122 by James Hunt
* init/parse_job.c: stanza_kill(): Actually save parsed
1067
	* init/Makefile.am: test_job_process must now be linked to the 'util'
1068
	  library for pty helper functionality.
1069
	* init/tests/test_job_process.c:
1070
	  - Compiler appeasement.
1071
	  - Conditionally run tests in a pty for build environments such as
1072
	    modern versions of sbuild(1) that do not provide a controlling
1073
	    terminal (sbuild) (LP: #888910).
1182.14.121 by James Hunt
* init/parse_job.c: stanza_kill(): Actually save parsed value to avoid
1074
1182.14.119 by A.Costa
fix a series of manpage typos.
1075
2012-08-31  Steve Langasek  <steve.langasek@ubuntu.com>
1076
1077
	[ A. Costa <agcosta@gis.net> ]
1078
	* init/man/init.5, util/man/runlevel.7, util/man/initctl.8: fix a
1079
	number of typos.
1080
1182.38.1 by James Hunt
* init/main.c: main(): Remove checks for /dev/kmsg, /dev/null,
1081
2012-08-07  James Hunt  <james.hunt@ubuntu.com>
1082
1083
	* init/main.c: main(): Remove checks for /dev/kmsg, /dev/null,
1084
	  /dev/console and /dev/tty since some environments use different
1085
	  major/minor numbers to the norm (for example on LXC, /dev/console is
1086
	  not (5,1), but (136,*)). Do not attempt to create /dev/console again,
1087
	  due to LXC numbering difference.
1088
1182.36.3 by James Hunt
* init/main.c:main(): Handle hostile initramfs-less environments by
1089
2012-08-03  James Hunt  <james.hunt@ubuntu.com>
1090
1091
	* init/main.c:main(): Handle hostile initramfs-less environments by
1092
	  calling umask and creating required device nodes as early as possible.
1093
	* init/system.c: New functions to simplify code:
1094
	  - system_mknod()
1095
	  - system_check_file()
1096
1182.14.113 by James Hunt
[ Eric S. Raymond <esr@thyrsus.com> ]
1097
2012-07-31  James Hunt  <james.hunt@ubuntu.com>
1098
1099
	[ Eric S. Raymond <esr@thyrsus.com> ]
1100
	* extra/man/socket-event.7: Fixed incorrect troff (LP: #1018925).
1101
1182.14.110 by James Hunt
* Changelog: Release entry.
1102
2012-03-22  James Hunt  <james.hunt@ubuntu.com>
1103
1182.14.111 by James Hunt
* NEWS: Begin new release.
1104
	* NEWS: Begin new release.
1105
	* configure.ac: Bump version to 1.6.
1106
1107
2012-03-22  James Hunt  <james.hunt@ubuntu.com>
1108
1182.14.110 by James Hunt
* Changelog: Release entry.
1109
	* Changelog: Release entry.
1110
	* configure.ac: Bump year.
1111
	* NEWS: Release 1.5.
1112
1182.14.105 by James Hunt
[ Steve Langasek <steve.langasek@ubuntu.com> ]
1113
2012-03-16  James Hunt  <james.hunt@ubuntu.com>
1114
1182.14.106 by James Hunt
* init/tests/test_job_process:
1115
	* init/tests/test_job_process:
1116
	  - Fixed multiple TEST_FAILED() typos
1117
	    ("unexpected" => unexpectedly").
1182.14.107 by James Hunt
* job_process_spawn(): Only display single message
1118
	* job_process_spawn(): Only display single message
1119
	  if pty setup fails. 
1120
	* init/man/init.5: Typo.
1121
	* init/tests/test_job_process:
1122
	  - child(): New TEST_OUTPUT_WITH_STOP test.
1123
	  - test_run(): New test "with multiple processes and log".
1124
	  - test_spawn():
1125
	    - umask reset.
1126
	    - New test "ensure multi processes output logged".
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1127
	* dbus/com.ubuntu.Upstart.xml:
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1128
	  - added 'NotifyDiskWriteable' method.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1129
	* init/control.c:
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1130
	  - control_notify_disk_writeable(): New function to flush early job log.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1131
	* init/job_process.c:
1132
	  - job_process_terminated(): Call log_handle_unflushed() to potentially
1133
	    add log object to unflushed list (the early job log) in certain
1134
	    scenarios.
1135
	* init/log.c:
1136
	  - log_flushed: bool indicating successful flush of early job log.
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1137
	  - log_unflushed_files: The "early job log" list.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1138
	  - log_new(): Call log_unflushed_init() and initialize new log members.
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1139
	  - log_flush(): Only call log_read_watch() conditionally now.
1140
	  - log_io_reader(): More careful consideration of errno by
1141
	    using saved value from log member.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1142
	  - log_io_error_handler(): Set remote_closed for the benefit of
1143
	    log_flushed() (to avoid flushing multiple times).
1144
	  - log_file_open: Now saves errno value from open(2).
1145
	  - log_read_watch(): Removed log->unflushed->len assert since it was
1146
	    erroneous: even if unflushed data exists, it will be written in
1147
	    order when log_io_reader() calls log_file_write().
1148
	  - log_unflushed_init(): New function to initialise the
1149
	    log_unflushed_files list.
1150
	  - log_handle_unflushed(): New function that potentially adds log
1151
	    object to the log_unflushed_files list to allow the data to be
1152
	    flushed _after_ the parent object has been destroyed.
1153
	  - log_clear_unflushed(): New function to clear the
1154
	    log_unflushed_files list by attempting to flush the data to disk.
1182.14.109 by James Hunt
* log.c: log_read_watch(): Set remote_closed for scenarios where
1155
	  - log_read_watch(): Set remote_closed for scenarios where
1156
	    error handler never called. (LP: #935585)
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1157
	* init/log.h:
1158
	  - Added new Log members: detached, remote_closed and open_errno.
1159
	  - Updated documentation.
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1160
	  - extern for log_unflushed_files.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1161
	  - Added prototypes for new functions: log_handle_unflushed(),
1162
	    log_clear_unflushed() and log_unflushed_init().
1163
	* init/tests/test_job_process.c:
1164
	  - test_run():
1165
	    - Call log_unflushed_init().
1166
	    - Corrected grammar in error messages for "ensure sane fds" tests.
1167
	    - "with single line command writing fast and exiting": Call
1168
	      nih_child_add_watch().
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1169
	    - added waitid() calls to ensure log data not added to
1170
	      unflushed list.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1171
	  - test_spawn():
1172
	    - Call log_unflushed_init().
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1173
	    - Corrected grammar in error messages for "ensure sane fds" tests.
1174
	    - Added TEST_ALLOC_SAFE() to "simple test" to ensure
1175
	      destructors run correctly.
1176
	    - "read single null byte with 'console log'": Call
1177
	      log_handle_unflushed() and added missing free.
1178
	    - "read data from forked process": Call
1179
	      log_handle_unflushed().
1180
	* init/tests/test_log.c: 
1181
	  - Updated documentation.
1182
	  - Added calls to log_unflushed_init().
1183
	  - "ensure logger flushes cached data on request": New test
1184
	    for log_handle_unflushed().
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1185
	* util/initctl.c:
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1186
	  - notify_disk_writeable_action(): New function to notify
1187
	    Upstart that the disk is writeable.
1188
	  - commands: Added new command "notify-disk-writeable".
1189
	* util/man/initctl.8: Updated for new notify-disk-writeable command.
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1190
	* util/tests/test_initctl.c:
1191
	  - STOP_UPSTART(): Check return from kill(2).
1192
	  - test_show_config(): Adding missing rmdir(2).
1193
	  - test_check_config(): Adding missing rmdir(2).
1182.14.108 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1194
	  - test_notify_disk_writeable(): New function embodying new test
1182.33.1 by James Hunt
* dbus/com.ubuntu.Upstart.xml:
1195
	    "with job ending before log disk writeable".
1196
1182.14.105 by James Hunt
[ Steve Langasek <steve.langasek@ubuntu.com> ]
1197
	[ Steve Langasek <steve.langasek@ubuntu.com> ]
1198
	* init/tests/test_job_process:
1199
	  - close_all_files(): New function to ensure test environment
1200
	    has only expected fds open.
1201
	  - main(): Call close_all_files().
1202
1182.14.104 by James Hunt
* init/job.c: job_new(): Initialize log array.
1203
2012-03-07  James Hunt  <james.hunt@ubuntu.com>
1204
1205
	* init/job.c: job_new(): Initialize log array.
1206
	* init/job.h: Change Log element to an array to handle scenario where
1207
	  job has multiple simultaneous processes running (LP: #940290).
1208
	* init/job_process.c:
1209
	  - job_process_run(): pass ProcessType to job_process_spawn().
1210
	  - job_process_spawn():
1211
	    - Now accepts a ProcessType.
1212
	    - Ensure existing matching process type log is destroyed before
1213
	      creating a new one.
1214
	  - job_process_terminated(): Update for log array.
1215
	* init/job_process.h: Updated prototype for job_process_spawn().
1216
	* init/tests/test_job.c: test_new(): Updated logic for log array.
1217
	* init/tests/test_job_process.c: test_run():
1218
	  - Updated logic for log array.
1219
	  - Added ProcessType to job_process_spawn() calls.
1220
1182.14.103 by James Hunt
* init/job_process.c: job_process_spawn(): If pty setup fails,
1221
2012-03-05  James Hunt  <james.hunt@ubuntu.com>
1222
1223
	* init/job_process.c: job_process_spawn(): If pty setup fails,
1224
	  log message and disable logging for job.
1225
	* init/man/init.5: Explain new behaviour should pty setup fail.
1226
	* init/tests/test_job_process.c: Updated disabled test
1227
	  "when no free ptys" for new behaviour.
1228
1182.14.101 by James Hunt
Added missing changelog entry.
1229
2012-03-01  James Hunt  <james.hunt@ubuntu.com>
1230
1231
	* init/job_class.c:
1232
	  - job_class_get_instance():
1233
	    - Use nih_local to avoid memory leak should nih_strcat_sprintf()
1234
	      fail.
1235
	    - Formatting.
1236
	  - job_class_start():
1237
	    - Use nih_local to avoid memory leak should nih_strcat_sprintf()
1238
	      fail.
1239
	    - Formatting.
1182.14.102 by James Hunt
init/man/init.5: Add further pty details.
1240
	* init/man/init.5: Add further pty details.
1182.14.101 by James Hunt
Added missing changelog entry.
1241
1182.14.98 by James Hunt
* init/log.c:
1242
2012-02-13  James Hunt  <james.hunt@ubuntu.com>
1243
1244
	* init/log.c:
1245
	  - log_flush(): Comments.
1246
	  - log_read_watch():
1247
	    - Improved comments.
1248
	    - Don't re-attempt read on EAGAIN/EWOULDBLOCK since those errors are
1249
	      nominally impossible due to the remote end of the pty already
1250
	      having ended (LP: #926468).
1251
	    - Added a debug-mode warning when 'badly-behaved' application
1252
	      detected that leaks fds to its children, as this is generally a bug.
1253
	* init/tests/test_job_process.c:
1254
	  - test_run():
1255
	    - "with single line command writing fast and exiting": added
1256
	      waitpid() to ensure no EAGAIN.
1257
	  - test_spawn():
1258
	    - "with no such file, no shell and console log": added
1259
	      waitpid() to ensure no EAGAIN.
1260
1182.14.97 by James Hunt
* init/job_process.c: job_process_spawn():
1261
2012-02-03  James Hunt  <james.hunt@ubuntu.com>
1262
1263
	* init/job_process.c: job_process_spawn():
1264
	  - Set close-on-exec for pty_master.
1265
	  - Ensure stdio buffers flushed prior to forking to ensure no data
1266
	    leakage to child (should init be run with '--debug', or the tests
1267
	    be run with redirected output, for example).
1268
	  - Free log object if child process fails to exec(3) rather than just
1269
	    closing fd. This ensures io watch is removed correctly. (LP: #922754)
1270
	  - Only need to remap pty_master if CONSOLE_LOG in operation.
1271
	* init/tests/test_job_process:
1272
	  - fd_valid(): New helper function to determine if specified fd is valid.
1273
	  - child(): Added new 'TEST_FDS' test to ensure no fd leakage to child
1274
	    processes.
1275
	  - test_run():
1276
	    - New tests:
1277
	      - "ensure sane fds with no console, no script"
1278
	      - "ensure sane fds with no console, and script"
1279
	      - "ensure sane fds with console log, no script"
1280
	      - "ensure sane fds with console log, and script"
1281
	      - "with single-line command running an invalid command, \
1282
	         then a 1-line post-stop script"
1283
	      - "with single-line command running an invalid command, \
1284
	         then a 2-line post-stop script"
1285
	      - "with single-line command running an invalid command, \
1286
	         then a post-stop command"
1287
	      - "with single-line command running an invalid command, \
1288
	         then an invalid post-stop command"
1289
	      - "with single-line command running a valid command, \
1290
	         then a 1-line invalid post-stop command"
1291
	    - Test "with single-line command running an invalid command":
1292
	      - now diverts stderr output for less chatty test-run experience.
1293
	      - Improved checking.
1294
	    - Test "with setuid me" now diverts stderr output for less chatty
1295
	      test-run experience.
1296
	  - test_spawn():
1297
	    - New tests:
1298
	      - "with no such file, no shell and console log"
1299
	      - "ensure sane fds with no console"
1300
	      - "ensure sane fds with console log"
1301
	* init/tests/test_log.c: test_log_destroy():
1302
	  - New test "ensure watch freed when log destroyed"
1303
1182.14.96 by James Hunt
* init/tests/test_job_process.c: test_run(): Fixed typo in
1304
2012-01-27  James Hunt  <james.hunt@ubuntu.com>
1305
1306
	* init/tests/test_job_process.c: test_run(): Fixed typo in
1307
	  test "with setuid me" where uid value was being set to gid.
1308
1182.14.95 by James Hunt
* init/job_process.c: job_process_terminated(): Free log to ensure data
1309
2012-01-25  James Hunt  <james.hunt@ubuntu.com>
1310
1311
	* init/job_process.c: job_process_terminated(): Free log to ensure data
1312
	  written as soon as _any_ process ends (consider respawn jobs).
1313
	* init/log.c:
1314
	  - log_destroy():
1315
	    - Improved documentation.
1316
	    - Now calls new function log_flush().
1317
	  - log_flush(): New function to ensure no lingering buffered job data
1318
	    remains. Now considers EBADF (LP: #912558).
1319
	  - log_io_reader():
1320
	    - Added missing assert for @len.
1321
	    - Simplified ENOSPC handling.
1322
	    - Ensure log->io set to NULL to allow other routines to detect it
1323
	      really has gone.
1324
	  - log_file_write(): Added @len checks.
1325
	  - log_read_watch(): New function to drain data from a watch descriptor
1326
	    (which also must consider EBADF).
1327
	* init/log.h: Added define for LOG_READ_SIZE.
1328
	* init/tests/test_job_process.c:
1329
	  - test_run():
1330
	    - Added some extra pointer checks.
1331
	    - Free class *before* checking file to ensure destructor invoked at
1332
	      correct point.
1333
	    - Added test "with single-line command running an invalid command"
1334
	      (for scenario bug 912558 exposed).
1335
	    - Added test "with single-line command writing fast and exiting".
1336
	* init/tests/test_log.c: Changed all tests to use openpty(3) rather than
1337
	  pipe(2) for semantic parity with actual code.
1338
	* util/tests/test_user_sessions.sh:
1339
	  - ensure_no_output(): Now calls check_job_output() and delete_job() to
1340
	    simplify logic.
1341
	  - delete_job(): Call get_job_file() rather than doing it long-hand.
1342
	  - check_job_output(): New function.
1343
	  - start_job(): Added allow_failure parameter.
1344
	  - test_ensure_no_unexpected_output(): New test
1345
	    "ensure command job does not create log file with invalid command".
1346
1182.14.94 by James Hunt
* init/man/init.5: Explain that all job processes affected
1347
2012-01-05  James Hunt  <james.hunt@ubuntu.com>
1348
1349
	* init/man/init.5: Explain that all job processes affected
1350
	  by 'setuid' and 'setgid' stanzas.
1351
1182.14.92 by James Hunt
init/job_process.c: job_process_spawn():
1352
2011-12-22  James Hunt  <james.hunt@ubuntu.com>
1353
1354
	* init/job_process.c: job_process_spawn():
1355
	  - Set child handler to default rather than explicit ignore
1356
	    to avoid test failures in environments that disallow
1357
	    ignoring SIGCHLD.
1182.14.93 by James Hunt
* init/tests/test_job_process.c: test_run():
1358
	* init/tests/test_job_process.c: test_run():
1359
	  - Changed timeout for test feature "ensure that no log
1360
	    file written for CONSOLE_NONE".
1182.14.92 by James Hunt
init/job_process.c: job_process_spawn():
1361
1182.14.80 by James Hunt
* init/tests/test_job_process.c: test_run():
1362
2011-12-15  James Hunt  <james.hunt@ubuntu.com>
1363
1182.14.82 by James Hunt
* Makefile.am: Add missing TESTING.sessions to distribution.
1364
	* Makefile.am: Add missing TESTING.sessions to distribution.
1182.14.83 by James Hunt
* contrib/vim/syntax/upstart.vim: Meta-data update and addition
1365
	* contrib/vim/syntax/upstart.vim: Meta-data update and addition
1366
	  of more standard (Ubuntu Upstart) events.
1182.14.84 by James Hunt
* extra/man/upstart-udev-bridge.8: Ensure literal dashes used
1367
	* extra/man/upstart-udev-bridge.8: Ensure literal dashes used
1368
	  for all command-line options.
1182.14.85 by James Hunt
* extra/upstart-udev-bridge.c:
1369
	* extra/upstart-udev-bridge.c:
1370
	  - udev_monitor_watcher(): Fix leak when obtaining udev value.
1371
	  - make_safe_string(): Don't realloc since overhead too high
1372
	  considering size of strings.
1182.14.86 by James Hunt
* init/job_class.c: Typo.
1373
	* init/job_class.c: Typo.
1182.14.87 by James Hunt
* init/job_process.c: job_process_spawn():
1374
	* init/job_process.c: job_process_spawn():
1375
	  - Correct ignoring of SIGCHLD prior to grantpt(3) call.
1376
	  - Removed redundant close(2) calls.
1377
	  - Move declarations to top of block for
1378
	    getpwnam(3)/getgrnam(3).
1182.14.88 by James Hunt
* init/log.c:
1379
	* init/log.c:
1380
	  - log_file_open(): Comments.
1381
	  - log_file_write(): Added missing cast on
1382
	    nih_io_buffer_shrink() call.
1182.14.89 by James Hunt
* init/main.c: console_type_setter(): NihOptionSetter's should
1383
	* init/main.c: console_type_setter(): NihOptionSetter's should
1384
	  return 0 on success.
1182.14.90 by James Hunt
* init/man/init.5: lower-case all references to system jobs
1385
	* init/man/init.5: lower-case all references to system jobs
1386
	  and user jobs.
1182.14.91 by James Hunt
* init/tests/test_job_process.c: Add missing include for
1387
	* init/tests/test_job_process.c: Add missing include for
1388
	  fnmatch.h.
1182.14.82 by James Hunt
* Makefile.am: Add missing TESTING.sessions to distribution.
1389
1390
2011-12-15  James Hunt  <james.hunt@ubuntu.com>
1391
1182.14.80 by James Hunt
* init/tests/test_job_process.c: test_run():
1392
	* init/tests/test_job_process.c: test_run():
1393
	  - Ensure process group killed for multi-process shell scripts.
1394
	  - Change 'command-not-found' tests to use regex matching rather
1395
	    than literal to allow for minor differences in /bin/sh variants
1396
	    error output.
1397
1182.14.78 by James Hunt
* NEWS: Release 1.4
1398
2011-12-13  James Hunt  <james.hunt@ubuntu.com>
1399
1182.14.79 by James Hunt
* configure.ac: Bump version to 1.5
1400
	* configure.ac: Bump version to 1.5
1401
	* NEWS: Begin new release
1402
1403
2011-12-13  James Hunt  <james.hunt@ubuntu.com>
1404
1182.14.78 by James Hunt
* NEWS: Release 1.4
1405
	* NEWS: Release 1.4
1406
	* configure.ac (NIH_COPYRIGHT): Update
1407
1182.31.1 by James Hunt
* extra/man/upstart-udev-bridge.8:
1408
2011-12-12  James Hunt  <james.hunt@ubuntu.com>
1409
1182.14.77 by James Hunt
Simplify logfile name encoding.
1410
	Simplify logfile name encoding.
1411
	
1412
	* init/job_process.c: job_process_log_path(): Ditch D-Bus job name
1413
	  encoding in path names for saner approach that simply remaps slash
1414
	  characters (minimal surprises for users).
1415
	* init/job_process.h: Addition of macros:
1416
	  - JOB_PROCESS_LOG_FILE_EXT
1417
	  - JOB_PROCESS_LOG_REMAP_FROM_CHAR
1418
	  - JOB_PROCESS_LOG_REMAP_TO_CHAR
1419
	* init/man/init.5: Update console section for simplified log filename
1420
	  encoding approach.
1421
	* init/test_job_process.c: test_log_path(): Updates for simplified
1422
	  logfile name encoding.
1423
	* util/tests/test_user_sessions.sh: Updates for simplified
1424
	  logfile name encoding: removed dbus_encode() and replaced with
1425
	  upstart_encode().
1426
1427
2011-12-12  James Hunt  <james.hunt@ubuntu.com>
1428
1182.31.1 by James Hunt
* extra/man/upstart-udev-bridge.8:
1429
	* extra/man/upstart-udev-bridge.8:
1430
	  - Added new '--no-strip' option.
1431
	  - Added missing '--daemon', '--debug' and '--help' options.
1432
	* extra/upstart-udev-bridge.c:
1433
	  XXX: Behavioural change: non-printable bytes are now removed
1434
	  by default from all udev message data to handle buggy
1435
	  hardware devices which expose this data to userland (the
1436
	  kernel simply passes it through verbatim). To revert to old
1437
	  behaviour (where no udev message data is modified), specify
1438
	  the new '--no-strip' option (LP: #829980).
1439
	  - make_safe_string(): New function to cleanse udev data.
1440
	  - udev_monitor_watcher():
1441
	    - Cleanse udev data unless '--no-strip' specified.
1442
	    - Fixed possible crash should 'action' not be set.
1443
	    - Fixed possible crash should 'devname' not be set
1444
	      and '--debug' specified.
1445
1182.14.71 by James Hunt
Introduction of 'log' argument to 'console' stanza allowing
1446
2011-12-09  James Hunt  <james.hunt@ubuntu.com>
1447
1182.14.72 by James Hunt
* Merge of 'setuid' + 'setgid' stanzas from
1448
	* Merge of 'setuid' + 'setgid' stanzas from
1449
	  Evan Broder (lp:~broder/upstart/drop-privileges).
1450
1451
2011-12-09  James Hunt  <james.hunt@ubuntu.com>
1452
1182.14.71 by James Hunt
Introduction of 'log' argument to 'console' stanza allowing
1453
	Introduction of 'log' argument to 'console' stanza allowing
1454
	system job output only to be captured.
1455
	
1456
	* contrib/vim/syntax/upstart.vim: Added 'log' and missing
1457
	  'none'.
1458
	* init/Makefile.am: Update for log.c, log.h and test_log.c.
1459
	* init/job.c: job_new(): Initialize log.
1460
	* init/job.h: Add Log pointer to Job.
1461
	* init/job_class.c:
1462
	  - XXX: behaviour change: Default for 'console'
1463
	    is now CONSOLE_LOG rather than CONSOLE_NONE.
1464
	    Rationale is that if a job does produce output, you want to see
1465
	    it since the chances are it will contain useful error details.
1466
	  - Added default_console variable.
1467
	  - job_class_console_type(): New function to parse console type
1468
	    string.
1469
	* init/job_class.h:
1470
	  - Added CONSOLE_LOG to ConsoleType and updated documentation
1471
	    for ConsoleType.
1472
	  - Added prototype for job_class_console_type().
1473
	* init/job_process.c:
1474
	  - New log_dir and disable_job_logging variables.
1475
	  - job_process_run(): Updated to reflect new parameter for
1476
	    job_process_spawn().
1477
	  - job_process_spawn(): Now accepts a Job rather than a
1478
	    JobClass to allow job->log and class->console to be handled
1479
	    appropriately. Now creates pty master and slave fds for
1480
	    console logging. Simplified code for file descriptor
1481
	    switching by using new job_process_remap_fd().
1482
	  - job_process_error_read(): Added entries for:
1483
	    - JOB_PROCESS_ERROR_OPENPT_MASTER
1484
	    - JOB_PROCESS_ERROR_OPENPT_UNLOCKPT
1485
	    - JOB_PROCESS_ERROR_PTSNAME
1486
	    - JOB_PROCESS_ERROR_OPENPT_SLAVE
1487
	  - job_process_log_path(): New function that returns full path to log
1488
	    file for specified Job.
1489
	  - job_process_remap_fd(): New function to ensure file
1490
	    descriptors do not collide.
1491
	* init/job_process.h:
1492
	  - Updated JobProcessErrorType with new entries:
1493
	    - JOB_PROCESS_ERROR_OPENPT_MASTER
1494
	    - JOB_PROCESS_ERROR_OPENPT_UNLOCKPT
1495
	    - JOB_PROCESS_ERROR_PTSNAME
1496
	    - JOB_PROCESS_ERROR_OPENPT_SLAVE
1497
	  - job_process_spawn(): Updated prototype.
1498
	  - job_process_log_path(): Added prototype.
1499
	* init/main.c:
1500
	  - handle_logdir(): New function for overriding log directory.
1501
	  - console_type_setter(): New Function to handle selection of
1502
	    default console value.
1503
	  - Added following command-line options:
1504
	    - '--default-console'
1505
	    - '--logdir'
1506
	    - '--no-log'
1507
	* init/man/init.5:
1508
	  - Update and restructure of section on 'console' stanza.
1509
	  - Added a FILES section.
1510
	* init/man/init.8: Updated with details of new options:
1511
	  - '--default-console'
1512
	  - '--logdir'
1513
	  - '--no-log'
1514
	* init/parse_job.c: stanza_console(): Updated for "log".
1515
	* init/paths.h: Added defines for JOB_LOGDIR and LOGDIR_ENV.
1516
	* init/session.c:
1517
	  - Added missing function headers.
1518
	* init/system.c: system_setup_console(): Update for CONSOLE_LOG.
1519
	* init/test_conf.c:
1520
	  - TEST_FORCE_WATCH_UPDATE(): Removed debug.
1521
	  - test_override(): Removed erroneous comment.
1522
	  - test_select_job(): Added variable attributes to keep gcc 4.6 happy.
1523
	* init/test_event.c: Explicitly set console type to CONSOLE_NONE to
1524
	  retain behaviour of existing tests.
1525
	* init/test_job.c:
1526
	  - test_job_new(): Ensure log object not created on Job instantiation.
1527
	  - test_change_state(): Explicitly set console type to CONSOLE_NONE to
1528
	    retain behaviour of existing tests.
1529
	* init/test_job_class.c:
1530
	  - test_new(): Ensure console type now defaults to CONSOLE_LOG.
1531
	  - Explicitly set console type to CONSOLE_NONE to retain behaviour of
1532
	    existing tests.
1533
	* init/test_job_process.c:
1534
	  - Added various new macros to simplify test code.
1535
	  - child(): New child_tests added for TEST_OUTPUT and TEST_SIGNALS.
1536
	  - get_available_pty_count(): New function.
1537
	  - Explicitly set console type to CONSOLE_NONE to retain behaviour of
1538
	    existing tests.
1539
	  - test_run(): Added new tests for CONSOLE_LOG.
1540
	  - test_spawn(): Added new tests for CONSOLE_LOG.
1541
	  - test_log_path(): New function.
1542
	  - test_handler(): Added UPSTART_LOGDIR support to 
1543
	  - main():
1544
	    - Update to allow number of forks to be specified when run as a child
1545
	      process.
1546
	    - Added call to test_log_path().
1547
	    - initialize various subsystems since before, functions run from
1548
	      main() had to be run in the order specified and exactly as listed
1549
	     (certain tests relied on previous tests initializing a subsystem
1550
	     which gives unexpected results and thus confusing behaviour
1551
	     if the order of tests is changed).
1552
	* init/test_parse_job.c: Added new test to test_stanza_console() for
1553
	  "console log".
1554
	* util/tests/test_user_sessions.sh: Added tests for job logging
1555
	  to ensure no unexpected output recorded for user jobs.
1556
1182.14.99 by James Hunt
* init/parse_job.c, init/job_class.c, init/job_class.h: Added "usage"
1557
2011-11-16  Petr Lautrbach <plautrba@redhat.com>
1558
	* init/parse_job.c, init/job_class.c, init/job_class.h: Added "usage"
1559
	stanza which is used by initctl command.
1560
	* init/tests/test_parse_job.c: Tests for "usage" stanza
1561
	* init/man/init.5: "usage" stanza documentation.
1562
	* util/initctl.c, util/man/initctl.8: Added "inictl usage" command.
1563
	* util/tests/test_initctl.c: Tests for ""inictl usage" command.
1564
1182.14.67 by Scott James Remnant
* init/main.c: Deal with failure to setup the system console by
1565
2011-08-11  Scott James Remnant  <keybuk@google.com>
1566
1182.14.70 by Scott James Remnant
* init/job_process.c (job_process_spawn): Can't return on
1567
	* init/job_process.c (job_process_spawn): Can't return on
1568
	dup2() error, we're in the child. Return an error back to
1569
	the child properly.
1570
1182.14.69 by Scott James Remnant
* init/job_process.c (job_process_spawn), init/main.c: error
1571
	* init/job_process.c (job_process_spawn), init/main.c: error
1572
	should be ENOENT
1573
1182.14.68 by Scott James Remnant
* init/job_class.c, init/job_class.h: Move constants into the
1574
	* init/job_class.c, init/job_class.h: Move constants into the
1575
	header file so they can be found from other source files.
1576
	* init/job_process.c (job_process_spawn): Only adjust the OOM
1577
	score if it isn't the default
1578
	* init/main.c: Apply the default OOM score to the init process
1579
	itself.
1580
1182.14.67 by Scott James Remnant
* init/main.c: Deal with failure to setup the system console by
1581
	* init/main.c: Deal with failure to setup the system console by
1582
	falling back to /dev/null, so we don't end up without default fds
1583
	and castrate the process.
1584
1182.14.66 by Scott James Remnant
* init/job_class.c (job_class_new): nit, use #defines for the default
1585
2011-08-10  Scott James Remnant  <keybuk@google.com>
1586
1587
	* init/job_class.c (job_class_new): nit, use #defines for the default
1588
	nice level and oom score adjustment.
1323 by James Hunt
Upstream cherry-pick for user session fixes
1589
2011-07-25  James Hunt  <james.hunt@ubuntu.com>
1590
1591
	* init/job_process.c: job_process_spawn():
1592
	  - Added dup2() return check.
1593
	* TESTING.sessions: Updated with information on user sessions.
1594
	* init/job_process.c:
1595
	  - job_process_spawn():
1596
	    - Change group before user and do it as early as possible.
1597
	    - Ensure non-priv user is able to read script fd. Default system
1598
	      behaviour is seemingly not consistent/defined, so force it
1599
	      to be (LP: #813052)
1600
	    - Ensure cwd for user job is home directory by default.
1601
	  - job_process_error_read():
1602
	    - Added handling for JOB_PROCESS_ERROR_SETUID and
1603
	      JOB_PROCESS_ERROR_SETGID (LP: #807293).
1604
	    - Added new entry for JOB_PROCESS_ERROR_CHOWN.
1605
	* init/job_process.h:
1606
	  - Added entry for JOB_PROCESS_ERROR_CHOWN in JobProcessErrorType.
1607
	* init/man/init.5: Update for user jobs explaining behaviour of stanzas
1608
	  which manipulate system resource limits and when the init
1609
	  daemon reads the users job directory.
1610
	* util/tests/test_user_sessions.sh: New script for testing user sessions
1611
	  (NOTE: this is *NOT* run automatically).
1612
	* init/session.c: session_from_dbus(): Handle case where a users
1613
	  home directory is changed or where a uid is re-used for a
1614
	  different username.
1615
	* init/session.h: Updated comments for Session object.
1616
	* init/man/init.5: Explain that symbolic links are not supported.
1617
1618
2011-07-22  James Hunt  <james.hunt@ubuntu.com>
1619
1620
	* util/man/initctl.8: Clarify semantics of restart(8)
1621
	  command (LP: #731225).
1622
1182.14.59 by James Hunt
* util/tests/test_initctl.c:
1623
2011-07-20  James Hunt  <james.hunt@ubuntu.com>
1624
1625
	* util/tests/test_initctl.c:
1626
	  - test_show_config(): /* fall through :) */
1627
	  - test_check_config(): Manually start and stop dbus-daemon to work
1628
	    around change in dbus autostart behaviour which causes issues when
1629
	    running the tests in a chroot and non-X11 environment (see dbus commit
1630
	    cea055514a9dfc74e7f0515cf4a256da10a891bc).
1631
1182.29.2 by James Hunt
* contrib/vim/syntax/upstart.vim: Updates for kill, oom, expect
1632
2011-06-14  James Hunt  <james.hunt@ubuntu.com>
1633
1182.14.54 by James Hunt
* Changelog: Release entry.
1634
	* NEWS: Release 1.3
1635
1636
2011-06-14  James Hunt  <james.hunt@ubuntu.com>
1637
1182.29.2 by James Hunt
* contrib/vim/syntax/upstart.vim: Updates for kill, oom, expect
1638
	* contrib/vim/syntax/upstart.vim: Updates for kill, oom, expect
1639
	and limit.  
1640
1182.14.49 by Scott James Remnant
* init/job_process.c (job_process_spawn): Make sure we don't close
1641
2011-06-07  Scott James Remnant  <scott@netsplit.com>
1642
1643
	* init/job_process.c (job_process_spawn): Make sure we don't close
1644
	our own file descriptor if it already has the right value.
1645
1182.14.43 by James Hunt
Merge of lp:~jamesodhunt/upstart/upstream-override-support.
1646
2011-06-06  James Hunt  <james.hunt@ubuntu.com>
1647
	
1648
	Add override file support.
1649
1650
	* init/conf.c:
1651
	  - conf_reload_path(): Now takes an extra override_path parameter.
1652
	  - is_conf_file() / is_conf_file_std() / is_conf_file_override(): New
1653
	    functions to determine type of given file path.
1654
	  - toggle_conf_name(): New function which convert a conf file
1655
	    name to an override name and vice versa.
1656
	  - majority of remaining functions updated to handle override
1657
	    files.
1658
	* init/conf.h: Prototypes.
1659
	* init/job_class.c: Whitespace.
1660
	* init/man/init.5: Updated to document override file support.
1661
	* init/man/init.8: Added reference to control-alt-delete(7) man page.
1662
	* init/paths.h: New macros CONF_EXT_OVERRIDE, CONF_EXT_STD,
1663
	  IS_CONF_FILE_OVERRIDE and IS_CONF_FILE_STD.
1664
	* init/parse_conf.c: Added assertion to remind us forcibly to add
1665
	  override-handling code for directories if we ever allow content in
1666
	  'init.conf'.
1667
	* init/parse_job.c (parse_job): Additional parameter 'update' to
1668
	  allow override files to replace existing Job details.
1669
	* init/parse_job.h: Updated parse_job() prototype.
1670
	* init/test_conf.c
1671
	  - New macros TEST_ENSURE_CLEAN_ENV() and
1672
	    TEST_FORCE_WATCH_UPDATE().
1673
	  - test_override(): New function.
1674
	  - test_toggle_conf_name(): New function.
1675
	* init/test_parse_job.c:
1676
	  - Updated for extra parse_job() parameter.
1677
	  - added a test feature to test_parse_job() to exercise new
1678
	    parameter to parse_job().
1679
	* util/man/initctl.8: Clarified what it means to restart a job.
1680
1182.14.48 by James Hunt
Merge of lp:~jamesodhunt/upstart/upstream-udev+socket-bridges.
1681
	Add udev and socket bridges.
1682
	
1683
	* Makefile.am: Added extra directory.
1684
	* New files:
1685
	  - extra/Makefile.am
1686
	  - extra/conf/upstart-socket-bridge.conf
1687
	  - extra/conf/upstart-udev-bridge.conf
1688
	  - extra/man/socket-event.7
1689
	  - extra/man/upstart-socket-bridge.8
1690
	  - extra/man/upstart-udev-bridge.8
1691
	  - extra/upstart-socket-bridge.c
1692
	  - extra/upstart-udev-bridge.c
1693
	* configure.ac:
1694
	  - Check for udev (for upstart-udev-bridge).
1695
	  - Add extra/Makefile to AC_CONFIG_FILES.
1696
	* dbus/com.ubuntu.Upstart.xml: Add EmitEventWithFile method.
1697
	* init/control.c:
1698
	  - control_emit_event(): Now a wrapper for control_emit_event_with_file.
1699
	  - control_emit_event_with_file(): New function that operates on an fd.
1700
	* init/control.h: Prototype for control_emit_event_with_file().
1701
	* init/event.c:
1702
	  - event_new(): Initialize event fd.
1703
	  - event_pending_handle_jobs(): Now calls event_operator_fds().
1704
	* init/event.c: Add fd to Event struct.
1705
	* init/event_operator.c: event_operator_fds(): New function.
1706
	* init/event_operator.h: Prototype for event_operator_fds().
1707
	* init/job.c: job_new(): Initialize fd members.
1708
	* init/job.h: Add fds and num_fds to Job struct.
1709
1182.9.12 by James Hunt
Add session support. Note that there are no automatically runnable and
1710
2011-06-03  James Hunt  <james.hunt@ubuntu.com>
1711
1712
	Add session support. Note that there are no automatically runnable and
1713
	explicit tests yet. However, see TESTING.sessions.
1714
	
1715
	* TESTING.sessions: ASCII (reStructuredText) document explaining
1716
	  how to run manual tests for session support (for chroots).
1717
	* dbus/Upstart.conf: Simplified to support allowing users to invoke
1718
	  all methods (since Upstart now isolates commands by user).
1719
	* init/Makefile.am: Added session.[ch] files.
1720
	* init/session.c: New file. Note that session_from_dbus() will disable sessions
1721
	  (by returning the NULL session) if environment variable "UPSTART_NO_SESSIONS"
1722
	  is set to any value (used by tests).
1723
	* init/session.h: New file.
1724
	* init/parse_job.h: parse_job(): Add session pointer to prototype.
1725
	* init/parse_job.c:
1726
	  - parse_job(): Add session parameter.
1727
	  - Update calls to job_class_new() to pass session pointer.
1728
	* init/job.c: job_new(): Crucial change to ensure chroot sessions have
1729
	  a unique D-Bus name (LP:#728531).
1730
	* init/job_class.c: 
1731
	  - job_class_new(): Add session parameter and session support.
1732
	  - job_class_remove(): Add session parameter to prototype.
1733
	  - job_class_consider(): Only consider jobs from the appropriate session.
1734
	  - job_class_reconsider(): Only consider jobs from the appropriate session.
1735
	  - job_class_start(): Disallow out-of-session modification.
1736
	  - job_class_stop(): Disallow out-of-session modification.
1737
	  - job_class_restart(): Disallow out-of-session modification.
1738
	* init/main.c: Add "--no-sessions" command-line option to disable
1739
	  sessions and revert to traditional behaviour.
1740
	* init/job_class.h: 
1741
	  - job_class_new(): Add session pointer to prototype.
1742
	  - JobClass: Add session member.
1743
	* init/job_process.c: job_process_spawn():
1744
	  - Call chroot(2) for chroot sessions.
1745
	  - Call setuid(2) for user session jobs.
1746
	* init/job.c:
1747
	  - job_emit_event(): Set session for event.
1748
	  - job_start(): Disallow out-of-session modification.
1749
	  - job_stop(): Disallow out-of-session modification.
1750
	  - job_restart(): Disallow out-of-session modification.
1751
	* init/event.h: Event: Add session member.
1752
	* init/event.c:
1753
	  - event_new(): initialize session to NULL.
1754
	  - event_pending_handle_jobs(): Add session handling.
1755
	  - event_finished(): Set session for failure event.
1756
	* init/control.c:
1757
	  - control_get_job_by_name(): Add session handling.
1758
	  - control_get_all_jobs(): Add session handling.
1759
	  - control_emit_event(): Add session handling.
1760
	* init/conf.c:
1761
	  - conf_source_new(): Initialise session to NULL.
1762
	  - conf_reload_path(): Pass session to parse_job().
1763
	  - conf_select_job(): Add session parameter.
1764
	* init/conf.h:
1765
	  - ConfSource: Add session member.
1766
	  - conf_select_job(): Add session parameter to prototype.
1767
	* All tests updated to set "UPSTART_NO_SESSIONS" (to disable
1768
	  sessions).
1769
1182.27.1 by James Hunt
* contrib/bash_completion/upstart:
1770
2011-06-02  James Hunt  <james.hunt@ubuntu.com>
1771
1772
	* contrib/bash_completion/upstart:
1773
	  - Made function names more meaningful:
1774
	  - _upstart_jobs: Now returns a unique list
1775
	  - _upstart_events (nee _upstart_named_events ) now considers all
1776
	    "emits" tokens.
1777
	  - Updates for "check-config" and "show-config".
1778
	  - Added "--session" option.
1779
	  - Added "--no-wait" for emit, reload and restart.
1780
1182.28.1 by James Hunt
Man page updates.
1781
	Man page updates.
1782
	
1783
	* init/man/init.5:
1784
	  - Quoted dashes.
1785
	  - Explain handling of duplicated stanzas.
1786
	  - "respawn": Document default count and interval.
1787
	  - "emits": Reference "initctl check-config".
1788
	  - Added BUGS section.
1789
	  - Added copyright.
1790
	* init/man/init.8:
1791
	  - Quoted dashes.
1792
	  - See Also: Added control-alt-delete(7).
1793
	* util/man/initctl.8:
1794
	  - Quoted dashes.
1795
	  - "restart": Clarified meaning.
1796
	  - "list": Explained "stop/waiting" jobs.
1797
1182.20.3 by James Hunt
Add D-Bus session support to initctl.
1798
2011-06-01  James Hunt  <james.hunt@ubuntu.com>
1799
1800
	Add D-Bus session support to initctl.
1801
	
1802
	* util/initctl.c:
1803
	  - Added "--session" command-line option.
1804
	  - dbus_bus_type_setter(): New function used by option parser to
1805
	    distinguish system/session D-Bus bus type.
1806
	  - system_bus variable now replaced by two others: use_dbus (boolean)
1807
	    and dbus_bus_type.
1808
	  - upstart_open(): Updated to handle multiple D-Bus bus types.
1809
	* util/man/initctl.8: Update for "--session" option.
1810
	* util/tests/test_initctl.c: Updated to make use of use_dbus and
1811
	  dbus_bus_type rather than system_bus.
1812
1182.23.2 by James Hunt
* Changelog: Update for "show-config".
1813
	Add "show-config" command to initctl.
1814
	
1815
	* util/initctl.c:
1816
	  - New functions:
1817
	    - job_class_condition_handler(): Handler function to retrieve job conditions.
1818
	    - job_class_condition_err_handler(): Handler error function for
1819
	      job_class_condition_handler().
1820
	    - job_class_parse_events(): Convert RPN "start on" and "stop on" conditions to
1821
	      human-readable format.
1822
	    - job_class_show_emits(): Display events which job emits.
1823
	    - job_class_show_conditions(): Make D-Bus calls to retrieve "start on" and
1824
	      "stop on" conditions.
1825
	    - show_config_action: Handle "show-config" command..
1826
	* util/initctl.h: New file providing stack-handling functionality for
1827
	  RPN parsing for "show-config" command.
1828
	* util/Makefile.am: Added initctl.h to initctl_SOURCES.
1829
	* util/man/initctl.8: Updated for "show-config" command and associated
1830
	  options.
1182.1.103 by James Hunt
* Bumped version to 0.9.5
1831
	* util/tests/test_initctl.c:
1182.23.2 by James Hunt
* Changelog: Update for "show-config".
1832
	  - New macros START_UPSTART, STOP_UPSTART, RUN_COMMAND, CREATE_FILE and DELETE_FILE.
1833
	    These are required since due to the introduction of the
1834
	    "show-config" initctl command, initctl is no longer solely a proxy
1835
	    to Upstart: it now has some intelligence (it parses the 
1836
	    "emits", "start on" and "stop on" conditions) and thus must be
1837
	    tested directly.
1838
	  - test_show_config(): New function to test "initctl show-config".
1839
	  - in_chroot(): New function to detect if tests are being run from
1840
	    within a chroot environment.
1841
	  - dbus_configured(): New function which performs a basic check to
1842
	    establish if D-Bus is configured correctly.
1843
	  - main(): Added call to test_show_config(), conditional on
1844
	    a non-chroot environment and a working D-Bus system.
1845
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1846
	Add "check-config" command to initctl.
1847
	
1182.1.97 by James Hunt
* conf/rc-sysinit.conf: Added emits stanza for runlevel event.
1848
	* util/initctl.c:
1849
	  - New functions:
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1850
	    - allow_event(): Determine if specified event is erroneous or not.
1851
	      Handles globbing.
1182.1.97 by James Hunt
* conf/rc-sysinit.conf: Added emits stanza for runlevel event.
1852
	    - allow_job(): Determine if specified job is erroneous or not.
1853
	      Handles variables (such as instance variables).
1182.13.5 by James Hunt
* contrib/bash_completion/upstart: Updated for new initctl show-config
1854
	    - check_condition(): High-level function to handle checking start
1855
	      on/stop on conditions.
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1856
	    - check_config_action: Handler for "check-config" command.
1857
	    - display_check_errors(): Display errors from expression tree nodes
1858
	      that are in error.
1859
	    - eval_expr_tree(): Evaluate expression tree.
1860
	    - ignored_events_setter(): handler for '--ignore-events' command-line
1861
	      option for "check-config" command.
1182.13.5 by James Hunt
* contrib/bash_completion/upstart: Updated for new initctl show-config
1862
	    - tree_filter(): Used for filtering expression tree nodes.
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1863
	  - show_config_action(): Update for check-config mode.
1864
	  - job_class_parse_events(): Update for check-config mode.
1865
	  - job_class_show_emits(): Update for check-config mode.
1182.13.5 by James Hunt
* contrib/bash_completion/upstart: Updated for new initctl show-config
1866
	* util/initctl.h:
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1867
	  - Added structs for JobCondition, CheckConfigData and ExprNode.
1868
	  - New macros: MAKE_EXPR_NODE() and MAKE_JOB_CONDITION().
1869
	* util/tests/test_initctl.c:
1870
	  - test_check_config(): New function to test "initctl check-config".
1871
	  - main(): Added call to test_check_config(), conditional on
1872
	    a non-chroot environment and a working D-Bus system.
1873
	* util/man/initctl.8: Updated for "check-config" command and associated
1874
	  options.
1182.24.4 by James Hunt
* Changelog: updated.
1875
	* conf/rc-sysinit.conf: Added "emits" stanza, required by
1876
	"check-config".
1182.24.3 by James Hunt
* Changelog: Update for "check-config".
1877
1182.25.1 by James Hunt
Addition of initctl2dot script for visualisation.
1878
	Addition of initctl2dot script for visualisation.
1879
	
1880
	* Makefile.am: Added scripts directory.
1881
	* configure.ac: Updated AC_CONFIG_FILES for scripts/Makefile.
1882
	* scripts/Makefile.am: Makefile for scripts.
1883
	* scripts/initctl2dot.py: Python script to produce dot(1) graphs of
1884
	  "initctl show-config" output.
1885
	* scripts/man/initctl2dot.8: Man page for initctl2dot.py script.
1886
1182.26.1 by James Hunt
Addition of init-checkconf script.
1887
	Addition of init-checkconf script.
1888
	
1889
	* scripts/init-checkconf.sh: Script to determine if specified job
1890
	  config file is valid or not.
1891
	* scripts/man/init-checkconf.8: Man page for init-checkconf.sh.
1892
	* scripts/Makefile.am: Added init-checkconf script and man
1893
	  page.
1894
1182.14.24 by James Hunt
Corrected copyright notices.
1895
2011-05-31  James Hunt  <james.hunt@ubuntu.com>
1896
1182.20.1 by James Hunt
Add command-line option to use D-Bus session bus (for testing).
1897
	Add command-line option to use D-Bus session bus (for testing).
1898
	
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
1899
	* init/control.c:
1182.20.1 by James Hunt
Add command-line option to use D-Bus session bus (for testing).
1900
	  - Added new boolean use_session_bus.
1901
	  - Updated comments.
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
1902
	  - control_handle_bus_type(): New function to allow selection of
1182.20.1 by James Hunt
Add command-line option to use D-Bus session bus (for testing).
1903
	    session bus via env var "UPSTART_USE_SESSION_BUS".
1904
	    Also logs use of session bus if use_session_bus set.
1905
	  - control_bus_open(): Now connects to either D-Bus system bus or session bus.
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
1906
	* init/control.h: New define for USE_SESSION_BUS_ENV.
1182.20.1 by James Hunt
Add command-line option to use D-Bus session bus (for testing).
1907
	* init/main.c: Addition of "--session" command-line option.
1908
	* init/man/init.8: Update for new "--session" command-line option.
1182.21.1 by James Hunt
Add option to allow alternate location for job config files.
1909
1182.14.24 by James Hunt
Corrected copyright notices.
1910
	* Corrected copyright notices.
1911
1182.21.1 by James Hunt
Add option to allow alternate location for job config files.
1912
	Add option to allow alternate location for job config files.
1913
	
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
1914
	* init/main.c:
1182.21.1 by James Hunt
Add option to allow alternate location for job config files.
1915
	  - Added "--confdir <dir>" command-line option.
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
1916
	  - handle_confdir(): New function to select alternate confdir using env
1182.21.1 by James Hunt
Add option to allow alternate location for job config files.
1917
	    var "UPSTART_CONFDIR" or command-line option (for testing).
1918
	* init/paths.h: Added define for CONFDIR_ENV.
1182.21.3 by James Hunt
* Changelog: Update for man page.
1919
	* init/man/init.8: Update for new "--confdir" command-line option.
1182.21.1 by James Hunt
Add option to allow alternate location for job config files.
1920
1182.22.1 by James Hunt
Add ability to suppress initial event and/or change its name.
1921
	Add ability to suppress initial event and/or change its name.
1922
	
1923
	* init/main.c: New command-line options: "--no-startup-event" and
1924
	  "--startup-event". If "--no-startup-event" specified, log message as a
1925
	  debug aid.
1926
	* init/man/init.8: Documentation for new command-line options:
1927
	  "--no-startup-event" and "--startup-event".
1928
1182.14.22 by Scott James Remnant
* init/job_class.h (JobClass): Replace oom_adj with oom_score_adj
1929
2011-05-12  Marc - A. Dahlhaus  <mad@wol.de>
1930
1182.14.23 by Scott James Remnant
* init/job_class.h (JobClass): Add kill signal member
1931
	* init/job_class.h (JobClass): Add kill signal member
1932
	* init/job_class.c (job_class_new): Initialise kill signal
1933
	* init/tests/test_job_class.c (test_new): Check kill signal initialised
1934
	correctly.
1935
	* init/system.c (system_kill): Change to accept a signal rather than
1936
	a boolean.
1937
	* init/system.h: Update prototype
1938
	* init/tests/test_system.c (test_kill): Update tests to pass signals
1939
	by value.
1940
	* init/job_process.c (job_process_kill, job_process_kill_timer): Pass
1941
	the configured kill signal, or SIGKILL, to the function rather than
1942
	TRUE/FALSE.
1943
	* init/parse_job.c (stanza_kill): Add parsing for kill signal.
1944
	* init/tests/test_parse_job.c (test_stanza_kill): Check parsing works
1945
	* init/errors.h: Add illegal signal error and string.
1946
	* init/man/init.5: Update documentation
1947
1182.14.22 by Scott James Remnant
* init/job_class.h (JobClass): Replace oom_adj with oom_score_adj
1948
	* init/job_class.h (JobClass): Replace oom_adj with oom_score_adj
1949
	* init/job_class.c (job_class_new): Replace oom_adj with oom_score_adj.
1950
	* init/job_process.c (job_process_spawn): Write the new score
1951
	adjustment, falling back to calculating and writing the old value if
1952
	necessary.
1953
	* init/parse_job.c (stanza_oom): Parse both the new and old values,
1954
	converting the old value to the new value if present.
1955
	* init/errors.h: Add new error string.
1956
	* init/man/init.5: Documentation update.
1957
	* init/tests/test_job_class.c (test_new): Update check.
1958
	* init/tests/test_parse_job.c (test_stanza_oom): Update tests.
1959
1182.14.21 by Scott James Remnant
* init/job_process.c (job_process_run): Always make the shell script
1960
2011-05-12  Scott James Remnant  <scott@netsplit.com>
1961
1962
	* init/job_process.c (job_process_run): Always make the shell script
1963
	fd 9, since that's the highest that shells are required by POSIX to
1964
	support.  Pass the file descriptor to job_process_spawn()
1965
	(job_process_run): Accept the extra file descriptor, moving it to fd 9.
1966
	(job_process_error_read): Add handling for error condition.
1967
	* init/job_process.h: Adjust prototypes, add constant
1968
	* init/tests/test_job_process.c (test_spawn): Add argument to call in
1969
	tests
1970
1182.14.20 by Scott James Remnant
* configure.ac: Bump version to 1.3
1971
2011-03-22  Scott James Remnant  <scott@netsplit.com>
1972
1973
	* configure.ac: Bump version to 1.3
1974
	* NEWS: Begin new release
1182.14.18 by Scott James Remnant
* init/job_process.c (job_process_run): Correct shell redirection;
1975
1182.14.19 by Scott James Remnant
* NEWS: Release 1.2
1976
	* NEWS: Release 1.2
1977
1182.14.18 by Scott James Remnant
* init/job_process.c (job_process_run): Correct shell redirection;
1978
	* init/job_process.c (job_process_run): Correct shell redirection;
1979
	the form we used dosen't work with at least pdksh
1980
1182.14.9 by Scott James Remnant
* init/job_process.c (job_process_run): Prepend a shell command to the
1981
2011-03-16  Scott James Remnant  <scott@netsplit.com>
1982
1182.14.17 by Scott James Remnant
* configure.ac: Bump version to 1.2
1983
	* configure.ac: Bump version to 1.2
1984
	* NEWS: Begin new release
1985
1182.14.16 by Scott James Remnant
* NEWS: Release 1.1
1986
	* NEWS: Release 1.1
1987
1988
	* configure.ac (NIH_COPYRIGHT): Update
1989
1182.14.15 by Scott James Remnant
* init/main.c: Don't close the console until initialization is
1990
	* init/main.c: Don't close the console until initialization is
1991
	complete.
1992
1182.14.14 by Scott James Remnant
* util/Makefile.am (uninstall-hook): Clean up symlinks on uninstall
1993
	* util/Makefile.am (uninstall-hook): Clean up symlinks on uninstall
1994
1182.14.13 by Scott James Remnant
* init/environ.c (environ_all_valid): Only verify that an = is present
1995
	* init/environ.c (environ_all_valid): Only verify that an = is present
1996
	(environ_valid): Drop this function, the part of POSIX I read about
1997
	valid environment variable names only applies to other things defined
1998
	by POSIX, elsewhere it explicitly says Applications may do whatever
1999
	they like (and even encourages to avoid conflict)
2000
	(environ_expand_until): Remove validity check for name.
2001
	* init/environ.h: Update header.
2002
	* init/tests/test_environ.c (test_valid): Drop tests.
2003
	(test_all_valid): Drop name tests.
2004
	(test_expand): Remove illegal expansion test.
2005
	* init/tests/test_control.c (test_emit_event): Remove the test case for
2006
	an invalid name in the environment.
2007
	* init/tests/test_job_class.c (test_start, test_stop)
2008
	(test_restart): Change the invalid argument tests to use an entry
2009
	without an = as the invalid test.
2010
1182.14.11 by Scott James Remnant
* util/reboot.c: pass '-H' to shutdown when called as 'halt'
2011
	* util/reboot.c: pass '-H' to shutdown when called as 'halt'
2012
1182.14.10 by Scott James Remnant
* init/job_process.c (job_process_handler): Check the job's normal exit
2013
	* init/job_process.c (job_process_handler): Check the job's normal exit
2014
	list, decrease log priority of messages from warning to information if
2015
	the exit status or signal is in the list.
2016
	* init/tests/test_job_process.c (test_handler): Change the normal exit
2017
	test cases to not expect the warning
2018
1182.14.9 by Scott James Remnant
* init/job_process.c (job_process_run): Prepend a shell command to the
2019
	* init/job_process.c (job_process_run): Prepend a shell command to the
2020
	pasted script to force the shell to close the file descriptor being
2021
	used to paste the script. The shell will already have a new copy when
2022
	it opened the path.
2023
1182.14.8 by James Hunt
* init/conf.c (conf_source_reload, conf_source_reload_dir): Fix typos
2024
2011-03-15  James Hunt  <james.hunt@ubuntu.com>
2025
2026
	* init/conf.c (conf_source_reload, conf_source_reload_dir): Fix typos
2027
	in doc-strings
2028
	* init/job_process.c (job_process_run): Fix typo in doc-string
2029
	* init/parse_job.c (stanza_env): Fix typo in doc-string
2030
1182.14.7 by Patty Langasek
* init/man/init.5: Grammar fixes
2031
2011-03-15  Patty Langasek  <harmoney@dodds.net>
2032
2033
	* init/man/init.5: Grammar fixes
2034
1182.14.6 by Jacek Konieczny
* contrib/vim/syntax/upstart.vim: Further improve syntax hilighting
2035
2011-03-15  Jacek Konieczny  <jajcus@jajcus.net>
2036
2037
	* contrib/vim/syntax/upstart.vim: Further improve syntax hilighting
2038
1182.14.4 by Scott James Remnant
* NEWS: Release 1.0
2039
2011-03-01  Scott James Remnant  <scott@netsplit.com>
2040
1182.14.5 by Scott James Remnant
* configure.ac: Bump version to 1.1
2041
	* configure.ac: Bump version to 1.1
2042
	* NEWS: Begin new release
2043
1182.14.4 by Scott James Remnant
* NEWS: Release 1.0
2044
	* NEWS: Release 1.0
2045
1182.14.1 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload_job_dir): Add tests for
2046
2011-02-17  Scott James Remnant  <scott@netsplit.com>
2047
1182.14.3 by Scott James Remnant
* configure.ac, NEWS: Bump version to 1.0
2048
	* configure.ac, NEWS: Bump version to 1.0
2049
	* TODO: Update.
2050
1182.14.1 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload_job_dir): Add tests for
2051
	* init/tests/test_conf.c (test_source_reload_job_dir): Add tests for
2052
	a crasher bug when a file is created called ".conf"
2053
	* init/conf.c (conf_dir_filter): Apply fix for the crasher; check that
2054
	the character before the ".conf" extension is not "/"
2055
	* NEWS: Update.
1182.13.1 by James Hunt
* contrib/utils/initctl2dot.py: Simply Python script to convert new initctl
2056
1182.1.77 by Petr Lautrbach
* init/job_process.c (job_process_termianted): Don't rewind the
2057
2011-01-06  Petr Lautrbach  <plautrba@redhat.com>
2058
2059
	* init/job_process.c (job_process_termianted): Don't rewind the
2060
	utmp file between updates.
2061
	* init/tests/test_job_process.c (test_utmp): Add test case for
2062
	newer mingetty behaviour.
2063
1182.1.76 by Scott James Remnant
* contrib/bash_completion/upstart: Add bash completion script.
2064
2010-12-21  James Hunt  <james.hunt@ubuntu.com>
2065
2066
	* contrib/bash_completion/upstart: Add bash completion script.
2067
	* contrib/Makefile.am (EXTRA_DIST): Include in tarball.
2068
	* NEWS: Update.
2069
1182.1.75 by Scott James Remnant
* NEWS: update.
2070
2010-12-20  Scott James Remnant  <scott@netsplit.com>
2071
2072
	* NEWS: update.
2073
1182.1.73 by Petr Lautrbach
* util/shutdown.c: Exit non-zero if unable to shutdown the system.
2074
2010-12-20  Petr Lautrbach  <plautrba@redhat.com>
2075
1182.1.74 by Petr Lautrbach
* init/job_process.c (job_process_terminated): On termination of
2076
	* init/job_process.c (job_process_terminated): On termination of
2077
	a job, update the utmp file replacing any existing entry for that
2078
	pid with a DEAD_PROCESS entry; likewise append an entry to wtmp.
2079
	* init/tests/test_job_process.c (test_utmp): Test utmp handling.
2080
1182.1.73 by Petr Lautrbach
* util/shutdown.c: Exit non-zero if unable to shutdown the system.
2081
	* util/shutdown.c: Exit non-zero if unable to shutdown the system.
2082
1182.1.67 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (start_on, stop_on, emits): Add new
2083
2010-12-14  Scott James Remnant  <scott@netsplit.com>
2084
1300 by Colin Watson
sync up with 0.9.3 tarball
2085
	* configure.ac: Bump version to 0.6.8
2086
	* NEWS: Begin new release
2087
1182.1.71 by Scott James Remnant
* NEWS: Release 0.6.7
2088
	* NEWS: Release 0.6.7
2089
1182.1.67 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (start_on, stop_on, emits): Add new
2090
	* dbus/com.ubuntu.Upstart.Job.xml (start_on, stop_on, emits): Add new
2091
	properties to return the job's relationship to events.
2092
	* init/job_class.c (job_class_get_start_on)
2093
	(job_class_get_stop_on, job_class_get_emits): Implement the properties
2094
	* init/job_class.h: Add prototypes.
2095
	* init/tests/test_job_class.c (test_get_start_on)
2096
	(test_get_stop_on, test_get_emits): Test the new properties too
2097
1182.1.66 by Scott James Remnant
* init/job_class.h: Added debug member.
2098
2010-12-14  James Hunt  <james.hunt@ubuntu.com>
1182.6.2 by James Hunt
updated changelog for debug stanza.
2099
1182.8.3 by James Hunt
Updated changelog for manual stanza.
2100
	* init/parse_job.c (stanza_manual): New function to handle manual
2101
	stanza.
2102
	* init/tests/test_parse_job.c (test_stanza_manual): New function to
2103
	test manual stanza.
2104
	* init/man/init.5: Update for manual stanza.
2105
2106
2010-12-14  James Hunt <james.hunt@ubuntu.com>
2107
1182.6.2 by James Hunt
updated changelog for debug stanza.
2108
	* init/job_class.h: Added debug member.
2109
	* init/job_class.c: Initialized debug member.
2110
	* init/job_process.c: Pause child using raise(3).
2111
	* init/main.c: Display PID+PPID for debug builds.
2112
	* init/parse_job.c: Added new function stanza_debug.
2113
	* init/tests/test_job_process.c (test_spawn): Added test for debug stanza.
2114
1182.1.65 by Scott James Remnant
* dbus/upstart.h (DBUS_SERVICE_UPSTART, DBUS_ADDRESS_UPSTART):
2115
2010-12-10  Scott James Remnant  <scott@netsplit.com>
2116
2117
	* dbus/upstart.h (DBUS_SERVICE_UPSTART, DBUS_ADDRESS_UPSTART):
2118
	For debugging purposes, when -DDEBUG is given, change the values of
2119
	these constants.  You'll need to modify your own D-Bus configuration
2120
	of course.
2121
1182.1.63 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add missing
2122
2010-12-09  Scott James Remnant  <scott@netsplit.com>
2123
2124
	* init/tests/test_job.c (test_change_state): Add missing
2125
	DBUS_TYPE_INVALID to dbus_message_get_args() call.
2126
1182.1.62 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged, StateChanged)
2127
2010-12-08  Colin Watson  <cjwatson@debian.org>
1182.5.4 by Colin Watson
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged): New signal.
2128
1182.1.62 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged, StateChanged)
2129
	* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged, StateChanged)
2130
	(Failed): New signals.
1182.5.4 by Colin Watson
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged): New signal.
2131
	* init/job.c (job_change_goal): Emit GoalChanged signal after
1182.1.62 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged, StateChanged)
2132
	(job_change_state): Emit StateChanged signal after changing state.
2133
	(job_failed): Emit Failed signal after marking job as failed.
1182.5.4 by Colin Watson
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged): New signal.
2134
	* init/tests/test_job.c (test_change_goal): Test for this.
1182.1.62 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (GoalChanged, StateChanged)
2135
	(test_change_state): Test for this.
2136
	* NEWS: Update.
2137
1182.1.66 by Scott James Remnant
* init/job_class.h: Added debug member.
2138
2010-12-08  James Hunt  <james.hunt@ubuntu.com>
1182.1.61 by Scott James Remnant
* init/event.c, init/event_operator.c: Fix grammar and factual errors
2139
2140
	* init/event.c, init/event_operator.c: Fix grammar and factual errors
2141
	in comments.
2142
	* init/man/init.5: Fix grammar errors and clarify export behaviour.
2143
1182.1.60 by Scott James Remnant
* init/man/init.5: Typo existing -> exiting
2144
2010-12-08  Clint Byrum  <clint@ubuntu.com>
2145
2146
	* init/man/init.5: Typo existing -> exiting
1182.5.1 by Colin Watson
* dbus/com.ubuntu.Upstart.Instance.xml (StateChanged): New signal.
2147
1182.1.59 by Scott James Remnant
* init/job_process.c (job_process_spawn): We can fail to open the
2148
2010-08-12  Scott James Remnant  <scott@netsplit.com>
2149
2150
	* init/job_process.c (job_process_spawn): We can fail to open the
2151
	system console for various reasons, sometimes because there isn't
2152
	a console (ENXIO or ENODEV) but worse due to kernel race conditions
2153
	on SMP/multi-core systems (EIO).  If "console output" is used, and
2154
	these happen, fall back to /dev/null.
2155
1182.1.56 by Scott James Remnant
* configure.ac: Bump the requirement of libnih to 1.0.2 after
2156
2010-04-27  Scott James Remnant  <scott@netsplit.com>
2157
1300 by Colin Watson
sync up with 0.9.3 tarball
2158
	* configure.ac: Bump version to 0.6.7
2159
	* NEWS: Begin new release
2160
1182.1.57 by Scott James Remnant
* NEWS: Release 0.6.6
2161
	* NEWS: Release 0.6.6
2162
1182.1.56 by Scott James Remnant
* configure.ac: Bump the requirement of libnih to 1.0.2 after
2163
	* configure.ac: Bump the requirement of libnih to 1.0.2 after
2164
	verifying that building using --with-local-libnih and an earlier
2165
	version installed still works.
2166
1182.1.55 by Scott James Remnant
* configure.ac: Replace the --with-local-libnih code with an
2167
2010-04-24  Scott James Remnant  <scott@netsplit.com>
2168
2169
	* configure.ac: Replace the --with-local-libnih code with an
2170
	expansion of the NIH_WITH_LOCAL_LIBNIH macro that now contains it.
2171
	* README: Bump libnih version.
2172
1182.2.1 by Colin Watson
* init/man/init.5 (env): Document behaviour when the environment
2173
2010-03-31  Colin Watson  <cjwatson@ubuntu.com>
2174
2175
	* init/man/init.5 (env): Document behaviour when the environment
2176
	variable's value is omitted.
2177
	* init/parse_job.c (stanza_env): Document that arguments may be
2178
	simply VAR as well as VAR=VALUE.
2179
1182.1.53 by Michael Biebl
* configure.ac: Remove double-quoting from NIH_CFLAGS and
2180
2010-03-02  Michael Biebl  <mbiebl@gmail.com>
2181
2182
	* configure.ac: Remove double-quoting from NIH_CFLAGS and
2183
	NIH_DBUS_CFLAGS when using --with-local-libnih
2184
1182.1.48 by Scott James Remnant
* init/paths.h (DEV_FD): Drop this definition, it's needless.
2185
2010-02-26  Scott James Remnant  <scott@netsplit.com>
2186
1182.1.51 by Scott James Remnant
* NEWS: Update.
2187
	* NEWS: Update.
2188
1182.1.50 by Scott James Remnant
* init/job_process.c (job_process_run): Since /proc is always mounted,
2189
	* init/job_process.c (job_process_run): Since /proc is always mounted,
2190
	guaranteed because we mount it ourselves if it isn't, we don't need
2191
	to check for it and can always use /proc/self/fd/NNN when we want.
2192
	* init/tests/test_job_process.c (test_run): Since /proc is always
2193
	mounted, we don't need to check for it and skip tests.
2194
1182.1.49 by Scott James Remnant
* init/system.c (system_mount): Add function to mount a kernel
2195
	* init/system.c (system_mount): Add function to mount a kernel
2196
	filesystem (ie. /proc and /sys)
2197
	* init/system.h: Add header.
2198
	* init/main.c: Mount /proc and /sys on initialisation.
2199
1182.1.48 by Scott James Remnant
* init/paths.h (DEV_FD): Drop this definition, it's needless.
2200
	* init/paths.h (DEV_FD): Drop this definition, it's needless.
2201
	* init/job_process.c (job_process_run): Rather than using /dev/fd,
2202
	use /proc/self/fd which is more Linuxish and is always guaranteed to
2203
	exist when /proc is mounted - needing no symlinks.
2204
	* init/tests/test_job_process.c (test_run): Adjust test to match.
2205
1182.1.47 by Scott James Remnant
* configure.ac: Use NIH_COPYRIGHT instead of AC_COPYRIGHT
2206
2010-02-09  Scott James Remnant  <scott@netsplit.com>
2207
2208
	* configure.ac: Use NIH_COPYRIGHT instead of AC_COPYRIGHT
2209
1182.1.30 by Scott James Remnant
* init/job_process.c (job_process_handler): Reduce priority of the
2210
2010-02-04  Scott James Remnant  <scott@netsplit.com>
2211
1182.1.46 by Scott James Remnant
* configure.ac: Bump version to 0.6.6
2212
	* configure.ac: Bump version to 0.6.6
2213
	* NEWS: Begin new release
2214
1182.1.45 by Scott James Remnant
* NEWS: Release 0.6.5
2215
	* NEWS: Release 0.6.5
2216
1182.1.44 by Scott James Remnant
* util/tests/test_initctl.c (test_reload_action): Don't send
2217
	* util/tests/test_initctl.c (test_reload_action): Don't send
2218
	SIGHUP to the server process, it'll be terminated anyway since
2219
	reload doesn't loop.
2220
1182.1.42 by Scott James Remnant
* init/event_operator.c (event_operator_match): Support operator
2221
	* init/event_operator.c (event_operator_match): Support operator
2222
	negation using !=
2223
	* init/tests/test_event_operator.c (test_operator_update): Add
2224
	test cases for negation.
2225
	* init/man/init.5: Add negation to documentation
2226
1182.1.41 by Scott James Remnant
* init/man/init.8: Improve reference to init(5) to make it more
2227
	* init/man/init.8: Improve reference to init(5) to make it more
2228
	obvious that this is where documentation can be found.
2229
	* init/man/init.5: Add Upstart to the title to make it show up
2230
	with man -k upstart
2231
1182.1.39 by Scott James Remnant
* init/man/init.8: Add missing OPTIONS section, documenting the
2232
	* init/man/init.8: Add missing OPTIONS section, documenting the
2233
	--verbose option.
2234
1182.1.38 by Scott James Remnant
* init/main.c (main): After resetting the system console, close it
2235
	* init/main.c (main): After resetting the system console, close it
2236
	again and reopen /dev/null for ourselves so we don't hold the
2237
	system console open.
2238
1182.1.37 by Scott James Remnant
* init/job_process.c (job_process_error_abort): Free the error
2239
	* init/job_process.c (job_process_error_abort): Free the error
2240
	before exiting.
2241
1182.1.36 by Scott James Remnant
* util/initctl.c (reload_action): Add a reload command, this obtains
2242
	* util/initctl.c (reload_action): Add a reload command, this obtains
2243
	the pid of the main process of the given job instance and sends
2244
	SIGHUP to it.  It might not be in its final form, but it's damned
2245
	useful for now.
2246
	* util/tests/test_initctl.c (test_reload_action): Add test cases.
2247
	* util/man/initctl.8: Add documentation for the reload command,
2248
	and missing documentation for restart.
2249
	* util/Makefile.am (install-data-hook, install-exec-hook): Create
2250
	additional reload symlinks.
2251
1182.1.32 by Scott James Remnant
* util/reboot.c (main): Restore the sync() system call before
2252
	* util/reboot.c (main): Restore the sync() system call before
2253
	calling reboot(); the Linux kernel says we have to do this, and I
2254
	suspect that ext4 is no longer forcing this before power off.
2255
1182.1.31 by Scott James Remnant
* init/main.c (hup_handler): Move call to reconnect to D-Bus system
2256
	* init/main.c (hup_handler): Move call to reconnect to D-Bus system
2257
	bus into new function
2258
	(usr1_handler): This is because a config reload "forgets" existing
2259
	state, such as events that were pending.
2260
	(main): Add SIGUSR1 signal handler.
2261
1182.1.30 by Scott James Remnant
* init/job_process.c (job_process_handler): Reduce priority of the
2262
	* init/job_process.c (job_process_handler): Reduce priority of the
2263
	stopped/continued by signal messages to informational.
2264
1182.1.28 by Scott James Remnant
* util/shutdown.c (shutdown_now): Free error before exiting.
2265
2010-02-03  Scott James Remnant  <scott@netsplit.com>
1236 by Scott James Remnant
Merge change from trunk that makes it possible to build Upstart using
2266
1235 by Scott James Remnant
Fix "unhandled error" in shutdown when unable to change runlevel,
2267
	* util/shutdown.c (shutdown_now): Free error before exiting.
2268
1182.1.27 by Johan Kiviniemi
* conf/rc-sysinit.conf: Don't replace DEFAULT_RUNLEVEL with an
2269
2010-02-03  Johan Kiviniemi  <johan@kiviniemi.name>
1233 by Scott James Remnant
Don't lose the original default runlevel if /etc/inittab exists without
2270
2271
	* conf/rc-sysinit.conf: Don't replace DEFAULT_RUNLEVEL with an
2272
	empty string when there is no "initdefault" line in /etc/inittab
2273
1182.1.23 by Scott James Remnant
* configure.ac: Bump version to 0.6.5, bump copyright year to 2010.
2274
2010-02-03  Scott James Remnant  <scott@netsplit.com>
2275
1182.1.26 by Scott James Remnant
Update code to work with libnih 1.0.1
2276
	Update code to work with libnih 1.0.1
2277
2278
	* init/tests/test_event.c (test_new): Replace TEST_ALLOC_ORPHAN(env)
2279
	with TEST_ALLOC_PARENT(env, NULL); discard environment after creating
2280
	event from it
2281
	* init/tests/test_event_operator.c (test_operator_new): Replace
2282
	TEST_ALLOC_ORPHAN(env) with TEST_ALLOC_PARENT(env, NULL); discard
2283
	environment after creating event from it
2284
	* init/tests/test_control.c (test_emit_event): Discard event
2285
	environment after emission
2286
	* init/init.supp: Add nih_alloc_ref_new() to init functions
2287
1182.1.24 by Scott James Remnant
libnih is now released as its own project, so rather than expecting
2288
	libnih is now released as its own project, so rather than expecting
2289
	to include it with the source we depend on it being outside of it.
2290
2291
	* Makefile.am (SUBDIRS): Remove m4 directory along with the nih bits.
2292
	(EXTRA_DIST): Remove ChangeLog.nih
2293
	* configure.ac (AM_INIT_AUTOMAKE): Remove dist-bzip2, since we don't
2294
	actually use it; add color-tests and silent-rules.
2295
	(AM_SILENT_RULES): Use silent rules by default
2296
	(AM_MAINTAINER_MODE): Enable maintainer mode by default (as before),
2297
	but allow it to be disabled
2298
	(AM_GNU_GETTEXT_VERSION): Bump to 0.17
2299
	(NIH_INIT): Replace with the expanded out calls that we actually need.
2300
	(AC_CONFIG_FILES): Remove nih directories
2301
	Add magic to allow use of a local libnih source tree.
2302
	* init/Makefile.am (AM_CFLAGS): Add NIH_CFLAGS and NIH_DBUS_CFLAGS
2303
	(init_LDADD, test_system_LDADD, test_environ_LDADD, test_process_LDADD)
2304
	(test_job_class_LDADD, test_job_process_LDADD, test_job_LDADD)
2305
	(test_event_LDADD, test_event_operator_LDADD)
2306
	(test_blocked_LDADD, test_parse_job_LDADD)
2307
	(test_parse_conf_LDADD, test_conf_LDADD, test_control_LDADD):
2308
	Replace library paths with NIH_LIBS and NIH_DBUS_LIBS
2309
	($(com_ubuntu_Upstart_OUTPUTS)),
2310
	($(com_ubuntu_Upstart_Job_OUTPUTS)),
2311
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Use external nih-dbus-tool
2312
	and obey silent rules.
2313
	(test_system_LDFLAGS, test_environ_LDFLAGS)
2314
	(test_process_LDFLAGS, test_job_class_LDFLAGS)
2315
	(test_job_process_LDFLAGS, test_job_LDFLAGS, test_event_LDFLAGS)
2316
	(test_event_operator_LDFLAGS, test_blocked_LDFLAGS)
2317
	(test_parse_job_LDFLAGS, test_parse_conf_LDFLAGS)
2318
	(test_conf_LDFLAGS, test_control_LDFLAGS): Drop -static
2319
	* util/Makefile.am (AM_CFLAGS): Add NIH_CFLAGS and NIH_DBUS_CFLAGS
2320
	(initctl_LDADD, reboot_LDADD, runlevel_LDADD, shutdown_LDADD)
2321
	(test_initctl_LDADD, test_utmp_LDADD, test_sysv_LDADD)
2322
	(test_telinit_LDADD): Replace library paths with NIH_LIBS and
2323
	NIH_DBUS_LIBS
2324
	($(com_ubuntu_Upstart_OUTPUTS)):
2325
	($(com_ubuntu_Upstart_Job_OUTPUTS)):
2326
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Use external nih-dbus-tool
2327
	and obey silent rules.
2328
	(initctl_LDFLAGS, reboot_LDFLAGS, runlevel_LDFLAGS)
2329
	(shutdown_LDFLAGS, telinit_LDFLAGS, test_initctl_LDFLAGS)
2330
	(test_utmp_LDFLAGS, test_sysv_LDFLAGS, test_telinit_LDFLAGS): Drop
2331
	-static
2332
	* README: Add libnih to the dependencies.
2333
	* HACKING: Remove the instructions for checking out libnih, replace
2334
	with a description about how to use a libnih source tree instead of
2335
	the installed one.
2336
1182.1.23 by Scott James Remnant
* configure.ac: Bump version to 0.6.5, bump copyright year to 2010.
2337
	* configure.ac: Bump version to 0.6.5, bump copyright year to 2010.
2338
	* NEWS: Begin new release.
2339
1182.1.22 by Scott James Remnant
* NEWS: Release 0.6.3
2340
2009-08-02  Scott James Remnant  <scott@netsplit.com>
2341
2342
	* NEWS: Release 0.6.3
2343
1182.1.20 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): Add a missing test
2344
2009-08-01  Scott James Remnant  <scott@netsplit.com>
2345
2346
	* init/tests/test_job_process.c (test_handler): Add a missing test
2347
	case for the running process exiting while we're in the stopping
2348
	state.
2349
	* init/job_process.c (job_process_terminated): Don't change the
2350
	state or record failure information if we're in the stopping state
2351
	when the main process dies, otherwise we hit an assertion later;
2352
	just wait for the stopping event to finish and carry on as before.
2353
1182.1.19 by Scott James Remnant
* dbus/upstart.h: Allow the service name and address to be overriden
2354
2009-07-31  Scott James Remnant  <scott@netsplit.com>
2355
2356
	* dbus/upstart.h: Allow the service name and address to be overriden
2357
1182.1.18 by Michael Biebl
* init/tests/test_job_process.c: Add missing sys/ptrace.h include
2358
2009-07-29  Michael Biebl  <mbiebl@gmail.com>
2359
2360
	* init/tests/test_job_process.c: Add missing sys/ptrace.h include
2361
1182.1.13 by Scott James Remnant
* init/job.c (job_change_state): Obvious bug fix; the set of states
2362
2009-07-21  Scott James Remnant  <scott@netsplit.com>
2363
1182.1.17 by Scott James Remnant
* configure.ac: Bump version to 0.6.3
2364
	* configure.ac: Bump version to 0.6.3
2365
	* NEWS: Begin new release
2366
1182.1.16 by Scott James Remnant
* NEWS: Release 0.6.2
2367
	* NEWS: Release 0.6.2
2368
1182.1.15 by Scott James Remnant
* init/main.c (crash_handler): Restore missing chdir ("/") call.
2369
	* init/main.c (crash_handler): Restore missing chdir ("/") call.
2370
1182.1.14 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): We should allow
2371
	* init/tests/test_job_process.c (test_handler): We should allow
2372
	a job to exec() before it calls fork() to allow shell scripts to
2373
	exec daemons.
2374
	* init/job_process.c (job_process_trace_exec): Continue the traced
2375
	process instead of detaching if it has not yet forked.
2376
1182.1.13 by Scott James Remnant
* init/job.c (job_change_state): Obvious bug fix; the set of states
2377
	* init/job.c (job_change_state): Obvious bug fix; the set of states
2378
	into which we can enter JOB_STOPPING includes JOB_STARTING because
2379
	we can get the "stop" event or command there.
2380
1182.1.9 by Scott James Remnant
* util/runlevel.c: If there is no current runlevel because the
2381
2009-07-16  Scott James Remnant  <scott@netsplit.com>
2382
1182.1.12 by Scott James Remnant
* configure.ac: Bump version to 0.6.2
2383
	* configure.ac: Bump version to 0.6.2
2384
	* NEWS: Begin new release
2385
1182.1.11 by Scott James Remnant
* NEWS: Release 0.6.1
2386
	* NEWS: Release 0.6.1
2387
1182.1.10 by Scott James Remnant
* util/runlevel.c: Output the path before the error message,
2388
	* util/runlevel.c: Output the path before the error message,
2389
	to make it clear that it's the utmp file missing not runlevel.
2390
1182.1.9 by Scott James Remnant
* util/runlevel.c: If there is no current runlevel because the
2391
	* util/runlevel.c: If there is no current runlevel because the
2392
	environment variable is empty, output "unknown" instead of "N N".
2393
1182.1.8 by Scott James Remnant
* README: Now that D-Bus 1.2.16 proper has been released, update
2394
2009-07-15  Scott James Remnant  <scott@netsplit.com>
2395
2396
	* README: Now that D-Bus 1.2.16 proper has been released, update
2397
	our requirements.
2398
1182.1.3 by Scott James Remnant
* util/tests/test_utmp.c (test_write_runlevel): Looks like glibc
2399
2009-07-14  Scott James Remnant  <scott@netsplit.com>
2400
1182.1.7 by Scott James Remnant
* TODO: Update
2401
	* TODO: Update
2402
1182.1.6 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): Rework the existing
2403
	* init/tests/test_job_process.c (test_handler): Rework the existing
2404
	ptrace fork handler test case to make sure we test the case where
2405
	we get the fork event before the stopped child.  Add a second test
2406
	case for the opposite (stopped child before the fork event) which
2407
	we don't currently handle.
2408
	* init/job_process.c (job_process_trace_fork): Test for the missed
2409
	child event using ptrace(), if it succeeds the child is ready so
2410
	we can just assume we had the event.
2411
1182.1.5 by Scott James Remnant
* util/Makefile.am (EXTRA_DIST): Distribute the valgrind suppressions
2412
	* util/Makefile.am (EXTRA_DIST): Distribute the valgrind suppressions
2413
	file
2414
1182.1.4 by Scott James Remnant
* util/tests/test_utmp.c (test_write_shutdown): Additional instance
2415
	* util/tests/test_utmp.c (test_write_shutdown): Additional instance
2416
	of the same test.
2417
1182.1.3 by Scott James Remnant
* util/tests/test_utmp.c (test_write_runlevel): Looks like glibc
2418
	* util/tests/test_utmp.c (test_write_runlevel): Looks like glibc
2419
	is fixed to return the right error code.
2420
1182.1.1 by Scott James Remnant
* configure.ac: Bump version to 0.6.1
2421
2009-07-11  Scott James Remnant  <scott@netsplit.com>
2422
1182.1.2 by Scott James Remnant
* init/control.c (control_server_open): Don't hardcode the server
2423
	* init/control.c (control_server_open): Don't hardcode the server
2424
	address, otherwise the test suite can't test this function.
2425
	* init/tests/test_control.c (test_server_open)
2426
	(test_server_connect, test_server_close): Change the server
2427
	address in the tests.
2428
1182.1.1 by Scott James Remnant
* configure.ac: Bump version to 0.6.1
2429
	* configure.ac: Bump version to 0.6.1
2430
	* NEWS: Begin new release
2431
1162 by Scott James Remnant
* conf/rc-sysinit.conf: Fix typo.
2432
2009-07-09  Scott James Remnant  <scott@netsplit.com>
2433
1182 by Scott James Remnant
* NEWS: Release 0.6.0
2434
	* NEWS: Release 0.6.0
2435
1181 by Scott James Remnant
* README: Note that we need D-Bus GIT HEAD.
2436
	* README: Note that we need D-Bus GIT HEAD.
2437
	* NEWS: Update.
2438
1180 by Scott James Remnant
* init/man/inittab.5: People keep trying "man inittab", so explain
2439
	* init/man/inittab.5: People keep trying "man inittab", so explain
2440
	that it's gone.
2441
	* init/Makefile.am (dist_man_MANS): Install it
2442
1179 by Scott James Remnant
* NEWS: Declare the "lacks documentation" bug fixed
2443
	* NEWS: Declare the "lacks documentation" bug fixed
2444
1178 by Scott James Remnant
* init/man/init.8: Refresh and turn it into more of an overview
2445
	* init/man/init.8: Refresh and turn it into more of an overview
2446
	of Upstart now that we have lots of other pages to refer to.
2447
	* init/man/upstart.7: Since it's an overview, people might go
2448
	"man upstart" so redirect to it.
2449
	* init/man/init.5: Actually document the configuration format.
2450
	* init/Makefile.am (dist_man_MANS): Install the configuration
2451
	documentation, and the redirect.
2452
1177 by Scott James Remnant
* util/man/runlevel.8, util/man/telinit.8, util/man/shutdown.8,
2453
	* util/man/runlevel.8, util/man/telinit.8, util/man/shutdown.8,
2454
	* util/man/reboot.8: Add environment and files sections.
2455
1176 by Scott James Remnant
* init/man/startup.7, init/man/starting.7, init/man/started.7,
2456
	* init/man/startup.7, init/man/starting.7, init/man/started.7,
2457
	* init/man/stopping.7, init/man/stopped.7
2458
	* init/man/control-alt-delete.7, init/man/keyboard-request.7,
2459
	* init/man/power-status-changed.7: Write manual pages for each
2460
	of the events generated by the init daemon by default.
2461
	* init/Makefile.am (dist_man_MANS): Distribute and install the
2462
	new manpages.
2463
	* util/man/runlevel.7: Indent the example, don't boldface
2464
1175 by Scott James Remnant
* init/job.c (job_start, job_stop, job_restart): Restructure
2465
	* init/job.c (job_start, job_stop, job_restart): Restructure
2466
	slightly to avoid gcc warning
2467
	* init/job_class.c (job_class_start, job_class_restart): Make the
2468
	same change to these too
2469
	* util/shutdown.c: Warn if we can't change directory
2470
	* util/telinit.c: Assert that we don't fall out of the switch
2471
	* init/tests/test_job_class.c (test_get_version)
2472
	(test_get_author, test_get_description, test_get_name): Initialise
2473
	alloc-safe variables to NULL to avoid gcc warning
2474
	* util/tests/test_initctl.c (test_job_status, test_start_action)
2475
	(test_stop_action, test_restart_action, test_status_action)
2476
	(test_list_action, test_emit_action)
2477
	(test_reload_configuration_action, test_version_action)
2478
	(test_log_priority_action, test_upstart_open): Initialise alloc-safe
2479
	variables to NULL and diverted return values to 0 to avoid gcc
2480
	warnings.
2481
	(test_start_action, test_stop_action, test_restart_action):
2482
	Replace sigsetjmp/siglongjmp with a call to _exit() in the handler
2483
	* util/tests/test_sysv.c (test_change_runlevel): Initialise alloc-safe
2484
	variables to NULL to avoid gcc warnings
2485
1174 by Scott James Remnant
* util/man/runlevel.7: Formatting fixes, and mention that rcS
2486
	* util/man/runlevel.7: Formatting fixes, and mention that rcS
2487
	runs rc-sysinit again.
2488
	* util/man/runlevel.8: s/utilities/tools/
2489
	* util/man/telinit.8: s/utilities/tools/
2490
	* util/man/shutdown.8: s/utilities/tools/
2491
	* util/man/reboot.8: s/utilities/programs/
2492
	* util/man/initctl.8: s/utility/tool/
2493
1173 by Scott James Remnant
* init/job_class.h (JobClass): Drop the leader option; at the time
2494
	* init/job_class.h (JobClass): Drop the leader option; at the time
2495
	it seemed to make sense that Upstart would provide a "daemon"-like
2496
	environment, but it really doesn't in practice.  Software should
2497
	feel safe to daemonise on its own, and I'd rather fix supervision
2498
	of those; freeing up Upstart jobs to run as new sessions by default
2499
	again.  This is also the only real option that would change the
2500
	behaviour between 0.6 and 0.10 in an awkwardly compatible way.
2501
	* init/job_class.c (job_class_new): Remove leader initialisation
2502
	* init/tests/test_job_class.c (test_new): Drop the initialisation
2503
	check for leader
2504
	* init/parse_job.c (stanza_session): Drop the stanza
2505
	* init/tests/test_parse_job.c (test_stanza_session): Drop the
2506
	stanza test cases.
2507
	* init/job_process.c (job_process_spawn): Drop the double-fork.
2508
	This means we don't need to read the pid of our extra child either.
2509
	(job_process_error_read): we no longer need a fork error.
2510
	* init/job_process.h (JobProcessErrorType): Drop the fork error.
2511
	* init/tests/test_job_process.c (test_spawn): Replace the simple job
2512
	test case with the session leader test case, now that's the default.
2513
	(test_run, test_spawn, test_kill, test_handler): Remove all the
2514
	class->leader = TRUE from the tests, we only ever really tested
2515
	session leaders anyway since that's all the test suite could follow
2516
	* init/tests/test_job.c (test_change_goal, test_change_state):
2517
	Remove the leader flag from test jobs
2518
	* init/tests/test_event.c (test_pending, test_finished): Remove
2519
	the leader flag from test jobs.
2520
1171 by Scott James Remnant
* init/job_process.c (job_process_catch_runaway): Use a monotonic
2521
	* init/job_process.c (job_process_catch_runaway): Use a monotonic
2522
	clock, not the realtime clock, for respawn interval detection.
2523
	* init/tests/test_job_process.c (test_kill, test_handler): Use the
2524
	monotonic clock in test cases too
2525
	* init/Makefile.am (init_LDADD): Link with librt
2526
	* NEWS: Update.
2527
1170 by Scott James Remnant
* util/utmp.c (utmp_write_runlevel): Don't write 'N' to utmp or
2528
	* util/utmp.c (utmp_write_runlevel): Don't write 'N' to utmp or
2529
	wtmp for the previous runlevel, this will force writing reboot
2530
	records if prevlevel='N'/0 since read_runlevel will always return
2531
	'N' in that case.
2532
	* util/tests/test_utmp.c (test_write_runlevel): Add test case for
2533
	passing 'N' and having it treated as zero
2534
	(test_read_runlevel): Add a couple of test cases for the problems
2535
	we found last night where shutdown and corrupt utmp records result
2536
	in the wrong data being returned.
2537
	* util/tests/test_sysv.c (test_change_runlevel): Add a test case
2538
	for switching from sysinit to the first runlevel
2539
1169 by Scott James Remnant
* init/conf.h,
2540
	* init/conf.h,
2541
	* init/control.h,
2542
	* init/event.h,
2543
	* init/job_class.h: Variable declarations in header files need to
2544
	be prefixed with "extern", the NIH_BEGIN_EXTERN stuff only applies
2545
	to C++.
2546
1168 by Scott James Remnant
* util/reboot.c: Reboot can't write the shutdown time before
2547
	* util/reboot.c: Reboot can't write the shutdown time before
2548
	calling shutdown, otherwise shutdown won't be able to get the
2549
	current runlevel anymore.
2550
	* util/man/reboot.8: Update, we don't write the shutdown time
2551
	before calling shutdown - it's up to the shutdown scripts to
2552
	call reboot -w before remounting the root filesystem.
2553
1167 by Scott James Remnant
* util/tests/test_utmp.c (test_get_runlevel): Replace test case
2554
	* util/tests/test_utmp.c (test_get_runlevel): Replace test case
2555
	with one that expects 'N' rather than fall-through.
2556
	* util/tests/test_sysv.c (test_change_runlevel): Expect N when
2557
	there is no previous runlevel
2558
1166 by Scott James Remnant
* util/utmp.c (utmp_read_runlevel): Also catch a zero runlevel from
2559
	* util/utmp.c (utmp_read_runlevel): Also catch a zero runlevel from
2560
	utmp, replacing with 'N' - these functions should never return 0
2561
	* util/sysv.c (sysv_change_runlevel): Should set prevlevel to N
2562
	when we don't find one
2563
1165 by Scott James Remnant
* util/utmp.c (utmp_read_runlevel): Catch a negative runlevel from
2564
	* util/utmp.c (utmp_read_runlevel): Catch a negative runlevel from
2565
	corrupt utmp data, convert to 'N'
2566
	(utmp_get_runlevel): Return N when RUNLEVEL is set but empty,
2567
	rather than falling through
2568
1164 by Scott James Remnant
* util/telinit.c: Catch a missing argument separately so we don't
2569
	* util/telinit.c: Catch a missing argument separately so we don't
2570
	output "(null)"
2571
1163 by Scott James Remnant
* README: Update requirements.
2572
	* README: Update requirements.
2573
	* TODO: Update.
2574
1162 by Scott James Remnant
* conf/rc-sysinit.conf: Fix typo.
2575
	* conf/rc-sysinit.conf: Fix typo.
2576
1155 by Scott James Remnant
* init/job_process.c (job_process_run): Stop being stingy, the
2577
2009-07-08  Scott James Remnant  <scott@netsplit.com>
2578
1161 by Scott James Remnant
* conf/rc-sysinit.conf: Michael Biebl pointed out that by setting
2579
	* conf/rc-sysinit.conf: Michael Biebl pointed out that by setting
2580
	the runlevel to "S" during sysinit, we end up with the runlevel
2581
	after boot being "S 2" - and that means scripts in rc2.d that
2582
	are also in rcS.d won't get started.  The way we had it before
2583
	("N 2") was correct.  This happily fixes the one corner case our
2584
	reboot handling didn't cover - crashing in single user mode and
2585
	rebooting.
2586
1160 by Scott James Remnant
* util/telinit.c: Fix missing ret = from kill
2587
	* util/telinit.c: Fix missing ret = from kill
2588
1159 by Scott James Remnant
* conf/rc-sysinit.conf: Ignore -s/single if we're already coming
2589
	* conf/rc-sysinit.conf: Ignore -s/single if we're already coming
2590
	from single-user-mode.
2591
1158 by Scott James Remnant
* util/telinit.c (options): Unignore the -t option
2592
	* util/telinit.c (options): Unignore the -t option
2593
	* NEWS: Update.
2594
1157 by Scott James Remnant
* init/main.c (hup_handler): Also try and reconnect to the message
2595
	* init/main.c (hup_handler): Also try and reconnect to the message
2596
	bus if we've lost the connection.
2597
1156 by Scott James Remnant
* init/conf.c (conf_source_reload_dir): Don't blacklist certain
2598
	* init/conf.c (conf_source_reload_dir): Don't blacklist certain
2599
	patterns from the configuration directory, instead just filter
2600
	to whitelist.
2601
	(conf_dir_filter): Whitelist filter, only accept files ending
2602
	in .conf
2603
	(conf_reload_path): Strip .conf from the filename to generate
2604
	the job name.
2605
	(conf_file_filter): Add the extra is_dir argument.
2606
	* init/tests/test_conf.c (test_source_reload_job_dir)
2607
	(test_source_reload_conf_dir, test_source_reload_file)
2608
	(test_source_reload): Append .conf to all our filenames
2609
	* init/tests/test_control.c (test_reload_configuration): Append
2610
	.conf to filenames here too
2611
	* NEWS: Update.
2612
1155 by Scott James Remnant
* init/job_process.c (job_process_run): Stop being stingy, the
2613
	* init/job_process.c (job_process_run): Stop being stingy, the
2614
	post-stop script can have the stop environment too
2615
	* init/tests/test_job_process.c (test_run): Add a test case to
2616
	make sure it is.
2617
1154 by Scott James Remnant
* contrib/vim/syntax/upstart.vim: Upstart job syntax highlighting
2618
2009-07-08  Michael Biebl  <mbiebl@gmail.com>
2619
2620
	* contrib/vim/syntax/upstart.vim: Upstart job syntax highlighting
2621
	* contrib/vim/ftdetect/upstart.vim: Use for the /etc/init directory
2622
	* contrib/Makefile.am: Include the vim syntax files in the
2623
	distribution
2624
	* configure.ac (AC_CONFIG_FILES): Create contrib/Makefile
2625
	* Makefile.am (SUBDIRS): Recurse into the contrib sub-directory
2626
1140 by Scott James Remnant
* util/utmp.c: Set of functions for dealing with utmp and wtmp
2627
2009-07-08  Scott James Remnant  <scott@netsplit.com>
2628
1153 by Scott James Remnant
* conf/rc.conf: This doesn't need to be an instance job, Upstart
2629
	* conf/rc.conf: This doesn't need to be an instance job, Upstart
2630
	will do the right thing and stop the task before starting it again
2631
	with the new environment (I spent so much time on that, you'd think
2632
	I'd remember :p)
2633
1152 by Scott James Remnant
* conf/control-alt-delete.conf: Default job for Control-Alt-Delete
2634
	* conf/control-alt-delete.conf: Default job for Control-Alt-Delete
2635
	* conf/rc-sysinit.conf: Default job for system initialisation
2636
	* conf/rc.conf: A fully wacky instance job that runs the rc script
2637
	for runlevel changes
2638
	* conf/rcS.conf: And a job for single-user-mode, which calls back
2639
	to rc-sysinit
2640
	* conf/Makefile.am (dist_init_DATA): Install the default files
2641
	into the /etc/init directory
2642
	* configure.ac (AC_CONFIG_FILES): Create conf/Makefile
2643
	* Makefile.am (SUBDIRS): Recurse into the conf directory.
2644
1151 by Scott James Remnant
* util/initctl.c (upstart_open, start_action, stop_action)
2645
	* util/initctl.c (upstart_open, start_action, stop_action)
2646
	(restart_action, status_action, list_action): Don't auto-start
2647
	the init daemon, it makes no sense.
2648
	(upstart_open): When not running from the test suite, and not as
2649
	root, it makes sense to default to using the system bus daemon.
2650
	* util/tests/test_initctl.c (test_upstart_open): Make sure that
2651
	auto-start is FALSE, not TRUE.
2652
	* NEWS: Update.
2653
1150 by Scott James Remnant
* util/Makefile.am (dist_man_MANS): Oops, had the wrong name for
2654
	* util/Makefile.am (dist_man_MANS): Oops, had the wrong name for
2655
	the runlevel(7) manpage.
2656
1149 by Scott James Remnant
* util/shutdown.c: Gets a bit of a redress, but not much of rewrite
2657
	* util/shutdown.c: Gets a bit of a redress, but not much of rewrite
2658
	since this is largely just compatibility madness.
2659
	(shutdown_now): Port to use sysv_change_runlevel()
2660
	(warning_message): Construct plural forms a little better.
2661
	(wall): use utmpx, rather than utmp
2662
	* util/man/shutdown.8: Minor tweaks and improvements
2663
	* NEWS: Update.
2664
1148 by Scott James Remnant
* util/reboot.c: Following the pattern of the previous, remove much
2665
	* util/reboot.c: Following the pattern of the previous, remove much
2666
	of the reboot code, but in the process adding support for reboot
2667
	implying --force in runlevel 0 or 6, and writing the shutdown
2668
	wtmp record.
2669
	* util/man/reboot.8: Minor updates.
2670
	* NEWS: Update.
2671
1147 by Scott James Remnant
* util/telinit.c: Drop quite a bit of the code of telinit too,
2672
	* util/telinit.c: Drop quite a bit of the code of telinit too,
2673
	just becoming a wrapper about sysv_change_runlevel() - also support
2674
	Qq/Uu by using kill()
2675
	* util/tests/test_telinit.c (test_env_option): Since we have an
2676
	env option, we should test it.	
2677
	* util/man/telinit.8: Update the manual page.
2678
	* util/man/runlevel.8: Typo (/var/run/wtmp -> /var/log/wtmp)
2679
	* util/Makefile.am (TESTS): Run the new test
2680
	(test_telinit_SOURCES, test_telinit_CFLAGS)
2681
	(test_telinit_LDFLAGS, test_telinit_LDADD): Details for the
2682
	test suite binary
2683
	* NEWS: Update.
2684
1146 by Scott James Remnant
* util/runlevel.c: Drop about 90% of the code, this just becomes
2685
	* util/runlevel.c: Drop about 90% of the code, this just becomes
2686
	a wrapper around utmp_get_runlevel()
2687
	* util/man/runlevel.8: Update the runlevel manpage.
2688
	* util/man/runlevel.7: Also put together a manual page that
2689
	describes the runlevel event, as well as the implementation in
2690
	Upstart.
2691
	* util/Makefile.am (dist_man_MANS): Install the new manpage.
2692
	* NEWS: Update.
2693
1145 by Scott James Remnant
* util/Makefile.am (reboot_SOURCES, runlevel_SOURCES): Compile and
2694
	* util/Makefile.am (reboot_SOURCES, runlevel_SOURCES): Compile and
2695
	link the utmp handling source, depending on the header.
2696
	(reboot_LDADD, runlevel_LDADD): Drop dependency on libupstart
2697
	(shutdown_SOURCES, telinit_SOURCES): Compile and link both the
2698
	utmp handling and sysv compat source, depending on the headers
2699
	(nodist_shutdown_SOURCES, nodist_telinit_SOURCES): Also link in
2700
	the auto-generated bindings
2701
	(shutdown_LDADD, telinit_LDADD): Drop dependencies on libupstart,
2702
	replacing with dependencies on libnih-dbus and the D-Bus libs.
2703
	(runlevel_SOURCES, runlevel_LDFLAGS, runlevel_LDADD)
2704
	(shutdown_SOURCES, shutdown_LDFLAGS, shutdown_LDADD)
2705
	(telinit_SOURCES, telinit_LDFLAGS, telinit_LDADD): Remove duplicate
2706
	entries mistakenly copied from compat/sysv
2707
1144 by Scott James Remnant
* util/sysv.c (sysv_change_runlevel): Pretty much the core compat
2708
	* util/sysv.c (sysv_change_runlevel): Pretty much the core compat
2709
	function for System V, generate a runlevel event and store the
2710
	appropriate things in utmp and wtmp.
2711
	* util/sysv.h: Prototype.
2712
	* util/tests/test_sysv.c: Test cases for the new function.
2713
	* util/Makefile.am (TESTS): Run the sysv test cases
2714
	(test_sysv_SOURCES, nodist_test_sysv_SOURCES, test_sysv_LDFLAGS)
2715
	(test_sysv_LDADD): Details for the sysv test cases, which obviously
2716
	depend on the auto-generated bindings code.
2717
1143 by Scott James Remnant
* util/utmp.c (utmp_write_runlevel): Make sure that it's ok to
2718
	* util/utmp.c (utmp_write_runlevel): Make sure that it's ok to
2719
	have no previous runlevel.
2720
	* util/tests/test_utmp.c (test_write_runlevel): Add no previous
2721
	runlevel test.
2722
1142 by Scott James Remnant
* util/utmp.c (utmp_read_runlevel): Don't call utmpxname() if we
2723
	* util/utmp.c (utmp_read_runlevel): Don't call utmpxname() if we
2724
	don't pass a utmp_file, letting glibc pick the default.
2725
	* util/tests/test_utmp.c (test_read_runlevel): Add a test case for
2726
	no filename.
2727
1141 by Scott James Remnant
* util/util.supp: utmpname leaks memory, so suppress it from valgrind
2728
	* util/util.supp: utmpname leaks memory, so suppress it from valgrind
2729
1140 by Scott James Remnant
* util/utmp.c: Set of functions for dealing with utmp and wtmp
2730
	* util/utmp.c: Set of functions for dealing with utmp and wtmp
2731
	(utmp_read_runlevel): Read the current runlevel from the file
2732
	(utmp_get_runlevel): Obtain the current runlevel from the
2733
	environment, or the file if not set
2734
	(utmp_write_runlevel): Write a runlevel change record, and also
2735
	deal with the reboot record if the utmp or wtmp files don't quite
2736
	match.
2737
	(utmp_write_shutdown): Write a shutdown time record
2738
	(utmp_entry, utmp_write, wtmp_write): utility functions for creating
2739
	and writing utmp and wtmp records.
2740
	* util/utmp.h: Prototypes for new functions.
2741
	* util/tests/test_utmp.c: Test cases.
2742
	* util/Makefile.am (test_utmp_SOURCES, test_utmp_LDFLAGS)
2743
	(test_utmp_LDADD): Details for utmp test cases
2744
	(tests): Move to the bottom of the file and make PHONY
2745
1139 by Scott James Remnant
* util/man/initctl.8: Improve the manpage.
2746
2009-07-07  Scott James Remnant  <scott@netsplit.com>
2747
2748
	* util/man/initctl.8: Improve the manpage.
2749
1138 by Scott James Remnant
* util/initctl.c: Rewrite from scratch, utilising the current
2750
2009-07-06  Scott James Remnant  <scott@netsplit.com>
2751
2752
	* util/initctl.c: Rewrite from scratch, utilising the current
2753
	D-Bus API and auto-generated method functions for it.
2754
	* util/tests/test_initctl.c: Rewrite from scratch to test all
2755
	of the new methods.
2756
	* util/Makefile.am (test_initctl_CFLAGS): Include AM_CFLAGS
2757
	(install-data-hook, install-exec-hook): Install a symlink for
2758
	"restart" as well.
2759
	* NEWS: Update.
2760
1132 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml: Add a "version" property to obtain
2761
2009-07-03  Scott James Remnant  <scott@netsplit.com>
2762
1137 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (Start, Stop, Restart): add
2763
	* dbus/com.ubuntu.Upstart.Instance.xml (Start, Stop, Restart): add
2764
	wait arguments to the instance commands as well.
2765
	* init/job.c (job_start, job_stop, job_restart): Add wait arguments,
2766
	when TRUE the functions behave as before; when FALSE the methods
2767
	return after changing the goal and no blocked entries are created.
2768
	* init/job.h: Amend prototypes.
2769
	* init/tests/test_job.c (test_start, test_stop, test_restart): 
2770
	Pass TRUE for wait and check for a blocking entry in existing tests,
2771
	add tests for passing FALSE and making sure that there's no blocking
2772
	but we still get the reply.
2773
1136 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (Start, Stop, Restart): Add wait
2774
	* dbus/com.ubuntu.Upstart.Job.xml (Start, Stop, Restart): Add wait
2775
	arguments to these too
2776
	* init/job_class.c (job_class_start, job_class_stop)
2777
	(job_class_restart): Add wait arguments, when TRUE the functions
2778
	behave as before; when FALSE the methods return after changing
2779
	the goal and no blocked entries are created.
2780
	* init/job_class.h: Amend prototypes.
2781
	* init/tests/test_job_class.c (test_start, test_stop, test_restart): 
2782
	Pass TRUE for wait and check for a blocking entry in existing tests,
2783
	add tests for passing FALSE and making sure that there's no blocking
2784
	but we still get the reply.
2785
	(test_get_name, test_get_description, test_get_author)
2786
	(test_get_version): Add missing code to free the class on enomem
2787
1135 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (EmitEvent): Add wait argument
2788
	* dbus/com.ubuntu.Upstart.xml (EmitEvent): Add wait argument
2789
	* init/control.c (control_emit_event): Add wait argument, when TRUE
2790
	this behaves as before; when FALSE the method returns after queuing
2791
	the event and no blocked entry is created for it.
2792
	* init/control.h: Amend prototype.
2793
	* init/tests/test_control.c (test_emit_event): Pass TRUE for wait
2794
	and check for a blocking entry in existing tests, add a test for
2795
	passing FALSE and making sure that there's no blocking but we
2796
	still get the reply.
2797
1134 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml: Add a "processes" property
2798
	* dbus/com.ubuntu.Upstart.Instance.xml: Add a "processes" property
2799
	to obtain the list of current job processes, both their type and
2800
	their pid.
2801
	* init/job.c (job_get_processes): Implement the new property accessor
2802
	* init/job.h: Add prototype
2803
	* init/tests/test_job.c (test_get_processes): Add test cases for
2804
	returning process arrays.
2805
	(test_get_name, test_get_goal, test_get_state): Add missing free
2806
	for job class.
2807
1133 by Scott James Remnant
* init/tests/test_control.c (test_emit_event): Directly acess
2808
	* init/tests/test_control.c (test_emit_event): Directly acess
2809
	the number from an NihDBusError
2810
1132 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml: Add a "version" property to obtain
2811
	* dbus/com.ubuntu.Upstart.xml: Add a "version" property to obtain
2812
	the version of the init daemon, and a "log_priority" property to
2813
	get and set the daemon's log priority.
2814
	* init/control.c (control_get_version, control_get_log_priority)
2815
	(control_set_log_priority): Methods to support the new properties
2816
	* init/control.h: Prototypes.
2817
	* init/tests/test_control.c (test_get_version)
2818
	(test_get_log_priority, test_set_log_priority): Add tests for the
2819
	property accessor functions.
2820
1129 by Scott James Remnant
* dbus/Makefile.am (EXTRA_DIST): Make sure we distribute it
2821
2009-07-02  Scott James Remnant  <scott@netsplit.com>
2822
1131 by Scott James Remnant
* dbus/Upstart.conf: Need to adjust the security configuration
2823
	* dbus/Upstart.conf: Need to adjust the security configuration
2824
	* dbus/upstart.h: And the constants as well.
2825
1130 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml,
2826
	* dbus/com.ubuntu.Upstart.xml,
2827
	* dbus/com.ubuntu.Upstart.Job.xml,
2828
	* dbus/com.ubuntu.Upstart.Instance.xml: Now we don't hardcode the
2829
	interface name anywhere, we can version it properly.
2830
	* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
2831
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
2832
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Update default interface
2833
	names.
2834
	* util/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
2835
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
2836
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Update here too.
2837
1129 by Scott James Remnant
* dbus/Makefile.am (EXTRA_DIST): Make sure we distribute it
2838
	* dbus/Makefile.am (EXTRA_DIST): Make sure we distribute it
2839
	* dbus/upstart.h: Add a header file with the usual D-Bus constants.
2840
	* init/control.h: Drop CONTROL_ROOT, replace with DBUS_PATH_UPSTART
2841
	* init/control.c (control_server_open, control_bus_open)
2842
	(control_register_all): Replace CONTROL_* constants with the new ones
2843
	(control_get_job_by_name): Use DBUS_INTERFACE_UPSTART when constructing
2844
	error names.
2845
	* init/job_class.c (job_class_new, job_class_register)
2846
	(job_class_unregister): Construct paths using DBUS_PATH_UPSTART
2847
	(job_class_get_instance)
2848
	(job_class_get_instance_by_name, job_class_start)
2849
	(job_class_stop, job_class_restart): Use DBUS_INTERFACE_UPSTART to
2850
	construct error names
2851
	* init/job.c (job_new): Construct path using DBUS_PATH_UPSTART
2852
	(job_finished, job_start, job_stop, job_restart): Use
2853
	DBUS_INTERFACE_UPSTART to construct error names.
2854
	* init/event.c (event_finished): Use DBUS_INTERFACE_UPSTART to
2855
	construct error name.
2856
	* init/tests/test_control.c (test_server_open): Don't hardcode
2857
	the address, extract the abstract path from the constant.
2858
	(test_server_connect, test_bus_open, test_emit_event): Don't
2859
	harcode addresses, paths or interfaces - use the constants
2860
	* init/tests/test_job_class.c (test_consider, test_reconsider)
2861
	(test_register, test_unregister, test_start, test_stop)
2862
	(test_restart, test_get_instance, test_get_instance_by_name):
2863
	Use the constants instead of harcoding.
2864
	(test_new): Derive the expected path from the constant
2865
	* init/tests/test_job.c (test_new): Derive the paths from the
2866
	constant, check for jobs by that interface constant.
2867
	(test_change_state): Use DBUS_INTERFACE_UPSTART_JOB
2868
	(test_start, test_stop, test_restart): Use DBUS_INTERFACE_UPSTART_INSTANCE,
2869
	and generate errors from DBUS_INTERFACE_UPSTART
2870
2871
	* dbus/com.ubuntu.Upstart.xml,
2872
	* dbus/com.ubuntu.Upstart.Job.xml,
2873
	* dbus/com.ubuntu.Upstart.Instance.xml: Remove the empty symbol
2874
	annotation for the interfaces.
2875
	* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
2876
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
2877
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Define the default
2878
	interface and build-time instead.
2879
	* util/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
2880
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
2881
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Likewise for util
2882
1126 by Scott James Remnant
* dbus/Upstart.conf: It doesn't make much sense to restrict getting
2883
2009-06-30  Scott James Remnant  <scott@netsplit.com>
2884
2885
	* dbus/Upstart.conf: It doesn't make much sense to restrict getting
2886
	the values of properties, or looking up jobs or interfaces, so make
2887
	these public.
2888
1122 by Scott James Remnant
* configure.ac: Bump version to 0.6.0
2889
2009-06-23  Scott James Remnant  <scott@netsplit.com>
2890
1125 by Scott James Remnant
* Makefile.am (SUBDIRS): Add util to the list of sub-directories
2891
	* Makefile.am (SUBDIRS): Add util to the list of sub-directories
2892
	again.
2893
	* configure.ac (AC_CONFIG_FILES): Generate util/Makefile
2894
	* util/Makefile.am (AM_CFLAGS): Append D-Bus CFLAGS
2895
	(AM_CPPFLAGS): Make sure the build directory is also in the quoted
2896
	include path
2897
	(nodist_initctl_SOURCES): Build and link the generated D-Bus
2898
	bindings, but don't distribute them
2899
	(initctl_LDADD): Drop the libupstart dependency, instead put
2900
	libnih-dbus and DBUS_LIBS in there.
2901
	(com_ubuntu_Upstart_OUTPUTS, com_ubuntu_Upstart_XML)
2902
	($(com_ubuntu_Upstart_OUTPUTS)): Auto-generate D-Bus binding code
2903
	to proxy the manager object
2904
	(com_ubuntu_Upstart_Job_OUTPUTS, com_ubuntu_Upstart_Job_XML)
2905
	($(com_ubuntu_Upstart_Job_OUTPUTS)): Auto-generate D-Bus binding
2906
	code to proxy job class objects
2907
	(com_ubuntu_Upstart_Instance_OUTPUTS)
2908
	(com_ubuntu_Upstart_Instance_XML)
2909
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Auto-generate D-Bus
2910
	binding code to proxy job instance objects
2911
	(BUILT_SOURCES, CLEANFILES): Built sources have to come first
2912
	and be cleaned up
2913
	(test_initctl_LDADD): Tests need to be linked to libnih-dbus
2914
	and the D-Bus libraries, as well as the auto-generated output
2915
	* init/Makefile.am (EXTRA_DIST): Drop the EXTRA_DIST for the
2916
	sources, already handled since they're in a different directory
2917
1124 by Scott James Remnant
* COPYING: Change licence to version 2 of the GNU GPL.
2918
	* COPYING: Change licence to version 2 of the GNU GPL.
2919
	All files have been updated to reflect this.
2920
1123 by Scott James Remnant
* init/paths.h (CONFFILE): Add new macro
2921
	* init/paths.h (CONFFILE): Add new macro
2922
	* init/Makefile.am (AM_CPPFLAGS): Add CONFFILE definition
2923
	(install-data-local): No need to make conf.d or jobs.d
2924
	* init/main.c: Only parse CONFFILE (/etc/init.conf) as a
2925
	configuration file source and CONFDIR (/etc/init) as a job
2926
	configuration source.
2927
1122 by Scott James Remnant
* configure.ac: Bump version to 0.6.0
2928
	* configure.ac: Bump version to 0.6.0
2929
	* NEWS: Copy in news from 0.5.3; that release doesn't appear in
2930
	this ChangeLog since it was made on a separate branch.  Begin
2931
	new release.
2932
1121 by Scott James Remnant
* util/man/initctl.8: Fix formatting of SYNOPSIS
2933
2009-06-18  Casey Dahlin  <cdahlin@redhat.com>
2934
2935
	* util/man/initctl.8: Fix formatting of SYNOPSIS
2936
1120 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
2937
2009-06-18  Scott James Remnant  <scott@netsplit.com>
2938
2939
	* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
2940
	dbus/com.ubuntu.Upstart.Instance.xml: Add a comment to these files
2941
	to clarify that you may communicate and interact with Upstart
2942
	through these interfaces without restriction.  It also makes sense
2943
	that these files be copied into software that does so to turn into
2944
	their own bindings, so use the FSF permissive licence for them.
2945
1111 by Scott James Remnant
* dbus/Upstart.conf: Update the D-Bus configuration based on newer
2946
2009-06-17  Scott James Remnant  <scott@netsplit.com>
2947
1119 by Scott James Remnant
* configure.ac: Bump version to 0.5.3
2948
	* configure.ac: Bump version to 0.5.3
2949
1118 by Scott James Remnant
* NEWS: Copy in news from 0.5.2; that release doesn't appear in
2950
	* NEWS: Copy in news from 0.5.2; that release doesn't appear in
2951
	this ChangeLog since it was made on a separate branch.
2952
1117 by Scott James Remnant
* NEWS: Include 0.3.10 release, which happened from a separate branch.
2953
	* NEWS: Include 0.3.10 release, which happened from a separate branch.
2954
1116 by Scott James Remnant
* init/parse_job.c (stanza_kill, stanza_respawn, stanza_nice)
2955
	* init/parse_job.c (stanza_kill, stanza_respawn, stanza_nice)
2956
	(stanza_oom): Check errno after using strtol() to avoid overflows.
2957
	(stanza_normal, stanza_umask, stanza_limit): Also check with
2958
	strtoul() too
2959
	* init/tests/test_parse_job.c (test_stanza_kill)
2960
	(test_stanza_respawn): Add test cases for the two that don't
2961
	check for overflow already.
2962
	(test_stanza_limit): Add test for the too large case where we don't
2963
	already cope.
2964
1115 by Scott James Remnant
* dbus/Upstart.conf: Allow root to obtain properties
2965
	* dbus/Upstart.conf: Allow root to obtain properties
2966
1114 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml: Add name, goal and state
2967
	* dbus/com.ubuntu.Upstart.Instance.xml: Add name, goal and state
2968
	properties to the instance
2969
	* init/job.c (job_get_name, job_get_goal, job_get_state): Add methods
2970
	to return the property values
2971
	* init/job.h: Add prototypes.
2972
	* init/tests/test_job.c (test_get_name, test_get_goal)
2973
	(test_get_state): Test cases.
2974
1113 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml: Add name, description, author
2975
	* dbus/com.ubuntu.Upstart.Job.xml: Add name, description, author
2976
	and version properties to the job
2977
	* init/job_class.c (job_class_get_name)
2978
	(job_class_get_description, job_class_get_author)
2979
	(job_class_get_version): Add methods to return the property values.
2980
	* init/job_class.h: Add prototypes
2981
1112 by Scott James Remnant
* init/job_process.c (job_process_error_abort): Don't abort() from
2982
	* init/job_process.c (job_process_error_abort): Don't abort() from
2983
	a child process, it confuses people; just exit with an interesting
2984
	error code (which we ignore anyway).
2985
1111 by Scott James Remnant
* dbus/Upstart.conf: Update the D-Bus configuration based on newer
2986
	* dbus/Upstart.conf: Update the D-Bus configuration based on newer
2987
	D-Bus recommended practice with a proper deny-by-default D-Bus,
2988
	making sure to not use send_interface without send_destination.
2989
	Allow introspection as well.
2990
1110 by Scott James Remnant
* init/job_process.c (job_process_spawn): Only attempt to set
2991
2009-06-17  Jeff Oliver  <Jeffrey.Oliver@panasonic.aero>
2992
2993
	* init/job_process.c (job_process_spawn): Only attempt to set
2994
	the OOM adjustment if set in the class, avoiding issue where /proc
2995
	is not mounted for the first job.
2996
	
1106 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml,
2997
2009-06-17  Scott James Remnant  <scott@netsplit.com>
2998
1109 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): Add test cases for a
2999
	* init/tests/test_job_process.c (test_handler): Add test cases for a
3000
	respawning job failing while it's post-start or pre-stop processes
3001
	are still running while making sure that it still respawns afterwards.
3002
	* init/job_process.c (job_process_terminated): To fix it, check for
3003
	a running post-start or pre-stop process before checking for a the
3004
	respawn.  That's not enough because then we won't respawn when the
3005
	existing process finishes, so use the goal as a hint.
3006
	* init/job.c (job_next_state): Use that hint goal here, remembering
3007
	to set the goal back to JOB_START afterwards.
3008
	(job_change_goal): Nothing to do in the respawn case
3009
	(job_goal_name, job_goal_from_name): Add the new values
3010
	* init/job.h (job_goal): Add the respawn goal
3011
	* init/tests/test_job.c (test_next_state): Add tests for the respawn
3012
	goal
3013
	(test_goal_name, test_goal_from_name): Tests for the new values
3014
1108 by Scott James Remnant
* configure.ac (AC_CONFIG_FILES): dbus goes before init just in case
3015
	* configure.ac (AC_CONFIG_FILES): dbus goes before init just in case
3016
	we ever do anything to them later
3017
1107 by Scott James Remnant
* init/job_class.c (job_class_register, job_class_unregister): Update
3018
	* init/job_class.c (job_class_register, job_class_unregister): Update
3019
	name of signal functions that we call.
3020
	(job_class_interfaces): No need to declare this separately
3021
	* init/job.c (job_register, job_change_state): Update name of signal
3022
	functions.
3023
	(job_interfaces): Drop, it comes from the generated header now
3024
	* init/control.c (manager_interfaces): Drop, comes from the header
3025
	as control_interfaces
3026
	(control_register_all): Change array name
3027
	* init/tests/test_job_class.c,
3028
	* init/tests/test_job.c,
3029
	* init/tests/test_control.c,
3030
	* init/tests/test_blocked.c: Rename conn member of NihDBusMessage
3031
	to connection
3032
1106 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml,
3033
	* dbus/com.ubuntu.Upstart.xml,
3034
	* dbus/com.ubuntu.Upstart.Job.xml,
3035
	* dbus/com.ubuntu.Upstart.Instance.xml: Use annotation to mark the
3036
	methods as async, rather than a namespaced attribute.  Omit the
3037
	interface symbol.
3038
	* init/Makefile.am (AM_CPPFLAGS): Add builddir to the quoted includes
3039
	(init_SOURCES): Don't distribute the auto-generated outputs
3040
	($(com_ubuntu_Upstart_OUTPUTS))
3041
	($(com_ubuntu_Upstart_Job_OUTPUTS))
3042
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Generate using the new
3043
	binary tool.
3044
	(BUILT_SOURCES): Remind myself why these are BUILT_SOURCES
3045
	(MAINTAINERCLEANFILES): Change to ordinary CLEANFILES
3046
	(EXTRA_DIST): outputs aren't distributed
3047
1101 by Scott James Remnant
* COPYING: Change licence from GPL-2+ to GPL-3 only.
3048
2009-05-22  Scott James Remnant  <scott@netsplit.com>
3049
1102 by Scott James Remnant
* init/tests/test_conf.c: Remove nih/inotify.h include
3050
	* init/tests/test_conf.c: Remove nih/inotify.h include
3051
1101 by Scott James Remnant
* COPYING: Change licence from GPL-2+ to GPL-3 only.
3052
	* COPYING: Change licence from GPL-2+ to GPL-3 only.
3053
1100 by Scott James Remnant
* init/tests/test_job.c,
3054
2009-05-17  Scott James Remnant  <scott@netsplit.com>
3055
3056
	* init/tests/test_job.c,
3057
	* init/tests/test_job_class.c,
3058
	* init/tests/test_control.c: Include nih-dbus/errors.h
3059
1095 by Scott James Remnant
* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)):
3060
2009-05-09  Scott James Remnant  <scott@netsplit.com>
3061
1099 by Scott James Remnant
* init/init.supp: setenv on tls/i686/cmov
3062
	* init/init.supp: setenv on tls/i686/cmov
3063
1098 by Scott James Remnant
* init/job_class.c (job_class_get_instance, job_class_start)
3064
	* init/job_class.c (job_class_get_instance, job_class_start)
3065
	(job_class_stop, job_class_restart): Clean up the code by using
3066
	nih_error_steal()
3067
1097 by Scott James Remnant
* init/conf.c (conf_source_reload_file, conf_source_reload_dir):
3068
	* init/conf.c (conf_source_reload_file, conf_source_reload_dir): 
3069
	Steal the error that we stash instead of getting it, otherwise we'll
3070
	fail if another one occurs.
3071
1096 by Scott James Remnant
* init/conf.c (conf_reload_path): Simply return, no need to re-raise
3072
	* init/conf.c (conf_reload_path): Simply return, no need to re-raise
3073
	the error.
3074
	* init/job_class.c (job_class_get_instance, job_class_start)
3075
	(job_class_stop, job_class_restart): If not ENOMEM, we need to
3076
	re-raise the error as a D-Bus one, that means we now have to free
3077
	the old error first (saving the msssage)
3078
	* init/job_process.c (job_process_error_read): Replace call to
3079
	nih_error_raise_again() with nih_error_raise_error()
3080
1095 by Scott James Remnant
* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)):
3081
	* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
3082
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
3083
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Use the Python variant
3084
	of nih-dbus-tool for now
3085
1091 by Scott James Remnant
* init/Makefile.am (AM_CPPFLAGS): Use -iquote$(srcdir) instead of -I
3086
2009-03-27  Scott James Remnant  <scott@netsplit.com>
3087
1094 by Scott James Remnant
* init/tests/test_process.c (test_from_name): Cast -1 to ProcessType
3088
	* init/tests/test_process.c (test_from_name): Cast -1 to ProcessType
3089
	* init/tests/test_job_process.c (test_kill, test_handler): Cast -1
3090
	to ProcessType
3091
	* init/tests/test_job.c (test_new, test_change_state): Cast -1
3092
	to ProcessType
3093
	(test_goal_from_name): Cast -1 to JobGoal
3094
	(test_state_from_name): Cast -1 to JobState
3095
	* init/tests/test_control.c (test_bus_open): Add braces
3096
1093 by Scott James Remnant
* init/Makefile.am (tests): Add rule to build test cases
3097
	* init/Makefile.am (tests): Add rule to build test cases
3098
	* util/Makefile.am (tests): Likewise
3099
1092 by Scott James Remnant
* init/job.c (job_interfaces): Put static first
3100
	* init/job.c (job_interfaces): Put static first
3101
	(job_emit_event): Cast -1 to ProcessType
3102
	(job_emit_event): Cast -1 to ProcessType
3103
	* init/job_class.c (job_class_interfaces): Put static first.
3104
	* init/job_process.c (job_process_kill_timer): Cast -1 to ProcessType
3105
	* init/control.c (manager_interfaces): Put static first
3106
1091 by Scott James Remnant
* init/Makefile.am (AM_CPPFLAGS): Use -iquote$(srcdir) instead of -I
3107
	* init/Makefile.am (AM_CPPFLAGS): Use -iquote$(srcdir) instead of -I
3108
	since we only need it to pick those paths up.
3109
	* util/Makefile.am (AM_CPPFLAGS): Likewise.
3110
1085 by Scott James Remnant
* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)):
3111
2009-02-20  Scott James Remnant  <scott@netsplit.com>
3112
1090 by Scott James Remnant
* util/initctl.c (handle_job_instance_end, handle_job_process)
3113
	* util/initctl.c (handle_job_instance_end, handle_job_process)
3114
	(handle_job_status_end, handle_event),
3115
	* util/shutdown.c (main): No need for new_* temporary variable when
3116
	looping over nih_realloc with NIH_MUST.
3117
1089 by Scott James Remnant
* util/initctl.c (job_info_output, output_name, handle_job_list)
3118
	* util/initctl.c (job_info_output, output_name, handle_job_list)
3119
	(handle_job_instance, handle_job_instance_end)
3120
	(handle_job_status, handle_job_process, handle_job_status_end)
3121
	(handle_event, env_option),
3122
	* util/telinit.c (main),
3123
	* util/shutdown.c (main, shutdown_now, timer_callback, wall): 
3124
1088 by Scott James Remnant
* init/event.c (event_init, event_pending_handle_jobs, event_finished),
3125
	* init/event.c (event_init, event_pending_handle_jobs, event_finished),
3126
	* init/event_operator.c (event_operator_events),
3127
	* init/job.c (job_emit_event, job_name),
3128
	* init/job_class.c (job_class_init, job_class_start)
3129
	(job_class_stop, job_class_restart),
3130
	* init/job_process.c (job_process_run, job_process_error_read)
3131
	(job_process_kill),
3132
	* init/conf.c (conf_init, conf_source_reload_file)
3133
	(conf_reload_path),
3134
	* init/control.c (control_init, control_server_connect)
3135
	(control_bus_open): Set variable outside of NIH_MUST macro.
3136
1087 by Scott James Remnant
* init/event.c (event_pending_handle_jobs): Set variable outside
3137
	* init/event.c (event_pending_handle_jobs): Set variable outside
3138
	of NIH_SHOULD macro.
3139
1085 by Scott James Remnant
* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)):
3140
	* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
3141
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
3142
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Update expected path
3143
	of nih-dbus-tool
3144
3145
	* configure.ac: Create nih-dbus-tool Makefile
3146
	* Makefile.am (SUBDIRS): Build in nih-dbus-tool
3147
1071 by Scott James Remnant
* init/conf.c (conf_source_reload): The ConfFile destructor has
3148
2009-01-29  Scott James Remnant  <scott@netsplit.com>
3149
1084 by Scott James Remnant
* configure.ac: Bump version to 0.5.2
3150
	* configure.ac: Bump version to 0.5.2
3151
	* NEWS: Begin 0.5.2
3152
3153
	* NEWS: Copy in news from 0.5.1; that release doesn't appear in
3154
	this ChangeLog since it was made on a separate branch.
3155
1083 by Scott James Remnant
* init/tests/test_blocked.c (test_new),
3156
	* init/tests/test_blocked.c (test_new),
3157
	* init/tests/test_control.c (test_get_job_by_name)
3158
	(test_get_all_jobs, test_emit_event),
3159
	* init/tests/test_event.c (test_finished),
3160
	* init/tests/test_job.c (test_change_state),
3161
	* init/tests/test_job_class.c (test_get_instance)
3162
	(test_get_instance_by_name, test_get_all_instances): Continue the
3163
	battle with the gcc optimiser which declares variables first used
3164
	inside TEST_ALLOC_FAIL as used uninitialized.
3165
1081 by Scott James Remnant
* init/parse_job.c (parse_exec, parse_script, stanza_instance)
3166
	* init/parse_job.c (parse_exec, parse_script, stanza_instance)
3167
	(stanza_description, stanza_author, stanza_version)
3168
	(stanza_start, stanza_stop, stanza_chroot, stanza_chdir):
3169
	Unreference members when replacing them instead of freeing; not
3170
	strictly necessary but the style is the thing.
3171
1080 by Scott James Remnant
* init/job_process.c (job_process_terminated): Unreference the
3172
	* init/job_process.c (job_process_terminated): Unreference the
3173
	kill timer instead of freeing
3174
1079 by Scott James Remnant
* init/job_class.c (job_class_get_instance): Use nih_local for
3175
	* init/job_class.c (job_class_get_instance): Use nih_local for
3176
	instance environment and name
3177
	(job_class_start, job_class_stop, job_class_restart):
3178
	Unreference job environment instead of freeing
3179
1078 by Scott James Remnant
* init/job.c (job_change_state, job_start, job_stop, job_restart):
3180
	* init/job.c (job_change_state, job_start, job_stop, job_restart):
3181
	Unreference job environment instead of freeing
3182
	(job_name): Discard job name in case a reference was taken.
3183
1077 by Scott James Remnant
* init/event.c (event_pending_handle_jobs): Unreference the job
3184
	* init/event.c (event_pending_handle_jobs): Unreference the job
3185
	environment instead of freeing
3186
1076 by Scott James Remnant
* init/environ.c (environ_add): should unreference the old environment
3187
	* init/environ.c (environ_add): should unreference the old environment
3188
	string in case anyone took a ref elsewhere
3189
	(environ_set): use nih_local for str
3190
	(environ_expand_until): Should set *str to NULL if we free it,
3191
	just in case.
3192
1075 by Scott James Remnant
* init/conf.c (conf_source_reload): File should be unreferenced,
3193
	* init/conf.c (conf_source_reload): File should be unreferenced,
3194
	not freed.
3195
	(conf_source_reload_file): Use nih_local for dpath
3196
	(conf_delete_handler): Watch and file should be unreferenced,
3197
	not freed.
3198
	(conf_reload_path): File should be unreferenced, not freed;
3199
	use nih_local for file buffer
3200
1074 by Scott James Remnant
* init/blocked.c (blocked_new),
3201
	* init/blocked.c (blocked_new),
3202
	* init/conf.c (conf_source_new, conf_file_new),
3203
	* init/event.c (event_new),
3204
	* init/event_operator.c (event_operator_new),
3205
	* init/job.c (job_new),
3206
	* init/job_class.c (job_class_new): No need to cast function
3207
	argument to nih_alloc_set_destructor()
3208
1073 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): We can't just
3209
	* init/tests/test_job_process.c (test_handler): We can't just
3210
	assume that our child is sitting at the signal otherwise we might
3211
	end up sending the CONT signal before it's even stopped.  Use
3212
	waitid() to wait for the child to stop first.
3213
1072 by Scott James Remnant
* init/init.supp: More expressions for environment memory which
3214
	* init/init.supp: More expressions for environment memory which
3215
	valgrind can't deal with
3216
1071 by Scott James Remnant
* init/conf.c (conf_source_reload): The ConfFile destructor has
3217
	* init/conf.c (conf_source_reload): The ConfFile destructor has
3218
	side-effects that involve the iteration of the sources and their
3219
	files, so we can't simply call it while iterating because of the
3220
	cursor.  Move the sources into a deleted list first, and delete
3221
	them from there.
3222
	* init/conf.h: Fix prototype.
3223
	* init/tests/test_conf.c (test_source_reload_job_dir): Test pointers
3224
	with TEST_EQ_P not TEST_EQ
3225
1038 by Scott James Remnant
* init/blocked.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3226
2009-01-28  Scott James Remnant  <scott@netsplit.com>
3227
1070 by Scott James Remnant
* init/job_class.c (job_class_start): We can't create the blocked
3228
	* init/job_class.c (job_class_start): We can't create the blocked
3229
	until we know we're going to block, otherwise we could ref and unref
3230
	the message (freeing it).  Wait until the job is created, which
3231
	means we can't fail to create the blocked item (we'll already have
3232
	announced the new instance).
3233
	(job_class_stop, job_class_restart): For consistency, don't fail
3234
	if OOM when making blocked.
3235
1069 by Scott James Remnant
* init/tests/test_job.c (test_new): Initialise a bunch of subsystems
3236
	* init/tests/test_job.c (test_new): Initialise a bunch of subsystems
3237
	outside of TEST_ALLOC_FAIL
3238
1068 by Scott James Remnant
* init/environ.c (environ_add): We can't allocate nih_local with
3239
	* init/environ.c (environ_add): We can't allocate nih_local with
3240
	a context, it won't be freed; so don't, but then remember to
3241
	reference it when we do just use it.
3242
1067 by Scott James Remnant
* init/event.c (event_pending_handle_jobs): Must reset the start_on
3243
	* init/event.c (event_pending_handle_jobs): Must reset the start_on
3244
	operator in case of error.
3245
1066 by Scott James Remnant
* init/job_process.c (job_process_kill_timer): Oops, move the
3246
	* init/job_process.c (job_process_kill_timer): Oops, move the
3247
	assert that we have a process pid to after we know which process
3248
	we have.
3249
	* init/tests/test_job_process.c (test_run): Initialise the
3250
	error context and NihIo outside of TEST_ALLOC_FAIL
3251
	(test_kill): Initialise timers and the event system.
3252
	* init/init.supp: Reference from the jobs hash to the bins is
3253
	still reachable, obviously; as is the string inside job_name()
3254
	either way it is allocated
3255
1065 by Scott James Remnant
* init/tests/test_parse_job.c (test_parse_job): Initialise the
3256
	* init/tests/test_parse_job.c (test_parse_job): Initialise the
3257
	error context outside of TEST_ALLOC_FAIL
3258
1064 by Scott James Remnant
* init/init.supp: Update suppressions for new nih_alloc()
3259
	* init/init.supp: Update suppressions for new nih_alloc()
3260
1063 by Scott James Remnant
* init/job_process.c (job_process_run): Had the shell variable
3261
	* init/job_process.c (job_process_run): Had the shell variable
3262
	setting round the wrong way, now it should be ok.
3263
1062 by Scott James Remnant
* init/tests/test_blocked.c (test_new): in the case of allocation
3264
	* init/tests/test_blocked.c (test_new): in the case of allocation
3265
	failure, the message should not be referenced; which we test by
3266
	trying to discard it and seeing whether that works.
3267
1061 by Scott James Remnant
* init/job.c (job_emit_event): event_new() only references the
3268
	* init/job.c (job_emit_event): event_new() only references the
3269
	environment now, so use nih_local to make sure we clean it up
3270
	if that doesn't happen
3271
1060 by Scott James Remnant
* init/job.h (Job): Add kill_process member
3272
	* init/job.h (Job): Add kill_process member
3273
	* init/job.c (job_new): Initialise to -1
3274
	* init/job_process.c (job_process_kill): Store the process to be
3275
	killed in the kill_process member for the timer, since we can't
3276
	pass two sets of data.  Assert that it's not set to anything, this
3277
	all needs fixing, obviously.
3278
	(job_process_kill_timer): Take the job as the data argument,
3279
	eliminating the need for nih_alloc_parent().  Sanity check the job
3280
	and reset kill_timer and kill_process when done.
3281
	(job_process_terminated): Clear the kill_process field too.
3282
	* init/tests/test_job.c (test_new): Check it's -1
3283
	(test_change_state): Check kill_process is set to PROCESS_MAIN
3284
	when active, or -1 when not.
3285
	* init/tests/test_job_process.c (test_kill): Make sure the
3286
	kill_process member is set and cleared.
3287
	(test_handler): Set the kill_process member for the timer and make
3288
	sure it's cleared when appropriate.
3289
1059 by Scott James Remnant
* init/job_class.c (job_class_start, job_class_stop)
3290
	* init/job_class.c (job_class_start, job_class_stop)
3291
	(job_class_restart): Use nih_local to eliminate nih_alloc_reparent,
3292
	and to clean up some of the code too.
3293
1058 by Scott James Remnant
* init/job_class.c: Update documentation to match new nih_alloc()
3294
	* init/job_class.c: Update documentation to match new nih_alloc()
3295
1057 by Scott James Remnant
* init/parse_job.c (parse_on_operator, parse_on_collect):
3296
	* init/parse_job.c (parse_on_operator, parse_on_collect):
3297
	Use an nih_ref/nih_unref pair instead of nih_alloc_reparent; this
3298
	is not ideal, but then this code is rather messy and leaves a lot
3299
	of allocated data attached to the object on the assumption that
3300
	it will be thrown away.
3301
1056 by Scott James Remnant
* init/event_operator.c: Update documentation to match new nih_alloc()
3302
	* init/event_operator.c: Update documentation to match new nih_alloc()
3303
	(event_operator_match): Use nih_local on expanded value.
3304
	(event_operator_environment): Make evlist nih_local, it will be
3305
	referenced by the environment array on success
3306
1055 by Scott James Remnant
* init/event_operator.c (event_operator_new): Reference the
3307
	* init/event_operator.c (event_operator_new): Reference the
3308
	event instead of reparenting it.
3309
1054 by Scott James Remnant
* init/event.c: Update documentation to match new nih_alloc()
3310
	* init/event.c: Update documentation to match new nih_alloc()
3311
	(event_finished): Use nih_local to tidy up a slight bit.
3312
1053 by Scott James Remnant
* init/event.c (event_new): Reference the event, don't reparent
3313
	* init/event.c (event_new): Reference the event, don't reparent
3314
	(event_pending_handle_jobs): Use nih_local for environment array
3315
	and for the job name, damn I love this thing.  Reference the array
3316
	into the job to avoid freeing.
3317
1052 by Scott James Remnant
* init/parse_job.c (parse_job): Update documentation to match
3318
	* init/parse_job.c (parse_job): Update documentation to match
3319
	new nih_alloc()
3320
	(parse_process, parse_on_operator, stanza_start, stanza_stop)
3321
	(stanza_expect, stanza_kill, stanza_respawn, stanza_normal)
3322
	(stanza_session, stanza_console, stanza_nice, stanza_umask)
3323
	(stanza_oom, stanza_limit): Use nih_local for all the temporary
3324
	arguments where we can.
3325
1051 by Scott James Remnant
* init/parse_job.c (parse_on_operand, stanza_env, stanza_export)
3326
	* init/parse_job.c (parse_on_operand, stanza_env, stanza_export)
3327
	(stanza_emits): Make temporary string variables use nih_local,
3328
	this gives us a massive code clean-up and makes nih_str_array_addp
3329
	safe to take a reference.
3330
1050 by Scott James Remnant
* init/job_process.c (job_process_run): Make argv, env, script and
3331
	* init/job_process.c (job_process_run): Make argv, env, script and
3332
	cmd all use nih_local, this cleans up the code a little and makes
3333
	nih_str_array_addp safe to take a reference.
3334
1049 by Scott James Remnant
* init/environ.c: Update documentation to match new nih_alloc()
3335
	* init/environ.c: Update documentation to match new nih_alloc()
3336
1048 by Scott James Remnant
* init/tests/test_job_process.c (test_run): Check that trailing
3337
	* init/tests/test_job_process.c (test_run): Check that trailing
3338
	newlines are ignored when running a script (can verify r1025 is
3339
	fixed with gdb)
3340
1047 by Scott James Remnant
* init/tests/test_environ.c (test_expand): Add a test case for the
3341
	* init/tests/test_environ.c (test_expand): Add a test case for the
3342
	bug fixed in r1027, the implicit case of the gap in the environment
3343
	string being the same size as the value replacing it.
3344
1046 by Scott James Remnant
* init/environ.c (environ_add): Use nih_local for new_str, making
3345
	* init/environ.c (environ_add): Use nih_local for new_str, making
3346
	the code paths a little simpler and ensuring we pass something that
3347
	can be referenced to nih_str_array_addp()
3348
1045 by Scott James Remnant
* init/tests/test_event.c (test_new): Make sure that env is an
3349
	* init/tests/test_event.c (test_new): Make sure that env is an
3350
	orphan with TEST_ALLOC_ORPHAN.
3351
	* init/tests/test_event_operator.c (test_operator_new): Make sure
3352
	that env is an orphan with TEST_ALLOC_ORPHAN.
3353
	(test_operator_copy): Drop pointless NULL parent check.
3354
1044 by Scott James Remnant
* init/tests/test_control.c: Include limits.h
3355
	* init/tests/test_control.c: Include limits.h
3356
1043 by Scott James Remnant
* init/blocked.c (blocked_new): Take a reference to the message,
3357
	* init/blocked.c (blocked_new): Take a reference to the message,
3358
	otherwise it will be freed; we free the Blocked structure when we're
3359
	done, so will automatically unref the message.
3360
	* init/tests/test_blocked.c (test_new): Add tests to make sure the
3361
	reference is taken.
3362
	* init/tests/test_job.c (test_start, test_stop, test_restart):
3363
	Make sure the message is referenced when an error is not returned
3364
	but not referenced when one is.
3365
	* init/tests/test_job_class.c (test_start, test_stop)
3366
	(test_restart): Make sure the message is referenced when an error
3367
	is not returned but not referenced when one is.
3368
	* init/tests/test_control.c (test_emit_event): Make sure that
3369
	the message is referenced.
3370
1042 by Scott James Remnant
* init/tests/test_blocked.c: Change nih/dbus.h include to
3371
	* init/tests/test_blocked.c: Change nih/dbus.h include to
3372
	nih-dbus/dbus_message.h
3373
	* init/tests/test_control.c: Change nih/dbus.h include to error,
3374
	connection and object; include D-Bus test macros.
3375
	* init/tests/test_job.c: Change nih/dbus.h include to error, message
3376
	and object; include D-Bus test macros
3377
	* init/tests/test_job_class.c: Change nih/dbus.h include to error,
3378
	message and object; include D-Bus test macros
3379
1041 by Scott James Remnant
* init/job_class.h: Change nih/dbus.h include to
3380
	* init/job_class.h: Change nih/dbus.h include to
3381
	nih-dbus/dbus_message.h and include the actual D-Bus header
3382
	* init/job_class.c: Change nih/dbus.h include to error, message,
3383
	object and util.
3384
1040 by Scott James Remnant
* init/job.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3385
	* init/job.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3386
	and include the actual D-Bus header
3387
	* init/job.c: Change nih/dbus.h include to error, message, object
3388
	and util.
3389
1039 by Scott James Remnant
* init/control.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3390
	* init/control.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3391
	and include the actual D-Bus header
3392
	* init/control.c: Change nih/dbus.h include to error, connection,
3393
	message and object includes.
3394
1038 by Scott James Remnant
* init/blocked.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3395
	* init/blocked.h: Change nih/dbus.h include to nih-dbus/dbus_message.h
3396
	* init/blocked.c: Change nih/dbus.h include to nih-dbus/dbus_message.h
3397
1037 by Scott James Remnant
* init/Makefile.am: Update paths to libnih-dbus dependencies.
3398
2009-01-27  Scott James Remnant  <scott@netsplit.com>
3399
3400
	* init/Makefile.am: Update paths to libnih-dbus dependencies.
3401
1028 by Scott James Remnant
* README: Update features and requirements.
3402
2009-01-26  Scott James Remnant  <scott@netsplit.com>
3403
1036 by Scott James Remnant
* configure.ac (AC_CONFIG_FILES): Add nih-dbus sub-directory
3404
	* configure.ac (AC_CONFIG_FILES): Add nih-dbus sub-directory
3405
	* Makefile.am (SUBDIRS): Add nih-dbus sub-directory
3406
1035 by Scott James Remnant
* configure.ac: Bump copyright to 2009
3407
	* configure.ac: Bump copyright to 2009
3408
1034 by Scott James Remnant
* configure.ac: Matching libnih, we now mandate libtool 2.2.x
3409
	* configure.ac: Matching libnih, we now mandate libtool 2.2.x
3410
	* HACKING: Update dependency requirement to 2.2.4
3411
1033 by Scott James Remnant
* init/init.supp: Adjust suppression for glibc 2.8
3412
	* init/init.supp: Adjust suppression for glibc 2.8
3413
1032 by Scott James Remnant
* init/tests/test_event.c (test_finished): Remove erroneous test
3414
	* init/tests/test_event.c (test_finished): Remove erroneous test
3415
	of free'd memory.
3416
1031 by Scott James Remnant
* configure.ac: Bump version to 0.5.1
3417
	* configure.ac: Bump version to 0.5.1
3418
1029 by Scott James Remnant
* init/tests/test_event_operator.c (test_operator_handle): Add a
3419
	* init/tests/test_event_operator.c (test_operator_handle): Add a
3420
	test for duplicate events when already matched.
3421
	* init/event_operator.c (event_operator_handle): Skip if already
3422
	matched.
3423
1028 by Scott James Remnant
* README: Update features and requirements.
3424
	* README: Update features and requirements.
3425
	* NEWS: Copy in news from 0.5.0; that release doesn't appear in
3426
	this ChangeLog since it was made on a separate branch.
3427
1027 by Scott James Remnant
* init/environ.c (environ_expand_until): Handle the implicit case
3428
2009-01-26  Casey Dahlin  <cdahlin@redhat.com>
3429
3430
	* init/environ.c (environ_expand_until): Handle the implicit case
3431
	of the gap in the string being the same size of the value.
1026 by Scott James Remnant
* init/job_process.c (job_process_handler): Handle the case of a
3432
3433
	* init/job_process.c (job_process_handler): Handle the case of a
3434
	child being continued by a signal, otherwise we'll assert.
1025 by Scott James Remnant
* init/job_process.c (job_process_run): Double-check that the
3435
3436
	* init/job_process.c (job_process_run): Double-check that the
3437
	newline(s) we see are at the end of the script before stripping,
3438
	since we can fall through if the newline is mid-script but /dev/fd
3439
	isn't mounted.
3440
1024 by Scott James Remnant
* TODO: Update.
3441
2008-07-05  Scott James Remnant  <scott@netsplit.com>
3442
3443
	* TODO: Update.
3444
1023 by Scott James Remnant
* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)):
3445
2008-07-01  Scott James Remnant  <scott@netsplit.com>
3446
3447
	* init/Makefile.am ($(com_ubuntu_Upstart_OUTPUTS)): 
3448
	($(com_ubuntu_Upstart_Job_OUTPUTS)): 
3449
	($(com_ubuntu_Upstart_Instance_OUTPUTS)): Must be newer than the
3450
	source for the dbus tool, and ensure the dbus tool is built
3451
1022 by Scott James Remnant
* init/Makefile.am: Update along with libnih so that we leave the
3452
2008-06-30  Scott James Remnant  <scott@netsplit.com>
3453
3454
	* init/Makefile.am: Update along with libnih so that we leave the
3455
	D-Bus bindings in the dist tarball, meaning Python is no longer a
3456
	build-dependency.
3457
1020 by Scott James Remnant
* Makefile.am (SUBDIRS): List po last so that update-po is run after
3458
2008-06-11  Scott James Remnant  <scott@netsplit.com>
3459
1021 by Scott James Remnant
* Makefile.am (SUBDIRS): List dbus before init in case we need to
3460
	* Makefile.am (SUBDIRS): List dbus before init in case we need to
3461
	generate anything in that directory later on.
3462
	
1020 by Scott James Remnant
* Makefile.am (SUBDIRS): List po last so that update-po is run after
3463
	* Makefile.am (SUBDIRS): List po last so that update-po is run after
3464
	generating any sources.
3465
1009 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (Start, Stop, Restart): Add methods
3466
2008-06-08  Scott James Remnant  <scott@netsplit.com>
3467
1019 by Scott James Remnant
* init/Makefile.am (EXTRA_DIST): Ship the built sources, don't
3468
	* init/Makefile.am (EXTRA_DIST): Ship the built sources, don't
3469
	clean them.
3470
	(maintainer-clean-local): Well, not unless maintainer-clean anyway
3471
3472
	* init/job.c, init/job_class.c: Add missing errno.h include
3473
1016 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (GetInstance): Add method to get
3474
	* dbus/com.ubuntu.Upstart.Job.xml (GetInstance): Add method to get
3475
	an instance name in the same basic manner as start and stop would,
3476
	though this one's synchronous.
3477
	* init/job_class.c (job_class_get_instance): Implementing by copying
3478
	the relevant bit of Stop.
3479
	* init/job_class.h: Add prototype.
3480
	* init/tests/test_job_class.c (test_get_instance): Add tests.
3481
	* TODO: Continue to document the C&P madness.
3482
1015 by Scott James Remnant
* init/conf.c (conf_reload_path): Read file directly into memory,
3483
	* init/conf.c (conf_reload_path): Read file directly into memory,
3484
	not using mmap.
3485
1014 by Scott James Remnant
* compat/sysv/reboot.c, compat/sysv/runlevel.c, compat/sysv/shutdown.c,
3486
	* compat/sysv/reboot.c, compat/sysv/runlevel.c, compat/sysv/shutdown.c,
3487
	* compat/sysv/telinit.c: Move into the util directory; we're going
3488
	to support limited SysV-a-like commands without full compatibility
3489
	which is what we always did, and I'm not going to worry about adding
3490
	others.
3491
	* compat/sysv/man/reboot.8, compat/sysv/runlevel.8,
3492
	* compat/sysv/man/shutdown.8, compat/sysv/telinit.8: Move as well.
3493
	* compat/sysv/Makefile.am, util/Makefile.am: Merge.
3494
	* configure.ac: Remove the (commented out) compat/sysv and logd
3495
	Remove the --enable-compat option.
3496
	* Makefile.am (SUBDIRS): Remove (commented out) compat/sysv and logd
3497
1013 by Scott James Remnant
* logd/Makefile.am, logd/main.c, logd/man/logd.8, logd/jobs.d/logd.in:
3498
	* logd/Makefile.am, logd/main.c, logd/man/logd.8, logd/jobs.d/logd.in:
3499
	Consign logd to oblivion.  We haven't supported it for ages, it has
3500
	non-working issues, and there's got to be a better way to do this.
3501
1012 by Scott James Remnant
* TODO: Update.
3502
	* TODO: Update.
3503
1011 by Scott James Remnant
* init/job.c (job_change_goal): Adjust the documentation. After
3504
	* init/job.c (job_change_goal): Adjust the documentation.  After
3505
	careful thought, there's no way this can return after freeing the
3506
	job, since it'll either block on an event, a process or do nothing.
3507
1010 by Scott James Remnant
* init/job.c (job_start, job_stop, job_restart): Clear the start
3508
	* init/job.c (job_start, job_stop, job_restart): Clear the start
3509
	and stop environment, shouldn't necessarily make a difference, but
3510
	it pays to be consistent.
3511
1009 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (Start, Stop, Restart): Add methods
3512
	* dbus/com.ubuntu.Upstart.Job.xml (Start, Stop, Restart): Add methods
3513
	to control jobs, all take an environment array and both Start and
3514
	Restart return an instance path so properties, etc. can be obtained
3515
	afterwards.
3516
	* init/job_class.c (job_class_start, job_class_stop)
3517
	(job_class_restart): Add the code for the top halves of the methods
3518
	* init/job_class.h: Add prototypes for the new methods.
3519
	* init/job.c (job_finished): And the bottom halves go here.
3520
	* init/tests/test_job_class.c (test_start, test_stop)
3521
	(test_restart): Add test cases for the methods.
3522
	* init/blocked.h (blocked_type): Add enums for the new methods.
3523
	* init/blocked.c (blocked_new): Handle the new methods here.
3524
	* init/tests/test_blocked.c (test_new): Add add tests for handling.
3525
998 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (Start, Stop, Restart): Add
3526
2008-06-07  Scott James Remnant  <scott@netsplit.com>
3527
1008 by Scott James Remnant
* init/job_process.c (job_process_terminated): Don't check the goal
3528
	* init/job_process.c (job_process_terminated): Don't check the goal
3529
	to see whether the main process was allowed to terminate, check the
3530
	state.  A termination is only not a failure if we're on the KILLED
3531
	state (ie. we killed it), otherwise it can still be a failure even
3532
	if it was going to stop anyway.
3533
	* init/tests/test_job_process.c (test_handler): Add a test case.
3534
1007 by Scott James Remnant
* init/control.c (control_emit_event): Use environ_all_valid here(),
3535
	* init/control.c (control_emit_event): Use environ_all_valid here(),
3536
	also reorder the blocking stuff to be less strange, it's ok to free
3537
	environment.
3538
	* init/tests/test_control.c (test_emit_event): The event array should
3539
	be a child of message, which means it doesn't matter if the function
3540
	we call frees it.
3541
1006 by Scott James Remnant
* init/environ.c (environ_all_valid): Add a validation function for
3542
	* init/environ.c (environ_all_valid): Add a validation function for
3543
	external input.
3544
	* init/environ.h: Add prototype.
3545
	* init/tests/test_environ.c (test_all_valid): Test function.
3546
1005 by Scott James Remnant
* init/environ.c: Note that we can call this in a loop with OOM,
3547
	* init/environ.c: Note that we can call this in a loop with OOM,
3548
	since the resulting table will always be the same.
3549
1004 by Scott James Remnant
* init/event_operator.c (event_operator_environment): Use
3550
	* init/event_operator.c (event_operator_environment): Use
3551
	environ_append(), and while we're at it, there's no reason this should
3552
	use NIH_MUST.
3553
	* init/event_operator.h: Adjust prototype.
3554
	* init/tests/test_event_operator.c (test_operator_environment): Allow
3555
	for failure.
3556
	* init/event.c (event_pending_handle_jobs): Call with NIH_MUST,
3557
	which is actually safe.
3558
1003 by Scott James Remnant
* init/job_class.c (job_class_environment): Use environ_append()
3559
	* init/job_class.c (job_class_environment): Use environ_append()
3560
1002 by Scott James Remnant
* init/environ.c (environ_append): There are multiple cases where we
3561
	* init/environ.c (environ_append): There are multiple cases where we
3562
	append one environment table onto another, so we should have a
3563
	function to do that.
3564
	* init/environ.h: Prototype for it.
3565
	* init/tests/test_environ.c (test_append): Test the new function.
3566
1001 by Scott James Remnant
* init/job_process.c (job_process_run): Invert the logic; we nearly
3567
	* init/job_process.c (job_process_run): Invert the logic; we nearly
3568
	always want to pass the script with /dev/fd/NNN.  The only times we
3569
	don't are if it doesn't exist, or if we're dealing with a single-line
3570
	shell script.
3571
	* init/tests/test_job_process.c (test_run): Update test cases to
3572
	only expect an argv-execution for single-line scripts.
3573
1000 by Scott James Remnant
* init/job.c (job_restart): Wrote the blocking bit slightly weirdly
3574
	* init/job.c (job_restart): Wrote the blocking bit slightly weirdly
3575
	without neededing to, so leave it as it should be.
3576
999 by Scott James Remnant
* TODO: Update.
3577
	* TODO: Update.
3578
998 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml (Start, Stop, Restart): Add
3579
	* dbus/com.ubuntu.Upstart.Instance.xml (Start, Stop, Restart): Add
3580
	simple instance control methods, these only change the goal of an
3581
	existing instance - thus cannot pass environment.
3582
	* init/job.c (job_start, job_stop, job_restart): Add methods, which
3583
	look spookily similar to each other, except for the subtle yet
3584
	important differences.
3585
	(job_finished): Implement bottom halves.
3586
	* init/job.h: Add prototypes.
3587
	* init/tests/test_job.c (test_start, test_stop, test_restart): Add
3588
	tests for the new methods.
3589
	* init/blocked.h (blocked_type): Add enums for methods.
3590
	* init/blocked.c (blocked_new): Handle methods here too
3591
	* init/tests/test_blocked.c (test_new): Add tests for them.
3592
992 by Scott James Remnant
* init/event.c (event_new): There's no reason this shouldn't be
3593
2008-06-06  Scott James Remnant  <scott@netsplit.com>
3594
997 by Scott James Remnant
* init/blocked.h (blocked_type): Having a single message type won't
3595
	* init/blocked.h (blocked_type): Having a single message type won't
3596
	work for the job cases, so expand to have many.
3597
	* init/blocked.c (blocked_new): We'll just have to list them all here.
3598
	* init/control.c (control_emit_event): Happily we create them
3599
	individually anyway.
3600
	* init/event.c (event_finished): And since we have to handle them
3601
	individually, it'll actually protect us replying to the wrong one.
3602
996 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload): Clean up the temporary
3603
	* init/tests/test_conf.c (test_source_reload): Clean up the temporary
3604
	directory.
3605
	* init/tests/test_control.c (test_reload_configuration): That goes
3606
	for this one too.
3607
995 by Scott James Remnant
* init/tests/test_control.c (my_connect_handler): Use TEST_DBUS_MESSAGE
3608
	* init/tests/test_control.c (my_connect_handler): Use TEST_DBUS_MESSAGE
3609
	instead of a pop/read/write loop.
3610
	(test_emit_event): Renamed TEST_DBUS_CONN to TEST_DBUS_OPEN.
3611
	* init/tests/test_job.c (test_new, test_register)
3612
	(test_change_state): Use TEST_DBUS_OPEN and TEST_DBUS_CLOSE to setup
3613
	and tear down D-Bus connections and TEST_DBUS_MESSAGE instead of
3614
	a loop.
3615
	* init/tests/test_job_class.c (test_consider, test_reconsider)
3616
	(test_register, test_unregister): Likewise.
3617
994 by Scott James Remnant
* init/control.c (control_get_job_by_name): Sanity check the name
3618
	* init/control.c (control_get_job_by_name): Sanity check the name
3619
	of a job in the same way; we don't need to sanity check the instance
3620
	name because "" is valid (and the default for singletons).
3621
	* init/tests/test_control.c (test_get_job_by_name): Test.
3622
993 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (EmitEvent): Add an asynchronous
3623
	* dbus/com.ubuntu.Upstart.xml (EmitEvent): Add an asynchronous
3624
	method to emit an event, providing the name and accompanying
3625
	environment.  No return value, it either works or you get an
3626
	error.
3627
	* init/control.c (control_emit_event): Implement top half of the
3628
	method, blocking the message in the event.
3629
	* init/control.h: Add prototype.
3630
	* init/event.c (event_finished): Implement the bottom half which
3631
	sends the reply or error, these are actually tested along with
3632
	the top for sanity reasons.
3633
	* init/tests/test_control.c (test_emit_event): Test the various
3634
	ways the method may be used and abused; the async nature means
3635
	we actually need a real D-Bus server to do this.
3636
	* TODO: Update.
3637
992 by Scott James Remnant
* init/event.c (event_new): There's no reason this shouldn't be
3638
	* init/event.c (event_new): There's no reason this shouldn't be
3639
	allowed to return insufficient memory, so do so.
3640
	(event_finished): Wrap call.
3641
	* init/tests/test_event.c (test_new): Add alloc failed test.
3642
	* init/job.c (job_emit_event): Must create the event.
3643
	* init/main.c (main, cad_handler, kbd_handler, pwr_handler): Wrap
3644
	with NIH_MUST
3645
973 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (JobAdded, JobRemoved): Add signals
3646
2008-06-05  Scott James Remnant  <scott@netsplit.com>
3647
991 by Scott James Remnant
* TODO: Update.
3648
	* TODO: Update.
3649
990 by Scott James Remnant
* init/job.c (job_unblock): Rename to job_finished, since this
3650
	* init/job.c (job_unblock): Rename to job_finished, since this
3651
	does not behave like event_unblock but more like event_finished
3652
	(job_change_state, job_failed): Change name in call.
3653
	* init/job.h: Update prototype.
3654
	* init/tests/test_job.c (test_unblock): Rename to test_finished
3655
	* init/event.c (event_pending_handle_jobs): Update calls here.
3656
989 by Scott James Remnant
* init/job.h (Job): Rename blocked to blocker to match event, since
3657
	* init/job.h (Job): Rename blocked to blocker to match event, since
3658
	it has the same use as event->blockers except it's a toggle
3659
	* init/job.c (job_new, job_change_state): Rename where used
3660
	* init/event.c (event_finished): Rename here also since its reset
3661
	* init/tests/test_job.c, init/tests/test_job_process.c,
3662
	* init/tests/test_event.c: Rename in test cases too.
3663
988 by Scott James Remnant
* init/job.c (job_emit_event): Add a Blocked record to the event's
3664
	* init/job.c (job_emit_event): Add a Blocked record to the event's
3665
	blocking list for the starting and stopping events.
3666
	* init/tests/test_job.c (test_emit_event): Add tests for the record
3667
	being added to the list with the right details.
3668
	(test_change_goal): Make sure that a Blocked record is added
3669
	(test_change_state): Make sure that Blocked records are added
3670
	* init/tests/test_job_process.c (test_handler): Also make sure
3671
	that Blocked records are added.
3672
987 by Scott James Remnant
* init/event.c (event_finished): Clear jobs referenced in the
3673
	* init/event.c (event_finished): Clear jobs referenced in the
3674
	blocking list, rather than iterating the entire jobs hash.
3675
	(event_finished_handle_jobs): Drop this function.
3676
	* init/tests/test_event.c (test_finished, test_finished_handle_jobs):
3677
	Merge tests again and test using both the blocking list and job's
3678
	blocked member.
3679
986 by Scott James Remnant
* init/event.h (event): Add blocking member.
3680
	* init/event.h (event): Add blocking member.
3681
	* init/event.c (event_new): Initialising blocking list.
3682
	* init/tests/test_event.c (test_new): Make sure it's initialised
3683
	to an empty list.
3684
985 by Scott James Remnant
* init/tests/test_job_process.c (test_handler): Update tests to use
3685
	* init/tests/test_job_process.c (test_handler): Update tests to use
3686
	Blocked.
3687
984 by Scott James Remnant
* init/event.c (event_pending_handle_jobs): Collect environment
3688
	* init/event.c (event_pending_handle_jobs): Collect environment
3689
	and events independantly, which means we don't have to worry about
3690
	the list contents or freeing them up in case of error.
3691
	* init/event_operator.c (event_operator_events): Fix parent.
3692
	* init/tests/test_event.c (test_pending_handle_jobs): Update tests.
3693
	* init/init.supp: Update collect suppression.
3694
983 by Scott James Remnant
* init/event_operator.c (event_operator_collect): Break in two.
3695
	* init/event_operator.c (event_operator_collect): Break in two.
3696
	(event_operator_environment): Collect the environment from the event,
3697
	appending the list of event names if necessary.
3698
	(event_operator_events): Block events and pass them to the
3699
	given list.
3700
	* init/event_operator.h: Update prototypes.
3701
	* init/tests/test_event_operator.c (test_operator_collect): Also
3702
	split into two new functions
3703
	(test_operator_environment, test_operator_events): Adjust
3704
982 by Scott James Remnant
* init/event_operator.c (event_operator_collect): Placed Blocked
3705
	* init/event_operator.c (event_operator_collect): Placed Blocked
3706
	structures in the list, rather than ordinary entries; I strongly
3707
	suspect that while it's nice to iterate the operator tree only once,
3708
	this needs to be three functions really.
3709
	* init/tests/test_event_operator.c (test_operator_collect): Update
3710
	test suite.
3711
981 by Scott James Remnant
* init/job.h (Job): Make blocking a statically defined list.
3712
	* init/job.h (Job): Make blocking a statically defined list.
3713
	* init/job.c (job_new): Initialise rather than setting to NULL.
3714
	(job_unblock): Assume that blocking members are Blocked structures
3715
	and that the list itself is always iterable.
3716
	* init/tests/test_job.c (test_new): Check the list is empty, rather
3717
	than NULL.
3718
	(test_change_state, test_failed, test_unblock): Change tests cases
3719
	to expect blocking to always be present, and create members as Blocked
3720
	structures.
3721
980 by Scott James Remnant
* init/blocked.c (blocked_new): Set destructor (forgotten)
3722
	* init/blocked.c (blocked_new): Set destructor (forgotten)
3723
979 by Scott James Remnant
* init/init.supp: Add setenv, which has crept in
3724
	* init/init.supp: Add setenv, which has crept in
3725
978 by Scott James Remnant
* init/blocked.h: Header containing enum, struct and prototype.
3726
	* init/blocked.h: Header containing enum, struct and prototype.
3727
	* init/blocked.c (blocked_new): Function to allocate the structure
3728
	with the right details.
3729
	* init/tests/test_blocked.c (test_new): Tests for the new function.
3730
	* init/Makefile.am (init_SOURCES): Compile using blocked.c and header
3731
	(TESTS): Build blocked test suite
3732
	(test_process_LDADD, test_job_class_LDADD)
3733
	(test_job_process_LDADD, test_job_LDADD, test_event_LDADD)
3734
	(test_event_operator_LDADD, test_parse_job_LDADD)
3735
	(test_parse_conf_LDADD, test_conf_LDADD, test_control_LDADD):
3736
	Link blocked.o to most test suites.
3737
	(test_blocked_SOURCES, test_blocked_LDFLAGS, test_blocked_LDADD):
3738
	Details for test suite.
3739
977 by Scott James Remnant
* init/main.c: Also remove SIGTERM handling, we don't re-exec
3740
	* init/main.c: Also remove SIGTERM handling, we don't re-exec
3741
	properly and this is a dangerous signal to use anyway.
3742
	(term_handler): Drop function.
3743
976 by Scott James Remnant
* init/main.c: Remove handling for stop/cont; there's no reason
3744
	* init/main.c: Remove handling for stop/cont; there's no reason
3745
	a user should be able to pause the event queue.
3746
	(stop_handler): Drop function.
3747
	* init/event.c (event_poll): Remove paused handling.
3748
975 by Scott James Remnant
* init/control.c: Fix doc string.
3749
	* init/control.c: Fix doc string.
3750
974 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (ReloadConfiguration): Add method
3751
	* dbus/com.ubuntu.Upstart.xml (ReloadConfiguration): Add method
3752
	that's effectively the same as the HUP signal.
3753
	* init/control.c (control_reload_configuration): Unsurprisingly,
3754
	the implementation is identical.
3755
	* init/control.h: Add prototype.
3756
	* init/tests/test_control.c (test_reload_configuration): Make sure
3757
	the method works as expected.
3758
	(test_get_job_by_name, test_get_all_jobs): Add missing free calls for
3759
	message in cases of out of memory.
3760
973 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (JobAdded, JobRemoved): Add signals
3761
	* dbus/com.ubuntu.Upstart.xml (JobAdded, JobRemoved): Add signals
3762
	for when new jobs are added to the known list and when existing jobs
3763
	are removed, this allows GUIs to always show an up-to-date list.
3764
	* dbus/com.ubuntu.Upstart.Job.xml (InstanceAdded, InstanceRemoved):
3765
	Also add matching signals for when instances are added to the list
3766
	for a job and when they're removed again.
3767
	* init/job_class.c (job_class_register): Emit the JobAdded signal
3768
	for this job when registering if the new signal argument is TRUE;
3769
	pass on the signal argument to job_register()
3770
	(job_class_add): Emit signals when registering jobs with existing
3771
	connections.
3772
	(job_class_unregister): Emit signals when unregistering a job.
3773
	* init/job.c (job_register): Likewise, emit the InstanceAdded signal
3774
	for the job class if the new signal argument is TRUE.
3775
	(job_new): Emit signals when registering instances with existing
3776
	connections.
3777
	(job_change_state): Emit the instance removed signal when destroying
3778
	an inactive instance.
3779
	* init/job_class.h, init/job.h: Add signal argument to prototypes
3780
	* init/control.c (control_register_all): When registering job classes
3781
	on a new connection, do not emit a signal since they will already
3782
	exist at the point when the name appears on the bus or the connection
3783
	is complete.
3784
	* init/tests/test_control.c (test_bus_open): Add comment that we
3785
	are testing for signal non-emission already with the fake server,
3786
	since it was this test that actually made me realise we had to
3787
	not emit them :p
3788
	* init/tests/test_job_class.c (test_register): Test that the signal
3789
	is emitted when signal is TRUE and not emitted when signal is FALSE
3790
	(test_unregister): Test that the JobRemoved signal is emitted
3791
	(test_get_instance_by_name, test_get_all_instances): Free message
3792
	if allocation failed.
3793
	(test_consider, test_reconsider): Test that the JobAdded and
3794
	JobRemoved signals are emitted (or not) when appropriate.
3795
	* init/tests/test_job.c (test_register): Make sure that the
3796
	InstanceAdded signal is emitted when TRUE is passed, and not when
3797
	FALSE is passed.
3798
	(test_new): Make sure the InstanceAdded signal is emitted when the
3799
	job is registered on the bus.
3800
	(test_change_state): Make sure the InstanceRemoved signal is sent
3801
	when deleting an instance.
3802
969 by Scott James Remnant
* init/tests/test_control.c (test_bus_close): Don't rely on being
3803
2008-06-02  Scott James Remnant  <scott@netsplit.com>
3804
972 by Scott James Remnant
* init/tests/test_job.c (test_new, test_register): Also use a private
3805
	* init/tests/test_job.c (test_new, test_register): Also use a private
3806
	dbus server to avoid session bus problems.
3807
971 by Scott James Remnant
* init/tests/test_job_class.c (test_consider, test_reconsider)
3808
	* init/tests/test_job_class.c (test_consider, test_reconsider)
3809
	(test_register, test_unregister): Use a private dbus server instead
3810
	of connecting to the session bus, which might not be there.
3811
970 by Scott James Remnant
* init/tests/test_control.c (test_disconnected): Simplify using a
3812
	* init/tests/test_control.c (test_disconnected): Simplify using a
3813
	private dbus server rather than faking one.
3814
969 by Scott James Remnant
* init/tests/test_control.c (test_bus_close): Don't rely on being
3815
	* init/tests/test_control.c (test_bus_close): Don't rely on being
3816
	able to connect to the various buses, instead use a special private
3817
	one.
3818
962 by Scott James Remnant
* init/Makefile.am (test_process_LDADD, test_job_class_LDADD)
3819
2008-06-01  Scott James Remnant  <scott@netsplit.com>
3820
968 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (GetAllInstances): And also add
3821
	* dbus/com.ubuntu.Upstart.Job.xml (GetAllInstances): And also add
3822
	a similar method to return the object path of all instances of a
3823
	particular job.
3824
	* init/job_class.c (job_class_get_all_instances): Implement the
3825
	method, pretty much the same as the other.
3826
	* init/job_class.h: Add prototype.
3827
	* init/control.c: Fix comment.
3828
	* init/tests/test_control.c (test_get_all_jobs): Ensure that the
3829
	individual paths are children of the array.
3830
967 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (GetAllJobs): Add method to return
3831
	* dbus/com.ubuntu.Upstart.xml (GetAllJobs): Add method to return
3832
	the object path of all known jobs.
3833
	* init/control.c (control_get_all_jobs): Implement the method,
3834
	somewhat simple happily.
3835
	* init/control.h: Add prototype for the method.
3836
	* init/tests/test_control.c (test_get_all_jobs): Test that the
3837
	right data is returned.
3838
966 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
3839
	* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
3840
	* dbus/com.ubuntu.Upstart.Instance.xml: Add libnih XML NS to the
3841
	files so that we can tag methods as sync or async later.
3842
965 by Scott James Remnant
* init/control.c (control_get_job_by_name): Remove const from
3843
	* init/control.c (control_get_job_by_name): Remove const from
3844
	return parameter.
3845
	* init/control.h: Update prototype.
3846
	* init/tests/test_control.c (test_get_job_by_name): Remove const
3847
	from path type.
3848
964 by Scott James Remnant
* init/job_class.c (job_class_get_instance_by_name): Remove wrong
3849
	* init/job_class.c (job_class_get_instance_by_name): Remove wrong
3850
	const from parameter now that we've fixed the bindings generator.
3851
	* init/job_class.h: Update prototype to match.
3852
	* init/tests/test_job_class.c (test_get_instance_by_name): Change
3853
	type of path to match.
3854
963 by Scott James Remnant
* HACKING (Dependencies): clarify that autoreconf and configure need
3855
	* HACKING (Dependencies): clarify that autoreconf and configure need
3856
	to be run for libnih first.
3857
962 by Scott James Remnant
* init/Makefile.am (test_process_LDADD, test_job_class_LDADD)
3858
	* init/Makefile.am (test_process_LDADD, test_job_class_LDADD)
3859
	(test_job_process_LDADD, test_job_LDADD, test_event_LDADD)
3860
	(test_event_operator_LDADD, test_parse_job_LDADD)
3861
	(test_parse_conf_LDADD, test_conf_LDADD, test_control_LDADD): Link
3862
	the auto-generated D-Bus code in, otherwise the tests won't be
3863
	complete.
3864
961 by Scott James Remnant
* HACKING: Changed branch location again, of both upstart and
3865
2008-05-24  Scott James Remnant  <scott@netsplit.com>
3866
3867
	* HACKING: Changed branch location again, of both upstart and
3868
	libnih.
3869
960 by Scott James Remnant
* init/job_class.c (job_class_consider, job_class_reconsider): Find
3870
2008-05-16  Scott James Remnant  <scott@netsplit.com>
3871
3872
	* init/job_class.c (job_class_consider, job_class_reconsider): Find
3873
	the best class first and compare against the current class before
3874
	acting, this avoids the re-register jump every time a job stops.
3875
	(job_class_select): Rename to job_class_add() since this is takes
3876
	a class and is the direct opposite to job_class_remove().
3877
959 by Scott James Remnant
* init/event.c (event_new): We can't rely on the event poll function
3878
2008-05-15  Scott James Remnant  <scott@netsplit.com>
3879
3880
	* init/event.c (event_new): We can't rely on the event poll function
3881
	being the last in the main loop, it's often the first, so after
3882
	adding an event to the queue ensure the loop is iterated at least
3883
	once so that the event poll occurs for it.
3884
950 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (GetJobByName): Add method
3885
2008-05-09  Scott James Remnant  <scott@netsplit.com>
3886
958 by Scott James Remnant
* TODO (Anytime): Update.
3887
	* TODO (Anytime): Update.
3888
957 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Instance.xml: format to match others
3889
	* dbus/com.ubuntu.Upstart.Instance.xml: format to match others
3890
956 by Scott James Remnant
* dbus/com.ubuntu.Upstart.Job.xml (GetInstanceByName): Add method
3891
	* dbus/com.ubuntu.Upstart.Job.xml (GetInstanceByName): Add method
3892
	* init/job_class.c (job_class_get_instance_by_name): Implementation.
3893
	* init/job_class.h: Add prototype.
3894
	* init/tests/test_job_class.c (test_get_instance_by_name): Tests
3895
	for new method.
3896
955 by Scott James Remnant
* init/job_class.h (JobClass): Make instances a hash table.
3897
	* init/job_class.h (JobClass): Make instances a hash table.
3898
	* init/job_class.c (job_class_new): Initialise instances as a hash
3899
	table now.
3900
	(job_class_register): Iterate instances as hash table.
3901
	(job_class_remove): Slightly odd construct needed to return FALSE
3902
	if there's anything in the hash table.
3903
	(job_class_unregister): Likewise to assert on no instances.
3904
	* init/tests/test_job_class.c (test_new): Check that instances is
3905
	now a hash table.
3906
	* init/job.h (Job): Make name the first member.
3907
	* init/job.c (job_new): Add to instances as hash table.
3908
	(job_instance): Drop entirely, replaced by a hash lookup.
3909
	* init/tests/test_job.c (test_instance): Drop.
3910
	* init/job_process.c (job_process_find): Iterate instances as a
3911
	hash table.
3912
	* init/event.c (event_pending_handle_jobs)
3913
	(event_finished_handle_jobs): Iterate instances as hash table.
3914
	(event_pending_handle_jobs): Replace job_instance call with an
3915
	ordinary hash lookup.
3916
	* init/tests/test_event.c: Update to use hash table.
3917
	* init/tests/test_conf.c: Update instances stealing for hash table
3918
954 by Scott James Remnant
* init/job_class.c (job_class_new): initialise instance to the
3919
	* init/job_class.c (job_class_new): initialise instance to the
3920
	empty string.
3921
	* init/tests/test_job_class.c: Update job_new() calls.
3922
	(test_new): Check instance against the empty string.
3923
	* init/job.c (job_new): name may no longer be NULL.
3924
	* init/tests/test_job.c: Update job_new() calls.
3925
	(test_instance): Reset back to "" when done.
3926
	* init/event.c (event_pending_handle_jobs): Always expand the
3927
	name, since the class->instance is always non-NULL.
3928
	* init/tests/test_event.c: Update job_new calls.
3929
	* init/tests/test_conf.c: Update job_new calls.
3930
	* init/tests/test_job_process.c: Update job_new calls.
3931
953 by Scott James Remnant
* init/job.c (job_new): Singleton jobs have a fixed name of "",
3932
	* init/job.c (job_new): Singleton jobs have a fixed name of "",
3933
	rather than a NULL name, and a D-Bus name of "_".
3934
	(job_instance): Which rather simplifies this function (in fact,
3935
	it makes this function look like a common one).
3936
	(job_emit_event): Always set INSTANCE variable.
3937
	(job_name): Still distinguish in output, to avoid ugly "()" but
3938
	check character rather than NULL.
3939
	* init/tests/test_job.c (test_new): Check name is set to ""
3940
	and path to ".../_"
3941
	(test_change_state, test_emit_event): Update test cases to assume
3942
	an empty INSTANCE variable
3943
	(test_instance): Update to pass "" instead of NULL.
3944
	* init/job_process.c (job_process_run): Always set UPSTART_INSTANCE
3945
	* init/tests/test_job_process.c (test_run): Always assume an
3946
	UPSTART_INSTANCE variable, it may just be empty.
3947
	* init/tests/test_event.c (test_pending_handle_jobs): Expect
3948
	the name to be set to the empty string.
3949
952 by Scott James Remnant
* init/Makefile.am (com.ubuntu.Upstart.c com.ubuntu.Upstart.h)
3950
	* init/Makefile.am (com.ubuntu.Upstart.c com.ubuntu.Upstart.h)
3951
	(com.ubuntu.Upstart.Job.c com.ubuntu.Upstart.Job.h)
3952
	(com.ubuntu.Upstart.Instance.c com.ubuntu.Upstart.Instance.h):
3953
	Drop setting of data-type, turns out it doesn't work anyway.
3954
951 by Scott James Remnant
* dbus/Upstart.conf: Add configuration file.
3955
	* dbus/Upstart.conf: Add configuration file.
3956
	* dbus/Makefile.am (dbussystemdir, dist_dbussystem_DATA): Install
3957
	the configuration file into the right place.
3958
950 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml (GetJobByName): Add method
3959
	* dbus/com.ubuntu.Upstart.xml (GetJobByName): Add method
3960
	* init/control.c (control_get_job_by_name): Implementation.
3961
	* init/control.h: Prototype.
3962
	* init/tests/test_control.c (test_get_job_by_name): Test the
3963
	method using a fake message.
3964
944 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Check for a bug where
3965
2008-05-08  Scott James Remnant  <scott@netsplit.com>
3966
949 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
3967
	* dbus/com.ubuntu.Upstart.xml, dbus/com.ubuntu.Upstart.Job.xml,
3968
	* dbus/com.ubuntu.Upstart.Instance.xml: Add DTDs.
3969
948 by Scott James Remnant
* init/control.c (manager_interfaces): Export the general
3970
	* init/control.c (manager_interfaces): Export the general
3971
	com.ubuntu.Upstart interface
3972
	* init/job_class.c (job_class_interfaces): Export the
3973
	com.ubuntu.Upstart.Job interface
3974
	* init/job.c (job_interfaces): Export the
3975
	com.ubuntu.Upstart.Instance interface
3976
947 by Scott James Remnant
* init/Makefile.am (BUILT_SOURCES)
3977
	* init/Makefile.am (BUILT_SOURCES)
3978
	(com.ubuntu.Upstart.c com.ubuntu.Upstart.h)
3979
	(com.ubuntu.Upstart.Job.c com.ubuntu.Upstart.Job.h)
3980
	(com.ubuntu.Upstart.Instance.c com.ubuntu.Upstart.Instance.h):
3981
	Generate C code and header files from the XML files which produce
3982
	object bindings.
3983
	(init_SOURCES): Link the built sources.
3984
	(CLEANFILES): Clean them up afterwards
3985
946 by Scott James Remnant
* dbus/com.ubuntu.Upstart.xml: Initially empty description for
3986
	* dbus/com.ubuntu.Upstart.xml: Initially empty description for
3987
	manager object interface(s).
3988
	* dbus/com.ubuntu.Upstart.Job.xml: Initially empty description
3989
	for job class object interface(s).
3990
	* dbus/com.ubuntu.Upstart.Instance.xml: Initially empty
3991
	description for job instance object interface(s).
3992
	* dbus/Makefile.am: Distribute the three interface files,
3993
	they're used as sources elsewhere.
3994
	* configure.ac (AC_CONFIG_FILES): Generate dbus/Makefile
3995
	* Makefile.am (SUBDIRS): Descend into the dbus sub-directory.
3996
945 by Scott James Remnant
* init/job_class.c (job_class_consider, job_class_reconsider):
3997
	* init/job_class.c (job_class_consider, job_class_reconsider):
3998
	Separate out the actual meat of the functions, since it's largely
3999
	duplicated between the two.  This makes the difference between
4000
	the two functions clearer, consider always stages an election
4001
	no matter which is registered, reconsider only stages an election
4002
	if the current class is registered.
4003
	(job_class_select, job_class_remove): Functions containing the
4004
	common code, which now also handle registering and unregistering
4005
	the class with D-Bus.  Here is the right place, not in new, since
4006
	we only export the current best class of a given name.
4007
	(job_class_register, job_class_unregister): Function to register
4008
	a job and its instances, and to unregister a job (we assert that
4009
	there must be no instances for us to do this).
4010
	* init/job_class.h: Add prototypes.
4011
	* init/tests/test_job_class.c (test_consider, test_reconsider):
4012
	Check that D-Bus registration and unregistration happens as
4013
	expected.
4014
	(test_register, test_unregister): test on their own.
4015
	* init/job.c (job_new): Register instances with D-Bus, since
4016
	instances can only ever exist for active classes, all instances
4017
	are always registered on the bus.
4018
	(job_register): Function to register an instance on the bus.
4019
	* init/job.h: Add prototype.
4020
	* init/tests/test_job.c (test_new): Test creating a job with an
4021
	active d-bus connection, which should have it registered.
4022
	(test_register): Test registration on its own.
4023
	* init/control.c (control_register_all): Make this always succeed,
4024
	and register existing jobs on the new connection.
4025
	(control_server_connect, control_bus_open): registration is
4026
	always successful.
4027
	* init/tests/test_control.c (test_server_connect, test_bus_open):
4028
	Test with existing jobs when we get a connection or create the
4029
	bus connection, ensure that the jobs and instances are registered.
4030
944 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Check for a bug where
4031
	* init/tests/test_job.c (test_change_state): Check for a bug where
4032
	a job with multiple instances will be freed when one instance is
4033
	deleted rather than the last instance.
4034
	* init/job.c (job_change_state): Add debugging messages when we
4035
	destroy a job that's no longer the current one or an instance
4036
	that's no longer active; also ensure that we never destroy a job
4037
	that's the current one.
4038
	* init/event.c (event_pending_handle_jobs): Add a debugging message
4039
	when we create a new instance of a job.
4040
	* init/conf.c (conf_file_destroy): Add a debugging message when
4041
	we destroy a job that's no longer the current one.
4042
942 by Scott James Remnant
* init/job_process.c (job_process_run): Use NIH_ZERO instead of
4043
2008-05-07  Scott James Remnant  <scott@netsplit.com>
4044
943 by Scott James Remnant
* init/control.c (control_server_open, control_server_close)
4045
	* init/control.c (control_server_open, control_server_close)
4046
	(control_server_connect): Create and manage a listening d-bus server
4047
	that is used for private direct connections to Upstart for when the
4048
	d-bus daemon is not available.  Each new connection has the same
4049
	objects as the d-bus system bus, they only differ in their method.
4050
	(control_conns, control_init): Cache the open connections, including
4051
	the bus daemon and any private connections; we'll iterate this list
4052
	when sending signals.
4053
	(control_bus_open): Store connection in the list, don't worry about
4054
	setting close-on-exec, we check that by test case and rely on d-bus
4055
	to do it.
4056
	(control_bus_disconnected): Rename to control_disconnected
4057
	(control_disconnected): Work for system bus and private connections,
4058
	remove from the connections list.
4059
	* init/control.h: Add prototypes, remove global definition of bus
4060
	name to just being private again.
4061
	* init/tests/test_control.c (test_server_open, test_server_close)
4062
	(test_server_connect): Test the new functions.
4063
	(test_bus_open): add check for list entry
4064
	(test_bus_disconnected): rename to test_disconnected
4065
	* init/main.c: Open the listening server, warning if we're unable
4066
	to do so (but we won't treat it as a hard error since there's the
4067
	d-bus daemon as the default anyway).
4068
	* init/init.supp: suppress the fact that the control connections
4069
	list stays around.
4070
942 by Scott James Remnant
* init/job_process.c (job_process_run): Use NIH_ZERO instead of
4071
	* init/job_process.c (job_process_run): Use NIH_ZERO instead of
4072
	NIH_MUST and == 0
4073
940 by Scott James Remnant
* init/main.c (main): Warn if we can't set the root directory.
4074
2008-05-06  Scott James Remnant  <scott@netsplit.com>
4075
941 by Scott James Remnant
* init/environ.c (environ_expand_until): Odd gcc optimiser warning,
4076
	* init/environ.c (environ_expand_until): Odd gcc optimiser warning,
4077
	it reckons arg_start and end may be used uninitialised, but I don't
4078
	see how they can be.
4079
940 by Scott James Remnant
* init/main.c (main): Warn if we can't set the root directory.
4080
	* init/main.c (main): Warn if we can't set the root directory.
4081
	* init/job_process.c (job_process_spawn)
4082
	(job_process_error_abort): loop on the return of write()
4083
	* init/tests/test_job_process.c (child, main): assert getcwd() works
4084
	(test_handler): initialise list and entry for gcc's blind spot.
4085
	(test_run): initialise ret for gcc's blind spot
4086
	* init/tests/test_job.c (test_name): jump through hoops for gcc
4087
	(test_change_state): list and entry.
4088
	* init/tests/test_event.c (test_finished_handle_jobs, test_finished)
4089
	(test_pending_handle_jobs, test_poll, test_pending): initialise to
4090
	NULL and buy gcc glasses
4091
	* init/tests/test_event_operator.c (test_operator_collect): another
4092
	NULL to make gcc happy.
4093
935 by Scott James Remnant
* init/event.c (event_pending_handle_jobs)
4094
2008-05-01  Scott James Remnant  <scott@netsplit.com>
4095
938 by Scott James Remnant
* TODO: Update.
4096
	* TODO: Update.
4097
937 by Scott James Remnant
* init/init.supp: Suppress a few test case artefacts caused by
4098
	* init/init.supp: Suppress a few test case artefacts caused by
4099
	valgrind hating reachable memory at exec() time.
4100
936 by Scott James Remnant
* init/tests/test_job_process.c: Fix a few cases where we were
4101
	* init/tests/test_job_process.c: Fix a few cases where we were
4102
	still dup'ing the name argument to job_new().
4103
	* init/tests/test_parse_job.c: Include missing signal.h
4104
935 by Scott James Remnant
* init/event.c (event_pending_handle_jobs)
4105
	* init/event.c (event_pending_handle_jobs)
4106
	(event_finished_handle_jobs): Land the old job event handling
4107
	functions here as static functions, right now they're immense but
4108
	we'll actually move much of the code back out again as we go.
4109
	* init/tests/test_event.c (test_pending_handle_jobs)
4110
	(test_finished_handle_jobs): Also land the test cases in renamed
4111
	and somewhat restructued functions, since we now have to do the
4112
	testing through event_poll().
4113
	(test_poll, test_pending, test_finished): It never hurts to improve
4114
	test cases while you're in there.
4115
930 by Scott James Remnant
* init/control.c (control_job_config_path, control_job_path)
4116
2008-04-30  Scott James Remnant  <scott@netsplit.com>
4117
934 by Scott James Remnant
* init/job.c (job_change_state): Change calls to job_process_run
4118
	* init/job.c (job_change_state): Change calls to job_process_run
4119
	and job_process_kill.
4120
	* init/main.c: Change to job_process_handler
4121
933 by Scott James Remnant
* init/job_process.c, init/job_process.h: Land the code from job.c
4122
	* init/job_process.c, init/job_process.h: Land the code from job.c
4123
	and defs from job.h that deal specifically with a job's processes,
4124
	rename the functions to job_process_*() in the process.
4125
	* init/tests/test_job_process.c: And land the test cases as well.
4126
932 by Scott James Remnant
* init/job.c: Strip of everything not related to creation and finding
4127
	* init/job.c: Strip of everything not related to creation and finding
4128
	of instances and the core state machine; process stuff will move to
4129
	job_process.c and event handling to event.c, class (nee config) stuff
4130
	is already moved to job_class.c
4131
	(job_new): Don't reparent the name, it doesn't help anything, just
4132
	take a copy.
4133
	(job_name, job_failed, job_unblock, job_emit_event): Make extern since
4134
	we need to use these outside or just want to test them.
4135
	* init/job.h: Clean out also.
4136
	* init/tests/test_job.c: Also clean out.
4137
	(test_name, test_failed, test_unblock, test_emit_event): Add test cases
4138
	for newly extern functions.
4139
931 by Scott James Remnant
* init/main.c: Include events.h to get the ones we need.
4140
	* init/main.c: Include events.h to get the ones we need.
4141
930 by Scott James Remnant
* init/control.c (control_job_config_path, control_job_path)
4142
	* init/control.c (control_job_config_path, control_job_path)
4143
	(control_path_append): Drop these functions (replaced by the more
4144
	generic nih_dbus_path() function)
4145
	* init/control.h: Make CONTROL_ROOT public, and drop other prototypes.
4146
	* init/tests/test_control.c (test_job_config_path)
4147
	(test_job_path): Drop tests.
4148
919 by Scott James Remnant
* init/job_class.h (JobClass): Factor out old JobConfig object into
4149
2008-04-29  Scott James Remnant  <scott@netsplit.com>
4150
929 by Scott James Remnant
* init/event.c, init/event.h, init/tests/test_event.c: Strip out the
4151
	* init/event.c, init/event.h, init/tests/test_event.c: Strip out the
4152
	event operator code and events list.
4153
928 by Scott James Remnant
* init/job_class.c, init/job_class.h: We only need the event operator
4154
	* init/job_class.c, init/job_class.h: We only need the event operator
4155
	code here now.
4156
927 by Scott James Remnant
* init/events.h, init/event_operator.c, init/event_operator.h,
4157
	* init/events.h, init/event_operator.c, init/event_operator.h,
4158
	init/tests/test_event_operator.c: Separate out the event operator
4159
	code and the list of events into separate source files.
4160
	* init/Makefile.am (init_SOURCES): Build and link event operator code
4161
	and use the lists of events.
4162
	(TESTS): Build and run the event operator test suite.
4163
	(test_event_operator_SOURCES, test_event_operator_LDFLAGS)
4164
	(test_event_operator_LDADD): Details for the event operator test
4165
	suite.
4166
	(test_process_LDADD, test_job_class_LDADD)
4167
	(test_job_process_LDADD, test_job_LDADD, test_event_LDADD)
4168
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD)
4169
	(test_control_LDADD): Link the event operator code.
4170
926 by Scott James Remnant
* init/job_class.c, init/main.c: Correct includes and some function
4171
	* init/job_class.c, init/main.c: Correct includes and some function
4172
	names.
4173
925 by Scott James Remnant
* init/process.c, init/process.h, init/tests/test_process.c: Land
4174
	* init/process.c, init/process.h, init/tests/test_process.c: Land
4175
	original Process code (used by job class and similar).
4176
924 by Scott James Remnant
* init/process.c, init/process.h, init/tests/test_process.c: Break
4177
	* init/process.c, init/process.h, init/tests/test_process.c: Break
4178
	into two pieces, one part becomes job_process which requires both
4179
	job information and process information, the other becomes system
4180
	which requires no job information.
4181
	* init/errors.h: Update error name.
4182
	* init/Makefile.am (init_SOURCES): Build and link job process code
4183
	and header along with system code and header.
4184
	(TESTS): Build and run job process and system test suites.
4185
	(test_job_process_SOURCES, test_job_process_LDFLAGS)
4186
	(test_job_process_LDADD): Details for job process test suite.
4187
	(test_system_SOURCES, test_system_LDFLAGS, test_system_LDADD):
4188
	Details for system test suite.
4189
	(test_process_LDADD, test_job_class_LDADD, test_job_LDADD)
4190
	(test_event_LDADD, test_parse_job_LDADD, test_parse_conf_LDADD)
4191
	(test_conf_LDADD, test_control_LDADD): Link job process and system
4192
	code.
4193
923 by Scott James Remnant
* init/parse_conf.c: Remove parse_job include.
4194
	* init/parse_conf.c: Remove parse_job include.
4195
922 by Scott James Remnant
* init/init.supp: Update leak check for class init; remove
4196
	* init/init.supp: Update leak check for class init; remove
4197
	valgrind workaround since it's gone away with the change of that
4198
	function.
4199
921 by Scott James Remnant
* init/conf.h (ConfFile): Change type of job member, but leave name.
4200
	* init/conf.h (ConfFile): Change type of job member, but leave name.
4201
	Add prototype for new function.
4202
	* init/conf.c (conf_reload_path): Somewhat simplify the case of
4203
	having parsed a job, we only need to call job_class_consider() now
4204
	to have it dealt with.
4205
	(conf_file_destroy): Likewise after removing the ConfFile from the
4206
	source (so it won't get considered) and marking the job class as
4207
	deleted, we only need to call job_class_reconsider() and check the
4208
	return value to see whether we've been replaced.
4209
	(conf_select_job): In return we provide the function to decide which
4210
	of the available job sources is the best one.
4211
	* init/tests/test_conf.c: Update types in tests.
4212
	(test_select_job): Test the new function.
4213
920 by Scott James Remnant
* init/parse_job.h: Update to include job_class.h and update prototype
4214
	* init/parse_job.h: Update to include job_class.h and update prototype
4215
	to return JobClass, we'll keep the name though since we'll never
4216
	parse jobs and otherwise things get annoying.
4217
	* init/parse_job.c: Update to work on job classes.
4218
	* init/tests/test_parse_job.c: Update to match.
4219
919 by Scott James Remnant
* init/job_class.h (JobClass): Factor out old JobConfig object into
4220
	* init/job_class.h (JobClass): Factor out old JobConfig object into
4221
	a new JobClass object with the same properties, but in its own source
4222
	file.
4223
	(ExpectType): Rename old JobExpect to this to match other enums.
4224
	(ConsoleType): Move along with the object that uses it.
4225
	* init/job_class.c (job_class_init, job_class_new)
4226
	(job_class_environment): Bring along methods that only operate on
4227
	a JobClass, cleaning them up in the process.
4228
	(job_class_consider, job_class_reconsider): Replace job_config_replace
4229
	with these two functions that may be used for a new job class and
4230
	when discarding or finishing with an old one respectively.
4231
	* init/tests/test_job_class.c: Tests for the functions.
4232
	* init/Makefile.am (init_SOURCES): Build and link job class source
4233
	and header.
4234
	(TESTS): Build and run job class test suite.
4235
	(test_job_class_SOURCES, test_job_class_LDFLAGS)
4236
	(test_job_class_LDADD): Details for job class test suite.
4237
	(test_process_LDADD, test_job_LDADD, test_event_LDADD)
4238
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD)
4239
	(test_control_LDADD): Link job class code to other tests too.
4240
917 by Scott James Remnant
* init/control.c (control_bus_open): Call out to register objects
4241
2008-04-28  Scott James Remnant  <scott@netsplit.com>
4242
918 by Scott James Remnant
* init/control.c (control_job_config_path, control_job_path): Add
4243
	* init/control.c (control_job_config_path, control_job_path): Add
4244
	functions to generate D-Bus object paths for jobs and instances
4245
	(control_path_append): and a static function used by both to append
4246
	escaped path elements.
4247
	* init/control.h: Add prototypes.
4248
	* init/tests/test_control.c (test_job_config_path)
4249
	(test_job_path): Add test cases for the new functions.
4250
	* init/job.h (JobConfig, Job): Add path member to both structures.
4251
	* init/job.c (job_config_new, job_new): Initialise the path members.
4252
	* init/tests/test_job.c (test_config_new, test_new): Make sure
4253
	the path members are initialised to something sensible.
4254
	* init/init.supp: Valgrind whines, I do not know why.
4255
917 by Scott James Remnant
* init/control.c (control_bus_open): Call out to register objects
4256
	* init/control.c (control_bus_open): Call out to register objects
4257
	on the new bus connection.
4258
	(control_register_all): Start off by registering the connection
4259
	manager object, no methods/signals for now.
4260
	* init/tests/test_control.c (test_bus_open): Make sure the manager
4261
	object is registered.
4262
915 by Scott James Remnant
* init/job.c (job_emit_event): Make INSTANCE the second variable.
4263
2008-04-27  Scott James Remnant  <scott@netsplit.com>
4264
916 by Scott James Remnant
* init/tests/test_control.c (test_bus_open): Correct name of
4265
	* init/tests/test_control.c (test_bus_open): Correct name of
4266
	error macro.
4267
915 by Scott James Remnant
* init/job.c (job_emit_event): Make INSTANCE the second variable.
4268
	* init/job.c (job_emit_event): Make INSTANCE the second variable.
4269
	* init/tests/test_job.c (test_next_state): Update tests.
4270
914 by Scott James Remnant
* init/tests/test_control.c (test_bus_open): Use D-bus macros for
4271
2008-04-25  Scott James Remnant  <scott@netsplit.com>
4272
4273
	* init/tests/test_control.c (test_bus_open): Use D-bus macros for
4274
	error strings instead of naming them by hand.
4275
913 by Scott James Remnant
* init/tests/test_control.c (test_bus_close): Add another missing
4276
2008-04-22  Scott James Remnant  <scott@netsplit.com>
4277
4278
	* init/tests/test_control.c (test_bus_close): Add another missing
4279
	call to dbus_shutdown.
4280
912 by Scott James Remnant
* init/tests/test_control.c (test_bus_open): Under valgrind we seem
4281
2008-04-21  Scott James Remnant  <scott@netsplit.com>
4282
4283
	* init/tests/test_control.c (test_bus_open): Under valgrind we seem
4284
	to get NoReply instead of Disconnected which is a wee bit odd.
4285
	Add missing call
4286
	(test_bus_disconnected): Add missing call to dbus_shutdown.
4287
902 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add tests to make sure
4288
2008-04-19  Scott James Remnant  <scott@netsplit.com>
4289
911 by Scott James Remnant
* init/process.c: Add missing limits.h include
4290
	* init/process.c: Add missing limits.h include
4291
909 by Scott James Remnant
* init/job.h (JobConfig): Merge instance and instance_name; if
4292
	* init/job.h (JobConfig): Merge instance and instance_name; if
4293
	instance is set, the job is multi-instance with the name derived
4294
	from that; if unset the job is singleton.  We will not support
4295
	unlimited instances.
4296
	* init/job.c (job_config_new): Initialise instance to NULL.
4297
	(job_new): Assert that name is set for instance jobs.
4298
	(job_instance): Alter to only deal with singleton and instance
4299
	jobs, the unlimited instances case is gone.
4300
	(job_handle_event): Use instance instead of instance_name
4301
	* init/tests/test_job.c (test_config_new): Check instance is NULL
4302
	(test_find_by_pid): Adjust the way instance jobs are made, which
4303
	means we have to pass a name to job_config_new now.
4304
	(test_instance): Adjust tests to remove unlmited-instance tests
4305
	and pass name to job_config_new
4306
	(test_change_state, test_run_process): Pass instance name to
4307
	job_new as an allocated argument rather than waiting to set it
4308
	until afterwards.
4309
	(test_handle_event): Set instance instead of instance_name
4310
	* init/parse_job.c (stanza_instance): Make the argument mandatory.
4311
	* init/tests/test_parse_job.c (test_stanza_instance): Remove the
4312
	checks for without argument, and make sure that without argument
4313
	is an error.
4314
908 by Scott James Remnant
* init/parse_job.c (stanza_oom): Oops, forgot to free never arg.
4315
	* init/parse_job.c (stanza_oom): Oops, forgot to free never arg.
4316
907 by Scott James Remnant
* init/job.h (JobConfig): NihList is rather overkill for emits,
4317
	* init/job.h (JobConfig): NihList is rather overkill for emits,
4318
	which is static configuration; turn into a NULL-terminated array
4319
	which'll make it easier to turn into a D-Bus property later.
4320
	* init/job.c (job_config_new): Initialise to NULL now.
4321
	* init/tests/test_job.c (test_config_new): Make sure it's NULL.
4322
	* init/parse_job.c (stanza_emits): Store in an array instead.
4323
	* init/tests/test_parse_job.c (test_stanza_emits): Redo tests.
4324
906 by Scott James Remnant
* init/job.c (job_emit_event): Append exported variables to the
4325
	* init/job.c (job_emit_event): Append exported variables to the
4326
	job event without overwriting the builtins.
4327
	* init/tests/test_job.c (test_change_state): Check that exported
4328
	environment is added to the job events.
4329
905 by Scott James Remnant
* init/parse_job.c (stanza_export): Parse a new export stanza,
4330
	* init/parse_job.c (stanza_export): Parse a new export stanza,
4331
	which takes one or more environment variable names.
4332
	* init/tests/test_parse_job.c (test_stanza_export): Test the new
4333
	stanza.
4334
904 by Scott James Remnant
* init/job.h (JobConfig): Add new export member.
4335
	* init/job.h (JobConfig): Add new export member.
4336
	* init/job.c (job_config_new): Initialise to NULL.
4337
	* init/tests/test_job.c (test_config_new): Make sure it's NULL.
4338
903 by Scott James Remnant
* init/environ.c (environ_add, environ_set): Add a replace argument
4339
	* init/environ.c (environ_add, environ_set): Add a replace argument
4340
	which when FALSE does not replace existing entries in the environment
4341
	table.
4342
	* init/environ.h: Adjust prototypes.
4343
	* init/tests/test_environ.c (test_add): Add tests for non-replacement
4344
	mode, including corner cases.
4345
	(test_set): Replace should be TRUE in this test.
4346
	* init/event.c (event_operator_collect): Always replace existing
4347
	environment members.
4348
	* init/job.c (job_config_environment, job_run_process): Always replace
4349
	existing environment members.
4350
	(job_emit_event): Always replace existing environment members, and
4351
	rework this function to get rid of the confusing gotos.
4352
902 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add tests to make sure
4353
	* init/tests/test_job.c (test_change_state): Add tests to make sure
4354
	we include the INSTANCE variable in the event environment.
4355
896 by Scott James Remnant
* init/control.c (control_bus_open, control_bus_disconnected)
4356
2008-04-18  Scott James Remnant  <scott@netsplit.com>
4357
901 by Scott James Remnant
* init/process.c (process_kill): Make sure we do send the signal to
4358
	* init/process.c (process_kill): Make sure we do send the signal to
4359
	the process group; in practice this makes no difference, but it pays
4360
	to be explicit in such things.
4361
	* init/tests/test_process.c (test_kill): Add a test case for when
4362
	the session leader is no more.
4363
900 by Scott James Remnant
* init/job.h (JobConfig): Another day, another obscure job config
4364
	* init/job.h (JobConfig): Another day, another obscure job config
4365
	detail.  This one is for adjusting how likely you are to be killed
4366
	by the OOM Killer.
4367
	* init/job.c (job_config_new): Set to zero by default.
4368
	* init/tests/test_job.c (test_config_new): And make sure it is zero.
4369
	* init/parse_job.c (stanza_oom): And it helps to have a function
4370
	to set that one.
4371
	* init/tests/test_parse_job.c (test_stanza_oom): Test it.
4372
	* init/errors.h: And we need an error if its out of bounds.
4373
	* init/conf.c (conf_reload_path): Which also needs to be caught.
4374
	* init/process.c (process_spawn): Of course, we have to do something
4375
	with the oom adjustment.
4376
	(process_error_read): message for failure error.
4377
	* init/process.h (processErrorType): And need an error if it fails
4378
899 by Scott James Remnant
* init/main.c: Drop the legacy configuration directory, the format
4379
	* init/main.c: Drop the legacy configuration directory, the format
4380
	of jobs has changed sufficiently to not support it.
4381
	* init/Makefile.am (AM_CPPFLAGS): Remove LEGACY_CONFDIR definition.
4382
	(install-data-local): Don't create it, either.
4383
898 by Scott James Remnant
* init/enum.c, init/enum.h, init/tests/test_enum.c: Remove these
4384
	* init/enum.c, init/enum.h, init/tests/test_enum.c: Remove these
4385
	source files, a hold-over from when we had them in a separate
4386
	library and passed around the integer values.
4387
	* init/job.c, init/job.h, init/tests/test_job.c: Restore in their
4388
	proper place.
4389
	* init/Makefile.am: Remove enum.* from build instructions.
4390
897 by Scott James Remnant
* init/main.c: Attempt to connect to the system bus on startup,
4391
	* init/main.c: Attempt to connect to the system bus on startup,
4392
	but don't expect it to work.
4393
896 by Scott James Remnant
* init/control.c (control_bus_open, control_bus_disconnected)
4394
	* init/control.c (control_bus_open, control_bus_disconnected)
4395
	(control_bus_close): Functions to open a connection to the D-Bus
4396
	system bus, clean up if disconnected or disconnect ourselves
4397
	explicitly.
4398
	* init/control.h: Prototypes.
4399
	* init/tests/test_control.c (test_bus_open)
4400
	(test_bus_disconnected, test_bus_close): Test the functions using
4401
	a fake D-Bus system bus daemon.
4402
	* init/errors.h: Add error for "name taken".
4403
	* init/Makefile.am (init_SOURCES): Build and link control.c and
4404
	control.h
4405
	(TESTS): Build and run control test suite.
4406
	(test_control_SOURCES, test_control_LDFLAGS, test_control_LDADD):
4407
	Details for control test suite.
4408
	(test_process_LDADD, test_job_LDADD, test_event_LDADD)
4409
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD):
4410
	Link control.o
4411
895 by Scott James Remnant
* init/job.h (JobConfig): Add leader member.
4412
2008-04-16  Scott James Remnant  <scott@netsplit.com>
4413
4414
	* init/job.h (JobConfig): Add leader member.
4415
	* init/job.c (job_config_new): Initialise leader to FALSE.
4416
	* init/tests/test_job.c (test_config_new): Make sure leader is FALSE.
4417
	(test_change_goal, test_change_state, test_run_process)
4418
	(test_kill_process, test_child_handler, test_handle_event)
4419
	(test_handle_event_finished): Jobs have to be leaders now to allow
4420
	waitpid() to work in test cases.
4421
	* init/parse_job.c (stanza_session): Parse "session leader" stanza
4422
	to set to TRUE.
4423
	* init/tests/test_parse_job.c (test_stanza_session): Test new
4424
	stanza parsing.
4425
	(test_stanza_console): Add missing "missing argument" test.
4426
	* init/process.c (process_error_read): Deal with new fork error.
4427
	(process_spawn): If we're not to be a session leader, fork again and
4428
	write the pid back on the open socket.
4429
	* init/process.h (ProcessErrorType): Introduce new fork error.
4430
	* init/tests/test_process.c (test_spawn): Test that we can't start
4431
	a non-session-leader and still have process details.
4432
	(test_spawn, test_kill): Other jobs have to be leaders now to
4433
	allow waitpid() to work.
4434
	* init/tests/test_event.c (test_poll): Jobs have to be leaders now
4435
	to allow waitpid() to work.
4436
889 by Scott James Remnant
* init/event.h (Event): We don't use the id field for anything;
4437
2008-04-12  Scott James Remnant  <scott@netsplit.com>
4438
894 by Scott James Remnant
* configure.ac (NIH_INIT): Require that libnih build D-Bus support,
4439
	* configure.ac (NIH_INIT): Require that libnih build D-Bus support,
4440
	failing configure if we can't get it.
4441
	* init/Makefile.am (AM_CFLAGS): Build with D-Bus CFLAGS,
4442
	(init_LDADD, test_process_LDADD, test_job_LDADD, test_event_LDADD)
4443
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD): and
4444
	link with libnih-dbus.la and D-Bus LIBS.
4445
	(init_LDFLAGS): No need for -static now since libnih will only exist
4446
	statically anyway.
4447
893 by Scott James Remnant
* init/main.c: Use a better name for kbdrequest
4448
	* init/main.c: Use a better name for kbdrequest
4449
	* init/event.h (KBDREQUEST_EVENT): Rename event to keyboard-request
4450
892 by Scott James Remnant
* init/main.c: Drop the attempt to rescue a crashed system by
4451
	* init/main.c: Drop the attempt to rescue a crashed system by
4452
	carrying on with no state
4453
	(crash_handler): After the child has core dumped, the parent will
4454
	die and the kernel will panic.  That's the best we can do, I think.
4455
891 by Scott James Remnant
* init/job.c (job_change_state): Don't generate the stalled event;
4456
	* init/job.c (job_change_state): Don't generate the stalled event;
4457
	there's nothing useful you can do with it other than start a root
4458
	shell and that's just a security hole waiting to happen.
4459
	(job_new): Don't increment the instances counter.
4460
	* init/job.h: Remove extern for instances counter.
4461
	* init/tests/test_job.c (test_new): Remove the check that the
4462
	instance counter is incremented.
4463
	(test_change_state): Remove the test for the stalled event.
4464
	* init/event.h (STALLED): Remove stalled event definition,
4465
	* TODO: Update.
4466
890 by Scott James Remnant
* init/job.h (Job): And while we're at it, the instance name is
4467
	* init/job.h (Job): And while we're at it, the instance name is
4468
	guaranteed unique for a given job name, which is also guaranteed
4469
	to be unique - so don't bother with job ids either, since they
4470
	also get reused in bad cases.
4471
	* init/job.c (job_next_id): Drop this function.
4472
	(job_new): Don't assign an id anymore.
4473
	(job_find_by_id): Drop this function.
4474
	(job_run_process): Set UPSTART_INSTANCE to the instance name if set.
4475
	(job_name): Function to create the string used in messages.
4476
	(job_change_goal, job_change_state, job_run_process)
4477
	(job_kill_process, job_kill_timer, job_child_handler)
4478
	(job_process_terminated, job_process_trace_new)
4479
	(job_process_trace_new_child, job_process_trace_signal)
4480
	(job_process_trace_fork, job_process_trace_exec): Use the instance
4481
	name in messages (if set) in place of the job id.
4482
	* init/tests/test_job.c (test_new): Drop checks on the id field.
4483
	(test_find_by_id): Drop test.
4484
	(test_run_process): Check that UPSTART_INSTANCE is set only for
4485
	named job instances, and contains the instance name.
4486
	(test_change_state, test_run_process, test_child_handler): Remove
4487
	id setting and update error message checks.
4488
	* TODO: Update.
4489
889 by Scott James Remnant
* init/event.h (Event): We don't use the id field for anything;
4490
	* init/event.h (Event): We don't use the id field for anything;
4491
	and it can't be guaranteed to be unique since it can wrap over
4492
	and get reused.  Drop it.
4493
	* init/event.c (event_next_id): Drop this function.
4494
	(event_new): Don't assign an id anymore.
4495
	(event_find_by_id): Drop this function.
4496
	* init/tests/test_event.c (test_new): Drop checks on the id field
4497
	(test_find_by_id): Drop test.
4498
	(test_poll): Drop id setting which was needless anyway.
4499
886 by Scott James Remnant
* init/job.c (job_init): Create hash using nih_hash_string_new()
4500
2008-04-11  Scott James Remnant  <scott@netsplit.com>
4501
888 by Scott James Remnant
* init/tests/test_job.c (test_child_handler): Add tests to make
4502
	* init/tests/test_job.c (test_child_handler): Add tests to make
4503
	sure that respawn works for both services and tasks; the only
4504
	difference we want for tasks is that zero is a normal exit code.
4505
	* init/job.c (job_process_terminated): Status need not be non-zero
4506
	if the job is not a task.
4507
887 by Scott James Remnant
Change the default job type from task to service, which will
4508
	Change the default job type from task to service, which will
4509
	finally match people's expectations.
4510
4511
	* init/job.h (JobConfig): Replace service member with task
4512
	* init/job.c (job_config_new): Initialise task to FALSE
4513
	(job_change_state): Unblock if not a task instead of if a service
4514
	* init/tests/test_job.c (test_config_new): Make sure task is FALSE
4515
	(test_change_state): Check service by default, task with flag;
4516
	this also means we expect blockers to be cleared if we end up in
4517
	running for the other checks
4518
	(test_child_handler): Expect blockers to be cleared if we end up
4519
	in running now that service is the default.
4520
	* init/tests/test_event.c (test_poll): Test with a task since
4521
	we want to remain blocked for longer.
4522
	* init/parse_job.c (stanza_respawn): Don't set service to TRUE
4523
	(stanza_service): Rename to stanza_task and set task flag instead
4524
	* init/tests/test_parse_job.c (test_stanza_respawn): Remove checks
4525
	for setting of service flag
4526
	(test_stanza_service): Rename to test_stanza_task and test task
4527
886 by Scott James Remnant
* init/job.c (job_init): Create hash using nih_hash_string_new()
4528
	* init/job.c (job_init): Create hash using nih_hash_string_new()
4529
	* init/conf.c (conf_source_new): Likewise.
4530
881 by Scott James Remnant
* TODO: Document the problems with overflowing ids and instance
4531
2008-03-08  Scott James Remnant  <scott@netsplit.com>
4532
884 by Scott James Remnant
* HACKING: Terminology changes: Bazaar-NG is now just Bazaar;
4533
	* HACKING: Terminology changes: Bazaar-NG is now just Bazaar;
885 by Scott James Remnant
ws fix
4534
	Malone is now just Launchpad's bug tracking system.  Update bugs
884 by Scott James Remnant
* HACKING: Terminology changes: Bazaar-NG is now just Bazaar;
4535
	URL to match modern form.
4536
883 by Scott James Remnant
* init/enum.h (JobWaitType): Rename to JobExpect
4537
	* init/enum.h (JobWaitType): Rename to JobExpect
4538
	* init/job.h (JobConfig): Rename wait_for to expect
4539
	* init/job.c (job_config_new, job_change_state, job_run_process)
4540
	(job_process_stopped, job_process_trace_new_child): Rename wait_for
4541
	to expect in all occurances.
4542
	* init/tests/test_job.c: Likewise rename all occurances.
4543
	* init/parse_job.c (stanza_wait): Rename to stanza_expect and drop
4544
	the intermediate argument.
4545
	* init/tests/test_parse_job.c (test_stanza_wait): Rename to
4546
	test_stanza_expect and adjust tests to match new syntax.
4547
	* init/tests/test_process.c (test_spawn): Remove set of wait_for.
4548
882 by Scott James Remnant
* doc/states.dot: Remove the state transition from starting to
4549
	* doc/states.dot: Remove the state transition from starting to
4550
	waiting ("emit_stopped" in the graph); we don't have a "respawning
4551
	too fast" exit here anymore, so always go to stopping.
4552
	* doc/states.png: Regenerate.
4553
881 by Scott James Remnant
* TODO: Document the problems with overflowing ids and instance
4554
	* TODO: Document the problems with overflowing ids and instance
4555
	counter before I forget about them.
4556
873 by Scott James Remnant
* init/tests/test_environ.c (test_expand): Check that a string
4557
2008-03-07  Scott James Remnant  <scott@netsplit.com>
4558
880 by Scott James Remnant
* TODO: Update.
4559
	* TODO: Update.
4560
879 by Scott James Remnant
* init/job.h (JobConfig): Add instance_name member.
4561
	* init/job.h (JobConfig): Add instance_name member.
4562
	(Job): Add name member.
4563
	* init/job.c (job_config_new): Initialise instance name to NULL.
4564
	(job_new): Accept the name as an argument, reparenting and stealing
4565
	(job_handle_event): Expand the instance name and pass to job_new
4566
	(job_instance): Accept a name and look that up in the list of current
4567
	instances returning the instance if found.
4568
	* init/tests/test_job.c: Add extra argument to all job_new calls
4569
	(test_config_new): Make sure instance name is initialised to NULL.
4570
	(test_handle_event): Make sure the job name is set from the instance,
4571
	and make sure an existing instance is reused if we can.
4572
	(test_instance): Make sure that the existing instance is returned.
4573
	* init/parse_job.c (stanza_instance): Check for an optional argument
4574
	and store it in the instance_name member if it exists, otherwise
4575
	free and reset the instance_name member.
4576
	* init/tests/test_parse_job.c (test_stanza_instance): Check the new
4577
	argument is handled properly and stored in the right place.
4578
	* init/tests/test_conf.c (test_source_reload_job_dir)
4579
	(test_file_destroy): Add extra NULL to job_new
4580
	* init/tests/test_event.c (test_poll): Add extra NULL to job_new
4581
878 by Scott James Remnant
* init/event.c (event_operator_match): Accept an environment array
4582
	* init/event.c (event_operator_match): Accept an environment array
4583
	and expand the operator value against it before attempting to match.
4584
	(event_operator_handle): Also accept the environment array and pass
4585
	through to calls to event_operator_match().
4586
	* init/event.h: Update prototypes.
4587
	* init/tests/test_event.c (test_operator_match): Add extra NULL
4588
	argument to most tests, and add tests for known and unknown variable
4589
	references.
4590
	(test_operator_handle): Add extra NULL arguments to most tests, and
4591
	add test for passing of environment through.
4592
	(test_operator_reset): Add extra NULL argument to call.
4593
	* init/job.c (job_handle_event): Pass the job environment for the
4594
	stop event handling, but NULL for the start event.
4595
	* init/tests/test_job.c (test_handle_event): Make sure that a stop
4596
	operator is expanded from the job environment before being matched
4597
	against the stop event.
4598
877 by Scott James Remnant
* init/event.c, init/event.h, init/environ.c: Documentation tweaks.
4599
	* init/event.c, init/event.h, init/environ.c: Documentation tweaks.
4600
875 by Scott James Remnant
* init/job.c (job_change_state): Remove the code to check for runaway
4601
	* init/job.c (job_change_state): Remove the code to check for runaway
4602
	jobs from here, we'll always let people explicitly start an instance.
4603
	(job_process_terminated): Call job_catch_runaway when actually doing
4604
	the respawn instead.
4605
	* init/tests/test_job.c (test_change_state): Remove "too fast" checks,
4606
	we're going to allow start/stop requests to restart jobs as much as
4607
	they like since this is an external request.
4608
	(test_handle_event, test_handle_event_finished): No need to remove
4609
	a respawn limit with this behaviour.
4610
	(test_child_handler): Instead check that the respawn counter is
4611
	dealt with by the child handler.
4612
874 by Scott James Remnant
* TODO: Update, I found a bug with the current model.
4613
	* TODO: Update, I found a bug with the current model.
4614
873 by Scott James Remnant
* init/tests/test_environ.c (test_expand): Check that a string
4615
	* init/tests/test_environ.c (test_expand): Check that a string
4616
	without an expansion still works ok.
4617
872 by Scott James Remnant
* init/event.c (event_operator_collect): Just use strcat functions.
4618
2008-03-06  Scott James Remnant  <scott@netsplit.com>
4619
4620
	* init/event.c (event_operator_collect): Just use strcat functions.
4621
864 by Scott James Remnant
* init/job.c (job_handle_event): Collect the stop events and store
4622
2008-03-03  Scott James Remnant  <scott@netsplit.com>
4623
871 by Scott James Remnant
* init/environ.c (environ_valid): New function to check the validity
4624
	* init/environ.c (environ_valid): New function to check the validity
4625
	of an environment variable name, should call before accepting any.
4626
	(environ_expand_until): New function to expand variable references
4627
	in a string using an environment table; supports a few common
4628
	shell-like expressions.
4629
	(environ_getn): Change to return the value of the string, not the
4630
	entire environment string.
4631
	* init/environ.h: Add prototypes.
4632
	* init/errors.h: Add errors raised by new functions.
4633
	* init/tests/test_environ.c (test_valid, test_expand): Add test
4634
	cases for the new functions.
4635
	(test_get, test_getn): Change test case to check for the variable
4636
	value instead of returning the whole string.
4637
870 by Scott James Remnant
* TODO: Add thoughts on blocking commands.
4638
	* TODO: Add thoughts on blocking commands.
4639
869 by Scott James Remnant
* TODO: Update.
4640
	* TODO: Update.
4641
868 by Scott James Remnant
* init/event.h (Event): Remove the refs member; we now never hold
4642
	* init/event.h (Event): Remove the refs member; we now never hold
4643
	a reference to an event we're blocking since we always copy the
4644
	environment out if we want to keep it.
4645
	(EventOperator): Events are always blocked while we hold them,
4646
	so drop the blocked member.
4647
	(EventProgress): The done state is no longer needed, we can free
4648
	in finished now.
4649
	* init/event.c (event_ref, event_unref): Drop these functions.
4650
	(event_new): Don't ininitialise the refs member since it's gone.
4651
	(event_poll): Remove the done state since it's directly freed
4652
	in event_finished again
4653
	(event_finished): No done state, event is freed before return.
4654
	(event_operator_new): No blocked member.
4655
	(event_operator_copy): Always block the event after copying.
4656
	(event_operator_destroy): Simply unblock.
4657
	(event_operator_handle): Simply block the event on match.
4658
	(event_operator_collect): Always block the copied event
4659
	(event_operator_unblock): This function is no longer required, since
4660
	it has an identical effect to reset.
4661
	(event_operator_reset): Simply unblock the event.
4662
	* init/tests/test_event.c (test_new): Drop the check for refs
4663
	being initialised to zero.
4664
	(test_ref, test_unref, test_operator_collect): Drop test for
4665
	functions that have been dropped in the code.
4666
	(test_operator_new): Drop the check for blocked being initialised
4667
	to FALSE.
4668
	(test_block, test_unblock, test_operator_destroy): Drop any references
4669
	to the refs member.
4670
	(test_operator_destroy): Actually fix the function to test things.
4671
	(test_poll): Drop the check for remaining in the done state.
4672
	(test_operator_new, test_operator_copy): Drop the checks for blocked.
4673
	(test_operator_handle, test_operator_collect, test_opreator_reset):
4674
	Drop references to refs and blocked.
4675
	* init/job.c (job_unblock, job_handle_event): Drop the call to
4676
	event_unref() since the next call was always event_unblock() and
4677
	that's the one that we didn't delete.
4678
	* init/tests/test_job.c (test_change_state, test_child_handler)
4679
	(test_handle_event, test_handle_event_finished): Events don't
4680
	have references anymore, so remove calls to reference, unreference
4681
	and checks for the reference count - it's all done with blocks now.
4682
	(test_new): Remove check that the operator is not blocked for a
4683
	new job since there's no such thing now.
4684
	(test_handle_event): Operators don't have a blocked member anymore,
4685
	if there's an event, it's blocked.
4686
867 by Scott James Remnant
* init/job.c (job_change_state): Don't reference the event we're
4687
	* init/job.c (job_change_state): Don't reference the event we're
4688
	blocked on, we'll always know when it's finished.
4689
	(job_handle_event_finished): Likewise no reason to unreference it.
4690
	* init/tests/test_job.c (test_change_goal, test_child_handler)
4691
	(test_handle_event, test_change_state)
4692
	(test_handle_event_finished): Remove the expectation that the blocked
4693
	event is referenced by the job.
4694
	* init/tests/test_event.c (test_poll): Don't reference the event,
4695
	since the job would not have.
4696
866 by Scott James Remnant
* init/job.c (job_emit_event): Use environ_add/set for style
4697
	* init/job.c (job_emit_event): Use environ_add/set for style
4698
	reasons.
4699
865 by Scott James Remnant
* init/job.c (job_handle_event): Reset the stop_on operator after
4700
	* init/job.c (job_handle_event): Reset the stop_on operator after
4701
	processing the event, thus the expression needs to be completely
4702
	reevaluated before the job can be stopped again by it.  At last,
4703
	correct behaviour!
4704
	(job_change_state): No reason to reset the stop_on operator when
4705
	starting since it's always reset after evaluating to TRUE now;
4706
	likewise no reason to reset on re-entering running or waiting,
4707
	job_unblock() is sufficient.
4708
	(job_failed): No reason to iterate stop_on to set failed, it's
4709
	empty - job_unblock() does what we want.
4710
	* init/tests/test_job.c (test_handle_event): Check that the operator
4711
	is actually reset and the event not referenced when handling from
4712
	the event.
4713
	(test_change_state, test_child_handler): Don't put anything in stop_on
4714
	and thus don't expect anything to come out of it -- event environment
4715
	is all done in stop_env and blocking done in blocking.
4716
864 by Scott James Remnant
* init/job.c (job_handle_event): Collect the stop events and store
4717
	* init/job.c (job_handle_event): Collect the stop events and store
4718
	them in the blocking list, unblocking any that were there before
4719
	such as the start events.
4720
	(job_change_state): Unblock blocking events when returning to running
4721
	from pre-stop.
4722
	* init/tests/test_job.c (test_handle_event): Make sure the stop
4723
	events are collected and replace any previously blocking events.
4724
	(test_change_state, test_child_handler): Test that stop events in
4725
	the blocking list are kept and unblocked when necessary.
4726
846 by Scott James Remnant
* TODO: Update.
4727
2008-03-02  Scott James Remnant  <scott@netsplit.com>
4728
863 by Scott James Remnant
* init/job.c (job_change_state): Shouldn't emit the started event
4729
	* init/job.c (job_change_state): Shouldn't emit the started event
4730
	on pre-stop cancellation, and shouldn't unblock the job because
4731
	it's a service.
864 by Scott James Remnant
* init/job.c (job_handle_event): Collect the stop events and store
4732
862 by Scott James Remnant
* init/job.c (job_change_state): Throw away the stop environment
4733
	* init/job.c (job_change_state): Throw away the stop environment
4734
	when starting and returning to running.
4735
	* init/tests/test_job.c (test_change_state): Make sure the stop
4736
	environment is actually thrown away.
4737
861 by Scott James Remnant
* init/job.c (job_run_process): Append the environment from the
4738
	* init/job.c (job_run_process): Append the environment from the
4739
	stop events if given the pre-stop process to run; do this before
4740
	the special events so they can never be overriden.
4741
	* init/tests/test_job.c (test_run_process): Check that the stop event
4742
	environment is included for pre-stop and not for other jobs.
4743
860 by Scott James Remnant
* init/job.c (job_handle_event): Remove setting of UPSTART_JOB
4744
	* init/job.c (job_handle_event): Remove setting of UPSTART_JOB
4745
	and UPSTART_JOB_ID, we set that when we run the process.
4746
	* init/tests/test_job.c (test_handle_event): Don't check for
4747
	UPSTART_JOB and UPSTART_JOB_ID since we no longer copy it in here.
4748
859 by Scott James Remnant
* init/job.c (job_run_process): Copy the environment to pass it to
4749
	* init/job.c (job_run_process): Copy the environment to pass it to
4750
	the job, appending the UPSTART_JOB and UPSTART_JOB_ID variables here;
4751
	we never want to be able to match these, etc.
4752
	* init/tests/test_job.c (test_run_process): Add tests to make sure
4753
	that the environment is actually set in the processes we run.
4754
858 by Scott James Remnant
* init/job.h (Job): Add stop_env member to store environment from
4755
	* init/job.h (Job): Add stop_env member to store environment from
4756
	stop events for the stop script.
4757
	* init/job.c (job_new): Initialise stop_env to NULL.
4758
	(job_handle_event): Copy environment from the stop_on operator into
4759
	the stop_env member.
4760
	* init/tests/test_job.c (test_new): Check that stop_env is NULL.
4761
	(test_handle_event): Add lots of tests to make sure that the
4762
	environment is collected from the events and stored in stop_env
4763
	properly, overwriting what was there already if necessary.
4764
857 by Scott James Remnant
* init/init.supp (job-run-process-args): Add a suppression for the
4765
	* init/init.supp (job-run-process-args): Add a suppression for the
4766
	fact that job_run_process will leak its arguments to a new process
4767
	assuming that it will call exec() or exit()
4768
856 by Scott James Remnant
* init/tests/test_job.c (test_child_handler): Remove bogus free tag
4769
	* init/tests/test_job.c (test_child_handler): Remove bogus free tag
4770
	of the list, which we don't use in this test (valgrind failure)
4771
855 by Scott James Remnant
* init/job.h (Job): Remove the start_on member.
4772
	* init/job.h (Job): Remove the start_on member.
4773
	* init/job.c (job_new): Don't initialise start_on since it's gone.
4774
	(job_change_state): Drop call to unblock the start_on operator since
4775
	the events are already unblocked by job_unblock.
4776
	(job_failed): Drop setting of start_on events to failed since this
4777
	is already done by job_unblock.  This results in a slight change in
4778
	behaviour, now when a job fails to start - the event or command will
4779
	be immediately unblocked since there's no point waiting until it
4780
	stops again - it was waiting for it to start.
4781
	* init/tests/test_job.c (test_new): Remove start_on checks
4782
	(test_change_state, test_child_handler, test_handle_event): Remove
4783
	all references to start_on, instead relying on the blocking checks
4784
	instead.
4785
	* init/tests/test_event.c (test_poll): Remove solitary reference
4786
	to job's start_on, this wasn't necessary anyway - we proved that it
4787
	was the right event by affecting the job.  Revert previous commit
4788
	that temporarily increased the number of references, they should be
4789
	one again now only the blocking list holds them.
4790
854 by Scott James Remnant
* init/job.h (job): Add blocking member, a list of events that we're
4791
	* init/job.h (job): Add blocking member, a list of events that we're
4792
	blocking from finishing.
4793
	* init/job.c (job_new): Initialise blocking member to NULL.
4794
	(job_handle_event): Collect the list of events from the operator
4795
	and store them in the job's blocking list (unblocking any existing
4796
	first); if the job is already running, unblock unref and discard.
4797
	(job_unblock): New function to deal with unblocking the events we're
4798
	holding onto and resetting the blocking list; this will be extended
4799
	later to also unblock any command.
4800
	(job_change_state): Unblock events in running for services and in
4801
	waiting for everything.
4802
	(job_failed): Unblock events and mark them as failed.
4803
	* init/tests/test_job.c (test_new): Check that it's initialised to NULL
4804
	(test_handle_event): Extend the test cases to check the value of the
4805
	blocking list, and to make sure that the previous blocking list is
4806
	overwritten when necessary.
4807
	(test_change_state, test_child_handler): Extend test cases so that
4808
	wherever we're had a blocked event in start_on, we also have that in
4809
	the blocking list.
4810
	* init/tests/test_event.c (test_poll): Temporarily increase the
4811
	expected number of references/blockers to the event in the poll
4812
	test.
4813
853 by Scott James Remnant
* init/job.h (Job): Add start_env member, this stores the environment
4814
	* init/job.h (Job): Add start_env member, this stores the environment
4815
	to use when starting the event so it doesn't overwrite the current
4816
	environment of a restarting job.
4817
	* init/job.c (job_handle_event): Do the heavy lifting of starting a
4818
	new job instance here; construct the environment from the built-ins
4819
	and configured, append that collected from the start events, locate
4820
	or create a new instance, add the job name and id then copy into
4821
	the new start_env member before starting the job.  At some point
4822
	this will probably all become a function since it'll be similar for
4823
	the control functions.
4824
	(job_change_state): Copy the start_env member into the env member
4825
	when in the starting state; thus the job environment remains the same
4826
	until restarted.
4827
	(job_new): Remove code to initialise the environment, we now do that
4828
	when actually starting the instance.
4829
	* init/tests/test_job.c (test_handle_event): Add test cases for
4830
	starting the job, making sure that the environment is correctly
4831
	copied into the right field and also checking what happens if it's
4832
	already stopping or running.
4833
	(test_change_state): Make sure that start_env is correctly copied
4834
	over into env, overwriting what is there if non-NULL or keeping it
4835
	if NULL.
4836
	(test_new): Remove checks for environment setup, since we don't do
4837
	that anymore here; replace with checking for NULL and restore the
4838
	alloc fail tests.
4839
	* TODO: Update.
4840
852 by Scott James Remnant
* init/environ.c (environ_add): Allow it to accept NULL length, since
4841
	* init/environ.c (environ_add): Allow it to accept NULL length, since
4842
	we can't always keep that around.
4843
851 by Scott James Remnant
* init/process.c (process_spawn): Accept the environment list as
4844
	* init/process.c (process_spawn): Accept the environment list as
4845
	a parameter, then finally we can change this function to take a
4846
	JobConfig as the first argument.
4847
	(process_error_read): Remove the associated error handler.
4848
	* init/process.h: Change prototype.
4849
	(ProcessErrorType): Remove error enum for environment.
4850
	* init/tests/test_process.c (test_spawn): Update calls in test to
4851
	just pass in an environment array (direct testing).
4852
	* init/job.c (job_run_process): Pass configuration and environment
4853
	to process_spawn.
4854
850 by Scott James Remnant
* init/process.c (process_spawn): Take the environment directly out
4855
	* init/process.c (process_spawn): Take the environment directly out
4856
	the job structure, rather than recreating it.
4857
	(process_environment): Drop function, absorbed elsewhere.
4858
	* init/process.h: Remove prototype.
4859
	* init/tests/test_process.c (test_spawn): Set the job_id variable
4860
	before calling job_new and set config->start_on instead of
4861
	job->start_on so that job_new can pick up both.
4862
	(test_environment): Remove test cases.
4863
849 by Scott James Remnant
* init/job.h (Job): finally gains env pointer of its own.
4864
	* init/job.h (Job): finally gains env pointer of its own.
4865
	* init/job.c (job_new): Initialise the environment, moving the last
4866
	of the code from process_environment -- this is only temporary
4867
	though in the interests of refactoring, it'll move out of here again
4868
	soon enough.
4869
	* init/tests/test_job.c (test_new): Make sure that the environment is
4870
	set in a manner which tests the overriding of things by other things;
4871
	we have to temporarily comment out the alloc fail stuff though :-(
4872
848 by Scott James Remnant
* init/event.c (event_operator_collect): Make list the last argument
4873
	* init/event.c (event_operator_collect): Make list the last argument
4874
	for consistency with future functions.
4875
	* init/event.h: Update prototype.
4876
	* init/tests/test_event.c (test_operator_collect): Swap arguments.
4877
	* init/process.c (process_environment): Update.
4878
847 by Scott James Remnant
* init/job.c (job_config_environment): Function to generate an
4879
	* init/job.c (job_config_environment): Function to generate an
4880
	environment table from a JobConfig, code largely moved from process.c
4881
	* init/job.h: Add protoyype.
4882
	(JOB_DEFAULT_ENVIRONMENT): List of environment variables to always
4883
	copy from the environment (moved from process.h)
4884
	* init/tests/test_job.c (test_config_environment): Add test case,
4885
	again largely copied from test_process.c
4886
	* init/process.c (process_environment): Call job_config_environment
4887
	instead of the code moved out.
4888
	* init/process.h (PROCESS_ENVIRONMENT): Move to job.h
4889
	* TODO: Update.
4890
846 by Scott James Remnant
* TODO: Update.
4891
	* TODO: Update.
4892
843 by Scott James Remnant
* init/job.c (job_new): Increment the number of instances.
4893
2008-03-01  Scott James Remnant  <scott@netsplit.com>
4894
845 by Scott James Remnant
* init/event.c (event_operator_collect): Create a mega-function to
4895
	* init/event.c (event_operator_collect): Create a mega-function to
4896
	iterate an EventOperator tree (filtering out those bits that aren't
4897
	TRUE) and collect the events, adding them to a linked list, adding
4898
	their environment to a table and making a string list for another
4899
	environment variable.  Fundamentally this function marshals data
4900
	out of the Event subsystem into the right format for the Job subsystem.
4901
	* init/event.h: Add prototype.
4902
	* init/tests/test_event.c (test_operator_collect): Tests for the
4903
	collector function; some bits may seem similar to test_process.c
4904
	* init/process.c (process_environment): Use event_operator_collect
4905
	to gather the environment, instead of its own code (which pretty
4906
	much got pasted into event_operator_collect anyway).  Force everything
4907
	else to allocate matching the caller.
4908
	* init/tests/test_process.c (test_spawn, test_environment): Had
4909
	forgotten to set the value of the intermediate AND operator to TRUE,
4910
	necessary now.
4911
844 by Scott James Remnant
* init/process.c (process_environment_add): Move and rename this
4912
	* init/process.c (process_environment_add): Move and rename this
4913
	function, since it's not really process associated
4914
	(process_environment): Change to use environ_add or environ_setf
4915
	instead.
4916
	* init/process.h: Remove prototype.
4917
	* init/environ.c (environ_add): New name/location of
4918
	process_environment_add, modified to not take a copy of the string
4919
	(environ_set): Wrapper for the above for common dealing with
4920
	environment we want to set from a format string.
4921
	(environ_get, environ_getn, environ_lookup): Functions to get an
4922
	environment variable entry; largely cripped from event.c but
4923
	bug-fixed at the same time.
4924
	* init/environ.h: Function prototypes.
4925
	* init/event.c (event_operator_match): Change to use environ_lookup
4926
	* init/tests/test_process.c (test_environment_add): Move the tests.
4927
	* init/tests/test_environ.c: Test suite for environment handling
4928
	* init/Makefile.am (init_SOURCES): Build environ.c and environ.h
4929
	(TESTS): Build environment test suite
4930
	(test_environ_SOURCES, test_environ_LDFLAGS, test_environ_LDADD):
4931
	Details for environment test suite
4932
	(test_process_LDADD, test_job_LDADD, test_event_LDADD)
4933
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD):
4934
	Link environ.o to other test suites
4935
843 by Scott James Remnant
* init/job.c (job_new): Increment the number of instances.
4936
	* init/job.c (job_new): Increment the number of instances.
4937
	(job_instance): Simplify the function, it now only returns the
4938
	existing instance or NULL.  This makes it easier to extend when
4939
	we have env-limited instances later on.
4940
	(job_handle_event): If job_instance returns NULL, create
4941
	a new instance with job_new() and always reset the operator afterwards.
4942
	* init/tests/test_job.c (test_new): Check that the instances variable
4943
	is incremented when a new job is created.
4944
	(test_instance): Change to check that it returns NULL when there is
4945
	no active instance, or for multi-instance jobs, instead of creating
4946
	a new one itself.
4947
	(test_config_replace, test_find_by_pid)
4948
	(test_find_by_id, test_change_goal, test_change_state)
4949
	(test_next_state, test_run_process, test_kill_process)
4950
	(test_child_handler, test_handle_event)
4951
	(test_handle_event_finished): Call job_new to create a new instance
4952
	from a config, instead of job_instance.
4953
4954
	* init/tests/test_conf.c (test_source_reload_job_dir)
4955
	(test_file_destroy): Call job_new to create a new instance from a
4956
	config, instead of job_instance.
4957
	* init/tests/test_event.c (test_poll): Call job_new to create a new
4958
	instance from a config, instead of job_instance.
4959
	* init/tests/test_process.c (test_spawn, test_environment): Call
4960
	job_new to create a new instance from a config, instead of job_instance
4961
841 by Scott James Remnant
* init/Makefile.am (AM_CPPFLAGS): Replace TELINIT definition with
4962
2008-02-29  Scott James Remnant  <scott@netsplit.com>
4963
842 by Scott James Remnant
* configure.ac: Compare the evaluated $sbindir against the common
4964
	* configure.ac: Compare the evaluated $sbindir against the common
4965
	things we put in PATH, if it doesn't match, define EXTRA_PATH to
4966
	contain it.
4967
	* init/paths.h: Append EXTRA_PATH to PATH if defined.
4968
841 by Scott James Remnant
* init/Makefile.am (AM_CPPFLAGS): Replace TELINIT definition with
4969
	* init/Makefile.am (AM_CPPFLAGS): Replace TELINIT definition with
4970
	SBINDIR, pointing at the common directory.
4971
	* compat/sysv/Makefile.am (AM_CPPFLAGS): Replace SHUTDOWN definition
4972
	with SBINDIR, pointing at the common directory.
4973
	* init/paths.h (TELINIT): Redefine to be SBINDIR with "/telinit"
4974
	on the end; define SBINDIR if necessary.
4975
	* compat/sysv/reboot.c (SHUTDOWN): Redefine to be SBINDIR with
4976
	"/shutdown" on the end; define SBINDIR if necessary.
4977
833 by Scott James Remnant
* TODO: Update with job atomicity notes.
4978
2008-02-22  Scott James Remnant  <scott@netsplit.com>
4979
840 by Scott James Remnant
* init/event.c (event_operator_match): Rewrite to match both
4980
	* init/event.c (event_operator_match): Rewrite to match both
4981
	positionally and by name.
4982
	* init/tests/test_event.c (test_operator_match): Update tests to
4983
	check the new behaviour works.
4984
838 by Scott James Remnant
* init/parse_job.c (parse_on_operand): Add arguments to env list
4985
	* init/parse_job.c (parse_on_operand): Add arguments to env list
839 by Scott James Remnant
rather than args; sanity check afterwards to ensure that positional
4986
	rather than args; sanity check afterwards to ensure that positional
4987
	doesn't follow name-based -- when parsing the job is the right place
4988
	to catch this.
838 by Scott James Remnant
* init/parse_job.c (parse_on_operand): Add arguments to env list
4989
	* init/tests/test_parse_job.c (test_stanza_start)
4990
	(test_stanza_stop): Change args to env when checking operators.
839 by Scott James Remnant
rather than args; sanity check afterwards to ensure that positional
4991
	Check that arguments may be quoted in manners that we expect to be
4992
	sane.  Check that positional arguments cannot follow name-based ones.
4993
	* init/errors.h: Add new error.
4994
	* init/conf.c (conf_reload_path): Treat expected variable as a
4995
	permanent error.
838 by Scott James Remnant
* init/parse_job.c (parse_on_operand): Add arguments to env list
4996
837 by Scott James Remnant
* init/tests/test_process.c (test_spawn, test_environment):
4997
	* init/tests/test_process.c (test_spawn, test_environment): 
4998
	Update event_new() calls to remove extra argument.
4999
836 by Scott James Remnant
* init/main.c (main, cad_handler, kbd_handler, pwr_handler):
5000
	* init/main.c (main, cad_handler, kbd_handler, pwr_handler):
5001
	Update event_new() calls to remove extra argument.
5002
835 by Scott James Remnant
* init/job.c (job_change_state): Update event_new () call.
5003
	* init/job.c (job_change_state): Update event_new () call.
5004
	(job_emit_event): Update to put failure information in environment.
5005
	* init/tests/test_job.c (test_new, test_instance)
5006
	(test_child_handler, test_handle_event)
5007
	(test_handle_event_finished): Remove extra argument to event_new,
5008
	rename args to env in operator where necessary.
5009
	(test_change_state): Update to check emitted event by full environment.
5010
834 by Scott James Remnant
* init/event.h (Event): Remove args member.
5011
	* init/event.h (Event): Remove args member.
5012
	(EventOperator): Rename args member to env.
5013
	Update prototypes to match.
5014
	* init/event.c (event_new): Remove args member.
5015
	(event_finished): Remove copying of args member to failed event.
5016
	(event_operator_new): Rename args member to env.
5017
	(event_operator_copy): Rename args copying to env.
5018
	(event_operator_match): ??
5019
	* init/tests/test_event.c (test_new): Update test to remove args.
5020
	(test_operator_new): Update test to rename args to env.
5021
	(test_operator_copy): Update test to rename args to env.
5022
	(test_operator_match): ???
5023
833 by Scott James Remnant
* TODO: Update with job atomicity notes.
5024
	* TODO: Update with job atomicity notes.
5025
831 by Scott James Remnant
* init/job.h: Update prototypes to match variable names in the
5026
2008-02-20  Scott James Remnant  <scott@netsplit.com>
5027
832 by Scott James Remnant
* init/job.c: Switch around job_find_by_pid and job_find_by_id
5028
	* init/job.c: Switch around job_find_by_pid and job_find_by_id
5029
	* init/job.h: Likewise.
5030
831 by Scott James Remnant
* init/job.h: Update prototypes to match variable names in the
5031
	* init/job.h: Update prototypes to match variable names in the
5032
	code.
5033
827 by Scott James Remnant
* README: Update kernel recommendation to 2.6.24, since that's
5034
2008-02-17  Scott James Remnant  <scott@netsplit.com>
5035
830 by Scott James Remnant
* init/process.c (process_kill): Change to accept a JobConfig rather
5036
	* init/process.c (process_kill): Change to accept a JobConfig rather
5037
	than a Job, since in theory this should only ever need that in a
5038
	future where we can specify a kill signal (right now it's not used
5039
	for anything!)
5040
	* init/process.h: Update prototype.
5041
	* init/tests/test_process.c (test_kill): Update test cases.
5042
	* init/job.c (job_kill_process, job_kill_timer): Pass in JobConfig
5043
	instead of Job.
5044
829 by Scott James Remnant
* init/process.c (process_spawn): Accept trace as an argument instead
5045
	* init/process.c (process_spawn): Accept trace as an argument instead
5046
	of using a random piece of job state to determine whether to trace
5047
	or not.
5048
	* init/process.h: Update prototype.
5049
	* init/tests/test_process.c (test_spawn): Update tests to pass in
5050
	via argument whether to trace the job or not.
5051
	* init/job.c (job_run_process): Pass in the trace variable rather
5052
	than relying on it working it out for itself; this means we don't
5053
	need to set the state until after, therefore don't need to reset it.
5054
828 by Scott James Remnant
* AUTHORS, logd/jobs.d/logd.in: Update e-mail addresses.
5055
	* AUTHORS, logd/jobs.d/logd.in: Update e-mail addresses.
5056
827 by Scott James Remnant
* README: Update kernel recommendation to 2.6.24, since that's
5057
	* README: Update kernel recommendation to 2.6.24, since that's
5058
	the oldest version that the test suite will complete under.
5059
824 by Scott James Remnant
* init/process.c (process_environment): Function to build an
5060
2008-01-17  Scott James Remnant  <scott@netsplit.com>
5061
826 by Scott James Remnant
* TODO: Update.
5062
	* TODO: Update.
5063
825 by Scott James Remnant
* init/job.c (job_run_process): Don't append the list of event
5064
	* init/job.c (job_run_process): Don't append the list of event
5065
	names, they can be found in $UPSTART_EVENTS now.  This is better
5066
	since it's consistent for exec and script.
5067
	* init/tests/test_job.c (test_run_process): Drop test case.
5068
824 by Scott James Remnant
* init/process.c (process_environment): Function to build an
5069
	* init/process.c (process_environment): Function to build an
5070
	environment table for a job containing built-in variables, those
5071
	from the configuration, events and finally the upstart job ones.
5072
	(process_environment_add): Helper function for the above that
5073
	handles adding a variable to the array; dealing with fetching the
5074
	value from init's environment if necessary.
5075
	(process_setup_environment): This function now gets dropped in
5076
	favour of the new ones.
5077
	(process_spawn): Call the new process_environment() function and set
5078
	the environ variable directly.
5079
	* init/process.h (PROCESS_ENVIRONMENT): Define built-in environment
5080
	variables that are always copied from our own environment.
5081
	Add prototypes.
5082
	* init/tests/test_process.c (test_environment): Check that the
5083
	environment is built correctly and that each bit overrides the
5084
	right other bit.
5085
	(test_environment_add): Check that the array is built correctly.
5086
	(test_spawn): Adjust order and values of expected environment
5087
	to match what's now set.
5088
815 by Scott James Remnant
* init/job.c (job_change_state): Check the return value of
5089
2008-01-16  Scott James Remnant  <scott@netsplit.com>
5090
823 by Scott James Remnant
* init/job.c (job_failed): Separate the logic that marks the job
5091
	* init/job.c (job_failed): Separate the logic that marks the job
5092
	and its associated events as failed into its own function, since
5093
	it's a large enough amount of code that we were otherwise duplicating
5094
	everywhere else (and in a few places, failing to mark the events as
5095
	failed as well).
5096
	(job_change_state, job_process_terminated): Call job_failed instead
5097
	of doing it ourselves.
5098
	(job_emit_event): De-nest the logic and fix so that we don't add
5099
	environment to the failed respawn event.
5100
	* init/tests/test_job.c (test_change_state): Add checks on whether
5101
	the event was marked as failed or not.
5102
822 by Scott James Remnant
* TODO: Update.
5103
	* TODO: Update.
5104
821 by Scott James Remnant
* configure.ac (AC_COPYRIGHT): Update copyright to 2008.
5105
	* configure.ac (AC_COPYRIGHT): Update copyright to 2008.
5106
819 by Scott James Remnant
* TODO: Update.
5107
	* TODO: Update.
5108
818 by Scott James Remnant
* init/tests/test_job.c (test_child_handler): Don't run the signal
5109
	* init/tests/test_job.c (test_child_handler): Don't run the signal
5110
	and ptrace tests while in valgrind, sometimes signals (specifically
5111
	SIGCONT after SIGSTOP) don't behave right and we kinda need that
5112
	reliability.
5113
817 by Scott James Remnant
* init/tests/test_job.c (test_child_handler): After adding extra
5114
	* init/tests/test_job.c (test_child_handler): After adding extra
5115
	processes, make sure we clean up again so each test is roughly
5116
	independant.  Fix the final test case to not rely on previous
5117
	setup and work on its own.
5118
816 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Remove useless check
5119
	* init/tests/test_job.c (test_change_state): Remove useless check
5120
	of job->start_on from a killed/post-stop check (noticed while
5121
	writing the other).
5122
815 by Scott James Remnant
* init/job.c (job_change_state): Check the return value of
5123
	* init/job.c (job_change_state): Check the return value of
5124
	job_run_process() and if particular processes fail, change the
5125
	goal to stop and push the job into the next state; setting the job
5126
	as failed along the way.
5127
	(job_emit_event): If the exit_status is -1 then it means the job
5128
	failed to spawn, so don't place EXIT_SIGNAL or EXIT_STATUS in the
5129
	event environment.
5130
	* init/tests/test_job.c (test_change_state): Check what happens when
5131
	each process type fails, make sure that the job is stopped for
5132
	pre-start, spawned and post-stop and the failure is ignored for
5133
	post-start and pre-stop.
5134
806 by Scott James Remnant
* init/process.c (process_setup_limits): Integrate this function back
5135
2008-01-15  Scott James Remnant  <scott@netsplit.com>
5136
814 by Scott James Remnant
* init/main.c: Selectively compile out certain pieces when make is
5137
	* init/main.c: Selectively compile out certain pieces when make is
5138
	run with CPPFLAGS=-DDEBUG, giving us a build that'll happily run from
5139
	a user terminal.
5140
	* init/event.h: Change the startup event to "debug" when built like
5141
	that, so we don't accidentally do bad things.
5142
813 by Scott James Remnant
* init/job.c (job_run_process): Catch PROCESS_ERROR and abort the
5143
	* init/job.c (job_run_process): Catch PROCESS_ERROR and abort the
5144
	attempt to run the process, returning a non-temporary error condition.
5145
	* init/tests/test_job.c (test_run_process): Add test case for
5146
	attempting to spawn a file that doesn't exist.
5147
812 by Scott James Remnant
* init/process.c (process_error_read): Avoid the word process, since
5148
	* init/process.c (process_error_read): Avoid the word process, since
5149
	it's likely included in the higher error message.
5150
811 by Scott James Remnant
* init/process.c (process_spawn): Call process_error_abort() on any
5151
	* init/process.c (process_spawn): Call process_error_abort() on any
5152
	error condition.
5153
	* init/tests/test_process.c (test_spawn): Add a test case for failing
5154
	to spawn a process and receiving ProcessError correctly; fix other
5155
	cases to ensure they return a pid.
5156
810 by Scott James Remnant
* init/errors.h: Add PROCESS_ERROR to the enum, but not to the string
5157
	* init/errors.h: Add PROCESS_ERROR to the enum, but not to the string
5158
	list since there's no specific defined string for this one.
5159
	* init/process.h (ProcessError): Structure that builds on NihError
5160
	to add additional information for a process error.
5161
	(ProcessErrorType): enum of different process error types.
5162
	* init/process.c (process_spawn): After forking read the error in
5163
	the parent, returning if we raise one.
5164
	Ensure we close the pipe if the fork fails.
5165
	Re-order so that we set the environment, umask and priority after the
5166
	resource limits (which should apply to them).
5167
	(process_error_abort): New function to immediately abort with an
5168
	error, writing it on the pipe first.
5169
	(process_error_read): Counterpart function to read the error from
5170
	the pipe and raise it, with appropriate error messages.
5171
809 by Scott James Remnant
* init/process.c (process_spawn): Create a pipe to use for
5172
	* init/process.c (process_spawn): Create a pipe to use for
5173
	communication with the child, ensuring its closed before the parent
5174
	returns and ensuring that the writing end is close-on-exec in the
5175
	child.
5176
808 by Scott James Remnant
* init/job.c (job_run_process): Change to return a value indicating
5177
	* init/job.c (job_run_process): Change to return a value indicating
5178
	whether there's been a non-temporary error (always returns zero so
5179
	far).
5180
	* init/job.h: Update prototype.
5181
	* init/tests/test_job.c (test_run_process): Check that job_run_process
5182
	always returns zero.
5183
807 by Scott James Remnant
* init/job.c (job_change_goal): Document in which states this function
5184
	* init/job.c (job_change_goal): Document in which states this function
5185
	has unexpected side-effects such as freeing the job, since we do
5186
	attempt to call it from within job_change_state().
5187
806 by Scott James Remnant
* init/process.c (process_setup_limits): Integrate this function back
5188
	* init/process.c (process_setup_limits): Integrate this function back
5189
	into process_spawn() since there's no reason for it to be separate.
5190
	(process_setup_console): Alter this function so it closes the original
5191
	console descriptors, opens the new ones and can reset them to if
5192
	required -- in particular, this no longer takes a Job parameter.
5193
	(process_spawn): Use the new process_setup_console function and
5194
	integrate code from process_setup_limits().
5195
	* init/process.h: Update function prototype.
5196
	* init/main.c (main): Use the new process_setup_console() argument
5197
	form.  Move syslog opening to the end of the function, rather than
5198
	where it is now where it could be at risk of being closed again
5199
	immediately.  Change the root directory in case we're run in some
5200
	weird way.
5201
	(reset_console): Remove function since the code is now in
5202
	process_setup_console()
5203
	* init/enum.h (console_type): Remove CONSOLE_LOGGED and make the
5204
	CONSOLE_NONE constant be zero.
5205
	* init/parse_job.c (stanza_console): Drop parsing of "logged"
5206
	* init/tests/test_parse_job.c (test_stanza_console): Drop testing
5207
	of "logged" parsing.
5208
805 by Scott James Remnant
* HACKING: Correct bzr URLs to trunk.
5209
2008-01-14  Scott James Remnant  <scott@netsplit.com>
5210
5211
	* HACKING: Correct bzr URLs to trunk.
5212
802 by Scott James Remnant
* init/process.c (process_spawn): Group console closing and setup
5213
2007-12-15  Scott James Remnant  <scott@netsplit.com>
5214
804 by Scott James Remnant
* init/process.c (process_spawn): Fix some documentation strings.
5215
	* init/process.c (process_spawn): Fix some documentation strings.
5216
	
803 by Scott James Remnant
* init/process.c (process_kill): Move to beneath the process setup
5217
	* init/process.c (process_kill): Move to beneath the process setup
5218
	functions.
5219
	* init/process.h: Adjust ordering here too.
5220
802 by Scott James Remnant
* init/process.c (process_spawn): Group console closing and setup
5221
	* init/process.c (process_spawn): Group console closing and setup
5222
	together, becoming the session and process group leader first.
5223
793 by Scott James Remnant
* init/process.c (process_spawn): raise the system error before
5224
2007-12-07  Scott James Remnant  <scott@netsplit.com>
5225
801 by Scott James Remnant
* init/process.c (process_spawn): Drop the debug message since
5226
	* init/process.c (process_spawn): Drop the debug message since
5227
	it's always repeated by the caller.
5228
	* init/job.c (job_run_process): Drop the word Active which is a
5229
	hold-over from when we had different process states.
5230
800 by Scott James Remnant
* TODO: Update.
5231
	* TODO: Update.
5232
799 by Scott James Remnant
* init/job.c (job_child_handler): Add code to handle the trapped
5233
	* init/job.c (job_child_handler): Add code to handle the trapped
5234
	signal and ptrace event cases, distinguishing between a trapped
5235
	signal and process stopped after exec or fork using our trace
5236
	state member.  Call out to other functions to do the work.
5237
	(job_process_trace_new): Called after the first exec to set the
5238
	ptrace options, update the trace state and allow the process to
5239
	continue without delivering the signal.  Also called after the
5240
	fork to do the same.
5241
	(job_process_trace_new_child): Called after a fork for the new child;
5242
	increments the fork counter and if it goes over the number we want,
5243
	detaches from the process and allows it to move to running.  Otherwise
5244
	calls job_process_trace_new() instead.
5245
	(job_process_trace_signal): Called when a signal is trapped, simply
5246
	delivers it to the process unchanged.
5247
	(job_process_trace_fork): Called before a fork for the parent, obtains
5248
	the new child process id from the event, updating the job structure,
5249
	and detaches from the parent which we're no longer interested in.
5250
	(job_process_trace_exec): Called after an exec other than the first,
5251
	assumed to be the end of forking so detaches from the process and
5252
	allows it to move to running.
5253
	* init/tests/test_job.c (test_child_handler): Add test cases for
5254
	the various ptrace states.
5255
798 by Scott James Remnant
* init/job.c (job_run_process): Set process trace state to new for
5256
	* init/job.c (job_run_process): Set process trace state to new for
5257
	the main job if we need to wait for the daemon or fork; otherwise
5258
	reset the state.
5259
	* init/tests/test_job.c (test_run_process): Add test cases to make
5260
	sure the trace state is set right and picked up by process_spawn.
5261
797 by Scott James Remnant
* init/process.c (process_spawn): Set a ptrace before execing the
5262
	* init/process.c (process_spawn): Set a ptrace before execing the
5263
	binary if the trace state is TRACE_NEW, set by the caller.
5264
	* init/tests/test_process.c (test_spawn): Make sure that a job is
5265
	ptraced if set up properly.
5266
	(child): Add a simple case that just exits immediately for testing
5267
	the above.
5268
796 by Scott James Remnant
* init/job.h (Job): Add new trace_forks member to keep count of how
5269
	* init/job.h (Job): Add new trace_forks member to keep count of how
5270
	many forks we've seen and trace_state member to track whether we've
5271
	just started the trace or just forked.
5272
	* init/enum.h (TraceState): Add enumeration to keep track of ptrace
5273
	state to differentiate between a signal and an event.
5274
	* init/job.c (job_new): Initialise new members.
5275
	* init/tests/test_job.c (test_new): Check new members are initialised
5276
795 by Scott James Remnant
* init/enum.h (JobWaitType): Add new daemon and fork wait types.
5277
	* init/enum.h (JobWaitType): Add new daemon and fork wait types.
5278
	* init/parse_job.c (stanza_wait): Add parsing for daemon and fork.
5279
	* init/tests/test_parse_job.c (test_stanza_wait): Add tests too.
5280
794 by Scott James Remnant
* init/job.h (JobConfig): Remove daemon and pid members.
5281
	* init/job.h (JobConfig): Remove daemon and pid members.
5282
	(Job): Remove pid_timer member.
5283
	(JOB_DEFAULT_PID_TIMEOUT): Remove this constant.
5284
	* init/job.c (job_config_new, job_new): Remove initialisation of
5285
	removed members.
5286
	(job_change_state): Stay in spawned unless we're not waiting for
5287
	anything -- remove the daemon flag.
5288
	* init/tests/test_job.c (test_config_new, test_new): Remove checks
5289
	for initialisation of removed members.
5290
	(test_change_state): Remove daemon flag stays in spawned check since
5291
	the daemon flag has gone.
5292
	* init/parse_job.c (stanza_daemon, stanza_pid): Remove these
5293
	functions since they have no members to set.
5294
	* init/tests/test_parse_job.c (test_stanza_daemon, test_stanza_pid):
5295
	Remove the tests for the now non-existant functions.
5296
793 by Scott James Remnant
* init/process.c (process_spawn): raise the system error before
5297
	* init/process.c (process_spawn): raise the system error before
5298
	calling another syscall, in case we overwrite errno.
5299
791 by Scott James Remnant
* init/job.c (job_child_minder): Add informational message and
5300
2007-12-06  Scott James Remnant  <scott@netsplit.com>
5301
792 by Scott James Remnant
* init/job.c (job_child_handler): Implement a combined child event
5302
	* init/job.c (job_child_handler): Implement a combined child event
5303
	handler to replace the multiple separate ones.  This handler deals
5304
	with adding appropriate messages to the log and decoding any state
5305
	information before calling specific action functions.
5306
	(job_child_reaper): Remove, moving the bulk of the code into new
5307
	(job_process_terminated): function that handles it cleanly.
5308
	(job_child_minder): Remove, moving the bulk of the code into new
5309
	(job_process_stopped): function that's a lot cleaner.
5310
	* init/job.h: Update prototypes.
5311
	* init/tests/test_job.c (test_child_reaper, test_child_minder):
5312
	Combine unit tests from both functions into single new
5313
	(test_child_handler): function.
5314
	* init/main.c (main): Call the combined function on child events
5315
	instead of separate ones.
5316
791 by Scott James Remnant
* init/job.c (job_child_minder): Add informational message and
5317
	* init/job.c (job_child_minder): Add informational message and
5318
	improve style and documentation.
5319
790 by Scott James Remnant
* init/enum.h (JobWaitType): Introduce a new enum that specifies
5320
2007-12-02  Scott James Remnant  <scott@netsplit.com>
5321
5322
	* init/enum.h (JobWaitType): Introduce a new enum that specifies
5323
	how to transition the job from spawned to running; either we don't
5324
	wait, or we wait for it to emit the stopped signal.
5325
	* init/job.h (JobConfig): Add the wait_for member.
5326
	Add protoype for job_child_minder.
5327
	* init/job.c (job_config_new): Initialise to JOB_WAIT_NONE.
5328
	(job_child_minder): New function to catch when a process is stopped
5329
	by a signal, and move it to the next state when it does so.
5330
	* init/tests/test_job.c (test_config_new): Check the initialisation
5331
	of wait_for to JOB_WAIT_NONE.
5332
	(test_child_minder): Tests for the new function.
5333
	(test_change_state): Copy the daemon test case to refer to waiter.
5334
	* init/main.c (main): Call job_child_minder whenever the job is
5335
	stopped by a signal
5336
	* init/parse_job.c (stanza_wait): Parse a new "wait" stanza that
5337
	specifies what to wait for before leaving the spawned state.
5338
	* init/tests/test_parse_job.c (test_stanza_wait): Check the new
5339
	stanza.
5340
788 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add a few sets to NULL
5341
2007-11-29  Scott James Remnant  <scott@netsplit.com>
5342
5343
	* init/tests/test_job.c (test_change_state): Add a few sets to NULL
5344
	so gcc is happy.
5345
787 by Scott James Remnant
* init/job.c (job_child_reaper): Update argument names and types
5346
2007-11-15  Scott James Remnant  <scott@netsplit.com>
5347
5348
	* init/job.c (job_child_reaper): Update argument names and types
5349
	to match new NihChildHandler pattern; switch on event instead,
5350
	which can now have three values not two (it always could, this was
5351
	a bug) to output warning and assume that status is always non-zero
5352
	if killed so no need to check that separately.
5353
	* init/job.h: Update prototype.
5354
	* init/tests/test_job.c (test_child_reaper): Update calls to
5355
	job_child_reaper to pass an NihChildEvents member instead of FALSE
5356
	or TRUE for killed.
5357
	* init/main.c: Adjust call to nih_child_add_watch to indicate which
5358
	events we want to pass to the reaper; we don't use NIH_CHILD_ALL
5359
	since we're going to add ptrace stuff to a different function.
5360
785 by Scott James Remnant
* init/main.c (main): Tidy up.
5361
2007-11-07  Scott James Remnant  <scott@netsplit.com>
5362
5363
	* init/main.c (main): Tidy up.
5364
784 by Scott James Remnant
Complete the simplification of job config; rather than try and
5365
2007-11-04  Scott James Remnant  <scott@netsplit.com>
5366
5367
	Complete the simplification of job config; rather than try and
5368
	precompute job replacements, keeping them all in the same hash table
5369
	and chaining them together, we just work it out when it's actually
5370
	necessary based on what's in the conf_sources list.
5371
5372
	* init/job.h (JobConfig): Remove the replacement and replacement_for
5373
	members and put a deleted member in instead.
5374
	* init/job.c (job_config_new): Initialise deleted to FALSE; don't
5375
	replace the job into the hash table, since we only want the current
5376
	one in there now.
5377
	(job_config_find_by_name): Now that there is only ever one job
5378
	config in the hash table, we don't need any special function and
5379
	can just use nih_hash_lookup directly, so drop this function.
5380
	(job_config_should_replace): Rename to job_config_replace
5381
	(job_config_replace): Rework, it now checks to see whether there
5382
	are instances, and if not removes the job from the hash table
5383
	before selecting a new one (which might be the same job).
5384
	* init/tests/test_job.c (test_config_new): Update test to check
5385
	deleted starts off as FALSE and that the job isn't in the hash.
5386
	(test_config_find_by_name): Drop.
5387
	(test_config_should_replace): Rename and rewrite to test replacement
5388
	actually works as we expect.
5389
	(test_change_state): Update tests for entering the waiting mode and
5390
	replacing jobs.
5391
	(test_find_by_pid, test_find_by_id, test_handle_event)
5392
	(test_handle_event_finished): Add jobs to the hash table, otherwise
5393
	we can't find them
5394
	(test_child_reaper): Add job to the hash table, and also create a
5395
	source for it since we end up with it in the waiting state so need
5396
	to be able to keep it.
5397
	* init/Makefile.am (test_process_LDADD, test_job_LDADD)
5398
	(test_event_LDADD): Need the full .o file list now.
5399
	* init/conf.c (conf_file_destroy): Rewrite to mark the job deleted,
5400
	call job_config_replace if it's the current job and free it if
5401
	it isn't the current job either before or after that call.
5402
	(conf_reload_path): Handle job replacement here; look up the
5403
	old job in the hash table, if it exists attempt a replacement
5404
	otherwise add the new job to the hash table.
5405
	* init/tests/test_conf.c (test_source_reload_job_dir)
5406
	(test_source_reload_conf_dir, test_source_reload_file): Update
5407
	tests to check job->deleted and use nih_hash_lookup to see whether
5408
	it's the current job.
5409
	(test_file_destroy): Write tests to check the common cases, we don't
5410
	need to worry about the intermediate now since they can't happen.
5411
	* init/parse_job.c (parse_job): Massively simplify, this only creates
5412
	the config and parses it now.
5413
	* init/tests/test_parse_job.c (test_parse_job): Remove the replacement
5414
	checks.
5415
	* init/tests/test_event.c (test_poll): Add configs to the hash
5416
	table so they can be found.
5417
	* TODO: Update.
5418
783 by Scott James Remnant
* init/conf.h (ConfSource): Remove priority, we'll place these
5419
2007-11-03  Scott James Remnant  <scott@netsplit.com>
5420
5421
	* init/conf.h (ConfSource): Remove priority, we'll place these
5422
	in a linked list and use that order instead.
5423
	(ConfSourcePriority): Drop accordingly.
5424
	(ConfItem): Drop this structure; permitting jobs and states to be
5425
	defined inside larger conf files made things complicated for no
5426
	benefit; move the item union into
5427
	(ConfFile): here, instead of the items list.
5428
	(ConfItemType): Drop accordingly.
5429
	* init/conf.c (conf_init): Store sources in a linked list, instead
5430
	of a hash table; no idea why it ever was.
5431
	(conf_source_new): Drop priority argument and add to list not hash.
5432
	(conf_file_new): Set data to NULL instead of initialising items,
5433
	set destructor to conf_file_destroy.
5434
	(conf_item_destroy): Rename to conf_file_destroy
5435
	(conf_file_destroy): and adjust to refer to ConfItem instead,
5436
	getting the item type through the source.
5437
	(conf_item_new): Drop.
5438
	(conf_reload): Iterate as linked list not hash table.
5439
	(conf_reload_path): Simplify handling of old files and items a
5440
	little, just look it up and always free if it exists before parsing
5441
	the new file.
5442
	(conf_file_get): No longer any need for this function.
5443
	* init/tests/test_conf.c (test_file_get, test_item_new): Drop
5444
	test functions for those that have been removed.
5445
	(test_item_destroy): Rename to test_file_destroy.
5446
	(test_source_new): Don't pass or check priority, or hash lookup.
5447
	(test_file_new): Check data is set correctly.
5448
	(test_source_reload_job_dir, test_source_reload_conf_dir)
5449
	(test_source_reload_file): Update tests accordingly.
5450
	* init/parse_conf.c (stanza_job): Drop the job stanza, jobs
5451
	may only be defined in dedicated directories.  
5452
	* init/tests/test_parse_conf.c (test_parse_conf): Simply check to only
5453
	make sure the file is parsed.
5454
	(test_stanza_job): Drop function.
5455
	* init/main.c: Update calls to conf_source_new.
5456
	* init/init.supp: Update intermediate function in suppression.
5457
782 by Scott James Remnant
* init/process.c (process_spawn): Mask out all signals across the
5458
2007-10-26  Scott James Remnant  <scott@netsplit.com>
5459
5460
	* init/process.c (process_spawn): Mask out all signals across the
5461
	fork() rather than just SIGCHLD; reset the signal handlers to default
5462
	before unmasking again.  The original rationale was we needed to
5463
	avoid SIGCHLD occurring before we'd stashed the pid, but that's no
5464
	longer a problem; the new rationale is that we want to avoid the
5465
	signal handlers running in the newly forked child.
5466
771 by Scott James Remnant
* init/job.c (job_change_state): Hardcode the next state when we
5467
2007-10-20  Scott James Remnant  <scott@netsplit.com>
5468
781 by Scott James Remnant
* init/job.c (job_init): The job's name is the first item in the
5469
	* init/job.c (job_init): The job's name is the first item in the
5470
	structure again, so we can use nih_hash_string_key.
5471
	(job_config_name): Drop this function, then.
5472
780 by Scott James Remnant
* init/conf.h (ConfSourcePriority): Add a priority enum
5473
	* init/conf.h (ConfSourcePriority): Add a priority enum
5474
	(ConfSource): Add priority member.
5475
	* init/conf.c (conf_source_new): Take priority as an argument and
5476
	set it in the structure.
5477
	* init/tests/test_conf.c (test_source_new): Make sure priority
5478
	is set from the argument.
5479
	(test_file_new, test_file_get, test_item_new)
5480
	(test_source_reload_job_dir, test_source_reload_conf_dir)
5481
	(test_source_reload_file, test_source_reload, test_item_destroy):
5482
	Pass in a priority when creating a ConfSource.
5483
	* init/tests/test_parse_conf.c (test_parse_conf): Likewise.
5484
	* init/main.c (main): Set relative priorities for the configuration
5485
	directories.
5486
779 by Scott James Remnant
* init/conf.h (conf_file, conf_item): Add source and file members
5487
	* init/conf.h (conf_file, conf_item): Add source and file members
5488
	respectively that point to the parent structure.
5489
	* init/conf.c (conf_file_new, conf_item_new): Set the members.
5490
	* init/tests/test_conf.c (test_file_new, test_file_get)
5491
	(test_item_new): Make sure the new members are set properly.
5492
778 by Scott James Remnant
* util/Makefile.am (install-data-hook, install-exec-hook): Apply
5493
	* util/Makefile.am (install-data-hook, install-exec-hook): Apply
5494
	transform to source and destination of both manpage and program
5495
	symlinks.
5496
	* compat/sysv/Makefile.am (install-data-hook, install-exec-hook): 
5497
	Likewise for the compatibility symlinks.
5498
777 by Scott James Remnant
* TODO: Update.
5499
	* TODO: Update.
5500
776 by Scott James Remnant
* init/tests/test_process.c (test_spawn): Make the event a child
5501
	* init/tests/test_process.c (test_spawn): Make the event a child
5502
	of the operator so it doesn't get freed first.
5503
775 by Scott James Remnant
* init/job.c (job_instance): Increment an instances counter each
5504
	* init/job.c (job_instance): Increment an instances counter each
5505
	time we spawn an instance.
5506
	(job_change_state): Decrement the instances counter again.
5507
	(job_detect_stalled): Drop the main loop function, since we perform
5508
	active detection of stall now.
5509
	* init/job.h: Update header.
5510
	* init/tests/test_job.c (test_change_state): Check that we get the
5511
	stalled event for the last instance.
5512
	(test_detect_stalled): Drop the test.
5513
	* init/main.c: Remove job_detect_stalled from the main loop.
5514
774 by Scott James Remnant
* init/event.c (event_operator_destroy): Destructor for an
5515
	* init/event.c (event_operator_destroy): Destructor for an
5516
	EventOperator that unblocks and unreferences the event first.
5517
	(event_operator_new): Set the operator.
5518
	(event_operator_copy): Remove error handling since it's unnecessary
5519
	with the destructor in place.
5520
	* init/event.h: Add prototype.
5521
	* init/tests/test_event.c (test_operator_destroy): Make sure it
5522
	works properly.
5523
	(test_operator_copy): Don't unblock or unref events before freeing
5524
	them, since that's now taken care of when it's referenced.
5525
	* init/job.c (job_new): Remove unnecessary error handling.
5526
	* init/tests/test_job.c (test_run_process): Reference the event
5527
	when setting it, otherwise we'll assert when we try to free it.
5528
	* TODO: Update.
5529
773 by Scott James Remnant
* init/job.c (job_new): Drop the parent argument for consistency.
5530
	* init/job.c (job_new): Drop the parent argument for consistency.
5531
	(job_instance): Update call to job_new.
5532
	* init/job.h: Update prototype.
5533
	* init/tests/test_job.c (test_new): Adjust call, check the parent
5534
	and make sure that start_on and stop_on are copied over properly.
5535
	* TODO: Update.
5536
772 by Scott James Remnant
* init/conf.c (conf_file_get): Split out the allocation code from here
5537
	* init/conf.c (conf_file_get): Split out the allocation code from here
5538
	(conf_file_new): into this new function.
5539
	* init/conf.h: Add prototype.
5540
	* init/tests/test_conf.c (test_file_new): New tests.
5541
	* TODO: Update.
5542
771 by Scott James Remnant
* init/job.c (job_change_state): Hardcode the next state when we
5543
	* init/job.c (job_change_state): Hardcode the next state when we
5544
	catch a runaway job to be JOB_WAITING.
5545
	(job_next_state): Change next state for JOB_STARTING when goal is
5546
	JOB_STOP to be JOB_STOPPING for consistency with the others; otherwise
5547
	if our goal is stopped during our starting event, we'll never emit
5548
	a stopping event to match it.
5549
	* init/tests/test_job.c (test_next_state): Update test case.
5550
	* doc/states.dot: Adjust the state transitions.
5551
	* doc/states.png: Regenerate.
5552
	* TODO: Update.
5553
770 by Scott James Remnant
Dealing with instances has always been tricky since they're copies
5554
2007-10-19  Scott James Remnant  <scott@netsplit.com>
5555
5556
	Dealing with instances has always been tricky since they're copies
5557
	that exist in the hash table; this patch changes that so the job's
5558
	configuration is separated from its state.  The only difference
5559
	between instance and non-instance jobs now is that non-instance
5560
	jobs only ever have one entry in their instances list.
5561
5562
	* init/job.h (Job): Separate out the members that come from the
5563
	configuration into a new JobConfig structure which can be shared
5564
	amongst all of the instances; this means we can drop instance_of.
5565
	(JobConfig): Add instances list.
5566
	(JobProcess): Remove pid member, replaced by pid list in Job.
5567
	Update prototypes of functions to match.
5568
	* init/job.c (job_new): Split off initialisation of configuration
5569
	pieces into new job_config_new function leaving the state here;
5570
	copy the start_on and stop_on members from JobConfig
5571
	(job_copy): Drop this function, we don't need to copy jobs now.
5572
	(job_name): Rename to job_config_name.
5573
	(job_init): Set key function to job_config_name.
5574
	(job_process_new): Drop initialisation of pid.
5575
	(job_process_copy): Drop this function entirely, we don't need it.
5576
	(job_find_by_name): Rename to job_config_find_by_name; massively
5577
	simplify now we won't find instances or deleted jobs in the list.
5578
	(job_should_replace): Rename to job_config_should_replace; simplify
5579
	now that we can do a simple check to see whether a job exists or not
5580
	(job_find_by_pid, job_find_by_id): Loop through the instances after
5581
	looping through the hash table.
5582
	(job_instance): Simplify, now all it needs to do is call job_new()
5583
	if there isn't anything in the instances list, or it's multi-instance.
5584
	(job_change_goal): Document that job should not be used on return.
5585
	No need to check for instance jobs anymore.  Place the job id in
5586
	the output.
5587
	(job_change_state): Document that job should not be used on return.
5588
	Place the job id in the output.  Check for information in the job's
5589
	config.  Merge the waiting and deleted states, so that a job instance
5590
	is automatically deleted when it finishes.
5591
	(job_next_state): Assert that we never call job_next_state when
5592
	in JOB_WAITING since there's no possible next state.  Check config
5593
	for whether a main process exists.
5594
	(job_emit_event): Obtain config-replaced pieces from the job's config
5595
	(job_run_process): Obtain process information from the job's config
5596
	but store the pid in the Job.  Put job id in the output.
5597
	(job_kill_process, job_kill_timer): We don't need to obtain the
5598
	JobProcess just the pid from the job.  Put job id in the output.
5599
	(job_child_reaper): Put job id in the output.  Check job config.
5600
	(job_handle_event): Iterate job instances and process their stop_on
5601
	operators, but process the start_on from the job configs.
5602
	(job_handle_event_finished): Loop through the instances too.
5603
	(job_detect_stalled): Check start_on from the config and just
5604
	check whether there are any instances in the list.
5605
	(job_free_deleted): No deleted state, so drop this function.
5606
	* init/tests/test_job.c (test_new): Split into test_new and
5607
	new test_config_new function.  Create JobConfig object and spawn
5608
	Job instances from that.
5609
	(test_copy): Drop the tests.
5610
	(test_process_new): Drop check of pid.
5611
	(test_process_copy): Drop test.
5612
	(test_find_by_name): Rename to test_config_find_by_name.
5613
	(test_should_replace): Rename to test_config_should_replace.
5614
	(test_instance): Create JobConfig object, and adjust tests to ensure
5615
	that we always get a Job object.
5616
	(test_find_by_pid, test_find_by_id, test_change_goal): Create
5617
	JobConfig object and spawn Job instances from that.
5618
	(test_change_state): Create JobConfig object and spawn Job
5619
	instances from that.  Adjust tests that previously checked for
5620
	JOB_WAITING to check for job being freed.  Drop checks for JOB_DELETED.
5621
	(test_next_state): Create JobConfig object and spawn Job instances
5622
	from that.  Drop JOB_DELETED and JOB_WAITING checks.
5623
	(test_run_process, test_kill_process, test_child_reaper)
5624
	(test_handle_event, test_detect_stalled): Create JobConfig object
5625
	and spawn Job instances from that.
5626
	(test_free_deleted): Drop.
5627
	* init/main.c: Don't add job_free_deleted to the main loop.
5628
	* init/enum.h (JobState): Drop JOB_DELETED.
5629
	* init/enum.c (job_state_name, job_state_from_name): Drop JOB_DELETED.
5630
	* init/tests/test_enum.c (test_state_name, test_state_from_name):
5631
	Drop tests that use the JOB_DELETED value.
5632
	* init/process.c (process_spawn, process_setup_limits)
5633
	(process_setup_environment, process_setup_console): Get details
5634
	from the job config.  Put job id in the output.
5635
	* init/tests/test_process.c (test_spawn, test_kill): Create
5636
	a JobConfig object and make Job instances from that.
5637
	* init/tests/test_event.c (test_poll): Create a JobConfig object
5638
	and make Job instances from that.
5639
	(test_operator_copy): Set pointers to NULL to avoid gcc complaining.
5640
	* init/conf.h (ConfItem): Make the type for a job be JobConfig.
5641
	* init/conf.c (conf_item_destroy): Don't attempt to replace the
5642
	new middle-man target, if it was due to be replaced it would have
5643
	already been.  If we can replace the config, ensure nothing points
5644
	at it and then free it, rather than kicking state.
5645
	* init/tests/test_conf.c (test_source_reload_job_dir)
5646
	(test_source_reload_conf_dir, test_source_reload_file)
5647
	(test_source_reload, test_item_destroy): Call job_config_new to
5648
	create JobConfig objects, track when they are freed rather than
5649
	marked in the deleted state.  Create instances with job_instance,
5650
	and fetch from the instances list.  Expect the job to be freed
5651
	with the item.
5652
	* init/tests/test_parse_conf.c (test_parse_conf)
5653
	(test_stanza_job): Change expected type from Job to JobConfig.
5654
	* init/parse_job.c: Update prototypes of all functions to refer to
5655
	JobConfig instead of Job.
5656
	(parse_job): If the old job already has a replacement, remove the
5657
	replacement from the hash table -- but don't free it because it's
5658
	linked by a ConfItem -- this is temporary.  Likewise for when we
5659
	replace the old job.
5660
	* init/parse_job.h: Update prototype.
5661
	* init/tests/test_parse_job.c: Update all functions to use JobConfig
5662
	instead of Job.
5663
	(test_parse_job): Create an instance.
5664
	* doc/states.dot: Remove the deleted state.
5665
	* doc/states.png: Regenerate.
5666
	* TODO: Update with notes from the conversion.
5667
769 by Scott James Remnant
Update to catch up with changes in libnih that make code a little
5668
2007-10-16  Scott James Remnant  <scott@netsplit.com>
5669
5670
	Update to catch up with changes in libnih that make code a little
5671
	bit easier to follow (we hope).
5672
5673
	* init/tests/test_process.c (test_spawn, test_kill): Replace calls
5674
	to nih_list_free() with nih_free()
5675
	* init/event.c (event_poll): Replace nih_list_free with nih_free
5676
	since the former function has gone from libnih.
5677
	(event_new): Adjust setting of the destructor.
5678
	(event_operator_new): Set destructor for the tree node.
5679
	* init/tests/test_event.c (test_new, test_find_by_id, test_ref)
5680
	(test_unref, test_block, test_unblock, test_poll)
5681
	(test_operator_match): Replace nih_list_free with nih_free.
5682
	(test_poll): Use TEST_FREE_TAG and TEST_FREE rather than abusing
5683
	destructors.
5684
	* init/job.c (job_new): Set destructor to nih_list_destroy.
5685
	(job_copy, job_free_deleted): Use nih_free instead of nih_list_free
5686
	* init/tests/test_job.c (test_new, test_copy, test_find_by_name)
5687
	(test_find_by_pid, test_find_by_id, test_instance)
5688
	(test_change_goal, test_change_state, test_next_state)
5689
	(test_should_replace, test_run_process, test_kill_process)
5690
	(test_child_reaper, test_handle_event)
5691
	(test_handle_event_finished, test_detect_stalled)
5692
	(test_free_deleted): Replace all uses of nih_list_free with nih_free
5693
	(test_child_reaper, test_free_deleted): Replace destructor abuse
5694
	with TEST_FREE, etc.
5695
	* init/conf.c (conf_reload_path): Use nih_free instead of nih_list_free
5696
	(conf_source_new, conf_file_get, conf_item_new): Set destructor
5697
	(conf_source_reload, conf_delete_handler): Use nih_free not the
5698
	custom conf_file_free() function.
5699
	(conf_reload_path): Use nih_free not the custom conf_item_free()
5700
	function.
5701
	(conf_delete_handler): Use nih_free not nih_watch_free()
5702
	(conf_source_free, conf_file_free): Drop these functions, since
5703
	all the free chaining happens properly with destructors.
5704
	(conf_item_free): Rename to conf_item_destroy and turn into destructor
5705
	* init/conf.h: Update prototypes.
5706
	* init/tests/test_conf.c (test_source_new, test_file_get)
5707
	(test_item_new, test_source_reload_job_dir)
5708
	(test_source_reload_conf_dir, test_source_reload_file)
5709
	(test_item_free): Replace nih_list_free calls with nih_free
5710
	(test_source_reload_job_dir, test_source_reload_conf_dir)
5711
	(test_source_reload_file, test_source_reload, test_item_free): Replace
5712
	calls to conf_source_free with nih_free
5713
	(test_source_free, test_file_free): Drop functions.
5714
	(test_item_free): Rename to test_item_destroy
5715
	(test_item_new): Assign a job before freeing, otherwise the destroy
5716
	function will foul up as it expects one.
5717
	* init/parse_conf.c (stanza_job): Replace nih_list_free with nih_free
5718
	* init/tests/test_parse_conf.c (test_parse_conf)
5719
	(test_stanza_job): Replace conf_source_free() with nih_free()
5720
	(test_parse_conf, test_stanza_job): Replace conf_item_free()
5721
	with nih_free()
5722
	* init/parse_job.c (parse_job, parse_on_paren, parse_on_collect):
5723
	Replace nih_list_free with nih_free
5724
	(parse_on): always cut out the stack head before returning (it won't
5725
	be empty on error) otherwise we end up with a bunch of list entries
5726
	pointing to it -- and it's way out of scope when we try and free them
5727
	(parse_on_operator, parse_on_operand): Use the job as the context
5728
	not the operator for consistency of freeing.
5729
	* init/tests/test_parse_job.c: Replace all instances of nih_list_free
5730
	with nih_free (too many functions to list).
5731
766 by Scott James Remnant
* NEWS: Copy in news from 0.3.9; that release doesn't appear in
5732
2007-10-15  Scott James Remnant  <scott@netsplit.com>
5733
768 by Scott James Remnant
Strip out all of the IPC code, removing it and consigning it to the
5734
	Strip out all of the IPC code, removing it and consigning it to the
5735
	great revision control history in the sky.  We're going to switch
5736
	from home-brew to D-BUS. so all this is somewhat obsolete.  Rather
5737
	than maintain this while we carry on developing, we'll strip it out
5738
	now and put the D-BUS code in ater once the rest of the core changes
5739
	are done (otherwise we'd just be dragging those through maintenance
5740
	too).
5741
5742
	* Makefile.am (SUBDIRS): Remove the upstart sub-directory entirely;
5743
	comment out util, compat/sysv & logd since we'll fix them up later
5744
	* configure.ac (AC_CONFIG_FILES): Remove from here too.
5745
	* upstart/enum.c, upstart/enum.h, upstart/tests/test_enum.c: Move
5746
	these files into the init/ sub-directory; strictly speaking we'll
5747
	probably need to share them again later in some way, but for now
5748
	they can live with the rest of the daemon code.
5749
	* upstart/: Delete.
5750
	* init/Makefile.am (init_SOURCES): Remove control.c, control.h,
5751
	notify.c and notify.h;  add enum.c and enum.h
5752
	(TESTS): Remove test_control and test_notify; add test_enum
5753
	(test_control_SOURCES, test_control_LDFLAGS, test_control_LDADD)
5754
	(test_notify_SOURCES, test_notify_LDADD): Remove.
5755
	(test_enum_SOURCES, test_enum_LDFLAGS, test_enum_LDADD): Add details
5756
	(init_LDADD): Remove libupstart
5757
	(test_process_LDADD, test_job_LDADD, test_event_LDADD)
5758
	(test_parse_job_LDADD, test_parse_conf_LDADD, test_conf_LDADD): Remove
5759
	libupstart, control.o and notify.o; add enum.o
5760
	* init/control.c, init/control.h, init/tests/test_control.c: Delete
5761
	* init/notify.c, init/notify.h, init/tests/test_notify.c: Delete
5762
	* init/enum.c, init/job.c, init/job.h: Update include path for enum.h
5763
	* init/parse_job.c: Remove unnecessary enum.h include
5764
	* init/tests/test_enum.c: Update to reflect where it is.
5765
	* init/main.c (main): Drop control socket opening.
5766
	* init/tests/test_job.c: Remove unnecessary control.h include
5767
	* init/event.c (event_pending, event_finished): Remove calls to
5768
	notify_event and notify_event_finished
5769
	* init/job.c (job_change_goal, job_change_state): Remove calls
5770
	to notify_job.
5771
	* init/tests/test_parse_conf.c: Remove calls to notify_init
5772
	* init/tests/test_parse_job.c: Remove calls to notify_init
5773
	* init/tests/test_event.c (test_poll): Strip out the part of the
5774
	test that checks processes are notified.
5775
	(check_event, check_event_finished): Remove.
5776
767 by Scott James Remnant
* configure.ac: Bump Autoconf dependency to 2.61 to match libnih
5777
	* configure.ac: Bump Autoconf dependency to 2.61 to match libnih
5778
	* HACKING: Bump dependency in docs too.
5779
766 by Scott James Remnant
* NEWS: Copy in news from 0.3.9; that release doesn't appear in
5780
	* NEWS: Copy in news from 0.3.9; that release doesn't appear in
5781
	this ChangeLog since it was made on a separate branch by backporting
5782
	bug fixes made here.
5783
	* configure.ac: Bump version to 0.5.0, which is where development
5784
	is heading for.
5785
765 by Scott James Remnant
* HACKING: Change URL for libnih.
5786
2007-10-12  Scott James Remnant  <scott@netsplit.com>
5787
5788
	* HACKING: Change URL for libnih.
5789
761 by Scott James Remnant
* Makefile.am (ACLOCAL_AMFLAGS): Specify that aclocal install
5790
2007-10-08  Scott James Remnant  <scott@netsplit.com>
5791
763 by Scott James Remnant
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.16.1 since this
5792
	* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.16.1 since this
5793
	version of gettext is needed for compatibility with Automake 1.10
5794
	* HACKING: Bump version in the docs too.
5795
762 by Scott James Remnant
* compat/sysv/Makefile.am: Only create symlinks if COMPAT_SYSV is
5796
	* compat/sysv/Makefile.am: Only create symlinks if COMPAT_SYSV is
5797
	enabled, otherwise we leave dangling ones.
5798
761 by Scott James Remnant
* Makefile.am (ACLOCAL_AMFLAGS): Specify that aclocal install
5799
	* Makefile.am (ACLOCAL_AMFLAGS): Specify that aclocal install
5800
	ordinarily system-wide macros into m4 (libtool.m4, specifically).
5801
	This makes it easier for packagers to modify autoconfery since
5802
	aclocal is no longer a destructive event.
5803
	* configure.ac (AM_INIT_AUTOMAKE): Increase Automake requirement to
5804
	1.10 to ensure we have aclocal --instal
5805
	* HACKING: Increase Automake version in the docs.
5806
760 by Scott James Remnant
* init/job.c (job_detect_stalled, job_free_deleted): Call job_init()
5807
2007-09-21  Scott James Remnant  <scott@netsplit.com>
5808
5809
	* init/job.c (job_detect_stalled, job_free_deleted): Call job_init()
5810
	on entry, since we don't have a Job pointer passed to us, we need
5811
	to make sure we don't dereference a potentially NULL list.
5812
749 by Scott James Remnant
* TODO: Update again, still thinking about the atomicity of event
5813
2007-06-22  Scott James Remnant  <scott@netsplit.com>
5814
759 by Scott James Remnant
* TODO: Update.
5815
	* TODO: Update.
5816
758 by Scott James Remnant
* init/job.h: Update prototype of job_change_goal.
5817
	* init/job.h: Update prototype of job_change_goal.
5818
	(Job): Remove cause member.
5819
	* init/job.c (job_change_goal): Drop additional argument since cause
5820
	is no longer used.
5821
	(job_change_state, job_child_reaper, job_handle_event): Only pass
5822
	two arguments to job_change_goal.
5823
	* init/control.c (control_job_start, control_job_stop): Only pass
5824
	two argumenst to job_change_goal.
5825
	* init/tests/test_job.c (test_change_goal, test_change_state): Only
5826
	pass two arguments to job_change_goal.
5827
757 by Scott James Remnant
* init/job.c (job_new): Drop setting of cause.
5828
	* init/job.c (job_new): Drop setting of cause.
5829
	(job_change_cause): Drop this function entirely.
5830
	(job_change_goal, job_change_state): Drop calls to job_change_cause
5831
	(job_change_state, job_child_reaper): Don't pass job->cause to
5832
	job_change_goal calls.
5833
5834
	* init/tests/test_job.c: Remove all tests that checked the value of
5835
	job->cause, since that variable is going away.
5836
	(test_change_goal): Remove the specific tests that checked whether
5837
	cause was updated or not.
5838
756 by Scott James Remnant
* init/job.c (job_run_process): Replace the arguments from the event
5839
	* init/job.c (job_run_process): Replace the arguments from the event
5840
	with a list of event names.
5841
	* init/tests/test_job.c (test_run_process): Update test case to
5842
	supply arguments from the list of events.
5843
755 by Scott James Remnant
* init/process.c (process_setup_environment): Drop the UPSTART_EVENT
5844
	* init/process.c (process_setup_environment): Drop the UPSTART_EVENT
5845
	environment variable; it doesn't make sense when you can have multiple
5846
	events.
5847
	(process_setup_environment): Put all variables from the job's start
5848
	events into the job's environment; replacing the UPSTART_EVENT variable
5849
754 by Scott James Remnant
* init/job.c (job_change_cause): Don't notify the job event
5850
	* init/job.c (job_change_cause): Don't notify the job event
5851
	subscribers when changing the cause.
5852
	* init/notify.c (notify_job_finished): Instead notify them when
5853
	the job reaches a rest state.
5854
753 by Scott James Remnant
* init/notify.c (notify_job): Call notify_job_event regardless,
5855
	* init/notify.c (notify_job): Call notify_job_event regardless,
5856
	since this now looks over the start_on and stop_on fields.
5857
	(notify_job_event): Rewrite to iterate over start_on and stop_on,
5858
	and notifying for each cause event found.
5859
	(notify_job_event_caused): Static function that is the guts of the
5860
	above function.
5861
	* init/tests/test_notify.c (test_job, test_job_event): Modify tests
5862
	to refer exclusively to the start_on/stop_on expressions rather than
5863
	the cause.
5864
752 by Scott James Remnant
* init/job.c (job_change_cause): Only notify the job event and
5865
	* init/job.c (job_change_cause): Only notify the job event and
5866
	update the cause member, we don't need to ref or block it anymore
5867
	since that's handled by start_on and stop_on.
5868
	* init/tests/test_job.c (test_change_goal): Drop checks on cause
5869
	being referenced and blocked.
5870
	(test_change_state, test_child_reaper, test_handle_event): Update
5871
	test cases to not reference ->cause, and not count any references
5872
	or blockers towards it.
5873
	* init/tests/test_event.c (test_poll): Update expected reference
5874
	and block counts for events handled by jobs.
5875
	
751 by Scott James Remnant
* init/tests/test_process.c (test_kill): Make sure that all processes
5876
	* init/tests/test_process.c (test_kill): Make sure that all processes
5877
	in the process group are killed, rather than just the lone one.
5878
	* init/process.c (process_kill): Send the signal to all processes
5879
	in the same process group as the pid.
5880
	* init/tests/test_job.c (test_change_state, test_kill_process):
5881
	After spawning a child, call setpgid() to put it in its own process
5882
	group otherwise we could end up TERMing ourselves.
5883
750 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Update test cases to
5884
	* init/tests/test_job.c (test_child_reaper): Update test cases to
5885
	include checking of the start_on and stop_on expression trees.
5886
	* init/job.c (job_child_reaper): Mark all blocked events in the
5887
	start_on and stop_on trees as failed; since these are copies of
5888
	the cause event, we can drop that setting already.
5889
749 by Scott James Remnant
* TODO: Update again, still thinking about the atomicity of event
5890
	* TODO: Update again, still thinking about the atomicity of event
5891
	expressions.
5892
745 by Scott James Remnant
* init/tests/test_job.c (test_copy): Make sure that the job copy
5893
2007-06-21  Scott James Remnant  <scott@netsplit.com>
5894
748 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Include tests on a job's
5895
	* init/tests/test_job.c (test_change_state): Include tests on a job's
5896
	start_on and stop_on event expression trees, and make sure that events
5897
	are unblocked and unreferenced at the appropriate moments.
5898
	* init/job.c (job_change_state): Unblock the events that started the
5899
	job in running (if a service), and reset when we reach waiting (leave
5900
	referenced otherwise so the environment is always present).
5901
	Unblock and unreference the events that stopped the job in
5902
	starting (for restarting), running (if coming from pre-stop) and
5903
	waiting.
5904
	
747 by Scott James Remnant
* init/tests/test_job.c (test_handle_event): Rewrite tests using
5905
	* init/tests/test_job.c (test_handle_event): Rewrite tests using
5906
	event expressions, and make sure events are referenced and blocked
5907
	correctly matching how jobs are affected.  Include tests for correct
5908
	instance behaviour.
5909
	(test_instance): Make sure that instances copy across the expression
5910
	state, and reset the parent.
5911
	* init/job.c (job_instance): After spawning a new instance, reset
5912
	the start_on expression of the master job.
5913
746 by Scott James Remnant
* init/event.c (event_operator_copy): Change to making the parent
5914
	* init/event.c (event_operator_copy): Change to making the parent
5915
	of copies nodes be the actual tree parent, rather than the top
5916
	parent; otherwise you can't free an entire tree in one go.
5917
	* init/tests/test_event.c (test_operator_copy): Check parents of
5918
	copied nodes.
5919
	* init/tests/test_job.c (test_copy): Update parent checks here too.
5920
745 by Scott James Remnant
* init/tests/test_job.c (test_copy): Make sure that the job copy
5921
	* init/tests/test_job.c (test_copy): Make sure that the job copy
5922
	references and blocks the event; and in the event of failure, doesn't
5923
	* init/job.c (job_copy): Reset the start_on and stop_on expressions
5924
	in the event of failure.
5925
741 by Scott James Remnant
* init/parse_job.c: Where the stanza function parses an argument and
5926
2007-06-20  Scott James Remnant  <scott@netsplit.com>
5927
744 by Scott James Remnant
* TODO: Update.
5928
	* TODO: Update.
5929
743 by Scott James Remnant
* init/parse_job.c (parse_on): New generic parsing function to deal
5930
	* init/parse_job.c (parse_on): New generic parsing function to deal
5931
	with event expressions, including operators, parentheses, etc.
5932
	(parse_on_operator): Function called by parse_on() to deal with an
5933
	operator or operand.
5934
	(parse_on_paren): Function called by parse_on() to deal with a
5935
	parenthesis.
5936
	(parse_on_operand): Function called by parse_on_operator() to deal
5937
	with a non-operator token.
5938
	(parse_on_collect): Function called by all of the above to collect
5939
	the operators on the stack and deposit them into the output box,
5940
	either for collection by a later operator or for returning from
5941
	parse_on().
5942
	(stanza_start, stanza_stop): Call the new parse_on() function to
5943
	deal with "start on" and "stop on", storing it in the appropriate
5944
	part of the job.
5945
	* init/tests/test_parse_job.c (test_parse_job): Replace list empty
5946
	checks for start_events/stop_events with NULL checks on the new
5947
	start_on/stop_on members.
5948
	(test_stanza_start, test_stanza_stop): Test new stanza code.
5949
5950
	* init/errors.h (PARSE_EXPECTED_EVENT, PARSE_EXPECTED_OPERATOR)
5951
	(PARSE_MISMATCHED_PARENS): Add numerics and strings for the errors
5952
	that can be generated by parsing an event expression.
5953
	* init/conf.c (conf_reload_path): Handle the new errors properly,
5954
	including the line number where they occurred.
5955
	* logd/jobs.d/logd.in: Update "stop on" to work with the new parser.
5956
742 by Scott James Remnant
* init/parse_job.c (stanza_emits): Each entry in the emits list
5957
	* init/parse_job.c (stanza_emits): Each entry in the emits list
5958
	is now an NihListEntry with the event name as the string data
5959
	pointer, rather than an EventInfo structure (since that structure
5960
	is gone).
5961
	* init/tests/test_parse_job.c (test_stanza_emits): Update test
5962
	case to check for NihListEntry structures.
5963
741 by Scott James Remnant
* init/parse_job.c: Where the stanza function parses an argument and
5964
	* init/parse_job.c: Where the stanza function parses an argument and
5965
	can possibly reject it, save the position and line number and do not
5966
	return that unless we're happy with the argument.  This ensures errors
5967
	are raised pointing *at* the argument, rather than past it.
5968
	* init/tests/test_parse_job.c: Fix several test case errors where
5969
	the buffer was built incorrectly.  Pedantically check pos and lineno
5970
	after successful parsing, and after errors, to make sure they are
5971
	where they should be.
5972
735 by Scott James Remnant
* init/event.h (Event): Directly include the name, args and env
5973
2007-06-18  Scott James Remnant  <scott@netsplit.com>
5974
740 by Scott James Remnant
* init/job.h (Job): Replace the start_events and stop_events NihLists
5975
	* init/job.h (Job): Replace the start_events and stop_events NihLists
5976
	with start_on and stop_on EventOperators.
5977
	* init/job.c (job_new): Drop list initialising, and instead just set
5978
	the new start_on/stop_on members to NULL.
5979
	(job_copy): Copy the entire event operator tree to the new job,
5980
	including references and blockers.  emits has changed to a list of
5981
	NihListEntry with embedded strings, so copy them that way.
5982
	(job_run_process): Drop "->info."
5983
	(job_handle_event): Instead of iterating the events lists, call
5984
	event_operator_handle and check the return value and top node value.
5985
	(job_detect_stalled): Modify to iterate the start_on tree.
5986
	* init/tests/test_job.c (test_change_state, test_detect_stalled): 
5987
	Drop references to "->info." since we can get the variables directly.
5988
	(test_new): Check that start_on and stop_on are NULL.
5989
	(test_copy): Adjust tests of copying start_on and stop_on trees as
5990
	well as the emits list.
5991
	(test_handle_event, test_handle_event_finished) 
5992
	(test_detect_stalled): Change references from start_events to start_on,
5993
	stop_events to stop_on and construct using EventOperators instead.
5994
	(test_handle_event): Update number of blockers now that the event
5995
	expressions themselves will block the event.
5996
	* init/tests/test_event.c (test_poll): Update number of blockers since
5997
	both the events and cause will block it for now; also change
5998
	start_events and stop_events to start_on and stop_on respectively.
5999
739 by Scott James Remnant
* init/event.c (event_operator_copy): Copy the children nodes as well.
6000
	* init/event.c (event_operator_copy): Copy the children nodes as well.
6001
	* init/tests/test_event.c (test_operator_copy): Test copying
6002
	with children nodes.
6003
738 by Scott James Remnant
* init/tests/test_control.c (test_event_emit): Drop "->info."
6004
	* init/tests/test_control.c (test_event_emit): Drop "->info."
6005
737 by Scott James Remnant
* init/notify.c (notify_event, notify_event_finished): Drop
6006
	* init/notify.c (notify_event, notify_event_finished): Drop
6007
	"->info." from event references.
6008
736 by Scott James Remnant
* init/process.c (process_setup_environment): Drop "->info." from
6009
	* init/process.c (process_setup_environment): Drop "->info." from
6010
	cause references
6011
	* init/tests/test_process.c (test_spawn): Likewise.
6012
735 by Scott James Remnant
* init/event.h (Event): Directly include the name, args and env
6013
	* init/event.h (Event): Directly include the name, args and env
6014
	fields rather than using an interim structure; this makes more sense
6015
	since we use them differently than a match does.
6016
	(EventOperatorType, EventOperator): New structure to build event
6017
	expression trees that combine a match with "or" and "and" boolean
6018
	operators; solve some problems by holding the reference and blocker
6019
	on the matched event inside this structure directly and provide
6020
	methods to unblock and reset them.
6021
	(EventInfo): Drop this structure completely now that it is unused.
6022
	* init/event.c (event_info_new): Rename this structure to
6023
	event_operator_new() and initialise the new fields properly.
6024
	(event_info_copy): Likewise rename to event_operator_copy and deal
6025
	with copying event references and blockers over to the new structure,
6026
	since the state is useful to copy.
6027
	(event_match): Rename to event_operator_match and switch the arguments
6028
	around since it makes slightly more sense that way.
6029
	(event_operator_update): Function to update the value of an EVENT_OR
6030
	or EVENT_AND operator based on the value of the two children.
6031
	(event_operator_handle): Function to iterate an entire expression
6032
	tree looking for a given event, and update the values of other
6033
	operators if matched.
6034
	(event_operator_unblock): Function to iterate an expression tree
6035
	and release any events we're blocking.
6036
	(event_operator_reset): Function to iterate an expression tree,
6037
	unreferencing any events and resetting all values back to FALSE.
6038
	(event_new, event_pending, event_finished): Update references to
6039
	the Event structure to discard the intermediate "->info."
6040
	* init/tests/test_event.c (test_info_new): Rename to
6041
	test_operator_new() and test various features of the function added
6042
	in the converstion.
6043
	(test_info_copy): Likewise rename to test_operator_copy() and add a
6044
	few more tests, especially that blockers and references are copied.
6045
	(test_match): Rename to test_operator_match() and adjust argument
6046
	order to match the change.
6047
	(test_new) Call event_init() to avoid a valgrind error and update
6048
	references to drop "->info."
6049
	(test_poll): Use EventOperators in the job to test event polling,
6050
	rather than the old structures.
6051
	(test_operator_update, test_operator_handle, test_operator_unblock)
6052
	(test_operator_reset): Test behaviour of the new functions.
6053
734 by Scott James Remnant
* TODO: Update utmp/wtmp thoughts.
6054
2007-06-13  Scott James Remnant  <scott@netsplit.com>
6055
6056
	* TODO: Update utmp/wtmp thoughts.
6057
726 by Scott James Remnant
* compat/sysv/shutdown.c: Use nih pidfile functions since they're
6058
2007-06-12  Scott James Remnant  <scott@netsplit.com>
6059
732 by Scott James Remnant
* init/paths.h: Remove extra /, oops.
6060
	* init/paths.h: Remove extra /, oops.
6061
	* init/Makefile.am (install-data-local): Make destination
6062
	configuration directories as part of "make install".
6063
	(AM_CPPFLAGS): Define LEGACY_CONFDIR to be $(sysconfdir)/event.d
6064
	* logd/Makefile.am (jobs.d/logd): Replace mkdir_p with MKDIR_P
6065
	* init/main.c: Use macro to pick up /etc/event.d so it can be moved
6066
	by configure
6067
731 by Scott James Remnant
* TODO: Update.
6068
	* TODO: Update.
6069
730 by Scott James Remnant
* init/Makefile.am (AM_CPPFLAGS): Define CONFDIR to be
6070
	* init/Makefile.am (AM_CPPFLAGS): Define CONFDIR to be
6071
	$(sysconfdir)/init, replacing the old CFG_DIR definition.
6072
	* init/paths.h (CFG_DIR): Replace with CONFDIR definition,
6073
	and set the default to /etc/init
6074
	* init/main.c: Load configuration from /etc/init/init.conf,
6075
	/etc/init/conf.d and /etc/init/jobs.d; retain loading from /etc/event.d
6076
	for the time being.
6077
	* init/man/init.8: Change reference to directory.
6078
	* logd/Makefile.am: Replace references of eventdir with jobsdir,
6079
	and event.d with jobs.d
6080
	* logd/event.d: Rename to logd/jobs.d
6081
729 by Scott James Remnant
* init/conf.c (conf_reload): Ignore ENOENT, it's not interesting
6082
	* init/conf.c (conf_reload): Ignore ENOENT, it's not interesting
6083
	in the general case.
6084
728 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload): Test the general
6085
	* init/tests/test_conf.c (test_source_reload): Test the general
6086
	reload function.
6087
727 by Scott James Remnant
* init/tests/test_conf.c (test_source_free): s/unlink/rmdir/
6088
	* init/tests/test_conf.c (test_source_free): s/unlink/rmdir/
6089
	(test_source_reload_file): Test that configuration files work, and
6090
	are parsed with anything alongside ignored automatically.
6091
	* init/conf.c (conf_file_filter): As well as not filtering out the
6092
	source path itself, we also need to not filter out the path we're
6093
	watching which is different in the case of files; we need to know
6094
	about it because we handle its removal.
6095
	(conf_delete_handler): Compare the path deleted against the path
6096
	we're watching, rather than the source path, since this means the
6097
	watch needs to be freed.
6098
726 by Scott James Remnant
* compat/sysv/shutdown.c: Use nih pidfile functions since they're
6099
	* compat/sysv/shutdown.c: Use nih pidfile functions since they're
6100
	more reliable than doing it ourselves.
6101
721 by Scott James Remnant
* init/Makefile.am (init_SOURCES): Build and link parse_conf.c and
6102
2007-06-11  Scott James Remnant  <scott@netsplit.com>
6103
725 by Scott James Remnant
* init/conf.c (conf_reload_path): Call parse_conf for mixed files
6104
	* init/conf.c (conf_reload_path): Call parse_conf for mixed files
6105
	and directories.  Make a correction to the old_items code, was
6106
	passing the wrong arguments to nih_list_add; the effect we wanted
6107
	was that we add the old items head into the list, and remove the
6108
	existing head (what we did was add the first item to the old_items
6109
	list and then cut the rest out).
6110
	* init/tests/test_conf.c (test_source_reload_dir): Rename to
6111
	test_source_reload_job_dir, since that's what this does.
6112
	(test_source_reload_conf_dir): Add another function that tests
6113
	directories of mixed configuration.
6114
724 by Scott James Remnant
* init/parse_conf.c (parse_conf): Parse a configuration file that
6115
	* init/parse_conf.c (parse_conf): Parse a configuration file that
6116
	defines jobs by name.
6117
	(stanza_job): Job stanza, slightly trickier than it would appear to
6118
	need to be, to parse the block in-place and keep pos/lineno
6119
	consistent.
6120
	* init/parse_conf.h: Prototype for external function.
6121
	* init/tests/test_parse_conf.c: Test suite for mixed configuration
6122
	parsing.
6123
	* init/Makefile.am (init_SOURCES): Build and link parse_conf.c and
6124
	parse_conf.h
6125
	(TESTS): Build and run parse_conf tests
6126
	(test_parse_conf_SOURCES, test_parse_conf_LDFLAGS) 
6127
	(test_parse_conf_LDADD): Details for parse_conf test suite.
6128
	(test_conf_LDADD): Add parse_conf.o and conf.o since this calls
6129
	them now.
6130
723 by Scott James Remnant
* init/conf.c (conf_source_reload, conf_source_reload)
6131
	* init/conf.c (conf_source_reload, conf_source_reload) 
6132
	(conf_reload_path): Add some debugging messages.
6133
722 by Scott James Remnant
* init/conf.c (conf_source_new): Add missing call to conf_init()
6134
	* init/conf.c (conf_source_new): Add missing call to conf_init()
6135
721 by Scott James Remnant
* init/Makefile.am (init_SOURCES): Build and link parse_conf.c and
6136
	* init/conf.c (conf_item_new): Drop source parameter, since it's
6137
	unused in the function and makes it harder to call this when we
6138
	only have one data pointer.
6139
	(conf_reload_path): Drop source from conf_item_new() call.
6140
	* init/conf.h: Update prototype.
6141
	* init/tests/test_conf.c (test_item_new, test_item_free) 
6142
	(test_file_free): Drop source parameter from calls.
6143
705 by Scott James Remnant
* init/conf.c (conf_source_reload): Move the item deletion detection
6144
2007-06-10  Scott James Remnant  <scott@netsplit.com>
6145
720 by Scott James Remnant
* init/main.c (main): Add a handler for the SIGHUP signal
6146
	* init/main.c (main): Add a handler for the SIGHUP signal
6147
	(hup_handler): Handler for SIGHUP, just calls conf_reload().
6148
718 by Scott James Remnant
* init/main.c (main): Read the configuration again.
6149
	* init/main.c (main): Read the configuration again.
6150
717 by Scott James Remnant
* TODO: Update.
6151
	* TODO: Update.
6152
716 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload_dir): Reset the priority
6153
	* init/tests/test_conf.c (test_source_reload_dir): Reset the priority
6154
	and clean up consumed inotify instances.
6155
	(test_source_free, test_file_free, test_item_free): Test the free
6156
	functions on their own, paying special attention to conf_item_free()
6157
	even though this really duplicates other tests.
6158
715 by Scott James Remnant
* init/conf.c (conf_reload_path): In the case where we fail to map
6159
	* init/conf.c (conf_reload_path): In the case where we fail to map
6160
	the file into memory, we still need to purge all the items that
6161
	previously existed.
6162
	* init/tests/test_conf.c (test_source_reload): Rename to
6163
	test_source_reload_dir, so that we can keep this and the file
6164
	tests separate to make it easier to deal with.
6165
	(test_source_reload_dir): Add tests for physical and parse errors
6166
	when re-loading jobs with and without inotify, and for inotify-based
6167
	modification handling of jobs.
6168
714 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload): Add test for walk
6169
	* init/tests/test_conf.c (test_source_reload): Add test for walk
6170
	of non-existant directory with and without inotify; also test for
6171
	what happens when the top-level directory is deleted, again with
6172
	and without inotify.
6173
	* init/conf.c (conf_delete_handler): Handle the case of the top-level
6174
	directory being deleted by freeing the watch (so next time we asked
6175
	to reload, we can restore it).
6176
713 by Scott James Remnant
* init/tests/test_conf.c (test_source_reload): Add a test for
6177
	* init/tests/test_conf.c (test_source_reload): Add a test for
6178
	deletion of a running job.
6179
712 by Scott James Remnant
* init/conf.c (conf_item_free): Fix this up; when deleting an item
6180
	* init/conf.c (conf_item_free): Fix this up; when deleting an item
6181
	from a source, we first mark it for deletion unless it's already
6182
	marked for replacement.  Then if it's the replacement for something
6183
	else, we mark that to be replaced by whatever we're being replaced
6184
	by (so there are no references to us) and change that state if
6185
	necessary.  Finally we replace our own item and free the record
6186
	before returning.
6187
	* init/tests/test_conf.c (test_source_reload): Check that we handle
6188
	the cases of modiciation of a running job, modification of a
6189
	replacement of a running job and deletion of a replacement for a
6190
	running job.
6191
711 by Scott James Remnant
* init/parse_job.c (parse_job): Instead of freeing the previous
6192
	* init/parse_job.c (parse_job): Instead of freeing the previous
6193
	replacement, which could leave invalid references to it, mark it
6194
	for deletion and change the state.
6195
	* init/tests/test_parse_job.c (test_parse_job): Adjust the test so
6196
	that we hold a reference to the replacement job and make sure that
6197
	the state is changed to deleted, rather than checking for a destructor
6198
	being called on it.
6199
710 by Scott James Remnant
* init/init.supp (conf-init): Add valgrind suppression for the
6200
	* init/init.supp (conf-init): Add valgrind suppression for the
6201
	configuration sources hash table.
6202
709 by Scott James Remnant
* init/conf.c (conf_item_free): Don't overwrite any previous
6203
	* init/conf.c (conf_item_free): Don't overwrite any previous
6204
	replacement, only mark us for deletion if we wouldn't otherwise
6205
	be replaced.  Add some commented possible code for testing.
6206
	* init/tests/test_conf.c (test_source_reload): Test replacement of
6207
	jobs works properly; test modification with direct write and with
6208
	atomic rename replace; test deletion.
6209
708 by Scott James Remnant
* init/conf.c (conf_reload_path): It turns out that the flag trick
6210
	* init/conf.c (conf_reload_path): It turns out that the flag trick
6211
	doesn't work for items since we often reparse them within the same
6212
	file tag (it works with files because they're atomic and reparsed).
6213
	Store the old items in a different list instead.
6214
	(conf_source_free): We need to be careful about freeing sources,
6215
	so have a function to do it properly.
6216
	(conf_item_new): Since the flag member isn't useful, don't bother
6217
	setting it.
6218
	* init/conf.h: Add conf_source_free prototype.
6219
	(ConfFile): Remove flag member.
6220
	* init/tests/test_conf.c (test_source_reload): Add test for inotify
6221
	create detection.
6222
707 by Scott James Remnant
* init/conf.c (conf_file_delete): Rename to conf_file_free and match
6223
	* init/conf.c (conf_file_delete): Rename to conf_file_free and match
6224
	the pattern of those kinds of functions.
6225
	(conf_item_delete): Likewise rename to conf_item_free and match the
6226
	pattern of these kinds of functions.
6227
	* init/conf.h: Add prototypes.
6228
706 by Scott James Remnant
* init/conf.c (conf_reload_path): Fix bug with job name generation.
6229
	* init/conf.c (conf_reload_path): Fix bug with job name generation.
6230
	Allow non-parsing errors to be returned from the function.
6231
	(conf_item_delete): Drop all replacement management code, we'll put
6232
	this back through testing.
6233
	* init/tests/test_conf.c (test_source_reload): Test reloading adds
6234
	the right inotify watch and parses the files, also check that loading
6235
	without inotify and mandatory reloading work.
6236
705 by Scott James Remnant
* init/conf.c (conf_source_reload): Move the item deletion detection
6237
	* init/conf.c (conf_source_reload): Move the item deletion detection
6238
	code from this function, where it would only happen on a mandatory
6239
	reload
6240
	(conf_reload_path): to this function, where it will happen every time
6241
	the file is parsed; which is actually what we want.
6242
703 by Scott James Remnant
* init/conf.h (ConfItem): Drop the name and replace it with a type.
6243
2007-06-08  Scott James Remnant  <scott@netsplit.com>
6244
6245
	* init/conf.h (ConfItem): Drop the name and replace it with a type.
6246
	(ConfItemType): Enum for different types of configuration items
6247
	(ConfFile): Change items from a hash table to a list.
6248
	* init/conf.c (conf_file_get): Initialise the items member as a list.
6249
	(conf_item_set): Rename to conf_item_new again.
6250
	(conf_item_new): Allocates a new ConfItem and adds it to the file's
6251
	list, we won't reuse items anymore since it doesn't really make sense.
6252
	(conf_source_reload): Adjust clean-up code now that items is a list.
6253
	(conf_reload_path): Work out the name of jobs found by filename,
6254
	allocate a new item for them and parse the job into it.  Perform
6255
	handling of errors by outputting a warning.
6256
	(conf_item_delete): Takes both source and file so we can make
6257
	intelligent decisions.
6258
	(conf_file_delete): Takes a source and passes it to conf_item_delete
6259
	(conf_delete_handler): Pass both source and file to conf_file_delet
6260
	* init/tests/test_conf.c (test_file_get): Check that the items
6261
	list is empty; rather than the hash being unallocated.
6262
	(test_item_set): Rename back to test_item_new and only allocate a
6263
	single item which should get added to the list.
6264
699 by Scott James Remnant
* init/conf.c (conf_file_new): Rename to conf_file_get; in practice
6265
2007-06-06  Scott James Remnant  <scott@netsplit.com>
6266
702 by Scott James Remnant
* init/parse_job.c (stanza_respawn): Permit the word "unlimited",
6267
	* init/parse_job.c (stanza_respawn): Permit the word "unlimited",
6268
	raise a specific error for illegal limit and illegal interval.
6269
	(stanza_pid, stanza_kill, stanza_normal, stanza_umask) 
6270
	(stanza_nice, stanza_limit): Raise specific errors rather than
6271
	a generic "illegal value" error.
6272
	* init/tests/test_parse_job.c (test_stanza_respawn): Check that
6273
	we can use "unlimited", also check for new error return.
6274
	(test_stanza_pid, test_stanza_kill, test_stanza_normal) 
6275
	(test_stanza_umask, test_stanza_nice, test_stanza_limit): Check
6276
	for new specific errors.
6277
	* init/errors.h: Replace CFG_ILLEGAL_VALUE with a series of parse
6278
	errors.
6279
701 by Scott James Remnant
* init/conf.c: Comments.
6280
	* init/conf.c: Comments.
6281
700 by Scott James Remnant
* init/conf.c (conf_item_set): Call out to conf_item_delete() to
6282
	* init/conf.c (conf_item_set): Call out to conf_item_delete() to
6283
	handle unsetting of an item's data.
6284
	(conf_source_reload): Add code to deal with mandatory reloading,
6285
	calls conf_file_delete() and/or conf_item_delete() as appropriate.
6286
	(conf_delete_handler): Call conf_file_delete() on the ConfFile that
6287
	we find.
6288
	(conf_file_delete): Function to delete all items in a file.
6289
	(conf_item_delete): Placeholder function to delete an item.
6290
699 by Scott James Remnant
* init/conf.c (conf_file_new): Rename to conf_file_get; in practice
6291
	* init/conf.c (conf_file_new): Rename to conf_file_get; in practice
6292
	we never just want to allocate one of these, we always want to
6293
	return the existing entry if it exists.
6294
	(conf_item_new): Rename to conf_item_set; again in practice we always
6295
	want to update an existing item.  This function will grow the "deal
6296
	with replacement" stuff.
6297
	(conf_reload): Start putting in place the code that will allow
6298
	mandatory reloads, as well as initial setup.  This function iterates
6299
	over the sources and deals with errors.
6300
	(conf_source_reload): Function to reload an individual source, calls
6301
	out to one of the following two functions and will eventually perform
6302
	the deleted items scan.
6303
	(conf_source_reload_file): Set up a watch on a file, and reload it.
6304
	(conf_source_reload_dir): Set up a watch on a directory and reload it.
6305
	(conf_file_filter): Filter for watching parent directory of files.
6306
	(conf_create_modify_handler): File creation and modification handler.
6307
	(conf_delete_handler): File deletion handler.
6308
	(conf_file_visitor): Tree walk handler.
6309
	(conf_reload_path): Function that deals with files themselves,
6310
	currently just sorts out the ConfFile structure and maps the file
6311
	into memory.
6312
	* init/conf.h: Add new prototypes, update existing ones.
6313
	* init/tests/test_conf.c (test_file_new): Rename to test_file_get,
6314
	also test repeated calls when already in the table.
6315
	(test_item_new): Rename to test_item_set, also test repeated calls
6316
	when already in the table.
6317
	(test_source_reload): Start of test for reloading sources.
6318
698 by Scott James Remnant
* init/conf.c: Make a start on the new configuration management
6319
2007-06-05  Scott James Remnant  <scott@netsplit.com>
6320
6321
	* init/conf.c: Make a start on the new configuration management
6322
	routines, which will allow finer-grained tracking of configuration
6323
	and support mandatory reloading.
6324
	(conf_source_new, conf_file_new, conf_item_new): Start off with the
6325
	functions to allocate the tracking structures we need to use.
6326
	* init/conf.h: Structures and prototypes
6327
	* init/tests/test_conf.c: Test suite for allocation functions.
6328
	* init/Makefile.am (init_SOURCES): Build and link conf.c and conf.h
6329
	(TESTS): Run the conf test suite.
6330
	(test_conf_SOURCES, test_conf_LDFLAGS, test_conf_LDADD): Details for
6331
	the conf test suite.
6332
695 by Scott James Remnant
* upstart/Makefile.am (libupstart_la_LIBADD): Add $(LTLIBINTL)
6333
2007-06-04  Scott James Remnant  <scott@netsplit.com>
6334
696 by Scott James Remnant
* init/parse_job.c (stanza_description, stanza_author, stanza_version)
6335
	* init/parse_job.c (stanza_description, stanza_author, stanza_version)
6336
	(stanza_chroot, stanza_chdir, stanza_pid): Instead of erroring when
6337
	the string has already been allocated, free it and replace it with the
6338
	new one. Attempting to forbid duplicates is just too inconsistent,
6339
	especially for the integer ones which we compare against the default;
6340
	using the last one allows us to be entirely consistent.
6341
	(stanza_daemon, stanza_respawn, stanza_service, stanza_instance):
6342
	Don't error if the flag is already set, just ignore it.
6343
	(stanza_respawn, stanza_pid, stanza_kill, stanza_console) 
6344
	(stanza_umask, stanza_nice): Don't compare the current value against
6345
	the default, just overwrite it!
6346
	(parse_exec, parse_script): Free existing process command string
6347
	before setting a new one over the top.
6348
	(parse_process, stanza_exec, stanza_script, stanza_limit): Instead of
6349
	erroring if the structure is already set and allocated, just don't
6350
	allocate a new one and allow its members to be overwritten.
6351
	* init/tests/test_parse_job.c (test_stanza_exec) 
6352
	(test_stanza_script, test_stanza_pre_start) 
6353
	(test_stanza_post_start, test_stanza_pre_stop) 
6354
	(test_stanza_post_stop, test_stanza_description) 
6355
	(test_stanza_author, test_stanza_version, test_stanza_daemon) 
6356
	(test_stanza_respawn, test_stanza_service, test_stanza_instance) 
6357
	(test_stanza_pid, test_stanza_kill, test_stanza_console) 
6358
	(test_stanza_umask, test_stanza_nice, test_stanza_limit) 
6359
	(test_stanza_chroot, test_stanza_chdir): Replace tests that check
6360
	for an error in the case of duplicate stanzas with tests that make
6361
	sure the last of the duplicates is used.
6362
	* init/errors.h (CFG_DUPLICATE_VALUE, CFG_DUPLICATE_VALUE_STR): Drop
6363
	this error, since we don't consider this a problem anymore.
6364
695 by Scott James Remnant
* upstart/Makefile.am (libupstart_la_LIBADD): Add $(LTLIBINTL)
6365
	* upstart/Makefile.am (libupstart_la_LIBADD): Add $(LTLIBINTL)
6366
	* init/Makefile.am (init_LDADD): Reorder and add $(LTLIBINTL)
6367
	* util/Makefile.am (initctl_LDADD): Reorder and add $(LTLIBINTL)
6368
	* compat/sysv/Makefile.am (reboot_LDADD): Reorder and add $(LTLIBINTL)
6369
	(runlevel_LDADD): add $(LTLIBINTL)
6370
	(shutdown_LDADD): Reorder and add $(LTLIBINTL)
6371
	(telinit_LDADD): Reorder and add $(LTLIBINTL)
6372
	* logd/Makefile.am (logd_LDADD): Add $(LTLIBINTL)
6373
693 by Scott James Remnant
* init/cfgfile.c, init/cfgfile.h, init/tests/test_cfgfile.c: Rename
6374
2007-06-03  Scott James Remnant  <scott@netsplit.com>
6375
694 by Scott James Remnant
* init/tests/test_job.c (test_run_process): Add a test case for a
6376
	* init/tests/test_job.c (test_run_process): Add a test case for a
6377
	crasher when the event has no arguments.
6378
	* init/job.c (job_run_process): Fix the bug, we need to check the
6379
	arguments before trying to append them.
6380
693 by Scott James Remnant
* init/cfgfile.c, init/cfgfile.h, init/tests/test_cfgfile.c: Rename
6381
	* init/cfgfile.c, init/cfgfile.h, init/tests/test_cfgfile.c: Rename
6382
	to parse_job and strip out all functions except the parsing and stanza
6383
	ones.
6384
	* init/Makefile.am (init_SOURCES): Build and link parse_job.c and h
6385
	(TESTS): Run the parse job test suite
6386
	(test_cfgfile_SOURCES, test_cfgfile_LDFLAGS, test_cfgfile_LDADD):
6387
	Rename and update.
6388
	* init/parse_job.c: Rename all cfg_stanza_*() functions to just
6389
	stanza_*(), rename all cfg_parse_*() functions to just parse_*().
6390
	(parse_job, parse_process, stanza_exec, stanza_script, stanza_start)
6391
	(stanza_stop, stanza_emits, stanza_normal, stanza_env, stanza_limit):
6392
	Don't use NIH_MUST, it's fine to be out of memory and we should fail
6393
	in that case with a useful error.  The user can always reload the
6394
	config file.
6395
	(cfg_read_job, cfg_watch_dir, cfg_job_name, cfg_create_modify_handler)
6396
	(cfg_delete_handler, cfg_visitor): Drop these functions for now.
6397
	* init/parse_job.h: Update so it just contains the one prototype.
6398
	* init/tests/test_parse_job.c: Update all tests to pass a string
6399
	to parse_job(), and check errors raised; rather than mucking around
6400
	with file descriptors all of the time.  Spend the effort while we're
6401
	in here to run TEST_ALLOC_FAIL where we can.
6402
	* init/main.c: Drop config file loading for now since it's missing.
6403
691 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Separate out the job-handling code
6404
2007-05-27  Scott James Remnant  <scott@netsplit.com>
6405
692 by Scott James Remnant
* init/cfgfile.h (CFG_DIR): Drop this define, since it's in paths.h
6406
	* init/cfgfile.h (CFG_DIR): Drop this define, since it's in paths.h
6407
	(CfgDirectory): 
6408
691 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Separate out the job-handling code
6409
	* init/cfgfile.c (cfg_read_job): Separate out the job-handling code
6410
	into a new function that we could call from a stanza if we want
6411
	later; this one now just maps the file into memory and deals with
6412
	exceptions from the parsing.
6413
	(cfg_parse_job): Function containing the seperated out code; parses
6414
	a new job, marking it as a replacement for any existing job with the
6415
	same name.  Drop the warnings for using pid options without a daemon,
6416
	since these are actually useful for other things later.
6417
	* init/tests/test_cfgfile.c (test_read_job): Drop the check on
6418
	unexpected daemon options, since we don't issue these warnings
6419
	anymore.
6420
688 by Scott James Remnant
* init/event.c (event_ref, event_unref): Reference counting of events
6421
2007-05-20  Scott James Remnant  <scott@netsplit.com>
6422
690 by Scott James Remnant
* init/event.c (event_match): Change to accept Event as the first
6423
	* init/event.c (event_match): Change to accept Event as the first
6424
	argument and EventInfo as the second, making it obvious that this
6425
	matches a received Event against known EventInfo rather than just
6426
	comparing two info structs (since the order matters).
6427
	* init/event.h: Update prototype.
6428
	* init/tests/test_event.c (test_match): Update test accordingly.
6429
	(test_poll): Fix typo.
6430
	* init/job.c (job_handle_event): Pass in the event as the first
6431
	argument to event_match, rather than its info.
6432
	* TODO: Update.
6433
689 by Scott James Remnant
* init/job.c (job_emit_event): Return the event that we emit; don't
6434
	* init/job.c (job_emit_event): Return the event that we emit; don't
6435
	bother tracking block status or setting blocked, leave that to the
6436
	state loop so things are more obvious.
6437
	(job_change_state): Set the blocked flag here for starting and stopping
6438
	to the return value of job_emit_event().
6439
688 by Scott James Remnant
* init/event.c (event_ref, event_unref): Reference counting of events
6440
	* init/event.c (event_ref, event_unref): Reference counting of events
6441
	so we don't free those we still need.
6442
	(event_block, event_unblock): Blocker counting that replaces the
6443
	previous jobs member.
6444
	(event_new): Initialise refs and blockers fields.
6445
	(event_emit_finished): Remove this function.
6446
	(event_poll): Handle the new done state, and deal with the blockers
6447
	and references counts; turns out that we can fall all the way through
6448
	this switch if these are zero without needing to check again.
6449
	(event_pending): Remove call to event_emit_finished, the event_poll()
6450
	loop handles this case now.
6451
	(event_finished): Set progress to done on the way out.
6452
	* init/event.h (EventProgress): Add new done state
6453
	(Event): Add refs and blockers members, replacing jobs
6454
	* init/tests/test_event.c (test_new): Check refs and blockers are
6455
	initialised to zero.
6456
	(test_ref, test_unref, test_block, test_unblock): Check the ref
6457
	counting function behaviours.
6458
	(test_emit_finished): Drop this function since it's not used
6459
	* init/job.c (job_change_cause): Reference and block the event,
6460
	and unblock and unreference before changing.
6461
	(job_emit_event): Reference the event that blocks the job from
6462
	continuing.
6463
	(job_handle_event_finished): Unreference the blocking event again.
6464
	(job_change_state): Make sure that blocked has been cleared before
6465
	allowing a state change.
6466
	* init/tests/test_job.c: Change tests to use refs/blockers on the
6467
	cause event when counting, and also to follow the status of blocked
6468
	since that is now ref-counted as well.
6469
681 by Scott James Remnant
* TODO: Update.
6470
2007-05-18  Scott James Remnant  <scott@netsplit.com>
6471
687 by Scott James Remnant
* init/main.c (main, cad_handler, kbd_handler, pwr_handler): Use
6472
	* init/main.c (main, cad_handler, kbd_handler, pwr_handler): Use
6473
	event_new rather than event_emit.
6474
	* init/job.h (Job): Change type of cause and blocked to Event
6475
	* init/job.c (job_change_goal, job_change_cause, job_emit_event) 
6476
	(job_handle_event, job_handle_event_finished): Update all references
6477
	to EventEmission to use Event instead.
6478
	(job_detect_stalled): Call event_new instead of event_emit
6479
	(job_run_process): Use the info member of cause, not event member
6480
	* init/tests/test_job.c (test_change_goal, test_change_state) 
6481
	(test_run_process, test_child_reaper, test_handle_event) 
6482
	(test_handle_event_finished): Update all references to EventEmission
6483
	to use Event instead.
6484
	(test_detect_stalled): Correct to use right structure types.
6485
	* init/process.c (process_setup_environment): Use cause's info member,
6486
	rather than event member.
6487
	* init/tests/test_process.c (test_spawn): Update to use Event.
6488
	* init/notify.h (NotifySubscription): Change member to event
6489
	* init/notify.c (notify_subscribe_event) 
6490
	(notify_subscription_find, notify_job_event, notify_event) 
6491
	(notify_event_finished): Update functions to use event member and
6492
	Event structures.
6493
	* init/tests/test_notify.c (test_subscribe_event) 
6494
	(test_subscription_find, test_job, test_job_event, test_event) 
6495
	(test_event_finished): Update to use Event instead of EventEmission
6496
	* init/control.c (control_event_emit): Update to use event_new.
6497
	* init/tests/test_control.c (test_event_emit) 
6498
	(test_subscribe_events, test_unsubscribe_events): Update to use
6499
	Event rather than EventEmission.
6500
6501
	* init/event.h: Fix up a few references.
6502
	* init/tests/test_event.c (test_new): Remove reference to emission.
6503
685 by Scott James Remnant
* init/event.h (EventEmission): Rename to Event, and rename event
6504
	* init/event.h (EventEmission): Rename to Event, and rename event
6505
	member to info.
6506
	* init/event.c (event_emit_next_id): Rename to event_next_id
6507
	(event_emit): Rename to event_new, and add standard parent argument.
6508
	(event_emit_find_by_id): Rename to event_find_by_id
6509
	(event_poll): Iterate over Events in the list
6510
	(event_pending, event_finished): Operate on Event
6511
	* init/tests/test_event.c (test_emit): Rename to test_new and
6512
	adjust for names and arguments.
6513
	(test_emit_find_by_id): Rename to test_find_by_id and adjust for
6514
	names.
6515
	(test_emit_finished, test_poll): Adjust names.
6516
684 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop)
6517
	* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop) 
6518
	(cfg_stanza_emits): Convert to use EventInfo and event_info_*.
6519
	* init/job.c (job_copy): Use EventInfo and event_info_copy.
6520
	(job_handle_event, job_detect_stalled): Iterate EventInfo structures
6521
	* init/tests/test_cfgfile.c (test_stanza_start, test_stanza_stop) 
6522
	(test_stanza_emits): Update to use EventInfo
6523
	* init/tests/test_job.c (test_copy, test_handle_event) 
6524
	(test_handle_event_finished, test_detect_stalled): Update to use
6525
	EventInfo and event_info_new
6526
	* init/event.c (event_copy): Use nih_str_array_copy here, to make the
6527
	code somewhat simpler.
6528
	(event_finished): Copy the arguments and environment from the old
6529
	event, rather than stealing and reparenting.
6530
	* init/job.c (job_copy): Use nih_str_array_copy here too.
6531
	(job_run_process): Use nih_str_array_append to add the arguments from
6532
	the emission onto the command run.
6533
683 by Scott James Remnant
* init/event.h (Event): Rename to EventInfo, since this structure
6534
	* init/event.h (Event): Rename to EventInfo, since this structure
6535
	representations information about an event, rather than an actual
6536
	event in progress.
6537
	* init/event.c (event_new): Rename to event_info_new, also now can
6538
	take arguments and environment like event_emit() can.
6539
	(event_copy): Rename to event_info_copy.
6540
	* init/tests/test_event.c (test_new): Rename to test_info_new,
6541
	update names in test and test being given args or env.
6542
	(test_copy): Rename to test_info_copy and update names in test.
6543
	(test_match, test_poll): Use EventInfo.
682 by Scott James Remnant
* init/event.c (event_copy): Use nih_str_array_copy here, to make the
6544
681 by Scott James Remnant
* TODO: Update.
6545
	* TODO: Update.
6546
679 by Scott James Remnant
* configure.ac: Add AM_PROG_CC_C_O since we use per-target flags
6547
2007-04-24  Scott James Remnant  <scott@netsplit.com>
6548
6549
	* configure.ac: Add AM_PROG_CC_C_O since we use per-target flags
6550
	for one of the test cases.
6551
678 by Scott James Remnant
* upstart/message.c (upstart_message_newv): Add va_end to match
6552
2007-03-16  Scott James Remnant  <scott@netsplit.com>
6553
6554
	* upstart/message.c (upstart_message_newv): Add va_end to match
6555
	va_copy because the standard says so.
6556
	* upstart/wire.c (upstart_push_packv, upstart_pop_packv): Add
6557
	va_end here as well.
6558
666 by Scott James Remnant
* upstart/wire.c (upstart_push_int, upstart_pop_int): Send over the
6559
2007-03-13  Scott James Remnant  <scott@netsplit.com>
6560
677 by Scott James Remnant
* init/main.c: Wait until we've closed inherited standard file
6561
	* init/main.c: Wait until we've closed inherited standard file
6562
	descriptors and opened the console instead before trying to open the
6563
	control socket; otherwise we end up closing it by accident if we
6564
	weren't opened with sufficient descriptors in the first place.
6565
	Also wait until we've set up the logger before trying to parse the
6566
	configuration.  In fact both of these things need to be pretty low
6567
	down the main() function.
6568
676 by Scott James Remnant
* init/tests/test_job.c (test_run_process): Skip /dev/fd test cases
6569
	* init/tests/test_job.c (test_run_process): Skip /dev/fd test cases
6570
	if that's not available.
6571
675 by Scott James Remnant
* init/tests/test_control.c (test_log_priority): Make sure we know
6572
	* init/tests/test_control.c (test_log_priority): Make sure we know
6573
	that the message has been sent before calling the watcher.
6574
674 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): We get ENOSYS for missing inotify
6575
	* init/cfgfile.c (cfg_watch_dir): We get ENOSYS for missing inotify
6576
	support, not EOPNOTSUPP.
6577
	* init/tests/test_cfgfile.c (test_watch_dir): Actually make the
6578
	directory tree before testing for inotify, since we use the same
6579
	tree there too.
6580
673 by Scott James Remnant
* util/initctl.c (job_info_output): Restructure so gcc doesn't think
6581
	* util/initctl.c (job_info_output): Restructure so gcc doesn't think
6582
	name can be used uninitialised.
6583
	* init/tests/test_cfgfile.c (test_watch_dir): Correct an error where
6584
	i wouldn't be initialised if we skipped the inotify tests.
6585
6586
	* util/initctl.c (job_info_output): Restructure so gcc doesn't think
672 by Scott James Remnant
* init/process.c (process_setup_environment): job id fits inside
6587
	* init/process.c (process_setup_environment): job id fits inside
6588
	a %u now
6589
671 by Scott James Remnant
* upstart/message.h: Style; always refer to "unsigned int" as
6590
	* upstart/message.h: Style; always refer to "unsigned int" as
6591
	"unsigned int", and never "unsigned.
6592
	* upstart/tests/test_message.c (my_handler): Catch a stray couple
6593
	of "unsigned"s
6594
670 by Scott James Remnant
* init/control.c (control_job_query, control_job_start)
6595
	* init/control.c (control_job_query, control_job_start) 
6596
	(control_job_stop): Change type of id argument to unsigned int,
6597
	and call printf with %u to output it.
6598
	* init/tests/test_control.c (check_job, check_job_instance) 
6599
	(check_job_instance_end, check_job_status__waiting) 
6600
	(check_job_status_end__waiting, check_job_status__starting) 
6601
	(check_job_status_end__starting, check_job_status__running) 
6602
	(check_job_status_end__running, check_job_status__pre_stop) 
6603
	(check_job_status_end__pre_stop, check_job_status__stopping) 
6604
	(check_job_status_end__stopping, check_job_status__deleted) 
6605
	(check_job_status_end__deleted, check_job_unknown) 
6606
	(check_job_invalid, check_job_unchanged, check_event): Change
6607
	type of id arguments to unsigned int.
6608
	(check_list): Change type of id to unsigned int.
6609
	* init/tests/test_notify.c (check_job_status) 
6610
	(check_job_status_end, check_job_finished, check_event) 
6611
	(check_event_caused, check_event_finished): Change type of id
6612
	arguments to unsigned int.
6613
669 by Scott James Remnant
* init/job.h (Job): Change the type of the id to unsigned int.
6614
	* init/job.h (Job): Change the type of the id to unsigned int.
6615
	* init/job.c (job_next_id): Change ids to be unsigned ints, and now
6616
	we can just use %u in the nih_error call.
6617
	(job_find_by_id): Change argument to be unsigned int
6618
	* init/tests/test_job.c (test_find_by_id): Change id type to unsigned
6619
	int.
6620
	* init/event.h (Event): Change the type of the id to unsigned int.
6621
	* init/event.c (event_emit_next_id): Change ids to be unsigned ints,
6622
	and now we can just use %u in the nih_error call.
6623
	(event_emit_find_by_id): Change argument to be unsigned int
6624
	* init/tests/test_event.c (test_emit, test_emit_find_by_id) 
6625
	(check_event, check_event_finished): Change id type to unsigned int.
6626
668 by Scott James Remnant
* util/initctl.c (output_name): Use an unsigned int for the job id,
6627
	* util/initctl.c (output_name): Use an unsigned int for the job id,
6628
	which means we can use ordinary %u for the printf argument.
6629
	(handle_job, handle_job_finished, handle_job_instance) 
6630
	(handle_job_instance_end, handle_job_status) 
6631
	(handle_job_status_end, handle_job_unknown, handle_job_invalid) 
6632
	(handle_job_unchanged, handle_event, handle_event_caused) 
6633
	(handle_event_finished): Change argument type of id from uint32_t
6634
	to unsigned int.
6635
	(job_info_output): Change output type of id from %zu to %u
6636
667 by Scott James Remnant
* upstart/message.c (upstart_message_handle): Use unsigned int for
6637
	* upstart/message.c (upstart_message_handle): Use unsigned int for
6638
	ids, rather than a fixed-width type.
6639
	* upstart/tests/test_message.c (my_handler): Use unsigned int for
6640
	the ids, and give "unsigned int" instead of "unsigned" to va_arg as
6641
	a matter of style.
6642
666 by Scott James Remnant
* upstart/wire.c (upstart_push_int, upstart_pop_int): Send over the
6643
	* upstart/wire.c (upstart_push_int, upstart_pop_int): Send over the
6644
	wire using a plain old integer type, instead of a fixed width type;
6645
	there's no advantage to using the fixed-width type and we could hurt
6646
	ourselves if we tried running on ILP64.
6647
	(upstart_push_unsigned, upstart_pop_unsigned): Likewise use a plain
6648
	unsigned int over the wire.
6649
	(upstart_push_string, upstart_pop_string): Use an unsigned int for
6650
	the length of the string, technically this means that we silently
6651
	truncate any string that's greater than 4GB on 64-bit platforms;
6652
	it's either that or make the test cases harder (we did this before
6653
	anyway).
6654
	(upstart_push_header, upstart_pop_header): Type is always an unsigned
6655
	int (best conversion from an enum)
6656
655 by Scott James Remnant
* util/initctl.c (start_action, stop_action): Imply --no-wait if
6657
2007-03-11  Scott James Remnant  <scott@netsplit.com>
6658
665 by Scott James Remnant
* configure.ac: Bump version to 0.3.9
6659
	* configure.ac: Bump version to 0.3.9
6660
664 by Scott James Remnant
Release 0.3.8
6661
	* NEWS: Update.
6662
663 by Scott James Remnant
* util/man/initctl.8: Document the new commands.
6663
	* util/man/initctl.8: Document the new commands.
6664
662 by Scott James Remnant
* TODO: Update.
6665
	* TODO: Update.
6666
661 by Scott James Remnant
* init/job.c (job_handle_event): Correct the function so we don't
6667
	* init/job.c (job_handle_event): Correct the function so we don't
6668
	try and stop the master of an instance, and cause an assertion error.
6669
660 by Scott James Remnant
* util/initctl.c: Oops, correct function pointers in command table
6670
	* util/initctl.c: Oops, correct function pointers in command table
6671
6672
	* util/tests/test_initctl.c (test_version_action): 
6673
659 by Scott James Remnant
* util/initctl.c (handle_version): Handle receipt of the version
6674
	* util/initctl.c (handle_version): Handle receipt of the version
6675
	reply.
6676
	(version_action): Send the version-query message to the server and
6677
	expect one response.
6678
	(log_priority_action): Parse the single argument into an NihLogLevel
6679
	and send it to the server.
6680
658 by Scott James Remnant
* init/control.c (control_version_query, control_log_priority):
6681
	* init/control.c (control_version_query, control_log_priority):
6682
	Functions to handle the new messages from the server pov
6683
	* init/tests/test_control.c (test_version_query) 
6684
	(test_log_priority): Test the new messages are handled properly.
6685
	(check_version): Check the version string matches.
657 by Scott James Remnant
* upstart/message.h: Add messages for querying the version of the
6686
	* upstart/message.h: Add messages for querying the version of the
6687
	init daemon and changing the log priority.
6688
	* upstart/message.c (upstart_message_newv)
6689
	(upstart_message_handle): Marshal the new messages.
6690
	* upstart/tests/test_message.c (test_new, my_handler) 
6691
	(test_handle): Test the marshalling of the new messages,
6692
656 by Scott James Remnant
* upstart/libupstart.ver: Add enum functions to the global list.
6693
	* upstart/libupstart.ver: Add enum functions to the global list.
6694
655 by Scott James Remnant
* util/initctl.c (start_action, stop_action): Imply --no-wait if
6695
	* util/initctl.c (start_action, stop_action): Imply --no-wait if
6696
	we take the job id or name from an environment variable, since we'd
6697
	end up waiting for ourselves otherwise
6698
	* util/tests/test_initctl.c (test_start_action, test_stop_action):
6699
	Update test cases to make sure no-wait is implied.
6700
644 by Scott James Remnant
* compat/sysv/shutdown.c: More error/fatal adjustments.
6701
2007-03-09  Scott James Remnant  <scott@netsplit.com>
6702
654 by Scott James Remnant
* configure.ac: Bump version to 0.3.8
6703
	* configure.ac: Bump version to 0.3.8
6704
653 by Scott James Remnant
Release 0.3.7
6705
	* NEWS: Updated.
6706
	* configure.ac: Increase version to 0.3.7
6707
651 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add a test case for
6708
	* init/tests/test_job.c (test_change_state): Add a test case for
6709
	deleting the last instance of a replaced job.
6710
	* init/job.c (job_change_state): When moving a instance of a job into
6711
	the deleted state, check whether we should replace the job it's an
6712
	instance of, and if so, change that job's state too.
6713
	* TODO: Update.
6714
650 by Scott James Remnant
* util/initctl.c (handle_job_list): Always allocate current_list,
6715
	* util/initctl.c (handle_job_list): Always allocate current_list,
6716
	since we need it to be the parent of pointers we attach to it.
6717
	(handle_job_list_end): Always free the current list, only suppress
6718
	output if there aren't any entries in it.
6719
	(initctl_recv): Check the current_list pointer, no need for in_list
6720
	(handle_job_instance, handle_job_instance_end, handle_job_status):
6721
	Check current_list not in_list.
6722
	* util/tests/test_initctl.c: Correct some memory leaks.
6723
649 by Scott James Remnant
* init/process.c (process_setup_environment): Set the UPSTART_JOB_ID
6724
	* init/process.c (process_setup_environment): Set the UPSTART_JOB_ID
6725
	environment variable to the job's unique id.
6726
	* init/tests/test_process.c (test_spawn): Make sure it's set.
6727
648 by Scott James Remnant
* util/man/initctl.8: Update the initctl manpage.
6728
	* util/man/initctl.8: Update the initctl manpage.
6729
	* compat/sysv/man/reboot.8: Correct a minor grammar error.
6730
	* compat/sysv/man/shutdown.8: Fix reference from runlevel to telinit.
6731
647 by Scott James Remnant
* README: Add a README that copies the text from the web page and
6732
	* README: Add a README that copies the text from the web page and
6733
	adds some notes about recommended operating system versions.
6734
646 by Scott James Remnant
* util/initctl.c: Completely rewrite initctl, top to bottom; handling
6735
	* util/initctl.c: Completely rewrite initctl, top to bottom; handling
6736
	of the new messages is done natively, meaning that the commands just
6737
	vary the requests send and number of responses expected.
6738
	* util/tests/test_initctl.c: Test all of the new code.
6739
645 by Scott James Remnant
* init/main.c: Improve restarting and rescuing a little; store the
6740
	* init/main.c: Improve restarting and rescuing a little; store the
6741
	program path in a static variable so we can always access it, and
6742
	use the exported loglevel to pass the same to the new process.
6743
	* TODO: Update.
6744
644 by Scott James Remnant
* compat/sysv/shutdown.c: More error/fatal adjustments.
6745
	* compat/sysv/shutdown.c: More error/fatal adjustments.
6746
	* compat/sysv/telinit.c: More error/fatal adjustments.
6747
635 by Scott James Remnant
* doc/states.dot: Fix an error in the state diagram; when moving from
6748
2007-03-08  Scott James Remnant  <scott@netsplit.com>
6749
643 by Scott James Remnant
* init/main.c (main, crash_handler): Promote deadly errors to nih_fatal
6750
	* init/main.c (main, crash_handler): Promote deadly errors to nih_fatal
6751
	* logd/main.c (main): Promote deadly errors to nih_fatal
6752
	* compat/sysv/reboot.c (main): Promote deadly errors to nih_fatal
6753
	* compat/sysv/shutdown.c (main, shutdown_now): Promote deadly errors
6754
	to nih_fatal
6755
	* compat/sysv/telinit.c (main): Promote deadly errors to nih_fatal
6756
642 by Scott James Remnant
* init/event.c (event_pending): The message that we're handling an
6757
	* init/event.c (event_pending): The message that we're handling an
6758
	event should be logged with --verbose.
6759
641 by Scott James Remnant
* init/cfgfile.c (cfg_parse_script): Remove the unnecessary check for
6760
	* init/cfgfile.c (cfg_parse_script): Remove the unnecessary check for
6761
	a token inside a script block.
6762
640 by Scott James Remnant
* TODO: Update.
6763
	* TODO: Update.
6764
639 by Scott James Remnant
* init/control.c (control_watch_jobs): Rename to control_subscribe_jobs
6765
	* init/control.c (control_watch_jobs): Rename to control_subscribe_jobs
6766
	and update to handle new event name.
6767
	(control_unwatch_jobs): Rename to control_unsubscribe_jobs and update
6768
	to handle the new event name.
6769
	(control_watch_events): Rename to control_subscribe_events and update
6770
	to handle the new event name.
6771
	(control_unwatch_events): Rename to control_unsubscribe_events and
6772
	update to handle the new event name.
6773
	* init/tests/test_control.c (test_watch_jobs): Rename to
6774
	test_subscribe_jobs and update to new event name.
6775
	(test_unwatch_jobs): Rename to test_unsubscribe_jobs and update to 
6776
	new event name.
6777
	(test_watch_events): Rename to test_subscribe_events and update to
6778
	new event name.
6779
	(test_unwatch_events): Rename to test_unsubscribe events and update
6780
	to new event name.
6781
6782
	* upstart/message.h: Rename the watch commands to subscribe/unsubscribe
6783
	and regroup with new message numbers.
6784
	* upstart/message.c (upstart_message_newv) 
6785
	(upstart_message_handle): Marshal the updated subscription messages.
6786
	* upstart/tests/test_message.c (test_new, my_handler) 
6787
	(test_handle): Update tests to new names and numbers.
6788
	* TODO: Update.
6789
637 by Scott James Remnant
* upstart/message.c (upstart_message_handle): Raise a the unknown
6790
	* upstart/message.c (upstart_message_handle): Raise a the unknown
6791
	message error if the type is unknown, rather than the invalid message
6792
	error.
6793
	* upstart/tests/test_message.c (test_handle): Correct test case.
6794
636 by Scott James Remnant
* init/job.c (job_change_state): Correct a problem here too, when
6795
	* init/job.c (job_change_state): Correct a problem here too, when
6796
	moving from pre-stop to running, we don't want to emit a started event
6797
	since we never emitted a stopping event and never killed the process
6798
	anyway.  We do need to notify the job as finished, since the process
6799
	that tried to stop it will need to be told not to wait any longer.
6800
	* init/tests/test_job.c (test_change_state): Add a test for pre-stop
6801
	back to running.
6802
635 by Scott James Remnant
* doc/states.dot: Fix an error in the state diagram; when moving from
6803
	* doc/states.dot: Fix an error in the state diagram; when moving from
6804
	starting back to waiting, due to a failed respawn, we need to emit
6805
	the stopped event otherwise it will never happen.
6806
	* doc/states.png: Update.
6807
626 by Scott James Remnant
* upstart/message.h: Restore arguments to JOB_LIST, but rename to
6808
2007-03-05  Scott James Remnant  <scott@netsplit.com>
6809
634 by Scott James Remnant
* upstart/message.c (upstart_message_new): Make this a wrapper around
6810
	* upstart/message.c (upstart_message_new): Make this a wrapper around
6811
	(upstart_message_newv): which has all the old code, but accepts a
6812
	va_list instead of making its own.
6813
	* upstart/message.h: Add prototype.
6814
633 by Scott James Remnant
* init/main.c (crash_handler): Simply trying to leave a SEGV handler
6815
	* init/main.c (crash_handler): Simply trying to leave a SEGV handler
6816
	doesn't work so well, we end up repeating the problem instruction.
6817
	We really can't resume from this point, and can't even jump elsewhere
6818
	since our state is probably buggered up.  Only thing for it is to
6819
	re-exec ourselves with a clean state.
6820
632 by Scott James Remnant
* init/cfgfile.c (cfg_read_job, cfg_delete_handler): Don't try and
6821
	* init/cfgfile.c (cfg_read_job, cfg_delete_handler): Don't try and
6822
	free the magic (void *)-1 replacement (delete).
6823
631 by Scott James Remnant
* util/events.c, util/events.c, util/jobs.c, util/jobs.h: With the
6824
	* util/events.c, util/events.c, util/jobs.c, util/jobs.h: With the
6825
	new message responses, that intermix event and job information freely,
6826
	it no longer makes sense to distinguish between them.  So fold these
6827
	files back into the main initctl.c
6828
	* util/initctl.h: Drop unused header.
6829
	* util/Makefile.am (initctl_SOURCES): Update sources list.
6830
	(TESTS): Change which tests we build
6831
	(test_initctl_SOURCES, test_initctl_CFLAGS, test_initctl_LDFLAGS) 
6832
	(test_initctl_LDADD): Build the new combined test case binary, use
6833
	an automake feature to rebuild initctl.c with -DTEST and a different
6834
	.o file, and thus be able to define out main()
6835
6836
	* util/tests/test_events.c, util/tests/test_jobs.c: Collapse the two
6837
	test case files into one single
6838
	* util/tests/test_initctl.c
6839
630 by Scott James Remnant
* init/control.c (control_job_find): And implement the find function
6840
	* init/control.c (control_job_find): And implement the find function
6841
	that returns a list of jobs matching an optional pattern.
6842
	* init/tests/test_control.c: Make sure we do send all messages.
6843
	(check_list): Complex function to check the responses to a job list
6844
	(test_job_find): Test a couple of job lists.
6845
	* init/tests/test_notify.c: Make sure we do send all messages.
6846
629 by Scott James Remnant
* init/control.c (control_job_query): Implement the query message,
6847
	* init/control.c (control_job_query): Implement the query message,
6848
	this just needs to return the status or instance set.
6849
	* init/tests/test_control.c (test_job_query): Test the query command.
6850
	(check_job_status__deleted, check_job_status_end__deleted): Pair of
6851
	functions to check we can query deleted jobs directly.
6852
628 by Scott James Remnant
* init/control.c (control_send_instance): Function to send an instance
6853
	* init/control.c (control_send_instance): Function to send an instance
6854
	job, collating all of its instances together.
6855
	* init/control.h: Update.
6856
	* init/tests/test_control.c (test_send_instance): Check we receive
6857
	the right messages.
6858
	(check_job_instance, check_job_instance_end): Pair of functions to
6859
	check the instance messages.
6860
627 by Scott James Remnant
* upstart/message.h: Add new UPSTART_JOB_INSTANCE and
6861
	* upstart/message.h: Add new UPSTART_JOB_INSTANCE and
6862
	UPSTART_JOB_INSTANCE_END messages which we'll use to communicate that
6863
	a job is an instance, and group the instances of it together.
6864
	* upstart/message.c (upstart_message_new, upstart_message_handle):
6865
	Marshal the new instance messages.
6866
	* upstart/tests/test_message.c (test_new, my_handler) 
6867
	(test_handle): Test the new message types.
6868
626 by Scott James Remnant
* upstart/message.h: Restore arguments to JOB_LIST, but rename to
6869
	* upstart/message.h: Restore arguments to JOB_LIST, but rename to
6870
	pattern since that's what it is.
6871
	* upstart/message.c (upstart_message_handle): Restore arguments
6872
	with updated name.
6873
	* upstart/tests/test_message.c (test_new, my_handler) 
6874
	(test_handle): Restore tests for arguments, rename and make sure we
6875
	include a wildcard.
6876
612 by Scott James Remnant
* upstart/message.h: Update the message types, introducing a more
6877
2007-03-04  Scott James Remnant  <scott@netsplit.com>
6878
625 by Scott James Remnant
* upstart/message.h: Drop arguments to JOB_LIST.
6879
	* upstart/message.h: Drop arguments to JOB_LIST.
6880
	* upstart/message.c (upstart_message_new, upstart_message_handle):
6881
	Drop arguments to JOB_LIST.
6882
	* upstart/tests/test_message.c (test_new, my_handler) 
6883
	(test_handle): Drop the arguments from the test.
6884
624 by Scott James Remnant
* init/control.c (control_job_start): Update to return INVALID for
6885
	* init/control.c (control_job_start): Update to return INVALID for
6886
	instances and replacements; add the forgotten UPSTART_JOB message.
6887
	(control_job_stop): Update to return INVALID for replacements; add
6888
	the forgotten UPSTART_JOB message.  Deal with instance masters
6889
	magically by iterating all instances and stopping those instead.
6890
	* init/tests/test_control.c (check_job_deleted): Rename to 
6891
	check_job_invalid and check that message.
6892
	(check_job): Function to check the job we've acted upon.
6893
	(test_job_start): Check that we get the UPSTART_JOB message first,
6894
	restore the check on deleted jobs causing an error and add checks
6895
	that instance and replacement jobs also cause an error.
6896
	(test_job_stop): Check that we get the UPSTART_JOB message first,
6897
	restore the check on deleted jobs causing an error.  Make sure
6898
	instances are handled.
6899
623 by Scott James Remnant
* upstart/message.h: More message changes; add a JOB_FIND message
6900
	* upstart/message.h: More message changes; add a JOB_FIND message
6901
	and replace UPSTART_JOB_DELETED with UPSTART_JOB_INVALID since there's
6902
	a few more problem conditions.
6903
	* upstart/message.c (upstart_message_new, upstart_message_handle):
6904
	Marshal the new message and update names.
6905
	* upstart/tests/test_message.c (test_new, my_handler) 
6906
	(test_handle): Update tests to check the new message and update the
6907
	values and names of the existing ones.
6908
622 by Scott James Remnant
* init/job.h (Job): Remove the delete flag, add replacement and
6909
	* init/job.h (Job): Remove the delete flag, add replacement and
6910
	replacement_for pointers instead.
6911
	* init/job.c (job_new): Initialise replacement and replacement_for
6912
	pointers to NULL.
6913
	(job_find_by_name): Update to return what job the one we found is
6914
	a replacement for, and to skip DELETED jobs.
6915
	(job_instance): Make it simply illegal to call this for deleted jobs,
6916
	instances or replacements.
6917
	(job_change_goal): Make it illegal to change the goal of a replacement
6918
	job.
6919
	(job_free_deleted): Remove the previous code to handle deleted instance
6920
	masters, because it's now bogus.
6921
	(job_should_replace): New function to determine whether a job is
6922
	replaceable.
6923
	* init/tests/test_job.c (test_new): Check pointers are set.
6924
	(test_copy): Check that replacement and replacement_for are not
6925
	copied, since their state of an individual job.
6926
	(test_find_by_name): Update tests to make sure we ignore deleted jobs,
6927
	instances and replacements.
6928
	(test_instance): Remove test that will now cause an assertion,
6929
	and no longer check delete is set.
6930
	(test_change_goal): Remove test that will now cause an assertion.
6931
	(test_free_deleted): Remove test cases for deleted masters.
6932
	(test_should_replace): Test the new check function.
6933
	(test_change_state): Make sure that we end up in deleted for instances
6934
	and replaced jobs, and that replacements become the real job.
6935
	* init/cfgfile.c (cfg_read_job): Update to handle replacement jobs;
6936
	the old job's previous replacement is discarded, and set to the
6937
	current job; and then if the job should be replaced, it's moved
6938
	to deleted (which should promote the new job).
6939
	(cfg_delete_handler): Handle deletion of a job in a similar manner,
6940
	except we sent the replacement pointer to the special -1 value since
6941
	we have no actual replacement.
6942
	* init/tests/test_cfgfile.c (test_watch_dir): Update tests to make
6943
	sure that deletion and modification are handled wrt replacement.
6944
	(test_read_job): Make sure that reparsing an existing file is handled.
6945
	* init/tests/test_control.c (test_job_start): Remove checks that
6946
	delete gets set to true for instances.
6947
	(test_job_stop, test_job_start): Temporarily comment out deleted
6948
	job behaviour, since that's been somewhat changed.
6949
621 by Scott James Remnant
* upstart/message.h: We're not going to return JOB_LIST for JOB_STOP
6950
	* upstart/message.h: We're not going to return JOB_LIST for JOB_STOP
6951
	since that's just awkward for the client; just act on the master,
6952
	and return JOB_UNCHANGED.
6953
620 by Scott James Remnant
* init/notify.c (notify_job_status): Move this function to
6954
	* init/notify.c (notify_job_status): Move this function to
6955
	* init/control.c (control_send_job_status): here, since we need it for
6956
	the new control responses.
6957
	(control_job_query): New single function to list all jobs or a
6958
	particular job.
6959
	* init/control.h: Add prototype.
6960
	* init/tests/test_control.c (test_error_handler): Simplify this a
6961
	little to just sending a NO_OP message, since we can send an entire
6962
	stream of messages and leave them in the queue.
6963
	(check_job_status__stopping, check_job_process) 
6964
	(check_job_status_end__stopping): Trio of check functions for a job
6965
	status that's stopping, with an active main process.
6966
	(test_send_job_status): Test the now global status function.
6967
	(check_job_status__starting, check_job_status_end__starting): Pair
6968
	of check functions for a starting job with no process yet.
6969
	(test_watch_jobs, test_unwatch_jobs): Update to expect the full new
6970
	job status messages, with an optional process part as well.
6971
	(check_event): Function to check an event.
6972
	(test_watch_events): Minor update to use above function.
6973
	(check_job_status__waiting, check_job_status_end__waiting): Pair of
6974
	check functions for the first step in starting a job (goal change only)
6975
	(check_job_unknown, check_job_deleted, check_job_unchanged): Trio
6976
	of functions to check common error responses.
6977
	(test_job_start): Update tests to newer behaviour.
6978
	(check_job_status__running, check_job_status_end__running) 
6979
	(check_job_status__pre_stop, check_job_status_end__pre_stop): Checks
6980
	for the states we go through when stopping a job.
6981
	(test_job_stop): Update tests to newer behaviour.
6982
	* init/notify.c (notify_job, notify_job_event, notify_job_finished):
6983
	Update to call the newly exported function.
6984
	* init/job.c: Make job_id and job_id_wrapped externally available.
6985
	* init/job.h: Update.
6986
	* init/event.c: Make emission_id and emission_id_wrapped externally
6987
	available.
6988
	* init/event.h: Update.
6989
619 by Scott James Remnant
* upstart/message.h: Rename UPSTART_JOB_INVALID to
6990
	* upstart/message.h: Rename UPSTART_JOB_INVALID to
6991
	UPSTART_JOB_UNCHANGED, as it's not really invalid just a no-op
6992
	* upstart/message.c (upstart_message_new, upstart_message_handle):
6993
	Update the constant, fields are unchanged,
6994
	* upstart/tests/test_message.c (test_new, my_handler) 
6995
	(test_handle): Rename constants/messages.
6996
618 by Scott James Remnant
* upstart/message.h: Turns out we need extra errors to indicate that
6997
	* upstart/message.h: Turns out we need extra errors to indicate that
6998
	the job was deleted or already at that goal, otherwise the client
6999
	would sit there waiting for the finished event.	
7000
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7001
	Marshal the new error messages.
7002
	* upstart/tests/test_message.c (test_new, my_handler) 
7003
	(test_handle): Test the handling of the new messages.
7004
617 by Scott James Remnant
* init/tests/test_job.c (test_free_deleted): Found a bug; because
7005
	* init/tests/test_job.c (test_free_deleted): Found a bug; because
7006
	master instances never change state, they never end up in the deleted
7007
	state so are never reaped.  Add some test cases for cleaning them up,
7008
	but not while they have remaining instances.
7009
	* init/job.c (job_free_deleted): Implement the bug fix.
7010
616 by Scott James Remnant
* init/job.c (job_instance): Split out the instance spawning code
7011
	* init/job.c (job_instance): Split out the instance spawning code
7012
	into its own function, as we'll frequently need a pointer to the
7013
	instance before we try and change the goal.
7014
	(job_change_goal): Clean this function back up again, it no longer
7015
	needs to return values and can assert that it's never called for
7016
	deleted jobs or instance mastersr.
7017
	(job_handle_event): Spawn an instance when we get a start event.
7018
	* init/job.h: Update.
7019
	* init/tests/test_job.c (test_instance): Check instance creation.
7020
	(test_change_goal): Update tests now that it doesn't return a value
7021
	again, and doesn't spawn instances itself.
7022
	(test_handle_event): Make sure instances are spawned.
7023
615 by Scott James Remnant
* init/tests/test_event.c (test_poll): Needs a slight fix now that
7024
	* init/tests/test_event.c (test_poll): Needs a slight fix now that
7025
	we generate more events than we check, and that subscriptions go
7026
	away automatically.
7027
614 by Scott James Remnant
* init/notify.c (notify_job_status): Static function to handle
7028
	* init/notify.c (notify_job_status): Static function to handle
7029
	sending the more complicated job status message series 
7030
	(notify_job): Call notify_job_status() to send the new-style message
7031
	(notify_job_event): Send the new UPSTART_EVENT_CAUSED message with
7032
	the emission id, then call notify_job_status() to send the new-style
7033
	common status message.
7034
	(notify_job_finished): New function to be called when we reach the
7035
	job rest state, notifies and unsubscribes directly subscribed
7036
	processes, and includes failed information.
7037
	(notify_event_finished): Unsubscribe processes after sending the
7038
	finished event, since the event has gone away.  Also don't send
7039
	this to processes subscribed to all events, since it's not useful
7040
	for them.
7041
	* init/notify.h: Add prototype.
7042
	* init/tests/test_notify.c: Update all test cases and helper
7043
	functions to the new message types.
7044
	(test_job_finished): Check the new finished message is sent with
7045
	a status message preceeding it.
7046
	* init/job.c (job_change_state, job_change_state): Notify subscribed
7047
	processes with notify_job_finished() when in the running (for service)
7048
	or waiting states, just before we drop the cause.
7049
613 by Scott James Remnant
* upstart/message.h: Add failed, failed_process and exit_status
7050
	* upstart/message.h: Add failed, failed_process and exit_status
7051
	arguments to UPSTART_JOB_FINISHED.
7052
	* upstart/message.c (upstart_message_new, upstart_message_handle): 
7053
	Marshal the new arguments.
7054
	* upstart/tests/test_message.c (test_new, my_handler) 
7055
	(test_handle): Test the new arguments.
7056
612 by Scott James Remnant
* upstart/message.h: Update the message types, introducing a more
7057
	* upstart/message.h: Update the message types, introducing a more
7058
	structured job message set and replacing the UPSTART_EVENT_JOB_STATUS
7059
	message with UPSTART_EVENT_CAUSED which will be immediately followed
7060
	by an ordinary UPSTART_JOB_STATUS message.
7061
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7062
	Marshal the new messages.
7063
	* upstart/tests/test_message.c (test_new, my_handler) 
7064
	(test_handle): Test the new message types.
7065
	* TODO: Update.
7066
609 by Scott James Remnant
* init/event.c (event_emit_next_id): Split the id assigning code into
7067
2007-03-03  Scott James Remnant  <scott@netsplit.com>
7068
611 by Scott James Remnant
* TODO: Update.
7069
	* TODO: Update.
7070
610 by Scott James Remnant
* init/cfgfile.c (cfg_parse_exec, cfg_parse_script): Separate out
7071
	* init/cfgfile.c (cfg_parse_exec, cfg_parse_script): Separate out
7072
	the parsing of an exec or script stanza into separate functions,
7073
	seeing as this is quite a common operation.  This also means we
7074
	just need to change them in one place now.
7075
	(cfg_parse_process): Function to call either of the above depending
7076
	on the next argument.
7077
	(cfg_stanza_exec): Call cfg_parse_exec instead.
7078
	(cfg_stanza_script): Call cfg_parse_script instead.
7079
	(cfg_stanza_pre_start, cfg_stanza_post_start) 
7080
	(cfg_stanza_pre_stop, cfg_stanza_post_stop): Call cfg_parse_process
7081
	with the right arguments instead of doing by hand in each function.
7082
609 by Scott James Remnant
* init/event.c (event_emit_next_id): Split the id assigning code into
7083
	* init/event.c (event_emit_next_id): Split the id assigning code into
7084
	a static inline function for easier modification.
7085
	* init/job.c (job_next_id): Use the same style function here too.
7086
599 by Scott James Remnant
* TODO: Update.
7087
2007-03-02  Scott James Remnant  <scott@netsplit.com>
7088
608 by Scott James Remnant
* init/event.c (event_emit): Port the slightly more efficient in the
7089
	* init/event.c (event_emit): Port the slightly more efficient in the
7090
	early case code from job_new.
7091
607 by Scott James Remnant
* init/job.h (Job): Add a unique id to the job structure.
7092
	* init/job.h (Job): Add a unique id to the job structure.
7093
	* init/job.c (job_new): Assign an incrementing id to each new job
7094
	allocated.
7095
	(job_find_by_id): Locate a job by its unique id, sadly not very
7096
	efficient in a hash table ;-)
7097
	(job_name): New hash key function since name isn't the first entry
7098
	anymore.
7099
	(job_init): Change hash key function.
7100
	* init/tests/test_job.c (test_find_by_id): Make sure we can find a
7101
	job by its id.
7102
606 by Scott James Remnant
* init/job.c (job_change_goal): Return the new instance in that
7103
	* init/job.c (job_change_goal): Return the new instance in that
7104
	circumstance, and clean up a little bit.
7105
	* init/job.h: Update prototype.
7106
	* init/tests/test_job.c (test_change_goal): Update tests.
7107
605 by Scott James Remnant
* init/job.c (job_find_by_name): Skip jobs marked for deletion too.
7108
	* init/job.c (job_find_by_name): Skip jobs marked for deletion too.
7109
	* init/tests/test_job.c (test_find_by_name): Update test case.
7110
604 by Scott James Remnant
* init/event.h, init/notify.h, upstart/message.h: Provide C-level names
7111
	* init/event.h, init/notify.h, upstart/message.h: Provide C-level names
7112
	for enums, this makes the compiler generate things that gdb can get.
7113
603 by Scott James Remnant
* init/job.c (job_run_process, job_kill_process, job_kill_timer):
7114
	* init/job.c (job_run_process, job_kill_process, job_kill_timer):
7115
	Change process argument to be a plain ProcessType, this means we
7116
	know exactly which process we're trying to run or kill.
7117
	(job_change_state): Update calls to job_run_process
7118
	and job_kill_process
7119
	* init/tests/test_job.c (test_run_process, test_kill_process): Update
7120
	function calls to just pass a ProcessType in.
7121
602 by Scott James Remnant
* upstart/enum.h: Rename JobAction to ProcessType.
7122
	* upstart/enum.h: Rename JobAction to ProcessType.
7123
	* upstart/enum.c (job_action_name): Rename to process_name.
7124
	(job_action_from_name): Rename to process_from_name.
7125
	* upstart/tests/test_enum.c (test_action_name, test_action_from_name):
7126
	Rename and update to match.
7127
	* init/job.c (job_new, job_copy, job_change_state) 
7128
	(job_next_state): Change JOB_*_ACTION constants to PROCESS_*.
7129
	(job_find_by_pid): Change JobAction argument to ProcessType.
7130
	(job_emit_event): Call process_name on the failed process.
7131
	(job_child_reaper): Update to use ProcessType instead of JobAction.
7132
	* init/job.h (Job): Change type of failed_process to ProcessType.
7133
	* init/tests/test_job.c (test_find_by_pid): Update to use ProcessType
7134
	instead of JobAction in tests.
7135
	(test_new, test_copy, test_change_goal, test_change_state) 
7136
	(test_next_state, test_run_process, test_kill_process) 
7137
	(test_child_reaper, test_handle_event_finished): Change JOB_*_ACTION
7138
	constants to PROCESS_*
7139
	* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script) 
7140
	(cfg_stanza_pre_start, cfg_stanza_post_start) 
7141
	(cfg_stanza_pre_stop, cfg_stanza_post_stop): Change JOB_*_ACTION
7142
	constants to PROCESS_*
7143
	* init/tests/test_cfgfile.c (test_stanza_exec) 
7144
	(test_stanza_script, test_stanza_pre_start) 
7145
	(test_stanza_post_start, test_stanza_pre_stop) 
7146
	(test_stanza_post_stop, test_read_job, test_watch_dir): Change
7147
	JOB_*_ACTION constants to PROCESS_*
7148
	* init/tests/test_event.c (test_poll): Change JOB_*_ACTION constants
7149
	to PROCESS_*
7150
	* init/tests/test_control.c (test_job_start, test_job_stop): Change
7151
	JOB_*_ACTION constants to PROCESS_*
7152
601 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): Restore the prefix argument; pass
7153
	* init/cfgfile.c (cfg_watch_dir): Restore the prefix argument; pass
7154
	as the data pointer to the inotify callbacks and visitor function.
7155
	Change the return value to be the watch structure.
7156
	(cfg_job_name): Add prefix argument and prepend to relative path.
7157
	(cfg_create_modify_handler, cfg_delete_handler, cfg_visitor): Get
7158
	the prefix for the job names from the data pointer and pass to
7159
	cfg_job_name().
7160
	* init/cfgfile.h: Update prototypes.
7161
	* init/tests/test_cfgfile.c (test_watch_dir): Actually test the
7162
	watch functions.
7163
	* init/main.c (main): Pass NULL for the prefix for the global job
7164
	directory, compare the return value against (void *)-1.
7165
	* TODO: Update.
7166
600 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_on): Drop the simple on stanza.
7167
	* init/cfgfile.c (cfg_stanza_on): Drop the simple on stanza.
7168
	* init/tests/test_cfgfile.c (test_stanza_on): Remove test case.
7169
599 by Scott James Remnant
* TODO: Update.
7170
	* TODO: Update.
7171
587 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_respawn): Remove the shortcut that
7172
2007-03-01  Scott James Remnant  <scott@netsplit.com>
7173
598 by Scott James Remnant
* util/jobs.c (handle_job_status): Drop the process field from the
7174
	* util/jobs.c (handle_job_status): Drop the process field from the
7175
	output for now.
7176
	* util/events.c (handle_event_job_status): Likewise
7177
	* util/tests/test_jobs.c (test_start_action, test_list_action) 
7178
	(test_jobs_action): Drop pid from messages we simulate.
7179
	* util/tests/test_events.c (test_emit_action): Likewise.
7180
597 by Scott James Remnant
* upstart/message.c (upstart_message_new, upstart_message_handle):
7181
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7182
	Remove the pid field from the job status and event job status
7183
	messages.
7184
	* upstart/message.h: Update description of job status and event
7185
	job status message to remove the pid field.
7186
	* upstart/tests/test_message.c (test_new, my_handler) 
7187
	(test_handle): Remove checks using the pid field.
7188
596 by Scott James Remnant
* init/control.c (control_job_start, control_job_stop)
7189
	* init/control.c (control_job_start, control_job_stop) 
7190
	(control_job_query, control_job_list): Remove the pid field from
7191
	the messages, it'll come back later when we get better message
7192
	formats.
7193
	* init/tests/test_control.c (check_job_status, check_job_waiting) 
7194
	(check_job_started, check_job_stopped): Remove checks on the process
7195
	id, since that field is gone from the message.
7196
	(test_job_stop): Use the pid field of the main process.
7197
	(test_job_start): Initialise the main action process.
7198
595 by Scott James Remnant
* init/notify.c (notify_job, notify_job_event): Remove the pid field
7199
	* init/notify.c (notify_job, notify_job_event): Remove the pid field
7200
	from the message, it'll come back later when we get better message
7201
	formats.
7202
	* init/tests/test_notify.c (check_job_status) 
7203
	(check_event_job_status): Remove checks on the pid, since that field
7204
	is no longer present.
7205
594 by Scott James Remnant
* init/job.c (job_process_copy): Use job_process_new here, oops.
7206
	* init/job.c (job_process_copy): Use job_process_new here, oops.
7207
593 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script)
7208
	* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script) 
7209
	(cfg_stanza_pre_start, cfg_stanza_post_start) 
7210
	(cfg_stanza_pre_stop, cfg_stanza_post_stop): Use job_process_new
7211
	to allocate process structures and store in the process array.
7212
	* init/tests/test_cfgfile.c (test_read_job, test_stanza_exec) 
7213
	(test_stanza_script, test_stanza_pre_start) 
7214
	(test_stanza_post_start, test_stanza_pre_stop) 
7215
	(test_stanza_post_stop): Update test cases to use process array
7216
	member information.
7217
592 by Scott James Remnant
* init/tests/test_event.c (test_poll): Update to use newer job process
7218
	* init/tests/test_event.c (test_poll): Update to use newer job process
7219
	array and find the pid under there.
7220
591 by Scott James Remnant
* init/job.h (Job): Remove the pid and aux_pid fields; replace the
7221
	* init/job.h (Job): Remove the pid and aux_pid fields; replace the
7222
	individual JobProcess pointers with an array of them of a fixed
7223
	minimum size; replace failed_state with failed_process.
7224
	(JobProcess): add a pid field here, so now we can obtain the pid on
7225
	an individual process/action basis rather than global.
7226
	* init/job.c (job_process_new): Function to create a JobProcess
7227
	structure, setting the initial values to FALSE/NULL/0.
7228
	(job_process_copy): Function to copy a JobProcess.
7229
	(job_new): Don't initialise the pid or aux_pid members, initialise
7230
	the process array to a fixed initial size and set the members to NULL,
7231
	initialise the failed_process member to -1.
7232
	(job_copy): Update to use job_process_copy and copy the process array.
7233
	(job_find_by_pid): Look through the process structures in the job's
7234
	process array to find the pid, and optionally return which action it
7235
	was.
7236
	(job_change_state): Call job_kill_process in the JOB_KILLED state if
7237
	we have a main process and that has a pid, pass in the main process.
7238
	(job_next_state): Check the process id of the main process when
7239
	deciding what the next state is for running.
7240
	(job_run_process): Store the process id in the process structure
7241
	(job_kill_process): Accept a process structure and use that to obtain
7242
	the process id we need to send TERM too.  Remove the code that forced
7243
	a state change if kill() failed, since we will get a child signal
7244
	anyway and should do it there.
7245
	(job_kill_timer): Likewise, accept a process structure and don't
7246
	forcibly change the state anymore.
7247
	(job_child_reaper): Rewrite to switch based on the action that died,
7248
	rather than the state we were in; assert that the state is what we
7249
	expected.
7250
	(job_emit_event): The argument to the failed event is now the action
7251
	name, rather than the state name; an action of -1 indicates that
7252
	respawn failed.
7253
	* init/tests/test_job.c (test_process_new, test_process_copy): Make
7254
	sure the structure is created and copied properly.
7255
	(test_new, test_copy): Drop checks on the pid and aux_pid members,
7256
	add checks for the process array and pid members of processes.
7257
	(test_find_by_pid): Update test case to make sure we can find the pid
7258
	of any process, returning the action index rather than the process
7259
	pointer.
7260
	(test_run_process, test_kill_process, test_change_goal)
7261
	(test_change_state, test_next_state, test_child_reaper): Update test
7262
	cases to use pid fields inside process structures rather than the
7263
	pid or aux_pid members.
7264
	(test_handle_event, test_handle_event_finished) 
7265
	(test_free_deleted): Update to avoid pid field checks.
7266
590 by Scott James Remnant
* upstart/enum.h (JobAction): Enumeration of different actions.
7267
	* upstart/enum.h (JobAction): Enumeration of different actions.
7268
	* upstart/enum.c (job_action_name, job_action_from_name): Enumeration
7269
	to string conversion functions.
7270
	* upstart/tests/test_enum.c (test_action_name) 
7271
	(test_action_from_name): Tests for the new functions.
7272
589 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Instead of trying to copy over an
7273
	* init/cfgfile.c (cfg_read_job): Instead of trying to copy over an
7274
	old job's state and instances into the new one, mark the old job
7275
	as deleted.  This ensures we never end up applying a new post-stop
7276
	script to a job started with an old pre-start script, etc.  It also
7277
	makes life so much simpler.
7278
	* init/tests/test_cfgfile.c (test_read_job): Update tests to make
7279
	sure the old job is marked for deletion, instead of freed.
7280
	* TODO: Update.
7281
588 by Scott James Remnant
* init/notify.c (notify_job): Split out notification to processes
7282
	* init/notify.c (notify_job): Split out notification to processes
7283
	subscribed to the cause event into a new function
7284
	(notify_job_event): We can call this when we change cause.
7285
	* init/job.c (job_change_state): Notify anyone subscribed to the
7286
	job after we've changed the state, rather than before, otherwise
7287
	we won't know the new pids or anything.
7288
	(job_change_cause): Call notify_job_event before changing the cause
7289
	so that subscribers get a final status update.
7290
	* init/tests/test_notify.c (test_job_event): Check the new function.
7291
	* TODO: Update.
7292
587 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_respawn): Remove the shortcut that
7293
	* init/cfgfile.c (cfg_stanza_respawn): Remove the shortcut that
7294
	lets you specify "respawn COMMAND".  It was confusing as it hid
7295
	the common "[when] exec"/"[when] script" syntax, made it non-obvious
7296
	that "exec" and "respawn" were the same flag, etc.
7297
	* init/tests/test_cfgfile.c (test_stanza_respawn): Update tests.
7298
	(test_stanza_service): Fix test case to not use shortcut.
7299
	* logd/event.d/logd.in: Update to not use respawn shortcut.
7300
583 by Scott James Remnant
* TODO: Update.
7301
2007-02-25  Scott James Remnant  <scott@netsplit.com>
7302
586 by Scott James Remnant
* init/job.c (job_child_reaper): Shift the signal value into the
7303
	* init/job.c (job_child_reaper): Shift the signal value into the
7304
	higher byte to make it easier to detect, and not stamp over exit
7305
	statuses between 128 and 255.
7306
	(job_emit_event): Detect the signal stored in the new way.
7307
	* init/cfgfile.c (cfg_stanza_normal): Store signal in the higher bytes.
7308
	* init/tests/test_job.c (test_copy, test_change_state) 
7309
	(test_child_reaper): Update test cases.
7310
	* init/tests/test_cfgfile.c (test_stanza_normal): Update test.
7311
585 by Scott James Remnant
* TODO: Update.
7312
	* TODO: Update.
7313
584 by Scott James Remnant
* init/event.h (PWRSTATUS_EVENT): Add new power-status-changed event.
7314
	* init/event.h (PWRSTATUS_EVENT): Add new power-status-changed event.
7315
	* init/main.c (pwd_handler): Handle the SIGPWR signal by generating
7316
	the new event, leave it up to a job to parse the file and do
7317
	whatever it likes.
7318
583 by Scott James Remnant
* TODO: Update.
7319
	* TODO: Update.
7320
582 by Scott James Remnant
* upstart/tests/test_message.c (test_reader, test_handle_using)
7321
2007-02-13  Scott James Remnant  <scott@netsplit.com>
7322
7323
	* upstart/tests/test_message.c (test_reader, test_handle_using)
7324
	(test_handle); Usual fix for gcc optimiser thinking that fixed
7325
	for loops might not be.
7326
	* init/tests/test_job.c (test_run_process, test_kill_process):
7327
	Likewise.
7328
	* init/tests/test_notify.c (test_subscription_find): I still don't
7329
	know what a type-punned pointer is, nor why dereferencing such a
7330
	thing would break strict-aliasing rules.
7331
	* init/tests/test_cfgfile.c (test_read_job): More type-punning.
7332
	* util/tests/test_jobs.c (test_start_action): More for-loop action.
7333
	* util/tests/test_events.c (test_emit_action): And again.
7334
579 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop)
7335
2007-02-11  Scott James Remnant  <scott@netsplit.com>
7336
581 by Scott James Remnant
* init/job.c (job_change_goal): We need to be able to stop a running
7337
	* init/job.c (job_change_goal): We need to be able to stop a running
7338
	job without a process, because that's what a job-as-state is!  The
7339
	check was added because job_child_reaper calls job_change_goal and
7340
	then job_change_state immediately after, we should fix that instead.
7341
	(job_child_reaper): If we call job_change_goal while in the running
7342
	state, it will call job_change_state for us; so check for that first
7343
	and don't change the state!
7344
	* init/tests/test_job.c (test_change_goal): Update the test to ensure
7345
	that we can stop a job with no running process.
7346
580 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_normalexit): normalexit is inconsistent,
7347
	* init/cfgfile.c (cfg_stanza_normalexit): normalexit is inconsistent,
7348
	change to "normal exit"
7349
	* init/tests/test_cfgfile.c (test_stanza_normalexit): Update.
7350
579 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop)
7351
	* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop) 
7352
	(cfg_stanza_pre_start, cfg_stanza_post_start) 
7353
	(cfg_stanza_pre_stop, cfg_stanza_post_stop, cfg_stanza_respawn):
7354
	We're not going to allow stanza keywords to be quoted, since this
7355
	gives us an easy way to allow users to make something explicitly
7356
	not a keyword.
7357
565 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script): Rewrite to
7358
2007-02-10  Scott James Remnant  <scott@netsplit.com>
7359
578 by Scott James Remnant
* configure.ac: Bump version to 0.3.6
7360
	* configure.ac: Bump version to 0.3.6
7361
577 by Scott James Remnant
Release 0.3.5
7362
	* configure.ac: Increase version to 0.3.5
7363
	* NEWS: Update.
7364
	* TODO: Update.
7365
576 by Scott James Remnant
* TODO: More notes.
7366
	* TODO: More notes.
7367
575 by Scott James Remnant
* TODO: Note an issue with using JobProcess->pid
7368
	* TODO: Note an issue with using JobProcess->pid
7369
574 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_pre_start, cfg_stanza_post_start)
7370
	* init/cfgfile.c (cfg_stanza_pre_start, cfg_stanza_post_start) 
7371
	(cfg_stanza_pre_stop, cfg_stanza_post_stop): Add a needed check
7372
	for a token when parsing "exec".  Correct line number we expect
7373
	to see the duplicated value on.  Correct expected error for missing
7374
	argument from "Unexpected token" to "Expected token".
7375
7376
	* init/tests/test_cfgfile.c (main): Actually invoke the tests for
7377
	the scripts.
7378
573 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Correct type of lineno in error.
7379
	* init/cfgfile.c (cfg_read_job): Correct type of lineno in error.
7380
572 by Scott James Remnant
* TOOD: Minor notify bug
7381
	* TOOD: Minor notify bug
7382
571 by Scott James Remnant
* TODO: Big update.
7383
	* TODO: Big update.
7384
570 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Make sure that we can
7385
	* init/tests/test_job.c (test_child_reaper): Make sure that we can
7386
	reap post-start and pre-stop processes, and have only the aux_pid
7387
	changed.  Also make sure that if the running process dies while
7388
	in these states, with or without an aux process, that we don't
7389
	transition badly.
7390
569 by Scott James Remnant
* init/job.c (job_find_by_pid): Check aux_pid as well.
7391
	* init/job.c (job_find_by_pid): Check aux_pid as well.
7392
	* init/tests/test_job.c (test_find_by_pid): Make sure we can find it.
7393
568 by Scott James Remnant
* init/job.h (Job): Add an auxiliary pid member.
7394
	* init/job.h (Job): Add an auxiliary pid member.
7395
	* init/job.c (job_new): Initialise the aux_pid member.
7396
	(job_change_state): Run the post-start and pre-stop scripts when we
7397
	enter the state with the same name (assuming they exist).
7398
	(job_run_process): Store the pid in aux_pid when starting the
7399
	post-start or pre-stop processes.
7400
	* init/tests/test_job.c (test_change_state): Add tests for running
7401
	the new post-start and pre-stop scripts; which get their process ids
7402
	stored in aux_pid instead of pid.
7403
	(test_new): Make sure the aux_pid member is initialised properly.
7404
	(test_copy): Make sure the aux_pid member is not copied.
7405
7406
	* TODO: Update.
7407
567 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add a check for the
7408
	* init/tests/test_job.c (test_change_state): Add a check for the
7409
	daemon stanza holding the job in spawned; we snuck this in a while
7410
	back and never tested it (there's no support to get it out of
7411
	spawned yet).
7412
566 by Scott James Remnant
* init/job.h (Job): Add new post_start and pre_stop scripts.
7413
	* init/job.h (Job): Add new post_start and pre_stop scripts.
7414
	* init/job.c (job_new): Initialise new scripts to NULL.
7415
	(job_copy): Copy the information from the new scripts over as well.
7416
	* init/tests/test_job.c (test_new): Check they're initialised.
7417
	(test_copy): Check that the information is copied properly.
7418
	* init/cfgfile.c (cfg_stanza_post_start, cfg_stanza_pre_stop): Add
7419
	new script stanza functions for the additional two scripts that
7420
	we want.
7421
	* init/tests/test_cfgfile.c (test_stanza_post_start) 
7422
	(test_stanza_pre_stop): Add tests for the new stanzas.
7423
565 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script): Rewrite to
7424
	* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script): Rewrite to
7425
	allocate a JobProcess and parse the command or script into it.
7426
	(cfg_read_job): Fix the long broken assumption that pid_file and
7427
	pid_binary are required for respawn, when they're actually required
7428
	for daemon.
7429
	(cfg_stanza_start, cfg_stanza_stop): Remove script second-level.
7430
	(cfg_stanza_respawn): Parse into the job's process.
7431
	(cfg_stanza_pre_start, cfg_stanza_post_stop): New stanzas for the
7432
	processes alone.
7433
	* init/tests/test_cfgfile.c (test_read_job): Update a few test
7434
	cases to match reality.
7435
	(test_stanza_start, test_stanza_stop): Remove script-related checks.
7436
518 by Scott James Remnant
* init/job.c (job_change_goal): Have a stab at this function with the
7437
2007-02-09  Scott James Remnant  <scott@netsplit.com>
7438
564 by Scott James Remnant
* init/tests/test_job.c (test_kill_process): Poll the event queue
7439
	* init/tests/test_job.c (test_kill_process): Poll the event queue
7440
	after each test to get rid of the allocated events and make valgrind
7441
	happy.
7442
	* init/tests/test_control.c (test_job_start, test_job_stop)
7443
	(test_event_emit): Poll the event queue after each test to get rid
7444
	of the allocated events, as they make valgrind complain.
7445
	(test_event_emit): Free args and env when done.
7446
563 by Scott James Remnant
* init/job.h (JobName): Drop obsolete structure
7447
	* init/job.h (JobName): Drop obsolete structure
7448
	(JobProcess): Add a new structure to represent a single process
7449
	within the job, instead of using two variables to pick either the
7450
	script or command.
7451
	(Job): Change command and script to a single JobProcess called process;
7452
	change start_script and stop_script to a JobProcess called pre_start
7453
	and post_stop respectively.
7454
	* init/job.c (job_new): Initialise new members to NULL.
7455
	(job_copy): Copy the process structures across, including contents.
7456
	(job_change_state): Call job_run_process passing in the structure;
7457
	rather than fiddling with if statements.
7458
	(job_run_script, job_run_command, job_run_process): Combine all of
7459
	these three functions into a single new job_run_process function.
7460
	* init/tests/test_job.c (test_new, test_copy, test_change_goal) 
7461
	(test_change_state, test_child_reaper) 
7462
	(test_handle_event_finished): Change to using JobProcess for when
7463
	we need to construct a command.
7464
	(test_run_script, test_run_command): Merge into single new
7465
	(test_run_process) function.
7466
	* init/tests/test_event.c (test_poll): Replace command with process.
7467
	* init/tests/test_control.c (test_job_start): Change to using
7468
	JobProcess to specify the command.
7469
562 by Scott James Remnant
* init/main.c (main): Run job_free_deleted each time through the
7470
	* init/main.c (main): Run job_free_deleted each time through the
7471
	main loop.
7472
561 by Scott James Remnant
* init/job.c (job_change_goal): Minor tweak to the logic; we may
7473
	* init/job.c (job_change_goal): Minor tweak to the logic; we may
7474
	have just made the job an instance, that should still let us stop
7475
	the one underneath.
7476
560 by Scott James Remnant
* TODO: Update.
7477
	* TODO: Update.
7478
559 by Scott James Remnant
* util/jobs.c (do_job): Always expect a list of replies.
7479
	* util/jobs.c (do_job): Always expect a list of replies.
7480
558 by Scott James Remnant
* init/control.c (control_job_status, control_job_stop)
7481
	* init/control.c (control_job_status, control_job_stop)
7482
	(control_job_query): Reply with information about all instances of
7483
	the job.
7484
	* init/tests/test_control.c (test_job_status, test_job_stop)
7485
	(test_job_query): Make sure we get the list end even for a single job;
7486
	and make sure we get details of all instances attached to the job.
7487
557 by Scott James Remnant
* init/tests/test_job.c (test_change_goal): Check that starting
7488
	* init/tests/test_job.c (test_change_goal): Check that starting
7489
	an instance job actually starts a new instance of it.
7490
556 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_limit): Support the word "unlimited" in
7491
	* init/cfgfile.c (cfg_stanza_limit): Support the word "unlimited" in
7492
	limit arguments for both the soft and hard values.
7493
	* init/tests/test_cfgfile.c (test_stanza_limit): Make sure that we
7494
	can make limits be unlimited.
7495
555 by Scott James Remnant
* init/event.c (event_copy): Function to copy an event structure.
7496
	* init/event.c (event_copy): Function to copy an event structure.
7497
	* init/event.h: Add prototype.
7498
	* init/tests/test_event.c (test_copy): Make sure we copy the event
7499
	correctly, with or without arguments and/or environment.
7500
	* init/job.c (job_copy): Function to copy a job structure, leaving
7501
	the state as it is.
7502
	* init/job.h: Add prototype.
7503
	* init/tests/test_job.c (test_copy): Make sure that we copy the
7504
	job details whether they are NULL or non-NULL, but don't copy the
7505
	state.
7506
	* init/init.supp: Update supression.
554 by Scott James Remnant
* init/job.c (job_find_by_name): If we get a job that's an instance,
7507
	* init/job.c (job_find_by_name): If we get a job that's an instance,
7508
	return what it's an instance of.
7509
	* init/tests/test_job.c (test_find_by_name): Restore accidentally
7510
	deleted test function; test that we get the real job, not an instance.
7511
553 by Scott James Remnant
* init/job.c (job_new): instance_of is initialised to NULL.
7512
	* init/job.c (job_new): instance_of is initialised to NULL.
7513
	* init/job.h: Add a new instance_of pointer, pointing to the parent
7514
	that we're an instance of.
7515
	* init/tests/test_job.c (test_new): Check that.
7516
	* init/tests/test_cfgfile.c (test_read_job): Make sure instance_of
7517
	pointers are updated.
7518
552 by Scott James Remnant
* init/job.c (jobs): Store jobs in a hash table.
7519
	* init/job.c (jobs): Store jobs in a hash table.
7520
	(job_new): Add to hash table, not to a list.
7521
	(job_handle_event, job_handle_event_finished, job_detect_stalled) 
7522
	(job_free_deleted): Iterate across the hash table, rather than list.
7523
	(job_find_by_name): Use nih_hash_lookup, we keep this function because
7524
	we'll add "is instance or not" smarts soon!
7525
	(job_find_by_pid): Iterate across the entire hash table.
7526
	* init/tests/test_job.c (test_find_by_name): Drop test since this
7527
	function is now gone.
7528
	(test_free_deleted): Can't assume things are in a line now.
7529
	* init/control.c (control_job_list): Iterate the hash table.
7530
551 by Scott James Remnant
* init/event.c: Don't hide the events list anymore
7531
	* init/event.c: Don't hide the events list anymore
7532
	* init/event.h: Publish it and the init function.
7533
	* init/job.c: Don't hide the jobs list anymore.
7534
	(job_list): Since we don't hide it, we can drop this.
7535
	* init/job.h: Publish it and the init function.
7536
	* init/notify.c: Don't hide the subscriptions list anymore.
7537
	* init/notify.h: Publish it and the init function.
7538
	* init/control.c (control_job_list): Iterate the job list directly
7539
	* init/tests/test_control.c (test_event_emit): Use the events list
7540
	available to us.
7541
	* init/tests/test_event.c (test_poll): Call job_init directly and
7542
	just use the events list available to us.
7543
	* init/tests/test_job.c (test_new): Call job_init directly.
7544
	(test_change_state): Use the events list available to us.
7545
	* init/tests/test_notify.c (test_unsubscribe): Use the subscriptions
7546
	list available to us.
7547
550 by Scott James Remnant
* doc/states.dot: Add updated state graph.
7548
	* doc/states.dot: Add updated state graph.
7549
	* doc/Makefile.am (EXTRA_DIST): Ship the states diagram.
7550
	(states.png): Include rules to build the png, we'll put it in bzr
7551
	anyway, but this is useful.
7552
549 by Scott James Remnant
* init/cfgfile.c (cfg_delete_handler): Handle deleted jobs; mark
7553
	* init/cfgfile.c (cfg_delete_handler): Handle deleted jobs; mark
7554
	the job as deleted, and if it's dormant, invoke a state change.
7555
548 by Scott James Remnant
* upstart/enum.h: Add a new JOB_DELETED state.
7556
	* upstart/enum.h: Add a new JOB_DELETED state.
7557
	* upstart/enum.c (job_state_name, job_state_from_name): Add the new
7558
	state to the string functions.
7559
	* upstart/tests/test_enum.c (test_state_name) 
7560
	(test_state_from_name): Check the enum works.
7561
	* init/job.c (job_change_goal): New decision; we can start a waiting
7562
	job if it's marked delete (it might be a new instance) -- we'll use
7563
	the new deleted state to decide that we shouldn't.
7564
	(job_change_state): Once we reach waiting, if the job is to be deleted,
7565
	move to the next state.
7566
	(job_next_state): The next state for a waiting job if the goal is stop
7567
	is deleted.  We should never call job_next_state () for a deleted job.
7568
	(job_free_deleted): Very simple function, just detects
7569
	deleted jobs and frees them.
7570
	* init/job.h: Add prototype for new function.
7571
	* init/tests/test_job.c (test_change_goal): Update test to use new
7572
	deleted state; and don't even change the goal.
7573
	(test_change_state): Add a check to make sure we end up in deleted.
7574
	(test_next_state): Make sure waiting goes to deleted.
7575
	(test_free_deleted): Check the function.
7576
547 by Scott James Remnant
* init/job.c (job_change_goal): Don't try and start a job if it's
7577
	* init/job.c (job_change_goal): Don't try and start a job if it's
7578
	marked to be deleted and is just waiting for cleanup.
7579
	* init/tests/test_job.c (test_change_state): Make sure that the cause
7580
	is released when we reach waiting.
7581
546 by Scott James Remnant
* init/tests/test_cfgfile.c (test_read_job): Make sure that a deleted
7582
	* init/tests/test_cfgfile.c (test_read_job): Make sure that a deleted
7583
	job gets resurrected.
7584
545 by Scott James Remnant
* init/cfgfile.c (cfg_visitor): Correct number of arguments and call
7585
	* init/cfgfile.c (cfg_visitor): Correct number of arguments and call
7586
	to cfg_job_name.
7587
544 by Scott James Remnant
* TODO: Update.
7588
	* TODO: Update.
7589
543 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_daemon): Don't allow arguments anymore.
7590
	* init/cfgfile.c (cfg_stanza_daemon): Don't allow arguments anymore.
7591
	* init/tests/test_cfgfile.c (test_stanza_daemon): Update tests.
7592
542 by Scott James Remnant
* init/job.c (job_handle_event_finished): Function to unblock all
7593
	* init/job.c (job_handle_event_finished): Function to unblock all
7594
	jobs blocked on a given event emission.
7595
	(job_new, job_emit_event): Rename blocker to blocked; it's useful for
7596
	testing for truth.
7597
	* init/job.h: Add prototype, rename member.
7598
	* init/tests/test_job.c (test_handle_event_finished): Test it.
7599
	(test_new, test_change_state): Update name here too.
7600
	* init/event.c (event_finished): Call job_handle_event_finished
7601
	function to unblock jobs.
7602
	* init/tests/test_event.c (test_poll): Make sure the job gets
7603
	unblocked; a few other tests have to change since running event_poll
7604
	always unblocks the job if nothing listens to it.
7605
541 by Scott James Remnant
* init/job.c (job_child_reaper): Set failed back to FALSE if
7606
	* init/job.c (job_child_reaper): Set failed back to FALSE if
7607
	we're respawning, since we don't want to be failing.
7608
	* init/tests/test_job.c (test_child_reaper): cause will be NULL.
7609
	also free and poll events when done.
7610
	(test_handle_event): pid can never be -1
7611
	(test_change_state): poll events when done
7612
540 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Process will always
7613
	* init/tests/test_job.c (test_child_reaper): Process will always
7614
	be zero on return from reaper.
7615
539 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Killed doesn't go past
7616
	* init/tests/test_job.c (test_child_reaper): Killed doesn't go past
7617
	stopping; it goes to waiting, which will clear the cause.
7618
538 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Fill in values before
7619
	* init/tests/test_job.c (test_child_reaper): Fill in values before
7620
	we test against them.
7621
537 by Scott James Remnant
* init/tests/test_job.c (test_kill_process): Fix violated assertion
7622
	* init/tests/test_job.c (test_kill_process): Fix violated assertion
7623
536 by Scott James Remnant
* init/tests/test_job.c (test_change_state): This should be failed
7624
	* init/tests/test_job.c (test_change_state): This should be failed
7625
	because nothing cleared it.
7626
535 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Fix a couple of array
7627
	* init/tests/test_job.c (test_change_state): Fix a couple of array
7628
	index problems.
7629
534 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Why set that which
7630
	* init/tests/test_job.c (test_change_state): Why set that which
7631
	does not change?
7632
533 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add newline to test.
7633
	* init/tests/test_job.c (test_change_state): Add newline to test.
7634
532 by Scott James Remnant
* init/job.c (job_emit_event): Add the job name as an argument;
7635
	* init/job.c (job_emit_event): Add the job name as an argument;
7636
	oops.
7637
531 by Scott James Remnant
* init/tests/test_control.c (test_job_stop): Need to kill the process
7638
	* init/tests/test_control.c (test_job_stop): Need to kill the process
7639
	ourselves, as we're blocked on an event.
7640
	(test_job_query): Fix wrong value in test.
7641
	(check_job_stopped, test_job_stop, test_unwatch_jobs): Change job
7642
	name to match the test.
7643
530 by Scott James Remnant
* init/job.c (job_change_state): Must only not enter some states
7644
	* init/job.c (job_change_state): Must only not enter some states
7645
	with no process now; others like killed actually usually want one!
7646
529 by Scott James Remnant
* init/tests/test_cfgfile.c (test_read_job): Fix test case.
7647
	* init/tests/test_cfgfile.c (test_read_job): Fix test case.
7648
528 by Scott James Remnant
* init/tests/test_job.c (test_handle_event): Clean up tests.
7649
	* init/tests/test_job.c (test_handle_event): Clean up tests.
7650
	(test_detect_stalled): Clean up.
7651
527 by Scott James Remnant
* init/job.c (job_child_reaper): Update the reaping of the child
7652
	* init/job.c (job_child_reaper): Update the reaping of the child
7653
	processes; there's a much larger state range for the main process
7654
	now, so that needs to be taken into account.
7655
	* init/tests/test_job.c (test_child_reaper): New test cases.
7656
526 by Scott James Remnant
* init/job.c (job_next_state): Encapsulate the slightly odd three
7657
	* init/job.c (job_next_state): Encapsulate the slightly odd three
7658
	exit states of running in this function, otherwise we'll end up
7659
	special-casing it in places I'd rather not think about.
7660
	(job_change_goal): Only change the state of a running job if it
7661
	has a process.
7662
	* init/tests/test_job.c (test_next_state): Add a test case for the
7663
	dead running job
7664
	(test_change_goal): Add test case for the dead running job
7665
525 by Scott James Remnant
* init/tests/test_job.c (test_change_state): Add test cases for
7666
	* init/tests/test_job.c (test_change_state): Add test cases for
7667
	the forgotten stopping to killed transition.
7668
524 by Scott James Remnant
* init/job.c (job_kill_process, job_kill_timer): Just check the pid
7669
	* init/job.c (job_kill_process, job_kill_timer): Just check the pid
7670
	and state, and no longer any need to notify jobs since we're just
7671
	called from one state amongst many.
7672
	(job_change_state): Skip over the killed state if there's no process.
7673
	* init/tests/test_job.c (test_kill_process): Update test cases.
7674
523 by Scott James Remnant
* init/job.c (job_run_process): Simplify a little bit, no need to
7675
	* init/job.c (job_run_process): Simplify a little bit, no need to
7676
	do the state assertions here, just make sure there's no already
7677
	a process running.
7678
	* init/tests/test_job.c (test_run_command, test_run_script): Run
7679
	tests in the spawned state, since that's where we run the primary
7680
	command or script.  Drop check for process state since that's no
7681
	longer set.
7682
522 by Scott James Remnant
* init/job.c (job_change_state, job_next_state): Ok, here's the big
7683
	* init/job.c (job_change_state, job_next_state): Ok, here's the big
7684
	one ... rewrite this to use the new state transitions.  This has
7685
	suddenly got a lot simpler and easier to read, this was definitely a
7686
	good idea.
7687
	(job_emit_event): Function to make emission of events easier.
7688
	(job_failed_event): replaces this one which wasn't so easy.
7689
	* init/tests/test_job.c (test_change_state): I can't say how much I
7690
	wasn't looking forwards to rewriting these test cases; anyway, it's
7691
	done now and I hope they're all right;
7692
	(test_next_state): Make sure the state transitions are correct too.
7693
521 by Scott James Remnant
* init/job.h: Rename is_instance to delete and spawns_instance to
7694
	* init/job.h: Rename is_instance to delete and spawns_instance to
7695
	just instance.
7696
	* init/job.c (job_new): Update.
7697
	* init/tests/test_job.c (test_new): Update.
7698
	* init/cfgfile.c (cfg_stanza_instance): Update.
7699
	* init/tests/test_cfgfile.c (test_stanza_instance): Update.
7700
520 by Scott James Remnant
* init/event.h: Correct the event names.
7701
	* init/event.h: Correct the event names.
7702
519 by Scott James Remnant
* init/job.h: Add blocker event member.
7703
	* init/job.h: Add blocker event member.
7704
	* init/job.c (job_new): Initialise it to NULL.
7705
	* init/tests/test_job.c (test_new): Check it.
7706
518 by Scott James Remnant
* init/job.c (job_change_goal): Have a stab at this function with the
7707
	* init/job.c (job_change_goal): Have a stab at this function with the
7708
	new state machine; it gets somewhat simpler (until we introduce the
7709
	second scripts), now we just induce things by a state change.
7710
	* init/tests/test_job.c (test_change_goal): Made easier (for now)
7711
	because we don't need to deal with processes and can just wait to
7712
	be blocked on an event.
7713
483 by Scott James Remnant
* init/tests/test_process.c: Don't use printf, use TEST_FUNCTION
7714
2007-02-08  Scott James Remnant  <scott@netsplit.com>
7715
517 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Drop check for useless respawn script
7716
	* init/cfgfile.c (cfg_read_job): Drop check for useless respawn script
7717
	(cfg_stanza_respawn): Drop handling of "respawn script"
7718
	* init/tests/test_cfgfile.c (test_stanza_respawn): Drop the checks
7719
	for "respawn script"
7720
516 by Scott James Remnant
* init/job.h: Move things about a bit more; remove respawn_script
7721
	* init/job.h: Move things about a bit more; remove respawn_script
7722
	since that state is going away.
7723
	* init/job.c (job_new): Drop initialisation of process_state.
7724
	* init/tests/test_job.c (test_new): Improve the tests.
7725
515 by Scott James Remnant
* init/main.c (STATE_FD): Remove this define, not used anymore.
7726
	* init/main.c (STATE_FD): Remove this define, not used anymore.
7727
514 by Scott James Remnant
* init/tests/test_event.c (test_poll): Update the event checking
7728
	* init/tests/test_event.c (test_poll): Update the event checking
7729
	to match what's likely to happen.
7730
513 by Scott James Remnant
* init/event.h: Remove commented out bit.
7731
	* init/event.h: Remove commented out bit.
7732
512 by Scott James Remnant
* init/tests/test_notify.c (check_job_status, test_job): Correct
7733
	* init/tests/test_notify.c (check_job_status, test_job): Correct
7734
	state usage to match a possible state.
7735
511 by Scott James Remnant
* init/control.c (control_job_start, control_job_stop)
7736
	* init/control.c (control_job_start, control_job_stop) 
7737
	(control_job_query, control_job_list): Drop process state and
7738
	description from the job status messages we send back.
7739
	* init/tests/test_control.c (test_error_handler) 
7740
	(check_job_started, test_job_start, check_job_stopped) 
7741
	(check_job_stopping, test_job_query, check_job_starting) 
7742
	(test_job_list, test_watch_jobs, test_unwatch_jobs): Remove
7743
	process_state and description, and update usage of job states.
7744
510 by Scott James Remnant
* init/notify.c (notify_job): Don't include process state or
7745
	* init/notify.c (notify_job): Don't include process state or
7746
	description in the job status message anymore.
7747
	* init/tests/test_notify.c (check_job_status, test_job): Update tests
7748
509 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Drop the copying of the process_state
7749
	* init/cfgfile.c (cfg_read_job): Drop the copying of the process_state
7750
	member, since it doesn't exist anymore.
7751
	* init/tests/test_cfgfile.c (test_read_job): Drop the check too.
7752
508 by Scott James Remnant
* init/job.h (Job): Drop the process_state member.
7753
	* init/job.h (Job): Drop the process_state member.
7754
507 by Scott James Remnant
* util/jobs.c (handle_job_status): Drop the process_state and
7755
	* util/jobs.c (handle_job_status): Drop the process_state and
7756
	description arguments; output a process id only if it's greater
7757
	than zero.
7758
	* util/tests/test_jobs.c (test_start_action, test_list_action) 
7759
	(test_jobs_action): Update tests to use newer states and arguments.
7760
	* util/events.c (handle_event_job_status): Simplify in the same way
7761
506 by Scott James Remnant
* upstart/message.h: Remove process_state and description from the
7762
	* upstart/message.h: Remove process_state and description from the
7763
	job status event (we already had the foresight to not put them in
7764
	the event job status event).
7765
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7766
	Update handling of the messages to reduce the arguments.
7767
	* upstart/tests/test_message.c (test_new, my_handler) 
7768
	(test_handle): Update the tests for the new job status message.
7769
505 by Scott James Remnant
* upstart/enum.h (JobState): Change the job states to the new set
7770
	* upstart/enum.h (JobState): Change the job states to the new set
7771
	of states that we've planned.
7772
	(ProcessState): Drop process state entirely; this information is now
7773
	contained in the single JobState field.
7774
	* upstart/enum.c (job_state_name, job_state_from_name): Update
7775
	strings to match the new state names.
7776
	(process_state_name, process_state_from_name): Drop these functions.
7777
	* upstart/tests/test_enum.c (test_state_name) 
7778
	(test_state_from_name): Update test cases to match new names.
7779
	(test_process_state_name, test_process_state_from_name): Drop.
7780
504 by Scott James Remnant
* init/main.c (main): Remove the logd hack for now.
7781
	* init/main.c (main): Remove the logd hack for now.
7782
	* init/job.c (job_new): Change the default console to none for now.
7783
	* init/tests/test_job.c (test_new): Update test.
7784
	* init/cfgfile.c (cfg_stanza_console): Can't guard against duplicates
7785
	for a while.
7786
	* init/tests/test_cfgfile.c (test_stanza_console): Comment out dup test
7787
503 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Remove the restriction that there
7788
	* init/cfgfile.c (cfg_read_job): Remove the restriction that there
7789
	must be either an 'exec' or 'script' for a job; jobs without either
7790
	define states others can use.
7791
	* init/tests/test_cfgfile.c (test_read_job): Convert the test to
7792
	a "must work".
7793
	* init/job.c (job_change_state): Remove restriction that we must
7794
	have either a script or a command; having neither should just wedge
7795
	the job at the running rest state.  Note that there's no way to get
7796
	it out yet, because we don't force that particular state change.
7797
	* init/tests/test_job.c (test_change_state): Make sure that works.
7798
502 by Scott James Remnant
* init/job.c (job_change_cause): Put the knowledge about how to
7799
	* init/job.c (job_change_cause): Put the knowledge about how to
7800
	change the cause into a separate function, since it's slightly
7801
	tricky.
7802
	(job_change_goal, job_change_state): Set the cause using the above
7803
	function.
7804
501 by Scott James Remnant
* init/job.h (Job): Rename goal_event to cause, also shuffle things
7805
	* init/job.h (Job): Rename goal_event to cause, also shuffle things
7806
	around so that the state is mostly together.
7807
	* init/job.c, init/process.c, init/notify.c, init/cfgfile.c: Update
7808
	references (and comments) to match the new name.
7809
	* init/tests/test_job.c, init/tests/test_event.c,
7810
	init/tests/test_process.c, init/tests/test_cfgfile.c,
7811
	init/tests/test_notify.c: Likewise.
7812
500 by Scott James Remnant
* init/job.c (job_child_reaper): Don't change the goal event; the
7813
	* init/job.c (job_child_reaper): Don't change the goal event; the
7814
	state changes will handle this.
7815
	(job_change_goal): Only dereference/reference the goal event if we're
7816
	actually changing it.
7817
	* init/tests/test_job.c (test_change_state, test_child_reaper):
7818
	Update tests to not assume that the goal event gets changed.
7819
	(test_kill_process): Eliminate race condition.
7820
499 by Scott James Remnant
* init/job.c (job_child_reaper): Correct some problems with job and
7821
	* init/job.c (job_child_reaper): Correct some problems with job and
7822
	event failure; we now don't overwrite an existing failure record,
7823
	and don't record failure if the main process failed and the goal was
7824
	stop; since we likely caused it.
7825
	* init/tests/test_job.c (test_child_reaper): More test cases.
7826
498 by Scott James Remnant
* logd/event.d/logd.in: Stop on the new runlevel events, not the
7827
	* logd/event.d/logd.in: Stop on the new runlevel events, not the
7828
	shutdown event.
7829
497 by Scott James Remnant
* compat/sysv/shutdown.c (shutdown_now): Emit an ordinary runlevel
7830
	* compat/sysv/shutdown.c (shutdown_now): Emit an ordinary runlevel
7831
	change event now; including the INIT_HALT environment variable
7832
	* compat/sysv/man/shutdown.8: Update the manual
7833
496 by Scott James Remnant
* compat/sysv/telinit.c: Now just sends out a runlevel event with
7834
	* compat/sysv/telinit.c: Now just sends out a runlevel event with
7835
	an argument giving the new runlevel.
7836
	* compat/sysv/man/telinit.8: Update description of the command.
7837
495 by Scott James Remnant
* upstart/message.h: Remove the UPSTART_SHUTDOWN message.
7838
	* upstart/message.h: Remove the UPSTART_SHUTDOWN message.
7839
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7840
	Remove handling for the shutdown message.
7841
	* upstart/tests/test_message.c (test_new, test_handle): Remove
7842
	tests against the shutdown message.
7843
	* init/control.c (control_shutdown): Remove the shutdown command
7844
	from the server.
7845
	* init/tests/test_control.c (test_shutdown): Remove tests for it.
7846
	* init/event.h: Remove the shutdown event.
7847
	* util/initctl.c: Remove the shutdown command reference.
7848
	* util/events.c (shutdown_action): Remove the command.
7849
	* util/events.h: Update.
7850
	* util/tests/test_events.c (test_shutdown_action): Remove tests.
7851
494 by Scott James Remnant
* init/job.c (job_detect_idle): Rename to job_detect_stalled
7852
	* init/job.c (job_detect_idle): Rename to job_detect_stalled
7853
	(job_detect_stalled): Remove the idle state detection
7854
	(job_set_idle_event): Idle event has been removed.
7855
	* init/job.h: Update.
7856
	* init/tests/test_job.c (test_detect_idle): Rename to
7857
	(test_detect_stalled): and remove idle detection tests.
7858
	* init/main.c (main): Replace job_detect_idle with job_detect_stalled
7859
	* init/control.c (control_shutdown): Don't set the idle event.
7860
	* init/tests/test_control.c (test_shutdown): Don't detect the idle
7861
	event (and thus the second event)
7862
493 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_service): Parser for service stanza.
7863
	* init/cfgfile.c (cfg_stanza_service): Parser for service stanza.
7864
	* init/tests/test_cfgfile.c (test_stanza_service): Test the service
7865
	stanza.
7866
	(test_stanza_respawn): Check that respawn implies service.
7867
	* TODO: Update.
7868
7869
	* init/job.h (Job): Add a new service member.
7870
	* init/job.c (job_new): Service starts off as false.
7871
	(job_change_state): Check service instead of respawn.
7872
	* init/tests/test_job.c (test_change_state): Check with service
7873
	instead of respawn, since that's what we really mean.
7874
492 by Scott James Remnant
* init/cfgfile.c (cfg_read_job): Copy a whole bunch more state
7875
	* init/cfgfile.c (cfg_read_job): Copy a whole bunch more state
7876
	into the newly parsed job.
7877
	* init/job.c (job_run_process): Only output the first error.
7878
	* init/tests/test_cfgfile.c (test_read_job): Make sure important
7879
	things are copied.
7880
	* TODO: Update.
7881
491 by Scott James Remnant
* init/main.c: Restore a much simplified version of the term
7882
	* init/main.c: Restore a much simplified version of the term
7883
	handler that doesn't try and copy across any state.
7884
490 by Scott James Remnant
* compat/sysv/telinit.c: Update call to event_emit; we'll revisit
7885
	* compat/sysv/telinit.c: Update call to event_emit; we'll revisit
7886
	this shortly when we get rid of the shutdown event.
7887
489 by Scott James Remnant
* util/events.c (handle_event): Add new id field (but ignore it)
7888
	* util/events.c (handle_event): Add new id field (but ignore it)
7889
	Functio
7890
	(handle_event_job_status): New function to handle the new event.
7891
	(handle_event_finished): Function to handle the end of the event.
7892
	(emit_action): Send the newer event, and loop over replies until
7893
	we get a finished one.
7894
	* util/tests/test_events.c (test_emit_action): Update tests cases.
7895
488 by Scott James Remnant
* init/control.c (control_event_emit): New function to handle the
7896
	* init/control.c (control_event_emit): New function to handle the
7897
	new-style emit message.
7898
	* init/tests/test_control.c (test_event_emit): Make sure the new
7899
	message function behaves.
7900
487 by Scott James Remnant
* init/event.c, init/job.c, init/main.c, init/tests/test_event.c,
7901
	* init/event.c, init/job.c, init/main.c, init/tests/test_event.c,
7902
	init/tests/test_job.c: Completely drop the serialisation code, it's
7903
	getting out of date and in the way.
7904
486 by Scott James Remnant
* init/event.h: Remove compatibility macros.
7905
	* init/event.h: Remove compatibility macros.
7906
	(EventEmission): Drop the callback function; it was too error prone
7907
	to try and do it this way, and we only ever wanted to release a job
7908
	anyway as control requests are better handled through the notify
7909
	interface.
7910
	(EventEmissionCb): Drop unused typedef.
7911
	* init/event.c (event_emit): Drop callback argument.
7912
	(event_finished): Don't call the callback
7913
	* init/tests/test_event.c: Update to avoid callbacks.
7914
	* init/job.c (job_change_state): Convert to using event_emit and
7915
	EventEmission.
7916
	(job_detect_idle): Drop extra arguments to event_emit.
7917
	* init/main.c (main, cad_handler, kbd_handler): Drop extra arguments
7918
	to event_emit.
7919
	* init/control.c (control_shutdown): Use event_emit instead of
7920
	event_queue.
7921
	* init/tests/test_control.c (test_shutdown): Convert to using
7922
	EventEmission.
7923
	(test_watch_events, test_unwatch_events): Drop extra arguments to
7924
	event_emit.
7925
	* init/tests/test_notify.c (test_subscribe_event, test_job) 
7926
	(test_event, test_event_finished): Drop extra arguments to event_emit
7927
	* init/tests/test_job.c (test_change_goal, test_change_state) 
7928
	(test_run_script, test_child_reaper, test_detect_idle): Drop
7929
	extra arguments to event_emit.
7930
	* init/tests/test_process.c (test_spawn): Drop extra arguments to
7931
	event_emit.
7932
485 by Scott James Remnant
* TODO: Update.
7933
	* TODO: Update.
7934
484 by Scott James Remnant
Rewrite the notification subsystem quite significantly; now we
7935
	Rewrite the notification subsystem quite significantly; now we
7936
	have individual functions to subscribe to different types of
7937
	notification, and can even subscribe to individual jobs or events.
7938
7939
	* init/notify.c (notify_subscribe_job, notify_subscribe_event) 
7940
	(notify_unsubscribe): New subscription and unsubscription functions
7941
	that assume one record per subscription, not process.
7942
	(notify_subscription_find): Function to find a subscription.
7943
	(notify_job): Send a message to anything subscribed to the goal event
7944
	as well.
7945
	(notify_event): Use EventEmission and include the id in the event.
7946
	(notify_event_finished): New function, sends a finished message and
7947
	includes both the id and whether the event failed.
7948
	* init/notify.h (NotifySubscribe): New notify structure that is
7949
	once per subscription, rather than per-process; and allows
7950
	subscription to individual jobs or events.
7951
	* init/tests/test_notify.c (test_subscribe_job) 
7952
	(test_subscribe_event, test_unsubscribe): Test the new subscription
7953
	functions, replacing the old
7954
	(test_subscribe): tests.
7955
	(test_subscription_find): Check finding works
7956
	(check_event, test_event): Update to use emissions, and check that the
7957
	id is correct.
7958
	(test_event_finished): Check this one works too
7959
	(check_event_job_status, test_job): Make sure processes subscribed
7960
	via the goal event are notified too.
7961
	* init/event.c (event_pending): Pass the emission directly.
7962
	(event_finished): Notify subscribers that the event has finished.
7963
	* init/control.c (control_error_handler): Call notify_unsubscribe
7964
	(control_watch_jobs, control_unwatch_jobs, control_watch_events) 
7965
	(control_unwatch_events): Update to the new subscription API.
7966
	* init/tests/test_control.c (test_error_handler): Use new API
7967
	(test_watch_jobs, test_unwatch_jobs, test_watch_events)
7968
	(test_unwatch_events): Also update these to the new API; use a
7969
	destructor to make sure the subscription is freed.
7970
483 by Scott James Remnant
* init/tests/test_process.c: Don't use printf, use TEST_FUNCTION
7971
	* init/tests/test_process.c: Don't use printf, use TEST_FUNCTION
7972
457 by Scott James Remnant
* init/job.c (job_failed_event): Function to turn an event into one
7973
2007-02-07  Scott James Remnant  <scott@netsplit.com>
7974
482 by Scott James Remnant
* upstart/message.h: Allocate new grouped event messages.
7975
	* upstart/message.h: Allocate new grouped event messages.
7976
	* upstart/message.c (upstart_message_new, upstart_message_handle):
7977
	Add support for the new grouped event messages.
7978
	* upstart/tests/test_message.c (test_new, test_handle) 
7979
	(my_handler): Make sure the new messages are passed correctly.
7980
481 by Scott James Remnant
* init/job.c (job_change_state): Clear the goal event whenever we
7981
	* init/job.c (job_change_state): Clear the goal event whenever we
7982
	reach the final rest state of a job (waiting for all jobs, running
7983
	for services).
7984
	* init/tests/test_job.c (test_change_state): Check that the goal
7985
	event goes away at the right times.
7986
	* TODO: Update.
7987
480 by Scott James Remnant
* init/tests/test_job.c (test_child_reaper): Make sure that the
7988
	* init/tests/test_job.c (test_child_reaper): Make sure that the
7989
	event is marked failed properly
7990
479 by Scott James Remnant
* init/job.c (job_start_event, job_stop_event): There's no reason
7991
	* init/job.c (job_start_event, job_stop_event): There's no reason
7992
	for these to exist as seperate functions anymore, especially since
7993
	we want to eventually have some kind of match table.
7994
	(job_handle_event): Perform the iterations and match calls here
7995
	instead, since we just call job_change_goal now.
7996
	* init/job.h: Remove prototypes.
7997
	* init/tests/test_job.c (test_start_event, test_stop_event): Fold into
7998
	(test_handle_event): which now handles all the cases.
7999
478 by Scott James Remnant
* init/job.c (job_detect_idle): Call event_emit
8000
	* init/job.c (job_detect_idle): Call event_emit
8001
	* init/main.c (main, cad_handler, kbd_handler): Call event_emit
8002
	instead of event_queue.
8003
	* init/tests/test_event.c (test_new): Call event_poll
8004
	* init/tests/test_job.c (test_change_state, test_child_reaper) 
8005
	(test_detect_idle, test_change_state): Update to use newer event API.
8006
	* TODO: Update.
8007
477 by Scott James Remnant
* init/job.c (job_start, job_stop): Drop these functions; call
8008
	* init/job.c (job_start, job_stop): Drop these functions; call
8009
	job_change_goal instead (which is now public).
8010
	(job_change_state, job_child_reaper): Call job_change_goal instead.
8011
	* init/job.h: Update.
8012
	* init/tests/test_job.c (test_start, test_stop): Merge into new
8013
	(test_change_goal): function.
8014
	* init/main.c (main): Call job_change_goal instead of job_start.
8015
	* init/control.c (control_job_start, control_job_stop): Call
8016
	job_change_goal instead.
8017
476 by Scott James Remnant
* init/tests/test_job.c (test_new, test_change_state)
8018
	* init/tests/test_job.c (test_new, test_change_state) 
477 by Scott James Remnant
* init/job.c (job_start, job_stop): Drop these functions; call
8019
	(test_run_script, test_start, test_stop, test_start_event): 
476 by Scott James Remnant
* init/tests/test_job.c (test_new, test_change_state)
8020
8021
	* init/job.h (Job): goal_event is now an EventEmission, and is
8022
	a direct pointer to the one in the events queue, rather than a copy.
8023
	* init/process.c (process_setup_environment): Reference the event
8024
	name and environment through the goal event, not directly.
8025
	* init/job.c (job_run_script): Reference the event name and
8026
	environment through the goal event, not directly.
8027
	(job_change_state, job_child_reaper): Replace direct setting of the
8028
	job goal with a call to job_stop; the process state is always
8029
	PROCESS_NONE in all three cases, so this is completely safe.
8030
	(_job_start, _job_stop): Merge these two functions together into
8031
	(job_change_goal): which behaves a lot more like job_change_state,
8032
	except that it doesn't loop.  This handles the changing of the
8033
	emission.
8034
	(job_start, job_start_event, job_stop, job_stop_event): Simplify
8035
	these functions, now they just call job_change_goal passing in
8036
	the emission pointer (or NULL).
8037
475 by Scott James Remnant
* init/main.c, init/job.c, init/job.h, init/event.c, init/event.h,
8038
	* init/main.c, init/job.c, init/job.h, init/event.c, init/event.h,
8039
	init/tests/test_job.c, init/tests/test_event.c: Remove state
8040
	serialisation code for the time being; maintaining it is getting
8041
	increasingly harder, and it introduces some major bugs.  It will
8042
	get rewritten shortly.
8043
474 by Scott James Remnant
* init/event.c (event_pending): Pass the emission directly to
8044
	* init/event.c (event_pending): Pass the emission directly to
8045
	job_handle_event now.
8046
	* init/job.c (job_handle_event, job_start_event, job_stop_event):
8047
	Deal with event emissions rather than just plain events, the change
8048
	so far doesn't do anything else other than take the structure change.
8049
	* init/job.h: Change prototypes.
8050
	* init/tests/test_job.c (test_start_event, test_stop_event)
8051
	(test_handle_event): Update tests to use emissions.
8052
473 by Scott James Remnant
* init/tests/test_event.c (test_read_state, test_write_state): Check
8053
	* init/tests/test_event.c (test_read_state, test_write_state): Check
8054
	the passing of the progress information.
8055
	* init/event.c (event_read_state, event_write_state): Add progress
8056
	field to the serialisation (oops).
8057
472 by Scott James Remnant
* init/event.h: Add missing attribute for event_read_state.
8058
	* init/event.h: Add missing attribute for event_read_state.
8059
	* init/cfgfile.h: Add missing attributes.
8060
	* init/main.c (read_state): Don't discard return value.
8061
	* TODO: Update.
8062
471 by Scott James Remnant
* init/main.c (read_state): Handle the Emission keyword; also handle
8063
	* init/main.c (read_state): Handle the Emission keyword; also handle
8064
	Event really being an EventEmission.
8065
	* init/event.c (event_emit): Make the next emission id a static global
8066
	(event_read_state, event_write_state): Serialise event emission
8067
	structures, not plain events; also send over the last id we used so
8068
	it appears seamless.  This doesn't yet handle the callback/data bit
8069
	of the serialisation, which turns out to be a little tricky ... oops
8070
	* init/event.h: Update.
8071
	* init/tests/test_event.c (test_read_state, test_write_state): Check
8072
	that serialisation is done with EventEmissions instead, and all the
8073
	fields are passed (except callback and data which are ... tricky).
8074
470 by Scott James Remnant
* init/main.c (main): Call event_poll instead of event_queue_run.
8075
	* init/main.c (main): Call event_poll instead of event_queue_run.
8076
469 by Scott James Remnant
* init/event.c (event_poll): Add the new function that replaces
8077
	* init/event.c (event_poll): Add the new function that replaces
8078
	event_queue_run(); handles the new-style event emission structures
8079
	in the list and only returns when there are no non-handling events.
8080
	(event_pending, event_finished): Handling of particular event states
8081
	during poll; split out for readability.
8082
	(event_queue, event_queue_run): Drop these obsolete functions.
8083
	(event_read_state): Force type from event_queue.
8084
	* init/event.h: Add event_poll prototype; remove prototypes of old
8085
	functions, replacing with #defines for now so things still compile.
8086
	* init/tests/test_event.c (test_queue): Drop tests.
8087
	(test_read_state, test_write_state): Force type from event_queue
8088
	Change type we check size of.
8089
	(test_poll): Pretty thoroughly test the new poll function.
8090
	* init/job.c (job_change_state): Force type from event_queue
8091
	* init/control.c (control_event_queue): Force type from event queue
8092
	* init/tests/test_job.c (test_detect_idle): Force type from event_queue
8093
	* init/tests/test_control.c (test_event_queue, test_shutdown):
8094
	Force type from event_queue
8095
468 by Scott James Remnant
* init/event.c: Revert to a single list of events with an enum
8096
	* init/event.c: Revert to a single list of events with an enum
8097
	(event_emit): Set the progress to pending initially.
8098
	(event_emit_find_by_id): Simplify now it just checks one list
8099
	(event_emit_finished): Function for jobs to call once they've done
8100
	with an event; just sets the progress to finished for the event
8101
	queue to pick up.
8102
	* init/tests/test_event.c (test_emit_finished): Check it.
8103
8104
	* init/event.h: Add prototype.
8105
	(EventProgress): Add new enum	
8106
	(EventEmission): And add progress member to this structure
8107
	* init/tests/test_event.c (test_emit): Make sure the event is pending
8108
467 by Scott James Remnant
* init/event.c (event_emit_find_by_id): Locate an event emission
8109
	* init/event.c (event_emit_find_by_id): Locate an event emission
8110
	by its id in either the pending or handling queue.
8111
	* init/event.h: Add prototype
8112
	* init/tests/test_event.c (test_emit): Make sure that the emission
8113
	id is unique each time.
8114
	(test_emit_find_by_id): Test the function.
8115
466 by Scott James Remnant
* init/event.c (event_emit): New function to replace event_queue();
8116
	* init/event.c (event_emit): New function to replace event_queue();
8117
	returns an EventEmission structure with the details filled in as
8118
	given.
8119
	* init/event.h: Add prototype.
8120
465 by Scott James Remnant
* init/event.c (event_init): Rename the single events queue to
8121
	* init/event.c (event_init): Rename the single events queue to
8122
	pending and add a new handling list.
8123
8124
	* init/event.h (EventEmission, EventEmissionCb): Add a new emission
8125
	structure that wraps an event, for use in the queue.
8126
464 by Scott James Remnant
* util/tests/test_events.c (test_events_action): Update test now
8127
	* util/tests/test_events.c (test_events_action): Update test now
8128
	that nih_message is more sensible.
8129
	* util/tests/test_jobs.c (test_start_action, test_list_action) 
8130
	(test_jobs_action): Update test
8131
463 by Scott James Remnant
* util/events.c (emit_action): Actually pass the emit_env array
8132
	* util/events.c (emit_action): Actually pass the emit_env array
8133
	* util/tests/test_events.c (test_emit_action): Make sure it does.
8134
8135
	* util/initctl.c (main): Catch nih_command_parser() returning a
8136
	negative value to indicate an internal error, and always exit 1.
8137
462 by Scott James Remnant
* util/events.c (handle_event): Build up multiple lines to describe
8138
	* util/events.c (handle_event): Build up multiple lines to describe
8139
	the event, including its arguments and environment.
8140
	* util/tests/test_events.c (test_events_action): Check the new output
8141
	format is right.
8142
461 by Scott James Remnant
* init/main.c (main): Take out inadvertantly leaked debugging code;
8143
	* init/main.c (main): Take out inadvertantly leaked debugging code;
8144
	sorry about that.
8145
460 by Scott James Remnant
* init/job.c (job_child_reaper): Rewrite this to make the logic a
8146
	* init/job.c (job_child_reaper): Rewrite this to make the logic a
8147
	little easier to follow, and support signals in normalexit.  This
8148
	also now applies to deciding whether the job failed, if it did, we
8149
	store that information in the job so the stop and stopped events
8150
	can get it.
8151
	* init/tests/test_job.c (test_child_reaper): Add new test cases for
8152
	the setting of the failed flags.
8153
459 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_normalexit): Allow signal names in the
8154
	* init/cfgfile.c (cfg_stanza_normalexit): Allow signal names in the
8155
	arguments, which are added to the normalexit array or'd with 0x80
8156
	* init/tests/test_cfgfile.c (test_stanza_normalexit): Check that we
8157
	can now parse signal names correctly.
8158
458 by Scott James Remnant
* init/job.c (job_failed_event): Change add to addp to fix leak.
8159
	* init/job.c (job_failed_event): Change add to addp to fix leak.
8160
457 by Scott James Remnant
* init/job.c (job_failed_event): Function to turn an event into one
8161
	* init/job.c (job_failed_event): Function to turn an event into one
8162
	that includes all the necessary arguments and environment.
8163
	(job_change_state): Call job_failed_event for the stop and stopped
8164
	events (bit hacky at the moment, will improve later).
8165
	* init/tests/test_job.c (test_change_state): Check that the failed
8166
	events are generated properly.
8167
409 by Scott James Remnant
* init/job.h (Job): Add a new goal_event member
8168
2007-02-06  Scott James Remnant  <scott@netsplit.com>
8169
456 by Scott James Remnant
* init/job.c (job_change_state): Reset the failed member when
8170
	* init/job.c (job_change_state): Reset the failed member when
8171
	we enter the starting state.
8172
	* init/tests/test_job.c (test_change_state): Make sure that the
8173
	failed member is reset when we enter the starting state.
8174
455 by Scott James Remnant
* init/job.h (Job): Add failed, failed_state and exit_status members.
8175
	* init/job.h (Job): Add failed, failed_state and exit_status members.
8176
	* init/job.c (job_new): Initialise new members.
8177
454 by Scott James Remnant
* init/job.c (job_child_reaper): Convert signals to names when
8178
	* init/job.c (job_child_reaper): Convert signals to names when
8179
	outputting status messages.
8180
	* init/tests/test_job.c (test_child_reaper): Check that the signal
8181
	name gets converted over.
8182
453 by Scott James Remnant
* init/event.h (CTRLALTDEL_EVENT): Now we've broken the shared
8183
	* init/event.h (CTRLALTDEL_EVENT): Now we've broken the shared
8184
	namespace of events and jobs, rename the control-alt-delete event
8185
	back to control-alt-delete.
8186
452 by Scott James Remnant
* init/job.c (job_change_state): Replace the events generated as
8187
	* init/job.c (job_change_state): Replace the events generated as
8188
	part of the job state, named for the job and state, with new state
8189
	events that have the job name as an argument.
8190
	* init/event.h: Define new job event names.
8191
	* init/tests/test_job.c (test_change_state): Make sure the new
8192
	events are correct, with the job name as an argument.
8193
451 by Scott James Remnant
* init/job.c (job_change_state): Remove the job event; this has
8194
	* init/job.c (job_change_state): Remove the job event; this has
8195
	been repeatedly proved to be confusing.
8196
	* init/tests/test_job.c (test_change_state): Remove checks for the
8197
	job event.
8198
450 by Scott James Remnant
* util/events.c (emit_action): Pass in extra arguments.
8199
	* util/events.c (emit_action): Pass in extra arguments.
8200
	(env_option): Function to parse an option given an environment
8201
	variable.
8202
	* util/events.h: Add prototype.
8203
	* util/tests/test_events.c (test_emit_action): Make sure that the
8204
	emit action works with no arguments and with arguments.
8205
	(test_events_action): Send back events with the right number of args.
8206
	(test_env_option): Check the env option parser works.
8207
	* util/initctl.c: Give shutdown its own command and options, give
8208
	emit a new -e option.
449 by Scott James Remnant
* util/initctl.c: Give shutdown its own command and options.
8209
448 by Scott James Remnant
* util/events.c (shutdown_action): Split out from emit, seeing as
8210
	* util/events.c (shutdown_action): Split out from emit, seeing as
8211
	these are going to be different from now on.
8212
	* util/events.h: Add prototype.
8213
	* util/tests/test_events.c (test_shutdown_action): Copy test cases.
8214
447 by Scott James Remnant
* init/control.c (control_event_queue): Take the arguments and
8215
	* init/control.c (control_event_queue): Take the arguments and
8216
	environment from the event queue request; and reparent into the
8217
	event.
8218
	* init/tests/test_control.c (test_event_queue): Check that arguments
8219
	and environment are copied across properly.
8220
446 by Scott James Remnant
* init/notify.c (notify_event): Pass in the arguments and environment
8221
	* init/notify.c (notify_event): Pass in the arguments and environment
8222
	for the event.
8223
	* init/tests/test_notify.c (check_event): Check for event arguments
8224
	and environment from the notify process.
8225
	(test_event): Add arguments and environment to the event we test with
8226
445 by Scott James Remnant
* upstart/tests/test_message.c (test_new, test_handle): Send
8227
	* upstart/tests/test_message.c (test_new, test_handle): Send
8228
	arguments and environment with the UPSTART_EVENT_QUEUE and
8229
	UPSTART_EVENT messages.
8230
	* upstart/wire.c (upstart_pop_int, upstart_pop_unsigned): Shrink
8231
	only once.
8232
	(upstart_pop_string): Check the length is at least one first, as
8233
	we may just have an 'S'.
8234
8235
	* upstart/message.c (upstart_message_new, upstart_message_handle):
8236
	The UPSTART_EVENT and UPSTART_EVENT_QUEUE messages gain new array
8237
	arguments containing the arguments and environment for the event.
8238
	* upstart/message.h: Document the new arguments.
8239
444 by Scott James Remnant
* util/tests/test_events.c, util/tests/test_jobs.c: Update the
8240
	* util/tests/test_events.c, util/tests/test_jobs.c: Update the
8241
	message format checks here too.
8242
443 by Scott James Remnant
* upstart/tests/test_wire.c (test_pop_pack): Free the array.
8243
	* upstart/tests/test_wire.c (test_pop_pack): Free the array.
8244
442 by Scott James Remnant
* upstart/tests/test_message.c (test_new, test_handle)
8245
	* upstart/tests/test_message.c (test_new, test_handle)
8246
	(test_handle_using, test_reader): Update tests to include and
8247
	expect new type markers between each field.
8248
441 by Scott James Remnant
* upstart/wire.c (upstart_push_int, upstart_push_unsigned):
8249
	* upstart/wire.c (upstart_push_int, upstart_push_unsigned):
8250
	Take out silly asserts; it must have room!
8251
440 by Scott James Remnant
* upstart/wire.c (upstart_push_string, upstart_pop_string): Rewrite
8252
	* upstart/wire.c (upstart_push_string, upstart_pop_string): Rewrite
8253
	to use a type like the rest of the functions; this removes the strange
8254
	length restriction and allows us to make the pop function
8255
	non-destructive.
8256
	* upstart/tests/test_wire.c (test_push_string): Update.
8257
	(test_pop_string): Update, adding in non-destructive, wrong type
8258
	and insufficient space for type test cases.
8259
	(test_push_array, test_pop_array): These needed updated too,
8260
	changing the string format changed the array format.
8261
	(test_push_pack, test_pop_pack): And obviously the pack format changed.
8262
439 by Scott James Remnant
* upstart/wire.c (upstart_pop_header): Make the function
8263
	* upstart/wire.c (upstart_pop_header): Make the function
8264
	non-destructive in the face of errors.
8265
	* upstart/tests/test_wire.c (test_pop_header): Make sure that
8266
	invalid headers are non-destructive on error.
8267
438 by Scott James Remnant
* upstart/tests/test_wire.c (test_pop_int, test_pop_unsigned):
8268
	* upstart/tests/test_wire.c (test_pop_int, test_pop_unsigned):
8269
	Make sure that insufficient space is non-destructive.
8270
437 by Scott James Remnant
* upstart/wire.c (upstart_push_int, upstart_pop_int)
8271
	* upstart/wire.c (upstart_push_int, upstart_pop_int) 
8272
	(upstart_push_unsigned, upstart_pop_unsigned): Convert to array-style
8273
	type first format.
8274
	(upstart_push_string, upstart_push_header): Write the length and
8275
	type fields out by hand so they don't get an 'i' prefix.
8276
	(upstart_pop_string, upstart_pop_header): Read the length and type
8277
	fields by hand so they don't get an 'i' prefix.
8278
	* upstart/tests/test_wire.c (test_push_int, test_pop_int) 
8279
	(test_push_unsigned, test_pop_unsigned): Update test cases to match.
8280
	(test_push_pack, test_pop_pack): Pack format was changed too.
8281
436 by Scott James Remnant
* upstart/wire.c (upstart_push_packv, upstart_pop_packv): Add calls
8282
	* upstart/wire.c (upstart_push_packv, upstart_pop_packv): Add calls
8283
	to push and pop array.
8284
	* upstart/tests/test_wire.c (test_push_pack, test_pop_pack): Test
8285
	support for arrays.
8286
435 by Scott James Remnant
* upstart/wire.c (upstart_push_array, upstart_pop_array): Implement
8287
	* upstart/wire.c (upstart_push_array, upstart_pop_array): Implement
8288
	new array functions; note that these use a newer format that allows
8289
	us to transmit NULL without needing to limit the size of the array.
8290
	* upstart/wire.h: Add prototypes.
8291
	* upstart/tests/test_wire.c (test_push_array, test_pop_array):
8292
	Test the new array functions.
8293
434 by Scott James Remnant
* init/job.c (job_run_script): Build up the argument list, appending
8294
	* init/job.c (job_run_script): Build up the argument list, appending
8295
	those from the goal event if one is set.
8296
	(job_run_command): Use nih_str_array_add to build up the arguments,
8297
	but don't append those from the goal event (use script).
8298
	* init/tests/test_job.c (test_run_script): Make sure the arguments get
8299
	passed to the running shell scripts.
8300
433 by Scott James Remnant
* init/job.c (job_run_script): Only use the /dev/fd trick if we can
8301
	* init/job.c (job_run_script): Only use the /dev/fd trick if we can
8302
	actually stat /dev/fd; also don't hardcode that path ...
8303
	* init/paths.h (DEV_FD): Add here.
8304
432 by Scott James Remnant
* init/process.c (process_setup_environment): Copy environment
8305
	* init/process.c (process_setup_environment): Copy environment
8306
	variables from the goal event into the job's process.
8307
	* init/tests/test_process.c (test_spawn): Make sure the environment
8308
	reaches the job, but doesn't override that in the job already.
8309
8310
	* init/tests/test_job.c (test_start_event): 
8311
431 by Scott James Remnant
* init/job.c (job_start_event, job_stop_event): Copy the arguments
8312
	* init/job.c (job_start_event, job_stop_event): Copy the arguments
8313
	and environment from the event into the goal event.
8314
430 by Scott James Remnant
* init/job.c (job_read_state, job_write_state): Read and write
8315
	* init/job.c (job_read_state, job_write_state): Read and write
8316
	arguments and environment for goal event.
8317
	* init/tests/test_job.c (test_read_state, test_write_state): Test
8318
	with arguments and environment to the goal event.
8319
429 by Scott James Remnant
* init/event.c (event_read_state, event_write_state): Read and write
8320
	* init/event.c (event_read_state, event_write_state): Read and write
8321
	the arguments and environment of the event.
8322
	* init/tests/test_event.c (test_read_state, test_write_state): Make
8323
	sure arguments and environment are correctly serialised.
8324
428 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_console): Fix a leak of the console
8325
	* init/cfgfile.c (cfg_stanza_console): Fix a leak of the console
8326
	argument in the case of duplicated options.
8327
	(cfg_stanza_env): Drop the counting now nih_str_array_addp does it;
8328
	and be sure to use that function.
8329
	(cfg_stanza_umask): Fix leak of umask argument
8330
	(cfg_stanza_nice): Fix leak of nice argument
8331
	* init/tests/test_event.c (test_new): Call event_queue_run so init
8332
	is called outside of a TEST_ALLOC_FAIL block.
8333
427 by Scott James Remnant
* init/event.c (event_new): Start off with NULL args and env, to
8334
	* init/event.c (event_new): Start off with NULL args and env, to
8335
	match job (saves a few bytes).
8336
	(event_match): Watch for NULL arguments!
8337
	* init/tests/test_event.c (test_new): Check for NULL not alloc'd
8338
426 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_on, cfg_stanza_start)
8339
	* init/cfgfile.c (cfg_stanza_on, cfg_stanza_start) 
8340
	(cfg_stanza_stop): Parse arguments to the on stanza and store them
8341
	directly in the event.
8342
	* init/tests/test_cfgfile.c (test_stanza_on, test_stanza_start) 
8343
	(test_stanza_stop): Make sure arguments are parsed into the event.
8344
425 by Scott James Remnant
* init/event.c (event_new): Use nih_str_array_new.
8345
	* init/event.c (event_new): Use nih_str_array_new.
8346
	* init/cfgfile.c (cfg_stanza_env): Rewrite to use nih_str_array.
8347
424 by Scott James Remnant
* init/job.c (job_run_script): Check the error returned from
8348
	* init/job.c (job_run_script): Check the error returned from
8349
	nih_io_reopen; don't just loop.  We only ever expect ENOMEM (the
8350
	other error, EBADF, is impossible).
8351
423 by Scott James Remnant
* init/job.c (job_change_state): Reset the goal_event to NULL when
8352
	* init/job.c (job_change_state): Reset the goal_event to NULL when
8353
	we catch a run-away job (as it's not stopping for the same event
8354
	it started with).
8355
	(job_child_reaper): Reset the goal_event to NULL after setting the
8356
	goal to STOP.
8357
	* init/tests/test_job.c (test_change_state, test_child_reaper):
8358
	Check that the goal event gets reset whenever the goal gets changed.
8359
422 by Scott James Remnant
* init/tests/test_event.c: Use TEST_ALLOC_FAIL
8360
	* init/tests/test_event.c: Use TEST_ALLOC_FAIL
8361
421 by Scott James Remnant
* init/event.c (event_match): Match arguments using fnmatch() and
8362
	* init/event.c (event_match): Match arguments using fnmatch() and
8363
	allow more arguments in event1 than event2 (but not the other way
8364
	around).
8365
	* init/tests/test_event.c (test_match): Check the new permitted
8366
	combinations.
8367
420 by Scott James Remnant
* init/event.h (Event): Add args and env members to Event.
8368
	* init/event.h (Event): Add args and env members to Event.
8369
	* init/event.c (event_new): Initialise args and env members to
8370
	zero-length arrays.
8371
	* init/tests/test_event.c (test_new): Use TEST_ALLOC_FAIL and
8372
	make sure args and env are both initialised to a list containing
8373
	just NULL.
8374
419 by Scott James Remnant
* util/jobs.c (start_action): Get the UPSTART_JOB environment variable
8375
	* util/jobs.c (start_action): Get the UPSTART_JOB environment variable
8376
	and use that if we don't have any arguments passed to us.
8377
	(do_job): Code split from the above function that handles a named job
8378
	* util/tests/test_jobs.c (test_start_action): Make sure UPSTART_JOB
8379
	is picked up.
8380
417 by Scott James Remnant
* init/process.h: Add necessary attributes.
8381
	* init/process.h: Add necessary attributes.
8382
416 by Scott James Remnant
* init/process.c (process_setup_environment): Set the UPSTART_JOB
8383
	* init/process.c (process_setup_environment): Set the UPSTART_JOB
8384
	environment variable from the job, and the UPSTART_EVENT environment
8385
	variable from the job's goal_event member (if set).
8386
	* init/tests/test_process.c (test_spawn): Make sure we get the
8387
	environment in the job.
8388
415 by Scott James Remnant
* init/job.h: Add attributes to job_new and job_read_state.
8389
	* init/job.h: Add attributes to job_new and job_read_state.
8390
	* init/tests/test_job.c: Use CHECK_ALLOC_FAIL on the functions we
8391
	didn't get around to touching while we were in here.
8392
414 by Scott James Remnant
* init/job.c (job_start_event, job_stop_event): Set the goal_event
8393
	* init/job.c (job_start_event, job_stop_event): Set the goal_event
8394
	member to a copy of the event we found.
8395
	(job_read_state): Use event_new instead of trying to do it by hand.
8396
	* init/tests/test_job.c (test_start_event, test_stop_event): Use 
8397
	CHECK_ALLOC_FAIL; and make sure the goal_event is set properly.
8398
	(test_start, test_stop, test_write_new): Use event_new here too
8399
413 by Scott James Remnant
* init/job.c (job_write_state): Output a goal_event field containing
8400
	* init/job.c (job_write_state): Output a goal_event field containing
8401
	the event name or nothing for NULL.
8402
	(job_read_state): Parse the goal_event field
8403
	* init/tests/test_job.c (test_write_state): Make sure the state is
8404
	written out properly.
8405
	(test_read_state): Make sure that the state is parsed correctly too.
8406
412 by Scott James Remnant
* init/job.c (job_start, job_stop): Split all of the code except
8407
	* init/job.c (job_start, job_stop): Split all of the code except
8408
	the goal_event setting into two new static functions that this calls
8409
	(_job_start, _job_stop): New static functions
8410
	(job_start_event, job_stop_event): Call _job_start and _job_stop
8411
	instead of job_start and job_stop
8412
411 by Scott James Remnant
* init/job.c (job_catch_runaway): Move this function up a bit.
8413
	* init/job.c (job_catch_runaway): Move this function up a bit.
8414
410 by Scott James Remnant
* init/job.c (job_start, job_stop): Clear the goal_event member,
8415
	* init/job.c (job_start, job_stop): Clear the goal_event member,
8416
	these functions are called for a manual start.
8417
	* init/tests/test_job.c (test_start, test_stop): Make sure the
8418
	goal_event member is freed and set to NULL.
8419
409 by Scott James Remnant
* init/job.h (Job): Add a new goal_event member
8420
	* init/job.h (Job): Add a new goal_event member
8421
	* init/job.c (job_new): Initialise the goal_event member to NULL.
8422
	* init/tests/test_job.c (test_new): Check with TEST_ALLOC_FAIL;
8423
	also make sure goal_event is initialised to NULL.
8424
405 by Scott James Remnant
* init/process.c (process_spawn): Exit with 255 so we don't clash
8425
2007-02-05  Scott James Remnant  <scott@netsplit.com>
8426
408 by Scott James Remnant
* configure.ac: Bump version to 0.3.3
8427
	* configure.ac: Bump version to 0.3.3
8428
407 by Scott James Remnant
0.3.2 release.
8429
	* NEWS: Update.
8430
405 by Scott James Remnant
* init/process.c (process_spawn): Exit with 255 so we don't clash
8431
	* init/process.c (process_spawn): Exit with 255 so we don't clash
8432
	with anything that uses 1 as a normal exit code.  Note why we only
8433
	close 0..2 (everything else is FD_CLOEXEC).
8434
	* init/cfgfile.c (cfg_watch_dir): Mark the inotify watch descriptor
8435
	as FD_CLOEXEC.
8436
	* init/control.c (control_open): nih_io_set_cloexec can only ever
8437
	return EINVAL, so no point checking it.
8438
404 by Scott James Remnant
* init/tests/test_control.c: Remove strange old code.
8439
2007-02-04  Scott James Remnant  <scott@netsplit.com>
8440
8441
	* init/tests/test_control.c: Remove strange old code.
8442
389 by Scott James Remnant
* upstart/job.c, upstart/job.h, upstart/tests/test_job.c: Rename to
8443
2007-02-03  Scott James Remnant  <scott@netsplit.com>
8444
403 by Scott James Remnant
* init/control.c (control_open_sock, control_reopen)
8445
	* init/control.c (control_open_sock, control_reopen)
8446
	(control_close_handler): Drop these functions; unconnected datagram
8447
	sockets don't close -- so why try dealing with it?
8448
	(control_error_handler): Don't reopen the socket on error, just log
8449
	it -- the socket should be fine, there's no remote end to be lost,
8450
	after all.
8451
	* init/tests/test_control.c (test_close_handler): Drop.
8452
	(test_error_handler): Drop the reopen tests.
8453
402 by Scott James Remnant
* init/tests/test_job.c (test_run_script): Control socket doesn't
8454
	* init/tests/test_job.c (test_run_script): Control socket doesn't
8455
	get unexpectedly opened anymore; so no need to close it.
8456
8457
	* init/control.c (control_open): Remove the strange behaviour that
8458
	this can be called to get the socket.  Instead make control_io
8459
	global; we're all adults after all.
8460
	* init/tests/test_control.c (test_open): Remove the test for the
8461
	silly behaviour.
8462
	* init/notify.c (notify_job, notify_event): Use the control_io
8463
	pointer directly, and just do nothing if we lost it somehow.
8464
401 by Scott James Remnant
* init/main.c (main): Being unable tp open the control socket, or
8465
	* init/main.c (main): Being unable tp open the control socket, or
8466
	parse the configuration, should be a fatal error; stop being so
8467
	damned liberal! <g>   Don't reset the signal state if we're
8468
	being restarted, as this loses any pending signals -- be happy
8469
	that our parent left them in a good state.  Set SIGCHLD to the
8470
	standard handler, otherwise we might lose this before we start
8471
	the main loop (which does the same anyway).
8472
	(term_handler): Rework so we don't need to close and open the
8473
	control socket; instead we just close it in the child that's
8474
	going to send the state, and notify the parent that it's safe to
8475
	exec (which will cause it to be closed so the new init can open it).
8476
400 by Scott James Remnant
* init/tests/test_control.c (test_open): Fix valgrind error
8477
	* init/tests/test_control.c (test_open): Fix valgrind error
8478
	* init/tests/test_notify.c (test_subscribe): Fix valgrind error
8479
399 by Scott James Remnant
* init/notify.c (notify_subscribe): Make safe against ENOMEM.
8480
	* init/notify.c (notify_subscribe): Make safe against ENOMEM.
8481
	* init/tests/test_notify.c (test_subscribe): Use TEST_ALLOC_FAIL
8482
398 by Scott James Remnant
* init/control.c: Add needed attributes; tidy up formatting.
8483
	* init/control.c: Add needed attributes; tidy up formatting.
8484
	(control_open): Don't let ENOMEM fail opening the control socket.
8485
	* init/control.h: Add needed attributes.
8486
	* init/tests/test_control.c (test_open): Test for failed allocation.
8487
	* init/main.c (term_handler): Make sure we catch failure to open
8488
	the control socket again.
8489
397 by Scott James Remnant
* TODO: Update
8490
	* TODO: Update
8491
396 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): Clean this up a bit; now we only
8492
	* init/cfgfile.c (cfg_watch_dir): Clean this up a bit; now we only
8493
	output a warning if inotify failed for any reason other than not
8494
	being supported AND walking worked.
8495
395 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): Update to even newer watch API;
8496
	* init/cfgfile.c (cfg_watch_dir): Update to even newer watch API;
8497
	our create_handler is now always called if inotify is successful,
8498
	so we just need to fall back to walking the directory when it
8499
	isn't -- if inotify isn't supported, don't even bother complaining.
8500
	(cfg_create_modify_handler): Check the stat of the file visited to
8501
	make sure it's a regular file.
8502
	(cfg_visitor): Check the stat of the file visited to make sure it's
8503
	a regular file.
8504
394 by Scott James Remnant
* init/cfgfile.c: Update include to upstart/enum.h
8505
	* init/cfgfile.c: Update include to upstart/enum.h
8506
	* init/job.c: Update include to upstart/enum.h
8507
	* init/job.h: Update include to upstart/enum.h
8508
393 by Scott James Remnant
* logd/main.c: Add attribute to open_logging
8509
	* logd/main.c: Add attribute to open_logging
8510
392 by Scott James Remnant
* util/initctl.c: Split out the command functions into new files;
8511
	* util/initctl.c: Split out the command functions into new files;
8512
	* util/jobs.c: This gets the job-related commands
8513
	* util/events.h: This gets the event-related commands
8514
	* util/initctl.h, util/jobs.h, util/events.h: Headers
8515
	* util/tests/test_jobs.c: Test suite for job-related commands.
8516
	* util/tests/test_events.c: Test suite for event-related commands.
8517
	* util/Makefile.am (initctl_SOURCES): Add new files.
8518
	(TESTS): Build new test suites.
8519
	(test_jobs_SOURCES, test_jobs_LDFLAGS, test_jobs_LDADD):
8520
	Details for job-related commands test suite binary.
8521
	(test_events_SOURCES, test_events_LDFLAGS, test_events_LDADD):
8522
	Details for event-related commands test suite binary.
8523
	* TODO: Remove item about splitting initctl now we've done it.
8524
391 by Scott James Remnant
* TODO: Big update; strip anything we have a spec for.
8525
	* TODO: Big update; strip anything we have a spec for.
8526
390 by Scott James Remnant
* upstart/message.c (upstart_message_handle): Make sure that if we
8527
	* upstart/message.c (upstart_message_handle): Make sure that if we
8528
	fail to parse a message, we don't leave strings around in memory.
8529
	* upstart/tests/test_message.c (test_open): Check that we get a
8530
	raised EADDRINUSE if we try an open a socket twice.
8531
	(test_handle): Add lots of checks for things like NULL names and
8532
	incomplete messages; as well as the obvious unknown message.
8533
	(test_reader): Make sure that errors while handling messages are
8534
	dealt with by logging it.
8535
389 by Scott James Remnant
* upstart/job.c, upstart/job.h, upstart/tests/test_job.c: Rename to
8536
	* upstart/job.c, upstart/job.h, upstart/tests/test_job.c: Rename to
8537
	enum.c, enum.h and tests/test_enum.c; since this just includes enums
8538
	and convert functions really.
8539
	* upstart/Makefile.am: Update.
8540
	* upstart/libupstart.h: Update include.
8541
	* upstart/tests/test_message.c: Update include.
8542
383 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): Port to the new NihWatch API and
8543
2007-02-01  Scott James Remnant  <scott@netsplit.com>
8544
388 by Scott James Remnant
* logd/main.c (main): Ensure we error if daemonise fails.
8545
	* logd/main.c (main): Ensure we error if daemonise fails.
8546
387 by Scott James Remnant
* compat/sysv/shutdown.c (main): Ensure that signals and timers
8547
	* compat/sysv/shutdown.c (main): Ensure that signals and timers
8548
	are added, even if we run out of memory.
8549
386 by Scott James Remnant
* upstart/tests/test_message.c: Change from assert to assert0
8550
	* upstart/tests/test_message.c: Change from assert to assert0 
8551
	* upstart/tests/test_wire.c: Change from assert to assert0
8552
	* init/tests/test_notify.c: Change from assert to assert0
8553
	* init/tests/test_control.c: nih_io_message_send should always return
8554
	a value greater than zero.
8555
385 by Scott James Remnant
* upstart/tests/test_wire.c: Change to use assert instead of NIH_ZERO;
8556
	* upstart/tests/test_wire.c: Change to use assert instead of NIH_ZERO;
8557
	the rationale here is that in test cases we just want to fail, not
8558
	try again repeatedly.
8559
	* upstart/tests/test_message.c: Likewise.
8560
384 by Scott James Remnant
* init/tests/test_control.c: Use assert to ensure we get the expected
8561
	* init/tests/test_control.c: Use assert to ensure we get the expected
8562
	return values of functions that raise errors.
8563
	* init/tests/test_notify.c: Use assert to ensure we get the expected
8564
	return values of functions that raise errors.
8565
383 by Scott James Remnant
* init/cfgfile.c (cfg_watch_dir): Port to the new NihWatch API and
8566
	* init/cfgfile.c (cfg_watch_dir): Port to the new NihWatch API and
8567
	use nih_dir_walk().  This also fixes the long-standing bug where we
8568
	wouldn't watch the configuration directory if inotify was disabled.
8569
	Drop both the parent and prefix members for now, until we clean this
8570
	up later.
8571
	(cfg_create_modify_handler): Wrap cfg_read_job after figuring out
8572
	the job name.
8573
	(cfg_job_name): Function to figure out the job name from a path.
8574
	(cfg_visitor): Visitor function to handle initial parsing, figuring
8575
	out the job name; otherwise identical to the standard handler.
8576
	* init/cfgfile.h: Update prototype for cfg_watch_dir.
8577
	* init/main.c (main): Update call to cfg_watch_dir.
8578
382 by Scott James Remnant
* upstart/tests/test_message.c: Use TEST_ALLOC_FAIL to make sure
8579
2007-01-31  Scott James Remnant  <scott@netsplit.com>
8580
8581
	* upstart/tests/test_message.c: Use TEST_ALLOC_FAIL to make sure
8582
	allocations are handled properly.
8583
375 by Scott James Remnant
* HACKING: Update from libnih with new Documentation,
8584
2007-01-30  Scott James Remnant  <scott@netsplit.com>
8585
381 by Scott James Remnant
* upstart/wire.c: Note that if any of the push functions fail, the
8586
	* upstart/wire.c: Note that if any of the push functions fail, the
8587
	entire buffer should be discarded.
8588
	* upstart/tests/test_wire.c (test_push_int, test_push_unsigned) 
8589
	(test_push_string, test_push_header, test_push_pack): Us
8590
	TEST_ALLOC_FAIL to ensure that failing to allocate memory is caught.
8591
380 by Scott James Remnant
* upstart/tests/test_message.c (my_handler): Free the name and
8592
	* upstart/tests/test_message.c (my_handler): Free the name and
8593
	description after checking; they aren't otherwise.
8594
379 by Scott James Remnant
* upstart/wire.c (upstart_push_packv, upstart_pop_packv): Consume
8595
	* upstart/wire.c (upstart_push_packv, upstart_pop_packv): Consume
8596
	a copy of the va_list, so these can be called multiple times on the
8597
	same list without ill effect.
8598
378 by Scott James Remnant
* upstart/message.h: Add warn_unused_result attributes to
8599
	* upstart/message.h: Add warn_unused_result attributes to
8600
	upstart_message_handle and upstart_message_handle_using as they raise
8601
	errors.
8602
377 by Scott James Remnant
* upstart/wire.c: push functions return negative values to indicate
8603
	* upstart/wire.c: push functions return negative values to indicate
8604
	insufficient memory.
8605
	* upstart/wire.h: Add warn_unused_result attributes to push functions
8606
376 by Scott James Remnant
* upstart/tests/test_message.c: Guard calls to nih_io_buffer_push and
8607
	* upstart/tests/test_message.c: Guard calls to nih_io_buffer_push and
8608
	nih_io_message_add_control with NIH_ZERO to ensure they succeed.
8609
	* upstart/tests/test_wire.c: Guard calls to nih_io_buffer_push
8610
375 by Scott James Remnant
* HACKING: Update from libnih with new Documentation,
8611
	* HACKING: Update from libnih with new Documentation,
8612
	Function Attributes and Test Cases sections.
8613
370 by Scott James Remnant
* init/main.c (segv_handler): Rename to crash_handler and handle
8614
2007-01-10  Scott James Remnant  <scott@netsplit.com>
8615
374 by Scott James Remnant
* init/main.c (crash_handler): s/SEGV/SIGSEGV/
8616
	* init/main.c (crash_handler): s/SEGV/SIGSEGV/
8617
373 by Scott James Remnant
* init/main.c (main): Rename variable
8618
	* init/main.c (main): Rename variable
8619
372 by Scott James Remnant
* TODO: Update.
8620
	* TODO: Update.
8621
371 by Scott James Remnant
* init/main.c (main): Change the way we clear the arguments; by
8622
	* init/main.c (main): Change the way we clear the arguments; by
8623
	deleting just the final NULL terminator, we fool the kernel into
8624
	only returning one argument in cmdline.
8625
370 by Scott James Remnant
* init/main.c (segv_handler): Rename to crash_handler and handle
8626
	* init/main.c (segv_handler): Rename to crash_handler and handle
8627
	SIGABRT as well, so we can catch assertion errors.  Of course, in
8628
	theory, with our high test converage this should never happen in
8629
	practice <chortle>
8630
353 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_depends): Remove the depends stanza
8631
2007-01-09  Scott James Remnant  <scott@netsplit.com>
8632
369 by Scott James Remnant
* init/main.c (main): Clear arguments so that upstart only ever
8633
	* init/main.c (main): Clear arguments so that upstart only ever
8634
	appears as /sbin/init in ps, top, etc.
8635
368 by Scott James Remnant
* TODO: Update.
8636
	* TODO: Update.
8637
367 by Scott James Remnant
* util/initctl.c: Add data pointer to functions and handle calls.
8638
	* util/initctl.c: Add data pointer to functions and handle calls.
8639
366 by Scott James Remnant
* init/control.c: Add data pointer to all functions.
8640
	* init/control.c: Add data pointer to all functions.
8641
	* init/tests/test_control.c: Pass data pointer to
8642
	upstart_message_handle_using()
8643
	* init/tests/test_notify.c: Pass data pointer to
8644
	upstart_message_handle_using()
8645
365 by Scott James Remnant
* upstart/message.c (upstart_message_handle)
8646
	* upstart/message.c (upstart_message_handle) 
8647
	(upstart_message_handle_using): Add a data pointer argument to these
8648
	functions and pass it to the handler.
8649
	(upstart_message_reader): Pass the io structure's data pointer.
8650
	* upstart/message.h (UpstartMessageHandler): Add a data pointer to
8651
	the message handler.
8652
	* upstart/tests/test_message.c (test_handle, test_handle_using):
8653
	Pass a data pointer to the function call and check it's passed
8654
	to the handler correctly.
8655
	(test_reader): Check that the io data pointer gets passed.
8656
364 by Scott James Remnant
* init/tests/test_cfgfile.c (test_stanza_console, test_stanza_env)
8657
	* init/tests/test_cfgfile.c (test_stanza_console, test_stanza_env) 
8658
	(test_stanza_umask, test_stanza_nice, test_stanza_limit): Finish off
8659
	the newer style test cases.
8660
363 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_console, cfg_stanza_umask)
8661
	* init/cfgfile.c (cfg_stanza_console, cfg_stanza_umask)
8662
	(cfg_stanza_nice, cfg_stanza_limit, cfg_stanza_chroot)
8663
	(cfg_stanza_chdir): Guard against duplicate uses of the stanzas.
8664
	* init/tests/test_cfgfile.c (test_stanza_daemon) 
8665
	(test_stanza_respawn): Check that neither daemon or respawn override
8666
	exec if they have no arguments.
8667
	(test_stanza_script): Add missing function
8668
	(test_stanza_chroot, test_stanza_chdir): Add tests for these simple
8669
	stanzas.
8670
362 by Scott James Remnant
* init/cfgfile.c: Change remaining uses of nih_error_raise and
8671
	* init/cfgfile.c: Change remaining uses of nih_error_raise and
8672
	return to just nih_return_error.
8673
361 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_daemon)
8674
	* init/cfgfile.c (cfg_stanza_exec, cfg_stanza_daemon)
8675
	(cfg_stanza_respawn, cfg_stanza_script): Disallow duplicates,
8676
	both of command strings, scripts, limits and of just the flags.
8677
	* init/tests/test_cfgfile.c (test_stanza_exec) 
8678
	(test_stanza_daemon, test_stanza_respawn, test_stanza_instance):
8679
	Check the behaviour of these stanzas.
8680
	
360 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop): Disallow
8681
	* init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop): Disallow
8682
	duplicate values for the script.
8683
	* init/tests/test_cfgfile.c (test_stanza_start, test_stanza_stop):
8684
	Test cases for those two functions.
8685
359 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_description, cfg_stanza_author)
8686
	* init/cfgfile.c (cfg_stanza_description, cfg_stanza_author) 
8687
	(cfg_stanza_version): Don't allow stanza to be duplicated anymore.
8688
	* init/tests/test_cfgfile.c (test_stanza_description) 
8689
	(test_stanza_author, test_stanza_version): Test cases for these
8690
	simple stanza; making sure duplication is not permitted.
8691
	(test_stanza_on): Add a test case for this stanza too.
8692
358 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_kill): Guard against duplicate uses
8693
	* init/cfgfile.c (cfg_stanza_kill): Guard against duplicate uses
8694
	of the kill timeout stanza.
8695
	* init/tests/test_cfgfile.c (test_stanza_kill): Test the complex
8696
	kill stanza.
8697
	(test_stanza_pid): Check duplicate usage results in an error.
8698
357 by Scott James Remnant
* init/job.h (Job): Rename pidfile to pid_file and binary to pid_binary
8699
	* init/job.h (Job): Rename pidfile to pid_file and binary to pid_binary
8700
	* init/job.c (job_new): Update names here too.
8701
	* init/errors.h: Add a new "duplicate value" error.
8702
	* init/cfgfile.c (cfg_read_job): Change name of variables, and catch
8703
	the duplicate value error to add the line number.
8704
	(cfg_stanza_pid): Change variable names, and clean this function up
8705
	a little.  Make it an error to use a stanza more than once.
8706
	* init/tests/test_cfgfile.c (test_stanza_pid): Write a newer test
8707
	case function for the pid stanza.
8708
356 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_normalexit): Use do/while instead of
8709
	* init/cfgfile.c (cfg_stanza_normalexit): Use do/while instead of
8710
	while, that we don't have to test has_token first as next_arg does
8711
	that for us.
8712
355 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_normalexit): Change to peek at the next
8713
	* init/cfgfile.c (cfg_stanza_normalexit): Change to peek at the next
8714
	token to see whether it's missing or not, and then just fetch each
8715
	next argument at a time.  This is more efficient than parsing them
8716
	all in one go, and also means we can report the error in the right
8717
	place!
8718
	* init/tests/test_cfgfile.c (test_stanza_normalexit): Since we've
8719
	changed the function that parses the stanza, add a proper test case
8720
	function for it, covering all the behaviours.
8721
354 by Scott James Remnant
* init/job.c (job_new): Initialise the emits member to an empty list.
8722
	* init/job.c (job_new): Initialise the emits member to an empty list.
8723
	* init/job.h (Job): Add the emits member as a list.
8724
	* init/tests/test_job.c (test_new): Check the emits list starts off
8725
	empty.
8726
	* init/tests/test_cfgfile.c (test_stanza_emits): Test the new emits
8727
	stanza; this function will also serve as a prototype for cleaning up
8728
	the config tests.
8729
8730
	* init/cfgfile.c (cfg_stanza_emits): Add function to parse the new
8731
	emits stanza.
8732
353 by Scott James Remnant
* init/cfgfile.c (cfg_stanza_depends): Remove the depends stanza
8733
	* init/cfgfile.c (cfg_stanza_depends): Remove the depends stanza
8734
	from the configuration file.  Dependency support has never been used,
8735
	and is to be replaced by a more flexible event/state configuration
8736
	and blocking on the starting/stopping events.
8737
	* init/tests/test_cfgfile.c: Remove references and tests for the
8738
	depends stanza.
8739
	* init/job.h: Remove the depends list from the job structure.
8740
	* init/job.c (job_new): No depends list to initialise.
8741
	(job_change_state): No dependencies to release
8742
	(job_start): No dependencies to iterate; this removes a particularly
8743
	hairy and complex interaction between state changes.  Remove the
8744
	dependency event.
8745
	(job_release_depends): Drop this function.
8746
	* init/tests/test_job.c (test_start, test_stop): Massively simplify
8747
	these tests cases now we don't have dependencies to worry about.
8748
	(test_release_depends): Drop tests
8749
352 by Scott James Remnant
* init/cfgfile.c: Rewrite using the nih_config API, rather than one
8750
2007-01-08  Scott James Remnant  <scott@netsplit.com>
8751
8752
	* init/cfgfile.c: Rewrite using the nih_config API, rather than one
8753
	huge function we now just have seperate handler functions for each
8754
	stanza.  We can also use more fine-grained parsing than slurping
8755
	all args in and counting them.
8756
	(cfg_read_job): Catch exceptions from the configuration parser and
8757
	add the line number where the problem occurred to an output message.
8758
	Parser errors are now fatal, and not ignored.
8759
	* init/errors.h: Add a file containing errors raised within the init
8760
	daemon codebase.
8761
	* init/Makefile.am (init_SOURCES): Build with errors.h
8762
	* init/tests/test_cfgfile.c: Update test cases now we don't expect
8763
	a job to be returned if there's a parser error.
8764
8765
	* TODO: Update
8766
343 by Scott James Remnant
* util/initctl.c: Yet another makeover for this little program,
8767
2007-01-06  Scott James Remnant  <scott@netsplit.com>
8768
351 by Scott James Remnant
* logd/main.c (logging_reader): Fix inadvertent shadowing of the
8769
	* logd/main.c (logging_reader): Fix inadvertent shadowing of the
8770
	len parameter.
8771
348 by Scott James Remnant
* compat/sysv/telinit.c: Oops, nearly forgot to port this to send
8772
	* compat/sysv/telinit.c: Oops, nearly forgot to port this to send
8773
	the messages in the new way.
8774
	* compat/sysv/shutdown.c (shutdown_now): Likewise, port this too.
8775
346 by Scott James Remnant
* TODO: Update.
8776
	* TODO: Update.
8777
345 by Scott James Remnant
* util/initctl.c (handle_job_status): Output the process argument,
8778
	* util/initctl.c (handle_job_status): Output the process argument,
8779
	not the pid argument which contains the origin of the message.
8780
344 by Scott James Remnant
* upstart/message.c (upstart_message_handle): Raise a new unknown
8781
	* upstart/message.c (upstart_message_handle): Raise a new unknown
8782
	message error if we don't have a handler  and a new illegal message
8783
	error if the source is illegal.
8784
	* upstart/tests/test_message.c (test_handle): Adjust tests to check
8785
	for the new errors that we raise.
8786
	* upstart/errors.h: Define strings for new errors.
8787
343 by Scott James Remnant
* util/initctl.c: Yet another makeover for this little program,
8788
	* util/initctl.c: Yet another makeover for this little program,
8789
	port it to the new message/control framework using handler functions
8790
	and NihIoMessage.  This starts to make each action function look
8791
	very similar, so there's method to this madness.
8792
330 by Scott James Remnant
* upstart/message.c (upstart_message_handle_using): Wrapper function
8793
2007-01-05  Scott James Remnant  <scott@netsplit.com>
8794
342 by Scott James Remnant
* logd/main.c (main): Make sure that we add the SIGTERM handler.
8795
	* logd/main.c (main): Make sure that we add the SIGTERM handler.
8796
341 by Scott James Remnant
* init/tests/test_job.c (test_run_script): This test case relies
8797
	* init/tests/test_job.c (test_run_script): This test case relies
8798
	on there only being one file descriptor watch, which won't be true
8799
	if the control socket has been opened because there's a message to
8800
	go out.  Make sure it's closed first.
8801
340 by Scott James Remnant
* init/init.supp: Update supressions file now that control_init
8802
	* init/init.supp: Update supressions file now that control_init
8803
	has been renamed to notify_init
8804
339 by Scott James Remnant
* init/Makefile.am: Include notify.o from all tests.
8805
	* init/Makefile.am: Include notify.o from all tests.
8806
	* init/job.c (job_change_state, job_kill_process, job_start) 
8807
	(job_stop): Use the new notify_job function name.
8808
	* init/event.c (event_queue_run): Use the new notify_event function
8809
	name.
8810
338 by Scott James Remnant
* init/control.c (control_error_handler): Handle ECONNREFUSED now
8811
	* init/control.c (control_error_handler): Handle ECONNREFUSED now
8812
	that the process id is available to us.
8813
	* init/tests/test_control.c (test_error_handler): Make sure children
8814
	going away is handled properly.
8815
337 by Scott James Remnant
* upstart/message.c (upstart_message_new): Store the process id in
8816
	* upstart/message.c (upstart_message_new): Store the process id in
8817
	the int_data message field.
8818
	* upstart/tests/test_message.c (test_new): Check the int_data field
8819
	is filled in.
8820
336 by Scott James Remnant
* init/main.c (main): Guard against various things returning an error
8821
	* init/main.c (main): Guard against various things returning an error
8822
	that we weren't catching.
8823
335 by Scott James Remnant
* init/tests/test_notify.c: Whitespace fix.
8824
	* init/tests/test_notify.c: Whitespace fix.
8825
334 by Scott James Remnant
* init/control.c (control_watch_jobs, control_unwatch_jobs)
8826
	* init/control.c (control_watch_jobs, control_unwatch_jobs) 
8827
	(control_watch_events, control_unwatch_events): Restore functionality
8828
	to subscribe and unsubscribe from job and event notifications.	
8829
	* init/tests/test_control.c (test_watch_jobs, test_unwatch_jobs) 
8830
	(test_watch_events, test_unwatch_events): Check that the subscription
8831
	and unsubscription messages work.
8832
	* init/Makefile.am (test_control_LDADD): Link to notify.o
8833
8834
	* init/control.c: Drop unused include of upstart/errors.h
8835
333 by Scott James Remnant
* init/notify.c: Move functions that handle subscription and
8836
	* init/notify.c: Move functions that handle subscription and
8837
	notification from control.c.  Other than changing the names, we're
8838
	keeping the API the same for now; expect it to change later when we
8839
	add the ability to subscribe to individual jobs or events.
8840
	(notify_init): initialise the subscriptions list; we don't have a
8841
	separate send queue now that the control I/O is always asynchronous.
8842
	* init/notify.h: Moved notification enum, structure and prototypes
8843
	from control.h, changing the names so they match notify_* in the
8844
	process.
8845
	* init/Makefile.am (init_SOURCES): Build and link notify.c using
8846
	notify.h
8847
	(TESTS): Build the notify test suite binary.
8848
	(test_notify_SOURCES, test_notify_LDFLAGS, test_notify_LDADD): Details
8849
	for notify test suite binary.
8850
	* init/tests/test_notify.c: Rewrite test cases in the manner of
8851
	test_control.c so that we have one function for notify_job and
8852
	one for notify_event, each of which contains the child process that
8853
	receives the notification,
8854
332 by Scott James Remnant
* init/control.c (control_open): Allow this to be called to obtain
8855
	* init/control.c (control_open): Allow this to be called to obtain
8856
	the control socket, which means we can make it static.
8857
	* init/tests/test_control.c (test_open): Check that it works.
8858
331 by Scott James Remnant
* init/control.c, init/control.h, init/tests/test_control.c: Move
8859
	* init/control.c, init/control.h, init/tests/test_control.c: Move
8860
	functions that handle subscription and notification to new notify.c
8861
	(control_init): Drop completely, no need to maintain a send queue now
8862
	(control_open): Change to return an NihIo that uses the default
8863
	control watcher, and our error handler.  Split socket opening into
8864
	(control_open_sock): which can be called from other functions.
8865
	(control_close): Use nih_io_close() to close the socket and free the
8866
	structure in one go.
8867
	(control_reopen): Close the open control socket and open it again
8868
	without destroying the NihIo structure, its queues or state.
8869
	(control_close_handler): Handle the control socket going away
8870
	(control_error_handler): Handle errors on the control socket,
8871
	including the connection refused error that indicates a client went
8872
	away.
8873
	(control_handle): Split this into a miriad of small functions with
8874
	a table to link them to the message type; this will make expanding
8875
	each message handler much easier in future.
8876
	* init/control.h: Update.
8877
	* init/tests/test_control.c: Rewrite test cases to check the new
8878
	handler functions; as a side-effect, this gets rid of the evil giant
8879
	child/parent functions in favour of one test function per handler
8880
	function.
8881
330 by Scott James Remnant
* upstart/message.c (upstart_message_handle_using): Wrapper function
8882
	* upstart/message.c (upstart_message_handle_using): Wrapper function
8883
	around upstart_message_handle that ensures all messages as passed to
8884
	a single function.
8885
	* upstart/message.h: Update.
8886
	* upstart/tests/test_message.c (test_handle_using): Make sure it
8887
	calls the single function.
8888
329 by Scott James Remnant
* upstart/message.c (upstart_message_reader): Handle any errors
8889
2007-01-04  Scott James Remnant  <scott@netsplit.com>
8890
8891
	* upstart/message.c (upstart_message_reader): Handle any errors
8892
	that occurred while handling the message.
8893
325 by Scott James Remnant
* configure.ac (AC_COPYRIGHT): Update copyright to 2007.
8894
2007-01-02  Scott James Remnant  <scott@netsplit.com>
8895
328 by Scott James Remnant
* upstart/message.c (upstart_message_handle): Check that the name
8896
	* upstart/message.c (upstart_message_handle): Check that the name
8897
	argument is never NULL.
8898
	(upstart_message_reader): Simple message reader function that can
8899
	be associated with an I/O watch and handles each message received.
8900
	* upstart/message.h: Add prototype.
8901
	* upstart/tests/test_message.c (test_reader): Test the reader function.
8902
327 by Scott James Remnant
* upstart/control.c: Rename to upstart/message.c
8903
	* upstart/control.c: Rename to upstart/message.c
8904
	* upstart/control.h: Rename to upstart/message.h
8905
	* upstart/tests/test_control.c: Rename to upstart/tests/test_message.c
8906
	* upstart/libupstart.h: Update includes.
8907
	* upstart/wire.c: Include message.h
8908
	* upstart/wire.h: Update includes.
8909
	* upstart/tests/test_wire.c: Update includes.
8910
	* upstart/errors.h: Rename UPSTART_INVALID_MESSAGE to
8911
	UPSTART_MESSAGE_INVALID so that it's prefixed.
8912
	* upstart/Makefile.am (libupstart_la_SOURCES) 
8913
	(upstartinclude_HEADERS, TESTS): Update filenames.
8914
326 by Scott James Remnant
* upstart/control.c (upstart_message_new): New function that
8915
	* upstart/control.c (upstart_message_new): New function that
8916
	creates an NihIoMessage directly from its arguments, which are a type
8917
	followed by a variable number of args depending on that type.
8918
	(upstart_message_handler): Function to find a handler function for
8919
	a particular message type and origin process.
8920
	(upstart_message_handle): New function that takes an NihIoMessage
8921
	and invokes a handler function with a variable number of args
8922
	depending on the message type.
8923
	(upstart_send_msg, upstart_send_msg_to, upstart_recv_msg): Drop these
8924
	functions, leave it up to the caller to decide whether to send and
8925
	receive the messages synchronously or asynchronously; now that the
8926
	capability is in nih_io_*.
8927
	* upstart/control.h (UpstartMsgType): Rename to UpstartMessageType.
8928
	(UpstartMessageHandler): Function with variable number of arguments
8929
	that handles a message received.
8930
	(UpstartMsg): Drop this structure entirely, we'll encode or decode
8931
	the wire format directly from or into a function call, rather than
8932
	use an intermediate structure to marshal it.
8933
	(UpstartMessage): New structure to make a table that can be passed
8934
	to upstart_message_handle to determine which handler should be called.
8935
	* upstart/tests/test_control.c: Test new behaviour.
8936
	* upstart/wire.c (upstart_push_header, upstart_pop_header): Change
8937
	structure name for type parameter.
8938
	* upstart/wire.h: Update.
8939
	* upstart/tests/test_wire.c: Update.
8940
325 by Scott James Remnant
* configure.ac (AC_COPYRIGHT): Update copyright to 2007.
8941
	* configure.ac (AC_COPYRIGHT): Update copyright to 2007.
8942
324 by Scott James Remnant
* upstart/wire.c (upstart_write_int, upstart_write_unsigned)
8943
2006-12-29  Scott James Remnant  <scott@netsplit.com>
8944
8945
	* upstart/wire.c (upstart_write_int, upstart_write_unsigned) 
8946
	(upstart_write_string, upstart_write_header, upstart_write_packv) 
8947
	(upstart_write_pack): Rename to *_push_*
8948
	(upstart_read_int, upstart_read_unsigned, upstart_read_string) 
8949
	(upstart_read_header, upstart_read_packv, upstart_read_pack): Rename
8950
	to *_pop_*.
8951
	All of the above modified to modify an NihIoMessage structure,
8952
	instead of trying to carry around buffers ourself.
8953
	* upstart/wire.h: Update to match above.
8954
	* upstart/tests/test_wire.c: Update all tests to match the above
8955
	changes.
8956
322 by Scott James Remnant
* init/job.c (job_run_script): Open the NihIo structure in stream mode.
8957
2006-12-21  Scott James Remnant  <scott@netsplit.com>
8958
323 by Scott James Remnant
* upstart/wire.c (upstart_read_packv, upstart_write_packv): Change
8959
	* upstart/wire.c (upstart_read_packv, upstart_write_packv): Change
8960
	nih_assert_notreached to nih_assert_not_reached.
8961
322 by Scott James Remnant
* init/job.c (job_run_script): Open the NihIo structure in stream mode.
8962
	* init/job.c (job_run_script): Open the NihIo structure in stream mode.
8963
	* logd/main.c (logging_watcher): Open the NihIo structure in
8964
	stream mode.
8965
	(logging_reader): Need to pass the length of the size_t as a pointer
8966
	so that it can be modified if less is read.
8967
313 by Scott James Remnant
* upstart/control.c (MAGIC): Change to "upstart\n", the final
8968
2006-12-17  Scott James Remnant  <scott@netsplit.com>
8969
321 by Scott James Remnant
* upstart/wire.c (upstart_write_packv, upstart_write_pack)
8970
	* upstart/wire.c (upstart_write_packv, upstart_write_pack) 
8971
	(upstart_read_packv, upstart_read_pack): Functions to write a pack
8972
	of different variables to the stream, or read them from it
8973
	* upstart/wire.h: Add prototypes.
8974
	* upstart/tests/test_wire.c (test_write_pack, test_read_pack):
8975
	Check we can read and write a pack of variables at once.
8976
320 by Scott James Remnant
* upstart/wire.c (upstart_write_header, upstart_read_header): Drop
8977
	* upstart/wire.c (upstart_write_header, upstart_read_header): Drop
8978
	the version from the header, we'll just keep the protocol always
8979
	backwards compatible.
8980
	* upstart/wire.h: Update.
8981
	* upstart/tests/test_wire.c (test_write_header, test_read_header):
8982
	Check that everything works.
8983
319 by Scott James Remnant
* upstart/wire.c (upstart_write_string, upstart_read_string):
8984
	* upstart/wire.c (upstart_write_string, upstart_read_string):
8985
	Transmit the length as an unsigned, and use 0xffffffff to mean NULL
8986
	instead of zero so we can still transmit the empty string.
8987
	* upstart/wire.h: Update.
8988
	* upstart/tests/test_wire.c (test_write_string, test_read_string):
8989
	Tests for the functions to make sure the wire is at it should be.
8990
318 by Scott James Remnant
* upstart/wire.c (upstart_read_str, upstart_write_str): Rename to
8991
	* upstart/wire.c (upstart_read_str, upstart_write_str): Rename to
8992
	upstart_read_string and upstart_write_string.
8993
	* upstart/wire.h: Update.
8994
	
317 by Scott James Remnant
* upstart/wire.c (upstart_write_unsigned, upstart_read_unsigned):
8995
	* upstart/wire.c (upstart_write_unsigned, upstart_read_unsigned):
8996
	Functions to send unsigned values over the wire, which we'll use
8997
	to get a bit extra for the string lengths.
8998
	* upstart/wire.h: Update.
8999
	* upstart/tests/test_wire.c (test_write_unsigned) 
9000
	(test_read_unsigned): Test the new functions.
9001
316 by Scott James Remnant
* upstart/wire.c (upstart_write_ints, upstart_read_ints): Drop
9002
	* upstart/wire.c (upstart_write_ints, upstart_read_ints): Drop
9003
	these functions, we'll go with something far more generic and
9004
	useful.
9005
	* upstart/wire.h: Remove prototypes.
9006
315 by Scott James Remnant
* upstart/wire.c (upstart_write_int, upstart_read_int): Transmit
9007
	* upstart/wire.c (upstart_write_int, upstart_read_int): Transmit
9008
	integers as signed 32-bit values in network byte order.
9009
	* upstart/tests/test_wire.c (test_write_int, test_read_int): Test
9010
	the functions to make sure the wire is at it should be,
9011
314 by Scott James Remnant
* upstart/control.c (upstart_read_int, upstart_write_int)
9012
	* upstart/control.c (upstart_read_int, upstart_write_int) 
9013
	(upstart_read_ints, upstart_write_ints, upstart_read_str) 
9014
	(upstart_write_str, upstart_read_header, upstart_write_header): Move
9015
	functions to new wire.c file.
9016
	* upstart/wire.c: Source file to hold wire protocol functions.
9017
	* upstart/wire.h: Prototypes.
9018
	* upstart/tests/test_wire.c: (empty) test suite.
9019
	* upstart/libupstart.h: Include wire.h
9020
	* upstart/Makefile.am (libupstart_la_SOURCES): Build and link wire.c
9021
	(upstartinclude_HEADERS): Install wire.h
9022
	(TESTS): Build and run wire test suite.
9023
	(test_wire_SOURCES, test_wire_LDFLAGS, test_wire_LDADD): Details for
9024
	wire test suite binary.
9025
313 by Scott James Remnant
* upstart/control.c (MAGIC): Change to "upstart\n", the final
9026
	* upstart/control.c (MAGIC): Change to "upstart\n", the final
9027
	character was originally \0 and then was a " " for the 0.2 series.
9028
	* upstart/tests/test_control.c (test_recv_msg): Change to match.
9029
308 by Scott James Remnant
* upstart/control.c (upstart_read_int, upstart_write_int)
9030
2006-12-15  Scott James Remnant  <scott@netsplit.com>
9031
312 by Scott James Remnant
* util/initctl.c, compat/sysv/telinit.c, compat/sysv/shutdown.c:
9032
	* util/initctl.c, compat/sysv/telinit.c, compat/sysv/shutdown.c:
9033
	Update all uses of the UpstartMsg structure to avoid the
9034
	intermediate union that no longer exists.	
9035
311 by Scott James Remnant
* init/control.c, init/tests/test_control.c: Update all uses of
9036
	* init/control.c, init/tests/test_control.c: Update all uses of
9037
	the UpstartMsg structure to avoid the intermediate union that no
9038
	longer exists.	
9039
310 by Scott James Remnant
* upstart/control.h: Combine all the previous message structures
9040
	* upstart/control.h: Combine all the previous message structures
9041
	into just one that has all of the fields anyway.
9042
	* upstart/control.c, upstart/tests/test_control.c: Update all uses of
9043
	the UpstartMsg structure to avoid the intermediate union that no
9044
	longer exists.
9045
309 by Scott James Remnant
* upstart/control.h (UPSTART_API_VERSION): Define API version macro
9046
	* upstart/control.h (UPSTART_API_VERSION): Define API version macro
9047
	to be public.
9048
	* upstart/control.c (MSG_VERSION, upstart_send_msg_to): Replacing the
9049
	previous MSG_VERSION macro here.
9050
308 by Scott James Remnant
* upstart/control.c (upstart_read_int, upstart_write_int)
9051
	* upstart/control.c (upstart_read_int, upstart_write_int) 
9052
	(upstart_read_ints, upstart_write_ints, upstart_read_str) 
9053
	(upstart_write_str, upstart_read_header, upstart_write_header):
9054
	New functions to replace the old "write a struct" protocol with
9055
	something a little more regimented and supportable.
9056
	(IOVEC_ADD, IOVEC_READ, WireHdr, WireJobPayload, WireJobStatusPayload)
9057
	(WireEventPayload): Remove these structures, use the functions
9058
	instead.
9059
	(upstart_send_msg_to): Call write functions intead of using macros,
9060
	this makes the code somewhat neater.
9061
	(upstart_recv_msg): Call read functions instead of using macros,
9062
	again making the code somewhat neater.
9063
	* upstart/tests/test_control.c (test_recv_msg): Change wire
9064
	tests to match new protocol, and thus actually work properly,
9065
	previously these were endian sensitive.
9066
299 by Scott James Remnant
* configure.ac (AC_INIT): Correct bug reporting address.
9067
2006-12-14  Scott James Remnant  <scott@netsplit.com>
9068
307 by Scott James Remnant
* compat/sysv/shutdown.c (wall): Construct the wall message so that
9069
	* compat/sysv/shutdown.c (wall): Construct the wall message so that
9070
	we don't put \r into a po file; for some reason, gettext hates that
9071
	and bitches about it.  Someone's confusing internationalisation with
9072
	operating system portability, I expect.
9073
303 by Scott James Remnant
* util/man/initctl.8: Drop reference to start(8), as that's just
9074
	* util/man/initctl.8: Drop reference to start(8), as that's just
9075
	a symlink to initctl now.
9076
302 by Scott James Remnant
* init/man/init.8: Link to initctl.
9077
	* init/man/init.8: Link to initctl.
9078
301 by Scott James Remnant
* compat/sysv/reboot.c (main): Clear up help text a little.
9079
	* compat/sysv/reboot.c (main): Clear up help text a little.
9080
300 by Scott James Remnant
* HACKING: Correct some typos.
9081
	* HACKING: Correct some typos.
9082
299 by Scott James Remnant
* configure.ac (AC_INIT): Correct bug reporting address.
9083
	* configure.ac (AC_INIT): Correct bug reporting address.
9084
296 by Scott James Remnant
* util/initctl.c (print_job_status): Drop the newline from the
9085
2006-12-13  Scott James Remnant  <scott@netsplit.com>
9086
298 by Scott James Remnant
* configure.ac: Bump version to 0.3.2
9087
	* configure.ac: Bump version to 0.3.2
9088
297 by Scott James Remnant
* NEWS: Update.
9089
	* NEWS: Update.
9090
296 by Scott James Remnant
* util/initctl.c (print_job_status): Drop the newline from the
9091
	* util/initctl.c (print_job_status): Drop the newline from the
9092
	output.
9093
295 by Scott James Remnant
* util/initctl.c (print_job_status): Clean up initctl job status
9094
2006-12-13  Alex Smith  <alex@alex-smith.me.uk>
9095
9096
	* util/initctl.c (print_job_status): Clean up initctl job status
9097
	output, which was badly converted from printf to nih_message.
9098
294 by Scott James Remnant
* compat/sysv/man/shutdown.8: Add missing documentation on the
9099
2006-12-13  Scott James Remnant  <scott@netsplit.com>
9100
9101
	* compat/sysv/man/shutdown.8: Add missing documentation on the
9102
	format of TIME by copying it from --help output.
9103
293 by Scott James Remnant
* init/process.c (process_setup_console): Actually send output to
9104
2006-12-13  Alex Smith  <alex@alex-smith.me.uk>
9105
9106
	* init/process.c (process_setup_console): Actually send output to
9107
	/dev/null instead of /dev/console, when CONSOLE_NONE.
9108
290 by Scott James Remnant
* init/tests/test_job.c: Port to the new test framework.
9109
2006-12-13  Scott James Remnant  <scott@netsplit.com>
9110
291 by Scott James Remnant
* Makefile.am (EXTRA_DIST): Distribute the nih ChangeLog as well.
9111
	* Makefile.am (EXTRA_DIST): Distribute the nih ChangeLog as well.
9112
290 by Scott James Remnant
* init/tests/test_job.c: Port to the new test framework.
9113
	* init/tests/test_job.c: Port to the new test framework.
9114
	* init/job.c (job_set_idle_event): Fix a slight memory leak,
9115
	repeated setting of the idle event never freed the previous one set.
9116
276 by Scott James Remnant
* configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
9117
2006-12-12  Scott James Remnant  <scott@netsplit.com>
9118
289 by Scott James Remnant
* init/tests/test_cfgfile.c: Port to the new test framework.
9119
	* init/tests/test_cfgfile.c: Port to the new test framework.
9120
288 by Scott James Remnant
* init/tests/test_control.c: Port to the new test framework.
9121
	* init/tests/test_control.c: Port to the new test framework.
9122
	* init/init.supp: Suppress the list head allocated within control_init.
9123
287 by Scott James Remnant
* init/control.c (control_watcher): Need to save the pid when we
9124
	* init/control.c (control_watcher): Need to save the pid when we
9125
	get ECONNREFUSED, otherwise we lose it when we free the message.
9126
286 by Scott James Remnant
* init/tests/test_process.c: Port to the new test framework.
9127
	* init/tests/test_process.c: Port to the new test framework.
9128
	* init/init.supp: Suppress the list head allocated within job_init.
9129
285 by Scott James Remnant
* init/init.supp: Include a valgrind suppressions file.
9130
	* init/init.supp: Include a valgrind suppressions file.
9131
	* init/Makefile.am (EXTRA_DIST): Distribute the suppressions file.
9132
284 by Scott James Remnant
* init/tests/test_event.c: Port to the new test framework.
9133
	* init/tests/test_event.c: Port to the new test framework.
9134
283 by Scott James Remnant
* logd/Makefile.am, util/Makefile.am, compat/sys/Makefile.am
9135
	* logd/Makefile.am, util/Makefile.am, compat/sys/Makefile.am
9136
	(AM_CPPFLAGS): Add -I$(srcdir), necessary for testing "programs"
9137
	that don't have usual library path semantics.
9138
282 by Scott James Remnant
* upstart/tests/test_control.c: Port to the new test framework.
9139
	* upstart/tests/test_control.c: Port to the new test framework.
9140
	* upstart/control.c (upstart_free): Drop this function, while not
9141
	exposing libnih is a valiant effort, it already slips out because
9142
	of the error handling.
9143
281 by Scott James Remnant
* upstart/tests/test_job.c: Add missing include.
9144
	* upstart/tests/test_job.c: Add missing include.
9145
280 by Scott James Remnant
* upstart/tests/test_job.c: Port to the new test framework.
9146
	* upstart/tests/test_job.c: Port to the new test framework.
9147
	(test_process_state_name): Check that this returns NULL.
9148
279 by Scott James Remnant
* HACKING: Update location of download directory. Document
9149
	* HACKING: Update location of download directory.  Document
9150
	requirement that all code have test cases.
9151
278 by Scott James Remnant
* logd/main.c (open_logging): Likewise.
9152
	* logd/main.c (open_logging): Likewise.
9153
277 by Scott James Remnant
* init/control.c (control_open): No need to set ENOMEM, errno is
9154
	* init/control.c (control_open): No need to set ENOMEM, errno is
9155
	always set anyway.
9156
276 by Scott James Remnant
* configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
9157
	* configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
9158
	Automake's broken default includes.
9159
	* upstart/Makefile.am (DEFAULT_INCLUDES): Drop override now that
9160
	we don't need it.
9161
	(DEFS, INCLUDES): Replace these variables with the combined
9162
	(AM_CPPFLAGS): variable that declares everything.
9163
	* init/Makefile.am (DEFAULT_INCLUDES): Drop override now that
9164
	we don't need it.
9165
	(DEFS, INCLUDES): Replace these variables with the combined
9166
	(AM_CPPFLAGS): variable that declares everything.
9167
	* util/Makefile.am (DEFAULT_INCLUDES): Drop override now that
9168
	we don't need it.
9169
	(DEFS, INCLUDES): Replace these variables with the combined
9170
	(AM_CPPFLAGS): variable that declares everything.
9171
	* compat/sysv/Makefile.am (DEFAULT_INCLUDES): Drop override now that
9172
	we don't need it.
9173
	(DEFS, INCLUDES): Replace these variables with the combined
9174
	(AM_CPPFLAGS): variable that declares everything.
9175
	* logd/Makefile.am (DEFAULT_INCLUDES): Drop override now that
9176
	we don't need it.
9177
	(DEFS, INCLUDES): Replace these variables with the combined
9178
	(AM_CPPFLAGS): variable that declares everything.
9179
275 by Scott James Remnant
* util/initctl.c (start_action): Remove break calls which shouldn't
9180
2006-11-02  Scott James Remnant  <scott@netsplit.com>
9181
9182
	* util/initctl.c (start_action): Remove break calls which shouldn't
9183
	be there.
9184
274 by Scott James Remnant
* init/main.c: Include sys/time.h
9185
2006-10-18  Sean E. Russell  <ser@ser1.net>
9186
9187
	* init/main.c: Include sys/time.h
9188
	* init/cfgfile.c: Include sys/time.h and sys/resource.h
9189
	* init/job.c: Include sys/time.h and sys/resource.h
9190
268 by Scott James Remnant
* compat/sysv/runlevel.c (store): Don't break strict-aliasing rules
9191
2006-10-17  Scott James Remnant  <scott@netsplit.com>
9192
273 by Scott James Remnant
* configure.ac: Bump version to 0.3.1
9193
	* configure.ac: Bump version to 0.3.1
9194
272 by Scott James Remnant
0.3.0 release
9195
	* NEWS: Update.
9196
	* TODO: Update.
9197
270 by Scott James Remnant
* configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number.
9198
	* configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number.
9199
269 by Scott James Remnant
* logd/Makefile.am (event.d/logd): Make the event.d sub-directory
9200
	* logd/Makefile.am (event.d/logd): Make the event.d sub-directory
9201
	in case we're building outside of the source tree.
9202
268 by Scott James Remnant
* compat/sysv/runlevel.c (store): Don't break strict-aliasing rules
9203
	* compat/sysv/runlevel.c (store): Don't break strict-aliasing rules
9204
	by avoiding dereferencing type-punned pointer.  Answers on a
9205
	postcard, please.
9206
257 by Scott James Remnant
* logd/main.c (main): Correct help text to describe the options,
9207
2006-10-13  Scott James Remnant  <scott@netsplit.com>
9208
267 by Scott James Remnant
* util/initctl.c (start_action, emit_action): Add missing \n
9209
	* util/initctl.c (start_action, emit_action): Add missing \n
9210
266 by Scott James Remnant
* util/initctl.c: Rewrite using nih_command_parser.
9211
	* util/initctl.c: Rewrite using nih_command_parser.
9212
	* util/man/initctl.8: Improve.
9213
9214
	* util/start.c: Remove, replaced by initctl.
9215
	* util/man/start.8: Remove, replaced by initctl.
9216
	* util/Makefile.am (sbin_PROGRAMS): Drop start, now just a symlink
9217
	to initctl.
9218
	(dist_man_MANS): Drop start.8, now a symlink to initctl.8
9219
	(install-exec-hook): Make symlinks to initctl, add start
9220
	(install-data-hook): Make symlinks to initctl.8, add start.8
9221
265 by Scott James Remnant
* initctl: Rename to util again, I don't want a separate directory
9222
	* initctl: Rename to util again, I don't want a separate directory
9223
	for every single little tool; and we'll be shipping more than just
9224
	initctl (e.g. a non-compat reboot).
9225
	* configure.ac (AC_CONFIG_FILES): Make util/Makefile instead of
9226
	initctl/Makefile.
9227
	* Makefile.am (SUBDIRS): Descend into util, not initctl.
9228
264 by Scott James Remnant
* compat/sysv/reboot.c: Remove long options where they didn't exist
9229
	* compat/sysv/reboot.c: Remove long options where they didn't exist
9230
	before.  Write help text.
9231
	* compat/sysv/man/reboot.8: Update.
9232
263 by Scott James Remnant
* init/main.c (main): Formatting.
9233
	* init/main.c (main): Formatting.
9234
	* logd/main.c (main): Formatting.
9235
	* logd/man/logd.8: Formatting.
9236
	* compat/sysv/runlevel.c (main): Formatting.
9237
	* compat/sysv/telinit.c (main): Formatting.
9238
	* compat/sysv/man/shutdown.8: Remove long options.
9239
262 by Scott James Remnant
* compat/sysv/shutdown.c: Remove -e/--event, it has no place in a
9240
	* compat/sysv/shutdown.c: Remove -e/--event, it has no place in a
9241
	compatibility tool.  Get rid of long options that never existed
9242
	before.  Specify help text to describe the options.
9243
	* compat/sysv/man/shutdown.8: Spruce up a bit.
9244
261 by Scott James Remnant
* compat/sysv/telinit.c (main): Set help text to list the valid
9245
	* compat/sysv/telinit.c (main): Set help text to list the valid
9246
	runlevels.
9247
	* compat/sysv/man/telinit.8: Refine the notes to mention runlevel(8).
9248
260 by Scott James Remnant
* compat/sysv/runlevel.c (main): Make the help text describe the
9249
	* compat/sysv/runlevel.c (main): Make the help text describe the
9250
	options, rather than the behaviour.
261 by Scott James Remnant
* compat/sysv/telinit.c (main): Set help text to list the valid
9251
	* compat/sysv/man/runlevel.8: Flesh out a little more.
260 by Scott James Remnant
* compat/sysv/runlevel.c (main): Make the help text describe the
9252
259 by Scott James Remnant
* configure.ac (AC_INIT): Change bug reporting address to the
9253
	* configure.ac (AC_INIT): Change bug reporting address to the
9254
	mailing list, since Launchpad doesn't accept random bugs without
9255
	accounts and complicated control messages.
9256
	* init/main.c, logd/main.c: Add a period to the synopsis.
9257
258 by Scott James Remnant
* init/main.c (main): Set the synopsis, and direct people to look
9258
	* init/main.c (main): Set the synopsis, and direct people to look
9259
	at telinit in the --help output.
9260
	* init/man/init.8: Flesh this out a little more, still a lot of
9261
	explaining to do about jobs and events, but we'll wait until we've
9262
	changed that code before documentating the behaviour.
9263
257 by Scott James Remnant
* logd/main.c (main): Correct help text to describe the options,
9264
	* logd/main.c (main): Correct help text to describe the options,
9265
	rather than what the program does.  As per standard style.
9266
	Don't become a daemon until the logging socket is open, and make
9267
	that exclusive with waiting for SIGCONT.
9268
	* logd/man/logd.8: Write some more extensive documentation,
9269
	including describing the startup interlock and the socket protocol.
9270
	* TODO: Plan to get rid of the signal interlock from  logd.
9271
256 by Scott James Remnant
* configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so
9272
2006-10-12  Scott James Remnant  <scott@netsplit.com>
9273
9274
	* configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so
9275
	that gettext doesn't complain.
9276
	(AM_GNU_GETTEXT_VERSION): Increase to 0.15
9277
	(AC_PREREQ): Increase to 2.60
9278
	* HACKING: Update autoconf and gettext requirements.
9279
246 by Scott James Remnant
* HACKING: Detail function documentation requirement and format.
9280
2006-10-11  Scott James Remnant  <scott@netsplit.com>
9281
255 by Scott James Remnant
* init/control.c (control_init): Pass NULL to nih_list_new.
9282
	* init/control.c (control_init): Pass NULL to nih_list_new.
9283
	Clarify list item types.
9284
	* init/event.c (event_init): Pass NULL to nih_list_new.
9285
	* init/job.c (job_init): Pass NULL to nih_list_new.
9286
254 by Scott James Remnant
* init/main.c: Change nih_signal_add_callback to nih_signal_add_handler
9287
	* init/main.c: Change nih_signal_add_callback to nih_signal_add_handler
9288
	and NihSignalCb to NihSignalHandler.
9289
253 by Scott James Remnant
* init/cfgfile.c, init/cfgfile.h, init/control.c, init/control.h,
9290
	* init/cfgfile.c, init/cfgfile.h, init/control.c, init/control.h,
9291
	init/event.c, init/event.h, init/job.c, init/job.h, init/main.c,
9292
	init/process.c: Clean up documentation strings and parent pointer
9293
	types.
9294
252 by Scott James Remnant
* compat/sysv/shutdown.c: Change nih_signal_add_callback to
9295
	* compat/sysv/shutdown.c: Change nih_signal_add_callback to
9296
	nih_signal_add_handler.
9297
251 by Scott James Remnant
* compat/sysv/reboot.c: Set synopsis text depending on command
9298
	* compat/sysv/reboot.c: Set synopsis text depending on command
9299
	used (probably should use nih_command_parser?)
9300
	* compat/sysv/runlevel.c: Set synopsis and help text, and correct
9301
	usage.
9302
	* compat/sysv/shutdown.c: Set synopsis text.
9303
	* compat/sysv/telinit.c: Set synopsis text.
9304
250 by Scott James Remnant
* compat/sysv/runlevel.c, compat/sysv/shutdown.c: Clean up
9305
	* compat/sysv/runlevel.c, compat/sysv/shutdown.c: Clean up
9306
	documentation strings.
9307
249 by Scott James Remnant
* logd/main.c: Set synopsis and help text.
9308
	* logd/main.c: Set synopsis and help text.
9309
248 by Scott James Remnant
* logd/main.c: Clean up documentation strings.
9310
	* logd/main.c: Clean up documentation strings.
9311
	Change nih_signal_add_callback to nih_signal_add_handler.
9312
247 by Scott James Remnant
* upstart/control.c, upstart/control.h, upstart/job.c: Clean up
9313
	* upstart/control.c, upstart/control.h, upstart/job.c: Clean up
9314
	documentation strings and correct parent pointer type.
9315
246 by Scott James Remnant
* HACKING: Detail function documentation requirement and format.
9316
	* HACKING: Detail function documentation requirement and format.
9317
244 by Scott James Remnant
* configure.ac: Check for --enable-compat, default to sysv if given
9318
2006-10-10  Scott James Remnant  <scott@netsplit.com>
9319
245 by Scott James Remnant
* event.d/logd.in: Move to logd/event.d
9320
	* event.d/logd.in: Move to logd/event.d
9321
	* event.d/Makefile.am: Remove
9322
	* logd/Makefile.am: Create the logd job definition and install
9323
	* Makefile.am (SUBDIRS): event.d directory has been removed.
9324
	* configure.ac (AC_CONFIG_FILES): No longer make event.d/Makefile
9325
244 by Scott James Remnant
* configure.ac: Check for --enable-compat, default to sysv if given
9326
	* configure.ac: Check for --enable-compat, default to sysv if given
9327
	or no compat if not given.
9328
	* compat/sysv/Makefile.am: Don't build binaries or install manpages
9329
	unless COMPAT_SYSV is defined.
9330
243 by Scott James Remnant
* doc/upstart-logo.svg: Include the logo Alexandre designed.
9331
2006-10-06  Scott James Remnant  <scott@netsplit.com>
9332
9333
	* doc/upstart-logo.svg: Include the logo Alexandre designed.
9334
	* doc/Makefile.am (EXTRA_DIST): Ship the logo in the tarball.
9335
	* Makefile.am (SUBDIRS): Install under doc
9336
	* configure.ac: Generate doc/Makefile
9337
	* AUTHORS: Ensure he's credited fully.
9338
237 by Scott James Remnant
* configure.ac: Replace macros with single call to NIH_INIT.
9339
2006-09-27  Scott James Remnant  <scott@netsplit.com>
9340
242 by Scott James Remnant
* event.d/Makefile.am (do_subst): Eliminate duplicate /s
9341
	* event.d/Makefile.am (do_subst): Eliminate duplicate /s
9342
241 by Scott James Remnant
* man/init.8: Move to init/man
9343
	* man/init.8: Move to init/man
9344
	* init/Makefile.am: Update to install man page.
9345
	* man/logd.8: Move to logd/man
9346
	* logd/Makefile.am: Update to install man page.
9347
	* man/initctl.8, man/start.8: Move to initctl/man
9348
	* initctl/Makefile.am: Update to install man pages.
9349
	* man/reboot.8, man/runlevel.8, man/shutdown.8, man/telinit.8:
9350
	Move to compat/sysv/man
9351
	* compat/sysv/Makefile.am: Update to install man pages.
9352
	* man/Makefile.am: Remove
9353
	* configure.ac (AC_CONFIG_FILES): Remove man/Makefile
9354
	* Makefile.am (SUBDIRS): Don't build in man
9355
239 by Scott James Remnant
* util: Rename to initctl
9356
	* util: Rename to initctl
9357
	* configure.ac (AC_CONFIG_FILES): Update.
9358
	* Makefile.am (SUBDIRS): Update.
9359
238 by Scott James Remnant
* util/reboot.c: Move to compat/sysv
9360
	* util/reboot.c: Move to compat/sysv
9361
	* util/shutdown.c: Move to compat/sysv
9362
	* util/Makefile.am: Update.
9363
	* compat/sysv/Makefile.am: Update.
9364
237 by Scott James Remnant
* configure.ac: Replace macros with single call to NIH_INIT.
9365
	* configure.ac: Replace macros with single call to NIH_INIT.
9366
	Bump version to 0.3.0 to begin new development cycle.
9367
236 by Scott James Remnant
* logd/main.c: Revert the change that logged to the console, in
9368
2006-09-21  Scott James Remnant  <scott@netsplit.com>
9369
9370
	* logd/main.c: Revert the change that logged to the console, in
9371
	practice this doesn't work so well.  I want to get rid of logd
9372
	in the long term, or at least just have it as a simple logging
9373
	proxy, so giving it features seems wrong.
9374
232 by Scott James Remnant
* man/Makefile.am (dist_man_MANS): Drop sulogin.8
9375
2006-09-20  Scott James Remnant  <scott@netsplit.com>
9376
235 by Scott James Remnant
* configure.ac: Bump version to 0.2.8
9377
	* configure.ac: Bump version to 0.2.8
9378
	* NEWS: Updated.
9379
233 by Scott James Remnant
* logd/main.c (main): Check the kernel command-line for "quiet"
9380
	* logd/main.c (main): Check the kernel command-line for "quiet"
9381
	(line_reader): Write to console unless silent or a daemon
9382
232 by Scott James Remnant
* man/Makefile.am (dist_man_MANS): Drop sulogin.8
9383
	* man/Makefile.am (dist_man_MANS): Drop sulogin.8
9384
	* man/sulogin.8: Drop, we don't include an sulogin
9385
231 by Scott James Remnant
* event.d/Makefile.am (logd): Drop $(srcdir)
9386
2006-09-19  Michael Biebl  <mbiebl@gmail.com>
9387
9388
	* event.d/Makefile.am (logd): Drop $(srcdir)
9389
	* init/Makefile.am (init_SOURCES): Distribute paths.h
9390
230 by Scott James Remnant
* configure.ac: Check for sys/inotify.h
9391
2006-09-18  Michael Biebl  <mbiebl@gmail.com>
9392
9393
	* configure.ac: Check for sys/inotify.h
9394
229 by Scott James Remnant
* util/shutdown.c (warning_message): Adjust method of constructing
9395
2006-09-18  Scott James Remnant  <scott@netsplit.com>
9396
9397
	* util/shutdown.c (warning_message): Adjust method of constructing
9398
	the message to not confuse poor translators who think \r and \n are
9399
	the same thing!
9400
223 by Scott James Remnant
* configure.ac: Bump version to 0.2.7
9401
2006-09-14  Scott James Remnant  <scott@netsplit.com>
9402
228 by Scott James Remnant
* init/job.c (job_change_state): Catch runaway respawns when we
9403
	* init/job.c (job_change_state): Catch runaway respawns when we
9404
	enter the running state, so we catch stop/start loops too.
9405
	* init/tests/test_job.c (test_change_state): Update test.
9406
227 by Scott James Remnant
* event.d/logd: Rename to logd.in
9407
	* event.d/logd: Rename to logd.in
9408
	* event.d/logd.in: Replace /sbin with @sbindir@ so we can transform
9409
	* event.d/Makefile.am: Generate logd from logd.in
9410
225 by Scott James Remnant
* util/reboot.c: Don't hardcode the location of /sbin/shutdown
9411
	* util/reboot.c: Don't hardcode the location of /sbin/shutdown
9412
	* util/Makefile.am (DEFS): Use autoconf to seed it
9413
	* util/shutdown.c (sysvinit_shutdown): Don't hardcode the location
9414
	of /dev/initctl
9415
224 by Scott James Remnant
* init/paths.h: Create a new configuration file that can contain
9416
	* init/paths.h: Create a new configuration file that can contain
9417
	all of the path definitions, and in particular, allow them to be
9418
	overidden elsewhere.
9419
	* init/Makefile.am (DEFS): Override definitions of CFG_DIR and
9420
	TELINIT using autoconf
9421
	* init/main.c: Include paths.h.  Don't hardcode location of telinit
9422
	* init/job.c: Include paths.h
9423
	* init/process.c: Include paths.h
9424
	* init/process.h: Remove definitions from here.
9425
223 by Scott James Remnant
* configure.ac: Bump version to 0.2.7
9426
	* configure.ac: Bump version to 0.2.7
9427
221 by Scott James Remnant
* TODO: More TODO.
9428
2006-09-13  Scott James Remnant  <scott@netsplit.com>
9429
222 by Scott James Remnant
* NEWS: Updated.
9430
	* NEWS: Updated.
9431
221 by Scott James Remnant
* TODO: More TODO.
9432
	* TODO: More TODO.
9433
220 by Scott James Remnant
* util/reboot.c (main): Don't give -H with "halt".
9434
2006-09-10  Scott James Remnant  <scott@netsplit.com>
9435
9436
	* util/reboot.c (main): Don't give -H with "halt".
9437
205 by Scott James Remnant
* logd/main.c: Implement the logging daemon, it accepts connections
9438
2006-09-09  Scott James Remnant  <scott@netsplit.com>
9439
219 by Scott James Remnant
* configure.ac: Bump version to 0.2.6
9440
	* configure.ac: Bump version to 0.2.6
9441
218 by Scott James Remnant
* NEWS: Update.
9442
	* NEWS: Update.
9443
	* TODO: Update.
9444
217 by Scott James Remnant
* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
9445
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
9446
	the magic to be the package string.
9447
	* upstart/tests/test_control.c (test_recv_msg): Update tests.
9448
216 by Scott James Remnant
* util/initctl.c (main): Set the usage string.
9449
	* util/initctl.c (main): Set the usage string.
9450
	* util/shutdown.c (main): Set the usage string.
9451
	* util/start.c (main): Set the usage string.
9452
	* compat/sysv/runlevel.c (main): Set the usage string.
9453
	* compat/sysv/telinit.c (main): Set the usage string.
9454
215 by Scott James Remnant
* man/Makefile.am: Use install-data-hook and $(man8dir)
9455
	* man/Makefile.am: Use install-data-hook and $(man8dir)
9456
	* util/Makefile.am: Also use install-exec-hook
9457
214 by Scott James Remnant
* Makefile.am (SUBDIRS): Install contents of the man directory
9458
	* Makefile.am (SUBDIRS): Install contents of the man directory
9459
	* configure.ac (AC_CONFIG_FILES): Generate man/Makefile
9460
	* man/Makefile.am: Install manpages in the appropriate places.
9461
	* man/init.8, man/logd.8, man/initctl.8, man/reboot.8,
9462
	* man/shutdown.8, man/start.8, man/sulogin.8, man/runlevel.8,
9463
	* man/telinit.8: Include some basic manpages so we at least have
9464
	some level of documentation.
9465
213 by Scott James Remnant
* init/job.c (job_child_reaper): Don't check the exit status of
9466
	* init/job.c (job_child_reaper): Don't check the exit status of
9467
	a respawning job if the goal is to stop it.
9468
212 by Scott James Remnant
* compat/sysv/telinit.c (main): Generate events rather than
9469
	* compat/sysv/telinit.c (main): Generate events rather than
9470
	starting and stopping jobs directly, the events are named
9471
	"runlevel-X".  0, 1, 6 and s/S are shutdown events.
9472
211 by Scott James Remnant
* logd/main.c (main): Raise SIGSTOP before entering the main loop.
9473
	* logd/main.c (main): Raise SIGSTOP before entering the main loop.
9474
	* init/main.c (main): Interlock with logd.
9475
210 by Scott James Remnant
* event.d/logd: Should not be a console owner, but should stop
9476
	* event.d/logd: Should not be a console owner, but should stop
9477
	on shutdown.
9478
209 by Scott James Remnant
* init/process.c (process_setup_console): Revert part of the previous
9479
	* init/process.c (process_setup_console): Revert part of the previous
9480
	change, should just output to /dev/null if we don't have logd.
9481
208 by Scott James Remnant
* configure.ac: Bump version to 0.2.5
9482
	* configure.ac: Bump version to 0.2.5
9483
207 by Scott James Remnant
* init/main.c (main): Start the logd job if it exists.
9484
	* init/main.c (main): Start the logd job if it exists.
9485
9486
	* init/process.c (process_setup_console): Ignore ECONNREFUSED as
9487
	that just means that logd isn't around, handle errors by falling
9488
	back to opening the console.
9489
206 by Scott James Remnant
* init/process.c (process_setup_console): Implement handling for
9490
	* init/process.c (process_setup_console): Implement handling for
9491
	CONSOLE_LOGGED and generally clean up the other handling.
9492
	* init/process.h: Update.
9493
	* init/main.c (main): Pass NULL for the job to setup console.
9494
	* TODO: Update.
9495
205 by Scott James Remnant
* logd/main.c: Implement the logging daemon, it accepts connections
9496
	* logd/main.c: Implement the logging daemon, it accepts connections
9497
	on a unix stream socket with the abstract name
9498
	"/com/ubuntu/upstart/logd", expects the length of the name and the
9499
	name to follow; then sequences of lines which are logged to
9500
	/var/log/boot, or memory until that file can be opened.
9501
201 by Scott James Remnant
* logd/main.c (main): Add the code to daemonise, etc.
9502
2006-09-08  Scott James Remnant  <scott@netsplit.com>
9503
204 by Scott James Remnant
* util/shutdown.c (event_setter): Change the event names to
9504
	* util/shutdown.c (event_setter): Change the event names to
9505
	distinguish between "shutdown -h" and "shutdown -h -H".
9506
203 by Scott James Remnant
* init/job.c (job_handle_event): Allow jobs to react to their own
9507
	* init/job.c (job_handle_event): Allow jobs to react to their own
9508
	events, this is how we'll do respawn eventually.
9509
	* init/tests/test_job.c (test_handle_event): Remove test.
9510
202 by Scott James Remnant
* init/main.c (cad_handler, kbd_handler): Generate the new event
9511
	* init/main.c (cad_handler, kbd_handler): Generate the new event
9512
	names.
9513
	* init/event.h (CTRLALTDEL_EVENT, KBDREQUEST_EVENT): Add definitions
9514
	of these event names, change the ctrlaltdel event to just that.
9515
201 by Scott James Remnant
* logd/main.c (main): Add the code to daemonise, etc.
9516
	* logd/main.c (main): Add the code to daemonise, etc.
9517
194 by Scott James Remnant
* compat/sysv/telinit.c (main): Send a shutdown command when
9518
2006-09-07  Scott James Remnant  <scott@netsplit.com>
9519
200 by Scott James Remnant
* TODO: Long discussion today on #upstart, many improvements to the
9520
	* TODO: Long discussion today on #upstart, many improvements to the
9521
	job and event model that make it more elegant.
9522
	* AUTHORS: Include a list of thanks.
9523
199 by Scott James Remnant
* util/shutdown.c (shutdown_now): If we get ECONNREFUSED when we
9524
	* util/shutdown.c (shutdown_now): If we get ECONNREFUSED when we
9525
	try and send the shutdown event to init, it probably means we're
9526
	still in sysvinit.  So try that instead.
9527
	(sysvinit_shutdown): Function to send a hand-crafted runlevel
9528
	change message across /dev/initctl.
9529
198 by Scott James Remnant
* util/initctl.c (main): Add a shutdown command that takes an
9530
	* util/initctl.c (main): Add a shutdown command that takes an
9531
	arbitrary event name to be issued after "shutdown".  You'll
9532
	nearly always want the /sbin/shutdown tool instead.
9533
197 by Scott James Remnant
* init/job.c (job_detect_idle): Only generate the stalled event
9534
	* init/job.c (job_detect_idle): Only generate the stalled event
9535
	if at least one job handles it in its start_events list.
9536
	* init/tests/test_job.c (test_detect_idle): Make sure that works.
9537
196 by Scott James Remnant
* init/event.h (STARTUP_EVENT, SHUTDOWN_EVENT, STALLED_EVENT):
9538
	* init/event.h (STARTUP_EVENT, SHUTDOWN_EVENT, STALLED_EVENT):
9539
	Macros to define the standard event names.
9540
	* init/main.c (main): Use STARTUP_EVENT macro instead of "startup"
9541
	* init/control.c (control_handle): Use SHUTDOWN_EVENT macro
9542
	instead of "shutdown".
9543
	* init/job.c (job_detect_idle): Use STALLED_EVENT macro instead
9544
	of "stalled".
9545
195 by Scott James Remnant
* init/job.c (job_detect_idle): Add some log messages for when we
9546
	* init/job.c (job_detect_idle): Add some log messages for when we
9547
	detect the idle or stalled states.
9548
	(job_kill_process, job_kill_timer): Increase log verbosity.
9549
	* init/event.c (event_queue_run): Log which events we're handling
9550
	if --debug is given.
9551
194 by Scott James Remnant
* compat/sysv/telinit.c (main): Send a shutdown command when
9552
	* compat/sysv/telinit.c (main): Send a shutdown command when
9553
	requesting to enter runlevel 0 or runlevel 6, likewise for
9554
	runlevel 1, s or S which all run "rc1" not "rcS".
9555
	* init/main.c (main): When called directory (pid != 1) try and
9556
	run telinit before complaining that we're not init.  Make sure
9557
	errors aren't lost.
9558
193 by Scott James Remnant
* upstart/control.c (upstart_addr): Replace use of __builtin_offsetof
9559
2006-09-04  Johan Kiviniemi  <johan@kiviniemi.name>
9560
9561
	* upstart/control.c (upstart_addr): Replace use of __builtin_offsetof
9562
	with offsetof.
9563
	* upstart/tests/test_control.c (test_recv_msg): Likewise.
9564
192 by Scott James Remnant
* util/shutdown.c (main): Exit normally after sending the warning
9565
2006-09-04  Scott James Remnant  <scott@netsplit.com>
193 by Scott James Remnant
* upstart/control.c (upstart_addr): Replace use of __builtin_offsetof
9566
	
192 by Scott James Remnant
* util/shutdown.c (main): Exit normally after sending the warning
9567
	* util/shutdown.c (main): Exit normally after sending the warning
9568
	message if -k is given.
9569
179 by Scott James Remnant
* upstart/job.c (job_goal_from_name, job_state_from_name)
9570
2006-09-01  Scott James Remnant  <scott@netsplit.com>
9571
191 by Scott James Remnant
* configure.ac: Bump version to 0.2.2
9572
	* configure.ac: Bump version to 0.2.2
9573
190 by Scott James Remnant
* NEWS: Update.
9574
	* NEWS: Update.
9575
	* configure.ac: Bump version to 0.2.1
9576
189 by Scott James Remnant
* init/process.c (process_setup_console): Ensure that the console
9577
	* init/process.c (process_setup_console): Ensure that the console
9578
	is always initialised to at least /dev/null
9579
	* init/job.c (job_change_state): Initialise event to NULL.
9580
	* init/event.c (event_read_state): Don't mask initialisation of
9581
	other variable.
9582
	* init/cfgfile.c (cfg_job_stanza, cfg_parse_script, cfg_next_token): 
9583
	Print lineno using %zi not %d
9584
	* compat/sysv/runlevel.c (store): Cast pointer type of timeval.
9585
188 by Scott James Remnant
* init/main.c: Move the kernel headers include beneath the C
9586
	* init/main.c: Move the kernel headers include beneath the C
9587
	library ones, so that compilation doesn't fail on !i386.
9588
	* util/reboot.c: Likewise.
9589
187 by Scott James Remnant
* init/main.c (term_handler): Close the control connection if we
9590
	* init/main.c (term_handler): Close the control connection if we
9591
	re-exec init, otherwise it won't be able to bind.  Drop debugging.
9592
186 by Scott James Remnant
* init/main.c (term_handler): It always helps if we dup2 the
9593
	* init/main.c (term_handler): It always helps if we dup2 the
9594
	right file descriptor.
9595
185 by Scott James Remnant
* init/main.c: Use the TERM signal instead of USR1, as old init
9596
	* init/main.c: Use the TERM signal instead of USR1, as old init
9597
	used that for something else.  Also rather than passing across
9598
	file descriptor numbers, use a fixed descriptor and just pass
9599
	"--restart".  When we get that option we need to unmask signals
9600
	otherwise we sit there looking like a lemon.
9601
184 by Scott James Remnant
* init/job.c (job_change_state): Don't free the event unless we
9602
	* init/job.c (job_change_state): Don't free the event unless we
9603
	generate one.
9604
183 by Scott James Remnant
* NEWS: Update.
9605
	* NEWS: Update.
9606
182 by Scott James Remnant
* init/cfgfile.c (cfg_watcher): Ignore any file with '.' or '~'
9607
	* init/cfgfile.c (cfg_watcher): Ignore any file with '.' or '~'
9608
181 by Scott James Remnant
* TODO: Update.
9609
	* TODO: Update.
9610
180 by Scott James Remnant
* init/main.c (main): Parse command-line arguments, specifically
9611
	* init/main.c (main): Parse command-line arguments, specifically
9612
	look for --state-fd which we'll use for reexec.  Don't do a couple
9613
	of things if we're passed this.
9614
	(read_state): Parse the line-buffered state.
9615
	* init/job.c (job_read_state, job_write_state): Job state
9616
	serialisation so that we can re-exec ourselves.
9617
	* init/job.h: Update.
9618
	* init/tests/test_job.c: Test the serialisation.
9619
	* init/event.c (event_read_state, event_write_state): And similar
9620
	functions for serialising the event queue.
9621
	* init/event.h: Update.
9622
	* init/tests/test_event.c: Test the serialisation.
9623
	* init/cfgfile.c (cfg_read_job): Fix a bug, need to subtract current
9624
	time to get due time.
9625
179 by Scott James Remnant
* upstart/job.c (job_goal_from_name, job_state_from_name)
9626
	* upstart/job.c (job_goal_from_name, job_state_from_name) 
9627
	(process_state_from_name): Add opposite numbers that convert a
9628
	string back into an enumeration.
9629
	* upstart/job.h: Update.
9630
	* upstart/tests/test_job.c: Test the new functions.
9631
155 by Scott James Remnant
* util/shutdown.c: Adjust so that the warning message is sent out
9632
2006-08-31  Scott James Remnant  <scott@netsplit.com>
182 by Scott James Remnant
* init/cfgfile.c (cfg_watcher): Ignore any file with '.' or '~'
9633
178 by Scott James Remnant
* init/job.h (Job): Add respawn_limit, respawn_interval,
9634
	* init/job.h (Job): Add respawn_limit, respawn_interval,
9635
	respawn_count and respawn_time members so that we can keep track of
9636
	runaway processes.
9637
	* init/job.c (job_catch_runaway): Increment the respawn_count
9638
	within respawn_interval, or reset it if we go over.
9639
	(job_new): Initialise respawn_limit and respawn_interval to sensible
9640
	defaults.
9641
	* init/tests/test_job.c (test_new): Check the defaults are set.
9642
	(test_change_state): Check the respawning code works.
9643
	* init/cfgfile.c (cfg_job_stanza): Parse the "respawn limit" stanza.
9644
	* init/tests/test_cfgfile.c (test_read_job): Test the new stanza.
9645
176 by Scott James Remnant
* init/process.c (process_setup_console): Remove the console reset
9646
	* init/process.c (process_setup_console): Remove the console reset
9647
	code, it tends to just crash X and seems to do nothing interesting.
9648
	* init/main.c (reset_console): Instead put it here and just do it
9649
	on startup.
9650
175 by Scott James Remnant
* configure.ac: Bump version to 0.2.0
9651
	* configure.ac: Bump version to 0.2.0
9652
174 by Scott James Remnant
* util/Makefile.am (install-exec-local): Create symbolic links,
9653
	* util/Makefile.am (install-exec-local): Create symbolic links,
9654
	not hard links.
9655
173 by Scott James Remnant
* init/main.c: Can't catch STOP.
9656
	* init/main.c: Can't catch STOP.
9657
172 by Scott James Remnant
* util/reboot.c: Pause init while shutting down or rebooting.
9658
	* util/reboot.c: Pause init while shutting down or rebooting.
9659
171 by Scott James Remnant
* init/main.c (stop_handler): Catch STOP/TSTP and CONT.
9660
	* init/main.c (stop_handler): Catch STOP/TSTP and CONT.
9661
	* init/event.c (event_queue_run): Don't run the event queue while
9662
	paused.
9663
	* init/job.c (job_detect_idle): Don't detect idle jobs while paused.
9664
170 by Scott James Remnant
* util/reboot.c: if we get the -w argument ("only write to wtmp")
9665
	* util/reboot.c: if we get the -w argument ("only write to wtmp")
9666
	we need to exit, and not behave as halt normally would.
9667
169 by Scott James Remnant
* compat/sysv/runlevel.c (main): Add missing newline.
9668
	* compat/sysv/runlevel.c (main): Add missing newline.
9669
	* compat/sysv/telinit.c (main): And here too.
9670
167 by Scott James Remnant
* init/main.c (main): Check for idle after the startup event queue
9671
	* init/main.c (main): Check for idle after the startup event queue
9672
	has been run, otherwise we may just sit there.
9673
166 by Scott James Remnant
* compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install telinit
9674
	* compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install telinit
9675
	(telinit_SOURCES, telinit_LDFLAGS, telinit_LDADD): Details for
9676
	telinit binary.
9677
	* compat/sysv/telinit.c: Trivial telinit program that just runs
9678
	the appropriate rcX job.
9679
	* compat/sysv/runlevel.c (main): Suggest help on illegal runlevel.
9680
165 by Scott James Remnant
* util/Makefile.am: Tidy up.
9681
	* util/Makefile.am: Tidy up.
9682
164 by Scott James Remnant
* configure.ac (AC_CONFIG_FILES): Create compat/sysv/Makefile
9683
	* configure.ac (AC_CONFIG_FILES): Create compat/sysv/Makefile
9684
	* Makefile.am (SUBDIRS): Build things found in compat/sysv
9685
	* compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install runlevel
9686
	(runlevel_SOURCES, runlevel_LDFLAGS, runlevel_LDADD): Details for
9687
	runlevel binary.
9688
	* compat/sysv/runlevel.c: Helper to store and retrieve the current
9689
	"runlevel" from utmp/wtmp; as well as the reboot time.
9690
163 by Scott James Remnant
* init/main.c (main): Drop debugging set.
9691
	* init/main.c (main): Drop debugging set.
9692
162 by Scott James Remnant
* init/job.c (job_change_state): As well as the job/state events,
9693
	* init/job.c (job_change_state): As well as the job/state events,
9694
	send the job event when a service is running or a task is stopping.
9695
	* init/tests/test_job.c (test_change_state): Check the events get
9696
	sent properly.
9697
161 by Scott James Remnant
* util/start.c: Write a simple utility to start, stop, or query
9698
	* util/start.c: Write a simple utility to start, stop, or query
9699
	the status of the named jobs.
9700
	* util/Makefile.am (sbin_PROGRAMS): Build and install start
9701
	(start_SOURCES, start_LDFLAGS, start_LDADD): Details for start
9702
	(install-exec-local): Also install as stop and status.
9703
	* util/reboot.c (main): Drop the debugging set.
9704
160 by Scott James Remnant
* init/cfgfile.c (cfg_job_stanza): Correct nih_alloc error.
9705
	* init/cfgfile.c (cfg_job_stanza): Correct nih_alloc error.
9706
159 by Scott James Remnant
* init/process.c (process_setup_environment): Guard memory alloc.
9707
	* init/process.c (process_setup_environment): Guard memory alloc.
9708
	* init/job.c (job_set_idle_event): Likewise.
9709
	(job_change_state): And here too.
9710
	(job_run_command): Likewise.
9711
	* init/control.c (control_send): Likewise.
9712
	* init/cfgfile.c: And throughout this file.
9713
	* upstart/control.c (upstart_recv_msg): And once here too.
9714
158 by Scott James Remnant
* upstart/control.h: Abolish the separate halt, reboot and poweroff
9715
	* upstart/control.h: Abolish the separate halt, reboot and poweroff
9716
	messages and replace with a single shutdown message that takes
9717
	an event name (for the idle event issued afterwards).
9718
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
9719
	the new shutdown event type by just treating it as an event.
9720
	* upstart/tests/test_control.c (test_messages): Update tests.
9721
	* init/job.c (job_set_idle_event): Store a copy of the idle event
9722
	name.
9723
	* init/control.c (control_send): Copy the shutdown event name.
9724
	(control_handle): Replace individual handling with the new
9725
	single event.
9726
	* init/tests/test_control.c (test_watcher): Update.
9727
	* util/initctl.c: Drop handling for things that shutdown does now.
9728
	* util/shutdown.c: Send the UPSTART_SHUTDOWN event and let the user
9729
	specify anything they want, just give defaults.
9730
157 by Scott James Remnant
This is quite a big change and abolishes level events entirely,
9731
	This is quite a big change and abolishes level events entirely,
9732
	along with the event history.  We now just treat events as a
9733
	transient queue of strings that go past, may cause things to change,
9734
	but are otherwise forgotten.  This turns out to be much easier to
9735
	understand and has no real loss of power.
9736
9737
	* init/event.c: Vastly simplify; gone are the separate notions of
9738
	edge and level events, instead we just treat them as one-shot
9739
	things that go past and are forgotten about.
9740
	* init/event.h (Event): Remove value member.
9741
	Update prototypes.
9742
	* init/tests/test_event.c: Update.
9743
	* init/job.c (job_change_state): Change the event pattern to be
9744
	one that includes the job name and a description of the transition
9745
	instead of the new state.
9746
	(job_detect_idle): Call event_queue rather than event_queue_edge.
9747
	* init/tests/test_job.c: Update.
9748
	* init/cfgfile.c (cfg_job_stanza): Drop "when" and "while".
9749
	* init/tests/test_cfgfile.c (test_read_job): Drop mentions of
9750
	"when" and "while".
9751
	* init/control.c (control_send, control_handle): Drop cases for
9752
	level events.
9753
	(control_handle_event): Don't include a level in the event.
9754
	* init/tests/test_control.c: Update
9755
	* init/main.c: Call event_queue rather than event_queue_edge.
9756
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
9757
	event handling so that only a name is read.
9758
	* upstart/control.h: Remove value/level event structures.
9759
	* upstart/tests/test_control.c (test_messages): Update.
9760
	* upstart/job.c (process_state_name): Not used for events, adjust
9761
	documentation so it doesn't lie.
9762
	* util/initctl.c (main): Drop the set function, simplify trigger.
9763
	* util/shutdown.c (shutdown_now): Call UPSTART_EVENT_QUEUE for
9764
	shutdown into maintenance mode.
9765
156 by Scott James Remnant
* init/control.c (control_handle): Place a message in the syslog
9766
	* init/control.c (control_handle): Place a message in the syslog
9767
	before halting, powering off or rebooting.
9768
155 by Scott James Remnant
* util/shutdown.c: Adjust so that the warning message is sent out
9769
	* util/shutdown.c: Adjust so that the warning message is sent out
9770
	if shutdown is immediate, and when it actually happens.  Include
9771
	the hostname as wall does.
9772
149 by Scott James Remnant
* util/reboot.c: Implement reboot/halt/poweroff utility.
9773
2006-08-30  Scott James Remnant  <scott@netsplit.com>
9774
154 by Scott James Remnant
* TODO: Update.
9775
	* TODO: Update.
9776
153 by Scott James Remnant
* util/shutdown.c: Implement shutdown utility along the same lines
9777
	* util/shutdown.c: Implement shutdown utility along the same lines
9778
	as the sysvinit one, but with rather different code.
9779
152 by Scott James Remnant
* util/initctl.c (main): Call setuid on the effective user id so
9780
	* util/initctl.c (main): Call setuid on the effective user id so
9781
	that we can be made setuid root and executable by a special group.
9782
	* util/reboot.c (main): Likewise.
9783
150 by Scott James Remnant
* util/initctl.c (main): Check the effective rather than the real
9784
	* util/initctl.c (main): Check the effective rather than the real
9785
	user id, if we're effectively root, that's good enough.
9786
149 by Scott James Remnant
* util/reboot.c: Implement reboot/halt/poweroff utility.
9787
	* util/reboot.c: Implement reboot/halt/poweroff utility.
9788
	* util/Makefile.am (sbin_PROGRAMS): Build and install reboot
9789
	(reboot_SOURCES, reboot_LDFLAGS, reboot_LDADD): Details for reboot
9790
	(install-exec-local): Create hardlinks to reboot for halt and poweroff.
9791
148 by Scott James Remnant
* init/main.c (main): Actually run the idle-detect function.
9792
2006-08-29  Scott James Remnant  <scott@netsplit.com>
9793
9794
	* init/main.c (main): Actually run the idle-detect function.
9795
	* init/job.c (job_detect_idle): Interrupt the main loop, otherwise
9796
	we may end up waiting for a signal before we process the event
9797
	we just issued.
9798
135 by Scott James Remnant
* init/main.c (main): Stop handling SIGTERM, we never want people
9799
2006-08-27  Scott James Remnant  <scott@netsplit.com>
9800
147 by Scott James Remnant
* util/shutdown.c: Template main function.
9801
	* util/shutdown.c: Template main function.
9802
	* util/Makefile.am (sbin_PROGRAMS): Build and install the
9803
	shutdown binary.
9804
	(shutdown_SOURCES, shutdown_LDFLAGS, shutdown_LDADD): Details for
9805
	the shutdown binary
9806
146 by Scott James Remnant
* util/initctl.c (main): Add commands for halt, poweroff and reboot.
9807
	* util/initctl.c (main): Add commands for halt, poweroff and reboot.
9808
145 by Scott James Remnant
* init/event.c (event_queue_run): Remove the parameters.
9809
	* init/event.c (event_queue_run): Remove the parameters.
9810
	* init/event.h: Update.
9811
	* init/main.c (main): Update.
9812
	* init/tests/test_control.c (test_watcher): Update.
9813
	* init/tests/test_job.c (test_detect_idle): Update.
9814
144 by Scott James Remnant
* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Deal
9815
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Deal
9816
	with halting, rebooting and powering off; or at least the appropriate
9817
	messages.
9818
	* upstart/control.h: Add control message structures for halting,
9819
	powering off and rebooting the machine.
9820
	* upstart/tests/test_control.c (test_messages): Run the tests.
9821
	* init/control.c (control_handle): Add handling for halt, power off
9822
	and reboot that issue the shutdown event and arrange for the halt,
9823
	poweroff or reboot to be issued the next time the system is idle.
9824
	* init/tests/test_control.c (test_watcher): Test the events.
9825
143 by Scott James Remnant
* TODO: Update.
9826
	* TODO: Update.
9827
142 by Scott James Remnant
* init/job.c (job_detect_idle): Function to detect when the system is
9828
	* init/job.c (job_detect_idle): Function to detect when the system is
9829
	stalled or idle.
9830
	* init/job.h: Update
9831
	* init/tests/test_job.c (test_detect_idle): Test the new function.
9832
141 by Scott James Remnant
* util/initctl.c (main): Handle the list command.
9833
	* util/initctl.c (main): Handle the list command.
9834
140 by Scott James Remnant
* TODO: Update.
9835
	* TODO: Update.
9836
139 by Scott James Remnant
* upstart/control.c (WireJobStatusPayload): add description to the
9837
	* upstart/control.c (WireJobStatusPayload): add description to the
9838
	job status payload.
9839
	(upstart_send_msg_to, upstart_recv_msg): Send and receieve the
9840
	description over the wire.
9841
	* upstart/control.h (UpstartJobStatusMsg): add a description field
9842
	* upstart/tests/test_control.c: Update test cases.
9843
	* init/control.c (control_handle): Include the job description in
9844
	the message.
9845
	(control_send): Copy the description when we put the message on
9846
	the queue.
9847
	(control_handle_job): Copy the description here too
9848
	* init/tests/test_control.c: Update test cases.
9849
138 by Scott James Remnant
* init/job.c (job_list): Add a function to return the job list.
9850
	* init/job.c (job_list): Add a function to return the job list.
9851
	* init/job.h: Update.
9852
	* init/control.c (control_handle): Handle the JOB_LIST message
9853
	by sending back a list of job status messages followed by the
9854
	JOB_LIST_END message.
9855
	* init/tests/test_control.c (test_watcher_child): Check the
9856
	JOB_LIST message works properly.
9857
137 by Scott James Remnant
* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
9858
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
9859
	the JOB_LIST and JOB_LIST_END messages which have no payload.
9860
	* upstart/control.h: Add enums and structures for job list messages.
9861
	* upstart/tests/test_control.c (test_messages): Update tests.
9862
136 by Scott James Remnant
* init/main.c (main): Check that we're both uid and process #1
9863
	* init/main.c (main): Check that we're both uid and process #1
9864
135 by Scott James Remnant
* init/main.c (main): Stop handling SIGTERM, we never want people
9865
	* init/main.c (main): Stop handling SIGTERM, we never want people
9866
	to kill init.  Handle SIGINT and SIGWINCH through the ordinary
9867
	handler and SIGSEGV through a direct handler.
9868
	(segv_handler): Write a sensible core dump handler, we use a child
9869
	to dump core while we carry on in the parent hopefully stepping over
9870
	the bad instruction.
9871
	(cad_handler): Generate the control-alt-delete event.
9872
	(kbd_handler): Generate the kbdrequest event.
9873
131 by Scott James Remnant
* NEWS: Update.
9874
2006-08-25  Scott James Remnant  <scott@netsplit.com>
9875
134 by Scott James Remnant
* configure.ac: Bump version to 0.1.2
9876
	* configure.ac: Bump version to 0.1.2
9877
	* NEWS: Update.
9878
133 by Scott James Remnant
* TODO: Update.
9879
	* TODO: Update.
9880
132 by Scott James Remnant
* init/process.c (process_setup_environment): Inherit the PATH
9881
	* init/process.c (process_setup_environment): Inherit the PATH
9882
	and TERM environment variables from the init process, so the
9883
	console works properly.
9884
	* init/process.h (PATH): Declare a default value for this variable
9885
	* init/main.c (main): Set the value of PATH to the default.
9886
	* init/tests/test_process.c (child): Update test case.
9887
131 by Scott James Remnant
* NEWS: Update.
9888
	* NEWS: Update.
9889
	* configure.ac: Bump version to 0.1.1
9890
120 by Scott James Remnant
* upstart/tests/test_control.c: Fix overwrite of buffer.
9891
2006-08-24  Scott James Remnant  <scott@netsplit.com>
9892
130 by Scott James Remnant
* init/cfgfile.h (CFG_DIR): Change configuration directory to
9893
	* init/cfgfile.h (CFG_DIR): Change configuration directory to
9894
	/etc/event.d -- it's not been used by anyone, but is similar to
9895
	other directories that have which is a good precedent.
9896
	* event.d/Makefile.am (eventdir, dist_event_DATA): Install files
9897
	into the new directory name.
9898
	* Makefile.am (SUBDIRS): Rename sub directory
9899
	* configure.ac (AC_CONFIG_FILES): Rename generated Makefile
9900
129 by Scott James Remnant
* init/Makefile.am (DEFAULT_INCLUDES): Set to include the right
9901
	* init/Makefile.am (DEFAULT_INCLUDES): Set to include the right
9902
	directories so out of tree builds work.
9903
	* logd/Makefile.am (DEFAULT_INCLUDES): Set to include the right
9904
	directories so out of tree builds work.
9905
	* upstart/Makefile.am (DEFAULT_INCLUDES): Set to include the right
9906
	directories so out of tree builds work.
9907
	(upstartinclude_HEADERS): Install errors.h
9908
	* util/Makefile.am (DEFAULT_INCLUDES): Set to include the right
9909
	directories so out of tree builds work.
9910
9911
	* Makefile.am (SUBDIRS): Add m4 to the list
9912
	* configure.ac (AC_CONFIG_FILES): Generate m4/Makefile
9913
	* upstart/Makefile.am (upstartinclude_HEADERS): Add errors.h
9914
9915
	* upstart/control.c (upstart_open): 
9916
127 by Scott James Remnant
* init/control.c (control_open): Raise the error before
9917
	* init/control.c (control_open): Raise the error before
9918
	performing other actions so errno is not lost.
9919
9920
	* TODO: Update.o
122 by Scott James Remnant
* init/cfgfile.c (cfg_next_token): Don't count quote characters
9921
	* init/cfgfile.c (cfg_next_token): Don't count quote characters
9922
	unless we're actually planning to dequote the file, otherwise we
9923
	end up allocating short.
9924
121 by Scott James Remnant
* init/control.c (control_close): Free the io_watch using list_free
9925
	* init/control.c (control_close): Free the io_watch using list_free
9926
	in case a destructor has been set.
9927
	* init/tests/test_control.c: Initialise the type of the message, and
9928
	free job correctly.
9929
120 by Scott James Remnant
* upstart/tests/test_control.c: Fix overwrite of buffer.
9930
	* upstart/tests/test_control.c: Fix overwrite of buffer.
9931
	* init/tests/test_job.c: Clean up not-freed job.
9932
118 by Scott James Remnant
* init/cfgfile.c (cfg_skip_token): Drop this function; we'll
9933
2006-08-23  Scott James Remnant  <scott@netsplit.com>
9934
119 by Scott James Remnant
* init/tests/test_event.c: free the entry allocated and initialise
9935
	* init/tests/test_event.c: free the entry allocated and initialise
9936
	the return values.
9937
118 by Scott James Remnant
* init/cfgfile.c (cfg_skip_token): Drop this function; we'll
9938
	* init/cfgfile.c (cfg_skip_token): Drop this function; we'll
9939
	make sure *pos is pointing at the start of the thing we want
9940
	to parse, not the first token.  Update the other functions
9941
	accordingly.
9942
	(cfg_read_job): Implement function to look over a job file and
9943
	parse all of the stanzas that are found.  Also sanity checks the
9944
	job afterwards and deals with reloading existing jobs.
9945
	(cfg_job_stanza): Function that parses an individual stanza,
9946
	calling out to the other parse functions; this is the main config
9947
	file parser!
9948
	(cfg_parse_args, cfg_parse_command): Drop requirement that filename
9949
	and lineno be passed, so we can be called to reparse arguments after
9950
	we've already done so.
9951
	(cfg_parse_script): Remove requirement that it be called at the
9952
	start of the entire stanza, and instead at the start of the script.
9953
	When hitting EOF, return the script so far, not NULL.
9954
	(cfg_parse_args): Correct bug where we didn't check sufficient
9955
	characters while skipping whitespace.
9956
	(cfg_next_token): Correct bug where we didn't copy the character
9957
	after a slash into the text, instead of just not copying the slash.
9958
	Adjust line numbers to match the fact that it's zero based now.
9959
	* init/cfgfile.h: Define prototype.
9960
	* init/tests/test_cfgfile.c (test_read_job): Pretty thoroughly
9961
	test the config file parser code.
9962
112 by Scott James Remnant
* init/main.c (main): Remove the calls to the unfinished config
9963
2006-08-22  Scott James Remnant  <scott@netsplit.com>
9964
117 by Scott James Remnant
* init/cfgfile.c (cfg_tokenise): Rename to cfg_next_token.
9965
	* init/cfgfile.c (cfg_tokenise): Rename to cfg_next_token.
9966
	(cfg_skip_token): Code to skip whitespace, token and whitespace.
9967
	(cfg_parse_args): Function to parse an argument list.
9968
	(cfg_next_token): Extend to support the removal of quotes and
9969
	slashes from the token.
9970
116 by Scott James Remnant
* init/cfgfile.c (cfg_parse_script): Pass filename and lineno and
9971
	* init/cfgfile.c (cfg_parse_script): Pass filename and lineno and
9972
	increment the latter as we go.
9973
	(cfg_script_end): Pass and increment lineno.
9974
115 by Scott James Remnant
* init/cfgfile.c: Correct a missing semi-colon in prototypes.
9975
	* init/cfgfile.c: Correct a missing semi-colon in prototypes.
9976
	(cfg_parse_command): Function to parse any stanza that requires
9977
	a command and arguments list, e.g. exec/respawn/daemon.  We don't
9978
	want to require that the list be quoted, etc. and do want to allow
9979
	it to be folded over lines.
9980
	(cfg_tokenise): Function used by the above to tokenise the file,
9981
	handling things like \, quoted strings and newlines, etc.  Can be
9982
	used both to determine the length of the token and to copy it.
9983
114 by Scott James Remnant
* init/cfgfile.c (cfg_read_script): Rename to cfg_parse_script.
9984
	* init/cfgfile.c (cfg_read_script): Rename to cfg_parse_script.
9985
113 by Scott James Remnant
* init/cfgfile.c (cfg_read_script): Function to parse a script
9986
	* init/cfgfile.c (cfg_read_script): Function to parse a script
9987
	fragment ("foo script\n....end script\n") from the job file, which
9988
	is the most complex form we can find.  Write it assuming the file is
9989
	in a character array which may not be NULL terminated (ie. a mmap'd
9990
	file).
9991
	(cfg_script_end): Used by the above to detect the end of the
9992
	fragment.
9993
	* init/cfgfile.h: Empty header file.
9994
	* init/Makefile.am (init_SOURCES): Build and link cfgfile.c
9995
	using the cfgfile.h header
9996
	(TESTS): Build and run the config file test cases.
9997
	(test_cfgfile_SOURCES, test_cfgfile_LDFLAGS, test_cfgfile_LDADD):
9998
	Details for config file test case binary.
9999
112 by Scott James Remnant
* init/main.c (main): Remove the calls to the unfinished config
10000
	* init/main.c (main): Remove the calls to the unfinished config
10001
	file code.
10002
108 by Scott James Remnant
* init/process.c (process_setup_console): Become an exported
10003
2006-08-21  Scott James Remnant  <scott@netsplit.com>
10004
111 by Scott James Remnant
* init/main.c: Add missing include for unistd.h
10005
	* init/main.c: Add missing include for unistd.h
10006
	* init/process.c (process_setup_console): Drop use of job.
10007
	* util/initctl.c (main): Check that we're run as root.
10008
110 by Scott James Remnant
* init/main.c (main): Write the main function
10009
	* init/main.c (main): Write the main function
10010
109 by Scott James Remnant
* init/event.c (event_queue_cb): Rename to event_queue_run.
10011
	* init/event.c (event_queue_cb): Rename to event_queue_run.
10012
	* init/event.h: Update.
10013
108 by Scott James Remnant
* init/process.c (process_setup_console): Become an exported
10014
	* init/process.c (process_setup_console): Become an exported
10015
	function that includes the code to reset a console.
10016
103 by Scott James Remnant
* util/initctl.c (main): Provide the most basic main function.
10017
2006-08-19  Scott James Remnant  <scott@netsplit.com>
10018
107 by Scott James Remnant
* logd/main.c (main): Write the basic main function.
10019
	* logd/main.c (main): Write the basic main function.
10020
105 by Scott James Remnant
* util/initctl.c (main): Fill in the details to give us a basic
10021
	* util/initctl.c (main): Fill in the details to give us a basic
10022
	test client.
10023
104 by Scott James Remnant
* TODO: Update.
10024
	* TODO: Update.
10025
103 by Scott James Remnant
* util/initctl.c (main): Provide the most basic main function.
10026
	* util/initctl.c (main): Provide the most basic main function.
10027
	* util/Makefile.am (sbin_PROGRAMS): Build the initctl binary
10028
	* Makefile.am (SUBDIRS): Build the utilities.
10029
	* configure.ac (AC_CONFIG_FILES): Generate the util Makefile.
10030
94 by Scott James Remnant
* Makefile.am (SUBDIRS): Build the logd daemon
10031
2006-08-18  Scott James Remnant  <scott@netsplit.com>
10032
102 by Scott James Remnant
* init/Makefile.am (test_job_LDADD): Remove the duplicate link.
10033
	* init/Makefile.am (test_job_LDADD): Remove the duplicate link.
10034
100 by Scott James Remnant
* TODO: Update.
10035
	* TODO: Update.
10036
98 by Scott James Remnant
* init/job.c (job_handle_child): Rename to job_child_reaper.
10037
	* init/job.c (job_handle_child): Rename to job_child_reaper.
10038
	* init/job.h: Update.
10039
	* init/tests/test_job.c: Update function names.
10040
97 by Scott James Remnant
* init/control.c (control_cb): Rename to control_watcher
10041
	* init/control.c (control_cb): Rename to control_watcher
10042
	* init/tests/test_control.c: Update function names.
10043
96 by Scott James Remnant
* TODO: Update.
10044
	* TODO: Update.
10045
95 by Scott James Remnant
* Makefile.am (SUBDIRS): Install the rc.d files.
10046
	* Makefile.am (SUBDIRS): Install the rc.d files.
10047
	* configure.ac (AC_CONFIG_FILES): Generate the rc.d Makefile.
10048
	* rc.d/Makefile.am (rcdir): Define rcdir to be /etc/rc.d
10049
	(dist_rc_DATA): Install the logd file into that directory.
10050
	* rc.d/logd: Write a simple service definition for the log daemon,
10051
	this saves us hardcoding any information about it into init; it'll
10052
	just need to know the name.
10053
94 by Scott James Remnant
* Makefile.am (SUBDIRS): Build the logd daemon
10054
	* Makefile.am (SUBDIRS): Build the logd daemon
10055
	* configure.ac (AC_CONFIG_FILES): Generate the logd Makefile.
10056
	* logd/Makefile.am (sbin_PROGRAMS): Install the logd binary into
10057
	the sbin directory by default.
10058
	(logd_SOURCES): Build and link main.c
10059
	* logd/main.c (main): Add basic main function for testing purposes.
10060
46 by Scott James Remnant
* upstart/errors.h: Header file containing errors raised by
10061
2006-08-16  Scott James Remnant  <scott@netsplit.com>
10062
93 by Scott James Remnant
* init/job.c (job_start): Ignore self-dependencies; over-document
10063
	* init/job.c (job_start): Ignore self-dependencies; over-document
10064
	why the dependency event prodding has a surprise in its tail.
10065
	(job_change_state): Move the job_release_depends call to here.
10066
90 by Scott James Remnant
* init/event.c (event_queue_cb): Add event consumer/dispatcher.
10067
	* init/event.c (event_queue_cb): Add event consumer/dispatcher.
91 by Scott James Remnant
* init/event.h: Update.
10068
	* init/event.h: Update.
90 by Scott James Remnant
* init/event.c (event_queue_cb): Add event consumer/dispatcher.
10069
89 by Scott James Remnant
* init/control.c (control_send): Make the event code clearer.
10070
	* init/control.c (control_send): Make the event code clearer.
10071
	(control_handle): Handle the changed event semantics.
10072
	(control_handle_event): Issue the new event type.
10073
	* init/tests/test_control.c: Update tests.
10074
88 by Scott James Remnant
* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Adjust
10075
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Adjust
10076
	marshal code to match.
10077
	* upstart/control.h: Update all structures appropriately to the
10078
	previous changes.
10079
	* upstart/tests/test_control.c: Update.
10080
87 by Scott James Remnant
* init/job.c (job_change_state): Change call to event_trigger_level
10081
	* init/job.c (job_change_state): Change call to event_trigger_level
10082
	to event_queue_level.
10083
86 by Scott James Remnant
* init/event.c (event_trigger_edge, event_trigger_level): Place
10084
	* init/event.c (event_trigger_edge, event_trigger_level): Place
10085
	the event on the event_queue rather than directly triggering it.
10086
	Rename to event_queue_edge and event_queue_level respectively.
10087
	* init/event.h: Update.
10088
	* init/tests/test_event.c: Update test cases.
10089
85 by Scott James Remnant
* init/job.c (job_handle_event): Add another sanity check, jobs
10090
	* init/job.c (job_handle_event): Add another sanity check, jobs
10091
	should not be able to react to their own events; that's just silly.
10092
	* init/tests/test_job.c (test_handle_event): Check that the new
10093
	condition does the right thing.
10094
	
84 by Scott James Remnant
* init/job.c (job_change_state): Make it illegal for a job to exist
10095
	* init/job.c (job_change_state): Make it illegal for a job to exist
10096
	without either a command or script or both.  This is for sanity
10097
	reasons, allowing no primary process makes no sense and can lead
10098
	to event loops if someone is feeling nefarious.
10099
	* init/tests/test_job.c (test_change_state): Drop test on behaviour
10100
	we've just outlawed.
10101
83 by Scott James Remnant
* init/job.c (job_start): Only announce the change if we're still
10102
	* init/job.c (job_start): Only announce the change if we're still
10103
	in the waiting state, we could have moved on to running already.
10104
82 by Scott James Remnant
* init/job.c (job_start): If holding the job, at least announce
10105
	* init/job.c (job_start): If holding the job, at least announce
10106
	the goal change to subscribed clients.
10107
81 by Scott James Remnant
* TODO: Update.
10108
	* TODO: Update.
10109
80 by Scott James Remnant
* init/job.c (job_start): Check for dependencies before starting
10110
	* init/job.c (job_start): Check for dependencies before starting
10111
	the process, if we have any that aren't running we stay in waiting
10112
	until they are.  Any that aren't even starting get poked with a
10113
	dependency event to see whether that wakes them up.
10114
	* init/tests/test_job.c (test_start): Test paths through new
10115
	dependency code.
10116
79 by Scott James Remnant
* init/job.c (job_run_process): Once we've got an active process
10117
	* init/job.c (job_run_process): Once we've got an active process
10118
	in the running state, release our dependencies.
10119
78 by Scott James Remnant
* init/job.c (job_release_depends): Function to release any waiting
10120
	* init/job.c (job_release_depends): Function to release any waiting
10121
	dependencies on the given job.
10122
	* init/job.h: Update.
10123
	* init/tests/test_job.c (test_release_depends): Test the behaviour
10124
	of the function on its own.
10125
77 by Scott James Remnant
* init/job.h (Job): Add depends list field
10126
	* init/job.h (Job): Add depends list field
10127
	(JobName): New structure to hold the name of a job.
10128
	* init/job.c (job_new): Initialise the depends list.
10129
	* init/tests/test_job.c (test_new): Make sure the depends list is
10130
	initialised properly.
10131
76 by Scott James Remnant
* init/job.c (job_next_state): Return JOB_STARTING if we're in
10132
	* init/job.c (job_next_state): Return JOB_STARTING if we're in
10133
	JOB_WAITING and the goal is JOB_START.  This is only called when
10134
	there's some change, and I don't want to hard-code the goal there.
10135
	(job_start): Don't hardcode JOB_STARTING, instead just use the next
10136
	state.
10137
	* init/tests/test_job.c (test_next_state): Adjust test case.
10138
75 by Scott James Remnant
* init/control.c (control_subscribe): Allow the current
10139
	* init/control.c (control_subscribe): Allow the current
10140
	subscription to be found by passing NOTIFY_NONE.
10141
	(control_handle): Don't remove an existing subscription to jobs,
10142
	a GUI will probably want a permanent one to keep the status up to
10143
	date.
10144
74 by Scott James Remnant
* init/job.c (job_kill_process, job_kill_timer): Don't hardcode
10145
	* init/job.c (job_kill_process, job_kill_timer): Don't hardcode
10146
	JOB_STOPPING here, instead move to the next logical state. 
10147
	(job_kill_process): Notify subscribed processes that we killed
10148
	the job.
10149
	(job_start, job_stop): Notify subscribed processes of a change of
10150
	goal that doesn't result in an immediate state change.
10151
73 by Scott James Remnant
* init/event.c (event_trigger_edge, event_trigger_level): Swap
10152
	* init/event.c (event_trigger_edge, event_trigger_level): Swap
10153
	order so that events are announced before processed.
10154
72 by Scott James Remnant
* init/control.c (control_handle): Handle requests to watch and
10155
	* init/control.c (control_handle): Handle requests to watch and
10156
	unwatch jobs and events.
10157
	* init/tests/test_control.c (test_cb_child, test_cb): Check that
10158
	subscriptions work.
10159
71 by Scott James Remnant
* init/tests/test_control.c (test_cb_child): Add a sleep to avoid
10160
	* init/tests/test_control.c (test_cb_child): Add a sleep to avoid
10161
	a race that upsets gdb, have tried this with a STOP/CONT interlock
10162
	but can't seem to find where the child should reach first.
10163
70 by Scott James Remnant
* init/job.c (job_change_state): Notify the control handler.
10164
	* init/job.c (job_change_state): Notify the control handler.
10165
	* init/event.c (event_trigger_edge, event_trigger_level): Pass
10166
	event to the control handler.
10167
	* init/tests/test_control.c (test_cb_child): Expect to receive
10168
	job status events as well.
10169
	* init/Makefile.am (test_event_LDADD, test_process_LDADD) 
10170
	(test_job_LDADD): Add control.o to the linkage.
10171
69 by Scott James Remnant
* init/control.c (control_cb): Don't display an error for
10172
	* init/control.c (control_cb): Don't display an error for
10173
	ECONNREFUSED, just remove any subscriptions.
10174
	* init/tests/test_control.c (test_handle_job, test_handle_error):
10175
	Clean up our subscriptions properly.
10176
68 by Scott James Remnant
* init/control.c (control_handle_job): Function to send out an
10177
	* init/control.c (control_handle_job): Function to send out an
10178
	UPSTART_JOB_STATUS message to subscribed processes whenever a
10179
	job state changes.
10180
	(control_handle_event): Function to send out an
10181
	UPSTART_EVENT_TRIGGERED message to subscribed processes whenever
10182
	an event is triggered.
10183
	* init/control.h: Update.
10184
	* init/tests/test_control.c (test_handle_job, test_handle_event):
10185
	Check that the functions work properly.
10186
67 by Scott James Remnant
* init/control.c (control_handle): Handle messages that trigger
10187
	* init/control.c (control_handle): Handle messages that trigger
10188
	edge and level events; subscribe the process to receive notification
10189
	of job changes during the event.
10190
	* init/tests/test_control.c (test_cb_child): Check that the messages
10191
	are handled properly (without subscription check).
10192
66 by Scott James Remnant
* init/control.c (control_cb): Unsubscribe a process if it stops
10193
	* init/control.c (control_cb): Unsubscribe a process if it stops
10194
	listening.
10195
65 by Scott James Remnant
* init/control.c (control_send): Copy the pointers in the new
10196
	* init/control.c (control_send): Copy the pointers in the new
10197
	event messages.
10198
	* init/tests/test_control.c (test_send): Check the pointers are
10199
	copied across correctly.
10200
64 by Scott James Remnant
* init/control.c (control_subscribe): Add function to handle
10201
	* init/control.c (control_subscribe): Add function to handle
10202
	processes that want to subscribe to changes.
10203
	(control_init): Initialise the subscriptions list.
10204
	* init/control.h: Add structures and prototypes.
10205
	* init/tests/test_control.c (test_subscribe): Test the function.
10206
63 by Scott James Remnant
* upstart/control.h (UpstartMsgType): add messages for triggering
10207
	* upstart/control.h (UpstartMsgType): add messages for triggering
10208
	edge and level events, receiving the trigger for an event and for
10209
	watching jobs and events.
10210
	(UpstartEventTriggerEdgeMsg, UpstartEventTriggerLevelMsg)
10211
	(UpstartEventTriggeredMsg, UpstartWatchJobsMsg)
10212
	(UpstartUnwatchJobsMsg, UpstartWatchEventsMsg):
10213
	(UpstartUnwatchEventsMsg): Add structures for the new messages.
10214
	(UpstartMsg): And add them to the union.
10215
	* upstart/control.c (WireEventPayload): The event messages can all
10216
	share a wire payload type; the watch messages don't need any special
10217
	payload.
10218
	(upstart_send_msg_to): Add the payloads onto the wire.
10219
	(upstart_recv_msg): And take the payloads back off the wire.
10220
	* upstart/tests/test_control.c (test_messages): Test the new
10221
	message types.
10222
62 by Scott James Remnant
* upstart/control.h (UpstartJobStatusMsg): add a process id.
10223
	* upstart/control.h (UpstartJobStatusMsg): add a process id.
10224
	* upstart/control.c (WireJobStatusPayload): and here too.
10225
	(upstart_send_msg_to): copy the process id onto the wire.
10226
	(upstart_recv_msg): copy the process id from the wire.
10227
	* init/control.c (control_handle): Fill in the pid from the job.
10228
	* upstart/tests/test_control.c (test_messages): Check the pid gets
10229
	passed across the wire properly.
10230
61 by Scott James Remnant
* init/control.c (control_cb): Disable the poll for write once the
10231
	* init/control.c (control_cb): Disable the poll for write once the
10232
	send queue becomes empty.
10233
60 by Scott James Remnant
* upstart/Makefile.am (libupstart_la_SOURCES): Correct ordering.
10234
	* upstart/Makefile.am (libupstart_la_SOURCES): Correct ordering.
10235
59 by Scott James Remnant
* init/control.c (control_handle): Add missing break.
10236
	* init/control.c (control_handle): Add missing break.
10237
58 by Scott James Remnant
* upstart/job.c (job_goal_name, process_state_name): For completeness
10238
	* upstart/job.c (job_goal_name, process_state_name): For completeness
10239
	add these two functions as well.
10240
	* upstart/job.h: Update.
10241
	* upstart/tests/test_job.c (test_goal_name) 
10242
	(test_process_state_name): Test the new functions.
10243
57 by Scott James Remnant
* init/job.c (job_state_name): Move this utility function from here
10244
	* init/job.c (job_state_name): Move this utility function from here
10245
	* upstart/job.c (job_state_name): to here so all clients can use
10246
	it.
10247
	* init/job.h: Update.
10248
	* upstart/job.h: Update.
10249
	* init/tests/test_job.c (test_state_name): Move the test case from here
10250
	* upstart/tests/test_job.c: to here as well.
10251
	* upstart/Makefile.am (libupstart_la_SOURCES): Build and link job.c
10252
	(TESTS): Run the job test cases
10253
	(test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for
10254
	job test case binary.
10255
	* init/Makefile.am (test_job_LDADD, test_process_LDADD) 
10256
	(test_event_LDADD): Link to libupstart.la
10257
56 by Scott James Remnant
* init/control.c: Code to handle the server end of the control
10258
	* init/control.c: Code to handle the server end of the control
10259
	socket, a bit more complex than a client as we want to avoid
10260
	blocking on malcious clients.
10261
	* init/control.h: Prototypes.
10262
	* init/tests/test_control.c: Test the control code.
10263
	* init/Makefile.am (init_SOURCES): Build and link control.c
10264
	using the control.h header
10265
	(init_LDADD): Link to libupstart as well
10266
	(TESTS): Build and run the control test suite.
10267
	(test_control_SOURCES, test_control_LDFLAGS, test_control_LDADD):
10268
	Details for control test suite binary.
10269
55 by Scott James Remnant
* upstart/control.c: Add a way to disable the safety checks.
10270
	* upstart/control.c: Add a way to disable the safety checks.
10271
	* upstart/tests/test_control.c (test_free): Fix bad test case.
10272
54 by Scott James Remnant
* upstart/control.c (upstart_recv_msg): fixed bogus return type
10273
	* upstart/control.c (upstart_recv_msg): fixed bogus return type
10274
	for recvmsg from size_t to ssize_t so we don't infiniloop on error.
10275
53 by Scott James Remnant
* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Avoid
10276
	* upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Avoid
10277
	job_start as the short-cut for assigning name, as that might become
10278
	a more complex message eventually.  Use job_query instead.
10279
52 by Scott James Remnant
* upstart/control.c (upstart_free): Add wrapper function around
10280
	* upstart/control.c (upstart_free): Add wrapper function around
10281
	nih_free so we're a proper library and don't expose libnih too much
10282
	(upstart_recv_msg): Stash the sender pid in an argument.
10283
	* upstart/control.h: Update.
10284
	* upstart/tests/test_control.c (test_recv_msg): Test pid is
10285
	returned properly.
10286
	(test_free): Test the nih_free wrapper.
10287
51 by Scott James Remnant
* init/job.c (job_run_script): Document future FIXME.
10288
	* init/job.c (job_run_script): Document future FIXME.
10289
50 by Scott James Remnant
* init/exent.h, init/job.h, init/process.h: Fix up headers.
10290
	* init/exent.h, init/job.h, init/process.h: Fix up headers.
10291
49 by Scott James Remnant
* upstart/control.c, upstart/control.h, upstart/errors.h,
10292
	* upstart/control.c, upstart/control.h, upstart/errors.h,
10293
	upstart/job.h, upstart/libupstart.h: Fix up headers.
10294
48 by Scott James Remnant
* upstart/control.c: Write the code to handle the control socket
10295
	* upstart/control.c: Write the code to handle the control socket
10296
	and communication over it; turns out this was possible to write so
10297
	that both ends are handled in the same code.
10298
	* upstart/control.h: Structures and prototypes.
10299
	* upstart/tests/test_control.c: Test the new code.
10300
47 by Scott James Remnant
* upstart/Makefile.am (libupstart_la_LIBADD): Link to libnih
10301
	* upstart/Makefile.am (libupstart_la_LIBADD): Link to libnih
10302
46 by Scott James Remnant
* upstart/errors.h: Header file containing errors raised by
10303
	* upstart/errors.h: Header file containing errors raised by
10304
	libupstart.
10305
	* upstart/libupstart.h: Include errors.h
10306
29 by Scott James Remnant
* init/job.c (job_handle_child): Child handler to kick jobs into
10307
2006-08-15  Scott James Remnant  <scott@netsplit.com>
10308
45 by Scott James Remnant
* init/event.h: Add missing attribute for event_new()
10309
	* init/event.h: Add missing attribute for event_new()
10310
44 by Scott James Remnant
* init/job.h (JobGoal, JobState, ProcessState, ConsoleType): Move
10311
	* init/job.h (JobGoal, JobState, ProcessState, ConsoleType): Move
10312
	the enums from here
10313
	* upstart/job.h: into here so that we can use them across the
10314
	control socket.
10315
43 by Scott James Remnant
* Makefile.am (SUBDIRS): Build the libupstart library
10316
	* Makefile.am (SUBDIRS): Build the libupstart library
10317
	* configure.ac (AC_CONFIG_FILES): Generate upstart/Makefile
10318
	* upstart/Makefile.am: Makefile for sub-directory
10319
	* upstart/libupstart.ver: Linker version script.
10320
	* upstart/libupstart.h: "Include everything" header file.
10321
42 by Scott James Remnant
* TODO: Update.
10322
	* TODO: Update.
10323
41 by Scott James Remnant
* init/job.c (job_handle_child): Warn when processes are killed
10324
	* init/job.c (job_handle_child): Warn when processes are killed
10325
	or exit with an abnormal status.  Warn when respawning.
10326
40 by Scott James Remnant
* init/job.c (job_handle_child): Respawn processes that were not
10327
	* init/job.c (job_handle_child): Respawn processes that were not
10328
	supposed to have died.
10329
	* init/tests/test_job.c (test_handle_child): Test the respawn code.
10330
39 by Scott James Remnant
* TODO: Update.
10331
	* TODO: Update.
10332
38 by Scott James Remnant
* init/event.c (event_trigger_edge, event_trigger_level): Call
10333
	* init/event.c (event_trigger_edge, event_trigger_level): Call
10334
	job_handle_event so that we actually do something useful.
10335
	* init/Makefile.am (test_event_LDADD): Link to process.o and job.o
10336
	now that event.c calls code from job.
10337
37 by Scott James Remnant
* init/job.c (job_start_event): Function to start a job if an event
10338
	* init/job.c (job_start_event): Function to start a job if an event
10339
	matches.
10340
	(job_stop_event): Function to stop a job if an event matches.
10341
	(job_handle_event): Iterate the job list and dispatch the given event,
10342
	causing jobs to be stopped or started using the above two functions.
10343
	* init/job.h: Update.
10344
	* init/tests/test_job.c: Test the new functions.
10345
36 by Scott James Remnant
* init/job.c (job_new): Initialise start_events and stop_events to
10346
	* init/job.c (job_new): Initialise start_events and stop_events to
10347
	an empty list.
10348
	* init/job.h (Job): Add start_events and stop_events list heads.
10349
	* init/tests/test_job.c (test_new): Check the lists are initialised
10350
	correctly to the empty list.
10351
35 by Scott James Remnant
* init/event.c (event_match): Function to check events for equality.
10352
	* init/event.c (event_match): Function to check events for equality.
10353
	* init/event.h: Update.
10354
	* init/tests/test_event.c (test_match): Test function.
10355
34 by Scott James Remnant
* init/job.c (job_change_state): Trigger the level event with the
10356
	* init/job.c (job_change_state): Trigger the level event with the
10357
	same name as the job, with the value taken from the state.
10358
	* init/tests/test_job.c (test_change_state): Check the event
10359
	gets set to the right values as we go.
10360
	* init/Makefile.am (test_job_LDADD, test_process_LDADD): Link to
10361
	event.o now that job.c uses code from there.
10362
33 by Scott James Remnant
* init/event.c (event_change_value): Rename event_set_value to this
10363
	* init/event.c (event_change_value): Rename event_set_value to this
10364
	as we intended in the first place; makes it more consistent with job.
10365
	Always change the value.
10366
	(event_trigger_edge): Add a high-level function to trigger an edge
10367
	event.
10368
	(event_trigger_level): And another to trigger a level event with
10369
	a given value, this inherits the "don't change it" functionality
10370
	that was in event_set_value.
10371
	* init/event.h: Update.
10372
	* init/tests/test_event.c: Test new behaviours and functions.
10373
32 by Scott James Remnant
* init/event.c: Add simple code to keep track of events, whether
10374
	* init/event.c: Add simple code to keep track of events, whether
10375
	they have been recorded or not and their current value if any.
10376
	* init/event.h: Structures and prototypes.
10377
	* init/tests/test_event.c: Test cases for event code.
10378
	* init/Makefile.am (init_SOURCES): Build and link event.c using event.h
10379
	(TESTS): Run the event test suite.
10380
	(test_event_SOURCES, test_event_LDFLAGS, test_event_LDADD): Details
10381
	for event test suite binary.
10382
31 by Scott James Remnant
* init/job.c (job_run_process, job_kill_process, job_kill_timer):
10383
	* init/job.c (job_run_process, job_kill_process, job_kill_timer):
10384
	Downgrade error messages to warning as they're not fatal.
10385
	(job_change_state): Change info message to be more regular.
10386
30 by Scott James Remnant
* init/job.c (job_start): A very simple, but very necessary, function.
10387
	* init/job.c (job_start): A very simple, but very necessary, function.
10388
	Set the goal of the given job to JOB_START and kick it off.
10389
	(job_stop): And its companion, cause a running job to be stopped.
10390
	* init/job.h: Update.
10391
	* init/tests/test_job.c: Test the functions.
10392
29 by Scott James Remnant
* init/job.c (job_handle_child): Child handler to kick jobs into
10393
	* init/job.c (job_handle_child): Child handler to kick jobs into
10394
	the next state when their process dies.
10395
	* init/job.h: Update.
10396
	* init/tests/test_job.c (test_handle_child): Test the handler
10397
	directly by just invoking it with various job states.
10398
21 by Scott James Remnant
* init/process.c (process_spawn): Correct typo (progress -> process),
10399
2006-08-14  Scott James Remnant  <scott@netsplit.com>
10400
28 by Scott James Remnant
* init/tests/test_process.c (test_kill): Use select rather than
10401
	* init/tests/test_process.c (test_kill): Use select rather than
10402
	poll for consistency with other test cases.
10403
27 by Scott James Remnant
* init/job.c (job_kill_process): Add function to send the active
10404
	* init/job.c (job_kill_process): Add function to send the active
10405
	process of a job the TERM signal, and then set a timer to follow
10406
	up with the KILL signal if the job doesn't get cleaned up in time.
10407
	(job_kill_timer): Timer callback to send the KILL signal; this
10408
	does the same job as the child handler and puts the job into the
10409
	next state as there's no point waiting around now.
10410
	* init/job.h: Update.
10411
	* init/tests/test_job.c (test_kill_process): Test both functions
10412
	in one test case (as one is just the bottom half of the other).
10413
26 by Scott James Remnant
* init/tests/test_process.c (test_spawn): Use the right thing in
10414
	* init/tests/test_process.c (test_spawn): Use the right thing in
10415
	the test case filename and unlink it to make sure.
10416
25 by Scott James Remnant
* init/job.c (job_change_state): Write the principal state gate
10417
	* init/job.c (job_change_state): Write the principal state gate
10418
	function, called once a state has been left to enter the given new
10419
	state (which one should determine with job_next_state).  Spawns
10420
	the necessary processes or moves to the next appropriate state.
10421
	* init/job.h: Update.
10422
	* init/tests/test_job.c: Test the state changes.
10423
24 by Scott James Remnant
* init/job.c (job_run_process): Internal function to call
10424
	* init/job.c (job_run_process): Internal function to call
10425
	process_spawn and update the job structure.
10426
	(job_run_command): Simple(ish) wrapper for the above to split
10427
	a command by whitespace, or use a shell if it needs more complex
10428
	argument processing.
10429
	(job_run_script): More complex wrapper that uses a shell to execute
10430
	verbatim script, either using -c or a /dev/fd/NN and feeding the
10431
	shell down a pipe to it.
10432
	* init/job.h: Update.
10433
	* init/tests/test_job.c: Test the new functions.
10434
23 by Scott James Remnant
* init/Makefile.am (init_SOURCES, TESTS): Reorder so that process.c,
10435
	* init/Makefile.am (init_SOURCES, TESTS): Reorder so that process.c,
10436
	which is arguably lower level, comes first.
10437
	(test_job_LDADD): Link the process code.
10438
	(test_process_LDADD): Swap the order.
10439
22 by Scott James Remnant
* TODO: Update.
10440
	* TODO: Update.
10441
21 by Scott James Remnant
* init/process.c (process_spawn): Correct typo (progress -> process),
10442
	* init/process.c (process_spawn): Correct typo (progress -> process),
10443
	thanks Johan.
10444
19 by Scott James Remnant
* init/job.c (job_new): Initialise all structure members to zero
10445
2006-08-12  Scott James Remnant  <scott@netsplit.com>
10446
20 by Scott James Remnant
* init/process.c (process_spawn): Correct formatting of function.
10447
	* init/process.c (process_spawn): Correct formatting of function.
10448
	* init/process.h (SHELL): Define the location of the shell, all in
10449
	the spirit of not hard-coding stuff like this.
10450
19 by Scott James Remnant
* init/job.c (job_new): Initialise all structure members to zero
10451
	* init/job.c (job_new): Initialise all structure members to zero
10452
	as this doesn't happen automatically.
10453
18 by Scott James Remnant
* init/job.h (job_state_name): Declare as a const function.
10454
2006-08-10  Scott James Remnant  <scott@netsplit.com>
10455
10456
	* init/job.h (job_state_name): Declare as a const function.
10457
13 by Scott James Remnant
* init/process.c (process_spawn): Spawn a process using the job
10458
2006-08-09  Scott James Remnant  <scott@netsplit.com>
10459
17 by Scott James Remnant
* init/job.c (job_next_state): State transition logic; this uses
10460
	* init/job.c (job_next_state): State transition logic; this uses
10461
	our departure from the specification (the goal) so that the state
10462
	can always be currently accurate rather than suggestive.
10463
	(job_state_name): Cute function to convert enum into a name.
10464
	* init/job.h: Update.
10465
	* init/tests/test_job.c (test_next_state): Test the transitions.
10466
	(test_state_name): And the return values.
10467
16 by Scott James Remnant
* TODO: Add file to keep track of things.
10468
	* TODO: Add file to keep track of things.
10469
15 by Scott James Remnant
* init/job.c: Include nih/macros.h and nih/list.h
10470
	* init/job.c: Include nih/macros.h and nih/list.h
10471
	* init/process.c: Include order fixing, include nih/macros.h
10472
	* init/tests/test_job.c: Include nih/macros.h and nih/list.h
10473
	* init/tests/test_process.c: Include nih/list.h
10474
14 by Scott James Remnant
* init/job.c: Include order fixing.
10475
	* init/job.c: Include order fixing.
10476
	(job_find_by_name): Function to find a job by its (unique) name.
10477
	(job_find_by_pid): Function to find a job by the pid of its process.
10478
	* init/job.h: Update.
10479
	* init/tests/test_job.c (test_find_by_name, test_find_by_pid): Test
10480
	new functions.
10481
13 by Scott James Remnant
* init/process.c (process_spawn): Spawn a process using the job
10482
	* init/process.c (process_spawn): Spawn a process using the job
10483
	details to set up the environment, etc.
10484
	(process_setup_console): Set up the console according to the job.
10485
	(process_setup_limits): Set up the limits according to the job.
10486
	(process_setup_environment): Set up the environment according to
10487
	the job.
10488
	(process_kill): Simple function to send a kill signal or raise an
10489
	error; mostly just a wrapper without any particular logic.
10490
	* init/process.h: Prototypes and macros.
10491
	* init/tests/test_process.c: Test cases.
10492
	* init/Makefile.am (init_SOURCES): Build and link process.c and
10493
	its header file.
10494
	(TESTS): Run the process test suite.
10495
	(test_process_SOURCES, test_process_LDFLAGS, test_process_LDADD):
10496
	Details for process test sutie binary.
10497
11 by Scott James Remnant
* init/job.h: Header file to contain the definition of the Job
10498
2006-08-08  Scott James Remnant  <scott@netsplit.com>
10499
12 by Scott James Remnant
* init/job.c (job_new): nih_list_free is necessary.
10500
	* init/job.c (job_new): nih_list_free is necessary.
10501
	* init/tests/test_job.c (test_new): Free job when done.
10502
11 by Scott James Remnant
* init/job.h: Header file to contain the definition of the Job
10503
	* init/job.h: Header file to contain the definition of the Job
10504
	structure and associated typedefs, etc.
10505
	(JobGoal): In a divergence from the specification, we introduced a
10506
	"goal" for a job which tells us which way round the state machine
10507
	we're going (towards start, or towards stop).
10508
	(JobState): Which means this always holds the current state, even
10509
	if we're trying to get out of this state (ie. if we've sent the TERM
10510
	signal to the running process, we're still in the running state until
10511
	it's actually been reaped).
10512
	(ProcessState): And in another divergence, we keep the state of the
10513
	process so we know whether we need to force a state transition or
10514
	can just expect one because something transient is happening.
10515
	* init/job.c (job_new): Function to allocate a Job structure, set
10516
	the pointers to NULL and other important members to sensible
10517
	defaults.
10518
	(job_init): Initialise the list of jobs.
10519
	* init/tests/test_job.c: Test suite.
10520
	* init/Makefile.am (init_SOURCES): Compile and link job.c using
10521
	its header file.
10522
	(TESTS): Run the job test suite.
10523
	(test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for the
10524
	job test suite binary.
10525
8 by Scott James Remnant
* HACKING: Document dependency on libnih.
10526
2006-08-02  Scott James Remnant  <scott@netsplit.com>
10527
9 by Scott James Remnant
* configure.ac: Check for C99
10528
	* configure.ac: Check for C99
10529
8 by Scott James Remnant
* HACKING: Document dependency on libnih.
10530
	* HACKING: Document dependency on libnih.
10531
7 by Scott James Remnant
* init/Makefile.am (DEFS): Append to the default DEFS list, rather
10532
2006-07-27  Scott James Remnant  <scott@netsplit.com>
10533
10534
	* init/Makefile.am (DEFS): Append to the default DEFS list, rather
10535
	than overriding, otherwise we lose HAVE_CONFIG_H
10536
5 by Scott James Remnant
* AUTHORS: Change e-mail address to ubuntu.com.
10537
2006-07-13  Scott James Remnant  <scott@netsplit.com>
10538
6 by Scott James Remnant
* HACKING: Correct incorrect Bazaar URL.
10539
	* HACKING: Correct incorrect Bazaar URL.
10540
5 by Scott James Remnant
* AUTHORS: Change e-mail address to ubuntu.com.
10541
	* AUTHORS: Change e-mail address to ubuntu.com.
10542
	* HACKING: Update Bazaar and Release URLS.
10543
	* configure.ac (AC_COPYRIGHT): Change copyright to Canonical Ltd.
10544
	(AC_INIT): Change bug submission address to Launchpad.
10545
	* init/main.c: Update header to use Canonical copyright and
10546
	credit me as author.
10547
3 by Scott James Remnant
* init/main.c: Add the simplest template main.c
10548
2006-05-16  Scott James Remnant  <scott@netsplit.com>
10549
10550
	* init/main.c: Add the simplest template main.c
10551
	* init/Makefile.am: Add template Makefile.am that builds init from
10552
	main.c and links to libnih statically
10553
	* configure.ac (AC_CONFIG_FILES): Configure nih and init subdirs.
10554
	* Makefile.am (SUBDIRS): Recurse into nih and init subdirs.
10555
1 by Scott James Remnant
* ChangeLog: Initial project infrastructure created.
10556
2006-05-14  Scott James Remnant  <scott@netsplit.com>
10557
10558
	* ChangeLog: Initial project infrastructure created.