tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lseek on tty



On Mon, Sep 18, 2023 at 04:20:28PM -0400, Jan Schaumann wrote:
> On NetBSD and macOS, lseek(2) on a tty succeeds:
> On Linux, this fails.
> 
> I'm trying to think of why seeking on a terminal
> would make sense.  Anybody have an idea?
This is historical UNIX behaviour ‒
the file offset is modified, but it's just not used during I/O.

POSIX sayeth:
46244  The behavior of lseek( ) on devices which are incapable of seeking is implementation-defined.
46245  The value of the file offset associated with such a device is undefined.

46259  [EINVAL]  The whence argument is not a proper value, or the resulting file offset would
46260            be negative for a regular file, block special file, or directory.

Best,
наб

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index