Skip to content

posix_fallocate not supported #4464

@nazar-pc

Description

@nazar-pc
error: unsupported operation: can't call foreign function `posix_fallocate` on OS `linux`
   --> /home/nazar-pc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fs2-0.4.3/src/unix.rs:103:24
    |
103 |     let ret = unsafe { libc::posix_fallocate(file.as_raw_fd(), 0, len as libc::off_t) };
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsupported operation occurred here
    |
    = help: this means the program tried to do something Miri does not support; it does not indicate a bug in the program
    = note: BACKTRACE on thread `tests::other_op`:
    = note: inside `fs2::unix::allocate` at /home/nazar-pc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fs2-0.4.3/src/unix.rs:103:24: 103:86
    = note: inside `<std::fs::File as fs2::FileExt>::allocate` at /home/nazar-pc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fs2-0.4.3/src/lib.rs:104:9: 104:33

It is meant to pre-allocate disk space to ensure writes do not fail within provided length with lack of disk space afterward. I'd say it is mostly the same as File::set_len() except it avoids sparse files on disk.

Metadata

Metadata

Labels

A-filesArea: related to files, paths, sockets, file descriptors, or handlesA-shimsArea: This affects the external function shimsC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions