From xen-devel-bounces@lists.xen.org Thu Nov 19 11:35:27 2015 Received: (at maildrop) by bugs.xenproject.org; 19 Nov 2015 11:35:27 +0000 Received: from lists.xenproject.org ([50.57.142.19] helo=lists.xen.org) by bugs.xenproject.org with esmtp (Exim 4.80) (envelope-from ) id 1ZzNUt-0004EP-Cy for xen-devel-maildrop-Eithu9ie@bugs.xenproject.org; Thu, 19 Nov 2015 11:35:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZzNTb-0002IO-Jc; Thu, 19 Nov 2015 11:34:07 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZzNTZ-0002IG-Vz for xen-devel@lists.xen.org; Thu, 19 Nov 2015 11:34:06 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id F1/89-03235-DA3BD465; Thu, 19 Nov 2015 11:34:05 +0000 X-Env-Sender: prvs=758086435=Andrew.Cooper3@citrix.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1447932842!4909367!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33952 invoked from network); 19 Nov 2015 11:34:04 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Nov 2015 11:34:04 -0000 X-IronPort-AV: E=Sophos;i="5.20,317,1444694400"; d="scan'208";a="313323569" Message-ID: <564DB393.3070805@citrix.com> Date: Thu, 19 Nov 2015 11:33:39 +0000 From: Andrew Cooper User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Ian Campbell , Martin Osterloh , "xen-devel@lists.xen.org" References: <564CC43B.1000904@ainfosec.com> <1447924858.5647.15.camel@citrix.com> <564DAA8D.5060305@citrix.com> <1447932195.5647.46.camel@citrix.com> In-Reply-To: <1447932195.5647.46.camel@citrix.com> X-DLP: MIA1 Subject: Re: [Xen-devel] Current LibXL Status X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org On 19/11/15 11:23, Ian Campbell wrote: > create ! > title it libxl exit() on ENOMEM incompatible with gc'd languages > thanks Can this be extended to "should not use exit() in general" ? andrewcoop@andrewcoop:/local/xen.git/xen$ git grep exit\( -- :/tools/libxl/libxl* ../tools/libxl/libxl.c:1707: _exit(0); ../tools/libxl/libxl.c:1711: _exit(errno); ../tools/libxl/libxl.c:1716: _exit(-1); ../tools/libxl/libxl_aoutils.c:478: if (r) { LOGE(ERROR,"openpty failed"); _exit(-1); } ../tools/libxl/libxl_aoutils.c:482: if (rc) { LOGE(ERROR,"sendmsg to parent failed"); _exit(-1); } ../tools/libxl/libxl_aoutils.c:483: _exit(0); ../tools/libxl/libxl_bootloader.c:557: if (r) { LOGE(ERROR, "login_tty failed"); exit(-1); } ../tools/libxl/libxl_bootloader.c:559: exit(-1); ../tools/libxl/libxl_event.c:1387: exit(-1); ../tools/libxl/libxl_event.h:104: * and call exit(-1). ../tools/libxl/libxl_exec.c:106: _exit(-1); ../tools/libxl/libxl_exec.c:316: exit(255); ../tools/libxl/libxl_exec.c:324: _exit(127); ../tools/libxl/libxl_exec.c:340: _exit(r); ../tools/libxl/libxl_internal.c:28: _exit(-1); ../tools/libxl/libxl_remus_disk_drbd.c:229: _exit(ackwait); ../tools/libxl/libxl_save_callout.c:184: exit(-1); ../tools/libxl/libxl_save_helper.c:64: if (r < 0) { perror("memory allocation failed during logging"); exit(-1); } ../tools/libxl/libxl_save_helper.c:102: exit(-1); ../tools/libxl/libxl_save_helper.c:122: if (!r) { perror("memory allocation failed"); exit(-1); } ../tools/libxl/libxl_save_helper.c:189: if (r<0) { perror("write"); exit(-1); } ../tools/libxl/libxl_save_helper.c:210: if (r<=0) exit(-2); ../tools/libxl/libxl_save_helper.c:230: exit(0); ../tools/libxl/libxlu_cfg_l.c:1763: exit( YY_EXIT_FAILURE ); ../tools/libxl/libxlu_disk_l.c:2248: exit( YY_EXIT_FAILURE ); The majority of those are cases are not appropriate uses of exit(). AFAIIR, the *only* valid use of exit() in a library is to clean up in a child process from a library-initiated fork(). ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel