| Anonymous | Login | Signup for a new account | 2013-05-26 05:02 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004812 | OCaml | OCaml general | public | 2009-06-03 21:43 | 2012-09-17 14:10 | ||||||
| Reporter | goswin | ||||||||||
| Assigned To | |||||||||||
| Priority | high | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | 4.00.2+dev | Fixed in Version | |||||||||
| Summary | 0004812: Add extern int code_of_unix_error (value error); | ||||||||||
| Description | The unixsupport.h header provides functions to convert unix errno into ocamls Unix.error, which is sufficient for most applications. The attached patch adds a function for the reverse convertion. | ||||||||||
| Additional Information | Rational: For libfuse bindings I need to convert Unix.error to errno numbers. The C stubs call an ocaml closure and expect usualy a string as return value or an Unix.Unix_error exception in case of an error. The stubs need to catch the exception, convert them back to unix errno numbers and return -err to libfuse. The code looks something like this: static int readlink_stub(const char *name, char *buf, size_t size) { int res = 0; leave_blocking_section(); CAMLparam0(); CAMLlocal3(ml_name, ml_res, ml_exn); ml_name = caml_copy_string(name); value ml_res = caml_callback2(readlink_callback, ml_name, Val_int(size)); if (Is_exception_result(ml_res)) { ml_exn = Extract_exception(ml_res); res = -code_of_unix_error(Field(ml_exn, 1)); } else { strncpy(buf, String_val(ml_res), size); } enter_blocking_section(); return res; } | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2009-06-03 21:43 | goswin | New Issue | |
| 2009-06-03 21:43 | goswin | File Added: code_of_unix_error.dpatch | |
| 2011-05-31 15:44 | doligez | Status | new => acknowledged |
| 2012-07-11 14:47 | doligez | Priority | normal => high |
| 2012-07-11 14:47 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-31 13:36 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-17 14:10 | doligez | Target Version | 4.00.1+dev => 4.00.2+dev |
| Copyright © 2000 - 2011 MantisBT Group |