From owner-freebsd-stable@FreeBSD.ORG Sat Jan 12 23:47:29 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6578EF25 for ; Sat, 12 Jan 2013 23:47:29 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by mx1.freebsd.org (Postfix) with ESMTP id D2A9BE10 for ; Sat, 12 Jan 2013 23:47:28 +0000 (UTC) Received: by mail-we0-f176.google.com with SMTP id r5so1411465wey.7 for ; Sat, 12 Jan 2013 15:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=JNtBoh9kJle93KBvadOHgRi2xTznlhXsjXXWIE1WKIE=; b=NExN/qYG6cF+0/zaTzRd0xOIWS2wV7SQsaYLIQKACYejY+BuDHYh1tYgZmzWm7Slm8 HHZWTbdfDcMzRvhinvKzco1x1xqRSRhuh2csp8BPUT4PHNqw93PFXoCGNrsabRaoP8oK anucwR7E+DSu+lQDeoYDgQ4kFd36F2Kt5CIq04g+Wek4cP6g21r+36uJ/gjRBGLSPMAx CGIi6+D9z9DuCN7Cg8tnRH5UClLAvQbeNBSn0MtBwLR10vVuCvcEZZM5WJ4jryM2vhl4 dI+LQl8ZcYfPcDiiTguf1N7Slj5iXimRQbRWegXy2EJssHKzivNxIUfpUzJZb1goDvYv NpiA== X-Received: by 10.180.81.39 with SMTP id w7mr5869727wix.15.1358034441900; Sat, 12 Jan 2013 15:47:21 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id p2sm6533589wic.7.2013.01.12.15.47.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 12 Jan 2013 15:47:20 -0800 (PST) Date: Sun, 13 Jan 2013 00:47:04 +0100 From: Mateusz Guzik To: Ben Morrow Subject: Re: Determining which process needs to be restarted after update Message-ID: <20130112234704.GA5849@dft-labs.eu> References: <201467687.20130112121822@takeda.tk> <20130112232914.GA4922@anubis.morrow.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20130112232914.GA4922@anubis.morrow.me.uk> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: takeda@takeda.tk, freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2013 23:47:29 -0000 On Sat, Jan 12, 2013 at 11:29:14PM +0000, Ben Morrow wrote: > Quoth Derek Kulinski : > > > > I personally really like OpenSuSE command which is: zypper ps > > What it does is it lists all processes that have files opened that > > currently don't exist (i.e. link count is 0). This helps tremendously > > in determining which processes need to be restarted after an update. > > > > Is there something similar for FreeBSD? I was thinking of using > > lsof +L1, but on FreeBSD that command is not capable of displaying > > names of files that were deleted, many entries returned are for > > example processes that have open sockets. It also does not list names > > of the deleted/replaced files. > > > > Is there a tool that is capable to do such task, or maybe some > > additional options to lsof? I'm not too familiar with it myself. > > procstat -fa, look for entries with 'v' in the 'T' column and '-' in the > 'NAME' column (or get awk to look for you). You may also want to check > the 'V' column: see the manpage for the codes. This won't tell you what > the file used to be called before it was deleted: I don't think the > kernel keeps that information. > This has at least 2 problems: - it will not show shared libraries (-v is required) - it will report processes with open unlinked files, which is completely normal But even if we use -v, I don't think we can reliably distinguish "regular" unlinked file mapping from shared library mapping (for unlinked files we will get - as a name, just like in -f case). I didn't dig into this though. Instead I would go upwards in package dependency tree and for each daemon check if it is running (should be doable without much hackery). Checking for all binaries may be more problematic. -- Mateusz Guzik