From owner-freebsd-questions@FreeBSD.ORG Fri Jan 22 00:47:08 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E44001065676 for ; Fri, 22 Jan 2010 00:47:08 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from smtp.utwente.nl (smtp1.utsp.utwente.nl [130.89.2.8]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7338FC0C for ; Fri, 22 Jan 2010 00:47:07 +0000 (UTC) Received: from nox-laptop.student.utwente.nl (nox-laptop.student.utwente.nl [130.89.160.140]) by smtp.utwente.nl (8.12.10/SuSE Linux 0.7) with ESMTP id o0M0kvdU003997; Fri, 22 Jan 2010 01:46:57 +0100 From: Pieter de Goeje To: freebsd-questions@freebsd.org Date: Fri, 22 Jan 2010 01:46:57 +0100 User-Agent: KMail/1.9.10 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201001220146.57496.pieter@degoeje.nl> X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact icts.servicedesk@utwente.nl for more information. X-UTwente-MailScanner: Found to be clean X-UTwente-MailScanner-From: pieter@degoeje.nl X-Spam-Status: No Cc: cronfy Subject: Re: Unique id of a process (not pid) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2010 00:47:09 -0000 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