Browse thread
Unix module API: nonblocking connect's errors retrieving
-
Vsevolod Fedorov
- Markus Mottl
- Jerome Vouillon
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-09-22 (14:14) |
From: | Markus Mottl <markus.mottl@g...> |
Subject: | Re: [Caml-list] Unix module API: nonblocking connect's errors retrieving |
On 9/22/05, Vsevolod Fedorov <sevaAtWork@mail.ru> wrote: > The problem is: 'getsockopt_int' returns 'int' while I need Unix.error type. > I can't map int to error in good way. I have also run into this same problem a while ago. > May be is it the time to extend Unix module API? > For example, add function like 'getsockopt_error' or 'int_to_error'? There is already a C-function for handling that case in the OCaml-runtime (unix_error). You only need to write a C-wrapper that converts the arguments to this function appropriately, and define an "external"-function in OCaml. Then you can raise the corresponding Unix_error-exceptions by passing the error code and other arguments (i.e. name of associated Unix-call and arguments). But I agree, it would be a very good idea to expose this function in the standard Unix-module (hint, hint!)... Best regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com