From owner-svn-src-all@freebsd.org Mon Jun 4 15:55:54 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7465AFF0441 for ; Mon, 4 Jun 2018 15:55:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0AF5D6EE58 for ; Mon, 4 Jun 2018 15:55:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id v83-v6so10853018itc.3 for ; Mon, 04 Jun 2018 08:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/5Rrgd/Zi3CfDLz3fP6JwoHyjbcn2oK0teXSL47TGJQ=; b=ET8Dqi9JN64VP6oDVGUWbS8exxWxRYmFSPzX9XCf8OqZS2YqEI5qMUJ6PKALsN1psy 3VhKGCt0+kmBvWsYBphxuXz05xvnmVq8OGrQasp0WpKXZkzFrbVixbWCQ1f4QIOKqtZP jE6/e3fRL70puKPdkd8uwMyhYOcf3rICTRCLLjNO2Y1JWTp0lcEJOeIuHwGwbRd86sJf 4uvNA/Oe2bztqaxSU0q/kq1CbMoKi+pk0mduaMemeR0w+I55mniIOSdZmqy5wyAM7zP1 DdBmPwQDeaVJ64GS1049JMWTbFZekHQfcpXUU2FOF18+slwICNMl+eVejB0OwMVzMdUF O2Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/5Rrgd/Zi3CfDLz3fP6JwoHyjbcn2oK0teXSL47TGJQ=; b=Wn8+VEUyrrOQ7RQVLHTiOEFXcuk+iYzGVNWTBIpjXMBh63ReJtxsP05q1dQCftVbs1 9kQOMEMrbciAcfGxOiMP4y6dUdBe+AXhUPC2FUI4um+21uSRZmvWB3PBS73PA3ydVYaA vL+vHKE+xUSTHExVvoBSsdyZHyE+utqFGUSSCaQO7PeZLaF80KNf6FWXXCzqG3m2Orih dOVjmkPcdmi1XdvF1ouqm2zix0trtfMLshwdaLQ3DwYVttGTx+6mN7B0FgSpe0AxyDJO oHxP9DW5qvcos0vx0HVtrhCS2/F3C/mIlPH4MnRa7Cb9AJ3pqUxvB3Xk0ezA2Rn+4wWK KmFw== X-Gm-Message-State: APt69E33PmDehP1Xo8ltz2kC+KvEdP01df2sml4vq63H8phPHYXPDjoE 3oL60xjNgWwRYxUtpzXsHc5hk+fKma8gbGwlXIqqqg== X-Google-Smtp-Source: ADUXVKIPyrajYP4MQLIP/KFdfFZfTq80omKz2PhO9/LCn0UNcURjkVT2EoxeJZ1GrQFik/oZw0lJIF2288Tf2KSTP/A= X-Received: by 2002:a24:8201:: with SMTP id t1-v6mr15429463itd.51.1528127753207; Mon, 04 Jun 2018 08:55:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 08:55:52 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180604102704.GB43725@FreeBSD.org> References: <201806030507.w5357kMm036583@repo.freebsd.org> <20180604102704.GB43725@FreeBSD.org> From: Warner Losh Date: Mon, 4 Jun 2018 09:55:52 -0600 X-Google-Sender-Auth: qBMtx01h3zwilCVdTJwQ5zBHpK0 Message-ID: Subject: Re: svn commit: r334552 - head/usr.bin/top To: Alexey Dokuchaev Cc: Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 15:55:54 -0000 On Sun, Jun 03, 2018 at 05:07:46AM +0000, Eitan Adler wrote: > > New Revision: 334552 > > URL: https://svnweb.freebsd.org/changeset/base/334552 > > > > Log: > > top(1): remove chdir to / > > > > While this came out of a conversation in IRC, it turn out that some > > people don't like it. Since this was a courtesy feature, just remove > it. > At first I thought you were nuts to remove it, since I thought this was a wise change. However, I've changed my mind. I've done some research behind this practice. A long time ago, it used to be critical to the operation of the system: long running processes could prevent a reboot. The 7th Edithion and earlier didn't even have a reboot system call[*]. In System III and original System V based systems, you even had to cd / before doing a shutdown. Otherwise the umounts of all the filesystems except / would fail. There were no forcing provisions in the code at that time. Long running processes would cd to / to avoid problems with people needing to unmount a filesystem and secondarily to ensure that the umounts would work if there were issues with the process dying at reboot time. Somewhere around SysV r3 or so, these restrictions were lessoned and by the time Solaris forked from SysV r4, they were mostly gone. BSD kernels appear to have had similar issues, but they were fixed (or became moot) very early on (maybe between 2.8 and 2.9, google isn't as helpful as I'd had hoped here, and I didn't want to sink a ton of time reading code on TUHS). Fast forward to today, and they are unneeded. There's no issue with reboot. There can be minor issues with umounting filesystems. fstat(1) can be used, though it's a bit cumbersome, to find stray references. Warner [*] OK, a system call number was reserved for reboot, but it wasn't implemented.