Version française
Home     About     Download     Resources     Contact us    
Browse thread
Deletion of ioctl_ptr in Caml 1.06
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Deletion of ioctl_ptr in Caml 1.06
> 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