[rfc] ConsoleKit enhancements

William Jon McCann mccann at jhu.edu
Mon Feb 12 10:18:59 PST 2007


Hi,

On 2/9/07, David Zeuthen <david at fubar.dk> wrote:
> So I was thinking about some of the races that Bill brought up in
> another thread and I think we need some kind of interface to allow
> applications to sanely and race-free release/acquire resources on
> session switching.

Yeah.  Without getting into the details yet I agree that using some
kind of two phase transition is desirable.  I guess that is pretty
much what OS X does [1].

One tricky part is how we define "pre-switch" and "post-switch".
Ideally, I suppose, we'd like to know when the switch is initially
requested.  And by requested I mean:

  1. Direct kernel request (eg. VT_ACTIVATE ioctl)
  2. System level tools (eg. chvt)
  3. Hot keys (CTRL-ALT-Fn)
  4. ConsoleKit D-Bus API
  5. Login Managers (eg. GDM)
  6. Desktop tools (eg. GNOME fast-user-switch-applet)

A while ago I tried to get the kernel to give us this pre-switch
notification via ioctl VT_SETMODE and setting struct vt_mode relsig (a
signal to raise on VT release requests).

However, it seemed like only one pid may register for this at a time
at least from my cursory look through the kernel sources.  And the
xserver already claims it.

So the only indication we get in ConsoleKit is the return from VT_WAITACTIVE.

Anyway, that's just a little background.

Whatever kind of two phase notification we use must be robust against
the kernel switching VTs again by any of the above mechanisms.

So, we just have to be careful.  I'll still need to think about it a bit more.

Jon

[1] http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html#//apple_ref/c/data/NSWorkspaceSessionDidBecomeActiveNotification


More information about the hal mailing list