Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jan 2010 14:13:52 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        cronfy <cronfy@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Unique process id (not pid) and accounting daemon
Message-ID:  <20100130221352.GM71374@elvis.mu.org>
In-Reply-To: <d4ac64921001280616h7827d0ffoa78d21d545dbc012@mail.gmail.com>
References:  <d4ac64921001241533j375705f2we97945d010a1a7ff@mail.gmail.com> <20100125035448.GW71374@elvis.mu.org> <d4ac64921001280616h7827d0ffoa78d21d545dbc012@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* cronfy <cronfy@gmail.com> [100128 06:16] wrote:
> >> To ensure that process in the process tree and process in the
> >> accounting file are the same, I want to add unique process identifier
> >> (uint64_t) to 'proc' struct in sys/sys/proc.h and increment it for
> >> every process fork. I see it is possible to do this just before
> >> sx_sunlock() in fork1() in sys/kern/kern_fork.c.
> > Now that I know this, I would suggest simply recording the start
> > time as the serial number, then using pid+recorded_start_time as
> > your serial number.
> 
> This may lead to duplicate ids: pid may be reused and time may be
> shifted to give exactly the same start_time as it was used with this
> pid earlier. Simple increment will work fine.

You're right.  I was still stuck in "start time doesn't change" mode.
(assuming that if the time changed that the "start time" used to
tag processes would be incremented akin to your increasing number).

meh :)

> Ok, as far as no one else commented at my idea, I assume it is not
> completely stupid and will try to implement this :)

It sounds good! 

-- 
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250
.- FreeBSD committer



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