Inode Operations

Pawel Jakub Dawidek nick at garage.freebsd.pl
Sun Aug 24 02:01:18 PDT 2003


On Sat, Aug 23, 2003 at 07:54:45PM -0700, Tim Kientzle wrote:
+> I'm working on some archiving programs and need to (for various
+> reasons) keep track of a very large number of files so that I
+> can revisit them at the end of the operation.  For example,
+> on extract, I need to set directory access times and permissions
+> after the complete extract is finished, which requires me to
+> record every created directory.  (No, there is no way around
+> this short of re-scanning the entire archive a second
+> time, which is impractical at best.)
+> 
+> Right now, I'm storing the full pathname of each such
+> file, but that is taking up a lot of memory, so I'm looking
+> for a more compact approach.  It occurred to me that
+> the device number/inode (as returned by stat(2)) is another
+> way to uniquely identify a file.  As it turns out, I need to
+> stat() everything anyway, so collecting such identifiers is easy.
+> But, I can't find any system calls that actually use this information.
+> 
+> Question: Are there any system calls that allow you to
+> access/modify a file based only on the device number/inode number?

Check getfh(2)/fhopen(2) syscall if you are root.

-- 
Pawel Jakub Dawidek                       pawel at dawidek.net
UNIX Systems Programmer/Administrator     http://garage.freebsd.pl
Am I Evil? Yes, I Am!                     http://cerber.sourceforge.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030824/f713e00a/attachment.bin


More information about the freebsd-hackers mailing list