From: "Mark Shinwell" <mshinwell@janestcapital.com>
To: Robert Fischer <robert.fischer@smokejumperit.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] file_desc
Date: Tue, 1 Jul 2008 10:59:52 -0400 [thread overview]
Message-ID: <20080701145952.GA22140@janestcapital.com> (raw)
In-Reply-To: <486A40C9.2020807@smokejumperit.com>
On Tue, Jul 01, 2008 at 09:35:53AM -0500, Robert Fischer wrote:
> Is there a way to convert a file_descr to/from an int in OCaml? The type is
> abstract, and there doesn't seem to be an obvious answer.
>
> Alternatively, is there a way to get at an inherited file_descr from a
> process I execv'd into?
Not in the default standard library, I don't think. Jane Street's core
library <http://ocaml.janestcapital.com/?q=node/13> contains such a
function, however. It is implemented as:
external file_descr_of_int : int -> file_descr = "%identity"
Another approach is to write something like:
let file_descr_of_int fd =
assert (fd >= 0);
assert (Obj.is_int (Obj.repr Unix.stdin));
((Obj.magic fd) : Unix.file_descr)
Mark
next prev parent reply other threads:[~2008-07-01 14:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-01 14:35 file_desc Robert Fischer
2008-07-01 14:56 ` [Caml-list] file_desc SerP
2008-07-01 14:59 ` Mark Shinwell [this message]
2008-07-01 15:15 ` Dave Benjamin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080701145952.GA22140@janestcapital.com \
--to=mshinwell@janestcapital.com \
--cc=caml-list@inria.fr \
--cc=robert.fischer@smokejumperit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox