Index | Thread | Search

From:
Marc Espie <marc.espie.openbsd@gmail.com>
Subject:
FILE * is opaque so now what ?
To:
tech@openbsd.org
Cc:
millert@openbsd.org
Date:
Thu, 16 Jul 2026 16:57:09 +0200

Download raw body.

Thread
I've run into a language (unicon) that wants to do FILE* level polls
by first checking whether there's something stored in the internal
FILE* read buffer.

Specifically, checking whether that the old f->_r field is zero or not.

Now, I know of ZERO ways to do that check portably.

Do we have something like that anywhere ? it looks like a legitimate
question, and I'd hate to have the only answer be "hey, put everything
in non-buffered mode and get direct access to the fds"


(for now, I've disabled that part of the code entirely)


As far as libc is concerned, what I now is fgetc + ungetc, which tends to
be blocking and hence not at all what we want ?