From owner-freebsd-arch@FreeBSD.ORG Fri May 2 22:09:31 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44AB6B19 for ; Fri, 2 May 2014 22:09:31 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3A8811BF for ; Fri, 2 May 2014 22:09:30 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n15so277777wiw.8 for ; Fri, 02 May 2014 15:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=GjBTMx3DW0EDf0Cvy/FGAF6DuaQExa7GpV0nip0mu0c=; b=KO2d73/X1kynzBZVMG9z7YLNkvx/G+AWyvv0LDb2n2monZKhBoQwp1UYKXCIteDp8Q 7ut0uiqBiH5Q8jmhfkW2xYv5rVjsOcfA4Bq8pjQHNPyLTE093torOtscfRbUmv2v8DId rnZQEP7huNYIS16Wteb2vGa8VCz4L7UFqnXULOpSFxwADgeryRGtdcbNX9s5nIZCY3GF 0PPAHustoFhplqRL7eY6m2iYcXuJcg4N8tnVEUgPNmlUcLumxQzuT1sdUVaiZczGKkfp 2+9WONCR2iGKf7fULpRDnrcYR6x9uTU5UIbpf6NpdOaB/RMl7RfTJkwqfo1eeX/eWgV2 gtAQ== X-Received: by 10.180.81.40 with SMTP id w8mr4808805wix.45.1399068569086; Fri, 02 May 2014 15:09:29 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id by1sm4049107wjc.26.2014.05.02.15.09.27 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 02 May 2014 15:09:28 -0700 (PDT) Date: Sat, 3 May 2014 00:09:25 +0200 From: Mateusz Guzik To: freebsd-arch@freebsd.org Subject: safer alternative for pfind and pget? Message-ID: <20140502220925.GB28158@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2014 22:09:31 -0000 (I hope this list is ok.) Hello, currently when one wants to lookup a process there are only 2 functions to help: - pfind which provides no filtering whatsoever - pget which provides limited (mostly negative) filtering This leads to bugs since it places burden on all callers to make sure they filter out all states they cannot cope with (new, exiting, execing) and it is easy to miss some. So I would like to change this so that default function to use would provide the following semantics: with no flags it returns a fully constructed not-exiting process which the caller can debug Flags allow to ignore each restriction. It is unclear to me if this should replace pget or a new function should be created and all pget callers converted over time (and selected pfind callers). Thoughts? -- Mateusz Guzik