Extend a file, optionally zero-filling it
#include <sys/dcmd_blk.h> #define DCMD_FSYS_PREGROW_FILE __DIOT(_DCMD_FSYS, 14, off64_t)
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device. |
dcmd | DCMD_FSYS_PREGROW_FILE |
dev_data_ptr | A pointer to a off64_t |
n_bytes | sizeof(off64_t) |
dev_info_ptr | NULL |
This command extends a file, optionally zero-filling it. In contrast, the POSIX ftruncate() function extends a file and zero-fills the new data space.
In order to use this command, your process needs to have the vfs/pregrow (BLK_ABILITY_PREGROW) custom ability enabled. For more information, see procmgr_ability() and procmgr_ability_lookup() in the C Library Reference.
The pregrow-fill option to io-blk.so specifies whether or not this command zeroes the content when growing files. Zeroing the content is the default but increases the time for pregrowing files; not zeroing is very fast but insecure, as it allows access to the old content of the disk blocks.
The file size.
None.
int fd; off64_t sz; fd=open(...); sz=...; if (devctl(fd, DCMD_FSYS_PREGROW_FILE, &sz, sizeof(sz), NULL) != EOK) { /* Error */ }
devctl(), ftruncate() in the QNX Neutrino C Library Reference
io-blk.so in the Utilities Reference