tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Obtaining list of created sockets



On Mon, 30 Jun 2014, Johnny Billquist wrote:

> On 2014-06-30 08:29, Will Dignazio wrote:
> > Hi,
> >
> > I've dug through the so* code, and haven't found any table or list
> > dedicated to created sockets. The exception only seems to be fsocreate,
> > which attaches a file descriptor that could be used to find the assigned
> > socket.
> >
> > I'm working on a module where I would like to expose the list of created
> > sockets as a series of directories containing file descriptors that let
> > you access the properties of the sockets. This of course requires that
> > the module be aware of all the created sockets in the system. So,
> > without modifying the current socket creation process, is there a way to
> > obtain a list or table of created (not necessarily bound/open/listening)
> > sockets?
>
> Why not just check how netstat does it?

IIRC netstat does it by a private-to-each-protocol sysctl node, which only
works for protocols with socket types known to the calling program.
sockstat(1) is the same, there is no generic list of opened sockets.

regards,
iain


Home | Main Index | Thread Index | Old Index