From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2722 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jeff Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: The "Unix Philosophy 2020" document Date: Sat, 30 Nov 2019 13:13:58 +0100 Message-ID: <1093851575116038@sas2-5cafe8cd79cd.qloud-c.yandex.net> References: <20190831130730.ki6ma7i5curucowe@CasperVector> <20190901091157.bjtfhqq6d2rg75yo@CasperVector> <20190927083816.tectynx7dzlfcvb7@CasperVector> <20191012173743.drzlgnrw4hib6hh4@CasperVector> <20191117062644.lt6wfmqwijqqhc5w@CasperVector> <20191117072850.bokuozrpokvfq662@CasperVector> <20191125025202.oqu4ennu3lexnxsa@CasperVector> <20191125142047.sbewkum5jj3fckvi@CasperVector> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="127978"; mail-complaints-to="usenet@blaine.gmane.org" To: "supervision@list.skarnet.org" Original-X-From: supervision-return-2311-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Nov 30 13:14:05 2019 Return-path: Envelope-to: gcsg-supervision@m.gmane.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ib1dU-000XBq-PN for gcsg-supervision@m.gmane.org; Sat, 30 Nov 2019 13:14:04 +0100 Original-Received: (qmail 9930 invoked by uid 89); 30 Nov 2019 12:14:28 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Original-Received: (qmail 9923 invoked from network); 30 Nov 2019 12:14:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1575116039; bh=3pxbWCWHzkodRmi6XVqZG/5+qmHNiJprwbbfYkdUTIM=; h=References:Date:Message-Id:Subject:In-Reply-To:To:From; b=v17h3oepu1LXYzXeg52vtKWib8P+0bee62cTHcArL8pwpT8L1r6eGK20qYZFzK+hY +LYZ653ZO/6pfDbYMzEecP4bv/YTrpE78NZOMUdoQ4wrDK3t8bZ32ccOvCzFo/5ZLd mGtsDLyTPtpixgHhbudqLbAi9QKggxTA4gUMd/lk= Authentication-Results: mxback10j.mail.yandex.net; dkim=pass header.i=@yandex.com In-Reply-To: <20191125142047.sbewkum5jj3fckvi@CasperVector> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:2722 Archived-At: >>  Macros and/or helper functions (again cf. [1]; they can be factored into >>  a mini-library in nosh) can also be used to reduce boilerplate like >>  > const int error(errno); >>  > std::fprintf(stderr, ..., std::strerror(error)); >>  > throw EXIT_FAILURE; >>  which can be easily observed after the attached patch is applied. > > The first chunk in the patch is incorrect, and the new code should be > (in other words, swap the `ENOENT == error' and the `const int' lines) >>  if (!self_cgroup) { >>      if (ENOENT == error) return; // This is what we'll see on a BSD. >>      const int error(errno); >>      std::fprintf(stderr, "%s: FATAL: %s: %s\n", prog, "/proc/self/cgroup", std::strerror(error)); >>      throw EXIT_FAILURE; ^^^^^^^^^^^^^^^^^^^^^^^^^^ using an exception here looks like a REALLY brilliant idea to me >>  } why C++ btw ? i don't see any benefit in not using C in the first place, since when does one write Unix system tools in C++ ? is it the added "advantage" of bloated binaries and additional lib dependencies ?