Re: Deletion of ioctl_ptr in Caml 1.06

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Tue Nov 25 1997 - 11:19:05 MET


From: Xavier Leroy <Xavier.Leroy@inria.fr>
Message-Id: <199711251019.LAA22450@pauillac.inria.fr>
Subject: Re: Deletion of ioctl_ptr in Caml 1.06
In-Reply-To: <199711240328.WAA01968@codex.cis.upenn.edu> from Scott Alexander at "Nov 23, 97 10:28:08 pm"
To: salex@dsl.cis.upenn.edu (Scott Alexander)
Date: Tue, 25 Nov 1997 11:19:05 +0100 (MET)

> I'm curious as to the reason that Unix.ioctl_ptr (and Unix.ioctl_int) no
> longer exist in OCaml 1.06. Is there a workaround for code that used
> them? (I'm using ioctl_ptr in order to get information about the
> network interfaces attached to the current machine.)

There were two problems with the Unix.ioctl functions:
1- You had to hardwire the ioctl number and couldn't use the symbolic
names provided by the C include files. This makes code extremely
hard to read and fragile w.r.t. upgrades of the OS.
2- For ioctl_ptr, exploiting the result (which may be a complex
struct) was very incovenient.

For those two reasons, I think it's better to write a C function that
does the ioctl you're interested in, and returns to Caml the results
you're interested in.

- Xavier Leroy



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:13 MET