alias stanza wip patch

James Hunt james.hunt at canonical.com
Thu Jun 16 18:53:00 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mark,

On 15/06/11 01:02, Marc - A. Dahlhaus wrote:
> Hi List,
> 
> this is a first and for now only compile-tested draft of the alias stanza.
> Tests for the stanza are missing.
> The code for the alias stanza parsing is a copy of the one for the emits stanza.
> The testsuite of a patched 1.3 runs fine (exept for the X11 dependent tests as my box has no X11 running).
> 
> I'm unshure if the handling of blocked events with an alias configured works in this draft version, i'm still reading the code path of event.c and try to check if i'm not overlooking something.
> 
> Currently i add all blocking aliases to the main jobs blocking queue/list and hope that the catch in the event_poll loop works out as expected.
> I think there is a call to event_block missing for every alias event.
> I still have to check out how the whole blocking event chain code works...
> 
> Thanks,
> 
> Marc
> 
Thanks very much for this. One minor comment:

* init/job.c: job_emit_event(): Maybe "blocked_alias" would be easier to read than "blockedalias".

What we're also going to need I think is a global hash to map alias names to actual job names to
allow for the "start display-mananager" syntax to work. Essentially every place a job name can be
specified via initctl, we should also accept an alias name. Ignoring initctl for now, maybe
something like:


typedef struct job_alias {
    NihList   entry;
    char     *name;    /* alias name */
    Session  *session;
    NihList   aliases; /* NihListEntry pointers to JobClass objects */
} JobAlias;

NihHash job_aliases;


Then, when a request comes in to start "display-manager", control_get_job_by_name() can quickly find
the (hopefully) single match for "display-manager" in job_aliases and start a "gdm" Job instance (say).

Questions:

- - What if multiple .conf files *do* contain the same alias name? Even though this isn't legit, we
need to ensure we handle the scenario.
- - What if a job defines an alias for an existing job name?

Kind regards,

James.
- --
James Hunt
____________________________________
Ubuntu Foundations Team, Canonical.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk36UQgACgkQYBWEaHcQG9fBqwCgh2rbPCkmiH1+DNz/Cfk9OwBL
3BcAnAh7T2rz0glgs0HdZ84sEVAVznOJ
=XQmC
-----END PGP SIGNATURE-----



More information about the upstart-devel mailing list