ATTR_REMOVE(3)

πŸ“¦
version 2.6.0 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble

πŸ’– ATTR_REMOVE(3) πŸ’–

okay bestie, welcome to the XFS Compatibility API corner of section 3 of the manual β€” yes, that's the (3) in the title, we're in library-call territory, not commands. sit down, grab a strawberry πŸ“, and let's talk about deleting attributes.


✨ NAME ✨

attr_remove, attr_removef β€” remove a user attribute of a filesystem object. yeah. that's the whole gig. deleting vibes only πŸ’…


🌸 C SYNOPSIS 🌸

#include <attr/attributes.h>

int attr_remove (const char *path, const char *attrname, int flags);

int attr_removef (int fd, const char *attrname, int flags);

look at her. two functions, one dream. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, attr_remove and attr_removef give you a way to remove attributes that were previously created from filesystem objects. like, the attribute was there, it had a moment, it served looks, and now it's leaving the group chat. πŸ‘‘

path points to a path name for a filesystem object, and fd refers to the file descriptor associated with a file. if the attribute attrname exists, the attribute name and value will be removed from the filesystem object. both of them. name and value. the whole fit. 😭

the flags argument can contain the following symbols bitwise OR'ed together:

  • ATTR_ROOT β€” look for attrname in the root address space, not in the user address space. > heads up bestie: this one is limited to use by super-user only. super-user energy, no gatekeeping. πŸ‘‘
  • ATTR_DONTFOLLOW β€” do not follow symbolic links when resolving a path on an attr_remove function call. the default is to follow symbolic links. so if you don't say anything, she's following. she's always following. 🧚

πŸ’€ attr_remove will fail if one or more of the following are true πŸ’€

  • [ENOATTR] β€” the attribute name given is not associated with the indicated filesystem object. (nothing to remove, nothing to slay, empty handed πŸ˜”)
  • [ENOENT] β€” the named file does not exist. girl. where. where is she. πŸ™ˆ
  • [EPERM] β€” the effective user ID does not match the owner of the file and the effective user ID is not super-user.
  • [ENOTDIR] β€” a component of the path prefix is not a directory.
  • [EACCES] β€” search permission is denied on a component of the path prefix.
  • [EINVAL] β€” a bit was set in the flag argument that is not defined for this system call.
  • [EFAULT] β€” path points outside the allocated address space of the process.
  • [ELOOP] β€” a path name lookup involved too many symbolic links.
  • [ENAMETOOLONG] β€” the length of path exceeds {MAXPATHLEN}, or a pathname component is longer than {MAXNAMELEN}.

🌈 attr_removef will fail if 🌈

  • [ENOATTR] β€” the attribute name given is not associated with the indicated filesystem object.
  • [EINVAL] β€” a bit was set in the flag argument that is not defined for this system call, or fd refers to a socket, not a file. not me accidentally passing a socket πŸ’€
  • [EFAULT] β€” attrname points outside the allocated address space of the process.
  • [EBADF] β€” fd does not refer to a valid descriptor.

⭐ DIAGNOSTICS ⭐

on success, zero is returned. on error, -1 is returned, and errno is set appropriately. that's it. that's the vibe check. ✨


🫢 SEE ALSO 🫢

iykyk, the whole extended attributes friendship circle πŸ’œ


and that's a wrap, bestie! this page came from the Extended Attributes era, dated Dec 2001, and the source/version line is literally just Extended Attributes β€” so yeah, she's vintage, she's iconic, she's still holding it down. periodt. πŸ’…πŸŽ€πŸŒŸ

πŸ“¦ where this page comes from