IT Questions and Answers :)

Wednesday, November 22, 2017

A directory entry on a Unix or Linux system includes which of the following?

A directory entry on a Unix or Linux system includes which of the following?

  • inode number, filename, symlink names, and mode settings
  • filename and inode number
  • inode number, filename, mode settings, and file size in block count
  • inode number, all hardlinked filenames, mode settings, and ownership (UID and GID) 

A directory entry on a Unix or Linux system includes which of the following?

EXPLANATION

From the readdir man page on Linux:

       On Linux, the dirent structure is defined as follows:

           struct dirent {
               ino_t          d_ino;       /* inode number */
               off_t          d_off;       /* not an offset; see NOTES */
               unsigned short d_reclen;    /* length of this record */
               unsigned char  d_type;      /* type of file; not supported
                                              by all file system types */
               char           d_name[256]; /* filename */
           };

       The  only  fields  in the dirent structure that are mandated by POSIX.1 are: d_name[], of unspecified size, with at
       most NAME_MAX characters preceding the terminating null byte ('\0'); and (as an XSI extension)  d_ino.   The  other
       fields are unstandardized, and not present on all systems; see NOTES below for some further details.

From:
https://en.wikipedia.org/wiki/Unix_File_System
"Directory files contain only the list of filenames in the directory and the inode associated with each file."

SOURCE

https://linux.die.net/man/3/readdir
Share:

Popular Posts

Blog Archive