[RFA:] add _mkdir_r, fixing fallout from "add mkstemps, mkdtemp"

Eric Blake ebb9@byu.net
Wed Aug 12 17:41:00 GMT 2009

Hash: SHA1

According to Hans-Peter Nilsson on 8/11/2009 5:40 PM:
>> +#if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 2
>> +      if (domkdir)
>> +	{
>> +	  if (_mkdir_r (ptr, path, 0700) == 0)
>> +	    return 1;
>> +	  if (ptr->_errno != EEXIST)
>> +	    return 0;
>> +	}
>> +      else
>> +#endif /* _ELIX_LEVEL */
> So, where did you find that _mkdir_r you're calling?  Were there
> missing parts to the above patches?  Would those parts look like
> the patches below, adding necessary framework and stub for the
> mkdir syscall?

I just assumed that it worked like any other syscall, but you are correct
that newlib has not yet wrapped mkdir.  It worked for me on cygwin because
cygwin overrides mk*temp* in order to use a more secure random string
generation function, so this particular block wasn't getting compiled
under cygwin.

> With this patch, I can use today's newlib with test-suite
> results fixed (the same as before the above patch) for cris-elf.
> Nope, didn't test it anywhere else.  Not trying to raise the bar.
> Ok to commit?

I can't approve it, but it looks obvious to me.

> (PS. can we start using ISO C89 non-K&R function headers soon?)

Not really - there are other benefits to using macro wrappers, such as
cygwin being able to add dllexport attributes to all exported functions by
merely changing a single #define, rather than rewriting every file.

> libgloss:
> 2009-08-11  Hans-Peter Nilsson  <hp@axis.com>
> 	* libnosys/Makefile.in (OBJS): Add mkdir.
> 	* libnosys/mkdir.c: New file.
> newlib:
> 2009-08-11  Hans-Peter Nilsson  <hp@axis.com>
> 	* libc/include/reent.h: Add prototype and definition of _mkdir_r.
> 	* libc/reent/Makefile.am (GENERAL_SOURCES): Add mkdirr.c.
> 	(CHEWOUT_FILES): Add mkdirr.def.
> 	* libc/reent/Makefile.in: Regenerate.
> 	* libc/reent/mkdirr.c: New file.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Newlib mailing list