* inode query @ 2011-04-05 20:41 mohit verma 2011-04-05 21:38 ` Greg Freemyer 0 siblings, 1 reply; 5+ messages in thread From: mohit verma @ 2011-04-05 20:41 UTC (permalink / raw) To: kernelnewbies hi list, how can a utility like **find** command can map an inode number to a filename? i mean if we pass **find -inum inode_number / ** , it will show us the files associated with that "inode_number". What is the underlying mechanism used in all this ? I have peeped into the findutils code but it seems horrible to figure it out from that code .:) thanks in advance. -- ........................ *MOHIT VERMA* -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110406/6453bc43/attachment.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* inode query 2011-04-05 20:41 inode query mohit verma @ 2011-04-05 21:38 ` Greg Freemyer 2011-04-07 21:30 ` Greg Freemyer 2011-04-08 6:54 ` mohit verma 0 siblings, 2 replies; 5+ messages in thread From: Greg Freemyer @ 2011-04-05 21:38 UTC (permalink / raw) To: kernelnewbies On Tue, Apr 5, 2011 at 4:41 PM, mohit verma <mohit89mlnc@gmail.com> wrote: > > hi list, > how can a utility like **find** command ?can map an inode number to a > filename? > ?i mean if we pass **find -inum inode_number ?/ ** ? , it will show us the > ?files associated with that "inode_number". What is the underlying mechanism > used in all this ? > ?I have peeped into the findutils code but it seems horrible to figure it > out from that code .:) strace is a lot easier than reading code for something like that. Looks to me like find is just walking the tree and calling newfstatat() on every file. Here's a short section from strace. Notice in the directory walk it gets to charmaps. (I think that's /usr/share/i18n/charmaps). I'd guess that based on the return from newfstatat() it decides its a directory, so it call getdents64() It then starts calling newfstatat() for everything in that directory. (Not as sexy as you hoped I suspect.) newfstatat(AT_FDCWD, "charmaps", {st_mode=S_IFDIR|0755, st_size=12288, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("charmaps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 getdents64(4, /* 229 entries */, 32768) = 8024 getdents64(4, /* 0 entries */, 32768) = 0 close(4) = 0 open("charmaps", O_RDONLY|O_NOFOLLOW) = 4 fchdir(4) = 0 close(4) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 newfstatat(AT_FDCWD, "CP1257.gz", {st_mode=S_IFREG|0644, st_size=2813, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "EBCDIC-UK.gz", {st_mode=S_IFREG|0644, st_size=2129, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "LATIN-GREEK.gz", {st_mode=S_IFREG|0644, st_size=1605, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "NEXTSTEP.gz", {st_mode=S_IFREG|0644, st_size=2972, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "IBM903.gz", {st_mode=S_IFREG|0644, st_size=1566, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "BIG5-HKSCS.gz", {st_mode=S_IFREG|0644, st_size=145960, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "BRF.gz", {st_mode=S_IFREG|0644, st_size=1166, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "ISO-8859-9E.gz", {st_mode=S_IFREG|0644, st_size=3023, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "MSZ_7795.3.gz", {st_mode=S_IFREG|0644, st_size=1559, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "HP-ROMAN8.gz", {st_mode=S_IFREG|0644, st_size=3193, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "ISO-8859-7.gz", {st_mode=S_IFREG|0644, st_size=3074, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "DEC-MCS.gz", {st_mode=S_IFREG|0644, st_size=2948, ...}, AT_SYMLINK_NOFOLLOW) = 0 HTH Greg ^ permalink raw reply [flat|nested] 5+ messages in thread
* inode query 2011-04-05 21:38 ` Greg Freemyer @ 2011-04-07 21:30 ` Greg Freemyer 2011-04-08 6:54 ` mohit verma 1 sibling, 0 replies; 5+ messages in thread From: Greg Freemyer @ 2011-04-07 21:30 UTC (permalink / raw) To: kernelnewbies On Tue, Apr 5, 2011 at 5:38 PM, Greg Freemyer <greg.freemyer@gmail.com> wrote: > On Tue, Apr 5, 2011 at 4:41 PM, mohit verma <mohit89mlnc@gmail.com> wrote: >> >> hi list, >> how can a utility like **find** command ?can map an inode number to a >> filename? >> ?i mean if we pass **find -inum inode_number ?/ ** ? , it will show us the >> ?files associated with that "inode_number". What is the underlying mechanism >> used in all this ? >> ?I have peeped into the findutils code but it seems horrible to figure it >> out from that code .:) > > strace is a lot easier than reading code for something like that. > > Looks to me like find is just walking the tree and calling > newfstatat() on every file. > > Here's a short section from strace. ?Notice in the directory walk it > gets to charmaps. ?(I think that's /usr/share/i18n/charmaps). > > I'd guess that based on the return from newfstatat() it decides its a > directory, so it call getdents64() > > It then starts calling newfstatat() for everything in that directory. > (Not as sexy as you hoped I suspect.) > > > newfstatat(AT_FDCWD, "charmaps", {st_mode=S_IFDIR|0755, st_size=12288, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("charmaps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 > getdents64(4, /* 229 entries */, 32768) = 8024 > getdents64(4, /* 0 entries */, 32768) ? = 0 > close(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?= 0 > open("charmaps", O_RDONLY|O_NOFOLLOW) ? = 4 > fchdir(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? = 0 > close(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?= 0 > stat(".", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 > newfstatat(AT_FDCWD, "CP1257.gz", {st_mode=S_IFREG|0644, st_size=2813, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "EBCDIC-UK.gz", {st_mode=S_IFREG|0644, > st_size=2129, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "LATIN-GREEK.gz", {st_mode=S_IFREG|0644, > st_size=1605, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "NEXTSTEP.gz", {st_mode=S_IFREG|0644, > st_size=2972, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "IBM903.gz", {st_mode=S_IFREG|0644, st_size=1566, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "BIG5-HKSCS.gz", {st_mode=S_IFREG|0644, > st_size=145960, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "BRF.gz", {st_mode=S_IFREG|0644, st_size=1166, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "ISO-8859-9E.gz", {st_mode=S_IFREG|0644, > st_size=3023, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "MSZ_7795.3.gz", {st_mode=S_IFREG|0644, > st_size=1559, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "HP-ROMAN8.gz", {st_mode=S_IFREG|0644, > st_size=3193, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "ISO-8859-7.gz", {st_mode=S_IFREG|0644, > st_size=3074, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "DEC-MCS.gz", {st_mode=S_IFREG|0644, > st_size=2948, ...}, AT_SYMLINK_NOFOLLOW) = 0 > > > > HTH > Greg > Mohit, Here's some more precise info as you asked in a PM. I'm testing with openSUSE 11.4 which is a pretty current release. It's a 64-bit machine / OS. I suspect that's important in exactly which stat() call is used by find. The exact command I running is > sudo strace find /usr -inum 100 2> /tmp/strace.out I assume you know 2> will redirect stderr. So all of the strace prints go to my tmp file. Then I wait about 10 or 20 seconds and do a control-c. That way the search is killed in the middle and the last part of strace.out is relative to the search part, not just some termination logic. Then looking at /tmp/strace.out and pulling out what looks to a be logically important chunk from the end of the file I have: <snip a bunch of stuff. pick up in what appears to be a directory scan> newfstatat(AT_FDCWD, "gnome-dev-disc-dvdrw.png", {st_mode=S_IFLNK|0777, st_size=17, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "media-floppy.png", {st_mode=S_IFREG|0644, st_size=836, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "computer.png", {st_mode=S_IFREG|0644, st_size=2065, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "cdrom_unmount.png", {st_mode=S_IFLNK|0777, st_size=17, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "printer-remote.png", {st_mode=S_IFLNK|0777, st_size=11, ...}, AT_SYMLINK_NOFOLLOW) = 0 ### MY NOTE: DIRECTORY DONE. MOVE BACK TO PARENT DIR open("..", O_RDONLY|O_NOFOLLOW) = 4 fchdir(4) = 0 close(4) = 0 ### MY NOTE: OPEN THE NEXT DIRECTORY SO IT CAN BE CRAWLED newfstatat(AT_FDCWD, "categories", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("categories", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 ### MY NOTE: GET THE CONTENTS OF THE DIRECTORY getdents64(4, /* 62 entries */, 32768) = 2712 getdents64(4, /* 0 entries */, 32768) = 0 close(4) = 0 open("categories", O_RDONLY|O_NOFOLLOW) = 4 fchdir(4) = 0 close(4) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 ### MY NOTE: START CALLING newfstatat() on every file in the directory newfstatat(AT_FDCWD, "xfce-utils.png", {st_mode=S_IFLNK|0777, st_size=28, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "package_system.png", {st_mode=S_IFLNK|0777, st_size=23, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "xfce-system-settings.png", {st_mode=S_IFLNK|0777, st_size=22, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "applications-utilities.png", {st_mode=S_IFREG|0644, st_size=1858, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "redhat-sound_video.png", {st_mode=S_IFLNK|0777, st_size=27, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "preferences-desktop-peripherals.png", {st_mode=S_IFREG|0644, st_size=2355, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "package_settings.png", {st_mode=S_IFLNK|0777, st_size=22, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "package_games.png", {st_mode=S_IFLNK|0777, st_size=22, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "applications-multimedia.png", {st_mode=S_IFREG|0644, st_size=3129, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "preferences-other.png", {st_mode=S_IFREG|0644, st_size=2355, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "applications-science.png", {st_mode=S_IFREG|0644, st_size=2065, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "package_multimedia.png", {st_mode=S_IFLNK|0777, st_size=27, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "applications-graphics.png", {st_mode=S_IFREG|0644, st_size=1740, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "gnome-devel.png", {st_mode=S_IFLNK|0777, st_size=28, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "gnome-settings.png", {st_mode=S_IFLNK|0777, st_size=23, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "gnome-joystick.png", {st_mode=S_IFLNK|0777, st_size=22, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "gnome-multimedia.png", {st_mode=S_IFLNK|0777, st_size=27, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "applications-development.png", {st_mode=S_IFREG|0644, st_size=1717, ...}, AT_SYMLINK_NOFOLLOW) = I can't say I've ever seen newfstatat() before but based on a little googling it seems to be a version of fstat which is natively 64-bit. Good Luck Greg ^ permalink raw reply [flat|nested] 5+ messages in thread
* inode query 2011-04-05 21:38 ` Greg Freemyer 2011-04-07 21:30 ` Greg Freemyer @ 2011-04-08 6:54 ` mohit verma 2011-04-08 7:04 ` Manish Katiyar 1 sibling, 1 reply; 5+ messages in thread From: mohit verma @ 2011-04-08 6:54 UTC (permalink / raw) To: kernelnewbies On Wed, Apr 6, 2011 at 3:08 AM, Greg Freemyer <greg.freemyer@gmail.com>wrote: > On Tue, Apr 5, 2011 at 4:41 PM, mohit verma <mohit89mlnc@gmail.com> wrote: > > > > hi list, > > how can a utility like **find** command can map an inode number to a > > filename? > > i mean if we pass **find -inum inode_number / ** , it will show us > the > > files associated with that "inode_number". What is the underlying > mechanism > > used in all this ? > > I have peeped into the findutils code but it seems horrible to figure it > > out from that code .:) > > strace is a lot easier than reading code for something like that. > > Looks to me like find is just walking the tree and calling > newfstatat() on every file. > > Here's a short section from strace. Notice in the directory walk it > gets to charmaps. (I think that's /usr/share/i18n/charmaps). > > I'd guess that based on the return from newfstatat() it decides its a > directory, so it call getdents64() > > It then starts calling newfstatat() for everything in that directory. > (Not as sexy as you hoped I suspect.) > > > newfstatat(AT_FDCWD, "charmaps", {st_mode=S_IFDIR|0755, st_size=12288, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("charmaps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 > getdents64(4, /* 229 entries */, 32768) = 8024 > getdents64(4, /* 0 entries */, 32768) = 0 > close(4) = 0 > open("charmaps", O_RDONLY|O_NOFOLLOW) = 4 > fchdir(4) = 0 > close(4) = 0 > stat(".", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 > newfstatat(AT_FDCWD, "CP1257.gz", {st_mode=S_IFREG|0644, st_size=2813, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "EBCDIC-UK.gz", {st_mode=S_IFREG|0644, > st_size=2129, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "LATIN-GREEK.gz", {st_mode=S_IFREG|0644, > st_size=1605, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "NEXTSTEP.gz", {st_mode=S_IFREG|0644, > st_size=2972, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "IBM903.gz", {st_mode=S_IFREG|0644, st_size=1566, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "BIG5-HKSCS.gz", {st_mode=S_IFREG|0644, > st_size=145960, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "BRF.gz", {st_mode=S_IFREG|0644, st_size=1166, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "ISO-8859-9E.gz", {st_mode=S_IFREG|0644, > st_size=3023, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "MSZ_7795.3.gz", {st_mode=S_IFREG|0644, > st_size=1559, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "HP-ROMAN8.gz", {st_mode=S_IFREG|0644, > st_size=3193, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "ISO-8859-7.gz", {st_mode=S_IFREG|0644, > st_size=3074, ...}, AT_SYMLINK_NOFOLLOW) = 0 > newfstatat(AT_FDCWD, "DEC-MCS.gz", {st_mode=S_IFREG|0644, > st_size=2948, ...}, AT_SYMLINK_NOFOLLOW) = 0 > > Hi , i am using 32 bit intel system with ubuntu10.10. And what i got after strace find is something like this: fstatat64(AT_FDCWD, "hints", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("hints", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 fchdir(5) = 0 getdents64(5, /* 5 entries */, 32768) = 192 getdents64(5, /* 0 entries */, 32768) = 0 close(5) = 0 fstatat64(AT_FDCWD, "ttf-droid.hints", {st_mode=S_IFREG|0644, st_size=2819, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "ttf-mscorefonts-installer.hints", {st_mode=S_IFREG|0644, st_size=24745, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "ttf-unfonts-core.hints", {st_mode=S_IFREG|0644, st_size=1260, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5 fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fchdir(5) = 0 close(5) = 0 fstatat64(AT_FDCWD, "ps-cset-enc.data", {st_mode=S_IFREG|0644, st_size=3983, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "loc-cset.data", {st_mode=S_IFREG|0644, st_size=1261, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fontconfig.subst-rule", {st_mode=S_IFREG|0644, st_size=1015, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "xenc-cset.data", {st_mode=S_IFREG|0644, st_size=530, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "csetenc-xenc.data2", {st_mode=S_IFREG|0644, st_size=580, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5 fstat64(5, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 fchdir(5) = 0 close(5) = 0 fstatat64(AT_FDCWD, "environment", {st_mode=S_IFREG|0644, st_size=79, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "gnome-vfs-2.0", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("gnome-vfs-2.0", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 fchdir(5) = 0 getdents64(5, /* 3 entries */, 32768) = 80 getdents64(5, /* 0 entries */, 32768) = 0 close(5) = 0 fstatat64(AT_FDCWD, "modules", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("modules", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 fchdir(5) = 0 getdents64(5, /* 4 entries */, 32768) = 128 getdents64(5, /* 0 entries */, 32768) = 0 close(5) = 0 fstatat64(AT_FDCWD, "extra-modules.conf", {st_mode=S_IFREG|0644, st_size=225, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "default-modules.conf", {st_mode=S_IFREG|0644, st_size=300, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5 fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fchdir(5) = 0 close(5) = 0 open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5 fstat64(5, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 fchdir(5) = 0 close(5) = 0 fstatat64(AT_FDCWD, "gshadow", {st_mode=S_IFREG|0640, st_size=974, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "manpath.config", {st_mode=S_IFREG|0644, st_size=5173, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brltty", {st_mode=S_IFDIR|0755, st_size=12288, ...}, AT_SYMLINK_NOFOLLOW) = 0 open("brltty", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 fchdir(5) = 0 getdents64(5, /* 265 entries */, 32768) = 9720 brk(0x975a000) = 0x975a000 getdents64(5, /* 0 entries */, 32768) = 0 close(5) = 0 fstatat64(AT_FDCWD, "kbd-keypad.ktb", {st_mode=S_IFREG|0644, st_size=2944, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "letters-latin-dot8.tti", {st_mode=S_IFREG|0644, st_size=3793, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brltty-vr-all.hlp", {st_mode=S_IFREG|0644, st_size=69, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "mt.ttb", {st_mode=S_IFREG|0644, st_size=2203, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-front9.kti", {st_mode=S_IFREG|0644, st_size=1777, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-status4.kti", {st_mode=S_IFREG|0644, st_size=1160, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "kbd-braille.kti", {st_mode=S_IFREG|0644, st_size=1913, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "sv.ttb", {st_mode=S_IFREG|0644, st_size=838, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "gujarati.tti", {st_mode=S_IFREG|0644, st_size=5279, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "tamil.tti", {st_mode=S_IFREG|0644, st_size=4356, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brltty-ec-all.hlp", {st_mode=S_IFREG|0644, st_size=866, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "sw.ttb", {st_mode=S_IFREG|0644, st_size=1262, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-bm-display6.kti", {st_mode=S_IFREG|0644, st_size=2887, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-elba_trio_20.ktb", {st_mode=S_IFREG|0644, st_size=872, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "sa.ttb", {st_mode=S_IFREG|0644, st_size=886, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-el80_ii.ktb", {st_mode=S_IFREG|0644, st_size=865, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-routing.kti", {st_mode=S_IFREG|0644, st_size=969, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fr-2007.ttb", {st_mode=S_IFREG|0644, st_size=12529, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "ny.ctb", {st_mode=S_IFREG|0644, st_size=1269, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fr-cbifs.ttb", {st_mode=S_IFREG|0644, st_size=11267, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "en_CA.ttb", {st_mode=S_IFREG|0644, st_size=6653, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brltty-ts-pb40.hlp", {st_mode=S_IFREG|0644, st_size=3313, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-al-abt_small.ktb", {st_mode=S_IFREG|0644, st_size=880, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-hm-sync.ktb", {st_mode=S_IFREG|0644, st_size=1679, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "bengali.tti", {st_mode=S_IFREG|0644, st_size=4857, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-ht-bs80.ktb", {st_mode=S_IFREG|0644, st_size=868, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "bo.ttb", {st_mode=S_IFREG|0644, st_size=4629, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fr_CA.ttb", {st_mode=S_IFREG|0644, st_size=11512, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "sat.ttb", {st_mode=S_IFREG|0644, st_size=923, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "te.ttb", {st_mode=S_IFREG|0644, st_size=880, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-bar.kti", {st_mode=S_IFREG|0644, st_size=1189, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brltty-mn-all.hlp", {st_mode=S_IFREG|0644, st_size=2074, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "dra.ttb", {st_mode=S_IFREG|0644, st_size=882, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-sk-all.ktb", {st_mode=S_IFREG|0644, st_size=2698, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "ja.ctb", {st_mode=S_IFREG|0644, st_size=8450, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-elba_trio_32.ktb", {st_mode=S_IFREG|0644, st_size=872, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "letters-latin.tti", {st_mode=S_IFREG|0644, st_size=3752, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fr.ttb", {st_mode=S_IFREG|0644, st_size=837, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-bm-display7.kti", {st_mode=S_IFREG|0644, st_size=2215, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "fr-integral.ctb", {st_mode=S_IFREG|0644, st_size=3843, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "pl.ttb", {st_mode=S_IFREG|0644, st_size=11576, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "sd.ttb", {st_mode=S_IFREG|0644, st_size=884, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "de.ttb", {st_mode=S_IFREG|0644, st_size=11217, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "kha.ttb", {st_mode=S_IFREG|0644, st_size=880, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-ht-me88.ktb", {st_mode=S_IFREG|0644, st_size=873, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "de-vollschrift.ctb", {st_mode=S_IFREG|0644, st_size=3289, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "zu.ctb", {st_mode=S_IFREG|0644, st_size=1233, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "gd.ttb", {st_mode=S_IFREG|0644, st_size=3435, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "numbers-nemeth.tti", {st_mode=S_IFREG|0644, st_size=1486, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-bm-vertical.kti", {st_mode=S_IFREG|0644, st_size=916, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-al-abt_large.ktb", {st_mode=S_IFREG|0644, st_size=926, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-status20.kti", {st_mode=S_IFREG|0644, st_size=2610, ...}, AT_SYMLINK_NOFOLLOW) = 0 fstatat64(AT_FDCWD, "brl-pm-status0.kti", {st_mode=S_IFREG|0644, st_size=862, ...}, AT_SYMLINK_NOFOLLOW) = 0 My system doesn't have a system call like newfstatat(). But i suspect (looking at the strace output) that from the starting search directory find opens the dirent stream and manually check inode number (if option -inum) passed to it using fstatat() . > > > HTH > Greg > -- ........................ *MOHIT VERMA* -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110408/77dcd5d2/attachment-0001.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* inode query 2011-04-08 6:54 ` mohit verma @ 2011-04-08 7:04 ` Manish Katiyar 0 siblings, 0 replies; 5+ messages in thread From: Manish Katiyar @ 2011-04-08 7:04 UTC (permalink / raw) To: kernelnewbies On Thu, Apr 7, 2011 at 11:54 PM, mohit verma <mohit89mlnc@gmail.com> wrote: > > > On Wed, Apr 6, 2011 at 3:08 AM, Greg Freemyer <greg.freemyer@gmail.com> > wrote: >> >> On Tue, Apr 5, 2011 at 4:41 PM, mohit verma <mohit89mlnc@gmail.com> wrote: >> > >> > hi list, >> > how can a utility like **find** command ?can map an inode number to a >> > filename? >> > ?i mean if we pass **find -inum inode_number ?/ ** ? , it will show us >> > the >> > ?files associated with that "inode_number". What is the underlying >> > mechanism >> > used in all this ? >> > ?I have peeped into the findutils code but it seems horrible to figure >> > it >> > out from that code .:) >> >> strace is a lot easier than reading code for something like that. >> >> Looks to me like find is just walking the tree and calling >> newfstatat() on every file. >> >> Here's a short section from strace. ?Notice in the directory walk it >> gets to charmaps. ?(I think that's /usr/share/i18n/charmaps). >> >> I'd guess that based on the return from newfstatat() it decides its a >> directory, so it call getdents64() >> >> It then starts calling newfstatat() for everything in that directory. >> (Not as sexy as you hoped I suspect.) >> >> >> newfstatat(AT_FDCWD, "charmaps", {st_mode=S_IFDIR|0755, st_size=12288, >> ...}, AT_SYMLINK_NOFOLLOW) = 0 >> open("charmaps", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4 >> getdents64(4, /* 229 entries */, 32768) = 8024 >> getdents64(4, /* 0 entries */, 32768) ? = 0 >> close(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?= 0 >> open("charmaps", O_RDONLY|O_NOFOLLOW) ? = 4 >> fchdir(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? = 0 >> close(4) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?= 0 >> stat(".", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 >> newfstatat(AT_FDCWD, "CP1257.gz", {st_mode=S_IFREG|0644, st_size=2813, >> ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "EBCDIC-UK.gz", {st_mode=S_IFREG|0644, >> st_size=2129, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "LATIN-GREEK.gz", {st_mode=S_IFREG|0644, >> st_size=1605, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "NEXTSTEP.gz", {st_mode=S_IFREG|0644, >> st_size=2972, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "IBM903.gz", {st_mode=S_IFREG|0644, st_size=1566, >> ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "BIG5-HKSCS.gz", {st_mode=S_IFREG|0644, >> st_size=145960, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "BRF.gz", {st_mode=S_IFREG|0644, st_size=1166, >> ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "ISO-8859-9E.gz", {st_mode=S_IFREG|0644, >> st_size=3023, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "MSZ_7795.3.gz", {st_mode=S_IFREG|0644, >> st_size=1559, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "HP-ROMAN8.gz", {st_mode=S_IFREG|0644, >> st_size=3193, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "ISO-8859-7.gz", {st_mode=S_IFREG|0644, >> st_size=3074, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> newfstatat(AT_FDCWD, "DEC-MCS.gz", {st_mode=S_IFREG|0644, >> st_size=2948, ...}, AT_SYMLINK_NOFOLLOW) = 0 >> > Hi? , > ?i am using 32 bit intel system with ubuntu10.10.? And what i got after > strace find is something like this: > fstatat64(AT_FDCWD, "hints", {st_mode=S_IFDIR|0755, st_size=4096, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > open("hints", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 > fchdir(5)?????????????????????????????? = 0 > getdents64(5, /* 5 entries */, 32768)?? = 192 > getdents64(5, /* 0 entries */, 32768)?? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "ttf-droid.hints", {st_mode=S_IFREG|0644, st_size=2819, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "ttf-mscorefonts-installer.hints", > {st_mode=S_IFREG|0644, st_size=24745, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "ttf-unfonts-core.hints", {st_mode=S_IFREG|0644, > st_size=1260, ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) > = 5 > fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 > fchdir(5)?????????????????????????????? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "ps-cset-enc.data", {st_mode=S_IFREG|0644, st_size=3983, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "loc-cset.data", {st_mode=S_IFREG|0644, st_size=1261, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fontconfig.subst-rule", {st_mode=S_IFREG|0644, > st_size=1015, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "xenc-cset.data", {st_mode=S_IFREG|0644, st_size=530, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "csetenc-xenc.data2", {st_mode=S_IFREG|0644, > st_size=580, ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) > = 5 > fstat64(5, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 > fchdir(5)?????????????????????????????? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "environment", {st_mode=S_IFREG|0644, st_size=79, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "gnome-vfs-2.0", {st_mode=S_IFDIR|0755, st_size=4096, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("gnome-vfs-2.0", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) > = 5 > fchdir(5)?????????????????????????????? = 0 > getdents64(5, /* 3 entries */, 32768)?? = 80 > getdents64(5, /* 0 entries */, 32768)?? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "modules", {st_mode=S_IFDIR|0755, st_size=4096, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > open("modules", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 > fchdir(5)?????????????????????????????? = 0 > getdents64(5, /* 4 entries */, 32768)?? = 128 > getdents64(5, /* 0 entries */, 32768)?? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "extra-modules.conf", {st_mode=S_IFREG|0644, > st_size=225, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "default-modules.conf", {st_mode=S_IFREG|0644, > st_size=300, ...}, AT_SYMLINK_NOFOLLOW) = 0 > open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) > = 5 > fstat64(5, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 > fchdir(5)?????????????????????????????? = 0 > close(5)??????????????????????????????? = 0 > open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) > = 5 > fstat64(5, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 > fchdir(5)?????????????????????????????? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "gshadow", {st_mode=S_IFREG|0640, st_size=974, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "manpath.config", {st_mode=S_IFREG|0644, st_size=5173, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brltty", {st_mode=S_IFDIR|0755, st_size=12288, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > open("brltty", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5 > fchdir(5)?????????????????????????????? = 0 > getdents64(5, /* 265 entries */, 32768) = 9720 > brk(0x975a000)????????????????????????? = 0x975a000 > getdents64(5, /* 0 entries */, 32768)?? = 0 > close(5)??????????????????????????????? = 0 > fstatat64(AT_FDCWD, "kbd-keypad.ktb", {st_mode=S_IFREG|0644, st_size=2944, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "letters-latin-dot8.tti", {st_mode=S_IFREG|0644, > st_size=3793, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brltty-vr-all.hlp", {st_mode=S_IFREG|0644, st_size=69, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "mt.ttb", {st_mode=S_IFREG|0644, st_size=2203, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-front9.kti", {st_mode=S_IFREG|0644, > st_size=1777, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-status4.kti", {st_mode=S_IFREG|0644, > st_size=1160, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "kbd-braille.kti", {st_mode=S_IFREG|0644, st_size=1913, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "sv.ttb", {st_mode=S_IFREG|0644, st_size=838, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "gujarati.tti", {st_mode=S_IFREG|0644, st_size=5279, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "tamil.tti", {st_mode=S_IFREG|0644, st_size=4356, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brltty-ec-all.hlp", {st_mode=S_IFREG|0644, st_size=866, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "sw.ttb", {st_mode=S_IFREG|0644, st_size=1262, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-bm-display6.kti", {st_mode=S_IFREG|0644, > st_size=2887, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-elba_trio_20.ktb", {st_mode=S_IFREG|0644, > st_size=872, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "sa.ttb", {st_mode=S_IFREG|0644, st_size=886, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-el80_ii.ktb", {st_mode=S_IFREG|0644, > st_size=865, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-routing.kti", {st_mode=S_IFREG|0644, > st_size=969, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fr-2007.ttb", {st_mode=S_IFREG|0644, st_size=12529, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "ny.ctb", {st_mode=S_IFREG|0644, st_size=1269, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fr-cbifs.ttb", {st_mode=S_IFREG|0644, st_size=11267, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "en_CA.ttb", {st_mode=S_IFREG|0644, st_size=6653, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brltty-ts-pb40.hlp", {st_mode=S_IFREG|0644, > st_size=3313, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-al-abt_small.ktb", {st_mode=S_IFREG|0644, > st_size=880, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-hm-sync.ktb", {st_mode=S_IFREG|0644, st_size=1679, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "bengali.tti", {st_mode=S_IFREG|0644, st_size=4857, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-ht-bs80.ktb", {st_mode=S_IFREG|0644, st_size=868, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "bo.ttb", {st_mode=S_IFREG|0644, st_size=4629, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fr_CA.ttb", {st_mode=S_IFREG|0644, st_size=11512, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "sat.ttb", {st_mode=S_IFREG|0644, st_size=923, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "te.ttb", {st_mode=S_IFREG|0644, st_size=880, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-bar.kti", {st_mode=S_IFREG|0644, st_size=1189, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brltty-mn-all.hlp", {st_mode=S_IFREG|0644, > st_size=2074, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "dra.ttb", {st_mode=S_IFREG|0644, st_size=882, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-sk-all.ktb", {st_mode=S_IFREG|0644, st_size=2698, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "ja.ctb", {st_mode=S_IFREG|0644, st_size=8450, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-elba_trio_32.ktb", {st_mode=S_IFREG|0644, > st_size=872, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "letters-latin.tti", {st_mode=S_IFREG|0644, > st_size=3752, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fr.ttb", {st_mode=S_IFREG|0644, st_size=837, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-bm-display7.kti", {st_mode=S_IFREG|0644, > st_size=2215, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "fr-integral.ctb", {st_mode=S_IFREG|0644, st_size=3843, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "pl.ttb", {st_mode=S_IFREG|0644, st_size=11576, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "sd.ttb", {st_mode=S_IFREG|0644, st_size=884, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "de.ttb", {st_mode=S_IFREG|0644, st_size=11217, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "kha.ttb", {st_mode=S_IFREG|0644, st_size=880, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-ht-me88.ktb", {st_mode=S_IFREG|0644, st_size=873, > ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "de-vollschrift.ctb", {st_mode=S_IFREG|0644, > st_size=3289, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "zu.ctb", {st_mode=S_IFREG|0644, st_size=1233, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "gd.ttb", {st_mode=S_IFREG|0644, st_size=3435, ...}, > AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "numbers-nemeth.tti", {st_mode=S_IFREG|0644, > st_size=1486, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-bm-vertical.kti", {st_mode=S_IFREG|0644, > st_size=916, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-al-abt_large.ktb", {st_mode=S_IFREG|0644, > st_size=926, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-status20.kti", {st_mode=S_IFREG|0644, > st_size=2610, ...}, AT_SYMLINK_NOFOLLOW) = 0 > fstatat64(AT_FDCWD, "brl-pm-status0.kti", {st_mode=S_IFREG|0644, > st_size=862, ...}, AT_SYMLINK_NOFOLLOW) = 0 > > > My system doesn't have a system call like newfstatat(). But i suspect > (looking at the strace output)? that from the starting search directory find > opens the dirent stream and manually check inode number (if option -inum) > passed? to it using fstatat() . Hmm...actually I think it shouldn't need to do a if all you are trying to do is to find a file by inode number. It can be done just by using directory entries and doing a match of the name. The only reason I can think of doing a stat is to check if some entry is of directory type so that it can descend down. but then I tried "strace find . -maxdepth 1 -inum 5" to limit the descend only to current directory, but unfortunately find still calls stat :-(, don't know why. -- Thanks - Manish ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-08 7:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-05 20:41 inode query mohit verma 2011-04-05 21:38 ` Greg Freemyer 2011-04-07 21:30 ` Greg Freemyer 2011-04-08 6:54 ` mohit verma 2011-04-08 7:04 ` Manish Katiyar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).