[WIP] send to stdin per PID

e.g. send to a program’s stdin via its PID.

echotest.c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <stdio.h>

int main(){
    char buffer[1000];
    while (1){
        scanf("%s", buffer);
        printf("%s\n", buffer);
    }

    return 0;
}

Comiple and run the test. To send iostream to this program from elsewhere (e.g. another terminal):

echo something > /proc/<PID>/fd/0

Don’t try to read from program’s stdout/err (e.g. cat /proc/<PID>/fd/{1,2}), because the buffer could be consumed by other “listeners” and results will be inconsistent.

not so easy! [WIP]

https://serverfault.com/a/962956

edited 18.10.2023
created 01.02.2023
EOF
[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<