Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the meaning of 'I' in S_IRUSR

Tags:

S_IRUSR is a macro constant in sys/stat.h of posix. it stands for user read permission bit.

the prefix S_ may stand for 'status of' the RUSR maybe Read of User. but what's the meaning of 'I'?

like image 743
wuhaochi Avatar asked Dec 27 '12 13:12

wuhaochi


People also ask

What type is mode_ t?

In other words, a mode_t consists of a load of bit-packed booleans. Ignoring the last three, this gives their bit number: Read?

What does S_irwxu mean?

S_IRWXO is the bitwise inclusive OR of S_IROTH, S_IWOTH, and S_IXOTH. S_IRWXU. Read, write, and search, or execute, for the file owner; S_IRWXU is the bitwise inclusive OR of S_IRUSR, S_IWUSR, and S_IXUSR. S_ISGID. Privilege to set group ID (GID) for execution.

What is use sys stat h?

The stat data structure in the /usr/include/sys/stat. h file returns information for the stat, fstat, lstat, statx, and fstatx subroutines. The stat data structure contains the following fields: Item. Description.


1 Answers

The naming is historic ... dating back to the very earliest days of UNIX. The "S" is for STAT, the "I" for INODE (a term not really used in POSIX itself outside Rationale), the "R" for READ and the "USR" for USER.

Inodes do get a few mentions, and the stat structure also includes "st_ino", which the standard describes as the "File Serial Number". In many POSIX implementations, an inode is a data structure containing all the meta-data for the file (much of which is what is read by the stat() call).

(From Wikipedia:) The reason for designating these as "i" nodes is unknown. When asked, Unix pioneer Dennis Ritchie replied:

In truth, I don't know either. It was just a term that we started to use. "Index" is my best guess, because of the slightly unusual file system structure that stored the access information of files as a flat array on the disk, with all the hierarchical directory information living aside from this. Thus the i-number is an index in this array, the i-node is the selected element of the array.

(The "i-" notation was used in the 1st edition manual; its hyphen was gradually dropped.)

like image 111
NickStoughton Avatar answered Oct 04 '22 05:10

NickStoughton