Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.


Events are currently simple strings without any further details. This specification proposes extended the event structure to contain arguments and environment variables, and how those are matched in and delivered to jobs.


While the current event allows for simple things such as "control alt delete pressed" and "battery critical", it does not allow for events such as "block device hda1 added". This is greatly desirable to receive events from things like udev and ifupdown.

Use cases


The scope of this specification is limited to the content of the event structure, the matching of that structure and how we intend for that to be exposed to jobs. The actual implementation of associating jobs with events is described in the GoalChangeEvent specification.







Code changes are primarily limited to init/event.c and init/event.h.

The Event structure will be redefined as:

Both of these lists will be NULL-terminated as in other places in upstart.

The event_match function will be extended to compare arguments of both events, allowing arguments to be present in the first event that are not present in the second event. The configuration file parsing code will need to accept multiple arguments to the start on and stop on stanzas.

In order for the event name and environment to be exposed to the job processes, process_setup_environment in init/process.c will be extended to seed the appropriate variables from the job's goal change event (set as defined by GoalChangeEvent).

Arguments will be passed by modifying job_run_script in init/job.c to append the arguments to the script command run. Optionally we may also extend job_run_command so that if a shell is used, the arguments are also appended to that.

libupstart will be modified to include arguments and environment variables in the UPSTART_EVENT_QUEUE command.

emit_action in util/initctl.c will need to be modified to read further arguments and options from the command line, and seed the libupstart command appropriately.

Data preservation and migration

These changes are backwards compatible with the previous behaviour.


EventStructure (last edited 2006-11-29 12:50:43 by scott)