From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Lennart Poettering <lennart@poettering.net>
Cc: linux-kernel@vger.kernel.org, William Jon McCann <jmccann@redhat.com>
Subject: Re: [PATCH] vt: extend VT_WAITACTIVE ioctl to allow waiting until a specific VT becomes inactive
Date: Tue, 30 Jun 2009 09:34:18 +0100 [thread overview]
Message-ID: <20090630093418.4670980e@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20090630000003.GA21004@omega>
On Tue, 30 Jun 2009 02:00:04 +0200
Lennart Poettering <lennart@poettering.net> wrote:
> Currently, the VT_WAITACTIVE ioctl can be used to wait until a
> specific VT becomes _active_.
Well sort of - by the time it returns another VT may have switched again
unless you are using all the VT locking mess. Ditto with your changesit
seems.
> This is used by ConsoleKit
Yes someone posted a similar patch over a year ago (but ignored the
request for a signed-off-by) and his consolekit bug which was marked "Not
a bug" and ignored. I'm aware of this issue and the original patch would
have been merged but for the signed-off-by: issue.
> which VT is the active one. This patch extends this logic in a simple
> way, so that it can be used to wait until a specific VT becomes
> _inactive_.
Only it may have become active again by the time the call returns or it
may have become active and inactive again and be missed.
> will get a woken up once for each VT change. Having that many threads
> around is certainly ugly and also racy, since multiple quick VT changes
Good to see this has finally been accepted.
> /* this will wait until VT 5 is activated */
> ioctl(0, VT_WAITACTIVE, 5L);
I'd rather
ioctl(0, VT_WAITINACTIVE, ...)
[and both waits should be bitmasks of consoles but its a bit late for
that]
but wouldn't the following be a more useful looking call for most stuff
struct vtevent vtinfo {
int event;
#define VT_EVENT_SWITCH 1
#define VT_EVENT_BLANK 2
#define VT_EVENT_UNBLANK 3
#define VT_EVENT_RESIZE 4
unsigned int old;
unsigned int new;
unsigned int pad[4];
}
ioctl(0, VT_WAITEVENT, &vtinfo);
either way adding magic "negative number" semantics to VT_WAITACTIVE
isn't very nice.
We have an open bug for VT blank reporting to user space (and the
notifier hooks internally to do it). We also have races with the implicit
races in the WAITfoo APIs unless you are using the VT locking/change
stuff for things like X11
It looks like the job could be done better once even if for the moment it
simply reports VT changes.
next prev parent reply other threads:[~2009-06-30 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 0:00 Lennart Poettering
2009-06-30 8:34 ` Alan Cox [this message]
2009-06-30 12:58 ` Valdis.Kletnieks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090630093418.4670980e@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=jmccann@redhat.com \
--cc=lennart@poettering.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®