Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Unix.readdir problems
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-19 (05:35)
From: Travis Bemann <tabemann@w...>
Subject: [Caml-list] Unix.readdir problems
I've been having significant problems with using Unix.readdir, where
instead of actually returning directory items in strings, it returns
empty strings for each directory item that it would return otherwise,
in multithreaded *native* code, in the context:

(* Get the contents of a directory. *)
let scan_dir path =
  let dir = Unix.opendir path in
  let rec step acc =
    try step ((Unix.readdir dir) :: acc)
    with End_of_file -> List.rev acc
  let items = step [] in
  Unix.closedir dir;

The code this is run in is multithreaded, but this problem only shows
up when the code is running as native code, rather than being run by
the bytecode runtime.  Note that I'm running Debian 2.2, but with a
newer glibc than the one that came with it as distributed (i think).

I know there's a bug tracker item for this, and a not-very-useful
response to it, both of which are in French; however, it did not
appear to mention it working as bytecode but not as native, or what
any possible workarounds or solutions to be.

Anyone have any knowledge about this and how to either solve or work
around this?

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: