Read file in folder /proc/"pid"/fd/0 in ubuntu v11.10?
I cannot read file in folder /proc/"pid"/fd/0 which I need read it from C language to display screen.
Thank you so much! |
Have you tried running your program with superuser privileges?
Code:
sudo ./my_program |
Quote:
What happens when you try to read it? On my system, I randonly checked some processes, and it seems that fd0 typically points to /dev/null. What would you expect to accomplish by reading from there? |
Oh sorry, I only want get information TTY of a process, but I don't know read it from C language.
Ex: commands "ps -A" in terminal Result: PID TTY TIME CMD 2935 ? 00:00:00 gnome-pty-helpe 2936 pts/0 00:00:00 bash |
Do you want to find if a process uses a TTY?
In BASH, you could do: Code:
ls -l /proc/<PID>/fd | grep tty |
All times are GMT -5. The time now is 01:50 AM. |