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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux