summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-07-21 20:24:00 +0000
committerjhb <jhb@FreeBSD.org>2006-07-21 20:24:00 +0000
commit480dbd17c4a6d6e059cb591497f3fd19bcec978d (patch)
tree1f92ee853560a279459358791302c7aa3d169298 /sys/kern/kern_descrip.c
parent675c87997efd836b100a85b72592a737903a6a27 (diff)
downloadFreeBSD-src-480dbd17c4a6d6e059cb591497f3fd19bcec978d.zip
FreeBSD-src-480dbd17c4a6d6e059cb591497f3fd19bcec978d.tar.gz
Add a comment to explain what fdclose() does and what it's purpose is
since the subtlety eluded me when I looked at it last week.
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 599e917..c3e659a 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1756,6 +1756,14 @@ setugidsafety(struct thread *td)
FILEDESC_UNLOCK(fdp);
}
+/*
+ * If a specific file object occupies a specific file descriptor,
+ * close the file descriptor entry and drop a reference on the file
+ * object. This is a convenience function to handle a subsequent
+ * error in a function that calls falloc() that handles the race that
+ * another thread might have closed the file descriptor out from under
+ * the thread creating the file object.
+ */
void
fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td)
{
OpenPOWER on IntegriCloud