Re: Splicing to/from a tty

From: Linus Torvalds
Date: Thu Jan 21 2021 - 01:44:13 EST


On Wed, Jan 20, 2021 at 3:14 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Umm... Why do we clear FMODE_PWRITE there [seq_open - ed], anyway?

I think it's pointless and historical, and comes from "several /proc
files supported the simple single-write model, nothing ever supported
moving around and writing".

The seq_file stuff was always about reading, and then the writing part
was generally random special-case hacks on the side.

So I think that "clear PWRITE" thing is to make sure we get sane error
cases if somebody tries something funny, knowing that none of the
hacky stuff support it.

And then the very special kernfs thing adds it back in, because it
does in fact allow seeking writes.

Linus