chattr

Manipulate the attributes of a file (QNX Neutrino)

Syntax:

chattr [+/- attribute]... [filename]...

Runs on:

Neutrino

Options:

attribute
The attribute you want to remove (-) or set (+).
filename
The name of a file whose attributes you want to display or manipulate.

Description:

The chattr utility is a front end to the devctl(DCMD_FSYS_FILE_FLAGS) command (from <sys/dcmd_blk.h>), which gets and sets file attributes (that are outside the scope of the POSIX standard). For example, the DOS/FAT filesystem has the concept of “hidden” or “system” files. Such attributes are typically stored as flags in the on-disk inode of each file.

These attributes are divided into the following classes:

Generic
An attribute that corresponds to a concept that may be shared across multiple filesystem formats (even if implemented in a different manner for each one).
Filesystem-specific
An attribute that has meaning only within a specific filesystem.

It's the responsibility of each io-blk.so filesystem module to map generic attributes to and from their private representation.

For example, a hidden file is a generic concept of a filename that may be hidden from normal user browsing (not displayed by ls) but remains available (to open() by an application) if its name is already known. The representation of this concept varies between filesystems:

This mapping functionality allows for application abstraction away from a particular on-disk structure (a program can work unchanged against any file on any filesystem). Many filesystem-specific attributes have no corresponding generic concept, and must be manipulated with knowledge of the underlying filesystem structure; the various <sys/fs_*.h> header files contain relevant bit definitions.

When you invoke chattr with no attributes and a filename (or a list of filenames), it displays the currently set attributes of each file. When you invoke chattr with an attribute (or list of attributes), it applies those modifications to each file.

Examples:

List the attributes for a file:

# chattr chattr.c
chattr.c: +backup +contiguous +used +modified

Add to and remove from the attributes for a file:

# chattr -archive +system /fs/dos/autoexec.bat
/fs/dos/autoexec.bat: -archive +system

Turn off snapshots for a Power-Safe (fs-qnx6.so) filesystem:

# chattr -snapshot /fs/qnx6
/fs/qnx6: -snapshot

See also:

devb-*, fs-*, fsysinfo, io-blk.so