|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 2/3] lib/vfscore: Add pipe2() implementation and mkfifo() stub
For pipe2() we have just adapted musl's version. It basically calls pipe()
and apply the flags by calling fcntl() internally. mkfifo() is just a stub.
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
lib/vfscore/exportsyms.uk | 2 ++
lib/vfscore/pipe.c | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index b2957cc6..225cd730 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -110,6 +110,8 @@ vn_stat
vn_unlock
vfs_busy
pipe
+pipe2
+mkfifo
futimes
futimesat
utimensat
diff --git a/lib/vfscore/pipe.c b/lib/vfscore/pipe.c
index 4c561304..8d382965 100644
--- a/lib/vfscore/pipe.c
+++ b/lib/vfscore/pipe.c
@@ -571,3 +571,31 @@ ERR_EXIT:
UK_ASSERT(ret < 0);
return ret;
}
+
+/* TODO find a more efficient way to implement pipe2() */
+int pipe2(int pipefd[2], int flags)
+{
+ int rc;
+
+ rc = pipe(pipefd);
+ if (rc)
+ return rc;
+
+ if (flags & O_CLOEXEC) {
+ fcntl(pipefd[0], F_SETFD, FD_CLOEXEC);
+ fcntl(pipefd[1], F_SETFD, FD_CLOEXEC);
+ }
+ if (flags & O_NONBLOCK) {
+ fcntl(pipefd[0], F_SETFL, O_NONBLOCK);
+ fcntl(pipefd[1], F_SETFL, O_NONBLOCK);
+ }
+ return 0;
+}
+
+/* TODO maybe find a better place for this when it will be implemented */
+int mkfifo(const char *path __unused, mode_t mode __unused)
+{
+ WARN_STUBBED();
+ errno = ENOTSUP;
+ return -1;
+}
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |