Use poll(2) for stdin #2

Merged
clement.freville2 merged 2 commits from sys/poll-stdin into master 2 years ago

The runner tightly controls program input and output with three pipes. It's nearly impossible to know in advance in what order and when pipes can be read or written.

Instead, each file descriptor is waited for with poll, allowing the read and write functions to be called only if they are non-blocking calls.

Standard input is now also written in this way, allowing programs longer than the capacity of a tube buffer to be written. This input is treated carefully, since the program can close its standard input before we've had a chance to write the standard input completly. This avoids most kills for sigpipe, although there may be a race situation during the short time frame between the call to poll and the write.

A runner can now be invoked directly from the command line, to do quick testing.

The runner tightly controls program input and output with three pipes. It's nearly impossible to know in advance in what order and when pipes can be read or written. Instead, each file descriptor is waited for with `poll`, allowing the `read` and `write` functions to be called only if they are non-blocking calls. Standard input is now also written in this way, allowing programs longer than the capacity of a tube buffer to be written. This input is treated carefully, since the program can close its standard input before we've had a chance to write the standard input completly. This avoids most kills for sigpipe, although there may be a race situation during the short time frame between the call to `poll` and the write. A runner can now be invoked directly from the command line, to do quick testing.
clement.freville2 added the enhancement label 2 years ago
clement.freville2 added 2 commits 2 years ago
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
e5598e69de
Test the runner via the command line
clement.freville2 requested review from bastien.ollier 2 years ago
bastien.ollier approved these changes 2 years ago
bastien.ollier left a comment
Owner

🖖

🖖
clement.freville2 merged commit 60b4fce341 into master 2 years ago
clement.freville2 deleted branch sys/poll-stdin 2 years ago

Reviewers

bastien.ollier approved these changes 2 years ago
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
The pull request has been merged as 60b4fce341.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: sandkasten/planificador#2
Loading…
There is no content yet.