Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2015 05:04:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 197695] Fix broken KERN_PROC_FILEDESC sysctl
Message-ID:  <bug-197695-8-pjnnjdwKhA@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-197695-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-197695-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197695

--- Comment #4 from Niall Douglas <s_bugzilla@nedprod.com> ---
It turns out that I was wrong about there being no method of retrieving a
canonical path for an open file descriptor on FreeBSD. There in fact is, and it
is called KERN_PROC_FILEDESC.

Unfortunately, KERN_PROC_FILEDESC is broken for regular files, but not
directories where it works perfectly - even tracking renames and deletions with
ease. The attached test case and its output shows the broken behaviour:

1. Files opened with O_CREAT never get a path. Creating the file, closing it
and opening it again gets the file descriptor its path.

2. As soon as the process does its first rename() all the paths for all the
regular file descriptors get reset to null, but not directory file descriptors.

3. Directory file descriptors work correctly.


This was tested on FreeBSD 10.1 with ZFS on root. Other filing systems may
vary.

Niall

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197695-8-pjnnjdwKhA>