LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Query whether a pipe is empty AND has a reader waiting? (https://www.linuxquestions.org/questions/linux-kernel-70/query-whether-a-pipe-is-empty-and-has-a-reader-waiting-4175731792/)

jsyjr 12-14-2023 06:58 AM

Query whether a pipe is empty AND has a reader waiting?
 
I have long dreamed of recreating, within Emacs, the input and transcript functionality of the Apollo DM (Display Manager):


The distinguishing characteristic of a DM transcript was that, even in the presence of typeahead, it recorded faithfully and immutably, from the child process's perspective, the interleaving of input consumed from stdin with output written to stdout. (Of course, in the absence of typeahead, creating such a transcript is trivial.)

The essential implementation hurdle then is handling typeahead. And that comes down to being able to ask whether the pipe supplying stdin is both (1) empty and (2) has a read waiting.

So my question is, can one do that from userspace on a contemporary Linux kernel?

pan64 12-15-2023 01:32 AM

You need to give us some additional details, like what do you want to achieve, which language is it? Do you have some code to show us? Where did you stuck?
http://www.catb.org/~esr/faqs/smart-...html#beprecise

zeebra 12-16-2023 04:27 AM

Perhaps strace and ss could be of some help.. But I agree with pan64.

jsyjr 12-24-2023 05:30 AM

I have received an automated email prompting me to do something with this thread. I will mark the thread as solved, not because I received any reply more useful than what I had already found searching the web, but merely to follow protocol.

I will continue my search for a forum or community more interesting in discussing potential kernel enhancement(s).

zeebra 01-04-2024 07:29 AM

That's good and fine, but it doesn't really seem related to the Kernel at all. You'd probably have more luck with the LISP community, or more specifically ELISP, or perhaps even GUILE.

pan64 01-04-2024 09:41 AM

I still don't understand what is it all about. Probably it is related: https://unix.stackexchange.com/quest...ata-if-it-isnt


All times are GMT -5. The time now is 02:18 AM.