xref: /haiku/src/system/libroot/posix/sys/mkdir.c (revision 2ae568931fcac7deb9f1e6ff4e47213fbfe4029b)
1 /*
2 ** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 
7 #include <sys/stat.h>
8 #include <syscalls.h>
9 #include <errno.h>
10 
11 
12 #define RETURN_AND_SET_ERRNO(err) \
13 	if (err < 0) { \
14 		errno = err; \
15 		return -1; \
16 	} \
17 	return err;
18 
19 
20 int
21 mkdir(const char *path, mode_t mode)
22 {
23 	status_t status = _kern_create_dir(-1, path, mode);
24 
25 	RETURN_AND_SET_ERRNO(status);
26 }
27 
28