Implement uv_fs_mkdtemp

I implemented `uv_fs_mkdtemp` for unices and created a test for that. Could someone confirm that I am on the right way or provide some suggestions before I start implementing `uv_fs_mkdtemp` for Windows? Specifically I'm in doubt whether `uv_fs_t->ptr` is the right place for storing the name of temp directory which was created by underlying `mkdtemp`.

For Windows I want to use `glibc`'s [implementation](http://fossies.org/dox/glibc-2.19/mkdtemp_8c_source.html) which uses [`__gen_tempname`](http://fossies.org/dox/glibc-2.19/sysdeps_2posix_2tempname_8c_source.html#l00229).

Should close #1315
Nah, leave them as is, I checked glibc and it also does it like that. Can
you squash all commits into one?
On Jul 24, 2014 8:05 AM, "Pavel Platto" <notifications@github.com> wrote:

> In src/win/fs.c:
>
> > +     can exist for a given template is 62**6. It should never be
> > +     necessary to try all these combinations. Instead if a reasonable
> > +     number of names is tried (we define reasonable as 62**3) fail to
> > +     give the system administrator the chance to remove the problems. */
> > +#define ATTEMPTS_MIN (62 * 62 * 62)
> > +
> > +  /* The number of times to attempt to generate a temporary file. To
> > +     conform to POSIX, this must be no smaller than TMP_MAX. */
> > +#if ATTEMPTS_MIN < TMP_MAX
> > +  unsigned int attempts = TMP_MAX;
> > +#else
> > +  unsigned int attempts = ATTEMPTS_MIN;
> > +#endif
> > +
> > +  len = wcslen(req->pathw);
> > +  if (len < 6 || wcsncmp(&req->pathw[len - 6], L"XXXXXX", 6)) {
>
>  can you just use 6 there even if it's a wide-char string?
>
> Yes, it is count of characters to match, not bytes (docs says that and I
> checked it now).
>
> maybe we can have a static buffer with 6 "X"s, and its length, instead of
> having 6 everywhere?
>
> Do you have idea how to name these variables? I have only two variants:
>
>    - template_part_pattern and template_part_pattern_len which is perhaps
>    too long.
>    - xs and xs_len which also is not ideal but I like it more.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/joyent/libuv/pull/1368/files#r15331159>.
>