I am learning the POSIX API, and I don’t understand the logic behind some of the names.
e.g.
S_IRUSR, S_IRUSR
What does What does the S stand for? I get thatR and W are for read and write. But what naming convention followed by POSIX? Just like Win32 follows Hungarian Notation for naming, what does POSIX follow for their naming? For standards like POSIX, there must be documentation for it…
The leading
S_is just to identify what structure/function the constant goes with.From
<sys/stat.h>, the constantsS_IRUSR,S_IWUSR, etc are possible values for thest_modemember forstruct stat(used instat()and friends). All the members ofstruct statstart with the prefixst_, and there are severalstat-related macros that also start withS_. The convention is merely there to make matching structure names, member names, and constants easier.