From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id A7F37BC57 for ; Thu, 8 Jul 2010 19:01:25 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEACqhNUxQRFuw/2dsb2JhbACgMXHBd4UlBIQc X-IronPort-AV: E=Sophos;i="4.53,559,1272837600"; d="scan'208";a="54725312" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 08 Jul 2010 19:01:25 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1OWuTU-0003LO-AI; Thu, 08 Jul 2010 18:01:24 +0100 Date: Thu, 8 Jul 2010 18:01:24 +0100 To: Romain Beauxis Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Distinguish between osx and linux programmatically Message-ID: <20100708170124.GC16057@annexia.org> References: <20100708114434.GB16057@annexia.org> <201007081042.41196.toots@rastageeks.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <201007081042.41196.toots@rastageeks.org> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; stdlib:01 uname:01 uname:01 stdlib:01 non-unix:01 intern:01 wrote:01 encode:01 caml-list:01 emulate:01 emulate:01 width:97 kernel:02 string:02 external:03 On Thu, Jul 08, 2010 at 10:42:40AM -0500, Romain Beauxis wrote: > Le jeudi 8 juillet 2010 06:44:34, Richard Jones a écrit : > > Stdlib could bind the uname(2) syscall, but it's legendary in its > > complexity. Seems more likely to cause problems than just calling out > > to the external program. > > I fail to see the complexity.. Where is it ? Actually *I* misunderstood the link I posted (http://www.kernel.org/doc/man-pages/online/pages/man2/uname.2.html#NOTES) thinking it meant that the string fields in the structure could have variable width. Reading it again, they don't. Nevertheless I still think this is not a useful addition to stdlib, but for different reasons: (1) You'd have to emulate it on non-Unix platforms, but it's unclear what you'd emulate it with. Windows has a completely different and much richer concept of OS version. This sort of version probing complexity doesn't belong in the core library, but in an external "OS version" library where detection rules can be frequently updated. (2) Your program only ever calls out to uname once. The cost of running an external program is negligible. Red Hat recently sponsored an intern to write a library to encode OS version information: https://fedorahosted.org/libosinfo/browser/doc/overview.txt I haven't looked much at it yet beyond reading the documentation. Rich. -- Richard Jones Red Hat