From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2683A1F461 for ; Thu, 27 Jun 2019 21:22:54 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=juhEb Uc4ssh544Vdx+hRjJAGRWhkn5GVKhN6WHso08VBYqnSH38oj+eSa3kXzybj55gv6 n4lCJzlynfMfNkwjYQel4rlXSPSlhb6mND9ff/p21/7eETPh4bg70buYw0ZNaMOv +Abm11m2jNtfjI0kL1019WoFCYadxg4uBz7n3w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=4lG3j1l0ljq q2QSYl/0XpvfHMt0=; b=ObpDANLJH72wRMZcUYQCGCpe0ZooiZkUE8zZUxWib6i CUmHdFiD9Kr74K90bWScSWIyDqIGzExhLTezXhJ5T2Q4bkojPKU1E8AxkuJFpe0h 1bbg565l4AQsSeL/w/mHzTarS+IvZD3PQ0dGo1CHVfx8unUhYHnijrvjpbm+3pF0 = Received: (qmail 107272 invoked by alias); 27 Jun 2019 21:22:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 107259 invoked by uid 89); 27 Jun 2019 21:22:51 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: albireo.enyo.de From: Florian Weimer To: "Dmitry V. Levin" Cc: Zack Weinberg , Carlos O'Donell , GNU C Library Subject: Re: wrappers for multiplexed syscalls (was Re: glibc at the Toolchains microconference at LPC 2019) References: <87o92kibdz.fsf@oldenburg2.str.redhat.com> <20190626163908.GA13251@altlinux.org> <530DF2A2-2D76-43F6-81D0-405EFE097A57@brauner.io> <5f740811-e7d7-6ece-4156-89651666e416@redhat.com> <20190627093928.GA25423@altlinux.org> <20190627205259.GA818@altlinux.org> Date: Thu, 27 Jun 2019 23:22:45 +0200 In-Reply-To: <20190627205259.GA818@altlinux.org> (Dmitry V. Levin's message of "Thu, 27 Jun 2019 23:53:00 +0300") Message-ID: <87ef3eu3iy.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain * Dmitry V. Levin: > Speaking of multiplexed syscalls, if we don't event contemplate an idea > of adding a glibc wrapper for __NR_ipc, I think someonme did argue for socketcall when the topic came up a while back. > why would we want to add a wrapper for __NR_bpf or __NR_keyctl? We have wrappers for ioctl, fcntl, ptrace, prctl. I suppose they could serve as models. We'll see what the future will bring on the Linux. I expect that system calls are now easier to wire up consistently across architectures, so perhaps we will see fewer multiplexer system calls in the future. I suspect that, for architecture-independent features, these multiplexers had the important property that a kernel contributor wouldn't need to touch arch-specific code to add further sub-calls, which made them very attractive if you want to roll out new features relatively quickly. Regarding fcntl, I did look into providing a type-safe version of it using _Generic/__builtin_types_compatible_p/__builtin_choose_expr and so on. But then I realized that instead, we probably should have separate fcntl_* functions for each sub-call, similar to what we did for socketcall. gnulib could easily provide high-quality implementations for libcs which do not pick up on this idea. So yes, I tend to agree that exposing wrappers is problematic. > Since these syscalls have interfaces explicitly designed to scare regular > users off and encourage them to use library functions instead, providing > glibc wrappers for them would mislead people into invoking these system > calls directly. These wrappers would lack type checking available in > higher-level library functions, causing unnecessary runtime errors that > are easily avoidable at compile time when higher-level library functions > are used. Right. And fcntl isn't so different, actually. Thanks, Florian