mount_attr(2type)

πŸ’– mount_attr(2type) β€” the struct that tells the kernel what to change πŸ’–

okay so bestie, this is a 2type page, meaning it documents a type (a struct, not a function), and the whole vibe is: "here's the lil box of fields you hand to the kernel so it knows what mount properties to set, clear, and how to propagate". It lives in the Linux kernel headers, so no linking required, she's just a definition. πŸŽ€


✨ NAME ✨

mount_attr β€” what mount properties to set and clear

πŸ“š LIBRARY πŸ“š

Linux kernel headers

ngl this one's not a lib you link against, it's a header situation. include and go. 🫢

🌸 SYNOPSIS 🌸

#include <sys/mount.h>

struct mount_attr {
    u64 attr_set;     /* Mount properties to set */
    u64 attr_clr;     /* Mount properties to clear */
    u64 propagation;  /* Mount propagation type */
    u64 userns_fd;    /* User namespace file descriptor */
    /* ... */
};

πŸ’… DESCRIPTION πŸ’…

Okay so the whole "it's giving" of this struct is: it spells out which mount properties should be changed when you call mount_setattr(2). That's it, that's the job. ✨

The fields are as follows, no skips, we're reading all of them:

  • .attr_set β€” this field says which MOUNT_ATTR_* attribute flags to set. πŸ‘‘
  • .attr_clr β€” this field says which MOUNT_ATTR_* attribute flags to clear. bye bestie πŸ’€
  • .propagation β€” this field says what mount propagation will be applied. The valid values here are the same propagation types described in mount_namespaces(7). So if you wanna know your options, that's your girl. πŸ¦‹
  • .userns_fd β€” this field is a file descriptor that indicates which user namespace to use as a reference for ID-mapped mounts with MOUNT_ATTR_IDMAP. very main character, very specific. πŸ’–

⭐ STANDARDS ⭐

Linux. periodt. 🐧

πŸ•°οΈ HISTORY πŸ•°οΈ

  • Linux 5.12. ⭐
  • glibc 2.36. ✨
🚨 IMPORTANT WARNING, FR FR 🚨 Extra fields may be appended to the structure, and a zero value in a new field makes the kernel behave as though that extension field was not present. So a user must zero-fill this structure on initialization. No cap β€” if you don't zero-fill it, you're gambling and the kernel does not play. 😭

πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page bestie, you ate that πŸ’…βœ¨

okay bye, this was Linux man-pages 6.20, dated 2025-09-21 β€” love her, respect her, zero-fill your structs. πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms