English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Distinguish between osx and linux programmatically
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-07-08 (17:01)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Distinguish between osx and linux programmatically
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
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:


I haven't looked much at it yet beyond reading the documentation.


Richard Jones
Red Hat