1 /* 2 * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. 3 * Copyright 2024, Haiku, Inc. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 8 #include <errno.h> 9 #include <fcntl.h> 10 #include <sys/stat.h> 11 12 #include <errno_private.h> 13 14 15 int 16 mknod(const char *path, mode_t mode, dev_t dev) 17 { 18 return mknodat(AT_FDCWD, path, mode, dev); 19 } 20 21 22 int 23 mknodat(int fd, const char *path, mode_t mode, dev_t dev) 24 { 25 if (dev == 0) { 26 mode_t type = mode & S_IFMT; 27 mode &= ~S_IFMT; 28 if (type == S_IFIFO) 29 return mkfifoat(fd, path, mode); 30 } 31 32 __set_errno(ENOTSUP); 33 return -1; 34 } 35