Re: [PATCH] detour TTY driver - now ttyprintk

From: Samo Pogacnik
Date: Fri Jun 11 2010 - 17:32:20 EST



> > +#define TPKRLEV (('e'<<8) | 0) /* Wait for ttyprintk ratelimiting event*/
> > +static int tpk_ioctl(struct tty_struct *tty, struct file *file,
> > + unsigned int cmd, unsigned long arg)
> > +{
> > + struct ttyprintk_port *port;
> > +
> > + port = tty->driver_data;
> > +
> > + if (!port)
> > + return -EINVAL;
> > +
> > + switch (cmd) {
> > + case TPKRLEV:
> > + wait_event_interruptible(ttyprintk_ratelimit_wq,
> > + (ttyprintk_ratelimit_event != 0));
>
> Ok that wasn't quite what I had in mind.
>
> What I was thinking was needed was this
>
> /* Stop TIOCCONS */
> case TIOCCONS:
> return -EOPNOTSUPP;
>
> only it won't work that way. I'll sort that out in tty_io.c once the
> driver is happy. That way anything trying to mis-redirect the console
> will get stopped early which is probably more reliable than a ratelimit ?
>
I'm thinking to leave the ratelimit support in for the time being. I had
in mind cases, when someone does
"cat /proc/kmsg > dev/ttyprintk" or
suppose the console is redirected to ttyprintk (which i would like to be
able to do from user program) and then someone does:
"cat /proc/kmsg > /dev/console"... or
if console is redirected after this command ?

Were you thinking of some other mis-redirection case?

Samo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/