Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3240610imu; Sat, 24 Nov 2018 00:52:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vr4Jk94BCD7wWsBacVL7Qu2OKDukkh9q71ggZpQrUmXIUjUiwd2yiaffv8NxNjhUVMxWP7 X-Received: by 2002:a17:902:1681:: with SMTP id h1mr19302065plh.129.1543049529114; Sat, 24 Nov 2018 00:52:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543049529; cv=none; d=google.com; s=arc-20160816; b=wXctd4elx5KYq1F7OuzlPXr35rdVZKN37S9wT03/XG9fgYBurTBZGKu+hGFtTZiqew QMvs4XwVznLnWUCEtpQcTHwcr72cwSA4DDBTh1dQ0ZlABWDwnopVKhN7zCdAyOFR0FkL ptsc82BT0hIZaRXgHxfCiuA49pa9adoa0PK6Kt6DFiZz5ymkxLulkY5Jky4QAmmxHcxb RQtvI6QiA9vnnNiJ2I+rzotzuLcq64R61akNO6LY/ll0t9D6bxQ1IylNKnEaAQ8rTvwv J5TP4SIvWgZ4oh52IHvOVzH+egX+Usr1KXHtAry/HJ20qamcVD/jgj4NRJMdPQ7wV/qw 1cMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cR54/n7KNZUihlscX6wIjCxZtCWGWQoq6nR0dzcOMhc=; b=Sd3lRnaVyH+QLqEGV/zW++atA6qypV/07ppSNukj39N+lHwtOVCHohc/Qxm9S5mUMg ivVKAaZwbCgN9EJbIfuhmF3Db9uV/3MQ1JDsXxcNazI7scSnie8poIXlFsWSjXQgCZkB b9uhFWW4bLfWe8/LyOAcJvZt+cvcgASRifvHZIhogwPw7zKRJBlDbcBD4WJeuxiOgbNx EJftiMVWP0HxzmhwXt1glKSRq9KPJEjdU2QteSkZyX8hSpFVCtLPo7uvFyOWKW1iKfKL Fd2Lz0FztsMqX67QnWeymAW6iFMbBxZphfwM/wPQMm9QgsePuSQw0k6DG0p3DRAFSLjJ p66Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LSNsmafb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73si53394982pgd.478.2018.11.24.00.51.54; Sat, 24 Nov 2018 00:52: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; dkim=pass header.i=@google.com header.s=20161025 header.b=LSNsmafb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410231AbeKXHBi (ORCPT + 99 others); Sat, 24 Nov 2018 02:01:38 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:44506 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410222AbeKXHBi (ORCPT ); Sat, 24 Nov 2018 02:01:38 -0500 Received: by mail-vs1-f66.google.com with SMTP id g68so7804372vsd.11 for ; Fri, 23 Nov 2018 12:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cR54/n7KNZUihlscX6wIjCxZtCWGWQoq6nR0dzcOMhc=; b=LSNsmafbz/cqU1318m/c1DHeeuV8f3aYr84Ptd5U1aVzXab1qwqEcGpR5tcVtT1bOf 5WKmNQVF1vFN9VSDS9V+aLtq2+3go2m2gQEwbjxDGMsFpdmwfThDLIuNwG4B+ikRudfw v6C6hIG9zL1TGPS7XAlb04JccRGv9ie97teXyspbIWl/kTegoiupIgsfO4eGkboznHhd w6H1Hm8RLKGITPQ2Xegw9uTAwuWtAXgsVn7lxBCNsze5PqpI6KEd670LYXZfzV9hwX6z jP6OqZTZbzlm7+Ou6pSgKrCqRVAzDFUejLH88e0JJlauCrOh+5Vy9aBdgp+AqvECA9Nw un7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cR54/n7KNZUihlscX6wIjCxZtCWGWQoq6nR0dzcOMhc=; b=CiH+pE2vXhY8RTQwhY8VbL5rmqrZlXX5aQgOZwOK9yhuRW7qpmTJDompF0KwRDa91r f8dLeN98P21ByGdRqRejcvgp98bHNo3li3hrePNiKWAoRzGP8Thvk6TSNe5Xda1guLF5 mV74DdECJ279zVtLwGv+C4iYd+lbcVmrH7pKrXNOo7GPq+gBBb+SYimjtSCAet0TNfCx njpucszosZqlSi6GEtCZ7eo651N+unT83fZxr2p0RQjm3gitCnxgMZvHF3sCMRqAaP2H Wh2zT82R2XDXnu7tpIm6aV2GdwkGOvF5WDJEIYQeMk+nHtkT5eMekGiV7M7LArme7giY KQUQ== X-Gm-Message-State: AGRZ1gL28SmSWPPhm14OdXti3742+KNtGk7QtDgTQAWkEj0VRsPFY4KM 7+YjZ1K6+e88vgxBcpiD6FmrsRBio6G9Tmr9kiHVIw== X-Received: by 2002:a67:6e87:: with SMTP id j129mr7532640vsc.171.1543004152014; Fri, 23 Nov 2018 12:15:52 -0800 (PST) MIME-Version: 1.0 References: <877ehjx447.fsf@oldenburg.str.redhat.com> <875zx2vhpd.fsf@oldenburg.str.redhat.com> <87efbbvrx9.fsf@oldenburg.str.redhat.com> In-Reply-To: <87efbbvrx9.fsf@oldenburg.str.redhat.com> From: Daniel Colascione Date: Fri, 23 Nov 2018 12:15:39 -0800 Message-ID: Subject: Re: Official Linux system wrapper library? To: Florian Weimer Cc: Michael Kerrisk-manpages , linux-kernel , Joel Fernandes , Linux API , Willy Tarreau , Vlastimil Babka , "Carlos O'Donell" , GNU C Library Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 23, 2018 at 5:34 AM Florian Weimer wrote: > > * Daniel Colascione: > > > On Mon, Nov 12, 2018 at 12:11 AM, Florian Weimer wrote: > >> * Daniel Colascione: > >> > >>> If the kernel provides a system call, libc should provide a C wrapper > >>> for it, even if in the opinion of the libc maintainers, that system > >>> call is flawed. > >> > >> It's not that simple, I think. What about bdflush? socketcall? > >> getxpid? osf_gettimeofday? set_robust_list? > > > > What about them? Mentioning that these system calls exist is not in > > itself an argument. > > But socketcall does not exist on all architectures. Neither does > getpid, it's called getxpid on some architectures. So what? On systems on which a given system call does not exist, attempts to link against that system call should fail, or attempts to make that system call should fail at runtime with ENOSYS. That's completely expected and unsurprising behavior, not some unavoidable source of catastrophic confusion. > >> There are quite a few irregularities > > > > So? > > I think it would be a poor approach to expose application developers to > these portability issues. We need to abstract over these differences at > a certain layer, and applications are too late. And glibc is too early. The purpose of the lowest-level user library is not to provide an OS-agnostic portability layer. There are other projects much better-suited to providing portability, including the excellent GLib, Gnulib, and Qt. The purpose of the lowest-level user library is to expose the interfaces of the underlying system, whatever they are. That's a basic tenet of layered interface design. Due to historical accident, the same library (on most Linux systems) serves as both the lowest-level user library and an implementation of some antiquated portability constructs from ANSI C and POSIX. That this library provides these old portability interfaces is not a reason for that library to neglect its responsibility as the lowest-level system interface library. If people find that every attempt to expose even trivial new kernel interfaces turns into an endless trek through a swamp of specious objection (see the gettid debacle), then it becomes perfectly reasonable to find an alternate route over firmer ground. Other glibc developers (e.g., Joseph Myers) have expressed support for adding long-missing system call wrappers, like gettid, as long as the functions are adequately documented. Would you make a sustained objection to these additions? > >> and some editorial discretion appears to be unavoidable. > > > > That's an assertion, not an argument, and I strongly disagree. *Why* > > do you think "editorial discretion" is unavoidable? > > We do not want application authors to write code which uses socketcall, That's an opinion on portability, not an argument for the necessity of "editorial discretion". That you think an application calling socketcall would somehow be a bad idea is not a justification for not providing this interface. Low-level libraries must focus on mechanism, not policy, if a system is to be flexible enough to accommodate unanticipated needs.