From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/880 Path: news.gmane.org!not-for-mail From: Laurent Bercot Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: new "sv status" flags and exit-tracking patch, and misc. Date: Sat, 17 Sep 2005 10:53:10 +0200 Message-ID: <20050917085309.GA14841@skarnet.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126947212 23556 80.91.229.2 (17 Sep 2005 08:53:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 17 Sep 2005 08:53:32 +0000 (UTC) Original-X-From: supervision-return-1116-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Sep 17 10:53:32 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1EGYRF-0000Dh-K6 for gcsg-supervision@gmane.org; Sat, 17 Sep 2005 10:52:49 +0200 Original-Received: (qmail 15214 invoked by uid 76); 17 Sep 2005 08:53:10 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 15208 invoked by uid 1000); 17 Sep 2005 08:53:10 -0000 Mail-Followup-To: supervision@list.skarnet.org Original-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Xref: news.gmane.org gmane.comp.sysutils.supervision.general:880 Archived-At: I can't address all the points you're raising, but some bits I can answer: > Why does runit use its own env_get() method rather than getenv()? [This > is just one example; there are *lots* of places where C library calls > are eschewed in favor of locally-implemented bits]. > > (...) > > Why define the same error methods and macros at the top of each file (as > with fail/failx/warn/warnx/etc)? > > (...) > > Why the huge number of distinct error handling functions and macros with > large numbers of parameters instead of just one or two functions using > varargs? This, my friend, is DJB-style coding. And strange as it may seem to the profane, it's intentional. :) That coding style has its own reasons. All of which are of course questionable, but at least, asking yourself questions is better than blindly following a poor standard. If you like runit, then you're already questioning System V or BSD init ; delving into runit's code is the next step on the Path to Enlightenment, questioning more of your UNIX habits. Take a deep breath, coder, for what thou art about to see may change your way of thinking forever. No, I'm not exaggerating. Well... maybe just a little bit. :) Anyway. The main points are: - when the standard is mediocre, don't follow it. Create a better standard. - libc standards are often mediocre. UNIX is old, and bears the marks of age (read: compatibility), but back then, good interface design wasn't a science yet. Example of a deep-rooted legacy interface: stdio. - always wonder how something is implemented. Never forget library overhead; having a nifty does-it-all function call available does not mean it's a good idea to call it, because it may do way much more than you need, and be a pain security-wise or performance-wise. - libc portability is a myth. When you want portable code, write portable code, instead of relying on so-called portable functions that will obscurely break on some architecture in situations you cannot guess or control. Always play it safe. The strerr functions you're talking about are precisely _designed_ to avoid using varargs. The question is not "why not use varargs ?" - the question is "why would I use varargs when I can do without them ?" :) If you want to dive in this "alternatively written software", take a look at DJB's software, where it all comes from; especially daemontools (which was the original inspiration for runit) and ucspi-tcp. That way of thinking has led to qmail instead of sendmail; djbdns instead of BIND; tcprules instead of tcp_wrappers; runit instead of System V init; runwhen instead of cron; ucspi-ssl instead of stunnel; execline instead of sh (shameless and counterproductive plug here). And if nobody has yet come to write a working DJB-style news server to replace that INN horror, it's because it's a huge amount of painful work and we all have a life (sort of). That was my rant of the year. Time to go back to sleep. -- Laurent