Messages in this thread |  | | Date | Sat, 19 May 2001 19:57:07 -0400 (EDT) | From | Alexander Viro <> | Subject | Re: no ioctls for serial ports? [was Re: LANANA: To Pending Device Number Registrants] |
| |
On Sat, 19 May 2001, Linus Torvalds wrote:
> > On Sat, 19 May 2001, Pavel Machek wrote: > > > > Well, if we did something like modify(int fd, char *how), you could do > > > > modify(0, "nonblock,9600") > > What you're really proposing is to make ioctl's be ASCII strings. > > Which is not necessarily a bad idea, and I think plan9 did something > similar (or rather, if I remember correctly, plan9 has control streams > that were ASCII. Or am I confused?).
You are not. Control streams in question look like normal files. Normally driver exports a tree with several data files (e.g. fd0, fd1, fd2, fd3) and several control files (e.g. fd0ctl, fd1ctl, fd2ctl, fd3ctl). write() to the latter passes commands. No extra syscalls needed.
Notice that sometimes it's not ASCII - depends on the nature of stuff you are passing. Things like setting font, etc. need to pass bitmaps, so some parts of the stuff you write end up as binary. Which is perfectly sane.
> And a "stream of bytes" is in a very real sense the simplest structure, > and is the unix way (and the plan9 way is to avoid binary streams, and use > ASCII text instead when possible, whihc probably also makes sense).
s/possible/makes sense/. For commands ASCII is OK, but for cases when you pass binary data as a part of command (not just "something large", but something that really happens to be a bitmap, etc.) you write it as binary data.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |