PID of TTY/stdout users

1

Is there a way in Linux to see the statistics for userspace apps that end up printing data to TTYs or to stdout (the actual stdout, not apps with stdout redirected to files on storage devices)?

Actual problem: a Linux Kernel driver is printing some messages related to an UART that has high loads of traffic going trough it. Among other data that I'm using to determine the cause, I'm trying to deduce who is triggering this high load (producing a lot of traffic on that UART/TTY).

Catalin Vasile

Posted 2017-05-06T22:05:03.603

Reputation: 139

There's no such thing as "the actual stdout" – stdout is defined as whatever fd #1 points to, without any priority given to console or pty or file or pipe. Are you talking about /dev/console? – user1686 – 2017-05-07T00:09:58.347

/dev/console is also a good target. – Catalin Vasile – 2017-05-07T01:19:00.597

Answers

0

Why don't you grep the overloading message in {/bin,/usr/bin,/sbin} binaries or kernel source tree if necessary?

ubercracker

Posted 2017-05-06T22:05:03.603

Reputation: 1

I did just that. I have found the warning message in the kernel, but it is not that useful. After that warning is triggered, that is the only message getting out because it has high priority in the kernel, so I do not have anything other letfovers to grep for in the userspace apps. That's why I'm reoriented towards finding some statistics. – Catalin Vasile – 2017-05-07T12:24:10.830

Why don't you comment out the overloading message and rebuild the kernel? – ubercracker – 2017-05-07T12:32:42.180

The message triggers randomly, not too frequent, but when it does occur it leaves the system hanging. This system will become a product and I cannot let a possible hanging system get to a client :)) . – Catalin Vasile – 2017-05-07T16:22:04.403