diff options
author | rsc <rsc> | 2006-09-06 17:50:20 +0000 |
---|---|---|
committer | rsc <rsc> | 2006-09-06 17:50:20 +0000 |
commit | f552738889f56586728d1b5d2a63cde0cf124929 (patch) | |
tree | e91c4b41699f12d686383556fbbe67baa41d9575 /fd.c | |
parent | 9e9bcaf143bf8507e947f9934371744c3d50a8ea (diff) | |
download | xv6-labs-f552738889f56586728d1b5d2a63cde0cf124929.tar.gz xv6-labs-f552738889f56586728d1b5d2a63cde0cf124929.tar.bz2 xv6-labs-f552738889f56586728d1b5d2a63cde0cf124929.zip |
no /* */ comments
Diffstat (limited to 'fd.c')
-rw-r--r-- | fd.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -22,9 +22,7 @@ fd_init(void) initlock(&fd_table_lock, "fd_table"); } -/* - * allocate a file descriptor number for curproc. - */ +// Allocate a file descriptor number for curproc. int fd_ualloc(void) { @@ -36,9 +34,7 @@ fd_ualloc(void) return -1; } -/* - * allocate a file descriptor structure - */ +// Allocate a file descriptor structure struct fd* fd_alloc(void) { @@ -57,9 +53,8 @@ fd_alloc(void) return 0; } -/* - * addr is a kernel address, pointing into some process's p->mem. - */ +// Write to file descriptor; +// addr is a kernel address, pointing into some process's p->mem. int fd_write(struct fd *fd, char *addr, int n) { @@ -81,6 +76,7 @@ fd_write(struct fd *fd, char *addr, int n) } } +// Read from file descriptor. int fd_read(struct fd *fd, char *addr, int n) { @@ -101,6 +97,7 @@ fd_read(struct fd *fd, char *addr, int n) } } +// Close file descriptor. void fd_close(struct fd *fd) { @@ -128,6 +125,7 @@ fd_close(struct fd *fd) } } +// Get metadata about file descriptor. int fd_stat(struct fd *fd, struct stat *st) { @@ -140,6 +138,7 @@ fd_stat(struct fd *fd, struct stat *st) return -1; } +// Increment file descriptor reference count. void fd_incref(struct fd *fd) { |