Introduce man pages for file_getattr() and file_setattr()
v6 cover Introduce man pages for file_getattr() and file_setattr()
Hi folks,
This series introduce 2 man pages for file_getattr() and file_setattr() syscalls.
Changes from v5:
- rebase to 6.20 and dropped "struct file_attr" patch (merged)
- change description of dirfd & path args to reference openat(2) Changes from v4:
- Split single patch into 3 separate ones
- Mark examples for linters
- Use special char for empty lines in examples
- Use w64/w32 in printf() in examples
- Use const fattr in file_setattr() definition
- Other minor fixes
- A few fixes found by lint in examples
Changes from v3:
- dropped VERSIONS section in file_attr.2type
- reference arguments and errors from file_setattr to file_getattr
- Minor wording fixes
- Minor formatting fixes
- Removed zero-initialized requirement
- Interdiff with v3 below
Changes from v2:
- a few grammar fixes
- styling fixes
- sashiko.dev fixes (wrong AT_FDCWD combined with AT_EMPTY_PATH description, unused "dfd")
- dropped requirement to zero fattr before using file_setattr()
- Pathname -> path
- Dropped description of why FS_IOC_ aren't usable with special files
- Fixed backslashes in the code examples
Andrey Albershteyn (2):
man/man2: introduce man page for file_getattr(2) syscall man/man2: introduce man page for file_setattr(2) syscall
man/man2/file_getattr.2 | 252 ++++++++++++++++++++++++++++++++++++++++ man/man2/file_setattr.2 | 183 +++++++++++++++++++++++++++++ 2 files changed, 435 insertions(+) create mode 100644 man/man2/file_getattr.2 create mode 100644 man/man2/file_setattr.2
Range-diff against v5:
1: bfff306908cf ! 1: c7df8a930c70 man/man2: introduce man page for file_getattr(2) syscall
@@ man/man2/file_getattr.2 (new)
+of the file
+specified by path.
+.P
-+As with
++The
++.I dirfd
++and
++.I path
++arguments behave in the same way as in
+.BR openat (2),
-+if
++with the difference that
+.I path
-+is relative,
-+then it is interpreted relative to the directory
-+referred to by the file descriptor
-+.IR dirfd .
-+The special
-+.I dirfd
-+value
-+.B AT_FDCWD
-+can be used to refer to the current working directory of the calling process.
-+If
-+.I path
-+is absolute,
-+then
-+.I dirfd
-+is ignored.
++can be NULL meaning an empty string.
+.P
+The
+.I fattr2: d81d763c4223 = 2: 9c7fbaab27e5 man/man2: introduce man page for file_setattr(2) syscall
Signature · 1 line
2.56.0
PATCH v6 1/2 man/man2: introduce man page for file_getattr(2) syscall
Add manual page for file_getattr().
--- man/man2/file_getattr.2 | 252 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 man/man2/file_getattr.2
man/man2/file_getattr.2 new file +252 -0
@@ -0,0 +1,252 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH file_getattr 2 (date) "Linux man-pages (unreleased)" +.SH NAME +file_getattr \- get filesystem file attributes +.SH SYNOPSIS +.nf +.BR "#include <linux/fcntl.h>" " /* " AT_* " constants */" +.BR "#include <linux/fs.h>" " /* " FS_XFLAG_* " constants */" +.BR "#include <sys/syscall.h>" " /* " SYS_* " constants */" +.B #include <unistd.h> +.P +.B long syscall(SYS_file_getattr, +.BI " int " dirfd ", const char *" path , +.BI " struct file_attr *" fattr ", size_t " size , +.BI " unsigned int " flags ); +.fi +.SH DESCRIPTION +The +.BR file_getattr () +system call retrieves filesystem file attributes +of the file +specified by path. +.P +The +.I dirfd +and +.I path +arguments behave in the same way as in +.BR openat (2), +with the difference that +.I path +can be NULL meaning an empty string. +.P +The +.I fattr +argument is a pointer to a +.I file_attr +structure. +This structure will be filled with file attributes. +This structure is described in +.BR file_attr (2type). +.P +The +.I size +argument specifies the size of the structure pointed to by +.IR fattr . +The size indicates the version of the structure in use, +and should always be specified as +.IR sizeof(struct file_attr) . +.P +The +.I flags +argument contains a bitwise OR of zero or more of the following constants: +.TP +.B AT_EMPTY_PATH +If +.I path +is an empty string, +operate on the file referred to by +.IR dirfd . +In this case, +.I dirfd +can refer to any type of file, +not just a directory. +.TP +.B AT_SYMLINK_NOFOLLOW +If +.I path +is a symbolic link, +do not dereference it; +instead, +get attributes of the symbolic link inode itself. +.SH RETURN VALUE +On success, +zero is returned. +On error, +\-1 is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +.TP +.B E2BIG +.I size +is too big (larger than +.BR PAGE_SIZE ). +.TP +.B EACCES +Search permission is denied for one of the directories +in the path prefix of +.IR path . +.TP +.B EBADF +.I path +is relative but +.I dirfd +is neither +.B AT_FDCWD +nor a valid file descriptor. +.TP +.B EBADF +.I path +is an empty string, +.B AT_EMPTY_PATH +was specified, +but +.I dirfd +is neither +.B AT_FDCWD +nor a valid file descriptor. +.TP +.B EFAULT +.I path +or +.I fattr +is an invalid pointer. +.TP +.B EINVAL +Unknown flags specified in +.IR flags . +.TP +.B EINVAL +.I size +is smaller than +.BR FILE_ATTR_SIZE_VER0 . +.TP +.B ELOOP +Too many symbolic links encountered while resolving +.IR path . +.TP +.B ENAMETOOLONG +.I path +is too long. +.TP +.B ENOENT +A component of +.I path +does not exist. +.TP +.B ENOENT +.I path +is an empty string and +.B AT_EMPTY_PATH +was not specified in +.IR flags . +.TP +.B ENOMEM +Insufficient kernel memory was available. +.TP +.B ENOTDIR +A component of the path prefix of +.I path +is not a directory. +.TP +.B ENOTDIR +.I path +is relative and +.I dirfd +is a file descriptor referring to a file other than a directory. +.TP +.B EOPNOTSUPP +The filesystem does not support getting attributes on this type of inode. +.SH HISTORY +Linux 6.17 +.SH NOTES +This system call is designed to be extensible. +The +.I size +argument allows user-space applications to indicate +which version of the +.I file_attr +structure they are using, +enabling the kernel to support both old and new versions +of the structure simultaneously. +.P +If +.I size +is smaller than the structure size the kernel expects, +only the fields that fit within +.I size +will be filled in. +If +.I size +is larger than the kernel's structure size, +the extra bytes are zeroed. +.SH EXAMPLES +The program below demonstrates the use of +.BR file_getattr () +to retrieve and display file attributes. +.P +.in +4n +.\" SRC BEGIN (file_getattr.c) +.EX +#define _GNU_SOURCE +#include <fcntl.h> +#include <linux/fs.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/syscall.h> +#include <unistd.h> +\& +#ifndef SYS_file_getattr +#define SYS_file_getattr 467 +#endif +\& +int +main(int argc, char *argv[]) +{ + struct file_attr fa; + long ret; +\& + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename>\[rs]n", argv[0]); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, AT_FDCWD, argv[1], &fa, + sizeof(fa), 0); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + printf("File attributes:\[rs]n"); + printf(" xflags: 0x%w64x\[rs]n", fa.fa_xflags); + printf(" extsize: %w32u\[rs]n", fa.fa_extsize); + printf(" nextents: %w32u\[rs]n", fa.fa_nextents); + printf(" projid: %w32u\[rs]n", fa.fa_projid); + printf(" cowextsize: %w32u\[rs]n", fa.fa_cowextsize); +\& + /* + * Try setting NODUMP flag with chattr +d ./foo to see + * the difference. + */ + if (fa.fa_xflags & FS_XFLAG_NODUMP) + printf(" NODUMP flag is set\[rs]n"); +\& + exit(EXIT_SUCCESS); +} +.EE +.\" SRC END +.in +.SH SEE ALSO +.BR file_setattr (2), +.BR file_attr (2type), +.BR ioctl (2), +.BR ioctl_fs (2), +.BR openat (2), +.BR ioctl_xfs_fssetxattr (2)
Signature · 1 line
2.56.0
Alejandro Colomar
maintainerRe: [PATCH v6 1/2] man/man2: introduce man page for file_getattr(2) syscall
Hi Andrey,
Quoted 8 lines
Date: 2026-10-21 16:10:04+0200
From: Andrey Albershteyn <[email protected]>Add manual page for
file_getattr().
Thanks! I've applied the patch (with very minor tweaks in the commit message an the diff).
Have a lovely day!
Alex
Quoted 267 lines
--- man/man2/file_getattr.2 | 252 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 man/man2/file_getattr.2man/man2/file_getattr.2 new file +252
-0@@ -0,0 +1,252 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH file_getattr 2 (date) "Linux man-pages (unreleased)" +.SH NAME +file_getattr \- get filesystem file attributes +.SH SYNOPSIS +.nf +.BR "#include <linux/fcntl.h>" " /* " AT_* " constants */" +.BR "#include <linux/fs.h>" " /* " FS_XFLAG_* " constants */" +.BR "#include <sys/syscall.h>" " /* " SYS_* " constants */" +.B #include <unistd.h> +.P +.B long syscall(SYS_file_getattr, +.BI " int " dirfd ", const char *" path , +.BI " struct file_attr *" fattr ", size_t " size , +.BI " unsigned int " flags ); +.fi +.SH DESCRIPTION +The +.BR file_getattr () +system call retrieves filesystem file attributes +of the file +specified by path. +.P +The +.I dirfd +and +.I path +arguments behave in the same way as in +.BR openat (2), +with the difference that +.I path +can be NULL meaning an empty string. +.P +The +.I fattr +argument is a pointer to a +.I file_attr +structure. +This structure will be filled with file attributes. +This structure is described in +.BR file_attr (2type). +.P +The +.I size +argument specifies the size of the structure pointed to by +.IR fattr . +The size indicates the version of the structure in use, +and should always be specified as +.IR sizeof(struct file_attr) . +.P +The +.I flags +argument contains a bitwise OR of zero or more of the following constants: +.TP +.B AT_EMPTY_PATH +If +.I path +is an empty string, +operate on the file referred to by +.IR dirfd . +In this case, +.I dirfd +can refer to any type of file, +not just a directory. +.TP +.B AT_SYMLINK_NOFOLLOW +If +.I path +is a symbolic link, +do not dereference it; +instead, +get attributes of the symbolic link inode itself. +.SH RETURN VALUE +On success, +zero is returned. +On error, +\-1 is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +.TP +.B E2BIG +.I size +is too big (larger than +.BR PAGE_SIZE ). +.TP +.B EACCES +Search permission is denied for one of the directories +in the path prefix of +.IR path . +.TP +.B EBADF +.I path +is relative but +.I dirfd +is neither +.B AT_FDCWD +nor a valid file descriptor. +.TP +.B EBADF +.I path +is an empty string, +.B AT_EMPTY_PATH +was specified, +but +.I dirfd +is neither +.B AT_FDCWD +nor a valid file descriptor. +.TP +.B EFAULT +.I path +or +.I fattr +is an invalid pointer. +.TP +.B EINVAL +Unknown flags specified in +.IR flags . +.TP +.B EINVAL +.I size +is smaller than +.BR FILE_ATTR_SIZE_VER0 . +.TP +.B ELOOP +Too many symbolic links encountered while resolving +.IR path . +.TP +.B ENAMETOOLONG +.I path +is too long. +.TP +.B ENOENT +A component of +.I path +does not exist. +.TP +.B ENOENT +.I path +is an empty string and +.B AT_EMPTY_PATH +was not specified in +.IR flags . +.TP +.B ENOMEM +Insufficient kernel memory was available. +.TP +.B ENOTDIR +A component of the path prefix of +.I path +is not a directory. +.TP +.B ENOTDIR +.I path +is relative and +.I dirfd +is a file descriptor referring to a file other than a directory. +.TP +.B EOPNOTSUPP +The filesystem does not support getting attributes on this type of inode. +.SH HISTORY +Linux 6.17 +.SH NOTES +This system call is designed to be extensible. +The +.I size +argument allows user-space applications to indicate +which version of the +.I file_attr +structure they are using, +enabling the kernel to support both old and new versions +of the structure simultaneously. +.P +If +.I size +is smaller than the structure size the kernel expects, +only the fields that fit within +.I size +will be filled in. +If +.I size +is larger than the kernel's structure size, +the extra bytes are zeroed. +.SH EXAMPLES +The program below demonstrates the use of +.BR file_getattr () +to retrieve and display file attributes. +.P +.in +4n +.\" SRC BEGIN (file_getattr.c) +.EX +#define _GNU_SOURCE +#include <fcntl.h> +#include <linux/fs.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/syscall.h> +#include <unistd.h> +\& +#ifndef SYS_file_getattr +#define SYS_file_getattr 467 +#endif +\& +int +main(int argc, char *argv[]) +{ + struct file_attr fa; + long ret; +\& + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename>\[rs]n", argv[0]); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, AT_FDCWD, argv[1], &fa, + sizeof(fa), 0); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + printf("File attributes:\[rs]n"); + printf(" xflags: 0x%w64x\[rs]n", fa.fa_xflags); + printf(" extsize: %w32u\[rs]n", fa.fa_extsize); + printf(" nextents: %w32u\[rs]n", fa.fa_nextents); + printf(" projid: %w32u\[rs]n", fa.fa_projid); + printf(" cowextsize: %w32u\[rs]n", fa.fa_cowextsize); +\& + /* + * Try setting NODUMP flag with chattr +d ./foo to see + * the difference. + */ + if (fa.fa_xflags & FS_XFLAG_NODUMP) + printf(" NODUMP flag is set\[rs]n"); +\& + exit(EXIT_SUCCESS); +} +.EE +.\" SRC END +.in +.SH SEE ALSO +.BR file_setattr (2), +.BR file_attr (2type), +.BR ioctl (2), +.BR ioctl_fs (2), +.BR openat (2), +.BR ioctl_xfs_fssetxattr (2)Signature · 1 line
2.56.0
Signature · 1 line
<https://www.alejandro-colomar.es>
PATCH v6 2/2 man/man2: introduce man page for file_setattr(2) syscall
In reply to Andrey AlbershteynAdd manual pages for file_setattr() syscall.
--- man/man2/file_setattr.2 | 183 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 man/man2/file_setattr.2
man/man2/file_setattr.2 new file +183 -0
@@ -0,0 +1,183 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH file_setattr 2 (date) "Linux man-pages (unreleased)" +.SH NAME +file_setattr \- set filesystem file attributes +.SH SYNOPSIS +.nf +.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */" +.BR "#include <linux/fs.h>" " /* Definition of " FS_XFLAG_* " constants */" +.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" +.B #include <unistd.h> +.P +.B long syscall(SYS_file_setattr, +.BI " int " dirfd ", const char *" path , +.BI " const struct file_attr *" fattr ", size_t " size , +.BI " unsigned int " flags ); +.fi +.SH DESCRIPTION +The +.BR file_setattr () +system call sets filesystem file attributes +on the file specified by path. +.P +The +.IR dirfd , +.IR path , +.IR size , +and +.I flags +arguments behave in the same way as in +.BR file_getattr (2). +The +.IR fattr , +is read-only argument with +file attributes to set. +User-space applications should use +.BR file_getattr (2) +to initialize +.I fattr +argument beforehand. +.SH RETURN VALUE +On success, +zero is returned. +On error, +\-1 is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +The errors are the same as returned by +.BR file_getattr (2) +with the addition of following ones: +.TP +.B E2BIG +.I size +indicates a version which the kernel doesn't support +(the size is larger than the kernel expects) +and new fields are non-zero. +.TP +.B EINVAL +Invalid combination of parameters provided in +.I fattr +for this type of file or filesystem. +.TP +.B EPERM +The caller does not have the necessary permissions +to change the file attributes. +.TP +.B EROFS +The file is on a read-only filesystem. +.SH HISTORY +Linux 6.17 +.SH NOTES +This system call is designed to be extensible. +The +.I size +argument allows user-space applications to indicate +which version of the +.I file_attr +structure they are using, +enabling the kernel to support both old and new versions +of the structure simultaneously. +.P +If +.I size +is smaller than the structure size the kernel expects, +the kernel treats the missing fields as having zero values +(which is a no-op). +If +.I size +is larger than expected, +the kernel checks that all unknown (to the kernel) fields are zero; +if not, +the call fails with +.BR E2BIG . +.SH EXAMPLES +The program below demonstrates the use of +.BR file_setattr () +to set the +.B FS_XFLAG_NODUMP +flag on a file. +.P +.in +4n +.\" SRC BEGIN (file_setattr.c) +.EX +#define _GNU_SOURCE +#include <fcntl.h> +#include <linux/fs.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/syscall.h> +#include <unistd.h> +\& +#ifndef SYS_file_getattr +#define SYS_file_getattr 467 +#endif +\& +#ifndef SYS_file_setattr +#define SYS_file_setattr 468 +#endif +\& +int +main(int argc, char *argv[]) +{ + struct file_attr fa; + int dfd; + long ret; +\& + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename>\[rs]n", argv[0]); + exit(EXIT_FAILURE); + } +\& + dfd = open(argv[1], O_RDONLY); + if (dfd == \-1) { + perror("open"); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + printf("Current flags: 0x%w64x\[rs]n", fa.fa_xflags); +\& + fa.fa_xflags |= FS_XFLAG_NODUMP; +\& + ret = syscall(SYS_file_setattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_setattr"); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + if (fa.fa_xflags & FS_XFLAG_NODUMP) + printf("flags 0x%w64x (NODUMP flag is set)\[rs]n", fa.fa_xflags); +\& + exit(EXIT_SUCCESS); +} +.EE +.\" SRC END +.in +.SH SEE ALSO +.BR file_getattr (2), +.BR ioctl (2), +.BR ioctl_fs (2), +.BR openat (2), +.BR file_attr (2type), +.BR path_resolution (7), +.BR ioctl_xfs_fssetxattr (2)
Signature · 1 line
2.56.0
Re: [PATCH v6 2/2] man/man2: introduce man page for file_setattr(2) syscall
Quoted 7 lines
Date: 2026-10-21 16:10:05+0200
From: Andrey Albershteyn <[email protected]>Add manual pages for
file_setattr()syscall.
Hi Andrey,
I've applied this patch with some tweaks. Thanks!
Cheers,
Alex
Quoted 198 lines
--- man/man2/file_setattr.2 | 183 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 man/man2/file_setattr.2man/man2/file_setattr.2 new file +183
-0@@ -0,0 +1,183 @@ +.\" Copyright, the authors of the Linux man-pages project +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.TH file_setattr 2 (date) "Linux man-pages (unreleased)" +.SH NAME +file_setattr \- set filesystem file attributes +.SH SYNOPSIS +.nf +.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */" +.BR "#include <linux/fs.h>" " /* Definition of " FS_XFLAG_* " constants */" +.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" +.B #include <unistd.h> +.P +.B long syscall(SYS_file_setattr, +.BI " int " dirfd ", const char *" path , +.BI " const struct file_attr *" fattr ", size_t " size , +.BI " unsigned int " flags ); +.fi +.SH DESCRIPTION +The +.BR file_setattr () +system call sets filesystem file attributes +on the file specified by path. +.P +The +.IR dirfd , +.IR path , +.IR size , +and +.I flags +arguments behave in the same way as in +.BR file_getattr (2). +The +.IR fattr , +is read-only argument with +file attributes to set. +User-space applications should use +.BR file_getattr (2) +to initialize +.I fattr +argument beforehand. +.SH RETURN VALUE +On success, +zero is returned. +On error, +\-1 is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +The errors are the same as returned by +.BR file_getattr (2) +with the addition of following ones: +.TP +.B E2BIG +.I size +indicates a version which the kernel doesn't support +(the size is larger than the kernel expects) +and new fields are non-zero. +.TP +.B EINVAL +Invalid combination of parameters provided in +.I fattr +for this type of file or filesystem. +.TP +.B EPERM +The caller does not have the necessary permissions +to change the file attributes. +.TP +.B EROFS +The file is on a read-only filesystem. +.SH HISTORY +Linux 6.17 +.SH NOTES +This system call is designed to be extensible. +The +.I size +argument allows user-space applications to indicate +which version of the +.I file_attr +structure they are using, +enabling the kernel to support both old and new versions +of the structure simultaneously. +.P +If +.I size +is smaller than the structure size the kernel expects, +the kernel treats the missing fields as having zero values +(which is a no-op). +If +.I size +is larger than expected, +the kernel checks that all unknown (to the kernel) fields are zero; +if not, +the call fails with +.BR E2BIG . +.SH EXAMPLES +The program below demonstrates the use of +.BR file_setattr () +to set the +.B FS_XFLAG_NODUMP +flag on a file. +.P +.in +4n +.\" SRC BEGIN (file_setattr.c) +.EX +#define _GNU_SOURCE +#include <fcntl.h> +#include <linux/fs.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/syscall.h> +#include <unistd.h> +\& +#ifndef SYS_file_getattr +#define SYS_file_getattr 467 +#endif +\& +#ifndef SYS_file_setattr +#define SYS_file_setattr 468 +#endif +\& +int +main(int argc, char *argv[]) +{ + struct file_attr fa; + int dfd; + long ret; +\& + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename>\[rs]n", argv[0]); + exit(EXIT_FAILURE); + } +\& + dfd = open(argv[1], O_RDONLY); + if (dfd == \-1) { + perror("open"); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + printf("Current flags: 0x%w64x\[rs]n", fa.fa_xflags); +\& + fa.fa_xflags |= FS_XFLAG_NODUMP; +\& + ret = syscall(SYS_file_setattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_setattr"); + exit(EXIT_FAILURE); + } +\& + ret = syscall(SYS_file_getattr, dfd, "", &fa, sizeof(fa), + AT_EMPTY_PATH); + if (ret == \-1) { + perror("file_getattr"); + exit(EXIT_FAILURE); + } +\& + if (fa.fa_xflags & FS_XFLAG_NODUMP) + printf("flags 0x%w64x (NODUMP flag is set)\[rs]n", fa.fa_xflags); +\& + exit(EXIT_SUCCESS); +} +.EE +.\" SRC END +.in +.SH SEE ALSO +.BR file_getattr (2), +.BR ioctl (2), +.BR ioctl_fs (2), +.BR openat (2), +.BR file_attr (2type), +.BR path_resolution (7), +.BR ioctl_xfs_fssetxattr (2)Signature · 1 line
2.56.0
Signature · 1 line
<https://www.alejandro-colomar.es>