Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2010 17:16:08 +0300
From:      cronfy <cronfy@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Unique process id (not pid) and accounting daemon
Message-ID:  <d4ac64921001280616h7827d0ffoa78d21d545dbc012@mail.gmail.com>
In-Reply-To: <20100125035448.GW71374@elvis.mu.org>
References:  <d4ac64921001241533j375705f2we97945d010a1a7ff@mail.gmail.com>  <20100125035448.GW71374@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 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.

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

-- 
// cronfy



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