5

I get an inode for some logging file like '/tmp/logging'
and I want to open it via inode, NOT path.
How to do it?

kerwin
  • 941
  • 2
  • 12
  • 22

2 Answers2

7

In general you cannot do this from user-space because the system routines accept a path as an argument.

Take a look at this post.

Community
  • 1
  • 1
kch
  • 2,015
  • 14
  • 12
5

Short of a brute-force search of the filesystem for the inode (ex, find / -inum $X), you can't.

See the discussion here: http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2006-05/msg02223.html

David Wolever
  • 148,955
  • 89
  • 346
  • 502