On Tue, Nov 25, 2008 at 11:31 AM, Peter Miller <[EMAIL PROTECTED]> wrote:
> Hi Coders,
>
> Welcome to asymmetric API land once again.
> Today's subject is socket(2).
>
>                int fd = socket(family, type, protocol);
>
> After the fact, you can retrieve 'type' from an open file descriptor
> using getsockopt(2) SO_TYPE.
>
> After the fact, extracting 'family' from an open file descriptor is a
> bit better hidden, you have to use getsockname(2) and grope the
> sa_family field.
>
> Any ideas how to get 'protocol' from an open file descriptor?

readlink /proc/self/fd/$fd and apply heuristics to the result?

-- 
Martin <http://launchpad.net/~mbp/>
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to