IOCTL-XFS-H...MONITORED-FS(2)

πŸ“¦ version 7.2.1, in alpine 3.24, arch rolling, fedora 44, nixpkgs unstable

πŸ’– ioctl_xfs_health_fd_on_monitored_fs β€” bestie check πŸ’–

okay so real talk, this is a page from the System Calls Manual (section 2, the syscall girlies), and it's all about one specific XFS ioctl. come sit with me 🫢


✨ NAME ✨

ioctl_xfs_health_fd_on_monitored_fs β€” the lil function that checks whether the fd you're holding actually belongs to the same filesystem that's being monitored πŸ‘€


🌸 SYNOPSIS 🌸

#include <xfs/xfs_fs.h>

int ioctl(int healthmon_fd, XFS_IOC_HEALTH_FD_ON_MONITORED_FS, struct
xfs_health_file_on_monitored_fs *arg);

πŸ¦‹ DESCRIPTION πŸ¦‹

so this is an XFS healthmon fd ioctl, and what it does is literally just ask the kernel driver: "hey bestie, does the file descriptor we passed in through arg point to a file that lives on the same filesystem that healthmon_fd is monitoring?" πŸ’…

and the fd gets conveyed in a struct that looks exactly like this, no notes:

struct xfs_health_file_on_monitored_fs {
     __s32 fd;
     __u32 flags;
};
  • the flags field must be zero. like, zero zero. not negotiable 🚫
  • the fd field is a descriptor of an open file πŸ“‚

and one more thing β€” healthmon_fd must be a file that was opened via the XFS_IOC_HEALTH_MONITOR ioctl. that's the vibe check it has to pass. no cap.


⭐ RETURN VALUE ⭐

if something goes wrong, -1 gets returned and errno is set to tell you what happened 😭

but if the file descriptor does point to a file on the same filesystem that's being monitored? you get 0 back. slay. ✨


πŸ’€ ERRORS πŸ’€

error codes can be one of these, but lowkey not limited to just these:

  • ESTALE β€” the open file is not on the same filesystem that's being monitored. different fs, different vibe, not it πŸ™ˆ
  • EINVAL β€” one or more of the arguments you specified is invalid. check ur inputs bestie.
  • EBADF β€” arg.fd does not refer to an open file. it's giving closed, and not in the cute way πŸ’”
  • EFAULT β€” the arg structure could not be copied into the kernel. the copy failed, periodt.
  • ENOTTY β€” healthmon_fd is not an XFS health monitoring file. wrong file, wrong energy 😀

πŸ‘‘ CONFORMING TO πŸ‘‘

this API is specific to the XFS filesystem on the Linux kernel. iykyk 🐧


🌈 SEE ALSO 🌈


and that's the whole page, bestie, you ate it πŸ’…βœ¨ written by the XFS girlies, dated 2026-01-04, and yeah β€” that's the manual, section 2, no cap, we're done here. mwah πŸŽ€πŸ«ΆπŸ’–

πŸ“¦ where this page comes from