xref: /haiku/src/system/libroot/posix/sys/mkfifo.c (revision 893988af824e65e49e55f517b157db8386e8002b)
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the Haiku 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 mkfifo(const char *path, mode_t mode)
22 {
23 	status_t error = _kern_create_fifo(path, mode);
24 
25 	RETURN_AND_SET_ERRNO(error);
26 }
27