dtach - how to check if attached or unattached
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 socke开发者_如何学Cts created by dtach?)
use lsof to check how many dtach processes opened the socket file. if process number > 1, then the socket is attached.
精彩评论