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

Associating Local Port Number to PID



Folks,

I'm working on a program for UNIX (SVR4, Solaris 2.4) systems that needs to
associate PID with local TCP/IP port number, so as to pass session keys
accordingly to already running processes. This sounds like such an obviously
needed association that someone must have done it already.

Pointers to code would be best, but any references would be helpful (e.g.,
the appropriate /dev/kmem data structure(s), offset(s), etc.). If necessary,
the program is allowed to be in any group (e.g., "sys" to get at /dev/kmem)
and may even run as root, as a last resort. I see no reason for the latter,
however. Running set-gid to "sys" is sufficient for netstat(1) and ps(1) and
I think is the upper bound for process privilege that I would need.

Thanks in advance.

                                        Karl