MODECANON(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

modecanon β€” canonical file mode representation. Bestie, that's the whole name vibe: canonical file mode representation, slay. This is MODECANON(3) from the Library Functions Manual, and yes the manual name is folded in right here because we're cute like that. πŸŽ€

✨ SYNOPSIS ✨

#include <modex.h>

int    modei(int external); int    modex(int internal);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so POSIX threw out the file type bit macros and replaced them with function-like macros that test file type. This is bad in many ways β€” the worst of which is that it provides no way for a user program to synthesize file types in the mode bits. 😭

pax(1), tar(1) and cpio(1) are examples of user programs that must convert between the internal mode representation and a private external representation. These routines provide a canonical external representation with macros to access and synthesize the bits in the external representation. Iconic. ✨

modei takes an external mode representation external and returns the equivalent internal representation. 🫢

modex takes an internal mode representation internal and returns the equivalent external representation. πŸ’…

The traditional bit access macros β€” where the S_ prefix changes to X_ β€” are:

  • X_IFMT
  • X_IFSOCK
  • X_IFLNK
  • X_IFCTG
  • X_IFREG
  • X_IFBLK
  • X_IFDIR
  • X_IFCHR
  • X_IFIFO
  • X_IPERM
  • X_ISUID
  • X_ISGID
  • X_ISVTX
  • X_IRUSR
  • X_IWUSR
  • X_IXUSR
  • X_IRGRP
  • X_IWGRP
  • X_IXGRP
  • X_IROTH
  • X_IWOTH
  • X_IXOTH
  • X_IRWXU
  • X_IRWXG
  • X_IRWXO

X_ITYPE(mode) returns the type bits for mode. πŸ‘‘

🌈 SEE ALSO 🌈

pax(1), stat(2) β€” go read those too, bestie. πŸ’œ


Cute sign-off: source/version is the MODECANON(3) page in the Library Functions Manual, and there’s no separate date in the original footer β€” it just says MODECANON(3). πŸŽ€

πŸ“¦ where this page comes from