DCMD_FSYS_FILE_FLAGS

Get the flags for a file

Synopsis:

#include <sys/dcmd_blk.h>

#define DCMD_FSYS_FILE_FLAGS   __DIOTF(_DCMD_FSYS, 20, struct fs_fileflags)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device.
dcmd DCMD_FSYS_FILE_FLAGS
dev_data_ptr A pointer to a struct fs_fileflags (see below)
n_bytes sizeof(struct fs_fileflags)
dev_info_ptr NULL

Description:

This command gets flags that indicate file attributes. The chattr utility is a front end for this command; for information about the flags, see its entry in the Utilities Reference.

Note: Not all of the flags are currently defined in public headers.

Input:

None.

Output:

The fs_fileflags structure is defined as follows:

struct fs_fileflags {
        uint16_t        mask[2];
        uint16_t        bits[2];
        char            basetype[16];
};

The members include:

mask
An array of masks, one for the generic flags, and one for filesystem-specific flags.
bits
An array of bit settings, one for the generic flags, and one for filesystem-specific flags.
basetype
The null-terminated name of the filesystem.

Example:

struct fs_fileflags     ff;

memset(&ff, 0, sizeof ff);
if((err = devctl(fd, DCMD_FSYS_FILE_FLAGS, &ff, sizeof ff, 0)) != EOK) {
    printf("fsys_file_flags=%s(%d)\n", strerror(err), err);
} else {
    printf("fsys_file_flags=%#x:%#x\n", ff.bits[0], ff.bits[1]);
}

See also:

devctl() in the QNX Neutrino C Library Reference

chattr in the Utilities Reference