I am creating a small C program which will find first unattached dtach session and attach to it. However dtach does not provide a way to check unattached/attached status. Is it possible to get this information at all? (For example by directly reading sockets created by dtach?)
Share
use lsof to check how many dtach processes opened the socket file.
if process number > 1, then the socket is attached.