Subject: Re: Ioctl to write to a screen
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 04/30/2002 18:51:21
>>> Is it there one available now?  If not, I will add a
>>> WSDISPLAYIO_WRITECHAR (or something) that will do that.
>> I suggest you look into TIOCSTI.
> Ok, as I have seen, it seems suitable but it has one problem.  To
> call the ioctl I need to pass a file descriptor, and if I'm ok, it is
> the one for the tty I want to write to.  So I should open /dev/ttyE0,
> for example.

Right.

> But I can't do this.  I need to write to the active console, no
> matter which one it is.  For now, I only open /dev/ttyEcfg and work
> with ioctl's on it, which do not depend on a concrete console.

> So should I go on and create a new ioctl for this?  Or is it there a
> way to get this one working (TIOCSTI)?

Well, I haven't looked at the code.  But my first inclination would be
to make ttyEcfg's driver field TIOCSTI specially and have it operate on
the active console, whichever one that is.  You might even be able to
leverage the existing TIOCSTI code; the file descriptor is needed only
as a way for userland to identify which driver it's talking about -
once you're in the kernel, you can call another driver's ioctl routine
if you feel like it, whether or not you can find an fd open on it.

Of course, you'd need to make sure that you don't break anything if the
user tries to paste to a virtual console that nobody has open, but
that's probably not too hard.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B