Thread (17 messages) flat view 17 messages, 8 authors, 2021-03-08

Re: [RFC PATCH] fs: introduce mkdirat2 syscall for atomic mkdir

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2021-02-28 02:14:52
Also in: linux-api

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help