[PATCH] misc: Add mkostempat (BZ 19866)

Paul Eggert eggert@cs.ucla.edu
Tue Jun 23 19:09:52 GMT 2026


On 2026-06-23 10:01, Mark Wielaard wrote:
> int
> mkostempat (int dirfd,
>             int (*tryfunc) (int, char**, void *), void *args,
>             int len, char **name)

Yes, I was thinking along those lines, though 'len' isn't needed (it can 
be deduced from the template). Even 'dirfd' can be dispensed with if we 
want to simplify the API further, as the caller can pass it as part of 
the args.

This is the sort of thing Gnulib is doing already, though the API needs 
to be rationalized (a better name for the function, for example). (If 
the function's name ends in "at", it should keep 'dirfd' as an arg, 
though really the idea is more general than an "at" function.)

All the existing mk*t*mp* functions can be implemented atop this 
more-general idea.

> Or maybe we can allow NULL for the callback, in which case it would be
> the "standard" name/mode/len?

That also works.


More information about the Libc-alpha mailing list