1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

LibC: add mkfifo(3)

This commit is contained in:
Peter Elliott 2020-07-16 16:01:03 -06:00 committed by Andreas Kling
parent b9619989dd
commit 82ba7d546a
2 changed files with 7 additions and 0 deletions

View file

@ -30,6 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
extern "C" { extern "C" {
@ -63,4 +64,9 @@ int fchmod(int fd, mode_t mode)
int rc = syscall(SC_fchmod, fd, mode); int rc = syscall(SC_fchmod, fd, mode);
__RETURN_WITH_ERRNO(rc, rc, -1); __RETURN_WITH_ERRNO(rc, rc, -1);
} }
int mkfifo(const char* pathname, mode_t mode)
{
return mknod(pathname, mode | S_IFIFO, 0);
}
} }

View file

@ -60,6 +60,7 @@ mode_t umask(mode_t);
int chmod(const char* pathname, mode_t); int chmod(const char* pathname, mode_t);
int fchmod(int fd, mode_t); int fchmod(int fd, mode_t);
int mkdir(const char* pathname, mode_t); int mkdir(const char* pathname, mode_t);
int mkfifo(const char* pathname, mode_t);
inline dev_t makedev(unsigned int major, unsigned int minor) { return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u); } inline dev_t makedev(unsigned int major, unsigned int minor) { return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u); }
inline unsigned int major(dev_t dev) { return (dev & 0xfff00u) >> 8u; } inline unsigned int major(dev_t dev) { return (dev & 0xfff00u) >> 8u; }