[PATCH] misc: Add mkostempat (BZ 19866)
Paul Eggert
eggert@cs.ucla.edu
Fri Jun 26 00:45:44 GMT 2026
On 2026-06-25 14:59, Mark Wielaard wrote:
> If not, can we have a simple mkstempat one that just adds the dirfd
> argument, but doesn't try to fix any other issue?
We could, but there is always one more feature that people want. For
example, if/when Linux adds O_CREAT|O_DIRECTORY support to openat2, or a
mkdirat2 API (or whatever), we'll need yet another function to make this
new kernel facility available in the mkdtemp family.
In the end it's simpler to have a function with a callback.
Gnulib supports historical or standardized variants like
gen_register_open_temp, gen_tempname_len, mkdtemp, mkostemp, mkostemps,
mkstemp, mkstemps, and tmpfile. What a mess, right! But once we have a
callback-oriented function we don't need to add more to the mess. And in
Gnulib these variants are all implemented atop a callback-oriented
function anyway.
More information about the Libc-alpha
mailing list