Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why allocate a pseudo-terminal to each coprocess? #133

Closed
garlick opened this issue Feb 8, 2024 · 1 comment
Closed

why allocate a pseudo-terminal to each coprocess? #133

garlick opened this issue Feb 8, 2024 · 1 comment

Comments

@garlick
Copy link
Member

garlick commented Feb 8, 2024

Problem: for whatever reason, powermand starts coprocesses using forkpty(3), but it's not clear why coprocesses would require a terminal. As there may be a fixed number of ptys available, let's not use them unless there is a good reason.

@garlick
Copy link
Member Author

garlick commented Feb 8, 2024

This might provide a hint as to the reason:

/* Create "pipe device" data struct.
 * cmdline would normally look something like "/usr/bin/conman -j -Q bay0 |&"
 * (Korn shell style "coprocess" syntax)
 */

Seems like the only reason to use conman there is if conman "owns" a terminal server that happens to have a port connected to a serial-connected power control device. A workaround could be to just have powerman connect to the host:port of the terminal server directly.

Trying this out, the tests all pass except the bashfun test, which is arguably just a stupid stunt.

garlick added a commit to garlick/powerman that referenced this issue Feb 8, 2024
Problem: a large configuration with many coprocesses uses up
pseudo-terminals, which may have limited availability.

Start coprocesses with socketpair(2) and fork(2) instead of forkpty(3).

Fixes chaos#133
garlick added a commit to garlick/powerman that referenced this issue Feb 8, 2024
Problem: a large configuration with many coprocesses uses up
pseudo-terminals, which may have limited availability.

Start coprocesses with socketpair(2) and fork(2) instead of forkpty(3).

Fixes chaos#133
@mergify mergify bot closed this as completed in df97b68 Feb 8, 2024
chu11 pushed a commit to chu11/powerman that referenced this issue Apr 4, 2024
Problem: a large configuration with many coprocesses uses up
pseudo-terminals, which may have limited availability.

Start coprocesses with socketpair(2) and fork(2) instead of forkpty(3).

Fixes chaos#133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant