Discover PID from Port - Unix
This is a discussion on Discover PID from Port - Unix ; Hi:
Does anyone know how to programatically get the PID based on a port
number in UNIX (Solaris)? I'm looking for something more portable than
shelling out and calling lsof ....
-
Discover PID from Port
Hi:
Does anyone know how to programatically get the PID based on a port
number in UNIX (Solaris)? I'm looking for something more portable than
shelling out and calling lsof .
-
Re: Discover PID from Port
Jason8 wrote:
> Hi:
>
> Does anyone know how to programatically get the PID based on a port
> number in UNIX (Solaris)? I'm looking for something more portable than
> shelling out and calling lsof .
see the pfiles source code at opensolaris.org
http://cvs.opensolaris.org/source/xr...files/pfiles.c
and iterate over all pids in /proc
- Surinder
** Posted from http://www.teranews.com **
-
Re: Discover PID from Port
On Jun 8, 1:29 pm, Surinder Singh wrote:
> Jason8 wrote:
> > Hi:
>
> > Does anyone know how to programatically get the PID based on a port
> > number in UNIX (Solaris)? I'm looking for something more portable than
> > shelling out and calling lsof .
>
> see the pfiles source code at opensolaris.org
>
> http://cvs.opensolaris.org/source/xr...sr/src/cmd/pto...
>
> and iterate over all pids in /proc
>
> - Surinder
> ** Posted fromhttp://www.teranews.com**
ps -eaf | cut -c10-14 | xargs pfiles > file.txt
Search in file.txt for respective port/pid!
-
Re: Discover PID from Port
In article
,
"msnsachin@gmail.com" wrote:
> On Jun 8, 1:29 pm, Surinder Singh wrote:
> > Jason8 wrote:
> > > Hi:
> >
> > > Does anyone know how to programatically get the PID based on a port
> > > number in UNIX (Solaris)? I'm looking for something more portable than
> > > shelling out and calling lsof .
> >
> > see the pfiles source code at opensolaris.org
> >
> > http://cvs.opensolaris.org/source/xr...sr/src/cmd/pto...
> >
> > and iterate over all pids in /proc
> >
> > - Surinder
> > ** Posted fromhttp://www.teranews.com**
>
> ps -eaf | cut -c10-14 | xargs pfiles > file.txt
>
> Search in file.txt for respective port/pid!
So when he said he didn't want to shell out to lsof, you thought he
meant that shelling out to other programs was OK? My interpretation was
that he didn't want to shell out at all.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***