Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2010 01:46:57 +0100
From:      Pieter de Goeje <pieter@degoeje.nl>
To:        freebsd-questions@freebsd.org
Cc:        cronfy <cronfy@gmail.com>
Subject:   Re: Unique id of a process (not pid)
Message-ID:  <201001220146.57496.pieter@degoeje.nl>
In-Reply-To: <d4ac64921001210902h57578954nd793fe548d533935@mail.gmail.com>
References:  <d4ac64921001210902h57578954nd793fe548d533935@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 21 January 2010 18:02:39 cronfy wrote:
> Hello,
>
> Is there any unique identifier of a process in FreeBSD (not PID)?
>
> I am trying to get list of processes and watch for changes
> with kvm_getprocs(). I want to catch every process start and exit (except
> those processes that were started and finished between calls to
> kvm_getprocs()).
>
> But between calls to this function one process may exit and be replaced
> with another process with the same pid and same command name. The only
> difference is a start time of processes. Looks like this is a solution, but
> process start time may change if system time was shifted (i. e. with
> ntpdate). I can track these shifts too, but it looks to be too complex.
>
> Is there any simpler way to identify a process? Thanks in advance.

I honestly don't know if there is such a unique identifier, but lacking that, 
perhaps you can achieve your goal using kqueue(2)'s EVFILT_PROC. It should do 
what you want and a lot more.

You could also try asking freebsd-hackers@.

-- 
Pieter de Goeje



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001220146.57496.pieter>