From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751914AbbJLSMr (ORCPT ); Mon, 12 Oct 2015 14:12:47 -0400 Received: from imap.thunk.org ([74.207.234.97]:45057 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbbJLSMp (ORCPT ); Mon, 12 Oct 2015 14:12:45 -0400 Date: Mon, 12 Oct 2015 14:12:44 -0400 From: "Theodore Ts'o" To: Dave Goel Cc: linux-kernel@vger.kernel.org Subject: Re: [Linux] Linux PID algorithm is BRAINDEAD! Message-ID: <20151012181244.GA22589@thunk.org> Mail-Followup-To: Theodore Ts'o , Dave Goel , linux-kernel@vger.kernel.org References: <20151010215849.GG24678@thunk.org> <20151012150438.GA32396@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 12, 2015 at 01:49:59PM -0400, Dave Goel wrote: > > OTOH, I guess if one has to write cleaner/other meta scripts without > proper traps, the cleaner can simply check if linux's PID counter > is too close to the current PID, and if so, refrain from drastic > actions. For the latter, I wonder if there's a way to > get "current PID counter." How about: current_pid = fork(); if (current_pid == 0) exit(0); (void) waitpid(current_pid); Translating this to perl or python shouldn't be that difficult. - Ted