Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2001 09:06:42 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        "Eugene L. Vorokov" <vel@bugz.infotecs.ru>
Cc:        Sansonetti Laurent <lorenzo@linuxbe.org>, freebsd-hackers@freebsd.org
Subject:   Re: Getting filename from descriptor or vnode struct
Message-ID:  <Pine.BSF.4.21.0108170904480.22899-100000@InterJet.elischer.org>
In-Reply-To: <200108170705.f7H75G728300@bugz.infotecs.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
you are going to have to examine the name cache and find the inode of the
directories in the full path. Most open directories will have their full 
path in the caches..


On Fri, 17 Aug 2001, Eugene L. Vorokov 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 !
> 
> I think the best way would be to also hack open() and close(). You can have
> some table where you store fd and full pathname of each opened directory.
> You add an entry on open() and remove it on close().  Of course, open()
> argument may be a path relative to current directory, so to get full path
> you should simulate __getcwd() syscall; you must allocate userland buffer
> for it with mmap() and then copyin() it (read my previous posting). Once
> you have such table, you can find the path by fd in hacked getdirentries()
> and see if you want to hide the file or not ...
> 
> Regards,
> Eugene
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 


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?Pine.BSF.4.21.0108170904480.22899-100000>