Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 41919 invoked from network); 16 Oct 2006 08:17:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Oct 2006 08:17:37 -0000 Received: (qmail 45910 invoked by uid 500); 16 Oct 2006 08:17:32 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 45866 invoked by uid 500); 16 Oct 2006 08:17:32 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 45855 invoked by uid 99); 16 Oct 2006 08:17:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Oct 2006 01:17:32 -0700 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of liyilei1979@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Oct 2006 01:17:31 -0700 Received: by nf-out-0910.google.com with SMTP id a4so85816nfc for ; Mon, 16 Oct 2006 01:17:09 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=U19LCzU9KafZEUAK78b7W3YG7P/EZhsyOXvY1Ecg/qRb69fjwYCJXeeXj0KW1yLPxHTjBbTfdqWJ4WDKbBb/gnEdv9FTbXkVngYgMJ/ahRuPQv+T7oXW8dYpRIOlUHJ+SYJu2acJzoP5RHxGGazsH31rVjmc8oY4AvUSb6n2yFA= Received: by 10.78.181.13 with SMTP id d13mr7330731huf; Mon, 16 Oct 2006 01:17:09 -0700 (PDT) Received: by 10.78.150.19 with HTTP; Mon, 16 Oct 2006 01:17:09 -0700 (PDT) Message-ID: Date: Mon, 16 Oct 2006 16:17:09 +0800 From: "Leo Li" To: harmony-dev@incubator.apache.org Subject: [classlib][luni]Runtime.exec fails on Linux MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_40960_29106317.1160986629381" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_40960_29106317.1160986629381 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, all: The harmony Runtime.exec fails on Linux with ENOMEM. Here is the testcase: public class Exec { public static void main(String[] args) throws Exception { Runtime.getRuntime().exec("ls"); } } I have tried it on RedHat Enterprise 4 and Unbuntu, both get ENOMEM in native code. After digging into it, I found it fails in procimpl.c, line 135: grdpid = fork (); If the call to fork is changed to vfork, the testcase will pass but still get exitcode = 1 which indicates that some error has happened. The difference between fork and vfork is just whether page tables is copied to child process or not. But I do not think it is the main cause. Besides, vfork has become outdated since it main usage is supplied by fork with copy-on-write function implemented in modern linux kernel. Furthermore, vfork is also not so safe as fork. So I do not think it is the accepted way to solve the problem. I will try whether it can be reproduced on drlvm of linux since I am not sure whether it is relevent to VM or classlib. If any drlvm man can tell me the result, it can avoid my trouble to build it on linux. :) -- Leo Li China Software Development Lab, IBM ------=_Part_40960_29106317.1160986629381--