From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q2MGgd82017232 for ; Thu, 22 Mar 2012 17:42:40 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAJlVa09QRFuw/2dsb2JhbABEFrclgQeCCQEBBTo/EAsYHBIUKCGIIQe5AIVEij1jBJVekCmCZw X-IronPort-AV: E=Sophos;i="4.73,630,1325458800"; d="scan'208";a="137299375" Received: from furbychan.cocan.org ([80.68.91.176]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 22 Mar 2012 17:42:34 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.72) (envelope-from ) id 1SAl5t-0006XA-Sj; Thu, 22 Mar 2012 16:42:33 +0000 Date: Thu, 22 Mar 2012 16:42:33 +0000 From: "Richard W.M. Jones" To: Alain Frisch Cc: caml-list@inria.fr Message-ID: <20120322164233.GB21740@annexia.org> References: <20120322114710.GA21740@annexia.org> <4F6B206D.6030103@frisch.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F6B206D.6030103@frisch.fr> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Native dynlink and reloading modules On Thu, Mar 22, 2012 at 01:51:57PM +0100, Alain Frisch wrote: > On 03/22/2012 12:47 PM, Richard W.M. Jones wrote: > > > >I'm a bit surprised to find that native dynlink doesn't work in the > >same way as bytecode dynlink in respect to reloading the same module. > >(See attached test program) > > > >In bytecode dynlink, reloading (ie. Dynlink.loadfile) the same module > >causes the new module code to override the old module code: > > > > $ ./dynlink_test > > testing bytecode ... > > a > > b > > > >But in native dynlink, the new module is silently discarded and the > >old code appears to run: > > > > $ ./dynlink_test > > testing native ... > > a > > a > > > >I would classify this as a bug, but I'm not quite sure what is > >expected to happen. Is there some other way to override a module as > >in bytecode? > > natdynlink currenlty depends on the OS dynamic linker, we cannot > control the semantics so precisely (you can try loadfile_private, > but I'm not sure it would solve your issue). This is all a bit, umm, unexpected. Stepping back, the problem I'm trying to solve is how to reload a configuration-like file into a daemon without restarting the daemon. The "configuration-like file" is the whenjobs jobs script[1], and the daemon is the whenjobs daemon[2]. Any ideas on how best to go about this? Note that the whenjobs jobs script is intentionally a Turing-complete OCaml program, so converting it to another format is probably not going to be practical. Rich. [1] examples: http://git.annexia.org/?p=whenjobs.git;a=blob;f=tests/jobs/t201_ocaml_set_variable.ml;hb=HEAD http://people.redhat.com/~rjones/whenjobs/whenjobs.txt [2] http://git.annexia.org/?p=whenjobs.git;a=blob;f=daemon/daemon.ml;h=bc4f51a2f1177e5be2692a233d7f2b850f9a55bc;hb=HEAD#l293 -- Richard Jones Red Hat