Getting the PID of the actually open process in a serial port

Linux Lists (lists@cyclades.com)
Thu, 30 Jul 1998 17:23:50 -0700 (PDT)


Hi, there,

I'm trying to implement a /proc info entry for the Cyclades driver, but
I've faced a problem. One of the info I want to present is the PID of the
process currently running on the serial port, but since serial ports allow
multiple open's, the pgrp variable holds the PID of the last process that
opened the port. So for instance, if there is a mgetty running, whose PID
is 345, and I call 'stty -a /dev/ttyCx', whose PID is 789, even though
mgetty is still running after the stty process ends, the PID stored in the
pgrp variable is 789. Therefore, I can't read the pgrp variable to get the
PID of the current process running on the serial port, because it _can_
hold bogus info.

I'm not saying that this is wrong. I just would like to know if the kernel
provides some way to find out the PID 345 in the case described above.

Any help would be appreciated.

Thanks and Regards,
Ivan Passos

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html