blob: 2ca4bc3218b6af8a8e07215554f66d75e85a4750 [file] [log] [blame]
Scott James Remnant9c44a422007-02-03 12:17:14 +000012007-02-03 Scott James Remnant <scott@netsplit.com>
2
Scott James Remnant3af85462007-02-03 18:31:54 +00003 * init/tests/test_control.c (test_open): Fix valgrind error
4 * init/tests/test_notify.c (test_subscribe): Fix valgrind error
5
Scott James Remnante443b9c2007-02-03 18:24:18 +00006 * init/notify.c (notify_subscribe): Make safe against ENOMEM.
7 * init/tests/test_notify.c (test_subscribe): Use TEST_ALLOC_FAIL
8
Scott James Remnant4b601d12007-02-03 18:20:00 +00009 * init/control.c: Add needed attributes; tidy up formatting.
10 (control_open): Don't let ENOMEM fail opening the control socket.
11 * init/control.h: Add needed attributes.
12 * init/tests/test_control.c (test_open): Test for failed allocation.
13 * init/main.c (term_handler): Make sure we catch failure to open
14 the control socket again.
15
Scott James Remnantd308b432007-02-03 17:36:41 +000016 * TODO: Update
17
Scott James Remnant272938f2007-02-03 17:35:11 +000018 * init/cfgfile.c (cfg_watch_dir): Clean this up a bit; now we only
19 output a warning if inotify failed for any reason other than not
20 being supported AND walking worked.
21
Scott James Remnantd78d00e2007-02-03 17:27:32 +000022 * init/cfgfile.c (cfg_watch_dir): Update to even newer watch API;
23 our create_handler is now always called if inotify is successful,
24 so we just need to fall back to walking the directory when it
25 isn't -- if inotify isn't supported, don't even bother complaining.
26 (cfg_create_modify_handler): Check the stat of the file visited to
27 make sure it's a regular file.
28 (cfg_visitor): Check the stat of the file visited to make sure it's
29 a regular file.
30
Scott James Remnantbcbb1122007-02-03 17:11:21 +000031 * init/cfgfile.c: Update include to upstart/enum.h
32 * init/job.c: Update include to upstart/enum.h
33 * init/job.h: Update include to upstart/enum.h
34
Scott James Remnant801f9e12007-02-03 17:10:06 +000035 * logd/main.c: Add attribute to open_logging
36
Scott James Remnantcbd0cf82007-02-03 17:05:39 +000037 * util/initctl.c: Split out the command functions into new files;
38 * util/jobs.c: This gets the job-related commands
39 * util/events.h: This gets the event-related commands
40 * util/initctl.h, util/jobs.h, util/events.h: Headers
41 * util/tests/test_jobs.c: Test suite for job-related commands.
42 * util/tests/test_events.c: Test suite for event-related commands.
43 * util/Makefile.am (initctl_SOURCES): Add new files.
44 (TESTS): Build new test suites.
45 (test_jobs_SOURCES, test_jobs_LDFLAGS, test_jobs_LDADD):
46 Details for job-related commands test suite binary.
47 (test_events_SOURCES, test_events_LDFLAGS, test_events_LDADD):
48 Details for event-related commands test suite binary.
49 * TODO: Remove item about splitting initctl now we've done it.
50
Scott James Remnantadfcc3f2007-02-03 12:24:07 +000051 * TODO: Big update; strip anything we have a spec for.
52
Scott James Remnant1157bbf2007-02-03 12:17:55 +000053 * upstart/message.c (upstart_message_handle): Make sure that if we
54 fail to parse a message, we don't leave strings around in memory.
55 * upstart/tests/test_message.c (test_open): Check that we get a
56 raised EADDRINUSE if we try an open a socket twice.
57 (test_handle): Add lots of checks for things like NULL names and
58 incomplete messages; as well as the obvious unknown message.
59 (test_reader): Make sure that errors while handling messages are
60 dealt with by logging it.
61
Scott James Remnant9c44a422007-02-03 12:17:14 +000062 * upstart/job.c, upstart/job.h, upstart/tests/test_job.c: Rename to
63 enum.c, enum.h and tests/test_enum.c; since this just includes enums
64 and convert functions really.
65 * upstart/Makefile.am: Update.
66 * upstart/libupstart.h: Update include.
67 * upstart/tests/test_message.c: Update include.
68
Scott James Remnant1e57ab22007-02-01 16:51:28 +0000692007-02-01 Scott James Remnant <scott@netsplit.com>
70
Scott James Remnant0f1d9b62007-02-01 18:20:00 +000071 * logd/main.c (main): Ensure we error if daemonise fails.
72
Scott James Remnant36911572007-02-01 18:18:27 +000073 * compat/sysv/shutdown.c (main): Ensure that signals and timers
74 are added, even if we run out of memory.
75
Scott James Remnant9b705ee2007-02-01 17:34:39 +000076 * upstart/tests/test_message.c: Change from assert to assert0
77 * upstart/tests/test_wire.c: Change from assert to assert0
78 * init/tests/test_notify.c: Change from assert to assert0
79 * init/tests/test_control.c: nih_io_message_send should always return
80 a value greater than zero.
81
Scott James Remnant91c6eb72007-02-01 17:19:32 +000082 * upstart/tests/test_wire.c: Change to use assert instead of NIH_ZERO;
83 the rationale here is that in test cases we just want to fail, not
84 try again repeatedly.
85 * upstart/tests/test_message.c: Likewise.
86
Scott James Remnant9caf2822007-02-01 17:04:34 +000087 * init/tests/test_control.c: Use assert to ensure we get the expected
88 return values of functions that raise errors.
89 * init/tests/test_notify.c: Use assert to ensure we get the expected
90 return values of functions that raise errors.
91
Scott James Remnant1e57ab22007-02-01 16:51:28 +000092 * init/cfgfile.c (cfg_watch_dir): Port to the new NihWatch API and
93 use nih_dir_walk(). This also fixes the long-standing bug where we
94 wouldn't watch the configuration directory if inotify was disabled.
95 Drop both the parent and prefix members for now, until we clean this
96 up later.
97 (cfg_create_modify_handler): Wrap cfg_read_job after figuring out
98 the job name.
99 (cfg_job_name): Function to figure out the job name from a path.
100 (cfg_visitor): Visitor function to handle initial parsing, figuring
101 out the job name; otherwise identical to the standard handler.
102 * init/cfgfile.h: Update prototype for cfg_watch_dir.
103 * init/main.c (main): Update call to cfg_watch_dir.
104
Scott James Remnantbfd712d2007-01-31 12:13:25 +00001052007-01-31 Scott James Remnant <scott@netsplit.com>
106
107 * upstart/tests/test_message.c: Use TEST_ALLOC_FAIL to make sure
108 allocations are handled properly.
109
Scott James Remnant44828472007-01-30 11:53:33 +00001102007-01-30 Scott James Remnant <scott@netsplit.com>
111
Scott James Remnant2cc36542007-01-30 17:12:34 +0000112 * upstart/wire.c: Note that if any of the push functions fail, the
113 entire buffer should be discarded.
114 * upstart/tests/test_wire.c (test_push_int, test_push_unsigned)
115 (test_push_string, test_push_header, test_push_pack): Us
116 TEST_ALLOC_FAIL to ensure that failing to allocate memory is caught.
117
Scott James Remnant1084c682007-01-30 15:17:41 +0000118 * upstart/tests/test_message.c (my_handler): Free the name and
119 description after checking; they aren't otherwise.
120
Scott James Remnantdc8b3292007-01-30 15:01:30 +0000121 * upstart/wire.c (upstart_push_packv, upstart_pop_packv): Consume
122 a copy of the va_list, so these can be called multiple times on the
123 same list without ill effect.
124
Scott James Remnant92d87442007-01-30 15:01:21 +0000125 * upstart/message.h: Add warn_unused_result attributes to
126 upstart_message_handle and upstart_message_handle_using as they raise
127 errors.
128
Scott James Remnant2de25012007-01-30 14:57:27 +0000129 * upstart/wire.c: push functions return negative values to indicate
130 insufficient memory.
131 * upstart/wire.h: Add warn_unused_result attributes to push functions
132
Scott James Remnant4ccebcf2007-01-30 14:51:17 +0000133 * upstart/tests/test_message.c: Guard calls to nih_io_buffer_push and
134 nih_io_message_add_control with NIH_ZERO to ensure they succeed.
135 * upstart/tests/test_wire.c: Guard calls to nih_io_buffer_push
136
Scott James Remnant44828472007-01-30 11:53:33 +0000137 * HACKING: Update from libnih with new Documentation,
138 Function Attributes and Test Cases sections.
139
Scott James Remnant16a286f2007-01-10 15:38:33 +00001402007-01-10 Scott James Remnant <scott@netsplit.com>
141
Scott James Remnantde443012007-01-10 18:45:40 +0000142 * init/main.c (crash_handler): s/SEGV/SIGSEGV/
143
Scott James Remnant505f9282007-01-10 18:44:38 +0000144 * init/main.c (main): Rename variable
145
Scott James Remnant56a4d062007-01-10 17:33:39 +0000146 * TODO: Update.
147
Scott James Remnant78626fb2007-01-10 16:48:10 +0000148 * init/main.c (main): Change the way we clear the arguments; by
149 deleting just the final NULL terminator, we fool the kernel into
150 only returning one argument in cmdline.
151
Scott James Remnant16a286f2007-01-10 15:38:33 +0000152 * init/main.c (segv_handler): Rename to crash_handler and handle
153 SIGABRT as well, so we can catch assertion errors. Of course, in
154 theory, with our high test converage this should never happen in
155 practice <chortle>
156
Scott James Remnant39ec35b2007-01-09 08:16:01 +00001572007-01-09 Scott James Remnant <scott@netsplit.com>
158
Scott James Remnant7f4db422007-01-09 20:51:08 +0000159 * init/main.c (main): Clear arguments so that upstart only ever
160 appears as /sbin/init in ps, top, etc.
161
Scott James Remnant8fd06de2007-01-09 20:38:27 +0000162 * TODO: Update.
163
Scott James Remnant4d0481d2007-01-09 20:38:07 +0000164 * util/initctl.c: Add data pointer to functions and handle calls.
165
Scott James Remnantbcf9e972007-01-09 20:34:47 +0000166 * init/control.c: Add data pointer to all functions.
167 * init/tests/test_control.c: Pass data pointer to
168 upstart_message_handle_using()
169 * init/tests/test_notify.c: Pass data pointer to
170 upstart_message_handle_using()
171
Scott James Remnant6aa008c2007-01-09 20:26:44 +0000172 * upstart/message.c (upstart_message_handle)
173 (upstart_message_handle_using): Add a data pointer argument to these
174 functions and pass it to the handler.
175 (upstart_message_reader): Pass the io structure's data pointer.
176 * upstart/message.h (UpstartMessageHandler): Add a data pointer to
177 the message handler.
178 * upstart/tests/test_message.c (test_handle, test_handle_using):
179 Pass a data pointer to the function call and check it's passed
180 to the handler correctly.
181 (test_reader): Check that the io data pointer gets passed.
182
Scott James Remnantc7017d32007-01-09 18:44:58 +0000183 * init/tests/test_cfgfile.c (test_stanza_console, test_stanza_env)
184 (test_stanza_umask, test_stanza_nice, test_stanza_limit): Finish off
185 the newer style test cases.
186
Scott James Remnante63ef802007-01-09 17:54:56 +0000187 * init/cfgfile.c (cfg_stanza_console, cfg_stanza_umask)
188 (cfg_stanza_nice, cfg_stanza_limit, cfg_stanza_chroot)
189 (cfg_stanza_chdir): Guard against duplicate uses of the stanzas.
190 * init/tests/test_cfgfile.c (test_stanza_daemon)
191 (test_stanza_respawn): Check that neither daemon or respawn override
192 exec if they have no arguments.
193 (test_stanza_script): Add missing function
194 (test_stanza_chroot, test_stanza_chdir): Add tests for these simple
195 stanzas.
196
Scott James Remnant0cd393d2007-01-09 17:36:34 +0000197 * init/cfgfile.c: Change remaining uses of nih_error_raise and
198 return to just nih_return_error.
199
Scott James Remnantc352b632007-01-09 17:31:41 +0000200 * init/cfgfile.c (cfg_stanza_exec, cfg_stanza_daemon)
201 (cfg_stanza_respawn, cfg_stanza_script): Disallow duplicates,
202 both of command strings, scripts, limits and of just the flags.
203 * init/tests/test_cfgfile.c (test_stanza_exec)
204 (test_stanza_daemon, test_stanza_respawn, test_stanza_instance):
205 Check the behaviour of these stanzas.
206
Scott James Remnant94188d42007-01-09 16:43:58 +0000207 * init/cfgfile.c (cfg_stanza_start, cfg_stanza_stop): Disallow
208 duplicate values for the script.
209 * init/tests/test_cfgfile.c (test_stanza_start, test_stanza_stop):
210 Test cases for those two functions.
211
Scott James Remnant474a6ff2007-01-09 16:17:49 +0000212 * init/cfgfile.c (cfg_stanza_description, cfg_stanza_author)
213 (cfg_stanza_version): Don't allow stanza to be duplicated anymore.
214 * init/tests/test_cfgfile.c (test_stanza_description)
215 (test_stanza_author, test_stanza_version): Test cases for these
216 simple stanza; making sure duplication is not permitted.
217 (test_stanza_on): Add a test case for this stanza too.
218
Scott James Remnant49e8bb82007-01-09 15:57:59 +0000219 * init/cfgfile.c (cfg_stanza_kill): Guard against duplicate uses
220 of the kill timeout stanza.
221 * init/tests/test_cfgfile.c (test_stanza_kill): Test the complex
222 kill stanza.
223 (test_stanza_pid): Check duplicate usage results in an error.
224
Scott James Remnant443ef2e2007-01-09 15:47:24 +0000225 * init/job.h (Job): Rename pidfile to pid_file and binary to pid_binary
226 * init/job.c (job_new): Update names here too.
227 * init/errors.h: Add a new "duplicate value" error.
228 * init/cfgfile.c (cfg_read_job): Change name of variables, and catch
229 the duplicate value error to add the line number.
230 (cfg_stanza_pid): Change variable names, and clean this function up
231 a little. Make it an error to use a stanza more than once.
232 * init/tests/test_cfgfile.c (test_stanza_pid): Write a newer test
233 case function for the pid stanza.
234
Scott James Remnant34ff87d2007-01-09 09:00:30 +0000235 * init/cfgfile.c (cfg_stanza_normalexit): Use do/while instead of
236 while, that we don't have to test has_token first as next_arg does
237 that for us.
238
Scott James Remnanta7354692007-01-09 08:56:02 +0000239 * init/cfgfile.c (cfg_stanza_normalexit): Change to peek at the next
240 token to see whether it's missing or not, and then just fetch each
241 next argument at a time. This is more efficient than parsing them
242 all in one go, and also means we can report the error in the right
243 place!
244 * init/tests/test_cfgfile.c (test_stanza_normalexit): Since we've
245 changed the function that parses the stanza, add a proper test case
246 function for it, covering all the behaviours.
247
Scott James Remnant92e7fda2007-01-09 08:40:13 +0000248 * init/job.c (job_new): Initialise the emits member to an empty list.
249 * init/job.h (Job): Add the emits member as a list.
250 * init/tests/test_job.c (test_new): Check the emits list starts off
251 empty.
252 * init/tests/test_cfgfile.c (test_stanza_emits): Test the new emits
253 stanza; this function will also serve as a prototype for cleaning up
254 the config tests.
255
256 * init/cfgfile.c (cfg_stanza_emits): Add function to parse the new
257 emits stanza.
258
Scott James Remnant39ec35b2007-01-09 08:16:01 +0000259 * init/cfgfile.c (cfg_stanza_depends): Remove the depends stanza
260 from the configuration file. Dependency support has never been used,
261 and is to be replaced by a more flexible event/state configuration
262 and blocking on the starting/stopping events.
263 * init/tests/test_cfgfile.c: Remove references and tests for the
264 depends stanza.
265 * init/job.h: Remove the depends list from the job structure.
266 * init/job.c (job_new): No depends list to initialise.
267 (job_change_state): No dependencies to release
268 (job_start): No dependencies to iterate; this removes a particularly
269 hairy and complex interaction between state changes. Remove the
270 dependency event.
271 (job_release_depends): Drop this function.
272 * init/tests/test_job.c (test_start, test_stop): Massively simplify
273 these tests cases now we don't have dependencies to worry about.
274 (test_release_depends): Drop tests
275
Scott James Remnantd4f5fb82007-01-08 23:25:23 +00002762007-01-08 Scott James Remnant <scott@netsplit.com>
277
278 * init/cfgfile.c: Rewrite using the nih_config API, rather than one
279 huge function we now just have seperate handler functions for each
280 stanza. We can also use more fine-grained parsing than slurping
281 all args in and counting them.
282 (cfg_read_job): Catch exceptions from the configuration parser and
283 add the line number where the problem occurred to an output message.
284 Parser errors are now fatal, and not ignored.
285 * init/errors.h: Add a file containing errors raised within the init
286 daemon codebase.
287 * init/Makefile.am (init_SOURCES): Build with errors.h
288 * init/tests/test_cfgfile.c: Update test cases now we don't expect
289 a job to be returned if there's a parser error.
290
291 * TODO: Update
292
Scott James Remnant66384202007-01-06 14:23:18 +00002932007-01-06 Scott James Remnant <scott@netsplit.com>
294
Scott James Remnant4f968192007-01-06 20:31:13 +0000295 * logd/main.c (logging_reader): Fix inadvertent shadowing of the
296 len parameter.
297
Scott James Remnantda100272007-01-06 20:24:18 +0000298 * compat/sysv/telinit.c: Oops, nearly forgot to port this to send
299 the messages in the new way.
300 * compat/sysv/shutdown.c (shutdown_now): Likewise, port this too.
301
Scott James Remnant83a86522007-01-06 19:55:38 +0000302 * TODO: Update.
303
Scott James Remnant6e941882007-01-06 14:38:57 +0000304 * util/initctl.c (handle_job_status): Output the process argument,
305 not the pid argument which contains the origin of the message.
306
Scott James Remnant17d6dca2007-01-06 14:33:30 +0000307 * upstart/message.c (upstart_message_handle): Raise a new unknown
308 message error if we don't have a handler and a new illegal message
309 error if the source is illegal.
310 * upstart/tests/test_message.c (test_handle): Adjust tests to check
311 for the new errors that we raise.
312 * upstart/errors.h: Define strings for new errors.
313
Scott James Remnant66384202007-01-06 14:23:18 +0000314 * util/initctl.c: Yet another makeover for this little program,
315 port it to the new message/control framework using handler functions
316 and NihIoMessage. This starts to make each action function look
317 very similar, so there's method to this madness.
318
Scott James Remnantb4725d92007-01-05 13:10:21 +00003192007-01-05 Scott James Remnant <scott@netsplit.com>
320
Scott James Remnant3d6bb792007-01-05 22:33:43 +0000321 * logd/main.c (main): Make sure that we add the SIGTERM handler.
322
Scott James Remnantefbaafb2007-01-05 18:12:15 +0000323 * init/tests/test_job.c (test_run_script): This test case relies
324 on there only being one file descriptor watch, which won't be true
325 if the control socket has been opened because there's a message to
326 go out. Make sure it's closed first.
327
Scott James Remnantbe1941f2007-01-05 17:57:59 +0000328 * init/init.supp: Update supressions file now that control_init
329 has been renamed to notify_init
330
Scott James Remnant71cc4d82007-01-05 17:53:32 +0000331 * init/Makefile.am: Include notify.o from all tests.
332 * init/job.c (job_change_state, job_kill_process, job_start)
333 (job_stop): Use the new notify_job function name.
334 * init/event.c (event_queue_run): Use the new notify_event function
335 name.
336
Scott James Remnantfea6cb62007-01-05 17:49:13 +0000337 * init/control.c (control_error_handler): Handle ECONNREFUSED now
338 that the process id is available to us.
339 * init/tests/test_control.c (test_error_handler): Make sure children
340 going away is handled properly.
341
Scott James Remnant3dfb2132007-01-05 17:44:48 +0000342 * upstart/message.c (upstart_message_new): Store the process id in
343 the int_data message field.
344 * upstart/tests/test_message.c (test_new): Check the int_data field
345 is filled in.
346
Scott James Remnant5d702952007-01-05 17:21:34 +0000347 * init/main.c (main): Guard against various things returning an error
348 that we weren't catching.
349
Scott James Remnant601a0e32007-01-05 17:06:31 +0000350 * init/tests/test_notify.c: Whitespace fix.
351
Scott James Remnant15cd0862007-01-05 17:06:20 +0000352 * init/control.c (control_watch_jobs, control_unwatch_jobs)
353 (control_watch_events, control_unwatch_events): Restore functionality
354 to subscribe and unsubscribe from job and event notifications.
355 * init/tests/test_control.c (test_watch_jobs, test_unwatch_jobs)
356 (test_watch_events, test_unwatch_events): Check that the subscription
357 and unsubscription messages work.
358 * init/Makefile.am (test_control_LDADD): Link to notify.o
359
360 * init/control.c: Drop unused include of upstart/errors.h
361
Scott James Remnant58cef572007-01-05 16:18:42 +0000362 * init/notify.c: Move functions that handle subscription and
363 notification from control.c. Other than changing the names, we're
364 keeping the API the same for now; expect it to change later when we
365 add the ability to subscribe to individual jobs or events.
366 (notify_init): initialise the subscriptions list; we don't have a
367 separate send queue now that the control I/O is always asynchronous.
368 * init/notify.h: Moved notification enum, structure and prototypes
369 from control.h, changing the names so they match notify_* in the
370 process.
371 * init/Makefile.am (init_SOURCES): Build and link notify.c using
372 notify.h
373 (TESTS): Build the notify test suite binary.
374 (test_notify_SOURCES, test_notify_LDFLAGS, test_notify_LDADD): Details
375 for notify test suite binary.
376 * init/tests/test_notify.c: Rewrite test cases in the manner of
377 test_control.c so that we have one function for notify_job and
378 one for notify_event, each of which contains the child process that
379 receives the notification,
380
Scott James Remnantb1679c62007-01-05 15:49:54 +0000381 * init/control.c (control_open): Allow this to be called to obtain
382 the control socket, which means we can make it static.
383 * init/tests/test_control.c (test_open): Check that it works.
384
Scott James Remnantf7c6b062007-01-05 15:33:33 +0000385 * init/control.c, init/control.h, init/tests/test_control.c: Move
386 functions that handle subscription and notification to new notify.c
387 (control_init): Drop completely, no need to maintain a send queue now
388 (control_open): Change to return an NihIo that uses the default
389 control watcher, and our error handler. Split socket opening into
390 (control_open_sock): which can be called from other functions.
391 (control_close): Use nih_io_close() to close the socket and free the
392 structure in one go.
393 (control_reopen): Close the open control socket and open it again
394 without destroying the NihIo structure, its queues or state.
395 (control_close_handler): Handle the control socket going away
396 (control_error_handler): Handle errors on the control socket,
397 including the connection refused error that indicates a client went
398 away.
399 (control_handle): Split this into a miriad of small functions with
400 a table to link them to the message type; this will make expanding
401 each message handler much easier in future.
402 * init/control.h: Update.
403 * init/tests/test_control.c: Rewrite test cases to check the new
404 handler functions; as a side-effect, this gets rid of the evil giant
405 child/parent functions in favour of one test function per handler
406 function.
407
Scott James Remnantb4725d92007-01-05 13:10:21 +0000408 * upstart/message.c (upstart_message_handle_using): Wrapper function
409 around upstart_message_handle that ensures all messages as passed to
410 a single function.
411 * upstart/message.h: Update.
412 * upstart/tests/test_message.c (test_handle_using): Make sure it
413 calls the single function.
414
Scott James Remnantde3666f2007-01-04 23:00:07 +00004152007-01-04 Scott James Remnant <scott@netsplit.com>
416
417 * upstart/message.c (upstart_message_reader): Handle any errors
418 that occurred while handling the message.
419
Scott James Remnant92feed92007-01-02 15:27:47 +00004202007-01-02 Scott James Remnant <scott@netsplit.com>
421
Scott James Remnant7833bbf2007-01-02 20:57:23 +0000422 * upstart/message.c (upstart_message_handle): Check that the name
423 argument is never NULL.
424 (upstart_message_reader): Simple message reader function that can
425 be associated with an I/O watch and handles each message received.
426 * upstart/message.h: Add prototype.
427 * upstart/tests/test_message.c (test_reader): Test the reader function.
428
Scott James Remnant0e3b5fe2007-01-02 18:39:03 +0000429 * upstart/control.c: Rename to upstart/message.c
430 * upstart/control.h: Rename to upstart/message.h
431 * upstart/tests/test_control.c: Rename to upstart/tests/test_message.c
432 * upstart/libupstart.h: Update includes.
433 * upstart/wire.c: Include message.h
434 * upstart/wire.h: Update includes.
435 * upstart/tests/test_wire.c: Update includes.
436 * upstart/errors.h: Rename UPSTART_INVALID_MESSAGE to
437 UPSTART_MESSAGE_INVALID so that it's prefixed.
438 * upstart/Makefile.am (libupstart_la_SOURCES)
439 (upstartinclude_HEADERS, TESTS): Update filenames.
440
Scott James Remnant2ad9a042007-01-02 18:29:49 +0000441 * upstart/control.c (upstart_message_new): New function that
442 creates an NihIoMessage directly from its arguments, which are a type
443 followed by a variable number of args depending on that type.
444 (upstart_message_handler): Function to find a handler function for
445 a particular message type and origin process.
446 (upstart_message_handle): New function that takes an NihIoMessage
447 and invokes a handler function with a variable number of args
448 depending on the message type.
449 (upstart_send_msg, upstart_send_msg_to, upstart_recv_msg): Drop these
450 functions, leave it up to the caller to decide whether to send and
451 receive the messages synchronously or asynchronously; now that the
452 capability is in nih_io_*.
453 * upstart/control.h (UpstartMsgType): Rename to UpstartMessageType.
454 (UpstartMessageHandler): Function with variable number of arguments
455 that handles a message received.
456 (UpstartMsg): Drop this structure entirely, we'll encode or decode
457 the wire format directly from or into a function call, rather than
458 use an intermediate structure to marshal it.
459 (UpstartMessage): New structure to make a table that can be passed
460 to upstart_message_handle to determine which handler should be called.
461 * upstart/tests/test_control.c: Test new behaviour.
462 * upstart/wire.c (upstart_push_header, upstart_pop_header): Change
463 structure name for type parameter.
464 * upstart/wire.h: Update.
465 * upstart/tests/test_wire.c: Update.
466
Scott James Remnant92feed92007-01-02 15:27:47 +0000467 * configure.ac (AC_COPYRIGHT): Update copyright to 2007.
468
Scott James Remnant67546d12006-12-29 13:08:32 +00004692006-12-29 Scott James Remnant <scott@netsplit.com>
470
471 * upstart/wire.c (upstart_write_int, upstart_write_unsigned)
472 (upstart_write_string, upstart_write_header, upstart_write_packv)
473 (upstart_write_pack): Rename to *_push_*
474 (upstart_read_int, upstart_read_unsigned, upstart_read_string)
475 (upstart_read_header, upstart_read_packv, upstart_read_pack): Rename
476 to *_pop_*.
477 All of the above modified to modify an NihIoMessage structure,
478 instead of trying to carry around buffers ourself.
479 * upstart/wire.h: Update to match above.
480 * upstart/tests/test_wire.c: Update all tests to match the above
481 changes.
482
Scott James Remnantd76e8e32006-12-21 18:34:31 +00004832006-12-21 Scott James Remnant <scott@netsplit.com>
484
Scott James Remnantf922a982006-12-21 18:45:30 +0000485 * upstart/wire.c (upstart_read_packv, upstart_write_packv): Change
486 nih_assert_notreached to nih_assert_not_reached.
487
Scott James Remnantd76e8e32006-12-21 18:34:31 +0000488 * init/job.c (job_run_script): Open the NihIo structure in stream mode.
489 * logd/main.c (logging_watcher): Open the NihIo structure in
490 stream mode.
491 (logging_reader): Need to pass the length of the size_t as a pointer
492 so that it can be modified if less is read.
493
Scott James Remnanta0385232006-12-17 15:21:39 +00004942006-12-17 Scott James Remnant <scott@netsplit.com>
495
Scott James Remnant00cc6882006-12-17 19:54:36 +0000496 * upstart/wire.c (upstart_write_packv, upstart_write_pack)
497 (upstart_read_packv, upstart_read_pack): Functions to write a pack
498 of different variables to the stream, or read them from it
499 * upstart/wire.h: Add prototypes.
500 * upstart/tests/test_wire.c (test_write_pack, test_read_pack):
501 Check we can read and write a pack of variables at once.
502
Scott James Remnant518e1c12006-12-17 18:12:14 +0000503 * upstart/wire.c (upstart_write_header, upstart_read_header): Drop
504 the version from the header, we'll just keep the protocol always
505 backwards compatible.
506 * upstart/wire.h: Update.
507 * upstart/tests/test_wire.c (test_write_header, test_read_header):
508 Check that everything works.
509
Scott James Remnant64e378f2006-12-17 17:24:44 +0000510 * upstart/wire.c (upstart_write_string, upstart_read_string):
511 Transmit the length as an unsigned, and use 0xffffffff to mean NULL
512 instead of zero so we can still transmit the empty string.
513 * upstart/wire.h: Update.
514 * upstart/tests/test_wire.c (test_write_string, test_read_string):
515 Tests for the functions to make sure the wire is at it should be.
516
Scott James Remnantd6dde952006-12-17 17:00:56 +0000517 * upstart/wire.c (upstart_read_str, upstart_write_str): Rename to
518 upstart_read_string and upstart_write_string.
519 * upstart/wire.h: Update.
520
Scott James Remnantc71ab3b2006-12-17 16:58:28 +0000521 * upstart/wire.c (upstart_write_unsigned, upstart_read_unsigned):
522 Functions to send unsigned values over the wire, which we'll use
523 to get a bit extra for the string lengths.
524 * upstart/wire.h: Update.
525 * upstart/tests/test_wire.c (test_write_unsigned)
526 (test_read_unsigned): Test the new functions.
527
Scott James Remnant0218e3a2006-12-17 16:39:33 +0000528 * upstart/wire.c (upstart_write_ints, upstart_read_ints): Drop
529 these functions, we'll go with something far more generic and
530 useful.
531 * upstart/wire.h: Remove prototypes.
532
Scott James Remnant9ee44302006-12-17 16:37:59 +0000533 * upstart/wire.c (upstart_write_int, upstart_read_int): Transmit
534 integers as signed 32-bit values in network byte order.
535 * upstart/tests/test_wire.c (test_write_int, test_read_int): Test
536 the functions to make sure the wire is at it should be,
537
Scott James Remnant5cef53e2006-12-17 15:41:13 +0000538 * upstart/control.c (upstart_read_int, upstart_write_int)
539 (upstart_read_ints, upstart_write_ints, upstart_read_str)
540 (upstart_write_str, upstart_read_header, upstart_write_header): Move
541 functions to new wire.c file.
542 * upstart/wire.c: Source file to hold wire protocol functions.
543 * upstart/wire.h: Prototypes.
544 * upstart/tests/test_wire.c: (empty) test suite.
545 * upstart/libupstart.h: Include wire.h
546 * upstart/Makefile.am (libupstart_la_SOURCES): Build and link wire.c
547 (upstartinclude_HEADERS): Install wire.h
548 (TESTS): Build and run wire test suite.
549 (test_wire_SOURCES, test_wire_LDFLAGS, test_wire_LDADD): Details for
550 wire test suite binary.
551
Scott James Remnanta0385232006-12-17 15:21:39 +0000552 * upstart/control.c (MAGIC): Change to "upstart\n", the final
553 character was originally \0 and then was a " " for the 0.2 series.
554 * upstart/tests/test_control.c (test_recv_msg): Change to match.
555
Scott James Remnantfb9412a2006-12-15 18:03:22 +00005562006-12-15 Scott James Remnant <scott@netsplit.com>
557
Scott James Remnant2e5fe2b2006-12-15 18:27:58 +0000558 * util/initctl.c, compat/sysv/telinit.c, compat/sysv/shutdown.c:
559 Update all uses of the UpstartMsg structure to avoid the
560 intermediate union that no longer exists.
561
Scott James Remnantfb521462006-12-15 18:24:57 +0000562 * init/control.c, init/tests/test_control.c: Update all uses of
563 the UpstartMsg structure to avoid the intermediate union that no
564 longer exists.
565
Scott James Remnant99b97662006-12-15 18:15:22 +0000566 * upstart/control.h: Combine all the previous message structures
567 into just one that has all of the fields anyway.
568 * upstart/control.c, upstart/tests/test_control.c: Update all uses of
569 the UpstartMsg structure to avoid the intermediate union that no
570 longer exists.
571
Scott James Remnantd452ab12006-12-15 18:05:23 +0000572 * upstart/control.h (UPSTART_API_VERSION): Define API version macro
573 to be public.
574 * upstart/control.c (MSG_VERSION, upstart_send_msg_to): Replacing the
575 previous MSG_VERSION macro here.
576
Scott James Remnantfb9412a2006-12-15 18:03:22 +0000577 * upstart/control.c (upstart_read_int, upstart_write_int)
578 (upstart_read_ints, upstart_write_ints, upstart_read_str)
579 (upstart_write_str, upstart_read_header, upstart_write_header):
580 New functions to replace the old "write a struct" protocol with
581 something a little more regimented and supportable.
582 (IOVEC_ADD, IOVEC_READ, WireHdr, WireJobPayload, WireJobStatusPayload)
583 (WireEventPayload): Remove these structures, use the functions
584 instead.
585 (upstart_send_msg_to): Call write functions intead of using macros,
586 this makes the code somewhat neater.
587 (upstart_recv_msg): Call read functions instead of using macros,
588 again making the code somewhat neater.
589 * upstart/tests/test_control.c (test_recv_msg): Change wire
590 tests to match new protocol, and thus actually work properly,
591 previously these were endian sensitive.
592
Scott James Remnant27ebd792006-12-14 11:37:14 +00005932006-12-14 Scott James Remnant <scott@netsplit.com>
594
Scott James Remnant136dc6f2006-12-14 12:36:43 +0000595 * compat/sysv/shutdown.c (wall): Construct the wall message so that
596 we don't put \r into a po file; for some reason, gettext hates that
597 and bitches about it. Someone's confusing internationalisation with
598 operating system portability, I expect.
599
Scott James Remnantf334f842006-12-14 11:46:14 +0000600 * util/man/initctl.8: Drop reference to start(8), as that's just
601 a symlink to initctl now.
602
Scott James Remnant88847432006-12-14 11:44:36 +0000603 * init/man/init.8: Link to initctl.
604
Scott James Remnantf6b237a2006-12-14 11:40:49 +0000605 * compat/sysv/reboot.c (main): Clear up help text a little.
606
Scott James Remnant3b4b2272006-12-14 11:39:05 +0000607 * HACKING: Correct some typos.
608
Scott James Remnant27ebd792006-12-14 11:37:14 +0000609 * configure.ac (AC_INIT): Correct bug reporting address.
610
Scott James Remnant1d8763a2006-12-13 17:49:38 +00006112006-12-13 Scott James Remnant <scott@netsplit.com>
612
Scott James Remnantecec0fe2006-12-13 21:55:28 +0000613 * configure.ac: Bump version to 0.3.2
614
Scott James Remnantf642ffa2006-12-13 18:24:22 +0000615 * NEWS: Update.
616
Scott James Remnant1d8763a2006-12-13 17:49:38 +0000617 * util/initctl.c (print_job_status): Drop the newline from the
618 output.
619
Scott James Remnant567cbdc2006-12-13 17:07:58 +00006202006-12-13 Alex Smith <alex@alex-smith.me.uk>
621
622 * util/initctl.c (print_job_status): Clean up initctl job status
623 output, which was badly converted from printf to nih_message.
624
Scott James Remnante2cf6392006-12-13 17:02:20 +00006252006-12-13 Scott James Remnant <scott@netsplit.com>
626
627 * compat/sysv/man/shutdown.8: Add missing documentation on the
628 format of TIME by copying it from --help output.
629
Scott James Remnantfec90562006-12-13 17:00:40 +00006302006-12-13 Alex Smith <alex@alex-smith.me.uk>
631
632 * init/process.c (process_setup_console): Actually send output to
633 /dev/null instead of /dev/console, when CONSOLE_NONE.
634
Scott James Remnantf233c9d2006-12-13 16:45:35 +00006352006-12-13 Scott James Remnant <scott@netsplit.com>
636
Scott James Remnantfbf7a5c2006-12-13 16:54:42 +0000637 * Makefile.am (EXTRA_DIST): Distribute the nih ChangeLog as well.
638
Scott James Remnantf233c9d2006-12-13 16:45:35 +0000639 * init/tests/test_job.c: Port to the new test framework.
640 * init/job.c (job_set_idle_event): Fix a slight memory leak,
641 repeated setting of the idle event never freed the previous one set.
642
Scott James Remnant1abced42006-12-12 11:28:49 +00006432006-12-12 Scott James Remnant <scott@netsplit.com>
644
Scott James Remnantfbad50c2006-12-12 18:47:43 +0000645 * init/tests/test_cfgfile.c: Port to the new test framework.
646
Scott James Remnantef372232006-12-12 17:23:05 +0000647 * init/tests/test_control.c: Port to the new test framework.
648 * init/init.supp: Suppress the list head allocated within control_init.
649
Scott James Remnant2c2e01a2006-12-12 17:22:40 +0000650 * init/control.c (control_watcher): Need to save the pid when we
651 get ECONNREFUSED, otherwise we lose it when we free the message.
652
Scott James Remnant40f7d912006-12-12 15:31:35 +0000653 * init/tests/test_process.c: Port to the new test framework.
654 * init/init.supp: Suppress the list head allocated within job_init.
655
Scott James Remnantfc456592006-12-12 14:09:45 +0000656 * init/init.supp: Include a valgrind suppressions file.
657 * init/Makefile.am (EXTRA_DIST): Distribute the suppressions file.
658
Scott James Remnant96c9b072006-12-12 14:07:30 +0000659 * init/tests/test_event.c: Port to the new test framework.
660
Scott James Remnant237c7f62006-12-12 13:49:19 +0000661 * logd/Makefile.am, util/Makefile.am, compat/sys/Makefile.am
662 (AM_CPPFLAGS): Add -I$(srcdir), necessary for testing "programs"
663 that don't have usual library path semantics.
664
Scott James Remnant2a35ab92006-12-12 13:23:10 +0000665 * upstart/tests/test_control.c: Port to the new test framework.
666 * upstart/control.c (upstart_free): Drop this function, while not
667 exposing libnih is a valiant effort, it already slips out because
668 of the error handling.
669
Scott James Remnant905dd272006-12-12 12:38:34 +0000670 * upstart/tests/test_job.c: Add missing include.
671
Scott James Remnante77567f2006-12-12 12:25:46 +0000672 * upstart/tests/test_job.c: Port to the new test framework.
673 (test_process_state_name): Check that this returns NULL.
674
Scott James Remnantb7983062006-12-12 11:34:49 +0000675 * HACKING: Update location of download directory. Document
676 requirement that all code have test cases.
677
Scott James Remnant0c577ce2006-12-12 11:31:13 +0000678 * logd/main.c (open_logging): Likewise.
679
Scott James Remnantc654baf2006-12-12 11:30:44 +0000680 * init/control.c (control_open): No need to set ENOMEM, errno is
681 always set anyway.
682
Scott James Remnant1abced42006-12-12 11:28:49 +0000683 * configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
684 Automake's broken default includes.
685 * upstart/Makefile.am (DEFAULT_INCLUDES): Drop override now that
686 we don't need it.
687 (DEFS, INCLUDES): Replace these variables with the combined
688 (AM_CPPFLAGS): variable that declares everything.
689 * init/Makefile.am (DEFAULT_INCLUDES): Drop override now that
690 we don't need it.
691 (DEFS, INCLUDES): Replace these variables with the combined
692 (AM_CPPFLAGS): variable that declares everything.
693 * util/Makefile.am (DEFAULT_INCLUDES): Drop override now that
694 we don't need it.
695 (DEFS, INCLUDES): Replace these variables with the combined
696 (AM_CPPFLAGS): variable that declares everything.
697 * compat/sysv/Makefile.am (DEFAULT_INCLUDES): Drop override now that
698 we don't need it.
699 (DEFS, INCLUDES): Replace these variables with the combined
700 (AM_CPPFLAGS): variable that declares everything.
701 * logd/Makefile.am (DEFAULT_INCLUDES): Drop override now that
702 we don't need it.
703 (DEFS, INCLUDES): Replace these variables with the combined
704 (AM_CPPFLAGS): variable that declares everything.
705
Scott James Remnantacec3b22006-11-02 16:36:53 +00007062006-11-02 Scott James Remnant <scott@netsplit.com>
707
708 * util/initctl.c (start_action): Remove break calls which shouldn't
709 be there.
710
Scott James Remnantea806b72006-10-18 15:01:00 +01007112006-10-18 Sean E. Russell <ser@ser1.net>
712
713 * init/main.c: Include sys/time.h
714 * init/cfgfile.c: Include sys/time.h and sys/resource.h
715 * init/job.c: Include sys/time.h and sys/resource.h
716
Scott James Remnant6702ac12006-10-17 18:55:24 +01007172006-10-17 Scott James Remnant <scott@netsplit.com>
718
Scott James Remnantd5758f42006-10-17 19:21:25 +0100719 * configure.ac: Bump version to 0.3.1
720
Scott James Remnantfd029da2006-10-17 19:21:07 +0100721 * NEWS: Update.
722 * TODO: Update.
723
Scott James Remnant9f67cb82006-10-17 19:12:28 +0100724 * configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number.
725
Scott James Remnant4ebe87f2006-10-17 19:04:40 +0100726 * logd/Makefile.am (event.d/logd): Make the event.d sub-directory
727 in case we're building outside of the source tree.
728
Scott James Remnant6702ac12006-10-17 18:55:24 +0100729 * compat/sysv/runlevel.c (store): Don't break strict-aliasing rules
730 by avoiding dereferencing type-punned pointer. Answers on a
731 postcard, please.
732
Scott James Remnant7f133012006-10-13 12:00:34 +01007332006-10-13 Scott James Remnant <scott@netsplit.com>
734
Scott James Remnantecbb2b52006-10-13 15:18:24 +0100735 * util/initctl.c (start_action, emit_action): Add missing \n
736
Scott James Remnant48622982006-10-13 15:15:50 +0100737 * util/initctl.c: Rewrite using nih_command_parser.
738 * util/man/initctl.8: Improve.
739
740 * util/start.c: Remove, replaced by initctl.
741 * util/man/start.8: Remove, replaced by initctl.
742 * util/Makefile.am (sbin_PROGRAMS): Drop start, now just a symlink
743 to initctl.
744 (dist_man_MANS): Drop start.8, now a symlink to initctl.8
745 (install-exec-hook): Make symlinks to initctl, add start
746 (install-data-hook): Make symlinks to initctl.8, add start.8
747
Scott James Remnantb1d8a7d2006-10-13 13:57:31 +0100748 * initctl: Rename to util again, I don't want a separate directory
749 for every single little tool; and we'll be shipping more than just
750 initctl (e.g. a non-compat reboot).
751 * configure.ac (AC_CONFIG_FILES): Make util/Makefile instead of
752 initctl/Makefile.
753 * Makefile.am (SUBDIRS): Descend into util, not initctl.
754
Scott James Remnanta48b4fe2006-10-13 13:49:46 +0100755 * compat/sysv/reboot.c: Remove long options where they didn't exist
756 before. Write help text.
757 * compat/sysv/man/reboot.8: Update.
758
Scott James Remnant462734c2006-10-13 13:36:00 +0100759 * init/main.c (main): Formatting.
760 * logd/main.c (main): Formatting.
761 * logd/man/logd.8: Formatting.
762 * compat/sysv/runlevel.c (main): Formatting.
763 * compat/sysv/telinit.c (main): Formatting.
764 * compat/sysv/man/shutdown.8: Remove long options.
765
Scott James Remnanteff01f12006-10-13 13:32:12 +0100766 * compat/sysv/shutdown.c: Remove -e/--event, it has no place in a
767 compatibility tool. Get rid of long options that never existed
768 before. Specify help text to describe the options.
769 * compat/sysv/man/shutdown.8: Spruce up a bit.
770
Scott James Remnant4a5cd212006-10-13 12:59:15 +0100771 * compat/sysv/telinit.c (main): Set help text to list the valid
772 runlevels.
773 * compat/sysv/man/telinit.8: Refine the notes to mention runlevel(8).
774
Scott James Remnantf7819622006-10-13 12:54:43 +0100775 * compat/sysv/runlevel.c (main): Make the help text describe the
776 options, rather than the behaviour.
Scott James Remnant4a5cd212006-10-13 12:59:15 +0100777 * compat/sysv/man/runlevel.8: Flesh out a little more.
Scott James Remnantf7819622006-10-13 12:54:43 +0100778
Scott James Remnant930e25a2006-10-13 12:28:05 +0100779 * configure.ac (AC_INIT): Change bug reporting address to the
780 mailing list, since Launchpad doesn't accept random bugs without
781 accounts and complicated control messages.
782 * init/main.c, logd/main.c: Add a period to the synopsis.
783
Scott James Remnanta6ed7eb2006-10-13 12:14:45 +0100784 * init/main.c (main): Set the synopsis, and direct people to look
785 at telinit in the --help output.
786 * init/man/init.8: Flesh this out a little more, still a lot of
787 explaining to do about jobs and events, but we'll wait until we've
788 changed that code before documentating the behaviour.
789
Scott James Remnant7f133012006-10-13 12:00:34 +0100790 * logd/main.c (main): Correct help text to describe the options,
791 rather than what the program does. As per standard style.
792 Don't become a daemon until the logging socket is open, and make
793 that exclusive with waiting for SIGCONT.
794 * logd/man/logd.8: Write some more extensive documentation,
795 including describing the startup interlock and the socket protocol.
796 * TODO: Plan to get rid of the signal interlock from logd.
797
Scott James Remnant8985dd32006-10-12 15:26:29 +01007982006-10-12 Scott James Remnant <scott@netsplit.com>
799
800 * configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so
801 that gettext doesn't complain.
802 (AM_GNU_GETTEXT_VERSION): Increase to 0.15
803 (AC_PREREQ): Increase to 2.60
804 * HACKING: Update autoconf and gettext requirements.
805
Scott James Remnantc16a9b42006-10-11 17:08:58 +01008062006-10-11 Scott James Remnant <scott@netsplit.com>
807
Scott James Remnant74a11442006-10-11 17:58:56 +0100808 * init/control.c (control_init): Pass NULL to nih_list_new.
809 Clarify list item types.
810 * init/event.c (event_init): Pass NULL to nih_list_new.
811 * init/job.c (job_init): Pass NULL to nih_list_new.
812
Scott James Remnantc34c4be2006-10-11 17:56:34 +0100813 * init/main.c: Change nih_signal_add_callback to nih_signal_add_handler
814 and NihSignalCb to NihSignalHandler.
815
Scott James Remnant8b227402006-10-11 17:55:27 +0100816 * init/cfgfile.c, init/cfgfile.h, init/control.c, init/control.h,
817 init/event.c, init/event.h, init/job.c, init/job.h, init/main.c,
818 init/process.c: Clean up documentation strings and parent pointer
819 types.
820
Scott James Remnantd033c862006-10-11 17:41:22 +0100821 * compat/sysv/shutdown.c: Change nih_signal_add_callback to
822 nih_signal_add_handler.
823
Scott James Remnant1ee0f482006-10-11 17:40:41 +0100824 * compat/sysv/reboot.c: Set synopsis text depending on command
825 used (probably should use nih_command_parser?)
826 * compat/sysv/runlevel.c: Set synopsis and help text, and correct
827 usage.
828 * compat/sysv/shutdown.c: Set synopsis text.
829 * compat/sysv/telinit.c: Set synopsis text.
830
Scott James Remnant3b734642006-10-11 17:22:33 +0100831 * compat/sysv/runlevel.c, compat/sysv/shutdown.c: Clean up
832 documentation strings.
833
Scott James Remnantc6e4f002006-10-11 17:22:03 +0100834 * logd/main.c: Set synopsis and help text.
835
Scott James Remnant5e31d742006-10-11 17:16:55 +0100836 * logd/main.c: Clean up documentation strings.
837 Change nih_signal_add_callback to nih_signal_add_handler.
838
Scott James Remnant48359382006-10-11 17:13:48 +0100839 * upstart/control.c, upstart/control.h, upstart/job.c: Clean up
840 documentation strings and correct parent pointer type.
841
Scott James Remnantc16a9b42006-10-11 17:08:58 +0100842 * HACKING: Detail function documentation requirement and format.
843
Scott James Remnant59093a82006-10-10 13:09:58 +01008442006-10-10 Scott James Remnant <scott@netsplit.com>
845
Scott James Remnant335947d2006-10-11 17:08:34 +0100846 * event.d/logd.in: Move to logd/event.d
847 * event.d/Makefile.am: Remove
848 * logd/Makefile.am: Create the logd job definition and install
849 * Makefile.am (SUBDIRS): event.d directory has been removed.
850 * configure.ac (AC_CONFIG_FILES): No longer make event.d/Makefile
851
Scott James Remnant59093a82006-10-10 13:09:58 +0100852 * configure.ac: Check for --enable-compat, default to sysv if given
853 or no compat if not given.
854 * compat/sysv/Makefile.am: Don't build binaries or install manpages
855 unless COMPAT_SYSV is defined.
856
Scott James Remnant45150942006-10-06 16:36:27 +01008572006-10-06 Scott James Remnant <scott@netsplit.com>
858
859 * doc/upstart-logo.svg: Include the logo Alexandre designed.
860 * doc/Makefile.am (EXTRA_DIST): Ship the logo in the tarball.
861 * Makefile.am (SUBDIRS): Install under doc
862 * configure.ac: Generate doc/Makefile
863 * AUTHORS: Ensure he's credited fully.
864
Scott James Remnant10b8c0e2006-09-27 21:27:38 +01008652006-09-27 Scott James Remnant <scott@netsplit.com>
866
Scott James Remnant44052a32006-09-28 00:04:32 +0100867 * event.d/Makefile.am (do_subst): Eliminate duplicate /s
868
Scott James Remnant5222c402006-09-27 22:48:48 +0100869 * man/init.8: Move to init/man
870 * init/Makefile.am: Update to install man page.
871 * man/logd.8: Move to logd/man
872 * logd/Makefile.am: Update to install man page.
873 * man/initctl.8, man/start.8: Move to initctl/man
874 * initctl/Makefile.am: Update to install man pages.
875 * man/reboot.8, man/runlevel.8, man/shutdown.8, man/telinit.8:
876 Move to compat/sysv/man
877 * compat/sysv/Makefile.am: Update to install man pages.
878 * man/Makefile.am: Remove
879 * configure.ac (AC_CONFIG_FILES): Remove man/Makefile
880 * Makefile.am (SUBDIRS): Don't build in man
881
Scott James Remnant545cb8c2006-09-27 21:32:49 +0100882 * util: Rename to initctl
883 * configure.ac (AC_CONFIG_FILES): Update.
884 * Makefile.am (SUBDIRS): Update.
885
Scott James Remnant960c82d2006-09-27 21:30:42 +0100886 * util/reboot.c: Move to compat/sysv
887 * util/shutdown.c: Move to compat/sysv
888 * util/Makefile.am: Update.
889 * compat/sysv/Makefile.am: Update.
890
Scott James Remnant10b8c0e2006-09-27 21:27:38 +0100891 * configure.ac: Replace macros with single call to NIH_INIT.
892 Bump version to 0.3.0 to begin new development cycle.
893
Scott James Remnante5591992006-09-21 05:49:34 +01008942006-09-21 Scott James Remnant <scott@netsplit.com>
895
896 * logd/main.c: Revert the change that logged to the console, in
897 practice this doesn't work so well. I want to get rid of logd
898 in the long term, or at least just have it as a simple logging
899 proxy, so giving it features seems wrong.
900
Scott James Remnant9b58b842006-09-20 05:37:47 +01009012006-09-20 Scott James Remnant <scott@netsplit.com>
902
Scott James Remnant97f08fa2006-09-20 06:34:12 +0100903 * configure.ac: Bump version to 0.2.8
904 * NEWS: Updated.
905
Scott James Remnante59c71e2006-09-20 06:14:32 +0100906 * logd/main.c (main): Check the kernel command-line for "quiet"
907 (line_reader): Write to console unless silent or a daemon
908
Scott James Remnant9b58b842006-09-20 05:37:47 +0100909 * man/Makefile.am (dist_man_MANS): Drop sulogin.8
910 * man/sulogin.8: Drop, we don't include an sulogin
911
Scott James Remnant0fafba42006-09-20 01:36:29 +01009122006-09-19 Michael Biebl <mbiebl@gmail.com>
913
914 * event.d/Makefile.am (logd): Drop $(srcdir)
915 * init/Makefile.am (init_SOURCES): Distribute paths.h
916
Scott James Remnant58f165f2006-09-18 19:43:07 +01009172006-09-18 Michael Biebl <mbiebl@gmail.com>
918
919 * configure.ac: Check for sys/inotify.h
920
Scott James Remnante371cab2006-09-18 16:16:00 +01009212006-09-18 Scott James Remnant <scott@netsplit.com>
922
923 * util/shutdown.c (warning_message): Adjust method of constructing
924 the message to not confuse poor translators who think \r and \n are
925 the same thing!
926
Scott James Remnantf2b1c052006-09-14 10:34:45 +01009272006-09-14 Scott James Remnant <scott@netsplit.com>
928
Scott James Remnantb2e03d02006-09-14 11:20:13 +0100929 * init/job.c (job_change_state): Catch runaway respawns when we
930 enter the running state, so we catch stop/start loops too.
931 * init/tests/test_job.c (test_change_state): Update test.
932
Scott James Remnantb7714f72006-09-14 11:07:38 +0100933 * event.d/logd: Rename to logd.in
934 * event.d/logd.in: Replace /sbin with @sbindir@ so we can transform
935 * event.d/Makefile.am: Generate logd from logd.in
936
Scott James Remnant7e6bdb32006-09-14 10:57:03 +0100937 * util/reboot.c: Don't hardcode the location of /sbin/shutdown
938 * util/Makefile.am (DEFS): Use autoconf to seed it
939 * util/shutdown.c (sysvinit_shutdown): Don't hardcode the location
940 of /dev/initctl
941
Scott James Remnante0d0dd12006-09-14 10:51:05 +0100942 * init/paths.h: Create a new configuration file that can contain
943 all of the path definitions, and in particular, allow them to be
944 overidden elsewhere.
945 * init/Makefile.am (DEFS): Override definitions of CFG_DIR and
946 TELINIT using autoconf
947 * init/main.c: Include paths.h. Don't hardcode location of telinit
948 * init/job.c: Include paths.h
949 * init/process.c: Include paths.h
950 * init/process.h: Remove definitions from here.
951
Scott James Remnantf2b1c052006-09-14 10:34:45 +0100952 * configure.ac: Bump version to 0.2.7
953
Scott James Remnant0b8f23f2006-09-13 16:51:38 +01009542006-09-13 Scott James Remnant <scott@netsplit.com>
955
Scott James Remnant948ab872006-09-14 10:34:34 +0100956 * NEWS: Updated.
957
Scott James Remnant0b8f23f2006-09-13 16:51:38 +0100958 * TODO: More TODO.
959
Scott James Remnant080dd8d2006-09-10 12:42:03 +01009602006-09-10 Scott James Remnant <scott@netsplit.com>
961
962 * util/reboot.c (main): Don't give -H with "halt".
963
Scott James Remnantd7042862006-09-09 00:50:10 +01009642006-09-09 Scott James Remnant <scott@netsplit.com>
965
Scott James Remnantedb97902006-09-09 05:48:42 +0100966 * configure.ac: Bump version to 0.2.6
967
Scott James Remnant760237e2006-09-09 05:38:32 +0100968 * NEWS: Update.
969 * TODO: Update.
970
Scott James Remnant5e267a42006-09-09 05:21:28 +0100971 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
972 the magic to be the package string.
973 * upstart/tests/test_control.c (test_recv_msg): Update tests.
974
Scott James Remnant17fec6e2006-09-09 05:05:42 +0100975 * util/initctl.c (main): Set the usage string.
976 * util/shutdown.c (main): Set the usage string.
977 * util/start.c (main): Set the usage string.
978 * compat/sysv/runlevel.c (main): Set the usage string.
979 * compat/sysv/telinit.c (main): Set the usage string.
980
Scott James Remnantabede802006-09-09 05:01:45 +0100981 * man/Makefile.am: Use install-data-hook and $(man8dir)
982 * util/Makefile.am: Also use install-exec-hook
983
Scott James Remnantc6c20052006-09-09 04:58:11 +0100984 * Makefile.am (SUBDIRS): Install contents of the man directory
985 * configure.ac (AC_CONFIG_FILES): Generate man/Makefile
986 * man/Makefile.am: Install manpages in the appropriate places.
987 * man/init.8, man/logd.8, man/initctl.8, man/reboot.8,
988 * man/shutdown.8, man/start.8, man/sulogin.8, man/runlevel.8,
989 * man/telinit.8: Include some basic manpages so we at least have
990 some level of documentation.
991
Scott James Remnant33e47112006-09-09 03:45:00 +0100992 * init/job.c (job_child_reaper): Don't check the exit status of
993 a respawning job if the goal is to stop it.
994
Scott James Remnant1889aa62006-09-09 03:41:53 +0100995 * compat/sysv/telinit.c (main): Generate events rather than
996 starting and stopping jobs directly, the events are named
997 "runlevel-X". 0, 1, 6 and s/S are shutdown events.
998
Scott James Remnant515b2b92006-09-09 03:41:27 +0100999 * logd/main.c (main): Raise SIGSTOP before entering the main loop.
1000 * init/main.c (main): Interlock with logd.
1001
Scott James Remnant17eb9052006-09-09 03:41:04 +01001002 * event.d/logd: Should not be a console owner, but should stop
1003 on shutdown.
1004
Scott James Remnant34752262006-09-09 01:38:02 +01001005 * init/process.c (process_setup_console): Revert part of the previous
1006 change, should just output to /dev/null if we don't have logd.
1007
Scott James Remnante5533332006-09-09 01:36:07 +01001008 * configure.ac: Bump version to 0.2.5
1009
Scott James Remnantb4a1c2b2006-09-09 01:28:26 +01001010 * init/main.c (main): Start the logd job if it exists.
1011
1012 * init/process.c (process_setup_console): Ignore ECONNREFUSED as
1013 that just means that logd isn't around, handle errors by falling
1014 back to opening the console.
1015
Scott James Remnant9fb20d42006-09-09 01:22:03 +01001016 * init/process.c (process_setup_console): Implement handling for
1017 CONSOLE_LOGGED and generally clean up the other handling.
1018 * init/process.h: Update.
1019 * init/main.c (main): Pass NULL for the job to setup console.
1020 * TODO: Update.
1021
Scott James Remnantd7042862006-09-09 00:50:10 +01001022 * logd/main.c: Implement the logging daemon, it accepts connections
1023 on a unix stream socket with the abstract name
1024 "/com/ubuntu/upstart/logd", expects the length of the name and the
1025 name to follow; then sequences of lines which are logged to
1026 /var/log/boot, or memory until that file can be opened.
1027
Scott James Remnant527b9452006-09-08 17:15:07 +010010282006-09-08 Scott James Remnant <scott@netsplit.com>
1029
Scott James Remnantcb655e72006-09-08 17:49:20 +01001030 * util/shutdown.c (event_setter): Change the event names to
1031 distinguish between "shutdown -h" and "shutdown -h -H".
1032
Scott James Remnant90732d32006-09-08 17:33:19 +01001033 * init/job.c (job_handle_event): Allow jobs to react to their own
1034 events, this is how we'll do respawn eventually.
1035 * init/tests/test_job.c (test_handle_event): Remove test.
1036
Scott James Remnantbb3cc3f2006-09-08 17:17:47 +01001037 * init/main.c (cad_handler, kbd_handler): Generate the new event
1038 names.
1039 * init/event.h (CTRLALTDEL_EVENT, KBDREQUEST_EVENT): Add definitions
1040 of these event names, change the ctrlaltdel event to just that.
1041
Scott James Remnant527b9452006-09-08 17:15:07 +01001042 * logd/main.c (main): Add the code to daemonise, etc.
1043
Scott James Remnanta17917d2006-09-07 00:18:28 +010010442006-09-07 Scott James Remnant <scott@netsplit.com>
1045
Scott James Remnant214ebe82006-09-07 21:48:55 +01001046 * TODO: Long discussion today on #upstart, many improvements to the
1047 job and event model that make it more elegant.
1048 * AUTHORS: Include a list of thanks.
1049
Scott James Remnantb8280072006-09-07 03:19:00 +01001050 * util/shutdown.c (shutdown_now): If we get ECONNREFUSED when we
1051 try and send the shutdown event to init, it probably means we're
1052 still in sysvinit. So try that instead.
1053 (sysvinit_shutdown): Function to send a hand-crafted runlevel
1054 change message across /dev/initctl.
1055
Scott James Remnantae969062006-09-07 00:43:57 +01001056 * util/initctl.c (main): Add a shutdown command that takes an
1057 arbitrary event name to be issued after "shutdown". You'll
1058 nearly always want the /sbin/shutdown tool instead.
1059
Scott James Remnant987bcc42006-09-07 00:38:24 +01001060 * init/job.c (job_detect_idle): Only generate the stalled event
1061 if at least one job handles it in its start_events list.
1062 * init/tests/test_job.c (test_detect_idle): Make sure that works.
1063
Scott James Remnantea204d42006-09-07 00:30:53 +01001064 * init/event.h (STARTUP_EVENT, SHUTDOWN_EVENT, STALLED_EVENT):
1065 Macros to define the standard event names.
1066 * init/main.c (main): Use STARTUP_EVENT macro instead of "startup"
1067 * init/control.c (control_handle): Use SHUTDOWN_EVENT macro
1068 instead of "shutdown".
1069 * init/job.c (job_detect_idle): Use STALLED_EVENT macro instead
1070 of "stalled".
1071
Scott James Remnant84607df2006-09-07 00:27:22 +01001072 * init/job.c (job_detect_idle): Add some log messages for when we
1073 detect the idle or stalled states.
1074 (job_kill_process, job_kill_timer): Increase log verbosity.
1075 * init/event.c (event_queue_run): Log which events we're handling
1076 if --debug is given.
1077
Scott James Remnanta17917d2006-09-07 00:18:28 +01001078 * compat/sysv/telinit.c (main): Send a shutdown command when
1079 requesting to enter runlevel 0 or runlevel 6, likewise for
1080 runlevel 1, s or S which all run "rc1" not "rcS".
1081 * init/main.c (main): When called directory (pid != 1) try and
1082 run telinit before complaining that we're not init. Make sure
1083 errors aren't lost.
1084
Scott James Remnantf5c376c2006-09-04 16:25:04 +010010852006-09-04 Johan Kiviniemi <johan@kiviniemi.name>
Scott James Remnantedcae302006-09-04 07:06:23 +01001086
Scott James Remnantf5c376c2006-09-04 16:25:04 +01001087 * upstart/control.c (upstart_addr): Replace use of __builtin_offsetof
1088 with offsetof.
1089 * upstart/tests/test_control.c (test_recv_msg): Likewise.
1090
10912006-09-04 Scott James Remnant <scott@netsplit.com>
1092
Scott James Remnantedcae302006-09-04 07:06:23 +01001093 * util/shutdown.c (main): Exit normally after sending the warning
1094 message if -k is given.
1095
Scott James Remnante94bd202006-09-01 00:48:36 +010010962006-09-01 Scott James Remnant <scott@netsplit.com>
Scott James Remnantd4cdaca2006-08-31 00:47:11 +01001097
Scott James Remnant294cde72006-09-01 19:58:35 +01001098 * configure.ac: Bump version to 0.2.2
1099
Scott James Remnant7663bfb2006-09-01 19:58:19 +01001100 * NEWS: Update.
1101 * configure.ac: Bump version to 0.2.1
1102
Scott James Remnant67982142006-09-01 19:47:39 +01001103 * init/process.c (process_setup_console): Ensure that the console
1104 is always initialised to at least /dev/null
1105 * init/job.c (job_change_state): Initialise event to NULL.
1106 * init/event.c (event_read_state): Don't mask initialisation of
1107 other variable.
1108 * init/cfgfile.c (cfg_job_stanza, cfg_parse_script, cfg_next_token):
1109 Print lineno using %zi not %d
1110 * compat/sysv/runlevel.c (store): Cast pointer type of timeval.
1111
Scott James Remnant097b2a92006-09-01 19:30:37 +01001112 * init/main.c: Move the kernel headers include beneath the C
1113 library ones, so that compilation doesn't fail on !i386.
1114 * util/reboot.c: Likewise.
1115
Scott James Remnant28fcc922006-09-01 04:15:57 +01001116 * init/main.c (term_handler): Close the control connection if we
1117 re-exec init, otherwise it won't be able to bind. Drop debugging.
1118
Scott James Remnant6f464962006-09-01 04:10:20 +01001119 * init/main.c (term_handler): It always helps if we dup2 the
1120 right file descriptor.
1121
Scott James Remnant1db88042006-09-01 03:14:19 +01001122 * init/main.c: Use the TERM signal instead of USR1, as old init
1123 used that for something else. Also rather than passing across
1124 file descriptor numbers, use a fixed descriptor and just pass
1125 "--restart". When we get that option we need to unmask signals
1126 otherwise we sit there looking like a lemon.
1127
Scott James Remnante7a73262006-09-01 02:32:27 +01001128 * init/job.c (job_change_state): Don't free the event unless we
1129 generate one.
1130
Scott James Remnant12dd7252006-09-01 02:27:04 +01001131 * NEWS: Update.
1132
Scott James Remnant694172a2006-09-01 02:26:45 +01001133 * init/cfgfile.c (cfg_watcher): Ignore any file with '.' or '~'
1134
Scott James Remnantc6e63dd2006-09-01 02:16:43 +01001135 * TODO: Update.
1136
Scott James Remnant3401ab72006-09-01 02:14:47 +01001137 * init/main.c (main): Parse command-line arguments, specifically
1138 look for --state-fd which we'll use for reexec. Don't do a couple
1139 of things if we're passed this.
1140 (read_state): Parse the line-buffered state.
1141 * init/job.c (job_read_state, job_write_state): Job state
1142 serialisation so that we can re-exec ourselves.
1143 * init/job.h: Update.
1144 * init/tests/test_job.c: Test the serialisation.
1145 * init/event.c (event_read_state, event_write_state): And similar
1146 functions for serialising the event queue.
1147 * init/event.h: Update.
1148 * init/tests/test_event.c: Test the serialisation.
1149 * init/cfgfile.c (cfg_read_job): Fix a bug, need to subtract current
1150 time to get due time.
1151
Scott James Remnante94bd202006-09-01 00:48:36 +01001152 * upstart/job.c (job_goal_from_name, job_state_from_name)
1153 (process_state_from_name): Add opposite numbers that convert a
1154 string back into an enumeration.
1155 * upstart/job.h: Update.
1156 * upstart/tests/test_job.c: Test the new functions.
1157
11582006-08-31 Scott James Remnant <scott@netsplit.com>
Scott James Remnant694172a2006-09-01 02:26:45 +01001159
Scott James Remnantb7260a72006-08-31 22:08:56 +01001160 * init/job.h (Job): Add respawn_limit, respawn_interval,
1161 respawn_count and respawn_time members so that we can keep track of
1162 runaway processes.
1163 * init/job.c (job_catch_runaway): Increment the respawn_count
1164 within respawn_interval, or reset it if we go over.
1165 (job_new): Initialise respawn_limit and respawn_interval to sensible
1166 defaults.
1167 * init/tests/test_job.c (test_new): Check the defaults are set.
1168 (test_change_state): Check the respawning code works.
1169 * init/cfgfile.c (cfg_job_stanza): Parse the "respawn limit" stanza.
1170 * init/tests/test_cfgfile.c (test_read_job): Test the new stanza.
1171
Scott James Remnantff0d26a2006-08-31 20:49:43 +01001172 * init/process.c (process_setup_console): Remove the console reset
1173 code, it tends to just crash X and seems to do nothing interesting.
1174 * init/main.c (reset_console): Instead put it here and just do it
1175 on startup.
1176
Scott James Remnant25b263a2006-08-31 18:59:02 +01001177 * configure.ac: Bump version to 0.2.0
1178
Scott James Remnant4b61be92006-08-31 17:08:44 +01001179 * util/Makefile.am (install-exec-local): Create symbolic links,
1180 not hard links.
1181
Scott James Remnantaf1404f2006-08-31 16:04:16 +01001182 * init/main.c: Can't catch STOP.
1183
Scott James Remnant242b50b2006-08-31 15:40:42 +01001184 * util/reboot.c: Pause init while shutting down or rebooting.
1185
Scott James Remnanteabb7802006-08-31 15:39:04 +01001186 * init/main.c (stop_handler): Catch STOP/TSTP and CONT.
1187 * init/event.c (event_queue_run): Don't run the event queue while
1188 paused.
1189 * init/job.c (job_detect_idle): Don't detect idle jobs while paused.
1190
Scott James Remnant1cd8d862006-08-31 15:17:16 +01001191 * util/reboot.c: if we get the -w argument ("only write to wtmp")
1192 we need to exit, and not behave as halt normally would.
1193
Scott James Remnantff63cf72006-08-31 04:39:34 +01001194 * compat/sysv/runlevel.c (main): Add missing newline.
1195 * compat/sysv/telinit.c (main): And here too.
1196
Scott James Remnant32de9222006-08-31 04:34:27 +01001197 * init/main.c (main): Check for idle after the startup event queue
1198 has been run, otherwise we may just sit there.
1199
Scott James Remnant13ffffe2006-08-31 04:33:39 +01001200 * compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install telinit
1201 (telinit_SOURCES, telinit_LDFLAGS, telinit_LDADD): Details for
1202 telinit binary.
1203 * compat/sysv/telinit.c: Trivial telinit program that just runs
1204 the appropriate rcX job.
1205 * compat/sysv/runlevel.c (main): Suggest help on illegal runlevel.
1206
Scott James Remnant40f09012006-08-31 04:21:49 +01001207 * util/Makefile.am: Tidy up.
1208
Scott James Remnant12473562006-08-31 04:21:05 +01001209 * configure.ac (AC_CONFIG_FILES): Create compat/sysv/Makefile
1210 * Makefile.am (SUBDIRS): Build things found in compat/sysv
1211 * compat/sysv/Makefile.am (sbin_PROGRAMS): Build and install runlevel
1212 (runlevel_SOURCES, runlevel_LDFLAGS, runlevel_LDADD): Details for
1213 runlevel binary.
1214 * compat/sysv/runlevel.c: Helper to store and retrieve the current
1215 "runlevel" from utmp/wtmp; as well as the reboot time.
1216
Scott James Remnantd909cca2006-08-31 04:20:14 +01001217 * init/main.c (main): Drop debugging set.
1218
Scott James Remnantcedd11a2006-08-31 02:59:29 +01001219 * init/job.c (job_change_state): As well as the job/state events,
1220 send the job event when a service is running or a task is stopping.
1221 * init/tests/test_job.c (test_change_state): Check the events get
1222 sent properly.
1223
Scott James Remnant44b684a2006-08-31 02:58:45 +01001224 * util/start.c: Write a simple utility to start, stop, or query
1225 the status of the named jobs.
1226 * util/Makefile.am (sbin_PROGRAMS): Build and install start
1227 (start_SOURCES, start_LDFLAGS, start_LDADD): Details for start
1228 (install-exec-local): Also install as stop and status.
1229 * util/reboot.c (main): Drop the debugging set.
1230
Scott James Remnantb8ed2d12006-08-31 02:15:48 +01001231 * init/cfgfile.c (cfg_job_stanza): Correct nih_alloc error.
1232
Scott James Remnanta6125ae2006-08-31 02:14:25 +01001233 * init/process.c (process_setup_environment): Guard memory alloc.
1234 * init/job.c (job_set_idle_event): Likewise.
1235 (job_change_state): And here too.
1236 (job_run_command): Likewise.
1237 * init/control.c (control_send): Likewise.
1238 * init/cfgfile.c: And throughout this file.
1239 * upstart/control.c (upstart_recv_msg): And once here too.
1240
Scott James Remnant0b358ab2006-08-31 02:07:32 +01001241 * upstart/control.h: Abolish the separate halt, reboot and poweroff
1242 messages and replace with a single shutdown message that takes
1243 an event name (for the idle event issued afterwards).
1244 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
1245 the new shutdown event type by just treating it as an event.
1246 * upstart/tests/test_control.c (test_messages): Update tests.
1247 * init/job.c (job_set_idle_event): Store a copy of the idle event
1248 name.
1249 * init/control.c (control_send): Copy the shutdown event name.
1250 (control_handle): Replace individual handling with the new
1251 single event.
1252 * init/tests/test_control.c (test_watcher): Update.
1253 * util/initctl.c: Drop handling for things that shutdown does now.
1254 * util/shutdown.c: Send the UPSTART_SHUTDOWN event and let the user
1255 specify anything they want, just give defaults.
1256
Scott James Remnantff5efb92006-08-31 01:45:19 +01001257 This is quite a big change and abolishes level events entirely,
1258 along with the event history. We now just treat events as a
1259 transient queue of strings that go past, may cause things to change,
1260 but are otherwise forgotten. This turns out to be much easier to
1261 understand and has no real loss of power.
1262
1263 * init/event.c: Vastly simplify; gone are the separate notions of
1264 edge and level events, instead we just treat them as one-shot
1265 things that go past and are forgotten about.
1266 * init/event.h (Event): Remove value member.
1267 Update prototypes.
1268 * init/tests/test_event.c: Update.
1269 * init/job.c (job_change_state): Change the event pattern to be
1270 one that includes the job name and a description of the transition
1271 instead of the new state.
1272 (job_detect_idle): Call event_queue rather than event_queue_edge.
1273 * init/tests/test_job.c: Update.
1274 * init/cfgfile.c (cfg_job_stanza): Drop "when" and "while".
1275 * init/tests/test_cfgfile.c (test_read_job): Drop mentions of
1276 "when" and "while".
1277 * init/control.c (control_send, control_handle): Drop cases for
1278 level events.
1279 (control_handle_event): Don't include a level in the event.
1280 * init/tests/test_control.c: Update
1281 * init/main.c: Call event_queue rather than event_queue_edge.
1282 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Change
1283 event handling so that only a name is read.
1284 * upstart/control.h: Remove value/level event structures.
1285 * upstart/tests/test_control.c (test_messages): Update.
1286 * upstart/job.c (process_state_name): Not used for events, adjust
1287 documentation so it doesn't lie.
1288 * util/initctl.c (main): Drop the set function, simplify trigger.
1289 * util/shutdown.c (shutdown_now): Call UPSTART_EVENT_QUEUE for
1290 shutdown into maintenance mode.
1291
Scott James Remnantfcbee2d2006-08-31 00:49:36 +01001292 * init/control.c (control_handle): Place a message in the syslog
1293 before halting, powering off or rebooting.
1294
Scott James Remnantd4cdaca2006-08-31 00:47:11 +01001295 * util/shutdown.c: Adjust so that the warning message is sent out
1296 if shutdown is immediate, and when it actually happens. Include
1297 the hostname as wall does.
1298
Scott James Remnant255c5f22006-08-30 16:05:01 +010012992006-08-30 Scott James Remnant <scott@netsplit.com>
1300
Scott James Remnant5be55662006-08-30 19:13:25 +01001301 * TODO: Update.
1302
Scott James Remnant4a9245f2006-08-30 19:13:00 +01001303 * util/shutdown.c: Implement shutdown utility along the same lines
1304 as the sysvinit one, but with rather different code.
1305
Scott James Remnant2a71aaa2006-08-30 16:34:06 +01001306 * util/initctl.c (main): Call setuid on the effective user id so
1307 that we can be made setuid root and executable by a special group.
1308 * util/reboot.c (main): Likewise.
1309
Scott James Remnant70cc2292006-08-30 16:06:03 +01001310 * util/initctl.c (main): Check the effective rather than the real
1311 user id, if we're effectively root, that's good enough.
1312
Scott James Remnant255c5f22006-08-30 16:05:01 +01001313 * util/reboot.c: Implement reboot/halt/poweroff utility.
1314 * util/Makefile.am (sbin_PROGRAMS): Build and install reboot
1315 (reboot_SOURCES, reboot_LDFLAGS, reboot_LDADD): Details for reboot
1316 (install-exec-local): Create hardlinks to reboot for halt and poweroff.
1317
Scott James Remnantdc8877d2006-08-29 16:56:48 +010013182006-08-29 Scott James Remnant <scott@netsplit.com>
1319
1320 * init/main.c (main): Actually run the idle-detect function.
1321 * init/job.c (job_detect_idle): Interrupt the main loop, otherwise
1322 we may end up waiting for a signal before we process the event
1323 we just issued.
1324
Scott James Remnantf43bdf32006-08-27 18:20:29 +010013252006-08-27 Scott James Remnant <scott@netsplit.com>
1326
Scott James Remnant47158482006-08-27 22:37:10 +01001327 * util/shutdown.c: Template main function.
1328 * util/Makefile.am (sbin_PROGRAMS): Build and install the
1329 shutdown binary.
1330 (shutdown_SOURCES, shutdown_LDFLAGS, shutdown_LDADD): Details for
1331 the shutdown binary
1332
Scott James Remnant70a6ec62006-08-27 22:23:50 +01001333 * util/initctl.c (main): Add commands for halt, poweroff and reboot.
1334
Scott James Remnant0c7e72a2006-08-27 22:22:53 +01001335 * init/event.c (event_queue_run): Remove the parameters.
1336 * init/event.h: Update.
1337 * init/main.c (main): Update.
1338 * init/tests/test_control.c (test_watcher): Update.
1339 * init/tests/test_job.c (test_detect_idle): Update.
1340
Scott James Remnant96ae9e42006-08-27 22:15:34 +01001341 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Deal
1342 with halting, rebooting and powering off; or at least the appropriate
1343 messages.
1344 * upstart/control.h: Add control message structures for halting,
1345 powering off and rebooting the machine.
1346 * upstart/tests/test_control.c (test_messages): Run the tests.
1347 * init/control.c (control_handle): Add handling for halt, power off
1348 and reboot that issue the shutdown event and arrange for the halt,
1349 poweroff or reboot to be issued the next time the system is idle.
1350 * init/tests/test_control.c (test_watcher): Test the events.
1351
Scott James Remnant01a37082006-08-27 21:51:00 +01001352 * TODO: Update.
1353
Scott James Remnante02892b2006-08-27 21:49:44 +01001354 * init/job.c (job_detect_idle): Function to detect when the system is
1355 stalled or idle.
1356 * init/job.h: Update
1357 * init/tests/test_job.c (test_detect_idle): Test the new function.
1358
Scott James Remnant6a8508c2006-08-27 19:10:44 +01001359 * util/initctl.c (main): Handle the list command.
1360
Scott James Remnanta9476ad2006-08-27 19:07:23 +01001361 * TODO: Update.
1362
Scott James Remnant4da474d2006-08-27 19:06:35 +01001363 * upstart/control.c (WireJobStatusPayload): add description to the
1364 job status payload.
1365 (upstart_send_msg_to, upstart_recv_msg): Send and receieve the
1366 description over the wire.
1367 * upstart/control.h (UpstartJobStatusMsg): add a description field
1368 * upstart/tests/test_control.c: Update test cases.
1369 * init/control.c (control_handle): Include the job description in
1370 the message.
1371 (control_send): Copy the description when we put the message on
1372 the queue.
1373 (control_handle_job): Copy the description here too
1374 * init/tests/test_control.c: Update test cases.
1375
Scott James Remnant84f5e932006-08-27 18:49:25 +01001376 * init/job.c (job_list): Add a function to return the job list.
1377 * init/job.h: Update.
1378 * init/control.c (control_handle): Handle the JOB_LIST message
1379 by sending back a list of job status messages followed by the
1380 JOB_LIST_END message.
1381 * init/tests/test_control.c (test_watcher_child): Check the
1382 JOB_LIST message works properly.
1383
Scott James Remnantf4ad6d12006-08-27 18:40:01 +01001384 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Handle
1385 the JOB_LIST and JOB_LIST_END messages which have no payload.
1386 * upstart/control.h: Add enums and structures for job list messages.
1387 * upstart/tests/test_control.c (test_messages): Update tests.
1388
Scott James Remnantf4970812006-08-27 18:27:19 +01001389 * init/main.c (main): Check that we're both uid and process #1
1390
Scott James Remnantf43bdf32006-08-27 18:20:29 +01001391 * init/main.c (main): Stop handling SIGTERM, we never want people
1392 to kill init. Handle SIGINT and SIGWINCH through the ordinary
1393 handler and SIGSEGV through a direct handler.
1394 (segv_handler): Write a sensible core dump handler, we use a child
1395 to dump core while we carry on in the parent hopefully stepping over
1396 the bad instruction.
1397 (cad_handler): Generate the control-alt-delete event.
1398 (kbd_handler): Generate the kbdrequest event.
1399
Scott James Remnant33e64d02006-08-25 14:44:32 +020014002006-08-25 Scott James Remnant <scott@netsplit.com>
1401
Scott James Remnant21679252006-08-25 16:22:13 +02001402 * configure.ac: Bump version to 0.1.2
1403 * NEWS: Update.
1404
Scott James Remnantfef12b52006-08-25 16:16:45 +02001405 * TODO: Update.
1406
Scott James Remnant94d00982006-08-25 15:38:22 +02001407 * init/process.c (process_setup_environment): Inherit the PATH
1408 and TERM environment variables from the init process, so the
1409 console works properly.
1410 * init/process.h (PATH): Declare a default value for this variable
1411 * init/main.c (main): Set the value of PATH to the default.
1412 * init/tests/test_process.c (child): Update test case.
1413
Scott James Remnant33e64d02006-08-25 14:44:32 +02001414 * NEWS: Update.
1415 * configure.ac: Bump version to 0.1.1
1416
Scott James Remnant68ccc9e2006-08-24 00:10:41 +020014172006-08-24 Scott James Remnant <scott@netsplit.com>
1418
Scott James Remnant279d4352006-08-24 15:33:19 +02001419 * init/cfgfile.h (CFG_DIR): Change configuration directory to
1420 /etc/event.d -- it's not been used by anyone, but is similar to
1421 other directories that have which is a good precedent.
1422 * event.d/Makefile.am (eventdir, dist_event_DATA): Install files
1423 into the new directory name.
1424 * Makefile.am (SUBDIRS): Rename sub directory
1425 * configure.ac (AC_CONFIG_FILES): Rename generated Makefile
1426
Scott James Remnant937192c2006-08-24 02:57:50 +02001427 * init/Makefile.am (DEFAULT_INCLUDES): Set to include the right
1428 directories so out of tree builds work.
1429 * logd/Makefile.am (DEFAULT_INCLUDES): Set to include the right
1430 directories so out of tree builds work.
1431 * upstart/Makefile.am (DEFAULT_INCLUDES): Set to include the right
1432 directories so out of tree builds work.
1433 (upstartinclude_HEADERS): Install errors.h
1434 * util/Makefile.am (DEFAULT_INCLUDES): Set to include the right
1435 directories so out of tree builds work.
1436
1437 * Makefile.am (SUBDIRS): Add m4 to the list
1438 * configure.ac (AC_CONFIG_FILES): Generate m4/Makefile
1439 * upstart/Makefile.am (upstartinclude_HEADERS): Add errors.h
1440
1441 * upstart/control.c (upstart_open):
1442
Scott James Remnante4c3d552006-08-24 02:34:01 +02001443 * init/control.c (control_open): Raise the error before
1444 performing other actions so errno is not lost.
Scott James Remnant73550092006-08-24 02:27:03 +02001445
Scott James Remnante4c3d552006-08-24 02:34:01 +02001446 * TODO: Update.o
Scott James Remnantf8b776b2006-08-24 00:36:15 +02001447 * init/cfgfile.c (cfg_next_token): Don't count quote characters
1448 unless we're actually planning to dequote the file, otherwise we
1449 end up allocating short.
1450
Scott James Remnant9e17fc02006-08-24 00:28:10 +02001451 * init/control.c (control_close): Free the io_watch using list_free
1452 in case a destructor has been set.
1453 * init/tests/test_control.c: Initialise the type of the message, and
1454 free job correctly.
1455
Scott James Remnant68ccc9e2006-08-24 00:10:41 +02001456 * upstart/tests/test_control.c: Fix overwrite of buffer.
1457 * init/tests/test_job.c: Clean up not-freed job.
1458
Scott James Remnantc961ce32006-08-23 19:46:29 +020014592006-08-23 Scott James Remnant <scott@netsplit.com>
1460
Scott James Remnant013e9722006-08-23 23:00:14 +02001461 * init/tests/test_event.c: free the entry allocated and initialise
1462 the return values.
1463
Scott James Remnantc961ce32006-08-23 19:46:29 +02001464 * init/cfgfile.c (cfg_skip_token): Drop this function; we'll
1465 make sure *pos is pointing at the start of the thing we want
1466 to parse, not the first token. Update the other functions
1467 accordingly.
1468 (cfg_read_job): Implement function to look over a job file and
1469 parse all of the stanzas that are found. Also sanity checks the
1470 job afterwards and deals with reloading existing jobs.
1471 (cfg_job_stanza): Function that parses an individual stanza,
1472 calling out to the other parse functions; this is the main config
1473 file parser!
1474 (cfg_parse_args, cfg_parse_command): Drop requirement that filename
1475 and lineno be passed, so we can be called to reparse arguments after
1476 we've already done so.
1477 (cfg_parse_script): Remove requirement that it be called at the
1478 start of the entire stanza, and instead at the start of the script.
1479 When hitting EOF, return the script so far, not NULL.
1480 (cfg_parse_args): Correct bug where we didn't check sufficient
1481 characters while skipping whitespace.
1482 (cfg_next_token): Correct bug where we didn't copy the character
1483 after a slash into the text, instead of just not copying the slash.
1484 Adjust line numbers to match the fact that it's zero based now.
1485 * init/cfgfile.h: Define prototype.
1486 * init/tests/test_cfgfile.c (test_read_job): Pretty thoroughly
1487 test the config file parser code.
1488
Scott James Remnant0c58ed02006-08-22 11:42:19 +020014892006-08-22 Scott James Remnant <scott@netsplit.com>
1490
Scott James Remnant214168f2006-08-22 18:52:51 +02001491 * init/cfgfile.c (cfg_tokenise): Rename to cfg_next_token.
1492 (cfg_skip_token): Code to skip whitespace, token and whitespace.
1493 (cfg_parse_args): Function to parse an argument list.
1494 (cfg_next_token): Extend to support the removal of quotes and
1495 slashes from the token.
1496
Scott James Remnant21590a22006-08-22 17:40:48 +02001497 * init/cfgfile.c (cfg_parse_script): Pass filename and lineno and
1498 increment the latter as we go.
1499 (cfg_script_end): Pass and increment lineno.
1500
Scott James Remnanteed2e8d2006-08-22 17:31:07 +02001501 * init/cfgfile.c: Correct a missing semi-colon in prototypes.
1502 (cfg_parse_command): Function to parse any stanza that requires
1503 a command and arguments list, e.g. exec/respawn/daemon. We don't
1504 want to require that the list be quoted, etc. and do want to allow
1505 it to be folded over lines.
1506 (cfg_tokenise): Function used by the above to tokenise the file,
1507 handling things like \, quoted strings and newlines, etc. Can be
1508 used both to determine the length of the token and to copy it.
1509
Scott James Remnantfcc98ad2006-08-22 12:28:19 +02001510 * init/cfgfile.c (cfg_read_script): Rename to cfg_parse_script.
1511
Scott James Remnantfd32dd32006-08-22 11:46:01 +02001512 * init/cfgfile.c (cfg_read_script): Function to parse a script
1513 fragment ("foo script\n....end script\n") from the job file, which
1514 is the most complex form we can find. Write it assuming the file is
1515 in a character array which may not be NULL terminated (ie. a mmap'd
1516 file).
1517 (cfg_script_end): Used by the above to detect the end of the
1518 fragment.
1519 * init/cfgfile.h: Empty header file.
1520 * init/Makefile.am (init_SOURCES): Build and link cfgfile.c
1521 using the cfgfile.h header
1522 (TESTS): Build and run the config file test cases.
1523 (test_cfgfile_SOURCES, test_cfgfile_LDFLAGS, test_cfgfile_LDADD):
1524 Details for config file test case binary.
1525
Scott James Remnant0c58ed02006-08-22 11:42:19 +02001526 * init/main.c (main): Remove the calls to the unfinished config
1527 file code.
1528
Scott James Remnant6ce44812006-08-21 08:46:32 +020015292006-08-21 Scott James Remnant <scott@netsplit.com>
1530
Scott James Remnant027dd7b2006-08-21 09:01:25 +02001531 * init/main.c: Add missing include for unistd.h
1532 * init/process.c (process_setup_console): Drop use of job.
1533 * util/initctl.c (main): Check that we're run as root.
1534
Scott James Remnant77e8db32006-08-21 08:47:50 +02001535 * init/main.c (main): Write the main function
1536
Scott James Remnant6ecceb82006-08-21 08:47:23 +02001537 * init/event.c (event_queue_cb): Rename to event_queue_run.
1538 * init/event.h: Update.
1539
Scott James Remnant6ce44812006-08-21 08:46:32 +02001540 * init/process.c (process_setup_console): Become an exported
1541 function that includes the code to reset a console.
1542
Scott James Remnant5befd932006-08-19 19:24:54 +010015432006-08-19 Scott James Remnant <scott@netsplit.com>
1544
Scott James Remnantcd39a7c2006-08-19 20:02:17 +01001545 * logd/main.c (main): Write the basic main function.
1546
Scott James Remnant3bcd15e2006-08-19 19:50:12 +01001547 * util/initctl.c (main): Fill in the details to give us a basic
1548 test client.
1549
Scott James Remnant3dc965c2006-08-19 19:25:23 +01001550 * TODO: Update.
1551
Scott James Remnant5befd932006-08-19 19:24:54 +01001552 * util/initctl.c (main): Provide the most basic main function.
1553 * util/Makefile.am (sbin_PROGRAMS): Build the initctl binary
1554 * Makefile.am (SUBDIRS): Build the utilities.
1555 * configure.ac (AC_CONFIG_FILES): Generate the util Makefile.
1556
Scott James Remnant1fe38a82006-08-18 17:06:25 +010015572006-08-18 Scott James Remnant <scott@netsplit.com>
1558
Scott James Remnantc2659612006-08-18 22:19:47 +01001559 * init/Makefile.am (test_job_LDADD): Remove the duplicate link.
1560
Scott James Remnantd5e07052006-08-18 20:39:30 +01001561 * TODO: Update.
1562
Scott James Remnanta060bb72006-08-18 20:16:55 +01001563 * init/job.c (job_handle_child): Rename to job_child_reaper.
1564 * init/job.h: Update.
1565 * init/tests/test_job.c: Update function names.
1566
Scott James Remnant829dc082006-08-18 20:10:02 +01001567 * init/control.c (control_cb): Rename to control_watcher
1568 * init/tests/test_control.c: Update function names.
1569
Scott James Remnantddc3e282006-08-18 18:49:50 +01001570 * TODO: Update.
1571
Scott James Remnantc2cac3f2006-08-18 17:17:57 +01001572 * Makefile.am (SUBDIRS): Install the rc.d files.
1573 * configure.ac (AC_CONFIG_FILES): Generate the rc.d Makefile.
1574 * rc.d/Makefile.am (rcdir): Define rcdir to be /etc/rc.d
1575 (dist_rc_DATA): Install the logd file into that directory.
1576 * rc.d/logd: Write a simple service definition for the log daemon,
1577 this saves us hardcoding any information about it into init; it'll
1578 just need to know the name.
1579
Scott James Remnant1fe38a82006-08-18 17:06:25 +01001580 * Makefile.am (SUBDIRS): Build the logd daemon
1581 * configure.ac (AC_CONFIG_FILES): Generate the logd Makefile.
1582 * logd/Makefile.am (sbin_PROGRAMS): Install the logd binary into
1583 the sbin directory by default.
1584 (logd_SOURCES): Build and link main.c
1585 * logd/main.c (main): Add basic main function for testing purposes.
1586
Scott James Remnantb9814432006-08-16 02:11:51 +010015872006-08-16 Scott James Remnant <scott@netsplit.com>
1588
Scott James Remnantc5da6fd2006-08-16 18:06:49 +01001589 * init/job.c (job_start): Ignore self-dependencies; over-document
1590 why the dependency event prodding has a surprise in its tail.
1591 (job_change_state): Move the job_release_depends call to here.
1592
Scott James Remnant133a7a32006-08-16 17:45:51 +01001593 * init/event.c (event_queue_cb): Add event consumer/dispatcher.
Scott James Remnant13e5dbf2006-08-16 17:48:01 +01001594 * init/event.h: Update.
Scott James Remnant133a7a32006-08-16 17:45:51 +01001595
Scott James Remnant3772bc62006-08-16 17:41:34 +01001596 * init/control.c (control_send): Make the event code clearer.
1597 (control_handle): Handle the changed event semantics.
1598 (control_handle_event): Issue the new event type.
1599 * init/tests/test_control.c: Update tests.
1600
Scott James Remnantcaee5b52006-08-16 17:32:12 +01001601 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Adjust
1602 marshal code to match.
1603 * upstart/control.h: Update all structures appropriately to the
1604 previous changes.
1605 * upstart/tests/test_control.c: Update.
1606
Scott James Remnant4d4389d2006-08-16 17:19:20 +01001607 * init/job.c (job_change_state): Change call to event_trigger_level
1608 to event_queue_level.
1609
Scott James Remnant51664d72006-08-16 17:17:58 +01001610 * init/event.c (event_trigger_edge, event_trigger_level): Place
1611 the event on the event_queue rather than directly triggering it.
1612 Rename to event_queue_edge and event_queue_level respectively.
1613 * init/event.h: Update.
1614 * init/tests/test_event.c: Update test cases.
1615
Scott James Remnant4ddc86e2006-08-16 16:17:48 +01001616 * init/job.c (job_handle_event): Add another sanity check, jobs
1617 should not be able to react to their own events; that's just silly.
1618 * init/tests/test_job.c (test_handle_event): Check that the new
1619 condition does the right thing.
1620
Scott James Remnant930f3e02006-08-16 16:13:03 +01001621 * init/job.c (job_change_state): Make it illegal for a job to exist
1622 without either a command or script or both. This is for sanity
1623 reasons, allowing no primary process makes no sense and can lead
1624 to event loops if someone is feeling nefarious.
1625 * init/tests/test_job.c (test_change_state): Drop test on behaviour
1626 we've just outlawed.
1627
Scott James Remnant7dd047e2006-08-16 13:43:50 +01001628 * init/job.c (job_start): Only announce the change if we're still
1629 in the waiting state, we could have moved on to running already.
1630
Scott James Remnantf9261ba2006-08-16 13:40:05 +01001631 * init/job.c (job_start): If holding the job, at least announce
1632 the goal change to subscribed clients.
1633
Scott James Remnant853cc772006-08-16 13:34:51 +01001634 * TODO: Update.
1635
Scott James Remnantfdb82592006-08-16 13:31:49 +01001636 * init/job.c (job_start): Check for dependencies before starting
1637 the process, if we have any that aren't running we stay in waiting
1638 until they are. Any that aren't even starting get poked with a
1639 dependency event to see whether that wakes them up.
1640 * init/tests/test_job.c (test_start): Test paths through new
1641 dependency code.
1642
Scott James Remnant278150a2006-08-16 12:56:34 +01001643 * init/job.c (job_run_process): Once we've got an active process
1644 in the running state, release our dependencies.
1645
Scott James Remnant6d4104d2006-08-16 12:50:39 +01001646 * init/job.c (job_release_depends): Function to release any waiting
1647 dependencies on the given job.
1648 * init/job.h: Update.
1649 * init/tests/test_job.c (test_release_depends): Test the behaviour
1650 of the function on its own.
1651
Scott James Remnant1da1dad2006-08-16 12:18:50 +01001652 * init/job.h (Job): Add depends list field
1653 (JobName): New structure to hold the name of a job.
1654 * init/job.c (job_new): Initialise the depends list.
1655 * init/tests/test_job.c (test_new): Make sure the depends list is
1656 initialised properly.
1657
Scott James Remnant37eee032006-08-16 12:10:49 +01001658 * init/job.c (job_next_state): Return JOB_STARTING if we're in
1659 JOB_WAITING and the goal is JOB_START. This is only called when
1660 there's some change, and I don't want to hard-code the goal there.
1661 (job_start): Don't hardcode JOB_STARTING, instead just use the next
1662 state.
1663 * init/tests/test_job.c (test_next_state): Adjust test case.
1664
Scott James Remnantc3d3ead2006-08-16 09:00:50 +01001665 * init/control.c (control_subscribe): Allow the current
1666 subscription to be found by passing NOTIFY_NONE.
1667 (control_handle): Don't remove an existing subscription to jobs,
1668 a GUI will probably want a permanent one to keep the status up to
1669 date.
1670
Scott James Remnantb9a568c2006-08-16 08:57:46 +01001671 * init/job.c (job_kill_process, job_kill_timer): Don't hardcode
1672 JOB_STOPPING here, instead move to the next logical state.
1673 (job_kill_process): Notify subscribed processes that we killed
1674 the job.
1675 (job_start, job_stop): Notify subscribed processes of a change of
1676 goal that doesn't result in an immediate state change.
1677
Scott James Remnant8dbc6012006-08-16 08:57:38 +01001678 * init/event.c (event_trigger_edge, event_trigger_level): Swap
1679 order so that events are announced before processed.
1680
Scott James Remnant28161252006-08-16 08:41:48 +01001681 * init/control.c (control_handle): Handle requests to watch and
1682 unwatch jobs and events.
1683 * init/tests/test_control.c (test_cb_child, test_cb): Check that
1684 subscriptions work.
1685
Scott James Remnantb6d55bf2006-08-16 08:24:16 +01001686 * init/tests/test_control.c (test_cb_child): Add a sleep to avoid
1687 a race that upsets gdb, have tried this with a STOP/CONT interlock
1688 but can't seem to find where the child should reach first.
1689
Scott James Remnant5612b232006-08-16 08:21:06 +01001690 * init/job.c (job_change_state): Notify the control handler.
1691 * init/event.c (event_trigger_edge, event_trigger_level): Pass
1692 event to the control handler.
1693 * init/tests/test_control.c (test_cb_child): Expect to receive
1694 job status events as well.
1695 * init/Makefile.am (test_event_LDADD, test_process_LDADD)
1696 (test_job_LDADD): Add control.o to the linkage.
1697
Scott James Remnant9e0626a2006-08-16 08:17:07 +01001698 * init/control.c (control_cb): Don't display an error for
1699 ECONNREFUSED, just remove any subscriptions.
1700 * init/tests/test_control.c (test_handle_job, test_handle_error):
1701 Clean up our subscriptions properly.
1702
Scott James Remnant3c465c82006-08-16 07:40:24 +01001703 * init/control.c (control_handle_job): Function to send out an
1704 UPSTART_JOB_STATUS message to subscribed processes whenever a
1705 job state changes.
1706 (control_handle_event): Function to send out an
1707 UPSTART_EVENT_TRIGGERED message to subscribed processes whenever
1708 an event is triggered.
1709 * init/control.h: Update.
1710 * init/tests/test_control.c (test_handle_job, test_handle_event):
1711 Check that the functions work properly.
1712
Scott James Remnant16dadc52006-08-16 07:27:40 +01001713 * init/control.c (control_handle): Handle messages that trigger
1714 edge and level events; subscribe the process to receive notification
1715 of job changes during the event.
1716 * init/tests/test_control.c (test_cb_child): Check that the messages
1717 are handled properly (without subscription check).
1718
Scott James Remnanta7ba72a2006-08-16 07:11:30 +01001719 * init/control.c (control_cb): Unsubscribe a process if it stops
1720 listening.
1721
Scott James Remnant2c9669c2006-08-16 07:10:05 +01001722 * init/control.c (control_send): Copy the pointers in the new
1723 event messages.
1724 * init/tests/test_control.c (test_send): Check the pointers are
1725 copied across correctly.
1726
Scott James Remnant15d61c62006-08-16 06:55:58 +01001727 * init/control.c (control_subscribe): Add function to handle
1728 processes that want to subscribe to changes.
1729 (control_init): Initialise the subscriptions list.
1730 * init/control.h: Add structures and prototypes.
1731 * init/tests/test_control.c (test_subscribe): Test the function.
1732
Scott James Remnant8692f762006-08-16 06:21:13 +01001733 * upstart/control.h (UpstartMsgType): add messages for triggering
1734 edge and level events, receiving the trigger for an event and for
1735 watching jobs and events.
1736 (UpstartEventTriggerEdgeMsg, UpstartEventTriggerLevelMsg)
1737 (UpstartEventTriggeredMsg, UpstartWatchJobsMsg)
1738 (UpstartUnwatchJobsMsg, UpstartWatchEventsMsg):
1739 (UpstartUnwatchEventsMsg): Add structures for the new messages.
1740 (UpstartMsg): And add them to the union.
1741 * upstart/control.c (WireEventPayload): The event messages can all
1742 share a wire payload type; the watch messages don't need any special
1743 payload.
1744 (upstart_send_msg_to): Add the payloads onto the wire.
1745 (upstart_recv_msg): And take the payloads back off the wire.
1746 * upstart/tests/test_control.c (test_messages): Test the new
1747 message types.
1748
Scott James Remnant8ed97eb2006-08-16 05:46:44 +01001749 * upstart/control.h (UpstartJobStatusMsg): add a process id.
1750 * upstart/control.c (WireJobStatusPayload): and here too.
1751 (upstart_send_msg_to): copy the process id onto the wire.
1752 (upstart_recv_msg): copy the process id from the wire.
1753 * init/control.c (control_handle): Fill in the pid from the job.
1754 * upstart/tests/test_control.c (test_messages): Check the pid gets
1755 passed across the wire properly.
1756
Scott James Remnant7d914312006-08-16 05:37:50 +01001757 * init/control.c (control_cb): Disable the poll for write once the
1758 send queue becomes empty.
1759
Scott James Remnant59707c22006-08-16 05:32:20 +01001760 * upstart/Makefile.am (libupstart_la_SOURCES): Correct ordering.
1761
Scott James Remnanta98c8b82006-08-16 05:32:02 +01001762 * init/control.c (control_handle): Add missing break.
1763
Scott James Remnantb5c7a302006-08-16 05:24:55 +01001764 * upstart/job.c (job_goal_name, process_state_name): For completeness
1765 add these two functions as well.
1766 * upstart/job.h: Update.
1767 * upstart/tests/test_job.c (test_goal_name)
1768 (test_process_state_name): Test the new functions.
1769
Scott James Remnant20b15ad2006-08-16 05:20:02 +01001770 * init/job.c (job_state_name): Move this utility function from here
1771 * upstart/job.c (job_state_name): to here so all clients can use
1772 it.
1773 * init/job.h: Update.
1774 * upstart/job.h: Update.
1775 * init/tests/test_job.c (test_state_name): Move the test case from here
1776 * upstart/tests/test_job.c: to here as well.
1777 * upstart/Makefile.am (libupstart_la_SOURCES): Build and link job.c
1778 (TESTS): Run the job test cases
1779 (test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for
1780 job test case binary.
1781 * init/Makefile.am (test_job_LDADD, test_process_LDADD)
1782 (test_event_LDADD): Link to libupstart.la
1783
Scott James Remnant7a5c6672006-08-16 05:01:13 +01001784 * init/control.c: Code to handle the server end of the control
1785 socket, a bit more complex than a client as we want to avoid
1786 blocking on malcious clients.
1787 * init/control.h: Prototypes.
1788 * init/tests/test_control.c: Test the control code.
1789 * init/Makefile.am (init_SOURCES): Build and link control.c
1790 using the control.h header
1791 (init_LDADD): Link to libupstart as well
1792 (TESTS): Build and run the control test suite.
1793 (test_control_SOURCES, test_control_LDFLAGS, test_control_LDADD):
1794 Details for control test suite binary.
1795
Scott James Remnantb7cbda52006-08-16 04:53:38 +01001796 * upstart/control.c: Add a way to disable the safety checks.
1797 * upstart/tests/test_control.c (test_free): Fix bad test case.
1798
Scott James Remnant71d4d842006-08-16 04:29:21 +01001799 * upstart/control.c (upstart_recv_msg): fixed bogus return type
1800 for recvmsg from size_t to ssize_t so we don't infiniloop on error.
1801
Scott James Remnant2bda3832006-08-16 03:41:10 +01001802 * upstart/control.c (upstart_send_msg_to, upstart_recv_msg): Avoid
1803 job_start as the short-cut for assigning name, as that might become
1804 a more complex message eventually. Use job_query instead.
1805
Scott James Remnantd154b952006-08-16 03:39:35 +01001806 * upstart/control.c (upstart_free): Add wrapper function around
1807 nih_free so we're a proper library and don't expose libnih too much
1808 (upstart_recv_msg): Stash the sender pid in an argument.
1809 * upstart/control.h: Update.
1810 * upstart/tests/test_control.c (test_recv_msg): Test pid is
1811 returned properly.
1812 (test_free): Test the nih_free wrapper.
1813
Scott James Remnantdc0eb442006-08-16 02:40:29 +01001814 * init/job.c (job_run_script): Document future FIXME.
1815
Scott James Remnant2f558532006-08-16 02:24:55 +01001816 * init/exent.h, init/job.h, init/process.h: Fix up headers.
1817
Scott James Remnant45aab692006-08-16 02:23:27 +01001818 * upstart/control.c, upstart/control.h, upstart/errors.h,
1819 upstart/job.h, upstart/libupstart.h: Fix up headers.
1820
Scott James Remnant8c16cc82006-08-16 02:13:40 +01001821 * upstart/control.c: Write the code to handle the control socket
1822 and communication over it; turns out this was possible to write so
1823 that both ends are handled in the same code.
1824 * upstart/control.h: Structures and prototypes.
1825 * upstart/tests/test_control.c: Test the new code.
1826
Scott James Remnant729d9222006-08-16 02:12:23 +01001827 * upstart/Makefile.am (libupstart_la_LIBADD): Link to libnih
1828
Scott James Remnantb9814432006-08-16 02:11:51 +01001829 * upstart/errors.h: Header file containing errors raised by
1830 libupstart.
1831 * upstart/libupstart.h: Include errors.h
1832
Scott James Remnant342451a2006-08-15 00:08:20 +010018332006-08-15 Scott James Remnant <scott@netsplit.com>
1834
Scott James Remnant0a8e3472006-08-15 23:54:14 +01001835 * init/event.h: Add missing attribute for event_new()
1836
Scott James Remnant6f128872006-08-15 23:54:05 +01001837 * init/job.h (JobGoal, JobState, ProcessState, ConsoleType): Move
1838 the enums from here
1839 * upstart/job.h: into here so that we can use them across the
1840 control socket.
1841
Scott James Remnante5831792006-08-15 21:46:21 +01001842 * Makefile.am (SUBDIRS): Build the libupstart library
1843 * configure.ac (AC_CONFIG_FILES): Generate upstart/Makefile
1844 * upstart/Makefile.am: Makefile for sub-directory
1845 * upstart/libupstart.ver: Linker version script.
1846 * upstart/libupstart.h: "Include everything" header file.
1847
Scott James Remnant26a8eec2006-08-15 05:46:27 +01001848 * TODO: Update.
1849
Scott James Remnant1f8619c2006-08-15 05:45:38 +01001850 * init/job.c (job_handle_child): Warn when processes are killed
1851 or exit with an abnormal status. Warn when respawning.
1852
Scott James Remnanteb5ad272006-08-15 05:43:05 +01001853 * init/job.c (job_handle_child): Respawn processes that were not
1854 supposed to have died.
1855 * init/tests/test_job.c (test_handle_child): Test the respawn code.
1856
Scott James Remnant77c926d2006-08-15 05:22:08 +01001857 * TODO: Update.
1858
Scott James Remnant429cd672006-08-15 05:09:51 +01001859 * init/event.c (event_trigger_edge, event_trigger_level): Call
1860 job_handle_event so that we actually do something useful.
1861 * init/Makefile.am (test_event_LDADD): Link to process.o and job.o
1862 now that event.c calls code from job.
1863
Scott James Remnant355e1b62006-08-15 05:07:24 +01001864 * init/job.c (job_start_event): Function to start a job if an event
1865 matches.
1866 (job_stop_event): Function to stop a job if an event matches.
1867 (job_handle_event): Iterate the job list and dispatch the given event,
1868 causing jobs to be stopped or started using the above two functions.
1869 * init/job.h: Update.
1870 * init/tests/test_job.c: Test the new functions.
1871
Scott James Remnant923400d2006-08-15 04:27:44 +01001872 * init/job.c (job_new): Initialise start_events and stop_events to
1873 an empty list.
1874 * init/job.h (Job): Add start_events and stop_events list heads.
1875 * init/tests/test_job.c (test_new): Check the lists are initialised
1876 correctly to the empty list.
1877
Scott James Remnant865534f2006-08-15 04:22:06 +01001878 * init/event.c (event_match): Function to check events for equality.
1879 * init/event.h: Update.
1880 * init/tests/test_event.c (test_match): Test function.
1881
Scott James Remnant97137a72006-08-15 04:07:08 +01001882 * init/job.c (job_change_state): Trigger the level event with the
1883 same name as the job, with the value taken from the state.
1884 * init/tests/test_job.c (test_change_state): Check the event
1885 gets set to the right values as we go.
1886 * init/Makefile.am (test_job_LDADD, test_process_LDADD): Link to
1887 event.o now that job.c uses code from there.
1888
Scott James Remnant3b35a522006-08-15 04:01:32 +01001889 * init/event.c (event_change_value): Rename event_set_value to this
1890 as we intended in the first place; makes it more consistent with job.
1891 Always change the value.
1892 (event_trigger_edge): Add a high-level function to trigger an edge
1893 event.
1894 (event_trigger_level): And another to trigger a level event with
1895 a given value, this inherits the "don't change it" functionality
1896 that was in event_set_value.
1897 * init/event.h: Update.
1898 * init/tests/test_event.c: Test new behaviours and functions.
1899
Scott James Remnant4fef0732006-08-15 01:45:02 +01001900 * init/event.c: Add simple code to keep track of events, whether
1901 they have been recorded or not and their current value if any.
1902 * init/event.h: Structures and prototypes.
1903 * init/tests/test_event.c: Test cases for event code.
1904 * init/Makefile.am (init_SOURCES): Build and link event.c using event.h
1905 (TESTS): Run the event test suite.
1906 (test_event_SOURCES, test_event_LDFLAGS, test_event_LDADD): Details
1907 for event test suite binary.
1908
Scott James Remnant38fc8ff2006-08-15 00:43:26 +01001909 * init/job.c (job_run_process, job_kill_process, job_kill_timer):
1910 Downgrade error messages to warning as they're not fatal.
1911 (job_change_state): Change info message to be more regular.
1912
Scott James Remnantf033fb02006-08-15 00:37:33 +01001913 * init/job.c (job_start): A very simple, but very necessary, function.
1914 Set the goal of the given job to JOB_START and kick it off.
1915 (job_stop): And its companion, cause a running job to be stopped.
1916 * init/job.h: Update.
1917 * init/tests/test_job.c: Test the functions.
1918
Scott James Remnant342451a2006-08-15 00:08:20 +01001919 * init/job.c (job_handle_child): Child handler to kick jobs into
1920 the next state when their process dies.
1921 * init/job.h: Update.
1922 * init/tests/test_job.c (test_handle_child): Test the handler
1923 directly by just invoking it with various job states.
1924
Scott James Remnant1c463b92006-08-14 14:46:17 +010019252006-08-14 Scott James Remnant <scott@netsplit.com>
1926
Scott James Remnant51c827d2006-08-14 23:06:00 +01001927 * init/tests/test_process.c (test_kill): Use select rather than
1928 poll for consistency with other test cases.
1929
Scott James Remnante6e4a732006-08-14 23:04:53 +01001930 * init/job.c (job_kill_process): Add function to send the active
1931 process of a job the TERM signal, and then set a timer to follow
1932 up with the KILL signal if the job doesn't get cleaned up in time.
1933 (job_kill_timer): Timer callback to send the KILL signal; this
1934 does the same job as the child handler and puts the job into the
1935 next state as there's no point waiting around now.
1936 * init/job.h: Update.
1937 * init/tests/test_job.c (test_kill_process): Test both functions
1938 in one test case (as one is just the bottom half of the other).
1939
Scott James Remnant6868f652006-08-14 21:42:45 +01001940 * init/tests/test_process.c (test_spawn): Use the right thing in
1941 the test case filename and unlink it to make sure.
1942
Scott James Remnant85df9422006-08-14 21:41:39 +01001943 * init/job.c (job_change_state): Write the principal state gate
1944 function, called once a state has been left to enter the given new
1945 state (which one should determine with job_next_state). Spawns
1946 the necessary processes or moves to the next appropriate state.
1947 * init/job.h: Update.
1948 * init/tests/test_job.c: Test the state changes.
1949
Scott James Remnantba44b8b2006-08-14 20:06:28 +01001950 * init/job.c (job_run_process): Internal function to call
1951 process_spawn and update the job structure.
1952 (job_run_command): Simple(ish) wrapper for the above to split
1953 a command by whitespace, or use a shell if it needs more complex
1954 argument processing.
1955 (job_run_script): More complex wrapper that uses a shell to execute
1956 verbatim script, either using -c or a /dev/fd/NN and feeding the
1957 shell down a pipe to it.
1958 * init/job.h: Update.
1959 * init/tests/test_job.c: Test the new functions.
1960
Scott James Remnant156f5482006-08-14 19:09:55 +01001961 * init/Makefile.am (init_SOURCES, TESTS): Reorder so that process.c,
1962 which is arguably lower level, comes first.
1963 (test_job_LDADD): Link the process code.
1964 (test_process_LDADD): Swap the order.
1965
Scott James Remnant00bcc932006-08-14 19:07:28 +01001966 * TODO: Update.
1967
Scott James Remnant1c463b92006-08-14 14:46:17 +01001968 * init/process.c (process_spawn): Correct typo (progress -> process),
1969 thanks Johan.
1970
Scott James Remnant43534ca2006-08-12 14:52:01 +010019712006-08-12 Scott James Remnant <scott@netsplit.com>
1972
Scott James Remnant3030cc22006-08-12 15:18:55 +01001973 * init/process.c (process_spawn): Correct formatting of function.
1974 * init/process.h (SHELL): Define the location of the shell, all in
1975 the spirit of not hard-coding stuff like this.
1976
Scott James Remnant43534ca2006-08-12 14:52:01 +01001977 * init/job.c (job_new): Initialise all structure members to zero
1978 as this doesn't happen automatically.
1979
Scott James Remnant60b03e32006-08-10 00:59:00 +010019802006-08-10 Scott James Remnant <scott@netsplit.com>
1981
1982 * init/job.h (job_state_name): Declare as a const function.
1983
Scott James Remnant143a8572006-08-09 17:37:00 +010019842006-08-09 Scott James Remnant <scott@netsplit.com>
1985
Scott James Remnantd945d2e2006-08-09 23:47:44 +01001986 * init/job.c (job_next_state): State transition logic; this uses
1987 our departure from the specification (the goal) so that the state
1988 can always be currently accurate rather than suggestive.
1989 (job_state_name): Cute function to convert enum into a name.
1990 * init/job.h: Update.
1991 * init/tests/test_job.c (test_next_state): Test the transitions.
1992 (test_state_name): And the return values.
1993
Scott James Remnant5fa15672006-08-09 23:23:17 +01001994 * TODO: Add file to keep track of things.
1995
Scott James Remnantdbc78612006-08-09 23:22:45 +01001996 * init/job.c: Include nih/macros.h and nih/list.h
1997 * init/process.c: Include order fixing, include nih/macros.h
1998 * init/tests/test_job.c: Include nih/macros.h and nih/list.h
1999 * init/tests/test_process.c: Include nih/list.h
2000
Scott James Remnant03853ed2006-08-09 23:11:59 +01002001 * init/job.c: Include order fixing.
2002 (job_find_by_name): Function to find a job by its (unique) name.
2003 (job_find_by_pid): Function to find a job by the pid of its process.
2004 * init/job.h: Update.
2005 * init/tests/test_job.c (test_find_by_name, test_find_by_pid): Test
2006 new functions.
2007
Scott James Remnant143a8572006-08-09 17:37:00 +01002008 * init/process.c (process_spawn): Spawn a process using the job
2009 details to set up the environment, etc.
2010 (process_setup_console): Set up the console according to the job.
2011 (process_setup_limits): Set up the limits according to the job.
2012 (process_setup_environment): Set up the environment according to
2013 the job.
2014 (process_kill): Simple function to send a kill signal or raise an
2015 error; mostly just a wrapper without any particular logic.
2016 * init/process.h: Prototypes and macros.
2017 * init/tests/test_process.c: Test cases.
2018 * init/Makefile.am (init_SOURCES): Build and link process.c and
2019 its header file.
2020 (TESTS): Run the process test suite.
2021 (test_process_SOURCES, test_process_LDFLAGS, test_process_LDADD):
2022 Details for process test sutie binary.
2023
Scott James Remnant29abda02006-08-08 15:01:24 +010020242006-08-08 Scott James Remnant <scott@netsplit.com>
2025
Scott James Remnant31ee2632006-08-08 15:06:02 +01002026 * init/job.c (job_new): nih_list_free is necessary.
2027 * init/tests/test_job.c (test_new): Free job when done.
2028
Scott James Remnant29abda02006-08-08 15:01:24 +01002029 * init/job.h: Header file to contain the definition of the Job
2030 structure and associated typedefs, etc.
2031 (JobGoal): In a divergence from the specification, we introduced a
2032 "goal" for a job which tells us which way round the state machine
2033 we're going (towards start, or towards stop).
2034 (JobState): Which means this always holds the current state, even
2035 if we're trying to get out of this state (ie. if we've sent the TERM
2036 signal to the running process, we're still in the running state until
2037 it's actually been reaped).
2038 (ProcessState): And in another divergence, we keep the state of the
2039 process so we know whether we need to force a state transition or
2040 can just expect one because something transient is happening.
2041 * init/job.c (job_new): Function to allocate a Job structure, set
2042 the pointers to NULL and other important members to sensible
2043 defaults.
2044 (job_init): Initialise the list of jobs.
2045 * init/tests/test_job.c: Test suite.
2046 * init/Makefile.am (init_SOURCES): Compile and link job.c using
2047 its header file.
2048 (TESTS): Run the job test suite.
2049 (test_job_SOURCES, test_job_LDFLAGS, test_job_LDADD): Details for the
2050 job test suite binary.
2051
Scott James Remnantb933bc92006-08-02 02:29:25 +010020522006-08-02 Scott James Remnant <scott@netsplit.com>
2053
Scott James Remnant6c7667a2006-08-02 02:43:12 +01002054 * configure.ac: Check for C99
2055
Scott James Remnantb933bc92006-08-02 02:29:25 +01002056 * HACKING: Document dependency on libnih.
2057
Scott James Remnanta780d6c2006-07-27 18:40:51 +010020582006-07-27 Scott James Remnant <scott@netsplit.com>
2059
2060 * init/Makefile.am (DEFS): Append to the default DEFS list, rather
2061 than overriding, otherwise we lose HAVE_CONFIG_H
2062
Scott James Remnantb6270dd2006-07-13 02:16:38 +010020632006-07-13 Scott James Remnant <scott@netsplit.com>
2064
Scott James Remnant1bb35142006-07-13 02:30:58 +01002065 * HACKING: Correct incorrect Bazaar URL.
2066
Scott James Remnantb6270dd2006-07-13 02:16:38 +01002067 * AUTHORS: Change e-mail address to ubuntu.com.
2068 * HACKING: Update Bazaar and Release URLS.
2069 * configure.ac (AC_COPYRIGHT): Change copyright to Canonical Ltd.
2070 (AC_INIT): Change bug submission address to Launchpad.
2071 * init/main.c: Update header to use Canonical copyright and
2072 credit me as author.
2073
Scott James Remnant50748842006-05-16 21:02:31 +010020742006-05-16 Scott James Remnant <scott@netsplit.com>
2075
2076 * init/main.c: Add the simplest template main.c
2077 * init/Makefile.am: Add template Makefile.am that builds init from
2078 main.c and links to libnih statically
2079 * configure.ac (AC_CONFIG_FILES): Configure nih and init subdirs.
2080 * Makefile.am (SUBDIRS): Recurse into nih and init subdirs.
2081
Scott James Remnant8a0cd072006-05-14 18:28:58 +010020822006-05-14 Scott James Remnant <scott@netsplit.com>
2083
2084 * ChangeLog: Initial project infrastructure created.