Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2001 12:25:58 -0500
From:      Alfred Perlstein <bright@mu.org>
To:        Sansonetti Laurent <lorenzo@linuxbe.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Getting filename from descriptor or vnode struct
Message-ID:  <20010816122558.L38066@elvis.mu.org>
In-Reply-To: <001501c12678$56cd2320$0201a8c0@teledisnet.be>; from lorenzo@linuxbe.org on Thu, Aug 16, 2001 at 07:24:43PM %2B0200
References:  <001501c12678$56cd2320$0201a8c0@teledisnet.be>

next in thread | previous in thread | raw e-mail | index | archive | help
* Sansonetti Laurent <lorenzo@linuxbe.org> [010816 12:22] wrote:
> Hi hackers,
> 
> I'm confronted to a problem when I try to hack getdirentries(2) in a kld
> module :
> 
> To summarize, getdirentries() filled in a buffer a series of dirent struct,
> and the 'd_name' field represents the filename (without the full path).  I
> must recover the full path because I've on disk a list of files to hide ...
> 
> The field 'fd' in getdirentries_args is the file descriptor of the
> directory.. and I've discovered that the field 'p_fd' from struct proc is a
> filedesc struct which contains a vnode struct representing the current
> directory ('fd_cdir').
> 
> VOP_GETATTR() doesn't allow me to recover this..
> 
> If someone could help me, thanks in advance !

Since a vnode may be referenced by multiple hardlinks it can't have
a name really.  You could hack on struct file so that it keeps a
copy of the filename passed to open(2).

-- 
-Alfred Perlstein [alfred@freebsd.org]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010816122558.L38066>