Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / mkdirr.c
blobcf66a24d32a8a303dbba12555fe03269c20de058
1 /* Reentrant versions of mkdir system call. */
3 #include <reent.h>
4 #include <unistd.h>
5 #include <_syslist.h>
7 /* Some targets provides their own versions of this functions. Those
8 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
10 #ifdef _REENT_ONLY
11 #ifndef REENTRANT_SYSCALLS_PROVIDED
12 #define REENTRANT_SYSCALLS_PROVIDED
13 #endif
14 #endif
16 #ifndef REENTRANT_SYSCALLS_PROVIDED
18 /* We use the errno variable used by the system dependent layer. */
19 #undef errno
20 extern int errno;
23 FUNCTION
24 <<_mkdir_r>>---Reentrant version of mkdir
26 INDEX
27 _mkdir_r
29 SYNOPSIS
30 #include <reent.h>
31 int _mkdir_r(struct _reent *<[ptr]>,
32 const char *<[path]>, int <[mode]>);
34 DESCRIPTION
35 This is a reentrant version of <<mkdir>>. It
36 takes a pointer to the global data block, which holds
37 <<errno>>.
40 #include <sys/stat.h>
42 int
43 _mkdir_r (struct _reent *ptr,
44 const char *path,
45 int mode)
47 int ret;
49 errno = 0;
50 if ((ret = _mkdir (path, mode)) == -1 && errno != 0)
51 _REENT_ERRNO(ptr) = errno;
52 return ret;
56 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */