summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sys/include/os/filedesc.h11
-rw-r--r--src/sys/os/os_filedes.c1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/sys/include/os/filedesc.h b/src/sys/include/os/filedesc.h
index c339ed6..0023526 100644
--- a/src/sys/include/os/filedesc.h
+++ b/src/sys/include/os/filedesc.h
@@ -49,6 +49,17 @@ struct filedesc {
};
/*
+ * Duplicate a file descriptor
+ *
+ * @procp: Process to duplicate from
+ * @fd: File descriptor to duplicate
+ *
+ * Returns the new file descriptor on success, otherwise
+ * a value of NULL on failure
+ */
+struct filedesc *fd_dup(struct proc *procp, int fd);
+
+/*
* Initialize a process file descriptor table
* and set up standard streams
*
diff --git a/src/sys/os/os_filedes.c b/src/sys/os/os_filedes.c
index 3353a5f..11cf058 100644
--- a/src/sys/os/os_filedes.c
+++ b/src/sys/os/os_filedes.c
@@ -127,6 +127,7 @@ fd_open(const char *path, mode_t mode)
}
fd->vp = vp;
+ fd->mode = mode;
return fd->fdno;
}