14dc5ce8fSJérôme Duval /*
24dc5ce8fSJérôme Duval * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de.
3*1c22c260SAugustin Cavalier * Copyright 2024, Haiku, Inc. All rights reserved.
44dc5ce8fSJérôme Duval * Distributed under the terms of the MIT License.
54dc5ce8fSJérôme Duval */
64dc5ce8fSJérôme Duval
74dc5ce8fSJérôme Duval
84dc5ce8fSJérôme Duval #include <errno.h>
9*1c22c260SAugustin Cavalier #include <fcntl.h>
104dc5ce8fSJérôme Duval #include <sys/stat.h>
114dc5ce8fSJérôme Duval
124dc5ce8fSJérôme Duval #include <errno_private.h>
134dc5ce8fSJérôme Duval
144dc5ce8fSJérôme Duval
154dc5ce8fSJérôme Duval int
mknod(const char * path,mode_t mode,dev_t dev)16*1c22c260SAugustin Cavalier mknod(const char *path, mode_t mode, dev_t dev)
174dc5ce8fSJérôme Duval {
18*1c22c260SAugustin Cavalier return mknodat(AT_FDCWD, path, mode, dev);
194dc5ce8fSJérôme Duval }
204dc5ce8fSJérôme Duval
214dc5ce8fSJérôme Duval
224dc5ce8fSJérôme Duval int
mknodat(int fd,const char * path,mode_t mode,dev_t dev)23*1c22c260SAugustin Cavalier mknodat(int fd, const char *path, mode_t mode, dev_t dev)
244dc5ce8fSJérôme Duval {
25*1c22c260SAugustin Cavalier if (dev == 0) {
26*1c22c260SAugustin Cavalier mode_t type = mode & S_IFMT;
27*1c22c260SAugustin Cavalier mode &= ~S_IFMT;
28*1c22c260SAugustin Cavalier if (type == S_IFIFO)
29*1c22c260SAugustin Cavalier return mkfifoat(fd, path, mode);
30*1c22c260SAugustin Cavalier }
31*1c22c260SAugustin Cavalier
324dc5ce8fSJérôme Duval __set_errno(ENOTSUP);
334dc5ce8fSJérôme Duval return -1;
344dc5ce8fSJérôme Duval }
35