tech-net archive

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

reference counts on sockets?

I have an in-kernel consumer of the socket API, which uses a very large
number of sockets.  I don't want to maintain file structures associated
with all these sockets unless I absolutely must -- they're wasteful, and
kernel memory is at a premium.

The problem is that some of the code in the socket layer assumes that if
SS_NOFDREF is set, a socket's not long for this world and can be killed
off.  This seems like a poor substitute for a real reference counter, and
mingles the semantics "has no associated file descriptor" and "is being
deallocated" besides.

I'd like to add reference counts to sockets, either manipulated under
the socket lock, or by atomic operations.  Opinions?

Thor Lancelot Simon                               
    "Even experienced UNIX users occasionally enter rm *.* at the UNIX
     prompt only to realize too late that they have removed the wrong
     segment of the directory structure." - Microsoft WSS whitepaper

Home | Main Index | Thread Index | Old Index