From owner-freebsd-questions@FreeBSD.ORG Tue Apr 29 21:41:30 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9052A17B for ; Tue, 29 Apr 2014 21:41:30 +0000 (UTC) Received: from mail-out.apple.com (honeycrisp.apple.com [17.151.62.51]) (using TLSv1 with cipher DES-CBC3-SHA (168/168 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 730011CA1 for ; Tue, 29 Apr 2014 21:41:29 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from mail-out.apple.com by local.mail-out.apple.com (Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22 2013)) id <0N4T00B00AKXD100@local.mail-out.apple.com> for freebsd-questions@freebsd.org; Tue, 29 Apr 2014 14:41:23 -0700 (PDT) Received: from relay4.apple.com ([17.128.113.87]) by local.mail-out.apple.com (Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22 2013)) with ESMTP id <0N4T005G5AWZZ590@local.mail-out.apple.com>; Tue, 29 Apr 2014 14:41:23 -0700 (PDT) X-AuditID: 11807157-f79aa6d0000017b2-14-53601c8411b7 Received: from [17.149.230.127] (Unknown_Domain [17.149.230.127]) (using TLS with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by relay4.apple.com (Apple SCV relay) with SMTP id 28.12.06066.48C10635; Tue, 29 Apr 2014 14:41:24 -0700 (PDT) Subject: Re: system(3) && open file descriptors From: Charles Swiger In-reply-to: <20140429184307.GA1114@tiny-r255948> Date: Tue, 29 Apr 2014 14:41:22 -0700 Message-id: <71BBF914-AA3A-4701-8395-0A5C49474948@mac.com> References: <20140429184307.GA1114@tiny-r255948> To: Matthias Apitz X-Mailer: Apple Mail (2.1510) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsUiOPVZvW6LTEKwweofShYvv25isbh/+RqL A5PHjE/zWTyWHpjDHMAUxWWTkpqTWZZapG+XwJXx7e8DpoLHLBVvVk9mbWB8yNzFyMkhIWAi cfpLJyuELSZx4d56ti5GLg4hgX4mie0db5lAEswCWhI3/r0Esjk4eAX0JLb/kgMJCwvoS3xZ 1cIGEmYTUJOYMJEHJMwpYCjx8vNzsJEsAqoSk9oOsEBMUZTY0bYGypaX2P52DjPERCuJiRNt QcJCAgYS6781s4HYIkCtn7c/Z4K4TFbi9LnnLBMY+WchuWcWwj2zkAxdwMi8ilGgKDUnsdJE L7GgICdVLzk/dxMjKNgaCsN3MP5bZnWIUYCDUYmHV2BrfLAQa2JZcWXuIUYJDmYlEd45LAnB QrwpiZVVqUX58UWlOanFhxilOViUxHnPRMYGCwmkJ5akZqemFqQWwWSZODilGhjlPydcY5jm LL9Y/P59dsnmb1d/Ku8+4/54ZWP6drEyRhW9vlueXMULGZkPP2H+V3bhs41vp6LFF9+Y1rev 56gLTYw0/S22klXk78q9DaemfjKafNmJ26o6nzX9wPTZBza8nnE62WRNRbeBatkjIfYg0+51 afOW9i1obJhaoDwzOK7GdPJSuUVKLMUZiYZazEXFiQCtPhNaMgIAAA== Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2014 21:41:30 -0000 Hi-- On Apr 29, 2014, at 11:43 AM, Matthias Apitz wrote: > It seems that the proc started by the C library call system(3), as > /bin/sh -c string > owns the same set of open file descriptors as its calling proc. Is this > somewhere documented as a feature? 'man system" does not say anything > about, while 'man fork' does. At least my version of system(3) says that it invokes fork(2) and checks the exit status of the shell via waitpid(2). That plus listing fork(2) in SEE ALSO section seems to be enough of a pointer to the detailed behavior.... Regards, -- -Chuck