As of now we have understood that any program uses struct stat structure to store temporary inode info and display it. The struct stat structure gets info from struct inode (defined in inode.h) which in turn gets info from struct dinode. The struct dinode is (or may be, I am not sure) is the actual physical representation of the inode structure.
I also tried studying ls.c source code. I found that it uses another important structures struct FTS and struct FTSENT for traversing the file system hierarchy using functions defined in fts.c. Now the problem is that fts.c uses systemcalls like fstat() and open() for accessing inode information and I can't find where the source of those system calls are or in what language it is written? I think they are written in perl language but I have also found some .c files in /lib/libstand folder, but the source code is merely 30 lines.
I am stuck over here any help would do and also if my information is wrong please correct me. Thank you in anticipation.
Last edited by DutchDaemon; December 30th, 2011 at 00:41.
Reason: Don't invent your own formatting: http://forums.freebsd.org/showthread.php?t=8816
|