[systemd-devel] [RFC PATCH 1/2] Replace mkostemp+unlink with open(O_TMPFILE)

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Jan 27 10:50:36 PST 2014


On Mon, Jan 27, 2014 at 07:15:23PM +0100, Kay Sievers wrote:
> On Mon, Jan 27, 2014 at 6:27 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Mon, Jan 27, 2014 at 05:57:56PM +0100, Kay Sievers wrote:
> 
> >> Can we expect open(O_TMPFILE) to fail on kernels which do not support it?
> 
> >> I guess they will just silently ignore it? Then we never unlink?
> 
> > No, it is supposed to fail properly if it doesn't work. The flags were
> > changed to be incompatible with old kernels. We should probably have a
> > unit test for that. I have a small utility I was using for tests, I'll
> > dig it up.
> 
> Oh, any idea how this works? I couldn't see any kernel code that
> checks for currently unused flags and fails.

open("/tmp", O_TMPFILE|O_RDWR, S_IRUSR | S_IWUSR)

returns -1, errno=EISDIR on Linux 3.9.

Zbyszek


More information about the systemd-devel mailing list