From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28468 for caml-redistribution; Thu, 13 Mar 1997 10:33:40 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA19425 for ; Wed, 12 Mar 1997 20:50:03 +0100 (MET) Received: from kickapoo.inria.fr (kickapoo.inria.fr [128.93.9.66]) by concorde.inria.fr (8.7.6/8.7.3) with ESMTP id UAA18176; Wed, 12 Mar 1997 20:50:02 +0100 (MET) Received: (from verlyck@localhost) by kickapoo.inria.fr (8.7.6/8.7.3) id UAA13512; Wed, 12 Mar 1997 20:50:09 +0100 (MET) Date: Wed, 12 Mar 1997 20:50:09 +0100 (MET) Message-Id: <199703121950.UAA13512@kickapoo.inria.fr> To: Xavier.Leroy@inria.fr CC: caml-list@inria.fr In-reply-to: <199703120941.KAA08613@pauillac.inria.fr> (message from Xavier Leroy on Wed, 12 Mar 1997 10:41:17 +0100 (MET)) Subject: Re: Objective Caml's Unix libraries From: Bruno.Verlyck@inria.fr Mime-Version: 1.0 (generated by tm-edit 7.79) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: weis [ english summary at the end ] From: Xavier Leroy Date: Wed, 12 Mar 1997 10:41:17 +0100 (MET) No. File descriptors are an abstract type in the Unix library, and this is a conscious decision. > File descriptors are integers indeed. That's what C programming lets you believe, but they are not. It does not make sense to add or multiply two file descriptors, for instance. Tout ceci est indiscutable. At any rate, the only way to pass file descriptors to an exec'd program within the Unix library is to map them using dup2 to stdin, stdout or stderr. I agree it's an unpleasant constraint, but it's a small price to pay for the additional safety brought by having abstract file descriptors. Le problème est que C suinte de partout. Si je devais implémenter /bin/sh en Caml, la librairie Unix ne me permettrait pas de traiter la redirection <&3. Une fonction fileno : filedesc -> int résoudrait ce problème (et celui de Pawel.Wojciechowski), mais je ne vois pas comment traiter >&3 (je n'ai réfléchi que 5 minutes). Bon, l'interface de /bin/sh est de niveau scandaleusement bas, il y a (n'en doutons pas) moyen d'en concevoir une meilleure. Encore faut-il pouvoir (avoir le droit de) changer les specs... Et là, on n'a pas nécessairement le choix du prix à payer. Ré-écrire une librairie U= nix modifiée ? (il faudrait l'appeler Shell :-) In english: Xavier's arguments are very strong. But within them (and the Unix library), I can't write a /bin/sh clone, because of >&3 (here, and for Pawel.Wojciechowski, it would be enough to add a fun fileno : filedesc -> int, like the stdio macro) and <&3 -- but I thought about it for only 5 min. My point is that you can try to change the specs, but you have to be allowed to... Bruno. Disclaimer: I don't need anything more than the Unix library.