Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6596538imu; Wed, 14 Nov 2018 04:11:09 -0800 (PST) X-Google-Smtp-Source: AJdET5f0EjtH6zYP+PQN9lTJJvp0zVrqqTj+FTl4bwUEdHUjcSUkKJmrIywkolBfMoz5I5nuPXEh X-Received: by 2002:a65:4904:: with SMTP id p4mr1517032pgs.384.1542197469309; Wed, 14 Nov 2018 04:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542197469; cv=none; d=google.com; s=arc-20160816; b=qXalPq65AYYjSjB0h2/BBJDNbpXJ16utnEsP2xz/gnRYWyOkguOOZI7MOKqlpELI1y GkzulUaoBjRHDgXusNm/V7BLGFKfynXYjgSdu40vvFoiw2hFONHlQDWPImdma8JTn3ur IEwNYpP5uZpeg/cYcHE0RqQjuoH0lYMR7Ma3Zr4hDf/9OJykyUEXCaqY+KP+YQOPKQEg FzAN48usp7Eyb6ylNNJmACap2G0HKIe6hBiyo8ZXxqUlql3pOQz5MZ/yngfyP+vIdpBm 1O9ymW215oYxg+Bb1D9shsFtO/P14JG60+VtniDGxZtJKZywO8IHlkIYsb2mBn1AWNpX yCww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=aZtcnzS10xE0roJa0UAD9yy31GPH5KvTwqAiZKBOq+g=; b=dOzv03BUcorCL2Vshm1Y6m7HAPeGBVv9MOSCvlvEi2Z6zAjXnyv3mooyljOmey8dj8 uVcHfDxc7513el4YCYKxsLv5YPS7eCDYcoWDU9AnkGVLd62M6CM89wDwNrZn1jyb+oNN bJompCWIFqpjC2t/bq7I2z6gNWFi+7vLQGSENsRce7rV794Z+eP5LYp4BwezM57pN1Y3 QPVlGAHG4zt6SJIJu4uu/9Cy4BH+88DdBZDkS6l1+abnDzJt/SSLGizz046cT99HFK9w WZjZtJViiYbvkbRBy3ql988VNbKafTEl5sE7H4OYILE4Dfv0v5ABDjGzwkDJPRtkuZgP LqKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f39-v6si25076371plb.149.2018.11.14.04.10.52; Wed, 14 Nov 2018 04:11:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732544AbeKNWN0 (ORCPT + 99 others); Wed, 14 Nov 2018 17:13:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbeKNWN0 (ORCPT ); Wed, 14 Nov 2018 17:13:26 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE42488E57; Wed, 14 Nov 2018 12:10:26 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-117-210.ams2.redhat.com [10.36.117.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA01E103BAAD; Wed, 14 Nov 2018 12:10:22 +0000 (UTC) From: Florian Weimer To: Adam Borowski Cc: Willy Tarreau , "Michael Kerrisk \(man-pages\)" , Daniel Colascione , linux-kernel , Joel Fernandes , Linux API , Vlastimil Babka , Carlos O'Donell , "libc-alpha\@sourceware.org" Subject: Re: Official Linux system wrapper library? References: <20181111081725.GA30248@1wt.eu> <3664a508-ca74-4ff0-39a6-34543194a24e@gmail.com> <20181111111143.GB4189@1wt.eu> <87zhufvntw.fsf@oldenburg.str.redhat.com> <20181114120348.or5id3hzrmltkyvb@angband.pl> Date: Wed, 14 Nov 2018 13:10:16 +0100 In-Reply-To: <20181114120348.or5id3hzrmltkyvb@angband.pl> (Adam Borowski's message of "Wed, 14 Nov 2018 13:03:48 +0100") Message-ID: <87va4zc11z.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 12:10:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Adam Borowski: > On Sun, Nov 11, 2018 at 12:46:35PM +0100, Florian Weimer wrote: >> A lot of multi-threaded applications assume that most high-level >> functionality remains usable even after fork in a multi-threaded >> process. > > How would this be even possible? Currently fork kills all threads > (save for the caller). glibc's fork acquires several locks around fork. Other mallocs install fork handlers, too. > Glibc's manpage also warns: > > # After a fork() in a multithreaded program, the child can safely call only > # async-signal-safe functions (see signal-safety(7)) until such time as it > # calls execve(2). > > Which makes sense as its malloc uses a mutex, and you can't take a breath > without a library call using malloc somewhere (or in C++, the language > itself). Right, but applications require a working malloc after fork, unfortunately. opendir is often used to enumerate file descriptors which need closing, for example. Thanks, Florian