All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Drew DeVault <sir@cmpwn.com>
Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	Aleksa Sarai <cyphar@cyphar.com>
Subject: Re: [RFC PATCH] fs: introduce mkdirat2 syscall for atomic mkdir
Date: Sun, 28 Feb 2021 02:13:38 +0000	[thread overview]
Message-ID: <YDr8UihFQ3M469x8@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20210228002500.11483-1-sir@cmpwn.com>

On Sat, Feb 27, 2021 at 07:25:00PM -0500, Drew DeVault wrote:

> This introduces mkdirat2, along with the requisite flag argument, which
> presently accepts the same flags as open - allowing the caller to
> specify, say, O_CLOEXEC - and leaving us room to expand the next time an
> unforeseeable addition to mkdir is called for. Otherwise, it behaves
> identically to mkdirat, but returns an open file descriptor for the new
> directory.

No to the ABI part; "on error it returns -E..., on success - 0 or
a non-negative number representing a file descriptor (zero also possible,
but unlikely)" is bloody awful as calling conventions go, especially
since the case when 0 happens to be a descriptor is not going to get
a lot of testing on the userland side.

Don't mix "return an error or descriptor" with "return an error or 0".
It's going to end up a regular source of userland bugs.

  reply	other threads:[~2021-02-28  2:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  0:25 [RFC PATCH] fs: introduce mkdirat2 syscall for atomic mkdir Drew DeVault
2021-02-28  2:13 ` Al Viro [this message]
2021-02-28  2:21   ` Drew DeVault
2021-02-28  2:58     ` Al Viro
2021-02-28 13:56       ` Drew DeVault
2021-03-01 19:02       ` J. Bruce Fields
2021-03-08 13:50         ` Stefan Metzmacher
2021-02-28  2:24 ` Matthew Wilcox
2021-02-28  2:26   ` Drew DeVault
2021-02-28  4:03     ` Matthew Wilcox
2021-02-28 13:57       ` Drew DeVault
2021-03-01 19:09         ` J. Bruce Fields
2021-03-01 19:35           ` Matthew Wilcox
2021-03-01 20:10             ` J. Bruce Fields
2021-03-02  8:24             ` Miklos Szeredi
2021-03-02  7:13         ` Amir Goldstein
2021-03-03  2:39           ` Aleksa Sarai

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=YDr8UihFQ3M469x8@zeniv-ca.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=cyphar@cyphar.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sir@cmpwn.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.