From patchwork Thu Feb 18 15:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 42101 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ADB74394D88D; Thu, 18 Feb 2021 15:15:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADB74394D88D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613661309; bh=4oZWeumg03d8Z1y5Lnt1KGkf0PD/+G44xxBEli+me8o=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qJtxSPByxoTN042yfrX+xGnAhL5ZNtqqjCad87N9VAOkw9LDiSpLRBamCcRTT1d7j v+r2jmy8Fxuw4rgPlQdGJeOM6967tlbfa6CzdQigyAc9jrGA7rrBkUiqULsBa9egK0 l/zQNpZbp0DY7JMZmVg643+n2PzscZAhJPIuUX0I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 82F983870889 for ; Thu, 18 Feb 2021 15:15:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 82F983870889 Received: by mail-wm1-x32c.google.com with SMTP id a207so4301798wmd.1 for ; Thu, 18 Feb 2021 07:15:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4oZWeumg03d8Z1y5Lnt1KGkf0PD/+G44xxBEli+me8o=; b=Ay1x/WtCln9oy0kz3ajhLmYdvgVyyUb9p8ptfOARUB5sun75FuL7BEb49JU1s8+mSA mzaJzks/UQ9QEkBV7RYnAx4e80ZsXip0guKvuR/tM81wnsNocJDr5HfQf8fH6e26znPp VC2AzoMzTJ6TY6NZbgvuG5mSQoBrm79iEs0OhMtCQnZFlmo1NeOEysqPRkSMx/3bHVHM oiKsQ1mTGkY09LK0Sb6L54IZM0WUikmVqsJ/BywbvX9dyLOftzkB+9xgXA37/aB4/AAH 2ZH/75BIPKP4DnWkH+tIRRRh6C+cNP7wEpFMiuZJKiuZhE1TYF9oOZo/KUChgI1d/XT6 +5oA== X-Gm-Message-State: AOAM531VLZ3A5pOonsdwUHyYYaiK7gDk8RFvFCCkRhdRadcvnGXR15Yr vEq1ov/9uOTQ+H5c5DGVsKs= X-Google-Smtp-Source: ABdhPJwtIJqjqzAGT9hXk10R/Qa398m5v2JYPqfHkS4B5i+SEsUvq1nXBulTGEu+ecSq189+DIW5sw== X-Received: by 2002:a05:600c:3516:: with SMTP id h22mr4076388wmq.35.1613661305650; Thu, 18 Feb 2021 07:15:05 -0800 (PST) Received: from localhost.localdomain ([170.253.51.130]) by smtp.googlemail.com with ESMTPSA id k128sm3363760wmf.42.2021.02.18.07.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 07:15:05 -0800 (PST) To: mtk.manpages@gmail.com Subject: [RFC v2] execve.2: SYNOPSIS: Document both glibc wrapper and kernel sycalls Date: Thu, 18 Feb 2021 16:13:42 +0100 Message-Id: <20210218151341.51095-1-alx.manpages@gmail.com> X-Mailer: git-send-email 2.30.1.721.g45526154a5 In-Reply-To: <938df2c0-04b5-f6a4-79c3-b8fe09973828@gmail.com> References: <938df2c0-04b5-f6a4-79c3-b8fe09973828@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alejandro Colomar via Libc-alpha From: Alejandro Colomar Reply-To: Alejandro Colomar Cc: Alejandro Colomar , linux-man@vger.kernel.org, libc-alpha@sourceware.org, Florian Weimer , linux-kernel@vger.kernel.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Until now, the manual pages have (usually) documented only either the glibc (or another library) wrapper for a syscall, or the kernel syscall (this only when there's not a wrapper). Let's document both prototypes, which many times are slightly different. This will solve a problem where documenting glibc wrappers implied shadowing the documentation for the raw syscall. Signed-off-by: Alejandro Colomar --- man2/execve.2 | 15 +++++++++++++-- man2/membarrier.2 | 14 +++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/man2/execve.2 b/man2/execve.2 index 027a0efd2..318c71c85 100644 --- a/man2/execve.2 +++ b/man2/execve.2 @@ -41,8 +41,8 @@ execve \- execute program .nf .B #include .PP -.BI "int execve(const char *" pathname ", char *const " argv [], -.BI " char *const " envp []); +.BI "int execve(const char *" pathname ", +.BI " char *const " argv "[], char *const " envp []); .fi .SH DESCRIPTION .BR execve () @@ -772,6 +772,17 @@ Thus, this argument list was not directly usable in a further .BR exec () call. Since UNIX\ V7, both are NULL. +.SS C library/kernel differences +.RS 4 +.nf +/* Kernel system call: */ +.BR "#include " " /* For " SYS_* " constants */" +.B #include +.PP +.BI "int syscall(SYS_execve, const char *" pathname , +.BI " const char *const " argv "[], const char *const " envp []); +.fi +.RE .\" .\" .SH BUGS .\" Some Linux versions have failed to check permissions on ELF diff --git a/man2/membarrier.2 b/man2/membarrier.2 index 173195484..25d6add77 100644 --- a/man2/membarrier.2 +++ b/man2/membarrier.2 @@ -28,13 +28,12 @@ membarrier \- issue memory barriers on a set of threads .SH SYNOPSIS .nf .PP -.B #include +.BR "#include " " /* For " MEMBARRIER_* " constants */" +.BR "#include " " /* For " SYS_* " constants */" +.B #include .PP -.BI "int membarrier(int " cmd ", unsigned int " flags ", int " cpu_id ); +.BI "int syscall(SYS_membarrier, int " cmd ", unsigned int " flags ", int " cpu_id ); .fi -.PP -.IR Note : -There is no glibc wrapper for this system call; see NOTES. .SH DESCRIPTION The .BR membarrier () @@ -295,7 +294,7 @@ was: .PP .in +4n .EX -.BI "int membarrier(int " cmd ", int " flags ); +.BI "int syscall(SYS_membarrier, int " cmd ", int " flags ); .EE .in .SH CONFORMING TO @@ -322,9 +321,6 @@ Examples where .BR membarrier () can be useful include implementations of Read-Copy-Update libraries and garbage collectors. -.PP -Glibc does not provide a wrapper for this system call; call it using -.BR syscall (2). .SH EXAMPLES Assuming a multithreaded application where "fast_path()" is executed very frequently, and where "slow_path()" is executed infrequently, the