linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: linux-api@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Yury Norov" <yury.norov@gmail.com>,
	"Alexander A. Klimov" <grandmaster@al2klimov.de>,
	"André Almeida" <andrealmeid@collabora.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"David Sterba" <dsterba@suse.com>,
	"Joe Perches" <joe@perches.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>
Subject: [PATCH] Documentation: syscalls: add a note about  ABI-agnostic types
Date: Fri,  9 Apr 2021 13:43:04 -0700	[thread overview]
Message-ID: <20210409204304.1273139-1-yury.norov@gmail.com> (raw)

Recently added memfd_secret() syscall had a flags parameter passed
as unsigned long, which requires creation of compat entry for it.
It was possible to change the type of flags to unsigned int and so
avoid bothering with compat layer.

https://www.spinics.net/lists/linux-mm/msg251550.html

Documentation/process/adding-syscalls.rst doesn't point clearly about
preference of ABI-agnostic types. This patch adds such notification.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 Documentation/process/adding-syscalls.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/process/adding-syscalls.rst b/Documentation/process/adding-syscalls.rst
index 9af35f4ec728..46add16edf14 100644
--- a/Documentation/process/adding-syscalls.rst
+++ b/Documentation/process/adding-syscalls.rst
@@ -172,6 +172,13 @@ arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit
 registers.  (This concern does not apply if the arguments are part of a
 structure that's passed in by pointer.)
 
+Whenever possible, try to use ABI-agnostic types for passing parameters to
+a syscall in order to avoid creating compat entry for it. Linux supports two
+ABI models - ILP32 and LP64. The types like ``void *``, ``long``, ``size_t``,
+``off_t`` have different size in those ABIs; types like ``char`` and  ``int``
+have the same size and don't require a compat layer support. For flags, it's
+always better to use ``unsigned int``.
+
 
 Proposing the API
 -----------------
-- 
2.25.1


             reply	other threads:[~2021-04-09 20:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 20:43 Yury Norov [this message]
2021-04-14  4:40 ` [PATCH] Documentation: syscalls: add a note about ABI-agnostic types Yury Norov
2021-04-14  6:14   ` Mauro Carvalho Chehab
2021-04-14  8:46     ` Christian Brauner
2021-04-14  9:46       ` Mike Rapoport
2021-04-14 13:38         ` Christian Brauner
2021-04-15 19:34           ` Yury Norov
2021-04-14 16:06     ` Yury Norov
2021-04-27  2:24 ` Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409204304.1273139-1-yury.norov@gmail.com \
    --to=yury.norov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrealmeid@collabora.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=dsterba@suse.com \
    --cc=grandmaster@al2klimov.de \
    --cc=joe@perches.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).