Re: Socket vs File descriptor

From: "YOSHIFUJI Hideaki (åè èæ)"
Date: Thu Sep 24 2009 - 04:05:00 EST


KV Pavuram wrote:
Is there any ioctl call to determine if a given descriptor is a file descriptor or a socket descriptor.

Similarly, is there a way to find out a socket descriptor type ie.e if it is SOCK_STREAM, or SOCK_DGRAM type.

Maybe "lsof" command is your friend.

Or, depending on your purpose, you can use
getsockopt(), listen() etc. to get error
(e.g. ENOTSOCK) to test the type.

--yoshfuji
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/