From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 28 14:16:30 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EFFB106568B for ; Thu, 28 Jan 2010 14:16:30 +0000 (UTC) (envelope-from cronfy@gmail.com) Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mx1.freebsd.org (Postfix) with ESMTP id 05D928FC1C for ; Thu, 28 Jan 2010 14:16:28 +0000 (UTC) Received: by fxm27 with SMTP id 27so232468fxm.3 for ; Thu, 28 Jan 2010 06:16:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=uGuvU6kChEQJBvXCafToSJhNpYQttCLlV3FsvgLmZ7k=; b=GqItYPgUfTa+Dbktphh4vZRvIpFgZ1gR7PxD1xvmO3NaHTGTz0fgzmEsdgPahVhfJU AKUDS4Re4w89d/Vuh/oN0Bf3yFwF7y1U7+4w8NCxcVblsm3pVWsysfkIp1vAp4u8qh6E IN9xldQbvr/NNvNS1AI5smzlyY4U+hFLsZqC8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ehjxqcO6E/HiYpsa1GfWyRrGx9zsA5yKtIe6Z+lB+y0GvcHfm1IsXjpLnIpMEw0r2r 6cIwcMtrLgrPj/AFSoiHWsH/KG0UZFjvSweda7tzL7CjZfYtYKOoNSyjrSV867xDFlfS 98N6P1QzCCnkT5wQW1jTmfS0O2rsaHOczuX9I= MIME-Version: 1.0 Received: by 10.223.77.155 with SMTP id g27mr10677364fak.2.1264688188167; Thu, 28 Jan 2010 06:16:28 -0800 (PST) In-Reply-To: <20100125035448.GW71374@elvis.mu.org> References: <20100125035448.GW71374@elvis.mu.org> From: cronfy Date: Thu, 28 Jan 2010 17:16:08 +0300 Message-ID: To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: Unique process id (not pid) and accounting daemon X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2010 14:16:30 -0000 >> 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