blob: 1cd750b9f00d467bcac7cc347aeeef668d0991ff [file] [log] [blame]
Scott James Remnant3d39c7d2007-03-02 10:50:14 +000012007-03-02 Scott James Remnant <scott@netsplit.com>
2
3 * TODO: Update.
4
Scott James Remnantbc1ebc02007-03-01 12:27:09 +000052007-03-01 Scott James Remnant <scott@netsplit.com>
6
Scott James Remnant75914fd2007-03-01 19:05:45 +00007 * util/jobs.c (handle_job_status): Drop the process field from the
8 output for now.
9 * util/events.c (handle_event_job_status): Likewise
10 * util/tests/test_jobs.c (test_start_action, test_list_action)
11 (test_jobs_action): Drop pid from messages we simulate.
12 * util/tests/test_events.c (test_emit_action): Likewise.
13
Scott James Remnant0c68cc12007-03-01 18:53:23 +000014 * upstart/message.c (upstart_message_new, upstart_message_handle):
15 Remove the pid field from the job status and event job status
16 messages.
17 * upstart/message.h: Update description of job status and event
18 job status message to remove the pid field.
19 * upstart/tests/test_message.c (test_new, my_handler)
20 (test_handle): Remove checks using the pid field.
21
Scott James Remnantd134fe82007-03-01 18:46:53 +000022 * init/control.c (control_job_start, control_job_stop)
23 (control_job_query, control_job_list): Remove the pid field from
24 the messages, it'll come back later when we get better message
25 formats.
26 * init/tests/test_control.c (check_job_status, check_job_waiting)
27 (check_job_started, check_job_stopped): Remove checks on the process
28 id, since that field is gone from the message.
29 (test_job_stop): Use the pid field of the main process.
30 (test_job_start): Initialise the main action process.
31
Scott James Remnantdd1a6742007-03-01 18:42:42 +000032 * init/notify.c (notify_job, notify_job_event): Remove the pid field
33 from the message, it'll come back later when we get better message
34 formats.
35 * init/tests/test_notify.c (check_job_status)
36 (check_event_job_status): Remove checks on the pid, since that field
37 is no longer present.
38
Scott James Remnante2ce6372007-03-01 18:37:53 +000039 * init/job.c (job_process_copy): Use job_process_new here, oops.
40
Scott James Remnant8ed70e42007-03-01 18:34:37 +000041 * init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script)
42 (cfg_stanza_pre_start, cfg_stanza_post_start)
43 (cfg_stanza_pre_stop, cfg_stanza_post_stop): Use job_process_new
44 to allocate process structures and store in the process array.
45 * init/tests/test_cfgfile.c (test_read_job, test_stanza_exec)
46 (test_stanza_script, test_stanza_pre_start)
47 (test_stanza_post_start, test_stanza_pre_stop)
48 (test_stanza_post_stop): Update test cases to use process array
49 member information.
50
Scott James Remnant42479f92007-03-01 18:12:34 +000051 * init/tests/test_event.c (test_poll): Update to use newer job process
52 array and find the pid under there.
53
Scott James Remnantc8f15ac2007-03-01 18:03:22 +000054 * init/job.h (Job): Remove the pid and aux_pid fields; replace the
55 individual JobProcess pointers with an array of them of a fixed
56 minimum size; replace failed_state with failed_process.
57 (JobProcess): add a pid field here, so now we can obtain the pid on
58 an individual process/action basis rather than global.
59 * init/job.c (job_process_new): Function to create a JobProcess
60 structure, setting the initial values to FALSE/NULL/0.
61 (job_process_copy): Function to copy a JobProcess.
62 (job_new): Don't initialise the pid or aux_pid members, initialise
63 the process array to a fixed initial size and set the members to NULL,
64 initialise the failed_process member to -1.
65 (job_copy): Update to use job_process_copy and copy the process array.
66 (job_find_by_pid): Look through the process structures in the job's
67 process array to find the pid, and optionally return which action it
68 was.
69 (job_change_state): Call job_kill_process in the JOB_KILLED state if
70 we have a main process and that has a pid, pass in the main process.
71 (job_next_state): Check the process id of the main process when
72 deciding what the next state is for running.
73 (job_run_process): Store the process id in the process structure
74 (job_kill_process): Accept a process structure and use that to obtain
75 the process id we need to send TERM too. Remove the code that forced
76 a state change if kill() failed, since we will get a child signal
77 anyway and should do it there.
78 (job_kill_timer): Likewise, accept a process structure and don't
79 forcibly change the state anymore.
80 (job_child_reaper): Rewrite to switch based on the action that died,
81 rather than the state we were in; assert that the state is what we
82 expected.
83 (job_emit_event): The argument to the failed event is now the action
84 name, rather than the state name; an action of -1 indicates that
85 respawn failed.
86 * init/tests/test_job.c (test_process_new, test_process_copy): Make
87 sure the structure is created and copied properly.
88 (test_new, test_copy): Drop checks on the pid and aux_pid members,
89 add checks for the process array and pid members of processes.
90 (test_find_by_pid): Update test case to make sure we can find the pid
91 of any process, returning the action index rather than the process
92 pointer.
93 (test_run_process, test_kill_process, test_change_goal)
94 (test_change_state, test_next_state, test_child_reaper): Update test
95 cases to use pid fields inside process structures rather than the
96 pid or aux_pid members.
97 (test_handle_event, test_handle_event_finished)
98 (test_free_deleted): Update to avoid pid field checks.
99
Scott James Remnant4652e3b2007-03-01 16:25:56 +0000100 * upstart/enum.h (JobAction): Enumeration of different actions.
101 * upstart/enum.c (job_action_name, job_action_from_name): Enumeration
102 to string conversion functions.
103 * upstart/tests/test_enum.c (test_action_name)
104 (test_action_from_name): Tests for the new functions.
105
Scott James Remnantdc9d7902007-03-01 12:57:37 +0000106 * init/cfgfile.c (cfg_read_job): Instead of trying to copy over an
107 old job's state and instances into the new one, mark the old job
108 as deleted. This ensures we never end up applying a new post-stop
109 script to a job started with an old pre-start script, etc. It also
110 makes life so much simpler.
111 * init/tests/test_cfgfile.c (test_read_job): Update tests to make
112 sure the old job is marked for deletion, instead of freed.
113 * TODO: Update.
114
Scott James Remnant26a41cf2007-03-01 12:50:10 +0000115 * init/notify.c (notify_job): Split out notification to processes
116 subscribed to the cause event into a new function
117 (notify_job_event): We can call this when we change cause.
118 * init/job.c (job_change_state): Notify anyone subscribed to the
119 job after we've changed the state, rather than before, otherwise
120 we won't know the new pids or anything.
121 (job_change_cause): Call notify_job_event before changing the cause
122 so that subscribers get a final status update.
123 * init/tests/test_notify.c (test_job_event): Check the new function.
124 * TODO: Update.
125
Scott James Remnantbc1ebc02007-03-01 12:27:09 +0000126 * init/cfgfile.c (cfg_stanza_respawn): Remove the shortcut that
127 lets you specify "respawn COMMAND". It was confusing as it hid
128 the common "[when] exec"/"[when] script" syntax, made it non-obvious
129 that "exec" and "respawn" were the same flag, etc.
130 * init/tests/test_cfgfile.c (test_stanza_respawn): Update tests.
131 (test_stanza_service): Fix test case to not use shortcut.
132 * logd/event.d/logd.in: Update to not use respawn shortcut.
133
Scott James Remnantb1f34052007-02-25 09:12:53 +00001342007-02-25 Scott James Remnant <scott@netsplit.com>
135
Scott James Remnant43d8f092007-02-25 12:56:37 +0000136 * init/job.c (job_child_reaper): Shift the signal value into the
137 higher byte to make it easier to detect, and not stamp over exit
138 statuses between 128 and 255.
139 (job_emit_event): Detect the signal stored in the new way.
140 * init/cfgfile.c (cfg_stanza_normal): Store signal in the higher bytes.
141 * init/tests/test_job.c (test_copy, test_change_state)
142 (test_child_reaper): Update test cases.
143 * init/tests/test_cfgfile.c (test_stanza_normal): Update test.
144
Scott James Remnant8a77b5d2007-02-25 11:45:47 +0000145 * TODO: Update.
146
Scott James Remnant2c950692007-02-25 09:13:38 +0000147 * init/event.h (PWRSTATUS_EVENT): Add new power-status-changed event.
148 * init/main.c (pwd_handler): Handle the SIGPWR signal by generating
149 the new event, leave it up to a job to parse the file and do
150 whatever it likes.
151
Scott James Remnantb1f34052007-02-25 09:12:53 +0000152 * TODO: Update.
153
Scott James Remnant7e3ad172007-02-13 15:53:39 +00001542007-02-13 Scott James Remnant <scott@netsplit.com>
155
156 * upstart/tests/test_message.c (test_reader, test_handle_using)
157 (test_handle); Usual fix for gcc optimiser thinking that fixed
158 for loops might not be.
159 * init/tests/test_job.c (test_run_process, test_kill_process):
160 Likewise.
161 * init/tests/test_notify.c (test_subscription_find): I still don't
162 know what a type-punned pointer is, nor why dereferencing such a
163 thing would break strict-aliasing rules.
164 * init/tests/test_cfgfile.c (test_read_job): More type-punning.
165 * util/tests/test_jobs.c (test_start_action): More for-loop action.
166 * util/tests/test_events.c (test_emit_action): And again.
167
Scott James Remnant5c89c502007-02-11 14:08:19 +00001682007-02-11 Scott James Remnant <scott@netsplit.com>
169
Scott James Remnant17305e12007-02-11 18:20:19 +0000170 * init/job.c (job_change_goal): We need to be able to stop a running
171 job without a process, because that's what a job-as-state is! The
172 check was added because job_child_reaper calls job_change_goal and
173 then job_change_state immediately after, we should fix that instead.
174 (job_child_reaper): If we call job_change_goal while in the running
175 state, it will call job_change_state for us; so check for that first
176 and don't change the state!
177 * init/tests/test_job.c (test_change_goal): Update the test to ensure
178 that we can stop a job with no running process.
179
Scott James Remnantddda5f92007-02-11 14:18:00 +0000180 * init/cfgfile.c (cfg_stanza_normalexit): normalexit is inconsistent,
181 change to "normal exit"
182 * init/tests/test_cfgfile.c (test_stanza_normalexit): Update.
183
Scott James Remnant5c89c502007-02-11 14:08:19 +0000184 * init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop)
185 (cfg_stanza_pre_start, cfg_stanza_post_start)
186 (cfg_stanza_pre_stop, cfg_stanza_post_stop, cfg_stanza_respawn):
187 We're not going to allow stanza keywords to be quoted, since this
188 gives us an easy way to allow users to make something explicitly
189 not a keyword.
190
Scott James Remnant5dd50e32007-02-10 00:44:44 +00001912007-02-10 Scott James Remnant <scott@netsplit.com>
192
Scott James Remnant9675c072007-02-10 21:36:48 +0000193 * configure.ac: Bump version to 0.3.6
194
Scott James Remnant4e977172007-02-10 21:24:29 +0000195 * configure.ac: Increase version to 0.3.5
196 * NEWS: Update.
197 * TODO: Update.
198
Scott James Remnanta2f0a542007-02-10 18:07:26 +0000199 * TODO: More notes.
200
Scott James Remnant78456a52007-02-10 17:46:21 +0000201 * TODO: Note an issue with using JobProcess->pid
202
Scott James Remnantd11d0fd2007-02-10 17:45:17 +0000203 * init/cfgfile.c (cfg_stanza_pre_start, cfg_stanza_post_start)
204 (cfg_stanza_pre_stop, cfg_stanza_post_stop): Add a needed check
205 for a token when parsing "exec". Correct line number we expect
206 to see the duplicated value on. Correct expected error for missing
207 argument from "Unexpected token" to "Expected token".
208
209 * init/tests/test_cfgfile.c (main): Actually invoke the tests for
210 the scripts.
211
Scott James Remnant2ebe37b2007-02-10 17:35:33 +0000212 * init/cfgfile.c (cfg_read_job): Correct type of lineno in error.
213
Scott James Remnant178f3a62007-02-10 17:34:02 +0000214 * TOOD: Minor notify bug
215
Scott James Remnante72695c2007-02-10 17:11:26 +0000216 * TODO: Big update.
217
Scott James Remnant743c1c12007-02-10 16:49:17 +0000218 * init/tests/test_job.c (test_child_reaper): Make sure that we can
219 reap post-start and pre-stop processes, and have only the aux_pid
220 changed. Also make sure that if the running process dies while
221 in these states, with or without an aux process, that we don't
222 transition badly.
223
Scott James Remnanta54bfd02007-02-10 14:33:32 +0000224 * init/job.c (job_find_by_pid): Check aux_pid as well.
225 * init/tests/test_job.c (test_find_by_pid): Make sure we can find it.
226
Scott James Remnant153e3b52007-02-10 14:15:47 +0000227 * init/job.h (Job): Add an auxiliary pid member.
228 * init/job.c (job_new): Initialise the aux_pid member.
229 (job_change_state): Run the post-start and pre-stop scripts when we
230 enter the state with the same name (assuming they exist).
231 (job_run_process): Store the pid in aux_pid when starting the
232 post-start or pre-stop processes.
233 * init/tests/test_job.c (test_change_state): Add tests for running
234 the new post-start and pre-stop scripts; which get their process ids
235 stored in aux_pid instead of pid.
236 (test_new): Make sure the aux_pid member is initialised properly.
237 (test_copy): Make sure the aux_pid member is not copied.
238
239 * TODO: Update.
240
Scott James Remnantf415d8d2007-02-10 13:55:04 +0000241 * init/tests/test_job.c (test_change_state): Add a check for the
242 daemon stanza holding the job in spawned; we snuck this in a while
243 back and never tested it (there's no support to get it out of
244 spawned yet).
245
Scott James Remnante9332be2007-02-10 13:46:50 +0000246 * init/job.h (Job): Add new post_start and pre_stop scripts.
247 * init/job.c (job_new): Initialise new scripts to NULL.
248 (job_copy): Copy the information from the new scripts over as well.
249 * init/tests/test_job.c (test_new): Check they're initialised.
250 (test_copy): Check that the information is copied properly.
251 * init/cfgfile.c (cfg_stanza_post_start, cfg_stanza_pre_stop): Add
252 new script stanza functions for the additional two scripts that
253 we want.
254 * init/tests/test_cfgfile.c (test_stanza_post_start)
255 (test_stanza_pre_stop): Add tests for the new stanzas.
256
Scott James Remnant5dd50e32007-02-10 00:44:44 +0000257 * init/cfgfile.c (cfg_stanza_exec, cfg_stanza_script): Rewrite to
258 allocate a JobProcess and parse the command or script into it.
259 (cfg_read_job): Fix the long broken assumption that pid_file and
260 pid_binary are required for respawn, when they're actually required
261 for daemon.
262 (cfg_stanza_start, cfg_stanza_stop): Remove script second-level.
263 (cfg_stanza_respawn): Parse into the job's process.
264 (cfg_stanza_pre_start, cfg_stanza_post_stop): New stanzas for the
265 processes alone.
266 * init/tests/test_cfgfile.c (test_read_job): Update a few test
267 cases to match reality.
268 (test_stanza_start, test_stanza_stop): Remove script-related checks.
269
Scott James Remnante885d552007-02-09 00:01:46 +00002702007-02-09 Scott James Remnant <scott@netsplit.com>
271
Scott James Remnant315a80a2007-02-09 22:50:00 +0000272 * init/tests/test_job.c (test_kill_process): Poll the event queue
273 after each test to get rid of the allocated events and make valgrind
274 happy.
275 * init/tests/test_control.c (test_job_start, test_job_stop)
276 (test_event_emit): Poll the event queue after each test to get rid
277 of the allocated events, as they make valgrind complain.
278 (test_event_emit): Free args and env when done.
279
Scott James Remnant1ada0e22007-02-09 22:40:51 +0000280 * init/job.h (JobName): Drop obsolete structure
281 (JobProcess): Add a new structure to represent a single process
282 within the job, instead of using two variables to pick either the
283 script or command.
284 (Job): Change command and script to a single JobProcess called process;
285 change start_script and stop_script to a JobProcess called pre_start
286 and post_stop respectively.
287 * init/job.c (job_new): Initialise new members to NULL.
288 (job_copy): Copy the process structures across, including contents.
289 (job_change_state): Call job_run_process passing in the structure;
290 rather than fiddling with if statements.
291 (job_run_script, job_run_command, job_run_process): Combine all of
292 these three functions into a single new job_run_process function.
293 * init/tests/test_job.c (test_new, test_copy, test_change_goal)
294 (test_change_state, test_child_reaper)
295 (test_handle_event_finished): Change to using JobProcess for when
296 we need to construct a command.
297 (test_run_script, test_run_command): Merge into single new
298 (test_run_process) function.
299 * init/tests/test_event.c (test_poll): Replace command with process.
300 * init/tests/test_control.c (test_job_start): Change to using
301 JobProcess to specify the command.
302
Scott James Remnantc6740472007-02-09 21:16:28 +0000303 * init/main.c (main): Run job_free_deleted each time through the
304 main loop.
305
Scott James Remnantcb468602007-02-09 21:13:16 +0000306 * init/job.c (job_change_goal): Minor tweak to the logic; we may
307 have just made the job an instance, that should still let us stop
308 the one underneath.
309
Scott James Remnant3fbdda72007-02-09 21:12:10 +0000310 * TODO: Update.
311
Scott James Remnantdde96ff2007-02-09 21:10:45 +0000312 * util/jobs.c (do_job): Always expect a list of replies.
313
Scott James Remnantf9409952007-02-09 21:02:18 +0000314 * init/control.c (control_job_status, control_job_stop)
315 (control_job_query): Reply with information about all instances of
316 the job.
317 * init/tests/test_control.c (test_job_status, test_job_stop)
318 (test_job_query): Make sure we get the list end even for a single job;
319 and make sure we get details of all instances attached to the job.
320
Scott James Remnant6cfc8ab2007-02-09 20:34:37 +0000321 * init/tests/test_job.c (test_change_goal): Check that starting
322 an instance job actually starts a new instance of it.
323
Scott James Remnant87c46472007-02-09 20:05:32 +0000324 * init/cfgfile.c (cfg_stanza_limit): Support the word "unlimited" in
325 limit arguments for both the soft and hard values.
326 * init/tests/test_cfgfile.c (test_stanza_limit): Make sure that we
327 can make limits be unlimited.
328
Scott James Remnant22ac92f2007-02-09 19:39:42 +0000329 * init/event.c (event_copy): Function to copy an event structure.
330 * init/event.h: Add prototype.
331 * init/tests/test_event.c (test_copy): Make sure we copy the event
332 correctly, with or without arguments and/or environment.
333 * init/job.c (job_copy): Function to copy a job structure, leaving
334 the state as it is.
335 * init/job.h: Add prototype.
336 * init/tests/test_job.c (test_copy): Make sure that we copy the
337 job details whether they are NULL or non-NULL, but don't copy the
338 state.
339 * init/init.supp: Update supression.
Scott James Remnant099ece22007-02-09 18:13:51 +0000340 * init/job.c (job_find_by_name): If we get a job that's an instance,
341 return what it's an instance of.
342 * init/tests/test_job.c (test_find_by_name): Restore accidentally
343 deleted test function; test that we get the real job, not an instance.
344
Scott James Remnant99e3ecc2007-02-09 18:08:45 +0000345 * init/job.c (job_new): instance_of is initialised to NULL.
346 * init/job.h: Add a new instance_of pointer, pointing to the parent
347 that we're an instance of.
348 * init/tests/test_job.c (test_new): Check that.
349 * init/tests/test_cfgfile.c (test_read_job): Make sure instance_of
350 pointers are updated.
351
Scott James Remnant4513fae2007-02-09 17:52:32 +0000352 * init/job.c (jobs): Store jobs in a hash table.
353 (job_new): Add to hash table, not to a list.
354 (job_handle_event, job_handle_event_finished, job_detect_stalled)
355 (job_free_deleted): Iterate across the hash table, rather than list.
356 (job_find_by_name): Use nih_hash_lookup, we keep this function because
357 we'll add "is instance or not" smarts soon!
358 (job_find_by_pid): Iterate across the entire hash table.
359 * init/tests/test_job.c (test_find_by_name): Drop test since this
360 function is now gone.
361 (test_free_deleted): Can't assume things are in a line now.
362 * init/control.c (control_job_list): Iterate the hash table.
363
Scott James Remnant3f9624c2007-02-09 17:16:07 +0000364 * init/event.c: Don't hide the events list anymore
365 * init/event.h: Publish it and the init function.
366 * init/job.c: Don't hide the jobs list anymore.
367 (job_list): Since we don't hide it, we can drop this.
368 * init/job.h: Publish it and the init function.
369 * init/notify.c: Don't hide the subscriptions list anymore.
370 * init/notify.h: Publish it and the init function.
371 * init/control.c (control_job_list): Iterate the job list directly
372 * init/tests/test_control.c (test_event_emit): Use the events list
373 available to us.
374 * init/tests/test_event.c (test_poll): Call job_init directly and
375 just use the events list available to us.
376 * init/tests/test_job.c (test_new): Call job_init directly.
377 (test_change_state): Use the events list available to us.
378 * init/tests/test_notify.c (test_unsubscribe): Use the subscriptions
379 list available to us.
380
Scott James Remnant9709a8d2007-02-09 16:08:21 +0000381 * doc/states.dot: Add updated state graph.
382 * doc/Makefile.am (EXTRA_DIST): Ship the states diagram.
383 (states.png): Include rules to build the png, we'll put it in bzr
384 anyway, but this is useful.
385
Scott James Remnant92b01602007-02-09 15:46:55 +0000386 * init/cfgfile.c (cfg_delete_handler): Handle deleted jobs; mark
387 the job as deleted, and if it's dormant, invoke a state change.
388
Scott James Remnant9c0215a2007-02-09 15:42:20 +0000389 * upstart/enum.h: Add a new JOB_DELETED state.
390 * upstart/enum.c (job_state_name, job_state_from_name): Add the new
391 state to the string functions.
392 * upstart/tests/test_enum.c (test_state_name)
393 (test_state_from_name): Check the enum works.
394 * init/job.c (job_change_goal): New decision; we can start a waiting
395 job if it's marked delete (it might be a new instance) -- we'll use
396 the new deleted state to decide that we shouldn't.
397 (job_change_state): Once we reach waiting, if the job is to be deleted,
398 move to the next state.
399 (job_next_state): The next state for a waiting job if the goal is stop
400 is deleted. We should never call job_next_state () for a deleted job.
401 (job_free_deleted): Very simple function, just detects
402 deleted jobs and frees them.
403 * init/job.h: Add prototype for new function.
404 * init/tests/test_job.c (test_change_goal): Update test to use new
405 deleted state; and don't even change the goal.
406 (test_change_state): Add a check to make sure we end up in deleted.
407 (test_next_state): Make sure waiting goes to deleted.
408 (test_free_deleted): Check the function.
409
Scott James Remnant07dd5db2007-02-09 15:20:25 +0000410 * init/job.c (job_change_goal): Don't try and start a job if it's
411 marked to be deleted and is just waiting for cleanup.
412 * init/tests/test_job.c (test_change_state): Make sure that the cause
413 is released when we reach waiting.
414
Scott James Remnanta1ade132007-02-09 15:07:30 +0000415 * init/tests/test_cfgfile.c (test_read_job): Make sure that a deleted
416 job gets resurrected.
417
Scott James Remnant25873b52007-02-09 13:35:43 +0000418 * init/cfgfile.c (cfg_visitor): Correct number of arguments and call
419 to cfg_job_name.
420
Scott James Remnant3b5daf62007-02-09 13:31:01 +0000421 * TODO: Update.
422
Scott James Remnant845c6cb2007-02-09 13:29:27 +0000423 * init/cfgfile.c (cfg_stanza_daemon): Don't allow arguments anymore.
424 * init/tests/test_cfgfile.c (test_stanza_daemon): Update tests.
425
Scott James Remnant1cdc1632007-02-09 13:26:09 +0000426 * init/job.c (job_handle_event_finished): Function to unblock all
427 jobs blocked on a given event emission.
428 (job_new, job_emit_event): Rename blocker to blocked; it's useful for
429 testing for truth.
430 * init/job.h: Add prototype, rename member.
431 * init/tests/test_job.c (test_handle_event_finished): Test it.
432 (test_new, test_change_state): Update name here too.
433 * init/event.c (event_finished): Call job_handle_event_finished
434 function to unblock jobs.
435 * init/tests/test_event.c (test_poll): Make sure the job gets
436 unblocked; a few other tests have to change since running event_poll
437 always unblocks the job if nothing listens to it.
438
Scott James Remnantba5ebb02007-02-09 04:46:39 +0000439 * init/job.c (job_child_reaper): Set failed back to FALSE if
440 we're respawning, since we don't want to be failing.
441 * init/tests/test_job.c (test_child_reaper): cause will be NULL.
442 also free and poll events when done.
443 (test_handle_event): pid can never be -1
444 (test_change_state): poll events when done
445
Scott James Remnantfd0cc552007-02-09 04:39:36 +0000446 * init/tests/test_job.c (test_child_reaper): Process will always
447 be zero on return from reaper.
448
Scott James Remnantef11ca42007-02-09 04:37:24 +0000449 * init/tests/test_job.c (test_child_reaper): Killed doesn't go past
450 stopping; it goes to waiting, which will clear the cause.
451
Scott James Remnanta5034982007-02-09 04:36:12 +0000452 * init/tests/test_job.c (test_child_reaper): Fill in values before
453 we test against them.
454
Scott James Remnantda1ae312007-02-09 04:35:33 +0000455 * init/tests/test_job.c (test_kill_process): Fix violated assertion
456
Scott James Remnant011e4ae2007-02-09 04:35:00 +0000457 * init/tests/test_job.c (test_change_state): This should be failed
458 because nothing cleared it.
459
Scott James Remnant4f4ea832007-02-09 04:33:50 +0000460 * init/tests/test_job.c (test_change_state): Fix a couple of array
461 index problems.
462
Scott James Remnantaf9b63f2007-02-09 04:32:50 +0000463 * init/tests/test_job.c (test_change_state): Why set that which
464 does not change?
465
Scott James Remnantfcc51902007-02-09 04:30:43 +0000466 * init/tests/test_job.c (test_change_state): Add newline to test.
467
Scott James Remnant5f936192007-02-09 04:29:54 +0000468 * init/job.c (job_emit_event): Add the job name as an argument;
469 oops.
470
Scott James Remnantf89b1612007-02-09 04:28:09 +0000471 * init/tests/test_control.c (test_job_stop): Need to kill the process
472 ourselves, as we're blocked on an event.
473 (test_job_query): Fix wrong value in test.
474 (check_job_stopped, test_job_stop, test_unwatch_jobs): Change job
475 name to match the test.
476
Scott James Remnant7178e722007-02-09 04:22:04 +0000477 * init/job.c (job_change_state): Must only not enter some states
478 with no process now; others like killed actually usually want one!
479
Scott James Remnant851a05c2007-02-09 04:18:20 +0000480 * init/tests/test_cfgfile.c (test_read_job): Fix test case.
481
Scott James Remnant6c088782007-02-09 04:13:43 +0000482 * init/tests/test_job.c (test_handle_event): Clean up tests.
483 (test_detect_stalled): Clean up.
484
Scott James Remnantbfcb6162007-02-09 04:08:53 +0000485 * init/job.c (job_child_reaper): Update the reaping of the child
486 processes; there's a much larger state range for the main process
487 now, so that needs to be taken into account.
488 * init/tests/test_job.c (test_child_reaper): New test cases.
489
Scott James Remnantd7ac93f2007-02-09 03:39:00 +0000490 * init/job.c (job_next_state): Encapsulate the slightly odd three
491 exit states of running in this function, otherwise we'll end up
492 special-casing it in places I'd rather not think about.
493 (job_change_goal): Only change the state of a running job if it
494 has a process.
495 * init/tests/test_job.c (test_next_state): Add a test case for the
496 dead running job
497 (test_change_goal): Add test case for the dead running job
498
Scott James Remnantd285b832007-02-09 02:49:06 +0000499 * init/tests/test_job.c (test_change_state): Add test cases for
500 the forgotten stopping to killed transition.
501
Scott James Remnant999fc9a2007-02-09 02:44:25 +0000502 * init/job.c (job_kill_process, job_kill_timer): Just check the pid
503 and state, and no longer any need to notify jobs since we're just
504 called from one state amongst many.
505 (job_change_state): Skip over the killed state if there's no process.
506 * init/tests/test_job.c (test_kill_process): Update test cases.
507
Scott James Remnantad011612007-02-09 02:34:03 +0000508 * init/job.c (job_run_process): Simplify a little bit, no need to
509 do the state assertions here, just make sure there's no already
510 a process running.
511 * init/tests/test_job.c (test_run_command, test_run_script): Run
512 tests in the spawned state, since that's where we run the primary
513 command or script. Drop check for process state since that's no
514 longer set.
515
Scott James Remnant8bd1b042007-02-09 02:27:40 +0000516 * init/job.c (job_change_state, job_next_state): Ok, here's the big
517 one ... rewrite this to use the new state transitions. This has
518 suddenly got a lot simpler and easier to read, this was definitely a
519 good idea.
520 (job_emit_event): Function to make emission of events easier.
521 (job_failed_event): replaces this one which wasn't so easy.
522 * init/tests/test_job.c (test_change_state): I can't say how much I
523 wasn't looking forwards to rewriting these test cases; anyway, it's
524 done now and I hope they're all right;
525 (test_next_state): Make sure the state transitions are correct too.
526
Scott James Remnant6aee3782007-02-09 00:45:29 +0000527 * init/job.h: Rename is_instance to delete and spawns_instance to
528 just instance.
529 * init/job.c (job_new): Update.
530 * init/tests/test_job.c (test_new): Update.
531 * init/cfgfile.c (cfg_stanza_instance): Update.
532 * init/tests/test_cfgfile.c (test_stanza_instance): Update.
533
Scott James Remnant535c6902007-02-09 00:43:03 +0000534 * init/event.h: Correct the event names.
535
Scott James Remnante2edac92007-02-09 00:39:24 +0000536 * init/job.h: Add blocker event member.
537 * init/job.c (job_new): Initialise it to NULL.
538 * init/tests/test_job.c (test_new): Check it.
539
Scott James Remnante885d552007-02-09 00:01:46 +0000540 * init/job.c (job_change_goal): Have a stab at this function with the
541 new state machine; it gets somewhat simpler (until we introduce the
542 second scripts), now we just induce things by a state change.
543 * init/tests/test_job.c (test_change_goal): Made easier (for now)
544 because we don't need to deal with processes and can just wait to
545 be blocked on an event.
546
Scott James Remnant9e13a242007-02-08 00:24:21 +00005472007-02-08 Scott James Remnant <scott@netsplit.com>
548
Scott James Remnant5e469e42007-02-08 23:49:01 +0000549 * init/cfgfile.c (cfg_read_job): Drop check for useless respawn script
550 (cfg_stanza_respawn): Drop handling of "respawn script"
551 * init/tests/test_cfgfile.c (test_stanza_respawn): Drop the checks
552 for "respawn script"
553
Scott James Remnant4fdf7552007-02-08 23:45:34 +0000554 * init/job.h: Move things about a bit more; remove respawn_script
555 since that state is going away.
556 * init/job.c (job_new): Drop initialisation of process_state.
557 * init/tests/test_job.c (test_new): Improve the tests.
558
Scott James Remnant3856c632007-02-08 23:29:17 +0000559 * init/main.c (STATE_FD): Remove this define, not used anymore.
560
Scott James Remnantbc281c32007-02-08 23:25:33 +0000561 * init/tests/test_event.c (test_poll): Update the event checking
562 to match what's likely to happen.
563
Scott James Remnant049b50f2007-02-08 23:23:29 +0000564 * init/event.h: Remove commented out bit.
565
Scott James Remnant1abebfd2007-02-08 23:20:02 +0000566 * init/tests/test_notify.c (check_job_status, test_job): Correct
567 state usage to match a possible state.
568
Scott James Remnant64bc2a82007-02-08 22:59:46 +0000569 * init/control.c (control_job_start, control_job_stop)
570 (control_job_query, control_job_list): Drop process state and
571 description from the job status messages we send back.
572 * init/tests/test_control.c (test_error_handler)
573 (check_job_started, test_job_start, check_job_stopped)
574 (check_job_stopping, test_job_query, check_job_starting)
575 (test_job_list, test_watch_jobs, test_unwatch_jobs): Remove
576 process_state and description, and update usage of job states.
577
Scott James Remnantcb178f82007-02-08 22:47:42 +0000578 * init/notify.c (notify_job): Don't include process state or
579 description in the job status message anymore.
580 * init/tests/test_notify.c (check_job_status, test_job): Update tests
581
Scott James Remnant79cd4bf2007-02-08 22:44:46 +0000582 * init/cfgfile.c (cfg_read_job): Drop the copying of the process_state
583 member, since it doesn't exist anymore.
584 * init/tests/test_cfgfile.c (test_read_job): Drop the check too.
585
Scott James Remnant6f0ff592007-02-08 22:43:04 +0000586 * init/job.h (Job): Drop the process_state member.
587
Scott James Remnant56a1fa82007-02-08 22:40:01 +0000588 * util/jobs.c (handle_job_status): Drop the process_state and
589 description arguments; output a process id only if it's greater
590 than zero.
591 * util/tests/test_jobs.c (test_start_action, test_list_action)
592 (test_jobs_action): Update tests to use newer states and arguments.
593 * util/events.c (handle_event_job_status): Simplify in the same way
594
Scott James Remnantac0c88b2007-02-08 22:31:00 +0000595 * upstart/message.h: Remove process_state and description from the
596 job status event (we already had the foresight to not put them in
597 the event job status event).
598 * upstart/message.c (upstart_message_new, upstart_message_handle):
599 Update handling of the messages to reduce the arguments.
600 * upstart/tests/test_message.c (test_new, my_handler)
601 (test_handle): Update the tests for the new job status message.
602
Scott James Remnante76986a2007-02-08 22:21:22 +0000603 * upstart/enum.h (JobState): Change the job states to the new set
604 of states that we've planned.
605 (ProcessState): Drop process state entirely; this information is now
606 contained in the single JobState field.
607 * upstart/enum.c (job_state_name, job_state_from_name): Update
608 strings to match the new state names.
609 (process_state_name, process_state_from_name): Drop these functions.
610 * upstart/tests/test_enum.c (test_state_name)
611 (test_state_from_name): Update test cases to match new names.
612 (test_process_state_name, test_process_state_from_name): Drop.
613
Scott James Remnant08100e02007-02-08 17:57:21 +0000614 * init/main.c (main): Remove the logd hack for now.
615 * init/job.c (job_new): Change the default console to none for now.
616 * init/tests/test_job.c (test_new): Update test.
617 * init/cfgfile.c (cfg_stanza_console): Can't guard against duplicates
618 for a while.
619 * init/tests/test_cfgfile.c (test_stanza_console): Comment out dup test
620
Scott James Remnantf247adf2007-02-08 15:23:43 +0000621 * init/cfgfile.c (cfg_read_job): Remove the restriction that there
622 must be either an 'exec' or 'script' for a job; jobs without either
623 define states others can use.
624 * init/tests/test_cfgfile.c (test_read_job): Convert the test to
625 a "must work".
626 * init/job.c (job_change_state): Remove restriction that we must
627 have either a script or a command; having neither should just wedge
628 the job at the running rest state. Note that there's no way to get
629 it out yet, because we don't force that particular state change.
630 * init/tests/test_job.c (test_change_state): Make sure that works.
631
Scott James Remnant920d65b2007-02-08 13:49:53 +0000632 * init/job.c (job_change_cause): Put the knowledge about how to
633 change the cause into a separate function, since it's slightly
634 tricky.
635 (job_change_goal, job_change_state): Set the cause using the above
636 function.
637
Scott James Remnanta3bcac12007-02-08 13:40:53 +0000638 * init/job.h (Job): Rename goal_event to cause, also shuffle things
639 around so that the state is mostly together.
640 * init/job.c, init/process.c, init/notify.c, init/cfgfile.c: Update
641 references (and comments) to match the new name.
642 * init/tests/test_job.c, init/tests/test_event.c,
643 init/tests/test_process.c, init/tests/test_cfgfile.c,
644 init/tests/test_notify.c: Likewise.
645
Scott James Remnantef119832007-02-08 13:24:16 +0000646 * init/job.c (job_child_reaper): Don't change the goal event; the
647 state changes will handle this.
648 (job_change_goal): Only dereference/reference the goal event if we're
649 actually changing it.
650 * init/tests/test_job.c (test_change_state, test_child_reaper):
651 Update tests to not assume that the goal event gets changed.
652 (test_kill_process): Eliminate race condition.
653
Scott James Remnant93376ef2007-02-08 12:53:53 +0000654 * init/job.c (job_child_reaper): Correct some problems with job and
655 event failure; we now don't overwrite an existing failure record,
656 and don't record failure if the main process failed and the goal was
657 stop; since we likely caused it.
658 * init/tests/test_job.c (test_child_reaper): More test cases.
659
Scott James Remnantc3db81c2007-02-08 12:38:19 +0000660 * logd/event.d/logd.in: Stop on the new runlevel events, not the
661 shutdown event.
662
Scott James Remnante8d263c2007-02-08 03:20:30 +0000663 * compat/sysv/shutdown.c (shutdown_now): Emit an ordinary runlevel
664 change event now; including the INIT_HALT environment variable
665 * compat/sysv/man/shutdown.8: Update the manual
666
Scott James Remnant52360ea2007-02-08 03:06:40 +0000667 * compat/sysv/telinit.c: Now just sends out a runlevel event with
668 an argument giving the new runlevel.
669 * compat/sysv/man/telinit.8: Update description of the command.
670
Scott James Remnant8662bd02007-02-08 02:57:56 +0000671 * upstart/message.h: Remove the UPSTART_SHUTDOWN message.
672 * upstart/message.c (upstart_message_new, upstart_message_handle):
673 Remove handling for the shutdown message.
674 * upstart/tests/test_message.c (test_new, test_handle): Remove
675 tests against the shutdown message.
676 * init/control.c (control_shutdown): Remove the shutdown command
677 from the server.
678 * init/tests/test_control.c (test_shutdown): Remove tests for it.
679 * init/event.h: Remove the shutdown event.
680 * util/initctl.c: Remove the shutdown command reference.
681 * util/events.c (shutdown_action): Remove the command.
682 * util/events.h: Update.
683 * util/tests/test_events.c (test_shutdown_action): Remove tests.
684
Scott James Remnant65906602007-02-08 02:51:39 +0000685 * init/job.c (job_detect_idle): Rename to job_detect_stalled
686 (job_detect_stalled): Remove the idle state detection
687 (job_set_idle_event): Idle event has been removed.
688 * init/job.h: Update.
689 * init/tests/test_job.c (test_detect_idle): Rename to
690 (test_detect_stalled): and remove idle detection tests.
691 * init/main.c (main): Replace job_detect_idle with job_detect_stalled
692 * init/control.c (control_shutdown): Don't set the idle event.
693 * init/tests/test_control.c (test_shutdown): Don't detect the idle
694 event (and thus the second event)
695
Scott James Remnantb0d99d52007-02-08 02:40:43 +0000696 * init/cfgfile.c (cfg_stanza_service): Parser for service stanza.
697 * init/tests/test_cfgfile.c (test_stanza_service): Test the service
698 stanza.
699 (test_stanza_respawn): Check that respawn implies service.
700 * TODO: Update.
701
702 * init/job.h (Job): Add a new service member.
703 * init/job.c (job_new): Service starts off as false.
704 (job_change_state): Check service instead of respawn.
705 * init/tests/test_job.c (test_change_state): Check with service
706 instead of respawn, since that's what we really mean.
707
Scott James Remnante4ab75c2007-02-08 02:28:19 +0000708 * init/cfgfile.c (cfg_read_job): Copy a whole bunch more state
709 into the newly parsed job.
710 * init/job.c (job_run_process): Only output the first error.
711 * init/tests/test_cfgfile.c (test_read_job): Make sure important
712 things are copied.
713 * TODO: Update.
714
Scott James Remnantdb31c152007-02-08 02:05:38 +0000715 * init/main.c: Restore a much simplified version of the term
716 handler that doesn't try and copy across any state.
717
Scott James Remnant517f5552007-02-08 02:02:52 +0000718 * compat/sysv/telinit.c: Update call to event_emit; we'll revisit
719 this shortly when we get rid of the shutdown event.
720
Scott James Remnant1dc0de52007-02-08 01:57:34 +0000721 * util/events.c (handle_event): Add new id field (but ignore it)
722 Functio
723 (handle_event_job_status): New function to handle the new event.
724 (handle_event_finished): Function to handle the end of the event.
725 (emit_action): Send the newer event, and loop over replies until
726 we get a finished one.
727 * util/tests/test_events.c (test_emit_action): Update tests cases.
728
Scott James Remnantd9520172007-02-08 01:18:24 +0000729 * init/control.c (control_event_emit): New function to handle the
730 new-style emit message.
731 * init/tests/test_control.c (test_event_emit): Make sure the new
732 message function behaves.
733
Scott James Remnantb3e539e2007-02-08 01:10:12 +0000734 * init/event.c, init/job.c, init/main.c, init/tests/test_event.c,
735 init/tests/test_job.c: Completely drop the serialisation code, it's
736 getting out of date and in the way.
737
Scott James Remnant71b91fc2007-02-08 01:07:56 +0000738 * init/event.h: Remove compatibility macros.
739 (EventEmission): Drop the callback function; it was too error prone
740 to try and do it this way, and we only ever wanted to release a job
741 anyway as control requests are better handled through the notify
742 interface.
743 (EventEmissionCb): Drop unused typedef.
744 * init/event.c (event_emit): Drop callback argument.
745 (event_finished): Don't call the callback
746 * init/tests/test_event.c: Update to avoid callbacks.
747 * init/job.c (job_change_state): Convert to using event_emit and
748 EventEmission.
749 (job_detect_idle): Drop extra arguments to event_emit.
750 * init/main.c (main, cad_handler, kbd_handler): Drop extra arguments
751 to event_emit.
752 * init/control.c (control_shutdown): Use event_emit instead of
753 event_queue.
754 * init/tests/test_control.c (test_shutdown): Convert to using
755 EventEmission.
756 (test_watch_events, test_unwatch_events): Drop extra arguments to
757 event_emit.
758 * init/tests/test_notify.c (test_subscribe_event, test_job)
759 (test_event, test_event_finished): Drop extra arguments to event_emit
760 * init/tests/test_job.c (test_change_goal, test_change_state)
761 (test_run_script, test_child_reaper, test_detect_idle): Drop
762 extra arguments to event_emit.
763 * init/tests/test_process.c (test_spawn): Drop extra arguments to
764 event_emit.
765
Scott James Remnantf082fc42007-02-08 00:50:11 +0000766 * TODO: Update.
767
Scott James Remnant716f75c2007-02-08 00:49:40 +0000768 Rewrite the notification subsystem quite significantly; now we
769 have individual functions to subscribe to different types of
770 notification, and can even subscribe to individual jobs or events.
771
772 * init/notify.c (notify_subscribe_job, notify_subscribe_event)
773 (notify_unsubscribe): New subscription and unsubscription functions
774 that assume one record per subscription, not process.
775 (notify_subscription_find): Function to find a subscription.
776 (notify_job): Send a message to anything subscribed to the goal event
777 as well.
778 (notify_event): Use EventEmission and include the id in the event.
779 (notify_event_finished): New function, sends a finished message and
780 includes both the id and whether the event failed.
781 * init/notify.h (NotifySubscribe): New notify structure that is
782 once per subscription, rather than per-process; and allows
783 subscription to individual jobs or events.
784 * init/tests/test_notify.c (test_subscribe_job)
785 (test_subscribe_event, test_unsubscribe): Test the new subscription
786 functions, replacing the old
787 (test_subscribe): tests.
788 (test_subscription_find): Check finding works
789 (check_event, test_event): Update to use emissions, and check that the
790 id is correct.
791 (test_event_finished): Check this one works too
792 (check_event_job_status, test_job): Make sure processes subscribed
793 via the goal event are notified too.
794 * init/event.c (event_pending): Pass the emission directly.
795 (event_finished): Notify subscribers that the event has finished.
796 * init/control.c (control_error_handler): Call notify_unsubscribe
797 (control_watch_jobs, control_unwatch_jobs, control_watch_events)
798 (control_unwatch_events): Update to the new subscription API.
799 * init/tests/test_control.c (test_error_handler): Use new API
800 (test_watch_jobs, test_unwatch_jobs, test_watch_events)
801 (test_unwatch_events): Also update these to the new API; use a
802 destructor to make sure the subscription is freed.
803
Scott James Remnant9e13a242007-02-08 00:24:21 +0000804 * init/tests/test_process.c: Don't use printf, use TEST_FUNCTION
805
Scott James Remnante627ad42007-02-07 00:23:57 +00008062007-02-07 Scott James Remnant <scott@netsplit.com>
807
Scott James Remnant459aee32007-02-07 22:44:08 +0000808 * upstart/message.h: Allocate new grouped event messages.
809 * upstart/message.c (upstart_message_new, upstart_message_handle):
810 Add support for the new grouped event messages.
811 * upstart/tests/test_message.c (test_new, test_handle)
812 (my_handler): Make sure the new messages are passed correctly.
813
Scott James Remnant1d792152007-02-07 20:56:01 +0000814 * init/job.c (job_change_state): Clear the goal event whenever we
815 reach the final rest state of a job (waiting for all jobs, running
816 for services).
817 * init/tests/test_job.c (test_change_state): Check that the goal
818 event goes away at the right times.
819 * TODO: Update.
820
Scott James Remnantab17ab92007-02-07 20:38:01 +0000821 * init/tests/test_job.c (test_child_reaper): Make sure that the
822 event is marked failed properly
823
Scott James Remnant6d007b82007-02-07 20:21:54 +0000824 * init/job.c (job_start_event, job_stop_event): There's no reason
825 for these to exist as seperate functions anymore, especially since
826 we want to eventually have some kind of match table.
827 (job_handle_event): Perform the iterations and match calls here
828 instead, since we just call job_change_goal now.
829 * init/job.h: Remove prototypes.
830 * init/tests/test_job.c (test_start_event, test_stop_event): Fold into
831 (test_handle_event): which now handles all the cases.
832
Scott James Remnant269b7b92007-02-07 20:04:42 +0000833 * init/job.c (job_detect_idle): Call event_emit
834 * init/main.c (main, cad_handler, kbd_handler): Call event_emit
835 instead of event_queue.
836 * init/tests/test_event.c (test_new): Call event_poll
837 * init/tests/test_job.c (test_change_state, test_child_reaper)
838 (test_detect_idle, test_change_state): Update to use newer event API.
839 * TODO: Update.
840
Scott James Remnant80eabbc2007-02-07 19:54:27 +0000841 * init/job.c (job_start, job_stop): Drop these functions; call
842 job_change_goal instead (which is now public).
843 (job_change_state, job_child_reaper): Call job_change_goal instead.
844 * init/job.h: Update.
845 * init/tests/test_job.c (test_start, test_stop): Merge into new
846 (test_change_goal): function.
847 * init/main.c (main): Call job_change_goal instead of job_start.
848 * init/control.c (control_job_start, control_job_stop): Call
849 job_change_goal instead.
850
Scott James Remnant4522f4d2007-02-07 19:38:19 +0000851 * init/tests/test_job.c (test_new, test_change_state)
Scott James Remnant80eabbc2007-02-07 19:54:27 +0000852 (test_run_script, test_start, test_stop, test_start_event):
Scott James Remnant4522f4d2007-02-07 19:38:19 +0000853
854 * init/job.h (Job): goal_event is now an EventEmission, and is
855 a direct pointer to the one in the events queue, rather than a copy.
856 * init/process.c (process_setup_environment): Reference the event
857 name and environment through the goal event, not directly.
858 * init/job.c (job_run_script): Reference the event name and
859 environment through the goal event, not directly.
860 (job_change_state, job_child_reaper): Replace direct setting of the
861 job goal with a call to job_stop; the process state is always
862 PROCESS_NONE in all three cases, so this is completely safe.
863 (_job_start, _job_stop): Merge these two functions together into
864 (job_change_goal): which behaves a lot more like job_change_state,
865 except that it doesn't loop. This handles the changing of the
866 emission.
867 (job_start, job_start_event, job_stop, job_stop_event): Simplify
868 these functions, now they just call job_change_goal passing in
869 the emission pointer (or NULL).
870
Scott James Remnantb1db7a32007-02-07 16:33:27 +0000871 * init/main.c, init/job.c, init/job.h, init/event.c, init/event.h,
872 init/tests/test_job.c, init/tests/test_event.c: Remove state
873 serialisation code for the time being; maintaining it is getting
874 increasingly harder, and it introduces some major bugs. It will
875 get rewritten shortly.
876
Scott James Remnant4216cc82007-02-07 16:22:47 +0000877 * init/event.c (event_pending): Pass the emission directly to
878 job_handle_event now.
879 * init/job.c (job_handle_event, job_start_event, job_stop_event):
880 Deal with event emissions rather than just plain events, the change
881 so far doesn't do anything else other than take the structure change.
882 * init/job.h: Change prototypes.
883 * init/tests/test_job.c (test_start_event, test_stop_event)
884 (test_handle_event): Update tests to use emissions.
885
Scott James Remnantb2d06d42007-02-07 15:55:33 +0000886 * init/tests/test_event.c (test_read_state, test_write_state): Check
887 the passing of the progress information.
888 * init/event.c (event_read_state, event_write_state): Add progress
889 field to the serialisation (oops).
890
Scott James Remnantab132da2007-02-07 15:48:02 +0000891 * init/event.h: Add missing attribute for event_read_state.
892 * init/cfgfile.h: Add missing attributes.
893 * init/main.c (read_state): Don't discard return value.
894 * TODO: Update.
895
Scott James Remnantfcc9a0d2007-02-07 15:41:57 +0000896 * init/main.c (read_state): Handle the Emission keyword; also handle
897 Event really being an EventEmission.
898 * init/event.c (event_emit): Make the next emission id a static global
899 (event_read_state, event_write_state): Serialise event emission
900 structures, not plain events; also send over the last id we used so
901 it appears seamless. This doesn't yet handle the callback/data bit
902 of the serialisation, which turns out to be a little tricky ... oops
903 * init/event.h: Update.
904 * init/tests/test_event.c (test_read_state, test_write_state): Check
905 that serialisation is done with EventEmissions instead, and all the
906 fields are passed (except callback and data which are ... tricky).
907
Scott James Remnanta39da0f2007-02-07 13:52:42 +0000908 * init/main.c (main): Call event_poll instead of event_queue_run.
909
Scott James Remnante47588c2007-02-07 13:50:01 +0000910 * init/event.c (event_poll): Add the new function that replaces
911 event_queue_run(); handles the new-style event emission structures
912 in the list and only returns when there are no non-handling events.
913 (event_pending, event_finished): Handling of particular event states
914 during poll; split out for readability.
915 (event_queue, event_queue_run): Drop these obsolete functions.
916 (event_read_state): Force type from event_queue.
917 * init/event.h: Add event_poll prototype; remove prototypes of old
918 functions, replacing with #defines for now so things still compile.
919 * init/tests/test_event.c (test_queue): Drop tests.
920 (test_read_state, test_write_state): Force type from event_queue
921 Change type we check size of.
922 (test_poll): Pretty thoroughly test the new poll function.
923 * init/job.c (job_change_state): Force type from event_queue
924 * init/control.c (control_event_queue): Force type from event queue
925 * init/tests/test_job.c (test_detect_idle): Force type from event_queue
926 * init/tests/test_control.c (test_event_queue, test_shutdown):
927 Force type from event_queue
928
Scott James Remnant162c2b22007-02-07 11:32:04 +0000929 * init/event.c: Revert to a single list of events with an enum
930 (event_emit): Set the progress to pending initially.
931 (event_emit_find_by_id): Simplify now it just checks one list
932 (event_emit_finished): Function for jobs to call once they've done
933 with an event; just sets the progress to finished for the event
934 queue to pick up.
935 * init/tests/test_event.c (test_emit_finished): Check it.
936
937 * init/event.h: Add prototype.
938 (EventProgress): Add new enum
939 (EventEmission): And add progress member to this structure
940 * init/tests/test_event.c (test_emit): Make sure the event is pending
941
Scott James Remnantd379a602007-02-07 10:58:06 +0000942 * init/event.c (event_emit_find_by_id): Locate an event emission
943 by its id in either the pending or handling queue.
944 * init/event.h: Add prototype
945 * init/tests/test_event.c (test_emit): Make sure that the emission
946 id is unique each time.
947 (test_emit_find_by_id): Test the function.
948
Scott James Remnant7282c9a2007-02-07 03:14:08 +0000949 * init/event.c (event_emit): New function to replace event_queue();
950 returns an EventEmission structure with the details filled in as
951 given.
952 * init/event.h: Add prototype.
953
Scott James Remnant81cc7942007-02-07 02:54:25 +0000954 * init/event.c (event_init): Rename the single events queue to
955 pending and add a new handling list.
956
957 * init/event.h (EventEmission, EventEmissionCb): Add a new emission
958 structure that wraps an event, for use in the queue.
959
Scott James Remnantd82109e2007-02-07 02:15:39 +0000960 * util/tests/test_events.c (test_events_action): Update test now
961 that nih_message is more sensible.
962 * util/tests/test_jobs.c (test_start_action, test_list_action)
963 (test_jobs_action): Update test
964
Scott James Remnante5d3f012007-02-07 01:59:57 +0000965 * util/events.c (emit_action): Actually pass the emit_env array
966 * util/tests/test_events.c (test_emit_action): Make sure it does.
967
968 * util/initctl.c (main): Catch nih_command_parser() returning a
969 negative value to indicate an internal error, and always exit 1.
970
Scott James Remnant2cb93052007-02-07 01:49:43 +0000971 * util/events.c (handle_event): Build up multiple lines to describe
972 the event, including its arguments and environment.
973 * util/tests/test_events.c (test_events_action): Check the new output
974 format is right.
975
Scott James Remnant685644e2007-02-07 01:29:28 +0000976 * init/main.c (main): Take out inadvertantly leaked debugging code;
977 sorry about that.
978
Scott James Remnant5130e6d2007-02-07 01:18:38 +0000979 * init/job.c (job_child_reaper): Rewrite this to make the logic a
980 little easier to follow, and support signals in normalexit. This
981 also now applies to deciding whether the job failed, if it did, we
982 store that information in the job so the stop and stopped events
983 can get it.
984 * init/tests/test_job.c (test_child_reaper): Add new test cases for
985 the setting of the failed flags.
986
Scott James Remnant18935fe2007-02-07 00:38:13 +0000987 * init/cfgfile.c (cfg_stanza_normalexit): Allow signal names in the
988 arguments, which are added to the normalexit array or'd with 0x80
989 * init/tests/test_cfgfile.c (test_stanza_normalexit): Check that we
990 can now parse signal names correctly.
991
Scott James Remnant326c2312007-02-07 00:31:18 +0000992 * init/job.c (job_failed_event): Change add to addp to fix leak.
993
Scott James Remnante627ad42007-02-07 00:23:57 +0000994 * init/job.c (job_failed_event): Function to turn an event into one
995 that includes all the necessary arguments and environment.
996 (job_change_state): Call job_failed_event for the stop and stopped
997 events (bit hacky at the moment, will improve later).
998 * init/tests/test_job.c (test_change_state): Check that the failed
999 events are generated properly.
1000
Scott James Remnant2b2b7d12007-02-06 00:07:28 +000010012007-02-06 Scott James Remnant <scott@netsplit.com>
1002
Scott James Remnant038ef4d2007-02-06 23:46:53 +00001003 * init/job.c (job_change_state): Reset the failed member when
1004 we enter the starting state.
1005 * init/tests/test_job.c (test_change_state): Make sure that the
1006 failed member is reset when we enter the starting state.
1007
Scott James Remnantbd7ad1a2007-02-06 23:43:59 +00001008 * init/job.h (Job): Add failed, failed_state and exit_status members.
1009 * init/job.c (job_new): Initialise new members.
1010
Scott James Remnantddbf1162007-02-06 23:40:30 +00001011 * init/job.c (job_child_reaper): Convert signals to names when
1012 outputting status messages.
1013 * init/tests/test_job.c (test_child_reaper): Check that the signal
1014 name gets converted over.
1015
Scott James Remnantf11b7dc2007-02-06 23:03:48 +00001016 * init/event.h (CTRLALTDEL_EVENT): Now we've broken the shared
1017 namespace of events and jobs, rename the control-alt-delete event
1018 back to control-alt-delete.
1019
Scott James Remnant0ef0d392007-02-06 23:00:28 +00001020 * init/job.c (job_change_state): Replace the events generated as
1021 part of the job state, named for the job and state, with new state
1022 events that have the job name as an argument.
1023 * init/event.h: Define new job event names.
1024 * init/tests/test_job.c (test_change_state): Make sure the new
1025 events are correct, with the job name as an argument.
1026
Scott James Remnant1416d052007-02-06 22:42:55 +00001027 * init/job.c (job_change_state): Remove the job event; this has
1028 been repeatedly proved to be confusing.
1029 * init/tests/test_job.c (test_change_state): Remove checks for the
1030 job event.
1031
Scott James Remnant08146b92007-02-06 20:45:38 +00001032 * util/events.c (emit_action): Pass in extra arguments.
1033 (env_option): Function to parse an option given an environment
1034 variable.
1035 * util/events.h: Add prototype.
1036 * util/tests/test_events.c (test_emit_action): Make sure that the
1037 emit action works with no arguments and with arguments.
1038 (test_events_action): Send back events with the right number of args.
1039 (test_env_option): Check the env option parser works.
1040 * util/initctl.c: Give shutdown its own command and options, give
1041 emit a new -e option.
Scott James Remnante8f3ef92007-02-06 20:20:33 +00001042
Scott James Remnant7f69c622007-02-06 20:16:50 +00001043 * util/events.c (shutdown_action): Split out from emit, seeing as
1044 these are going to be different from now on.
1045 * util/events.h: Add prototype.
1046 * util/tests/test_events.c (test_shutdown_action): Copy test cases.
1047
Scott James Remnantca2df742007-02-06 20:13:32 +00001048 * init/control.c (control_event_queue): Take the arguments and
1049 environment from the event queue request; and reparent into the
1050 event.
1051 * init/tests/test_control.c (test_event_queue): Check that arguments
1052 and environment are copied across properly.
1053
Scott James Remnanta30a25f2007-02-06 20:08:22 +00001054 * init/notify.c (notify_event): Pass in the arguments and environment
1055 for the event.
1056 * init/tests/test_notify.c (check_event): Check for event arguments
1057 and environment from the notify process.
1058 (test_event): Add arguments and environment to the event we test with
1059
Scott James Remnantce51bfb2007-02-06 20:04:05 +00001060 * upstart/tests/test_message.c (test_new, test_handle): Send
1061 arguments and environment with the UPSTART_EVENT_QUEUE and
1062 UPSTART_EVENT messages.
1063 * upstart/wire.c (upstart_pop_int, upstart_pop_unsigned): Shrink
1064 only once.
1065 (upstart_pop_string): Check the length is at least one first, as
1066 we may just have an 'S'.
1067
1068 * upstart/message.c (upstart_message_new, upstart_message_handle):
1069 The UPSTART_EVENT and UPSTART_EVENT_QUEUE messages gain new array
1070 arguments containing the arguments and environment for the event.
1071 * upstart/message.h: Document the new arguments.
1072
Scott James Remnantd1a65342007-02-06 19:25:38 +00001073 * util/tests/test_events.c, util/tests/test_jobs.c: Update the
1074 message format checks here too.
1075
Scott James Remnantfb45e432007-02-06 19:07:24 +00001076 * upstart/tests/test_wire.c (test_pop_pack): Free the array.
1077
Scott James Remnanta8882032007-02-06 19:06:44 +00001078 * upstart/tests/test_message.c (test_new, test_handle)
1079 (test_handle_using, test_reader): Update tests to include and
1080 expect new type markers between each field.
1081
Scott James Remnantf9663f02007-02-06 18:58:37 +00001082 * upstart/wire.c (upstart_push_int, upstart_push_unsigned):
1083 Take out silly asserts; it must have room!
1084
Scott James Remnantc874a942007-02-06 18:57:34 +00001085 * upstart/wire.c (upstart_push_string, upstart_pop_string): Rewrite
1086 to use a type like the rest of the functions; this removes the strange
1087 length restriction and allows us to make the pop function
1088 non-destructive.
1089 * upstart/tests/test_wire.c (test_push_string): Update.
1090 (test_pop_string): Update, adding in non-destructive, wrong type
1091 and insufficient space for type test cases.
1092 (test_push_array, test_pop_array): These needed updated too,
1093 changing the string format changed the array format.
1094 (test_push_pack, test_pop_pack): And obviously the pack format changed.
1095
Scott James Remnant9ed52092007-02-06 18:36:51 +00001096 * upstart/wire.c (upstart_pop_header): Make the function
1097 non-destructive in the face of errors.
1098 * upstart/tests/test_wire.c (test_pop_header): Make sure that
1099 invalid headers are non-destructive on error.
1100
Scott James Remnantdc4436f2007-02-06 18:33:27 +00001101 * upstart/tests/test_wire.c (test_pop_int, test_pop_unsigned):
1102 Make sure that insufficient space is non-destructive.
1103
Scott James Remnantafc5b8c2007-02-06 18:32:08 +00001104 * upstart/wire.c (upstart_push_int, upstart_pop_int)
1105 (upstart_push_unsigned, upstart_pop_unsigned): Convert to array-style
1106 type first format.
1107 (upstart_push_string, upstart_push_header): Write the length and
1108 type fields out by hand so they don't get an 'i' prefix.
1109 (upstart_pop_string, upstart_pop_header): Read the length and type
1110 fields by hand so they don't get an 'i' prefix.
1111 * upstart/tests/test_wire.c (test_push_int, test_pop_int)
1112 (test_push_unsigned, test_pop_unsigned): Update test cases to match.
1113 (test_push_pack, test_pop_pack): Pack format was changed too.
1114
Scott James Remnanta63d4862007-02-06 18:10:58 +00001115 * upstart/wire.c (upstart_push_packv, upstart_pop_packv): Add calls
1116 to push and pop array.
1117 * upstart/tests/test_wire.c (test_push_pack, test_pop_pack): Test
1118 support for arrays.
1119
Scott James Remnant5b6a2022007-02-06 18:00:49 +00001120 * upstart/wire.c (upstart_push_array, upstart_pop_array): Implement
1121 new array functions; note that these use a newer format that allows
1122 us to transmit NULL without needing to limit the size of the array.
1123 * upstart/wire.h: Add prototypes.
1124 * upstart/tests/test_wire.c (test_push_array, test_pop_array):
1125 Test the new array functions.
1126
Scott James Remnantf1d51112007-02-06 16:22:48 +00001127 * init/job.c (job_run_script): Build up the argument list, appending
1128 those from the goal event if one is set.
1129 (job_run_command): Use nih_str_array_add to build up the arguments,
1130 but don't append those from the goal event (use script).
1131 * init/tests/test_job.c (test_run_script): Make sure the arguments get
1132 passed to the running shell scripts.
1133
Scott James Remnant2efe5562007-02-06 15:51:19 +00001134 * init/job.c (job_run_script): Only use the /dev/fd trick if we can
1135 actually stat /dev/fd; also don't hardcode that path ...
1136 * init/paths.h (DEV_FD): Add here.
1137
Scott James Remnantefa8c7e2007-02-06 15:02:23 +00001138 * init/process.c (process_setup_environment): Copy environment
1139 variables from the goal event into the job's process.
1140 * init/tests/test_process.c (test_spawn): Make sure the environment
1141 reaches the job, but doesn't override that in the job already.
1142
1143 * init/tests/test_job.c (test_start_event):
1144
Scott James Remnant0071dd32007-02-06 14:57:37 +00001145 * init/job.c (job_start_event, job_stop_event): Copy the arguments
1146 and environment from the event into the goal event.
1147
Scott James Remnantb3d4dee2007-02-06 14:39:35 +00001148 * init/job.c (job_read_state, job_write_state): Read and write
1149 arguments and environment for goal event.
1150 * init/tests/test_job.c (test_read_state, test_write_state): Test
1151 with arguments and environment to the goal event.
1152
Scott James Remnant4bba9702007-02-06 14:28:10 +00001153 * init/event.c (event_read_state, event_write_state): Read and write
1154 the arguments and environment of the event.
1155 * init/tests/test_event.c (test_read_state, test_write_state): Make
1156 sure arguments and environment are correctly serialised.
1157
Scott James Remnant462e7172007-02-06 13:30:24 +00001158 * init/cfgfile.c (cfg_stanza_console): Fix a leak of the console
1159 argument in the case of duplicated options.
1160 (cfg_stanza_env): Drop the counting now nih_str_array_addp does it;
1161 and be sure to use that function.
1162 (cfg_stanza_umask): Fix leak of umask argument
1163 (cfg_stanza_nice): Fix leak of nice argument
1164 * init/tests/test_event.c (test_new): Call event_queue_run so init
1165 is called outside of a TEST_ALLOC_FAIL block.
1166
Scott James Remnantfd196342007-02-06 13:19:03 +00001167 * init/event.c (event_new): Start off with NULL args and env, to
1168 match job (saves a few bytes).
1169 (event_match): Watch for NULL arguments!
1170 * init/tests/test_event.c (test_new): Check for NULL not alloc'd
1171
Scott James Remnantfc9a76e2007-02-06 13:14:46 +00001172 * init/cfgfile.c (cfg_stanza_on, cfg_stanza_start)
1173 (cfg_stanza_stop): Parse arguments to the on stanza and store them
1174 directly in the event.
1175 * init/tests/test_cfgfile.c (test_stanza_on, test_stanza_start)
1176 (test_stanza_stop): Make sure arguments are parsed into the event.
1177
Scott James Remnant5dd1bc92007-02-06 12:57:50 +00001178 * init/event.c (event_new): Use nih_str_array_new.
1179 * init/cfgfile.c (cfg_stanza_env): Rewrite to use nih_str_array.
1180
Scott James Remnant4d0fc0f2007-02-06 11:34:41 +00001181 * init/job.c (job_run_script): Check the error returned from
1182 nih_io_reopen; don't just loop. We only ever expect ENOMEM (the
1183 other error, EBADF, is impossible).
1184
Scott James Remnanteb8cb142007-02-06 11:31:27 +00001185 * init/job.c (job_change_state): Reset the goal_event to NULL when
1186 we catch a run-away job (as it's not stopping for the same event
1187 it started with).
1188 (job_child_reaper): Reset the goal_event to NULL after setting the
1189 goal to STOP.
1190 * init/tests/test_job.c (test_change_state, test_child_reaper):
1191 Check that the goal event gets reset whenever the goal gets changed.
1192
Scott James Remnant62e22f42007-02-06 02:08:19 +00001193 * init/tests/test_event.c: Use TEST_ALLOC_FAIL
1194
Scott James Remnant93cd4d22007-02-06 02:07:45 +00001195 * init/event.c (event_match): Match arguments using fnmatch() and
1196 allow more arguments in event1 than event2 (but not the other way
1197 around).
1198 * init/tests/test_event.c (test_match): Check the new permitted
1199 combinations.
1200
Scott James Remnant34b7c712007-02-06 01:57:45 +00001201 * init/event.h (Event): Add args and env members to Event.
1202 * init/event.c (event_new): Initialise args and env members to
1203 zero-length arrays.
1204 * init/tests/test_event.c (test_new): Use TEST_ALLOC_FAIL and
1205 make sure args and env are both initialised to a list containing
1206 just NULL.
1207
Scott James Remnantb36c1962007-02-06 01:48:09 +00001208 * util/jobs.c (start_action): Get the UPSTART_JOB environment variable
1209 and use that if we don't have any arguments passed to us.
1210 (do_job): Code split from the above function that handles a named job
1211 * util/tests/test_jobs.c (test_start_action): Make sure UPSTART_JOB
1212 is picked up.
1213
Scott James Remnant2a0b0852007-02-06 01:35:56 +00001214 * init/process.h: Add necessary attributes.
1215
Scott James Remnant0b10d502007-02-06 01:28:01 +00001216 * init/process.c (process_setup_environment): Set the UPSTART_JOB
1217 environment variable from the job, and the UPSTART_EVENT environment
1218 variable from the job's goal_event member (if set).
1219 * init/tests/test_process.c (test_spawn): Make sure we get the
1220 environment in the job.
1221
Scott James Remnantafce5282007-02-06 01:22:54 +00001222 * init/job.h: Add attributes to job_new and job_read_state.
1223 * init/tests/test_job.c: Use CHECK_ALLOC_FAIL on the functions we
1224 didn't get around to touching while we were in here.
1225
Scott James Remnant1b9914d2007-02-06 01:01:11 +00001226 * init/job.c (job_start_event, job_stop_event): Set the goal_event
1227 member to a copy of the event we found.
1228 (job_read_state): Use event_new instead of trying to do it by hand.
1229 * init/tests/test_job.c (test_start_event, test_stop_event): Use
1230 CHECK_ALLOC_FAIL; and make sure the goal_event is set properly.
1231 (test_start, test_stop, test_write_new): Use event_new here too
1232
Scott James Remnant9e7d25c2007-02-06 00:42:41 +00001233 * init/job.c (job_write_state): Output a goal_event field containing
1234 the event name or nothing for NULL.
1235 (job_read_state): Parse the goal_event field
1236 * init/tests/test_job.c (test_write_state): Make sure the state is
1237 written out properly.
1238 (test_read_state): Make sure that the state is parsed correctly too.
1239
Scott James Remnant7aa22b62007-02-06 00:32:30 +00001240 * init/job.c (job_start, job_stop): Split all of the code except
1241 the goal_event setting into two new static functions that this calls
1242 (_job_start, _job_stop): New static functions
1243 (job_start_event, job_stop_event): Call _job_start and _job_stop
1244 instead of job_start and job_stop
1245
Scott James Remnante4111be2007-02-06 00:17:27 +00001246 * init/job.c (job_catch_runaway): Move this function up a bit.
1247
Scott James Remnant5761ef02007-02-06 00:15:51 +00001248 * init/job.c (job_start, job_stop): Clear the goal_event member,
1249 these functions are called for a manual start.
1250 * init/tests/test_job.c (test_start, test_stop): Make sure the
1251 goal_event member is freed and set to NULL.
1252
Scott James Remnant2b2b7d12007-02-06 00:07:28 +00001253 * init/job.h (Job): Add a new goal_event member
1254 * init/job.c (job_new): Initialise the goal_event member to NULL.
1255 * init/tests/test_job.c (test_new): Check with TEST_ALLOC_FAIL;
1256 also make sure goal_event is initialised to NULL.
1257
Scott James Remnant506ad092007-02-05 21:09:30 +000012582007-02-05 Scott James Remnant <scott@netsplit.com>
1259
Scott James Remnantee7e5552007-02-05 23:14:10 +00001260 * configure.ac: Bump version to 0.3.3
1261
Scott James Remnantcf64c482007-02-05 23:14:00 +00001262 * NEWS: Update.
1263
Scott James Remnant506ad092007-02-05 21:09:30 +00001264 * init/process.c (process_spawn): Exit with 255 so we don't clash
1265 with anything that uses 1 as a normal exit code. Note why we only
1266 close 0..2 (everything else is FD_CLOEXEC).
1267 * init/cfgfile.c (cfg_watch_dir): Mark the inotify watch descriptor
1268 as FD_CLOEXEC.
1269 * init/control.c (control_open): nih_io_set_cloexec can only ever
1270 return EINVAL, so no point checking it.
1271
Scott James Remnant0b74ff62007-02-04 00:43:20 +000012722007-02-04 Scott James Remnant <scott@netsplit.com>
1273
1274 * init/tests/test_control.c: Remove strange old code.
1275
Scott James Remnant9c44a422007-02-03 12:17:14 +000012762007-02-03 Scott James Remnant <scott@netsplit.com>
1277
Scott James Remnant7b618862007-02-03 23:41:33 +00001278 * init/control.c (control_open_sock, control_reopen)
1279 (control_close_handler): Drop these functions; unconnected datagram
1280 sockets don't close -- so why try dealing with it?
1281 (control_error_handler): Don't reopen the socket on error, just log
1282 it -- the socket should be fine, there's no remote end to be lost,
1283 after all.
1284 * init/tests/test_control.c (test_close_handler): Drop.
1285 (test_error_handler): Drop the reopen tests.
1286
Scott James Remnant88c1aac2007-02-03 23:26:36 +00001287 * init/tests/test_job.c (test_run_script): Control socket doesn't
1288 get unexpectedly opened anymore; so no need to close it.
1289
1290 * init/control.c (control_open): Remove the strange behaviour that
1291 this can be called to get the socket. Instead make control_io
1292 global; we're all adults after all.
1293 * init/tests/test_control.c (test_open): Remove the test for the
1294 silly behaviour.
1295 * init/notify.c (notify_job, notify_event): Use the control_io
1296 pointer directly, and just do nothing if we lost it somehow.
1297
Scott James Remnant2e204b72007-02-03 23:15:28 +00001298 * init/main.c (main): Being unable tp open the control socket, or
1299 parse the configuration, should be a fatal error; stop being so
1300 damned liberal! <g> Don't reset the signal state if we're
1301 being restarted, as this loses any pending signals -- be happy
1302 that our parent left them in a good state. Set SIGCHLD to the
1303 standard handler, otherwise we might lose this before we start
1304 the main loop (which does the same anyway).
1305 (term_handler): Rework so we don't need to close and open the
1306 control socket; instead we just close it in the child that's
1307 going to send the state, and notify the parent that it's safe to
1308 exec (which will cause it to be closed so the new init can open it).
1309
Scott James Remnant3af85462007-02-03 18:31:54 +00001310 * init/tests/test_control.c (test_open): Fix valgrind error
1311 * init/tests/test_notify.c (test_subscribe): Fix valgrind error
1312
Scott James Remnante443b9c2007-02-03 18:24:18 +00001313 * init/notify.c (notify_subscribe): Make safe against ENOMEM.
1314 * init/tests/test_notify.c (test_subscribe): Use TEST_ALLOC_FAIL
1315
Scott James Remnant4b601d12007-02-03 18:20:00 +00001316 * init/control.c: Add needed attributes; tidy up formatting.
1317 (control_open): Don't let ENOMEM fail opening the control socket.
1318 * init/control.h: Add needed attributes.
1319 * init/tests/test_control.c (test_open): Test for failed allocation.
1320 * init/main.c (term_handler): Make sure we catch failure to open
1321 the control socket again.
1322
Scott James Remnantd308b432007-02-03 17:36:41 +00001323 * TODO: Update
1324
Scott James Remnant272938f2007-02-03 17:35:11 +00001325 * init/cfgfile.c (cfg_watch_dir): Clean this up a bit; now we only
1326 output a warning if inotify failed for any reason other than not
1327 being supported AND walking worked.
1328
Scott James Remnantd78d00e2007-02-03 17:27:32 +00001329 * init/cfgfile.c (cfg_watch_dir): Update to even newer watch API;
1330 our create_handler is now always called if inotify is successful,
1331 so we just need to fall back to walking the directory when it
1332 isn't -- if inotify isn't supported, don't even bother complaining.
1333 (cfg_create_modify_handler): Check the stat of the file visited to
1334 make sure it's a regular file.
1335 (cfg_visitor): Check the stat of the file visited to make sure it's
1336 a regular file.
1337
Scott James Remnantbcbb1122007-02-03 17:11:21 +00001338 * init/cfgfile.c: Update include to upstart/enum.h
1339 * init/job.c: Update include to upstart/enum.h
1340 * init/job.h: Update include to upstart/enum.h
1341
Scott James Remnant801f9e12007-02-03 17:10:06 +00001342 * logd/main.c: Add attribute to open_logging
1343
Scott James Remnantcbd0cf82007-02-03 17:05:39 +00001344 * util/initctl.c: Split out the command functions into new files;
1345 * util/jobs.c: This gets the job-related commands
1346 * util/events.h: This gets the event-related commands
1347 * util/initctl.h, util/jobs.h, util/events.h: Headers
1348 * util/tests/test_jobs.c: Test suite for job-related commands.
1349 * util/tests/test_events.c: Test suite for event-related commands.
1350 * util/Makefile.am (initctl_SOURCES): Add new files.
1351 (TESTS): Build new test suites.
1352 (test_jobs_SOURCES, test_jobs_LDFLAGS, test_jobs_LDADD):
1353 Details for job-related commands test suite binary.
1354 (test_events_SOURCES, test_events_LDFLAGS, test_events_LDADD):
1355 Details for event-related commands test suite binary.
1356 * TODO: Remove item about splitting initctl now we've done it.
1357
Scott James Remnantadfcc3f2007-02-03 12:24:07 +00001358 * TODO: Big update; strip anything we have a spec for.
1359
Scott James Remnant1157bbf2007-02-03 12:17:55 +00001360 * upstart/message.c (upstart_message_handle): Make sure that if we
1361 fail to parse a message, we don't leave strings around in memory.
1362 * upstart/tests/test_message.c (test_open): Check that we get a
1363 raised EADDRINUSE if we try an open a socket twice.
1364 (test_handle): Add lots of checks for things like NULL names and
1365 incomplete messages; as well as the obvious unknown message.
1366 (test_reader): Make sure that errors while handling messages are
1367 dealt with by logging it.
1368
Scott James Remnant9c44a422007-02-03 12:17:14 +00001369 * upstart/job.c, upstart/job.h, upstart/tests/test_job.c: Rename to
1370 enum.c, enum.h and tests/test_enum.c; since this just includes enums
1371 and convert functions really.
1372 * upstart/Makefile.am: Update.
1373 * upstart/libupstart.h: Update include.
1374 * upstart/tests/test_message.c: Update include.
1375
Scott James Remnant1e57ab22007-02-01 16:51:28 +000013762007-02-01 Scott James Remnant <scott@netsplit.com>
1377
Scott James Remnant0f1d9b62007-02-01 18:20:00 +00001378 * logd/main.c (main): Ensure we error if daemonise fails.
1379
Scott James Remnant36911572007-02-01 18:18:27 +00001380 * compat/sysv/shutdown.c (main): Ensure that signals and timers
1381 are added, even if we run out of memory.
1382
Scott James Remnant9b705ee2007-02-01 17:34:39 +00001383 * upstart/tests/test_message.c: Change from assert to assert0
1384 * upstart/tests/test_wire.c: Change from assert to assert0
1385 * init/tests/test_notify.c: Change from assert to assert0
1386 * init/tests/test_control.c: nih_io_message_send should always return
1387 a value greater than zero.
1388
Scott James Remnant91c6eb72007-02-01 17:19:32 +00001389 * upstart/tests/test_wire.c: Change to use assert instead of NIH_ZERO;
1390 the rationale here is that in test cases we just want to fail, not
1391 try again repeatedly.
1392 * upstart/tests/test_message.c: Likewise.
1393
Scott James Remnant9caf2822007-02-01 17:04:34 +00001394 * init/tests/test_control.c: Use assert to ensure we get the expected
1395 return values of functions that raise errors.
1396 * init/tests/test_notify.c: Use assert to ensure we get the expected
1397 return values of functions that raise errors.
1398
Scott James Remnant1e57ab22007-02-01 16:51:28 +00001399 * init/cfgfile.c (cfg_watch_dir): Port to the new NihWatch API and
1400 use nih_dir_walk(). This also fixes the long-standing bug where we
1401 wouldn't watch the configuration directory if inotify was disabled.
1402 Drop both the parent and prefix members for now, until we clean this
1403 up later.
1404 (cfg_create_modify_handler): Wrap cfg_read_job after figuring out
1405 the job name.
1406 (cfg_job_name): Function to figure out the job name from a path.
1407 (cfg_visitor): Visitor function to handle initial parsing, figuring
1408 out the job name; otherwise identical to the standard handler.
1409 * init/cfgfile.h: Update prototype for cfg_watch_dir.
1410 * init/main.c (main): Update call to cfg_watch_dir.
1411
Scott James Remnantbfd712d2007-01-31 12:13:25 +000014122007-01-31 Scott James Remnant <scott@netsplit.com>
1413
1414 * upstart/tests/test_message.c: Use TEST_ALLOC_FAIL to make sure
1415 allocations are handled properly.
1416
Scott James Remnant44828472007-01-30 11:53:33 +000014172007-01-30 Scott James Remnant <scott@netsplit.com>
1418
Scott James Remnant2cc36542007-01-30 17:12:34 +00001419 * upstart/wire.c: Note that if any of the push functions fail, the
1420 entire buffer should be discarded.
1421 * upstart/tests/test_wire.c (test_push_int, test_push_unsigned)
1422 (test_push_string, test_push_header, test_push_pack): Us
1423 TEST_ALLOC_FAIL to ensure that failing to allocate memory is caught.
1424
Scott James Remnant1084c682007-01-30 15:17:41 +00001425 * upstart/tests/test_message.c (my_handler): Free the name and
1426 description after checking; they aren't otherwise.
1427
Scott James Remnantdc8b3292007-01-30 15:01:30 +00001428 * upstart/wire.c (upstart_push_packv, upstart_pop_packv): Consume
1429 a copy of the va_list, so these can be called multiple times on the
1430 same list without ill effect.
1431
Scott James Remnant92d87442007-01-30 15:01:21 +00001432 * upstart/message.h: Add warn_unused_result attributes to
1433 upstart_message_handle and upstart_message_handle_using as they raise
1434 errors.
1435
Scott James Remnant2de25012007-01-30 14:57:27 +00001436 * upstart/wire.c: push functions return negative values to indicate
1437 insufficient memory.
1438 * upstart/wire.h: Add warn_unused_result attributes to push functions
1439
Scott James Remnant4ccebcf2007-01-30 14:51:17 +00001440 * upstart/tests/test_message.c: Guard calls to nih_io_buffer_push and
1441 nih_io_message_add_control with NIH_ZERO to ensure they succeed.
1442 * upstart/tests/test_wire.c: Guard calls to nih_io_buffer_push
1443
Scott James Remnant44828472007-01-30 11:53:33 +00001444 * HACKING: Update from libnih with new Documentation,
1445 Function Attributes and Test Cases sections.
1446
Scott James Remnant16a286f2007-01-10 15:38:33 +000014472007-01-10 Scott James Remnant <scott@netsplit.com>
1448
Scott James Remnantde443012007-01-10 18:45:40 +00001449 * init/main.c (crash_handler): s/SEGV/SIGSEGV/
1450
Scott James Remnant505f9282007-01-10 18:44:38 +00001451 * init/main.c (main): Rename variable
1452
Scott James Remnant56a4d062007-01-10 17:33:39 +00001453 * TODO: Update.
1454
Scott James Remnant78626fb2007-01-10 16:48:10 +00001455 * init/main.c (main): Change the way we clear the arguments; by
1456 deleting just the final NULL terminator, we fool the kernel into
1457 only returning one argument in cmdline.
1458
Scott James Remnant16a286f2007-01-10 15:38:33 +00001459 * init/main.c (segv_handler): Rename to crash_handler and handle
1460 SIGABRT as well, so we can catch assertion errors. Of course, in
1461 theory, with our high test converage this should never happen in
1462 practice <chortle>
1463
Scott James Remnant39ec35b2007-01-09 08:16:01 +000014642007-01-09 Scott James Remnant <scott@netsplit.com>
1465
Scott James Remnant7f4db422007-01-09 20:51:08 +00001466 * init/main.c (main): Clear arguments so that upstart only ever
1467 appears as /sbin/init in ps, top, etc.
1468
Scott James Remnant8fd06de2007-01-09 20:38:27 +00001469 * TODO: Update.
1470
Scott James Remnant4d0481d2007-01-09 20:38:07 +00001471 * util/initctl.c: Add data pointer to functions and handle calls.
1472
Scott James Remnantbcf9e972007-01-09 20:34:47 +00001473 * init/control.c: Add data pointer to all functions.
1474 * init/tests/test_control.c: Pass data pointer to
1475 upstart_message_handle_using()
1476 * init/tests/test_notify.c: Pass data pointer to
1477 upstart_message_handle_using()
1478
Scott James Remnant6aa008c2007-01-09 20:26:44 +00001479 * upstart/message.c (upstart_message_handle)
1480 (upstart_message_handle_using): Add a data pointer argument to these
1481 functions and pass it to the handler.
1482 (upstart_message_reader): Pass the io structure's data pointer.
1483 * upstart/message.h (UpstartMessageHandler): Add a data pointer to
1484 the message handler.
1485 * upstart/tests/test_message.c (test_handle, test_handle_using):
1486 Pass a data pointer to the function call and check it's passed
1487 to the handler correctly.
1488 (test_reader): Check that the io data pointer gets passed.
1489
Scott James Remnantc7017d32007-01-09 18:44:58 +00001490 * init/tests/test_cfgfile.c (test_stanza_console, test_stanza_env)
1491 (test_stanza_umask, test_stanza_nice, test_stanza_limit): Finish off
1492 the newer style test cases.
1493
Scott James Remnante63ef802007-01-09 17:54:56 +00001494 * init/cfgfile.c (cfg_stanza_console, cfg_stanza_umask)
1495 (cfg_stanza_nice, cfg_stanza_limit, cfg_stanza_chroot)
1496 (cfg_stanza_chdir): Guard against duplicate uses of the stanzas.
1497 * init/tests/test_cfgfile.c (test_stanza_daemon)
1498 (test_stanza_respawn): Check that neither daemon or respawn override
1499 exec if they have no arguments.
1500 (test_stanza_script): Add missing function
1501 (test_stanza_chroot, test_stanza_chdir): Add tests for these simple
1502 stanzas.
1503
Scott James Remnant0cd393d2007-01-09 17:36:34 +00001504 * init/cfgfile.c: Change remaining uses of nih_error_raise and
1505 return to just nih_return_error.
1506
Scott James Remnantc352b632007-01-09 17:31:41 +00001507 * init/cfgfile.c (cfg_stanza_exec, cfg_stanza_daemon)
1508 (cfg_stanza_respawn, cfg_stanza_script): Disallow duplicates,
1509 both of command strings, scripts, limits and of just the flags.
1510 * init/tests/test_cfgfile.c (test_stanza_exec)
1511 (test_stanza_daemon, test_stanza_respawn, test_stanza_instance):
1512 Check the behaviour of these stanzas.
1513
Scott James Remnant94188d42007-01-09 16:43:58 +00001514 * init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop): Disallow
1515 duplicate values for the script.
1516 * init/tests/test_cfgfile.c (test_stanza_start, test_stanza_stop):
1517 Test cases for those two functions.
1518
Scott James Remnant474a6ff2007-01-09 16:17:49 +00001519 * init/cfgfile.c (cfg_stanza_description, cfg_stanza_author)
1520 (cfg_stanza_version): Don't allow stanza to be duplicated anymore.
1521 * init/tests/test_cfgfile.c (test_stanza_description)
1522 (test_stanza_author, test_stanza_version): Test cases for these
1523 simple stanza; making sure duplication is not permitted.
1524 (test_stanza_on): Add a test case for this stanza too.
1525
Scott James Remnant49e8bb82007-01-09 15:57:59 +00001526 * init/cfgfile.c (cfg_stanza_kill): Guard against duplicate uses
1527 of the kill timeout stanza.
1528 * init/tests/test_cfgfile.c (test_stanza_kill): Test the complex
1529 kill stanza.
1530 (test_stanza_pid): Check duplicate usage results in an error.
1531
Scott James Remnant443ef2e2007-01-09 15:47:24 +00001532 * init/job.h (Job): Rename pidfile to pid_file and binary to pid_binary
1533 * init/job.c (job_new): Update names here too.
1534 * init/errors.h: Add a new "duplicate value" error.
1535 * init/cfgfile.c (cfg_read_job): Change name of variables, and catch
1536 the duplicate value error to add the line number.
1537 (cfg_stanza_pid): Change variable names, and clean this function up
1538 a little. Make it an error to use a stanza more than once.
1539 * init/tests/test_cfgfile.c (test_stanza_pid): Write a newer test
1540 case function for the pid stanza.
1541
Scott James Remnant34ff87d2007-01-09 09:00:30 +00001542 * init/cfgfile.c (cfg_stanza_normalexit): Use do/while instead of
1543 while, that we don't have to test has_token first as next_arg does
1544 that for us.
1545
Scott James Remnanta7354692007-01-09 08:56:02 +00001546 * init/cfgfile.c (cfg_stanza_normalexit): Change to peek at the next
1547 token to see whether it's missing or not, and then just fetch each
1548 next argument at a time. This is more efficient than parsing them
1549 all in one go, and also means we can report the error in the right
1550 place!
1551 * init/tests/test_cfgfile.c (test_stanza_normalexit): Since we've
1552 changed the function that parses the stanza, add a proper test case
1553 function for it, covering all the behaviours.
1554
Scott James Remnant92e7fda2007-01-09 08:40:13 +00001555 * init/job.c (job_new): Initialise the emits member to an empty list.
1556 * init/job.h (Job): Add the emits member as a list.
1557 * init/tests/test_job.c (test_new): Check the emits list starts off
1558 empty.
1559 * init/tests/test_cfgfile.c (test_stanza_emits): Test the new emits
1560 stanza; this function will also serve as a prototype for cleaning up
1561 the config tests.
1562
1563 * init/cfgfile.c (cfg_stanza_emits): Add function to parse the new
1564 emits stanza.
1565
Scott James Remnant39ec35b2007-01-09 08:16:01 +00001566 * init/cfgfile.c (cfg_stanza_depends): Remove the depends stanza
1567 from the configuration file. Dependency support has never been used,
1568 and is to be replaced by a more flexible event/state configuration
1569 and blocking on the starting/stopping events.
1570 * init/tests/test_cfgfile.c: Remove references and tests for the
1571 depends stanza.
1572 * init/job.h: Remove the depends list from the job structure.
1573 * init/job.c (job_new): No depends list to initialise.
1574 (job_change_state): No dependencies to release
1575 (job_start): No dependencies to iterate; this removes a particularly
1576 hairy and complex interaction between state changes. Remove the
1577 dependency event.
1578 (job_release_depends): Drop this function.
1579 * init/tests/test_job.c (test_start, test_stop): Massively simplify
1580 these tests cases now we don't have dependencies to worry about.
1581 (test_release_depends): Drop tests
1582
Scott James Remnantd4f5fb82007-01-08 23:25:23 +000015832007-01-08 Scott James Remnant <scott@netsplit.com>
1584
1585 * init/cfgfile.c: Rewrite using the nih_config API, rather than one
1586 huge function we now just have seperate handler functions for each
1587 stanza. We can also use more fine-grained parsing than slurping
1588 all args in and counting them.
1589 (cfg_read_job): Catch exceptions from the configuration parser and
1590 add the line number where the problem occurred to an output message.
1591 Parser errors are now fatal, and not ignored.
1592 * init/errors.h: Add a file containing errors raised within the init
1593 daemon codebase.
1594 * init/Makefile.am (init_SOURCES): Build with errors.h
1595 * init/tests/test_cfgfile.c: Update test cases now we don't expect
1596 a job to be returned if there's a parser error.
1597
1598 * TODO: Update
1599
Scott James Remnant66384202007-01-06 14:23:18 +000016002007-01-06 Scott James Remnant <scott@netsplit.com>
1601
Scott James Remnant4f968192007-01-06 20:31:13 +00001602 * logd/main.c (logging_reader): Fix inadvertent shadowing of the
1603 len parameter.
1604
Scott James Remnantda100272007-01-06 20:24:18 +00001605 * compat/sysv/telinit.c: Oops, nearly forgot to port this to send
1606 the messages in the new way.
1607 * compat/sysv/shutdown.c (shutdown_now): Likewise, port this too.
1608
Scott James Remnant83a86522007-01-06 19:55:38 +00001609 * TODO: Update.
1610
Scott James Remnant6e941882007-01-06 14:38:57 +00001611 * util/initctl.c (handle_job_status): Output the process argument,
1612 not the pid argument which contains the origin of the message.
1613
Scott James Remnant17d6dca2007-01-06 14:33:30 +00001614 * upstart/message.c (upstart_message_handle): Raise a new unknown
1615 message error if we don't have a handler and a new illegal message
1616 error if the source is illegal.
1617 * upstart/tests/test_message.c (test_handle): Adjust tests to check
1618 for the new errors that we raise.
1619 * upstart/errors.h: Define strings for new errors.
1620
Scott James Remnant66384202007-01-06 14:23:18 +00001621 * util/initctl.c: Yet another makeover for this little program,
1622 port it to the new message/control framework using handler functions
1623 and NihIoMessage. This starts to make each action function look
1624 very similar, so there's method to this madness.
1625
Scott James Remnantb4725d92007-01-05 13:10:21 +000016262007-01-05 Scott James Remnant <scott@netsplit.com>
1627
Scott James Remnant3d6bb792007-01-05 22:33:43 +00001628 * logd/main.c (main): Make sure that we add the SIGTERM handler.
1629
Scott James Remnantefbaafb2007-01-05 18:12:15 +00001630 * init/tests/test_job.c (test_run_script): This test case relies
1631 on there only being one file descriptor watch, which won't be true
1632 if the control socket has been opened because there's a message to
1633 go out. Make sure it's closed first.
1634
Scott James Remnantbe1941f2007-01-05 17:57:59 +00001635 * init/init.supp: Update supressions file now that control_init
1636 has been renamed to notify_init
1637
Scott James Remnant71cc4d82007-01-05 17:53:32 +00001638 * init/Makefile.am: Include notify.o from all tests.
1639 * init/job.c (job_change_state, job_kill_process, job_start)
1640 (job_stop): Use the new notify_job function name.
1641 * init/event.c (event_queue_run): Use the new notify_event function
1642 name.
1643
Scott James Remnantfea6cb62007-01-05 17:49:13 +00001644 * init/control.c (control_error_handler): Handle ECONNREFUSED now
1645 that the process id is available to us.
1646 * init/tests/test_control.c (test_error_handler): Make sure children
1647 going away is handled properly.
1648
Scott James Remnant3dfb2132007-01-05 17:44:48 +00001649 * upstart/message.c (upstart_message_new): Store the process id in
1650 the int_data message field.
1651 * upstart/tests/test_message.c (test_new): Check the int_data field
1652 is filled in.
1653
Scott James Remnant5d702952007-01-05 17:21:34 +00001654 * init/main.c (main): Guard against various things returning an error
1655 that we weren't catching.
1656
Scott James Remnant601a0e32007-01-05 17:06:31 +00001657 * init/tests/test_notify.c: Whitespace fix.
1658
Scott James Remnant15cd0862007-01-05 17:06:20 +00001659 * init/control.c (control_watch_jobs, control_unwatch_jobs)
1660 (control_watch_events, control_unwatch_events): Restore functionality
1661 to subscribe and unsubscribe from job and event notifications.
1662 * init/tests/test_control.c (test_watch_jobs, test_unwatch_jobs)
1663 (test_watch_events, test_unwatch_events): Check that the subscription
1664 and unsubscription messages work.
1665 * init/Makefile.am (test_control_LDADD): Link to notify.o
1666
1667 * init/control.c: Drop unused include of upstart/errors.h
1668
Scott James Remnant58cef572007-01-05 16:18:42 +00001669 * init/notify.c: Move functions that handle subscription and
1670 notification from control.c. Other than changing the names, we're
1671 keeping the API the same for now; expect it to change later when we
1672 add the ability to subscribe to individual jobs or events.
1673 (notify_init): initialise the subscriptions list; we don't have a
1674 separate send queue now that the control I/O is always asynchronous.
1675 * init/notify.h: Moved notification enum, structure and prototypes
1676 from control.h, changing the names so they match notify_* in the
1677 process.
1678 * init/Makefile.am (init_SOURCES): Build and link notify.c using
1679 notify.h
1680 (TESTS): Build the notify test suite binary.
1681 (test_notify_SOURCES, test_notify_LDFLAGS, test_notify_LDADD): Details
1682 for notify test suite binary.
1683 * init/tests/test_notify.c: Rewrite test cases in the manner of
1684 test_control.c so that we have one function for notify_job and
1685 one for notify_event, each of which contains the child process that
1686 receives the notification,
1687
Scott James Remnantb1679c62007-01-05 15:49:54 +00001688 * init/control.c (control_open): Allow this to be called to obtain
1689 the control socket, which means we can make it static.
1690 * init/tests/test_control.c (test_open): Check that it works.
1691
Scott James Remnantf7c6b062007-01-05 15:33:33 +00001692 * init/control.c, init/control.h, init/tests/test_control.c: Move
1693 functions that handle subscription and notification to new notify.c
1694 (control_init): Drop completely, no need to maintain a send queue now
1695 (control_open): Change to return an NihIo that uses the default
1696 control watcher, and our error handler. Split socket opening into
1697 (control_open_sock): which can be called from other functions.
1698 (control_close): Use nih_io_close() to close the socket and free the
1699 structure in one go.
1700 (control_reopen): Close the open control socket and open it again
1701 without destroying the NihIo structure, its queues or state.
1702 (control_close_handler): Handle the control socket going away
1703 (control_error_handler): Handle errors on the control socket,
1704 including the connection refused error that indicates a client went
1705 away.
1706 (control_handle): Split this into a miriad of small functions with
1707 a table to link them to the message type; this will make expanding
1708 each message handler much easier in future.
1709 * init/control.h: Update.
1710 * init/tests/test_control.c: Rewrite test cases to check the new
1711 handler functions; as a side-effect, this gets rid of the evil giant
1712 child/parent functions in favour of one test function per handler
1713 function.
1714
Scott James Remnantb4725d92007-01-05 13:10:21 +00001715 * upstart/message.c (upstart_message_handle_using): Wrapper function
1716 around upstart_message_handle that ensures all messages as passed to
1717 a single function.
1718 * upstart/message.h: Update.
1719 * upstart/tests/test_message.c (test_handle_using): Make sure it
1720 calls the single function.
1721
Scott James Remnantde3666f2007-01-04 23:00:07 +000017222007-01-04 Scott James Remnant <scott@netsplit.com>
1723
1724 * upstart/message.c (upstart_message_reader): Handle any errors
1725 that occurred while handling the message.
1726
Scott James Remnant92feed92007-01-02 15:27:47 +000017272007-01-02 Scott James Remnant <scott@netsplit.com>
1728
Scott James Remnant7833bbf2007-01-02 20:57:23 +00001729 * upstart/message.c (upstart_message_handle): Check that the name
1730 argument is never NULL.
1731 (upstart_message_reader): Simple message reader function that can
1732 be associated with an I/O watch and handles each message received.
1733 * upstart/message.h: Add prototype.
1734 * upstart/tests/test_message.c (test_reader): Test the reader function.
1735
Scott James Remnant0e3b5fe2007-01-02 18:39:03 +00001736 * upstart/control.c: Rename to upstart/message.c
1737 * upstart/control.h: Rename to upstart/message.h
1738 * upstart/tests/test_control.c: Rename to upstart/tests/test_message.c
1739 * upstart/libupstart.h: Update includes.
1740 * upstart/wire.c: Include message.h
1741 * upstart/wire.h: Update includes.
1742 * upstart/tests/test_wire.c: Update includes.
1743 * upstart/errors.h: Rename UPSTART_INVALID_MESSAGE to
1744 UPSTART_MESSAGE_INVALID so that it's prefixed.
1745 * upstart/Makefile.am (libupstart_la_SOURCES)
1746 (upstartinclude_HEADERS, TESTS): Update filenames.
1747
Scott James Remnant2ad9a042007-01-02 18:29:49 +00001748 * upstart/control.c (upstart_message_new): New function that
1749 creates an NihIoMessage directly from its arguments, which are a type
1750 followed by a variable number of args depending on that type.
1751 (upstart_message_handler): Function to find a handler function for
1752 a particular message type and origin process.
1753 (upstart_message_handle): New function that takes an NihIoMessage
1754 and invokes a handler function with a variable number of args
1755 depending on the message type.
1756 (upstart_send_msg, upstart_send_msg_to, upstart_recv_msg): Drop these
1757 functions, leave it up to the caller to decide whether to send and
1758 receive the messages synchronously or asynchronously; now that the
1759 capability is in nih_io_*.
1760 * upstart/control.h (UpstartMsgType): Rename to UpstartMessageType.
1761 (UpstartMessageHandler): Function with variable number of arguments
1762 that handles a message received.
1763 (UpstartMsg): Drop this structure entirely, we'll encode or decode
1764 the wire format directly from or into a function call, rather than
1765 use an intermediate structure to marshal it.
1766 (UpstartMessage): New structure to make a table that can be passed
1767 to upstart_message_handle to determine which handler should be called.
1768 * upstart/tests/test_control.c: Test new behaviour.
1769 * upstart/wire.c (upstart_push_header, upstart_pop_header): Change
1770 structure name for type parameter.
1771 * upstart/wire.h: Update.
1772 * upstart/tests/test_wire.c: Update.
1773
Scott James Remnant92feed92007-01-02 15:27:47 +00001774 * configure.ac (AC_COPYRIGHT): Update copyright to 2007.
1775
Scott James Remnant67546d12006-12-29 13:08:32 +000017762006-12-29 Scott James Remnant <scott@netsplit.com>
1777
1778 * upstart/wire.c (upstart_write_int, upstart_write_unsigned)
1779 (upstart_write_string, upstart_write_header, upstart_write_packv)
1780 (upstart_write_pack): Rename to *_push_*
1781 (upstart_read_int, upstart_read_unsigned, upstart_read_string)
1782 (upstart_read_header, upstart_read_packv, upstart_read_pack): Rename
1783 to *_pop_*.
1784 All of the above modified to modify an NihIoMessage structure,
1785 instead of trying to carry around buffers ourself.
1786 * upstart/wire.h: Update to match above.
1787 * upstart/tests/test_wire.c: Update all tests to match the above
1788 changes.
1789
Scott James Remnantd76e8e32006-12-21 18:34:31 +000017902006-12-21 Scott James Remnant <scott@netsplit.com>
1791
Scott James Remnantf922a982006-12-21 18:45:30 +00001792 * upstart/wire.c (upstart_read_packv, upstart_write_packv): Change
1793 nih_assert_notreached to nih_assert_not_reached.
1794
Scott James Remnantd76e8e32006-12-21 18:34:31 +00001795 * init/job.c (job_run_script): Open the NihIo structure in stream mode.
1796 * logd/main.c (logging_watcher): Open the NihIo structure in
1797 stream mode.
1798 (logging_reader): Need to pass the length of the size_t as a pointer
1799 so that it can be modified if less is read.
1800
Scott James Remnanta0385232006-12-17 15:21:39 +000018012006-12-17 Scott James Remnant <scott@netsplit.com>
1802
Scott James Remnant00cc6882006-12-17 19:54:36 +00001803 * upstart/wire.c (upstart_write_packv, upstart_write_pack)
1804 (upstart_read_packv, upstart_read_pack): Functions to write a pack
1805 of different variables to the stream, or read them from it
1806 * upstart/wire.h: Add prototypes.
1807 * upstart/tests/test_wire.c (test_write_pack, test_read_pack):
1808 Check we can read and write a pack of variables at once.
1809
Scott James Remnant518e1c12006-12-17 18:12:14 +00001810 * upstart/wire.c (upstart_write_header, upstart_read_header): Drop
1811 the version from the header, we'll just keep the protocol always
1812 backwards compatible.
1813 * upstart/wire.h: Update.
1814 * upstart/tests/test_wire.c (test_write_header, test_read_header):
1815 Check that everything works.
1816
Scott James Remnant64e378f2006-12-17 17:24:44 +00001817 * upstart/wire.c (upstart_write_string, upstart_read_string):
1818 Transmit the length as an unsigned, and use 0xffffffff to mean NULL
1819 instead of zero so we can still transmit the empty string.
1820 * upstart/wire.h: Update.
1821 * upstart/tests/test_wire.c (test_write_string, test_read_string):
1822 Tests for the functions to make sure the wire is at it should be.
1823
Scott James Remnantd6dde952006-12-17 17:00:56 +00001824 * upstart/wire.c (upstart_read_str, upstart_write_str): Rename to
1825 upstart_read_string and upstart_write_string.
1826 * upstart/wire.h: Update.
1827
Scott James Remnantc71ab3b2006-12-17 16:58:28 +00001828 * upstart/wire.c (upstart_write_unsigned, upstart_read_unsigned):
1829 Functions to send unsigned values over the wire, which we'll use
1830 to get a bit extra for the string lengths.
1831 * upstart/wire.h: Update.
1832 * upstart/tests/test_wire.c (test_write_unsigned)
1833 (test_read_unsigned): Test the new functions.
1834
Scott James Remnant0218e3a2006-12-17 16:39:33 +00001835 * upstart/wire.c (upstart_write_ints, upstart_read_ints): Drop
1836 these functions, we'll go with something far more generic and
1837 useful.
1838 * upstart/wire.h: Remove prototypes.
1839
Scott James Remnant9ee44302006-12-17 16:37:59 +00001840 * upstart/wire.c (upstart_write_int, upstart_read_int): Transmit
1841 integers as signed 32-bit values in network byte order.
1842 * upstart/tests/test_wire.c (test_write_int, test_read_int): Test
1843 the functions to make sure the wire is at it should be,
1844
Scott James Remnant5cef53e2006-12-17 15:41:13 +00001845 * upstart/control.c (upstart_read_int, upstart_write_int)
1846 (upstart_read_ints, upstart_write_ints, upstart_read_str)
1847 (upstart_write_str, upstart_read_header, upstart_write_header): Move
1848 functions to new wire.c file.
1849 * upstart/wire.c: Source file to hold wire protocol functions.
1850 * upstart/wire.h: Prototypes.
1851 * upstart/tests/test_wire.c: (empty) test suite.
1852 * upstart/libupstart.h: Include wire.h
1853 * upstart/Makefile.am (libupstart_la_SOURCES): Build and link wire.c
1854 (upstartinclude_HEADERS): Install wire.h
1855 (TESTS): Build and run wire test suite.
1856 (test_wire_SOURCES, test_wire_LDFLAGS, test_wire_LDADD): Details for
1857 wire test suite binary.
1858
Scott James Remnanta0385232006-12-17 15:21:39 +00001859 * upstart/control.c (MAGIC): Change to "upstart\n", the final
1860 character was originally \0 and then was a " " for the 0.2 series.
1861 * upstart/tests/test_control.c (test_recv_msg): Change to match.
1862
Scott James Remnantfb9412a2006-12-15 18:03:22 +000018632006-12-15 Scott James Remnant <scott@netsplit.com>
1864
Scott James Remnant2e5fe2b2006-12-15 18:27:58 +00001865 * util/initctl.c, compat/sysv/telinit.c, compat/sysv/shutdown.c:
1866 Update all uses of the UpstartMsg structure to avoid the
1867 intermediate union that no longer exists.
1868
Scott James Remnantfb521462006-12-15 18:24:57 +00001869 * init/control.c, init/tests/test_control.c: Update all uses of
1870 the UpstartMsg structure to avoid the intermediate union that no
1871 longer exists.
1872
Scott James Remnant99b97662006-12-15 18:15:22 +00001873 * upstart/control.h: Combine all the previous message structures
1874 into just one that has all of the fields anyway.
1875 * upstart/control.c, upstart/tests/test_control.c: Update all uses of
1876 the UpstartMsg structure to avoid the intermediate union that no
1877 longer exists.
1878
Scott James Remnantd452ab12006-12-15 18:05:23 +00001879 * upstart/control.h (UPSTART_API_VERSION): Define API version macro
1880 to be public.
1881 * upstart/control.c (MSG_VERSION, upstart_send_msg_to): Replacing the
1882 previous MSG_VERSION macro here.
1883
Scott James Remnantfb9412a2006-12-15 18:03:22 +00001884 * upstart/control.c (upstart_read_int, upstart_write_int)
1885 (upstart_read_ints, upstart_write_ints, upstart_read_str)
1886 (upstart_write_str, upstart_read_header, upstart_write_header):
1887 New functions to replace the old "write a struct" protocol with
1888 something a little more regimented and supportable.
1889 (IOVEC_ADD, IOVEC_READ, WireHdr, WireJobPayload, WireJobStatusPayload)
1890 (WireEventPayload): Remove these structures, use the functions
1891 instead.
1892 (upstart_send_msg_to): Call write functions intead of using macros,
1893 this makes the code somewhat neater.
1894 (upstart_recv_msg): Call read functions instead of using macros,
1895 again making the code somewhat neater.
1896 * upstart/tests/test_control.c (test_recv_msg): Change wire
1897 tests to match new protocol, and thus actually work properly,
1898 previously these were endian sensitive.
1899
Scott James Remnant27ebd792006-12-14 11:37:14 +000019002006-12-14 Scott James Remnant <scott@netsplit.com>
1901
Scott James Remnant136dc6f2006-12-14 12:36:43 +00001902 * compat/sysv/shutdown.c (wall): Construct the wall message so that
1903 we don't put \r into a po file; for some reason, gettext hates that
1904 and bitches about it. Someone's confusing internationalisation with
1905 operating system portability, I expect.
1906
Scott James Remnantf334f842006-12-14 11:46:14 +00001907 * util/man/initctl.8: Drop reference to start(8), as that's just
1908 a symlink to initctl now.
1909
Scott James Remnant88847432006-12-14 11:44:36 +00001910 * init/man/init.8: Link to initctl.
1911
Scott James Remnantf6b237a2006-12-14 11:40:49 +00001912 * compat/sysv/reboot.c (main): Clear up help text a little.
1913
Scott James Remnant3b4b2272006-12-14 11:39:05 +00001914 * HACKING: Correct some typos.
1915
Scott James Remnant27ebd792006-12-14 11:37:14 +00001916 * configure.ac (AC_INIT): Correct bug reporting address.
1917
Scott James Remnant1d8763a2006-12-13 17:49:38 +000019182006-12-13 Scott James Remnant <scott@netsplit.com>
1919
Scott James Remnantecec0fe2006-12-13 21:55:28 +00001920 * configure.ac: Bump version to 0.3.2
1921
Scott James Remnantf642ffa2006-12-13 18:24:22 +00001922 * NEWS: Update.
1923
Scott James Remnant1d8763a2006-12-13 17:49:38 +00001924 * util/initctl.c (print_job_status): Drop the newline from the
1925 output.
1926
Scott James Remnant567cbdc2006-12-13 17:07:58 +000019272006-12-13 Alex Smith <alex@alex-smith.me.uk>
1928
1929 * util/initctl.c (print_job_status): Clean up initctl job status
1930 output, which was badly converted from printf to nih_message.
1931
Scott James Remnante2cf6392006-12-13 17:02:20 +000019322006-12-13 Scott James Remnant <scott@netsplit.com>
1933
1934 * compat/sysv/man/shutdown.8: Add missing documentation on the
1935 format of TIME by copying it from --help output.
1936
Scott James Remnantfec90562006-12-13 17:00:40 +000019372006-12-13 Alex Smith <alex@alex-smith.me.uk>
1938
1939 * init/process.c (process_setup_console): Actually send output to
1940 /dev/null instead of /dev/console, when CONSOLE_NONE.
1941
Scott James Remnantf233c9d2006-12-13 16:45:35 +000019422006-12-13 Scott James Remnant <scott@netsplit.com>
1943
Scott James Remnantfbf7a5c2006-12-13 16:54:42 +00001944 * Makefile.am (EXTRA_DIST): Distribute the nih ChangeLog as well.
1945
Scott James Remnantf233c9d2006-12-13 16:45:35 +00001946 * init/tests/test_job.c: Port to the new test framework.
1947 * init/job.c (job_set_idle_event): Fix a slight memory leak,
1948 repeated setting of the idle event never freed the previous one set.
1949
Scott James Remnant1abced42006-12-12 11:28:49 +000019502006-12-12 Scott James Remnant <scott@netsplit.com>
1951
Scott James Remnantfbad50c2006-12-12 18:47:43 +00001952 * init/tests/test_cfgfile.c: Port to the new test framework.
1953
Scott James Remnantef372232006-12-12 17:23:05 +00001954 * init/tests/test_control.c: Port to the new test framework.
1955 * init/init.supp: Suppress the list head allocated within control_init.
1956
Scott James Remnant2c2e01a2006-12-12 17:22:40 +00001957 * init/control.c (control_watcher): Need to save the pid when we
1958 get ECONNREFUSED, otherwise we lose it when we free the message.
1959
Scott James Remnant40f7d912006-12-12 15:31:35 +00001960 * init/tests/test_process.c: Port to the new test framework.
1961 * init/init.supp: Suppress the list head allocated within job_init.
1962
Scott James Remnantfc456592006-12-12 14:09:45 +00001963 * init/init.supp: Include a valgrind suppressions file.
1964 * init/Makefile.am (EXTRA_DIST): Distribute the suppressions file.
1965
Scott James Remnant96c9b072006-12-12 14:07:30 +00001966 * init/tests/test_event.c: Port to the new test framework.
1967
Scott James Remnant237c7f62006-12-12 13:49:19 +00001968 * logd/Makefile.am, util/Makefile.am, compat/sys/Makefile.am
1969 (AM_CPPFLAGS): Add -I$(srcdir), necessary for testing "programs"
1970 that don't have usual library path semantics.
1971
Scott James Remnant2a35ab92006-12-12 13:23:10 +00001972 * upstart/tests/test_control.c: Port to the new test framework.
1973 * upstart/control.c (upstart_free): Drop this function, while not
1974 exposing libnih is a valiant effort, it already slips out because
1975 of the error handling.
1976
Scott James Remnant905dd272006-12-12 12:38:34 +00001977 * upstart/tests/test_job.c: Add missing include.
1978
Scott James Remnante77567f2006-12-12 12:25:46 +00001979 * upstart/tests/test_job.c: Port to the new test framework.
1980 (test_process_state_name): Check that this returns NULL.
1981
Scott James Remnantb7983062006-12-12 11:34:49 +00001982 * HACKING: Update location of download directory. Document
1983 requirement that all code have test cases.
1984
Scott James Remnant0c577ce2006-12-12 11:31:13 +00001985 * logd/main.c (open_logging): Likewise.
1986
Scott James Remnantc654baf2006-12-12 11:30:44 +00001987 * init/control.c (control_open): No need to set ENOMEM, errno is
1988 always set anyway.
1989
Scott James Remnant1abced42006-12-12 11:28:49 +00001990 * configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
1991 Automake's broken default includes.
1992 * upstart/Makefile.am (DEFAULT_INCLUDES): Drop override now that
1993 we don't need it.
1994 (DEFS, INCLUDES): Replace these variables with the combined
1995 (AM_CPPFLAGS): variable that declares everything.
1996 * init/Makefile.am (DEFAULT_INCLUDES): Drop override now that
1997 we don't need it.
1998 (DEFS, INCLUDES): Replace these variables with the combined
1999 (AM_CPPFLAGS): variable that declares everything.
2000 * util/Makefile.am (DEFAULT_INCLUDES): Drop override now that
2001 we don't need it.
2002 (DEFS, INCLUDES): Replace these variables with the combined
2003 (AM_CPPFLAGS): variable that declares everything.
2004 * compat/sysv/Makefile.am (DEFAULT_INCLUDES): Drop override now that
2005 we don't need it.
2006 (DEFS, INCLUDES): Replace these variables with the combined
2007 (AM_CPPFLAGS): variable that declares everything.
2008 * logd/Makefile.am (DEFAULT_INCLUDES): Drop override now that
2009 we don't need it.
2010 (DEFS, INCLUDES): Replace these variables with the combined
2011 (AM_CPPFLAGS): variable that declares everything.
2012
Scott James Remnantacec3b22006-11-02 16:36:53 +000020132006-11-02 Scott James Remnant <scott@netsplit.com>
2014
2015 * util/initctl.c (start_action): Remove break calls which shouldn't
2016 be there.
2017
Scott James Remnantea806b72006-10-18 15:01:00 +010020182006-10-18 Sean E. Russell <ser@ser1.net>
2019
2020 * init/main.c: Include sys/time.h
2021 * init/cfgfile.c: Include sys/time.h and sys/resource.h
2022 * init/job.c: Include sys/time.h and sys/resource.h
2023
Scott James Remnant6702ac12006-10-17 18:55:24 +010020242006-10-17 Scott James Remnant <scott@netsplit.com>
2025
Scott James Remnantd5758f42006-10-17 19:21:25 +01002026 * configure.ac: Bump version to 0.3.1
2027
Scott James Remnantfd029da2006-10-17 19:21:07 +01002028 * NEWS: Update.
2029 * TODO: Update.
2030
Scott James Remnant9f67cb82006-10-17 19:12:28 +01002031 * configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number.
2032
Scott James Remnant4ebe87f2006-10-17 19:04:40 +01002033 * logd/Makefile.am (event.d/logd): Make the event.d sub-directory
2034 in case we're building outside of the source tree.
2035
Scott James Remnant6702ac12006-10-17 18:55:24 +01002036 * compat/sysv/runlevel.c (store): Don't break strict-aliasing rules
2037 by avoiding dereferencing type-punned pointer. Answers on a
2038 postcard, please.
2039
Scott James Remnant7f133012006-10-13 12:00:34 +010020402006-10-13 Scott James Remnant <scott@netsplit.com>
2041
Scott James Remnantecbb2b52006-10-13 15:18:24 +01002042 * util/initctl.c (start_action, emit_action): Add missing \n
2043
Scott James Remnant48622982006-10-13 15:15:50 +01002044 * util/initctl.c: Rewrite using nih_command_parser.
2045 * util/man/initctl.8: Improve.
2046
2047 * util/start.c: Remove, replaced by initctl.
2048 * util/man/start.8: Remove, replaced by initctl.
2049 * util/Makefile.am (sbin_PROGRAMS): Drop start, now just a symlink
2050 to initctl.
2051 (dist_man_MANS): Drop start.8, now a symlink to initctl.8
2052 (install-exec-hook): Make symlinks to initctl, add start
2053 (install-data-hook): Make symlinks to initctl.8, add start.8
2054
Scott James Remnantb1d8a7d2006-10-13 13:57:31 +01002055 * initctl: Rename to util again, I don't want a separate directory
2056 for every single little tool; and we'll be shipping more than just
2057 initctl (e.g. a non-compat reboot).
2058 * configure.ac (AC_CONFIG_FILES): Make util/Makefile instead of
2059 initctl/Makefile.
2060 * Makefile.am (SUBDIRS): Descend into util, not initctl.
2061
Scott James Remnanta48b4fe2006-10-13 13:49:46 +01002062 * compat/sysv/reboot.c: Remove long options where they didn't exist
2063 before. Write help text.
2064 * compat/sysv/man/reboot.8: Update.
2065
Scott James Remnant462734c2006-10-13 13:36:00 +01002066 * init/main.c (main): Formatting.
2067 * logd/main.c (main): Formatting.
2068 * logd/man/logd.8: Formatting.
2069 * compat/sysv/runlevel.c (main): Formatting.
2070 * compat/sysv/telinit.c (main): Formatting.
2071 * compat/sysv/man/shutdown.8: Remove long options.
2072
Scott James Remnanteff01f12006-10-13 13:32:12 +01002073 * compat/sysv/shutdown.c: Remove -e/--event, it has no place in a
2074 compatibility tool. Get rid of long options that never existed
2075 before. Specify help text to describe the options.
2076 * compat/sysv/man/shutdown.8: Spruce up a bit.
2077
Scott James Remnant4a5cd212006-10-13 12:59:15 +01002078 * compat/sysv/telinit.c (main): Set help text to list the valid
2079 runlevels.
2080 * compat/sysv/man/telinit.8: Refine the notes to mention runlevel(8).
2081
Scott James Remnantf7819622006-10-13 12:54:43 +01002082 * compat/sysv/runlevel.c (main): Make the help text describe the
2083 options, rather than the behaviour.
Scott James Remnant4a5cd212006-10-13 12:59:15 +01002084 * compat/sysv/man/runlevel.8: Flesh out a little more.
Scott James Remnantf7819622006-10-13 12:54:43 +01002085
Scott James Remnant930e25a2006-10-13 12:28:05 +01002086 * configure.ac (AC_INIT): Change bug reporting address to the
2087 mailing list, since Launchpad doesn't accept random bugs without
2088 accounts and complicated control messages.
2089 * init/main.c, logd/main.c: Add a period to the synopsis.
2090
Scott James Remnanta6ed7eb2006-10-13 12:14:45 +01002091 * init/main.c (main): Set the synopsis, and direct people to look
2092 at telinit in the --help output.
2093 * init/man/init.8: Flesh this out a little more, still a lot of
2094 explaining to do about jobs and events, but we'll wait until we've
2095 changed that code before documentating the behaviour.
2096
Scott James Remnant7f133012006-10-13 12:00:34 +01002097 * logd/main.c (main): Correct help text to describe the options,
2098 rather than what the program does. As per standard style.
2099 Don't become a daemon until the logging socket is open, and make
2100 that exclusive with waiting for SIGCONT.
2101 * logd/man/logd.8: Write some more extensive documentation,
2102 including describing the startup interlock and the socket protocol.
2103 * TODO: Plan to get rid of the signal interlock from logd.
2104
Scott James Remnant8985dd32006-10-12 15:26:29 +010021052006-10-12 Scott James Remnant <scott@netsplit.com>
2106
2107 * configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so
2108 that gettext doesn't complain.
2109 (AM_GNU_GETTEXT_VERSION): Increase to 0.15
2110 (AC_PREREQ): Increase to 2.60
2111 * HACKING: Update autoconf and gettext requirements.
2112
Scott James Remnantc16a9b42006-10-11 17:08:58 +010021132006-10-11 Scott James Remnant <scott@netsplit.com>
2114
Scott James Remnant74a11442006-10-11 17:58:56 +01002115 * init/control.c (control_init): Pass NULL to nih_list_new.
2116 Clarify list item types.
2117 * init/event.c (event_init): Pass NULL to nih_list_new.
2118 * init/job.c (job_init): Pass NULL to nih_list_new.
2119
Scott James Remnantc34c4be2006-10-11 17:56:34 +01002120 * init/main.c: Change nih_signal_add_callback to nih_signal_add_handler
2121 and NihSignalCb to NihSignalHandler.
2122
Scott James Remnant8b227402006-10-11 17:55:27 +01002123 * init/cfgfile.c, init/cfgfile.h, init/control.c, init/control.h,
2124 init/event.c, init/event.h, init/job.c, init/job.h, init/main.c,
2125 init/process.c: Clean up documentation strings and parent pointer
2126 types.
2127
Scott James Remnantd033c862006-10-11 17:41:22 +01002128 * compat/sysv/shutdown.c: Change nih_signal_add_callback to
2129 nih_signal_add_handler.
2130
Scott James Remnant1ee0f482006-10-11 17:40:41 +01002131 * compat/sysv/reboot.c: Set synopsis text depending on command
2132 used (probably should use nih_command_parser?)
2133 * compat/sysv/runlevel.c: Set synopsis and help text, and correct
2134 usage.
2135 * compat/sysv/shutdown.c: Set synopsis text.
2136 * compat/sysv/telinit.c: Set synopsis text.
2137
Scott James Remnant3b734642006-10-11 17:22:33 +01002138 * compat/sysv/runlevel.c, compat/sysv/shutdown.c: Clean up
2139 documentation strings.
2140
Scott James Remnantc6e4f002006-10-11 17:22:03 +01002141 * logd/main.c: Set synopsis and help text.
2142
Scott James Remnant5e31d742006-10-11 17:16:55 +01002143 * logd/main.c: Clean up documentation strings.
2144 Change nih_signal_add_callback to nih_signal_add_handler.
2145
Scott James Remnant48359382006-10-11 17:13:48 +01002146 * upstart/control.c, upstart/control.h, upstart/job.c: Clean up
2147 documentation strings and correct parent pointer type.
2148
Scott James Remnantc16a9b42006-10-11 17:08:58 +01002149 * HACKING: Detail function documentation requirement and format.
2150
Scott James Remnant59093a82006-10-10 13:09:58 +010021512006-10-10 Scott James Remnant <scott@netsplit.com>
2152
Scott James Remnant335947d2006-10-11 17:08:34 +01002153 * event.d/logd.in: Move to logd/event.d
2154 * event.d/Makefile.am: Remove
2155 * logd/Makefile.am: Create the logd job definition and install
2156 * Makefile.am (SUBDIRS): event.d directory has been removed.
2157 * configure.ac (AC_CONFIG_FILES): No longer make event.d/Makefile
2158
Scott James Remnant59093a82006-10-10 13:09:58 +01002159 * configure.ac: Check for --enable-compat, default to sysv if given
2160 or no compat if not given.
2161 * compat/sysv/Makefile.am: Don't build binaries or install manpages
2162 unless COMPAT_SYSV is defined.
2163
Scott James Remnant45150942006-10-06 16:36:27 +010021642006-10-06 Scott James Remnant <scott@netsplit.com>
2165
2166 * doc/upstart-logo.svg: Include the logo Alexandre designed.
2167 * doc/Makefile.am (EXTRA_DIST): Ship the logo in the tarball.
2168 * Makefile.am (SUBDIRS): Install under doc
2169 * configure.ac: Generate doc/Makefile
2170 * AUTHORS: Ensure he's credited fully.
2171
Scott James Remnant10b8c0e2006-09-27 21:27:38 +010021722006-09-27 Scott James Remnant <scott@netsplit.com>
2173
Scott James Remnant44052a32006-09-28 00:04:32 +01002174 * event.d/Makefile.am (do_subst): Eliminate duplicate /s
2175
Scott James Remnant5222c402006-09-27 22:48:48 +01002176 * man/init.8: Move to init/man
2177 * init/Makefile.am: Update to install man page.
2178 * man/logd.8: Move to logd/man
2179 * logd/Makefile.am: Update to install man page.
2180 * man/initctl.8, man/start.8: Move to initctl/man
2181 * initctl/Makefile.am: Update to install man pages.
2182 * man/reboot.8, man/runlevel.8, man/shutdown.8, man/telinit.8:
2183 Move to compat/sysv/man
2184 * compat/sysv/Makefile.am: Update to install man pages.
2185 * man/Makefile.am: Remove
2186 * configure.ac (AC_CONFIG_FILES): Remove man/Makefile
2187 * Makefile.am (SUBDIRS): Don't build in man
2188
Scott James Remnant545cb8c2006-09-27 21:32:49 +01002189 * util: Rename to initctl
2190 * configure.ac (AC_CONFIG_FILES): Update.
2191 * Makefile.am (SUBDIRS): Update.
2192
Scott James Remnant960c82d2006-09-27 21:30:42 +01002193 * util/reboot.c: Move to compat/sysv
2194 * util/shutdown.c: Move to compat/sysv
2195 * util/Makefile.am: Update.
2196 * compat/sysv/Makefile.am: Update.
2197
Scott James Remnant10b8c0e2006-09-27 21:27:38 +01002198 * configure.ac: Replace macros with single call to NIH_INIT.
2199 Bump version to 0.3.0 to begin new development cycle.
2200
Scott James Remnante5591992006-09-21 05:49:34 +010022012006-09-21 Scott James Remnant <scott@netsplit.com>
2202
2203 * logd/main.c: Revert the change that logged to the console, in
2204 practice this doesn't work so well. I want to get rid of logd
2205 in the long term, or at least just have it as a simple logging
2206 proxy, so giving it features seems wrong.
2207
Scott James Remnant9b58b842006-09-20 05:37:47 +010022082006-09-20 Scott James Remnant <scott@netsplit.com>
2209
Scott James Remnant97f08fa2006-09-20 06:34:12 +01002210 * configure.ac: Bump version to 0.2.8
2211 * NEWS: Updated.
2212
Scott James Remnante59c71e2006-09-20 06:14:32 +01002213 * logd/main.c (main): Check the kernel command-line for "quiet"
2214 (line_reader): Write to console unless silent or a daemon
2215
Scott James Remnant9b58b842006-09-20 05:37:47 +01002216 * man/Makefile.am (dist_man_MANS): Drop sulogin.8
2217 * man/sulogin.8: Drop, we don't include an sulogin
2218
Scott James Remnant0fafba42006-09-20 01:36:29 +010022192006-09-19 Michael Biebl <mbiebl@gmail.com>
2220
2221 * event.d/Makefile.am (logd): Drop $(srcdir)
2222 * init/Makefile.am (init_SOURCES): Distribute paths.h
2223
Scott James Remnant58f165f2006-09-18 19:43:07 +010022242006-09-18 Michael Biebl <mbiebl@gmail.com>
2225
2226 * configure.ac: Check for sys/inotify.h
2227
Scott James Remnante371cab2006-09-18 16:16:00 +010022282006-09-18 Scott James Remnant <scott@netsplit.com>
2229
2230 * util/shutdown.c (warning_message): Adjust method of constructing
2231 the message to not confuse poor translators who think \r and \n are
2232 the same thing!
2233
Scott James Remnantf2b1c052006-09-14 10:34:45 +010022342006-09-14 Scott James Remnant <scott@netsplit.com>
2235
Scott James Remnantb2e03d02006-09-14 11:20:13 +01002236 * init/job.c (job_change_state): Catch runaway respawns when we
2237 enter the running state, so we catch stop/start loops too.
2238 * init/tests/test_job.c (test_change_state): Update test.
2239
Scott James Remnantb7714f72006-09-14 11:07:38 +01002240 * event.d/logd: Rename to logd.in
2241 * event.d/logd.in: Replace /sbin with @sbindir@ so we can transform
2242 * event.d/Makefile.am: Generate logd from logd.in
2243
Scott James Remnant7e6bdb32006-09-14 10:57:03 +01002244 * util/reboot.c: Don't hardcode the location of /sbin/shutdown
2245 * util/Makefile.am (DEFS): Use autoconf to seed it
2246 * util/shutdown.c (sysvinit_shutdown): Don't hardcode the location
2247 of /dev/initctl
2248
Scott James Remnante0d0dd12006-09-14 10:51:05 +01002249 * init/paths.h: Create a new configuration file that can contain
2250 all of the path definitions, and in particular, allow them to be
2251 overidden elsewhere.
2252 * init/Makefile.am (DEFS): Override definitions of CFG_DIR and
2253 TELINIT using autoconf
2254 * init/main.c: Include paths.h. Don't hardcode location of telinit
2255 * init/job.c: Include paths.h
2256 * init/process.c: Include paths.h
2257 * init/process.h: Remove definitions from here.
2258
Scott James Remnantf2b1c052006-09-14 10:34:45 +01002259 * configure.ac: Bump version to 0.2.7
2260
Scott James Remnant0b8f23f2006-09-13 16:51:38 +010022612006-09-13 Scott James Remnant <scott@netsplit.com>
2262
Scott James Remnant948ab872006-09-14 10:34:34 +01002263 * NEWS: Updated.
2264
Scott James Remnant0b8f23f2006-09-13 16:51:38 +01002265 * TODO: More TODO.
2266
Scott James Remnant080dd8d2006-09-10 12:42:03 +010022672006-09-10 Scott James Remnant <scott@netsplit.com>
2268
2269 * util/reboot.c (main): Don't give -H with "halt".
2270
Scott James Remnantd7042862006-09-09 00:50:10 +010022712006-09-09 Scott James Remnant <scott@netsplit.com>
2272
Scott James Remnantedb97902006-09-09 05:48:42 +01002273 * configure.ac: Bump version to 0.2.6
2274
Scott James Remnant760237e2006-09-09 05:38:32 +01002275 * NEWS: Update.
2276 * TODO: Update.
2277
Scott James Remnant5e267a42006-09-09 05:21:28 +01002278 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
2279 the magic to be the package string.
2280 * upstart/tests/test_control.c (test_recv_msg): Update tests.
2281
Scott James Remnant17fec6e2006-09-09 05:05:42 +01002282 * util/initctl.c (main): Set the usage string.
2283 * util/shutdown.c (main): Set the usage string.
2284 * util/start.c (main): Set the usage string.
2285 * compat/sysv/runlevel.c (main): Set the usage string.
2286 * compat/sysv/telinit.c (main): Set the usage string.
2287
Scott James Remnantabede802006-09-09 05:01:45 +01002288 * man/Makefile.am: Use install-data-hook and $(man8dir)
2289 * util/Makefile.am: Also use install-exec-hook
2290
Scott James Remnantc6c20052006-09-09 04:58:11 +01002291 * Makefile.am (SUBDIRS): Install contents of the man directory
2292 * configure.ac (AC_CONFIG_FILES): Generate man/Makefile
2293 * man/Makefile.am: Install manpages in the appropriate places.
2294 * man/init.8, man/logd.8, man/initctl.8, man/reboot.8,
2295 * man/shutdown.8, man/start.8, man/sulogin.8, man/runlevel.8,
2296 * man/telinit.8: Include some basic manpages so we at least have
2297 some level of documentation.
2298
Scott James Remnant33e47112006-09-09 03:45:00 +01002299 * init/job.c (job_child_reaper): Don't check the exit status of
2300 a respawning job if the goal is to stop it.
2301
Scott James Remnant1889aa62006-09-09 03:41:53 +01002302 * compat/sysv/telinit.c (main): Generate events rather than
2303 starting and stopping jobs directly, the events are named
2304 "runlevel-X". 0, 1, 6 and s/S are shutdown events.
2305
Scott James Remnant515b2b92006-09-09 03:41:27 +01002306 * logd/main.c (main): Raise SIGSTOP before entering the main loop.
2307 * init/main.c (main): Interlock with logd.
2308
Scott James Remnant17eb9052006-09-09 03:41:04 +01002309 * event.d/logd: Should not be a console owner, but should stop
2310 on shutdown.
2311
Scott James Remnant34752262006-09-09 01:38:02 +01002312 * init/process.c (process_setup_console): Revert part of the previous
2313 change, should just output to /dev/null if we don't have logd.
2314
Scott James Remnante5533332006-09-09 01:36:07 +01002315 * configure.ac: Bump version to 0.2.5
2316
Scott James Remnantb4a1c2b2006-09-09 01:28:26 +01002317 * init/main.c (main): Start the logd job if it exists.
2318
2319 * init/process.c (process_setup_console): Ignore ECONNREFUSED as
2320 that just means that logd isn't around, handle errors by falling
2321 back to opening the console.
2322
Scott James Remnant9fb20d42006-09-09 01:22:03 +01002323 * init/process.c (process_setup_console): Implement handling for
2324 CONSOLE_LOGGED and generally clean up the other handling.
2325 * init/process.h: Update.
2326 * init/main.c (main): Pass NULL for the job to setup console.
2327 * TODO: Update.
2328
Scott James Remnantd7042862006-09-09 00:50:10 +01002329 * logd/main.c: Implement the logging daemon, it accepts connections
2330 on a unix stream socket with the abstract name
2331 "/com/ubuntu/upstart/logd", expects the length of the name and the
2332 name to follow; then sequences of lines which are logged to
2333 /var/log/boot, or memory until that file can be opened.
2334
Scott James Remnant527b9452006-09-08 17:15:07 +010023352006-09-08 Scott James Remnant <scott@netsplit.com>
2336
Scott James Remnantcb655e72006-09-08 17:49:20 +01002337 * util/shutdown.c (event_setter): Change the event names to
2338 distinguish between "shutdown -h" and "shutdown -h -H".
2339
Scott James Remnant90732d32006-09-08 17:33:19 +01002340 * init/job.c (job_handle_event): Allow jobs to react to their own
2341 events, this is how we'll do respawn eventually.
2342 * init/tests/test_job.c (test_handle_event): Remove test.
2343
Scott James Remnantbb3cc3f2006-09-08 17:17:47 +01002344 * init/main.c (cad_handler, kbd_handler): Generate the new event
2345 names.
2346 * init/event.h (CTRLALTDEL_EVENT, KBDREQUEST_EVENT): Add definitions
2347 of these event names, change the ctrlaltdel event to just that.
2348
Scott James Remnant527b9452006-09-08 17:15:07 +01002349 * logd/main.c (main): Add the code to daemonise, etc.
2350
Scott James Remnanta17917d2006-09-07 00:18:28 +010023512006-09-07 Scott James Remnant <scott@netsplit.com>
2352
Scott James Remnant214ebe82006-09-07 21:48:55 +01002353 * TODO: Long discussion today on #upstart, many improvements to the
2354 job and event model that make it more elegant.
2355 * AUTHORS: Include a list of thanks.
2356
Scott James Remnantb8280072006-09-07 03:19:00 +01002357 * util/shutdown.c (shutdown_now): If we get ECONNREFUSED when we
2358 try and send the shutdown event to init, it probably means we're
2359 still in sysvinit. So try that instead.
2360 (sysvinit_shutdown): Function to send a hand-crafted runlevel
2361 change message across /dev/initctl.
2362
Scott James Remnantae969062006-09-07 00:43:57 +01002363 * util/initctl.c (main): Add a shutdown command that takes an
2364 arbitrary event name to be issued after "shutdown". You'll
2365 nearly always want the /sbin/shutdown tool instead.
2366
Scott James Remnant987bcc42006-09-07 00:38:24 +01002367 * init/job.c (job_detect_idle): Only generate the stalled event
2368 if at least one job handles it in its start_events list.
2369 * init/tests/test_job.c (test_detect_idle): Make sure that works.
2370
Scott James Remnantea204d42006-09-07 00:30:53 +01002371 * init/event.h (STARTUP_EVENT, SHUTDOWN_EVENT, STALLED_EVENT):
2372 Macros to define the standard event names.
2373 * init/main.c (main): Use STARTUP_EVENT macro instead of "startup"
2374 * init/control.c (control_handle): Use SHUTDOWN_EVENT macro
2375 instead of "shutdown".
2376 * init/job.c (job_detect_idle): Use STALLED_EVENT macro instead
2377 of "stalled".
2378
Scott James Remnant84607df2006-09-07 00:27:22 +01002379 * init/job.c (job_detect_idle): Add some log messages for when we
2380 detect the idle or stalled states.
2381 (job_kill_process, job_kill_timer): Increase log verbosity.
2382 * init/event.c (event_queue_run): Log which events we're handling
2383 if --debug is given.
2384
Scott James Remnanta17917d2006-09-07 00:18:28 +01002385 * compat/sysv/telinit.c (main): Send a shutdown command when
2386 requesting to enter runlevel 0 or runlevel 6, likewise for
2387 runlevel 1, s or S which all run "rc1" not "rcS".
2388 * init/main.c (main): When called directory (pid != 1) try and
2389 run telinit before complaining that we're not init. Make sure
2390 errors aren't lost.
2391
Scott James Remnantf5c376c2006-09-04 16:25:04 +010023922006-09-04 Johan Kiviniemi <johan@kiviniemi.name>
Scott James Remnantedcae302006-09-04 07:06:23 +01002393
Scott James Remnantf5c376c2006-09-04 16:25:04 +01002394 * upstart/control.c (upstart_addr): Replace use of __builtin_offsetof
2395 with offsetof.
2396 * upstart/tests/test_control.c (test_recv_msg): Likewise.
2397
23982006-09-04 Scott James Remnant <scott@netsplit.com>
2399
Scott James Remnantedcae302006-09-04 07:06:23 +01002400 * util/shutdown.c (main): Exit normally after sending the warning
2401 message if -k is given.
2402
Scott James Remnante94bd202006-09-01 00:48:36 +010024032006-09-01 Scott James Remnant <scott@netsplit.com>
Scott James Remnantd4cdaca2006-08-31 00:47:11 +01002404
Scott James Remnant294cde72006-09-01 19:58:35 +01002405 * configure.ac: Bump version to 0.2.2
2406
Scott James Remnant7663bfb2006-09-01 19:58:19 +01002407 * NEWS: Update.
2408 * configure.ac: Bump version to 0.2.1
2409
Scott James Remnant67982142006-09-01 19:47:39 +01002410 * init/process.c (process_setup_console): Ensure that the console
2411 is always initialised to at least /dev/null
2412 * init/job.c (job_change_state): Initialise event to NULL.
2413 * init/event.c (event_read_state): Don't mask initialisation of
2414 other variable.
2415 * init/cfgfile.c (cfg_job_stanza, cfg_parse_script, cfg_next_token):
2416 Print lineno using %zi not %d
2417 * compat/sysv/runlevel.c (store): Cast pointer type of timeval.
2418
Scott James Remnant097b2a92006-09-01 19:30:37 +01002419 * init/main.c: Move the kernel headers include beneath the C
2420 library ones, so that compilation doesn't fail on !i386.
2421 * util/reboot.c: Likewise.
2422
Scott James Remnant28fcc922006-09-01 04:15:57 +01002423 * init/main.c (term_handler): Close the control connection if we
2424 re-exec init, otherwise it won't be able to bind. Drop debugging.
2425
Scott James Remnant6f464962006-09-01 04:10:20 +01002426 * init/main.c (term_handler): It always helps if we dup2 the
2427 right file descriptor.
2428
Scott James Remnant1db88042006-09-01 03:14:19 +01002429 * init/main.c: Use the TERM signal instead of USR1, as old init
2430 used that for something else. Also rather than passing across
2431 file descriptor numbers, use a fixed descriptor and just pass
2432 "--restart". When we get that option we need to unmask signals
2433 otherwise we sit there looking like a lemon.
2434
Scott James Remnante7a73262006-09-01 02:32:27 +01002435 * init/job.c (job_change_state): Don't free the event unless we
2436 generate one.
2437
Scott James Remnant12dd7252006-09-01 02:27:04 +01002438 * NEWS: Update.
2439
Scott James Remnant694172a2006-09-01 02:26:45 +01002440 * init/cfgfile.c (cfg_watcher): Ignore any file with '.' or '~'
2441
Scott James Remnantc6e63dd2006-09-01 02:16:43 +01002442 * TODO: Update.
2443
Scott James Remnant3401ab72006-09-01 02:14:47 +01002444 * init/main.c (main): Parse command-line arguments, specifically
2445 look for --state-fd which we'll use for reexec. Don't do a couple
2446 of things if we're passed this.
2447 (read_state): Parse the line-buffered state.
2448 * init/job.c (job_read_state, job_write_state): Job state
2449 serialisation so that we can re-exec ourselves.
2450 * init/job.h: Update.
2451 * init/tests/test_job.c: Test the serialisation.
2452 * init/event.c (event_read_state, event_write_state): And similar
2453 functions for serialising the event queue.
2454 * init/event.h: Update.
2455 * init/tests/test_event.c: Test the serialisation.
2456 * init/cfgfile.c (cfg_read_job): Fix a bug, need to subtract current
2457 time to get due time.
2458
Scott James Remnante94bd202006-09-01 00:48:36 +01002459 * upstart/job.c (job_goal_from_name, job_state_from_name)
2460 (process_state_from_name): Add opposite numbers that convert a
2461 string back into an enumeration.
2462 * upstart/job.h: Update.
2463 * upstart/tests/test_job.c: Test the new functions.
2464
24652006-08-31 Scott James Remnant <scott@netsplit.com>
Scott James Remnant694172a2006-09-01 02:26:45 +01002466
Scott James Remnantb7260a72006-08-31 22:08:56 +01002467 * init/job.h (Job): Add respawn_limit, respawn_interval,
2468 respawn_count and respawn_time members so that we can keep track of
2469 runaway processes.
2470 * init/job.c (job_catch_runaway): Increment the respawn_count
2471 within respawn_interval, or reset it if we go over.
2472 (job_new): Initialise respawn_limit and respawn_interval to sensible
2473 defaults.
2474 * init/tests/test_job.c (test_new): Check the defaults are set.
2475 (test_change_state): Check the respawning code works.
2476 * init/cfgfile.c (cfg_job_stanza): Parse the "respawn limit" stanza.
2477 * init/tests/test_cfgfile.c (test_read_job): Test the new stanza.
2478
Scott James Remnantff0d26a2006-08-31 20:49:43 +01002479 * init/process.c (process_setup_console): Remove the console reset
2480 code, it tends to just crash X and seems to do nothing interesting.
2481 * init/main.c (reset_console): Instead put it here and just do it
2482 on startup.
2483
Scott James Remnant25b263a2006-08-31 18:59:02 +01002484 * configure.ac: Bump version to 0.2.0
2485
Scott James Remnant4b61be92006-08-31 17:08:44 +01002486 * util/Makefile.am (install-exec-local): Create symbolic links,
2487 not hard links.
2488
Scott James Remnantaf1404f2006-08-31 16:04:16 +01002489 * init/main.c: Can't catch STOP.
2490
Scott James Remnant242b50b2006-08-31 15:40:42 +01002491 * util/reboot.c: Pause init while shutting down or rebooting.
2492
Scott James Remnanteabb7802006-08-31 15:39:04 +01002493 * init/main.c (stop_handler): Catch STOP/TSTP and CONT.
2494 * init/event.c (event_queue_run): Don't run the event queue while
2495 paused.
2496 * init/job.c (job_detect_idle): Don't detect idle jobs while paused.
2497
Scott James Remnant1cd8d862006-08-31 15:17:16 +01002498 * util/reboot.c: if we get the -w argument ("only write to wtmp")
2499 we need to exit, and not behave as halt normally would.
2500
Scott James Remnantff63cf72006-08-31 04:39:34 +01002501 * compat/sysv/runlevel.c (main): Add missing newline.
2502 * compat/sysv/telinit.c (main): And here too.
2503
Scott James Remnant32de9222006-08-31 04:34:27 +01002504 * init/main.c (main): Check for idle after the startup event queue
2505 has been run, otherwise we may just sit there.
2506
Scott James Remnant13ffffe2006-08-31 04:33:39 +01002507 * compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install telinit
2508 (telinit_SOURCES, telinit_LDFLAGS, telinit_LDADD): Details for
2509 telinit binary.
2510 * compat/sysv/telinit.c: Trivial telinit program that just runs
2511 the appropriate rcX job.
2512 * compat/sysv/runlevel.c (main): Suggest help on illegal runlevel.
2513
Scott James Remnant40f09012006-08-31 04:21:49 +01002514 * util/Makefile.am: Tidy up.
2515
Scott James Remnant12473562006-08-31 04:21:05 +01002516 * configure.ac (AC_CONFIG_FILES): Create compat/sysv/Makefile
2517 * Makefile.am (SUBDIRS): Build things found in compat/sysv
2518 * compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install runlevel
2519 (runlevel_SOURCES, runlevel_LDFLAGS, runlevel_LDADD): Details for
2520 runlevel binary.
2521 * compat/sysv/runlevel.c: Helper to store and retrieve the current
2522 "runlevel" from utmp/wtmp; as well as the reboot time.
2523
Scott James Remnantd909cca2006-08-31 04:20:14 +01002524 * init/main.c (main): Drop debugging set.
2525
Scott James Remnantcedd11a2006-08-31 02:59:29 +01002526 * init/job.c (job_change_state): As well as the job/state events,
2527 send the job event when a service is running or a task is stopping.
2528 * init/tests/test_job.c (test_change_state): Check the events get
2529 sent properly.
2530
Scott James Remnant44b684a2006-08-31 02:58:45 +01002531 * util/start.c: Write a simple utility to start, stop, or query
2532 the status of the named jobs.
2533 * util/Makefile.am (sbin_PROGRAMS): Build and install start
2534 (start_SOURCES, start_LDFLAGS, start_LDADD): Details for start
2535 (install-exec-local): Also install as stop and status.
2536 * util/reboot.c (main): Drop the debugging set.
2537
Scott James Remnantb8ed2d12006-08-31 02:15:48 +01002538 * init/cfgfile.c (cfg_job_stanza): Correct nih_alloc error.
2539
Scott James Remnanta6125ae2006-08-31 02:14:25 +01002540 * init/process.c (process_setup_environment): Guard memory alloc.
2541 * init/job.c (job_set_idle_event): Likewise.
2542 (job_change_state): And here too.
2543 (job_run_command): Likewise.
2544 * init/control.c (control_send): Likewise.
2545 * init/cfgfile.c: And throughout this file.
2546 * upstart/control.c (upstart_recv_msg): And once here too.
2547
Scott James Remnant0b358ab2006-08-31 02:07:32 +01002548 * upstart/control.h: Abolish the separate halt, reboot and poweroff
2549 messages and replace with a single shutdown message that takes
2550 an event name (for the idle event issued afterwards).
2551 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
2552 the new shutdown event type by just treating it as an event.
2553 * upstart/tests/test_control.c (test_messages): Update tests.
2554 * init/job.c (job_set_idle_event): Store a copy of the idle event
2555 name.
2556 * init/control.c (control_send): Copy the shutdown event name.
2557 (control_handle): Replace individual handling with the new
2558 single event.
2559 * init/tests/test_control.c (test_watcher): Update.
2560 * util/initctl.c: Drop handling for things that shutdown does now.
2561 * util/shutdown.c: Send the UPSTART_SHUTDOWN event and let the user
2562 specify anything they want, just give defaults.
2563
Scott James Remnantff5efb92006-08-31 01:45:19 +01002564 This is quite a big change and abolishes level events entirely,
2565 along with the event history. We now just treat events as a
2566 transient queue of strings that go past, may cause things to change,
2567 but are otherwise forgotten. This turns out to be much easier to
2568 understand and has no real loss of power.
2569
2570 * init/event.c: Vastly simplify; gone are the separate notions of
2571 edge and level events, instead we just treat them as one-shot
2572 things that go past and are forgotten about.
2573 * init/event.h (Event): Remove value member.
2574 Update prototypes.
2575 * init/tests/test_event.c: Update.
2576 * init/job.c (job_change_state): Change the event pattern to be
2577 one that includes the job name and a description of the transition
2578 instead of the new state.
2579 (job_detect_idle): Call event_queue rather than event_queue_edge.
2580 * init/tests/test_job.c: Update.
2581 * init/cfgfile.c (cfg_job_stanza): Drop "when" and "while".
2582 * init/tests/test_cfgfile.c (test_read_job): Drop mentions of
2583 "when" and "while".
2584 * init/control.c (control_send, control_handle): Drop cases for
2585 level events.
2586 (control_handle_event): Don't include a level in the event.
2587 * init/tests/test_control.c: Update
2588 * init/main.c: Call event_queue rather than event_queue_edge.
2589 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
2590 event handling so that only a name is read.
2591 * upstart/control.h: Remove value/level event structures.
2592 * upstart/tests/test_control.c (test_messages): Update.
2593 * upstart/job.c (process_state_name): Not used for events, adjust
2594 documentation so it doesn't lie.
2595 * util/initctl.c (main): Drop the set function, simplify trigger.
2596 * util/shutdown.c (shutdown_now): Call UPSTART_EVENT_QUEUE for
2597 shutdown into maintenance mode.
2598
Scott James Remnantfcbee2d2006-08-31 00:49:36 +01002599 * init/control.c (control_handle): Place a message in the syslog
2600 before halting, powering off or rebooting.
2601
Scott James Remnantd4cdaca2006-08-31 00:47:11 +01002602 * util/shutdown.c: Adjust so that the warning message is sent out
2603 if shutdown is immediate, and when it actually happens. Include
2604 the hostname as wall does.
2605
Scott James Remnant255c5f22006-08-30 16:05:01 +010026062006-08-30 Scott James Remnant <scott@netsplit.com>
2607
Scott James Remnant5be55662006-08-30 19:13:25 +01002608 * TODO: Update.
2609
Scott James Remnant4a9245f2006-08-30 19:13:00 +01002610 * util/shutdown.c: Implement shutdown utility along the same lines
2611 as the sysvinit one, but with rather different code.
2612
Scott James Remnant2a71aaa2006-08-30 16:34:06 +01002613 * util/initctl.c (main): Call setuid on the effective user id so
2614 that we can be made setuid root and executable by a special group.
2615 * util/reboot.c (main): Likewise.
2616
Scott James Remnant70cc2292006-08-30 16:06:03 +01002617 * util/initctl.c (main): Check the effective rather than the real
2618 user id, if we're effectively root, that's good enough.
2619
Scott James Remnant255c5f22006-08-30 16:05:01 +01002620 * util/reboot.c: Implement reboot/halt/poweroff utility.
2621 * util/Makefile.am (sbin_PROGRAMS): Build and install reboot
2622 (reboot_SOURCES, reboot_LDFLAGS, reboot_LDADD): Details for reboot
2623 (install-exec-local): Create hardlinks to reboot for halt and poweroff.
2624
Scott James Remnantdc8877d2006-08-29 16:56:48 +010026252006-08-29 Scott James Remnant <scott@netsplit.com>
2626
2627 * init/main.c (main): Actually run the idle-detect function.
2628 * init/job.c (job_detect_idle): Interrupt the main loop, otherwise
2629 we may end up waiting for a signal before we process the event
2630 we just issued.
2631
Scott James Remnantf43bdf32006-08-27 18:20:29 +010026322006-08-27 Scott James Remnant <scott@netsplit.com>
2633
Scott James Remnant47158482006-08-27 22:37:10 +01002634 * util/shutdown.c: Template main function.
2635 * util/Makefile.am (sbin_PROGRAMS): Build and install the
2636 shutdown binary.
2637 (shutdown_SOURCES, shutdown_LDFLAGS, shutdown_LDADD): Details for
2638 the shutdown binary
2639
Scott James Remnant70a6ec62006-08-27 22:23:50 +01002640 * util/initctl.c (main): Add commands for halt, poweroff and reboot.
2641
Scott James Remnant0c7e72a2006-08-27 22:22:53 +01002642 * init/event.c (event_queue_run): Remove the parameters.
2643 * init/event.h: Update.
2644 * init/main.c (main): Update.
2645 * init/tests/test_control.c (test_watcher): Update.
2646 * init/tests/test_job.c (test_detect_idle): Update.
2647
Scott James Remnant96ae9e42006-08-27 22:15:34 +01002648 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Deal
2649 with halting, rebooting and powering off; or at least the appropriate
2650 messages.
2651 * upstart/control.h: Add control message structures for halting,
2652 powering off and rebooting the machine.
2653 * upstart/tests/test_control.c (test_messages): Run the tests.
2654 * init/control.c (control_handle): Add handling for halt, power off
2655 and reboot that issue the shutdown event and arrange for the halt,
2656 poweroff or reboot to be issued the next time the system is idle.
2657 * init/tests/test_control.c (test_watcher): Test the events.
2658
Scott James Remnant01a37082006-08-27 21:51:00 +01002659 * TODO: Update.
2660
Scott James Remnante02892b2006-08-27 21:49:44 +01002661 * init/job.c (job_detect_idle): Function to detect when the system is
2662 stalled or idle.
2663 * init/job.h: Update
2664 * init/tests/test_job.c (test_detect_idle): Test the new function.
2665
Scott James Remnant6a8508c2006-08-27 19:10:44 +01002666 * util/initctl.c (main): Handle the list command.
2667
Scott James Remnanta9476ad2006-08-27 19:07:23 +01002668 * TODO: Update.
2669
Scott James Remnant4da474d2006-08-27 19:06:35 +01002670 * upstart/control.c (WireJobStatusPayload): add description to the
2671 job status payload.
2672 (upstart_send_msg_to, upstart_recv_msg): Send and receieve the
2673 description over the wire.
2674 * upstart/control.h (UpstartJobStatusMsg): add a description field
2675 * upstart/tests/test_control.c: Update test cases.
2676 * init/control.c (control_handle): Include the job description in
2677 the message.
2678 (control_send): Copy the description when we put the message on
2679 the queue.
2680 (control_handle_job): Copy the description here too
2681 * init/tests/test_control.c: Update test cases.
2682
Scott James Remnant84f5e932006-08-27 18:49:25 +01002683 * init/job.c (job_list): Add a function to return the job list.
2684 * init/job.h: Update.
2685 * init/control.c (control_handle): Handle the JOB_LIST message
2686 by sending back a list of job status messages followed by the
2687 JOB_LIST_END message.
2688 * init/tests/test_control.c (test_watcher_child): Check the
2689 JOB_LIST message works properly.
2690
Scott James Remnantf4ad6d12006-08-27 18:40:01 +01002691 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
2692 the JOB_LIST and JOB_LIST_END messages which have no payload.
2693 * upstart/control.h: Add enums and structures for job list messages.
2694 * upstart/tests/test_control.c (test_messages): Update tests.
2695
Scott James Remnantf4970812006-08-27 18:27:19 +01002696 * init/main.c (main): Check that we're both uid and process #1
2697
Scott James Remnantf43bdf32006-08-27 18:20:29 +01002698 * init/main.c (main): Stop handling SIGTERM, we never want people
2699 to kill init. Handle SIGINT and SIGWINCH through the ordinary
2700 handler and SIGSEGV through a direct handler.
2701 (segv_handler): Write a sensible core dump handler, we use a child
2702 to dump core while we carry on in the parent hopefully stepping over
2703 the bad instruction.
2704 (cad_handler): Generate the control-alt-delete event.
2705 (kbd_handler): Generate the kbdrequest event.
2706
Scott James Remnant33e64d02006-08-25 14:44:32 +020027072006-08-25 Scott James Remnant <scott@netsplit.com>
2708
Scott James Remnant21679252006-08-25 16:22:13 +02002709 * configure.ac: Bump version to 0.1.2
2710 * NEWS: Update.
2711
Scott James Remnantfef12b52006-08-25 16:16:45 +02002712 * TODO: Update.
2713
Scott James Remnant94d00982006-08-25 15:38:22 +02002714 * init/process.c (process_setup_environment): Inherit the PATH
2715 and TERM environment variables from the init process, so the
2716 console works properly.
2717 * init/process.h (PATH): Declare a default value for this variable
2718 * init/main.c (main): Set the value of PATH to the default.
2719 * init/tests/test_process.c (child): Update test case.
2720
Scott James Remnant33e64d02006-08-25 14:44:32 +02002721 * NEWS: Update.
2722 * configure.ac: Bump version to 0.1.1
2723
Scott James Remnant68ccc9e2006-08-24 00:10:41 +020027242006-08-24 Scott James Remnant <scott@netsplit.com>
2725
Scott James Remnant279d4352006-08-24 15:33:19 +02002726 * init/cfgfile.h (CFG_DIR): Change configuration directory to
2727 /etc/event.d -- it's not been used by anyone, but is similar to
2728 other directories that have which is a good precedent.
2729 * event.d/Makefile.am (eventdir, dist_event_DATA): Install files
2730 into the new directory name.
2731 * Makefile.am (SUBDIRS): Rename sub directory
2732 * configure.ac (AC_CONFIG_FILES): Rename generated Makefile
2733
Scott James Remnant937192c2006-08-24 02:57:50 +02002734 * init/Makefile.am (DEFAULT_INCLUDES): Set to include the right
2735 directories so out of tree builds work.
2736 * logd/Makefile.am (DEFAULT_INCLUDES): Set to include the right
2737 directories so out of tree builds work.
2738 * upstart/Makefile.am (DEFAULT_INCLUDES): Set to include the right
2739 directories so out of tree builds work.
2740 (upstartinclude_HEADERS): Install errors.h
2741 * util/Makefile.am (DEFAULT_INCLUDES): Set to include the right
2742 directories so out of tree builds work.
2743
2744 * Makefile.am (SUBDIRS): Add m4 to the list
2745 * configure.ac (AC_CONFIG_FILES): Generate m4/Makefile
2746 * upstart/Makefile.am (upstartinclude_HEADERS): Add errors.h
2747
2748 * upstart/control.c (upstart_open):
2749
Scott James Remnante4c3d552006-08-24 02:34:01 +02002750 * init/control.c (control_open): Raise the error before
2751 performing other actions so errno is not lost.
Scott James Remnant73550092006-08-24 02:27:03 +02002752
Scott James Remnante4c3d552006-08-24 02:34:01 +02002753 * TODO: Update.o
Scott James Remnantf8b776b2006-08-24 00:36:15 +02002754 * init/cfgfile.c (cfg_next_token): Don't count quote characters
2755 unless we're actually planning to dequote the file, otherwise we
2756 end up allocating short.
2757
Scott James Remnant9e17fc02006-08-24 00:28:10 +02002758 * init/control.c (control_close): Free the io_watch using list_free
2759 in case a destructor has been set.
2760 * init/tests/test_control.c: Initialise the type of the message, and
2761 free job correctly.
2762
Scott James Remnant68ccc9e2006-08-24 00:10:41 +02002763 * upstart/tests/test_control.c: Fix overwrite of buffer.
2764 * init/tests/test_job.c: Clean up not-freed job.
2765
Scott James Remnantc961ce32006-08-23 19:46:29 +020027662006-08-23 Scott James Remnant <scott@netsplit.com>
2767
Scott James Remnant013e9722006-08-23 23:00:14 +02002768 * init/tests/test_event.c: free the entry allocated and initialise
2769 the return values.
2770
Scott James Remnantc961ce32006-08-23 19:46:29 +02002771 * init/cfgfile.c (cfg_skip_token): Drop this function; we'll
2772 make sure *pos is pointing at the start of the thing we want
2773 to parse, not the first token. Update the other functions
2774 accordingly.
2775 (cfg_read_job): Implement function to look over a job file and
2776 parse all of the stanzas that are found. Also sanity checks the
2777 job afterwards and deals with reloading existing jobs.
2778 (cfg_job_stanza): Function that parses an individual stanza,
2779 calling out to the other parse functions; this is the main config
2780 file parser!
2781 (cfg_parse_args, cfg_parse_command): Drop requirement that filename
2782 and lineno be passed, so we can be called to reparse arguments after
2783 we've already done so.
2784 (cfg_parse_script): Remove requirement that it be called at the
2785 start of the entire stanza, and instead at the start of the script.
2786 When hitting EOF, return the script so far, not NULL.
2787 (cfg_parse_args): Correct bug where we didn't check sufficient
2788 characters while skipping whitespace.
2789 (cfg_next_token): Correct bug where we didn't copy the character
2790 after a slash into the text, instead of just not copying the slash.
2791 Adjust line numbers to match the fact that it's zero based now.
2792 * init/cfgfile.h: Define prototype.
2793 * init/tests/test_cfgfile.c (test_read_job): Pretty thoroughly
2794 test the config file parser code.
2795
Scott James Remnant0c58ed02006-08-22 11:42:19 +020027962006-08-22 Scott James Remnant <scott@netsplit.com>
2797
Scott James Remnant214168f2006-08-22 18:52:51 +02002798 * init/cfgfile.c (cfg_tokenise): Rename to cfg_next_token.
2799 (cfg_skip_token): Code to skip whitespace, token and whitespace.
2800 (cfg_parse_args): Function to parse an argument list.
2801 (cfg_next_token): Extend to support the removal of quotes and
2802 slashes from the token.
2803
Scott James Remnant21590a22006-08-22 17:40:48 +02002804 * init/cfgfile.c (cfg_parse_script): Pass filename and lineno and
2805 increment the latter as we go.
2806 (cfg_script_end): Pass and increment lineno.
2807
Scott James Remnanteed2e8d2006-08-22 17:31:07 +02002808 * init/cfgfile.c: Correct a missing semi-colon in prototypes.
2809 (cfg_parse_command): Function to parse any stanza that requires
2810 a command and arguments list, e.g. exec/respawn/daemon. We don't
2811 want to require that the list be quoted, etc. and do want to allow
2812 it to be folded over lines.
2813 (cfg_tokenise): Function used by the above to tokenise the file,
2814 handling things like \, quoted strings and newlines, etc. Can be
2815 used both to determine the length of the token and to copy it.
2816
Scott James Remnantfcc98ad2006-08-22 12:28:19 +02002817 * init/cfgfile.c (cfg_read_script): Rename to cfg_parse_script.
2818
Scott James Remnantfd32dd32006-08-22 11:46:01 +02002819 * init/cfgfile.c (cfg_read_script): Function to parse a script
2820 fragment ("foo script\n....end script\n") from the job file, which
2821 is the most complex form we can find. Write it assuming the file is
2822 in a character array which may not be NULL terminated (ie. a mmap'd
2823 file).
2824 (cfg_script_end): Used by the above to detect the end of the
2825 fragment.
2826 * init/cfgfile.h: Empty header file.
2827 * init/Makefile.am (init_SOURCES): Build and link cfgfile.c
2828 using the cfgfile.h header
2829 (TESTS): Build and run the config file test cases.
2830 (test_cfgfile_SOURCES, test_cfgfile_LDFLAGS, test_cfgfile_LDADD):
2831 Details for config file test case binary.
2832
Scott James Remnant0c58ed02006-08-22 11:42:19 +02002833 * init/main.c (main): Remove the calls to the unfinished config
2834 file code.
2835
Scott James Remnant6ce44812006-08-21 08:46:32 +020028362006-08-21 Scott James Remnant <scott@netsplit.com>
2837
Scott James Remnant027dd7b2006-08-21 09:01:25 +02002838 * init/main.c: Add missing include for unistd.h
2839 * init/process.c (process_setup_console): Drop use of job.
2840 * util/initctl.c (main): Check that we're run as root.
2841
Scott James Remnant77e8db32006-08-21 08:47:50 +02002842 * init/main.c (main): Write the main function
2843
Scott James Remnant6ecceb82006-08-21 08:47:23 +02002844 * init/event.c (event_queue_cb): Rename to event_queue_run.
2845 * init/event.h: Update.
2846
Scott James Remnant6ce44812006-08-21 08:46:32 +02002847 * init/process.c (process_setup_console): Become an exported
2848 function that includes the code to reset a console.
2849
Scott James Remnant5befd932006-08-19 19:24:54 +010028502006-08-19 Scott James Remnant <scott@netsplit.com>
2851
Scott James Remnantcd39a7c2006-08-19 20:02:17 +01002852 * logd/main.c (main): Write the basic main function.
2853
Scott James Remnant3bcd15e2006-08-19 19:50:12 +01002854 * util/initctl.c (main): Fill in the details to give us a basic
2855 test client.
2856
Scott James Remnant3dc965c2006-08-19 19:25:23 +01002857 * TODO: Update.
2858
Scott James Remnant5befd932006-08-19 19:24:54 +01002859 * util/initctl.c (main): Provide the most basic main function.
2860 * util/Makefile.am (sbin_PROGRAMS): Build the initctl binary
2861 * Makefile.am (SUBDIRS): Build the utilities.
2862 * configure.ac (AC_CONFIG_FILES): Generate the util Makefile.
2863
Scott James Remnant1fe38a82006-08-18 17:06:25 +010028642006-08-18 Scott James Remnant <scott@netsplit.com>
2865
Scott James Remnantc2659612006-08-18 22:19:47 +01002866 * init/Makefile.am (test_job_LDADD): Remove the duplicate link.
2867
Scott James Remnantd5e07052006-08-18 20:39:30 +01002868 * TODO: Update.
2869
Scott James Remnanta060bb72006-08-18 20:16:55 +01002870 * init/job.c (job_handle_child): Rename to job_child_reaper.
2871 * init/job.h: Update.
2872 * init/tests/test_job.c: Update function names.
2873
Scott James Remnant829dc082006-08-18 20:10:02 +01002874 * init/control.c (control_cb): Rename to control_watcher
2875 * init/tests/test_control.c: Update function names.
2876
Scott James Remnantddc3e282006-08-18 18:49:50 +01002877 * TODO: Update.
2878
Scott James Remnantc2cac3f2006-08-18 17:17:57 +01002879 * Makefile.am (SUBDIRS): Install the rc.d files.
2880 * configure.ac (AC_CONFIG_FILES): Generate the rc.d Makefile.
2881 * rc.d/Makefile.am (rcdir): Define rcdir to be /etc/rc.d
2882 (dist_rc_DATA): Install the logd file into that directory.
2883 * rc.d/logd: Write a simple service definition for the log daemon,
2884 this saves us hardcoding any information about it into init; it'll
2885 just need to know the name.
2886
Scott James Remnant1fe38a82006-08-18 17:06:25 +01002887 * Makefile.am (SUBDIRS): Build the logd daemon
2888 * configure.ac (AC_CONFIG_FILES): Generate the logd Makefile.
2889 * logd/Makefile.am (sbin_PROGRAMS): Install the logd binary into
2890 the sbin directory by default.
2891 (logd_SOURCES): Build and link main.c
2892 * logd/main.c (main): Add basic main function for testing purposes.
2893
Scott James Remnantb9814432006-08-16 02:11:51 +010028942006-08-16 Scott James Remnant <scott@netsplit.com>
2895
Scott James Remnantc5da6fd2006-08-16 18:06:49 +01002896 * init/job.c (job_start): Ignore self-dependencies; over-document
2897 why the dependency event prodding has a surprise in its tail.
2898 (job_change_state): Move the job_release_depends call to here.
2899
Scott James Remnant133a7a32006-08-16 17:45:51 +01002900 * init/event.c (event_queue_cb): Add event consumer/dispatcher.
Scott James Remnant13e5dbf2006-08-16 17:48:01 +01002901 * init/event.h: Update.
Scott James Remnant133a7a32006-08-16 17:45:51 +01002902
Scott James Remnant3772bc62006-08-16 17:41:34 +01002903 * init/control.c (control_send): Make the event code clearer.
2904 (control_handle): Handle the changed event semantics.
2905 (control_handle_event): Issue the new event type.
2906 * init/tests/test_control.c: Update tests.
2907
Scott James Remnantcaee5b52006-08-16 17:32:12 +01002908 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Adjust
2909 marshal code to match.
2910 * upstart/control.h: Update all structures appropriately to the
2911 previous changes.
2912 * upstart/tests/test_control.c: Update.
2913
Scott James Remnant4d4389d2006-08-16 17:19:20 +01002914 * init/job.c (job_change_state): Change call to event_trigger_level
2915 to event_queue_level.
2916
Scott James Remnant51664d72006-08-16 17:17:58 +01002917 * init/event.c (event_trigger_edge, event_trigger_level): Place
2918 the event on the event_queue rather than directly triggering it.
2919 Rename to event_queue_edge and event_queue_level respectively.
2920 * init/event.h: Update.
2921 * init/tests/test_event.c: Update test cases.
2922
Scott James Remnant4ddc86e2006-08-16 16:17:48 +01002923 * init/job.c (job_handle_event): Add another sanity check, jobs
2924 should not be able to react to their own events; that's just silly.
2925 * init/tests/test_job.c (test_handle_event): Check that the new
2926 condition does the right thing.
2927
Scott James Remnant930f3e02006-08-16 16:13:03 +01002928 * init/job.c (job_change_state): Make it illegal for a job to exist
2929 without either a command or script or both. This is for sanity
2930 reasons, allowing no primary process makes no sense and can lead
2931 to event loops if someone is feeling nefarious.
2932 * init/tests/test_job.c (test_change_state): Drop test on behaviour
2933 we've just outlawed.
2934
Scott James Remnant7dd047e2006-08-16 13:43:50 +01002935 * init/job.c (job_start): Only announce the change if we're still
2936 in the waiting state, we could have moved on to running already.
2937
Scott James Remnantf9261ba2006-08-16 13:40:05 +01002938 * init/job.c (job_start): If holding the job, at least announce
2939 the goal change to subscribed clients.
2940
Scott James Remnant853cc772006-08-16 13:34:51 +01002941 * TODO: Update.
2942
Scott James Remnantfdb82592006-08-16 13:31:49 +01002943 * init/job.c (job_start): Check for dependencies before starting
2944 the process, if we have any that aren't running we stay in waiting
2945 until they are. Any that aren't even starting get poked with a
2946 dependency event to see whether that wakes them up.
2947 * init/tests/test_job.c (test_start): Test paths through new
2948 dependency code.
2949
Scott James Remnant278150a2006-08-16 12:56:34 +01002950 * init/job.c (job_run_process): Once we've got an active process
2951 in the running state, release our dependencies.
2952
Scott James Remnant6d4104d2006-08-16 12:50:39 +01002953 * init/job.c (job_release_depends): Function to release any waiting
2954 dependencies on the given job.
2955 * init/job.h: Update.
2956 * init/tests/test_job.c (test_release_depends): Test the behaviour
2957 of the function on its own.
2958
Scott James Remnant1da1dad2006-08-16 12:18:50 +01002959 * init/job.h (Job): Add depends list field
2960 (JobName): New structure to hold the name of a job.
2961 * init/job.c (job_new): Initialise the depends list.
2962 * init/tests/test_job.c (test_new): Make sure the depends list is
2963 initialised properly.
2964
Scott James Remnant37eee032006-08-16 12:10:49 +01002965 * init/job.c (job_next_state): Return JOB_STARTING if we're in
2966 JOB_WAITING and the goal is JOB_START. This is only called when
2967 there's some change, and I don't want to hard-code the goal there.
2968 (job_start): Don't hardcode JOB_STARTING, instead just use the next
2969 state.
2970 * init/tests/test_job.c (test_next_state): Adjust test case.
2971
Scott James Remnantc3d3ead2006-08-16 09:00:50 +01002972 * init/control.c (control_subscribe): Allow the current
2973 subscription to be found by passing NOTIFY_NONE.
2974 (control_handle): Don't remove an existing subscription to jobs,
2975 a GUI will probably want a permanent one to keep the status up to
2976 date.
2977
Scott James Remnantb9a568c2006-08-16 08:57:46 +01002978 * init/job.c (job_kill_process, job_kill_timer): Don't hardcode
2979 JOB_STOPPING here, instead move to the next logical state.
2980 (job_kill_process): Notify subscribed processes that we killed
2981 the job.
2982 (job_start, job_stop): Notify subscribed processes of a change of
2983 goal that doesn't result in an immediate state change.
2984
Scott James Remnant8dbc6012006-08-16 08:57:38 +01002985 * init/event.c (event_trigger_edge, event_trigger_level): Swap
2986 order so that events are announced before processed.
2987
Scott James Remnant28161252006-08-16 08:41:48 +01002988 * init/control.c (control_handle): Handle requests to watch and
2989 unwatch jobs and events.
2990 * init/tests/test_control.c (test_cb_child, test_cb): Check that
2991 subscriptions work.
2992
Scott James Remnantb6d55bf2006-08-16 08:24:16 +01002993 * init/tests/test_control.c (test_cb_child): Add a sleep to avoid
2994 a race that upsets gdb, have tried this with a STOP/CONT interlock
2995 but can't seem to find where the child should reach first.
2996
Scott James Remnant5612b232006-08-16 08:21:06 +01002997 * init/job.c (job_change_state): Notify the control handler.
2998 * init/event.c (event_trigger_edge, event_trigger_level): Pass
2999 event to the control handler.
3000 * init/tests/test_control.c (test_cb_child): Expect to receive
3001 job status events as well.
3002 * init/Makefile.am (test_event_LDADD, test_process_LDADD)
3003 (test_job_LDADD): Add control.o to the linkage.
3004
Scott James Remnant9e0626a2006-08-16 08:17:07 +01003005 * init/control.c (control_cb): Don't display an error for
3006 ECONNREFUSED, just remove any subscriptions.
3007 * init/tests/test_control.c (test_handle_job, test_handle_error):
3008 Clean up our subscriptions properly.
3009
Scott James Remnant3c465c82006-08-16 07:40:24 +01003010 * init/control.c (control_handle_job): Function to send out an
3011 UPSTART_JOB_STATUS message to subscribed processes whenever a
3012 job state changes.
3013 (control_handle_event): Function to send out an
3014 UPSTART_EVENT_TRIGGERED message to subscribed processes whenever
3015 an event is triggered.
3016 * init/control.h: Update.
3017 * init/tests/test_control.c (test_handle_job, test_handle_event):
3018 Check that the functions work properly.
3019
Scott James Remnant16dadc52006-08-16 07:27:40 +01003020 * init/control.c (control_handle): Handle messages that trigger
3021 edge and level events; subscribe the process to receive notification
3022 of job changes during the event.
3023 * init/tests/test_control.c (test_cb_child): Check that the messages
3024 are handled properly (without subscription check).
3025
Scott James Remnanta7ba72a2006-08-16 07:11:30 +01003026 * init/control.c (control_cb): Unsubscribe a process if it stops
3027 listening.
3028
Scott James Remnant2c9669c2006-08-16 07:10:05 +01003029 * init/control.c (control_send): Copy the pointers in the new
3030 event messages.
3031 * init/tests/test_control.c (test_send): Check the pointers are
3032 copied across correctly.
3033
Scott James Remnant15d61c62006-08-16 06:55:58 +01003034 * init/control.c (control_subscribe): Add function to handle
3035 processes that want to subscribe to changes.
3036 (control_init): Initialise the subscriptions list.
3037 * init/control.h: Add structures and prototypes.
3038 * init/tests/test_control.c (test_subscribe): Test the function.
3039
Scott James Remnant8692f762006-08-16 06:21:13 +01003040 * upstart/control.h (UpstartMsgType): add messages for triggering
3041 edge and level events, receiving the trigger for an event and for
3042 watching jobs and events.
3043 (UpstartEventTriggerEdgeMsg, UpstartEventTriggerLevelMsg)
3044 (UpstartEventTriggeredMsg, UpstartWatchJobsMsg)
3045 (UpstartUnwatchJobsMsg, UpstartWatchEventsMsg):
3046 (UpstartUnwatchEventsMsg): Add structures for the new messages.
3047 (UpstartMsg): And add them to the union.
3048 * upstart/control.c (WireEventPayload): The event messages can all
3049 share a wire payload type; the watch messages don't need any special
3050 payload.
3051 (upstart_send_msg_to): Add the payloads onto the wire.
3052 (upstart_recv_msg): And take the payloads back off the wire.
3053 * upstart/tests/test_control.c (test_messages): Test the new
3054 message types.
3055
Scott James Remnant8ed97eb2006-08-16 05:46:44 +01003056 * upstart/control.h (UpstartJobStatusMsg): add a process id.
3057 * upstart/control.c (WireJobStatusPayload): and here too.
3058 (upstart_send_msg_to): copy the process id onto the wire.
3059 (upstart_recv_msg): copy the process id from the wire.
3060 * init/control.c (control_handle): Fill in the pid from the job.
3061 * upstart/tests/test_control.c (test_messages): Check the pid gets
3062 passed across the wire properly.
3063
Scott James Remnant7d914312006-08-16 05:37:50 +01003064 * init/control.c (control_cb): Disable the poll for write once the
3065 send queue becomes empty.
3066
Scott James Remnant59707c22006-08-16 05:32:20 +01003067 * upstart/Makefile.am (libupstart_la_SOURCES): Correct ordering.
3068
Scott James Remnanta98c8b82006-08-16 05:32:02 +01003069 * init/control.c (control_handle): Add missing break.
3070
Scott James Remnantb5c7a302006-08-16 05:24:55 +01003071 * upstart/job.c (job_goal_name, process_state_name): For completeness
3072 add these two functions as well.
3073 * upstart/job.h: Update.
3074 * upstart/tests/test_job.c (test_goal_name)
3075 (test_process_state_name): Test the new functions.
3076
Scott James Remnant20b15ad2006-08-16 05:20:02 +01003077 * init/job.c (job_state_name): Move this utility function from here
3078 * upstart/job.c (job_state_name): to here so all clients can use
3079 it.
3080 * init/job.h: Update.
3081 * upstart/job.h: Update.
3082 * init/tests/test_job.c (test_state_name): Move the test case from here
3083 * upstart/tests/test_job.c: to here as well.
3084 * upstart/Makefile.am (libupstart_la_SOURCES): Build and link job.c
3085 (TESTS): Run the job test cases
3086 (test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for
3087 job test case binary.
3088 * init/Makefile.am (test_job_LDADD, test_process_LDADD)
3089 (test_event_LDADD): Link to libupstart.la
3090
Scott James Remnant7a5c6672006-08-16 05:01:13 +01003091 * init/control.c: Code to handle the server end of the control
3092 socket, a bit more complex than a client as we want to avoid
3093 blocking on malcious clients.
3094 * init/control.h: Prototypes.
3095 * init/tests/test_control.c: Test the control code.
3096 * init/Makefile.am (init_SOURCES): Build and link control.c
3097 using the control.h header
3098 (init_LDADD): Link to libupstart as well
3099 (TESTS): Build and run the control test suite.
3100 (test_control_SOURCES, test_control_LDFLAGS, test_control_LDADD):
3101 Details for control test suite binary.
3102
Scott James Remnantb7cbda52006-08-16 04:53:38 +01003103 * upstart/control.c: Add a way to disable the safety checks.
3104 * upstart/tests/test_control.c (test_free): Fix bad test case.
3105
Scott James Remnant71d4d842006-08-16 04:29:21 +01003106 * upstart/control.c (upstart_recv_msg): fixed bogus return type
3107 for recvmsg from size_t to ssize_t so we don't infiniloop on error.
3108
Scott James Remnant2bda3832006-08-16 03:41:10 +01003109 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Avoid
3110 job_start as the short-cut for assigning name, as that might become
3111 a more complex message eventually. Use job_query instead.
3112
Scott James Remnantd154b952006-08-16 03:39:35 +01003113 * upstart/control.c (upstart_free): Add wrapper function around
3114 nih_free so we're a proper library and don't expose libnih too much
3115 (upstart_recv_msg): Stash the sender pid in an argument.
3116 * upstart/control.h: Update.
3117 * upstart/tests/test_control.c (test_recv_msg): Test pid is
3118 returned properly.
3119 (test_free): Test the nih_free wrapper.
3120
Scott James Remnantdc0eb442006-08-16 02:40:29 +01003121 * init/job.c (job_run_script): Document future FIXME.
3122
Scott James Remnant2f558532006-08-16 02:24:55 +01003123 * init/exent.h, init/job.h, init/process.h: Fix up headers.
3124
Scott James Remnant45aab692006-08-16 02:23:27 +01003125 * upstart/control.c, upstart/control.h, upstart/errors.h,
3126 upstart/job.h, upstart/libupstart.h: Fix up headers.
3127
Scott James Remnant8c16cc82006-08-16 02:13:40 +01003128 * upstart/control.c: Write the code to handle the control socket
3129 and communication over it; turns out this was possible to write so
3130 that both ends are handled in the same code.
3131 * upstart/control.h: Structures and prototypes.
3132 * upstart/tests/test_control.c: Test the new code.
3133
Scott James Remnant729d9222006-08-16 02:12:23 +01003134 * upstart/Makefile.am (libupstart_la_LIBADD): Link to libnih
3135
Scott James Remnantb9814432006-08-16 02:11:51 +01003136 * upstart/errors.h: Header file containing errors raised by
3137 libupstart.
3138 * upstart/libupstart.h: Include errors.h
3139
Scott James Remnant342451a2006-08-15 00:08:20 +010031402006-08-15 Scott James Remnant <scott@netsplit.com>
3141
Scott James Remnant0a8e3472006-08-15 23:54:14 +01003142 * init/event.h: Add missing attribute for event_new()
3143
Scott James Remnant6f128872006-08-15 23:54:05 +01003144 * init/job.h (JobGoal, JobState, ProcessState, ConsoleType): Move
3145 the enums from here
3146 * upstart/job.h: into here so that we can use them across the
3147 control socket.
3148
Scott James Remnante5831792006-08-15 21:46:21 +01003149 * Makefile.am (SUBDIRS): Build the libupstart library
3150 * configure.ac (AC_CONFIG_FILES): Generate upstart/Makefile
3151 * upstart/Makefile.am: Makefile for sub-directory
3152 * upstart/libupstart.ver: Linker version script.
3153 * upstart/libupstart.h: "Include everything" header file.
3154
Scott James Remnant26a8eec2006-08-15 05:46:27 +01003155 * TODO: Update.
3156
Scott James Remnant1f8619c2006-08-15 05:45:38 +01003157 * init/job.c (job_handle_child): Warn when processes are killed
3158 or exit with an abnormal status. Warn when respawning.
3159
Scott James Remnanteb5ad272006-08-15 05:43:05 +01003160 * init/job.c (job_handle_child): Respawn processes that were not
3161 supposed to have died.
3162 * init/tests/test_job.c (test_handle_child): Test the respawn code.
3163
Scott James Remnant77c926d2006-08-15 05:22:08 +01003164 * TODO: Update.
3165
Scott James Remnant429cd672006-08-15 05:09:51 +01003166 * init/event.c (event_trigger_edge, event_trigger_level): Call
3167 job_handle_event so that we actually do something useful.
3168 * init/Makefile.am (test_event_LDADD): Link to process.o and job.o
3169 now that event.c calls code from job.
3170
Scott James Remnant355e1b62006-08-15 05:07:24 +01003171 * init/job.c (job_start_event): Function to start a job if an event
3172 matches.
3173 (job_stop_event): Function to stop a job if an event matches.
3174 (job_handle_event): Iterate the job list and dispatch the given event,
3175 causing jobs to be stopped or started using the above two functions.
3176 * init/job.h: Update.
3177 * init/tests/test_job.c: Test the new functions.
3178
Scott James Remnant923400d2006-08-15 04:27:44 +01003179 * init/job.c (job_new): Initialise start_events and stop_events to
3180 an empty list.
3181 * init/job.h (Job): Add start_events and stop_events list heads.
3182 * init/tests/test_job.c (test_new): Check the lists are initialised
3183 correctly to the empty list.
3184
Scott James Remnant865534f2006-08-15 04:22:06 +01003185 * init/event.c (event_match): Function to check events for equality.
3186 * init/event.h: Update.
3187 * init/tests/test_event.c (test_match): Test function.
3188
Scott James Remnant97137a72006-08-15 04:07:08 +01003189 * init/job.c (job_change_state): Trigger the level event with the
3190 same name as the job, with the value taken from the state.
3191 * init/tests/test_job.c (test_change_state): Check the event
3192 gets set to the right values as we go.
3193 * init/Makefile.am (test_job_LDADD, test_process_LDADD): Link to
3194 event.o now that job.c uses code from there.
3195
Scott James Remnant3b35a522006-08-15 04:01:32 +01003196 * init/event.c (event_change_value): Rename event_set_value to this
3197 as we intended in the first place; makes it more consistent with job.
3198 Always change the value.
3199 (event_trigger_edge): Add a high-level function to trigger an edge
3200 event.
3201 (event_trigger_level): And another to trigger a level event with
3202 a given value, this inherits the "don't change it" functionality
3203 that was in event_set_value.
3204 * init/event.h: Update.
3205 * init/tests/test_event.c: Test new behaviours and functions.
3206
Scott James Remnant4fef0732006-08-15 01:45:02 +01003207 * init/event.c: Add simple code to keep track of events, whether
3208 they have been recorded or not and their current value if any.
3209 * init/event.h: Structures and prototypes.
3210 * init/tests/test_event.c: Test cases for event code.
3211 * init/Makefile.am (init_SOURCES): Build and link event.c using event.h
3212 (TESTS): Run the event test suite.
3213 (test_event_SOURCES, test_event_LDFLAGS, test_event_LDADD): Details
3214 for event test suite binary.
3215
Scott James Remnant38fc8ff2006-08-15 00:43:26 +01003216 * init/job.c (job_run_process, job_kill_process, job_kill_timer):
3217 Downgrade error messages to warning as they're not fatal.
3218 (job_change_state): Change info message to be more regular.
3219
Scott James Remnantf033fb02006-08-15 00:37:33 +01003220 * init/job.c (job_start): A very simple, but very necessary, function.
3221 Set the goal of the given job to JOB_START and kick it off.
3222 (job_stop): And its companion, cause a running job to be stopped.
3223 * init/job.h: Update.
3224 * init/tests/test_job.c: Test the functions.
3225
Scott James Remnant342451a2006-08-15 00:08:20 +01003226 * init/job.c (job_handle_child): Child handler to kick jobs into
3227 the next state when their process dies.
3228 * init/job.h: Update.
3229 * init/tests/test_job.c (test_handle_child): Test the handler
3230 directly by just invoking it with various job states.
3231
Scott James Remnant1c463b92006-08-14 14:46:17 +010032322006-08-14 Scott James Remnant <scott@netsplit.com>
3233
Scott James Remnant51c827d2006-08-14 23:06:00 +01003234 * init/tests/test_process.c (test_kill): Use select rather than
3235 poll for consistency with other test cases.
3236
Scott James Remnante6e4a732006-08-14 23:04:53 +01003237 * init/job.c (job_kill_process): Add function to send the active
3238 process of a job the TERM signal, and then set a timer to follow
3239 up with the KILL signal if the job doesn't get cleaned up in time.
3240 (job_kill_timer): Timer callback to send the KILL signal; this
3241 does the same job as the child handler and puts the job into the
3242 next state as there's no point waiting around now.
3243 * init/job.h: Update.
3244 * init/tests/test_job.c (test_kill_process): Test both functions
3245 in one test case (as one is just the bottom half of the other).
3246
Scott James Remnant6868f652006-08-14 21:42:45 +01003247 * init/tests/test_process.c (test_spawn): Use the right thing in
3248 the test case filename and unlink it to make sure.
3249
Scott James Remnant85df9422006-08-14 21:41:39 +01003250 * init/job.c (job_change_state): Write the principal state gate
3251 function, called once a state has been left to enter the given new
3252 state (which one should determine with job_next_state). Spawns
3253 the necessary processes or moves to the next appropriate state.
3254 * init/job.h: Update.
3255 * init/tests/test_job.c: Test the state changes.
3256
Scott James Remnantba44b8b2006-08-14 20:06:28 +01003257 * init/job.c (job_run_process): Internal function to call
3258 process_spawn and update the job structure.
3259 (job_run_command): Simple(ish) wrapper for the above to split
3260 a command by whitespace, or use a shell if it needs more complex
3261 argument processing.
3262 (job_run_script): More complex wrapper that uses a shell to execute
3263 verbatim script, either using -c or a /dev/fd/NN and feeding the
3264 shell down a pipe to it.
3265 * init/job.h: Update.
3266 * init/tests/test_job.c: Test the new functions.
3267
Scott James Remnant156f5482006-08-14 19:09:55 +01003268 * init/Makefile.am (init_SOURCES, TESTS): Reorder so that process.c,
3269 which is arguably lower level, comes first.
3270 (test_job_LDADD): Link the process code.
3271 (test_process_LDADD): Swap the order.
3272
Scott James Remnant00bcc932006-08-14 19:07:28 +01003273 * TODO: Update.
3274
Scott James Remnant1c463b92006-08-14 14:46:17 +01003275 * init/process.c (process_spawn): Correct typo (progress -> process),
3276 thanks Johan.
3277
Scott James Remnant43534ca2006-08-12 14:52:01 +010032782006-08-12 Scott James Remnant <scott@netsplit.com>
3279
Scott James Remnant3030cc22006-08-12 15:18:55 +01003280 * init/process.c (process_spawn): Correct formatting of function.
3281 * init/process.h (SHELL): Define the location of the shell, all in
3282 the spirit of not hard-coding stuff like this.
3283
Scott James Remnant43534ca2006-08-12 14:52:01 +01003284 * init/job.c (job_new): Initialise all structure members to zero
3285 as this doesn't happen automatically.
3286
Scott James Remnant60b03e32006-08-10 00:59:00 +010032872006-08-10 Scott James Remnant <scott@netsplit.com>
3288
3289 * init/job.h (job_state_name): Declare as a const function.
3290
Scott James Remnant143a8572006-08-09 17:37:00 +010032912006-08-09 Scott James Remnant <scott@netsplit.com>
3292
Scott James Remnantd945d2e2006-08-09 23:47:44 +01003293 * init/job.c (job_next_state): State transition logic; this uses
3294 our departure from the specification (the goal) so that the state
3295 can always be currently accurate rather than suggestive.
3296 (job_state_name): Cute function to convert enum into a name.
3297 * init/job.h: Update.
3298 * init/tests/test_job.c (test_next_state): Test the transitions.
3299 (test_state_name): And the return values.
3300
Scott James Remnant5fa15672006-08-09 23:23:17 +01003301 * TODO: Add file to keep track of things.
3302
Scott James Remnantdbc78612006-08-09 23:22:45 +01003303 * init/job.c: Include nih/macros.h and nih/list.h
3304 * init/process.c: Include order fixing, include nih/macros.h
3305 * init/tests/test_job.c: Include nih/macros.h and nih/list.h
3306 * init/tests/test_process.c: Include nih/list.h
3307
Scott James Remnant03853ed2006-08-09 23:11:59 +01003308 * init/job.c: Include order fixing.
3309 (job_find_by_name): Function to find a job by its (unique) name.
3310 (job_find_by_pid): Function to find a job by the pid of its process.
3311 * init/job.h: Update.
3312 * init/tests/test_job.c (test_find_by_name, test_find_by_pid): Test
3313 new functions.
3314
Scott James Remnant143a8572006-08-09 17:37:00 +01003315 * init/process.c (process_spawn): Spawn a process using the job
3316 details to set up the environment, etc.
3317 (process_setup_console): Set up the console according to the job.
3318 (process_setup_limits): Set up the limits according to the job.
3319 (process_setup_environment): Set up the environment according to
3320 the job.
3321 (process_kill): Simple function to send a kill signal or raise an
3322 error; mostly just a wrapper without any particular logic.
3323 * init/process.h: Prototypes and macros.
3324 * init/tests/test_process.c: Test cases.
3325 * init/Makefile.am (init_SOURCES): Build and link process.c and
3326 its header file.
3327 (TESTS): Run the process test suite.
3328 (test_process_SOURCES, test_process_LDFLAGS, test_process_LDADD):
3329 Details for process test sutie binary.
3330
Scott James Remnant29abda02006-08-08 15:01:24 +010033312006-08-08 Scott James Remnant <scott@netsplit.com>
3332
Scott James Remnant31ee2632006-08-08 15:06:02 +01003333 * init/job.c (job_new): nih_list_free is necessary.
3334 * init/tests/test_job.c (test_new): Free job when done.
3335
Scott James Remnant29abda02006-08-08 15:01:24 +01003336 * init/job.h: Header file to contain the definition of the Job
3337 structure and associated typedefs, etc.
3338 (JobGoal): In a divergence from the specification, we introduced a
3339 "goal" for a job which tells us which way round the state machine
3340 we're going (towards start, or towards stop).
3341 (JobState): Which means this always holds the current state, even
3342 if we're trying to get out of this state (ie. if we've sent the TERM
3343 signal to the running process, we're still in the running state until
3344 it's actually been reaped).
3345 (ProcessState): And in another divergence, we keep the state of the
3346 process so we know whether we need to force a state transition or
3347 can just expect one because something transient is happening.
3348 * init/job.c (job_new): Function to allocate a Job structure, set
3349 the pointers to NULL and other important members to sensible
3350 defaults.
3351 (job_init): Initialise the list of jobs.
3352 * init/tests/test_job.c: Test suite.
3353 * init/Makefile.am (init_SOURCES): Compile and link job.c using
3354 its header file.
3355 (TESTS): Run the job test suite.
3356 (test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for the
3357 job test suite binary.
3358
Scott James Remnantb933bc92006-08-02 02:29:25 +010033592006-08-02 Scott James Remnant <scott@netsplit.com>
3360
Scott James Remnant6c7667a2006-08-02 02:43:12 +01003361 * configure.ac: Check for C99
3362
Scott James Remnantb933bc92006-08-02 02:29:25 +01003363 * HACKING: Document dependency on libnih.
3364
Scott James Remnanta780d6c2006-07-27 18:40:51 +010033652006-07-27 Scott James Remnant <scott@netsplit.com>
3366
3367 * init/Makefile.am (DEFS): Append to the default DEFS list, rather
3368 than overriding, otherwise we lose HAVE_CONFIG_H
3369
Scott James Remnantb6270dd2006-07-13 02:16:38 +010033702006-07-13 Scott James Remnant <scott@netsplit.com>
3371
Scott James Remnant1bb35142006-07-13 02:30:58 +01003372 * HACKING: Correct incorrect Bazaar URL.
3373
Scott James Remnantb6270dd2006-07-13 02:16:38 +01003374 * AUTHORS: Change e-mail address to ubuntu.com.
3375 * HACKING: Update Bazaar and Release URLS.
3376 * configure.ac (AC_COPYRIGHT): Change copyright to Canonical Ltd.
3377 (AC_INIT): Change bug submission address to Launchpad.
3378 * init/main.c: Update header to use Canonical copyright and
3379 credit me as author.
3380
Scott James Remnant50748842006-05-16 21:02:31 +010033812006-05-16 Scott James Remnant <scott@netsplit.com>
3382
3383 * init/main.c: Add the simplest template main.c
3384 * init/Makefile.am: Add template Makefile.am that builds init from
3385 main.c and links to libnih statically
3386 * configure.ac (AC_CONFIG_FILES): Configure nih and init subdirs.
3387 * Makefile.am (SUBDIRS): Recurse into nih and init subdirs.
3388
Scott James Remnant8a0cd072006-05-14 18:28:58 +010033892006-05-14 Scott James Remnant <scott@netsplit.com>
3390
3391 * ChangeLog: Initial project infrastructure created.