From: Ian Jackson Subject: libxl and malloc failure (Re: Current LibXL Status) Date: Thu, 18 Feb 2016 18:15:23 +0000 Message-ID: <22214.2619.86697.724156@mariner.uk.xensource.com> References: <564CC43B.1000904@ainfosec.com> <1447924858.5647.15.camel@citrix.com> <564DAA8D.5060305@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <564DAA8D.5060305@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Martin Osterloh , Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Andrew Cooper writes ("Re: [Xen-devel] Current LibXL Status"): > There really is a show-stopper, which I have stated before. > > Languages such as OCaml use -ENOMEM as a hint to run the garbage > collector some more. I expect Haskell is the same. This cannot possibly be true (if what you mean is that they use ENOMEM[1] from malloc as such an indication). It would make it impossible to write a correct binding to a normal C library. Typically C library which calls malloc will do so in the middle of its execution. Even if the library returns the resulting error up as a distinguishable error code, you can't just make the same library call again - it may have done half its work but not the other half. So I think you must be wrong. Ian. [1] NB that when malloc fails there is no -ENOMEM, only ENOMEM.