0

I'm working on a customized android target board. The board file system is mounted over NFS. There is a API call procedure Libcore.os.posix_fallocate which tries to create length of a physical file, but the operation failed due to "Error:Operation not supported on the transport endpoint". My immediate guess would be that posix_fallocate cannot be operated over NFS and I googled around seem my guess is valid. So is there any alternative API I can use to operate the same result?

It looks I can use dd command to pre-create a file, if that's the case, what API did dd command actually calling? I guess I can steal the API from dd

georgewhr
  • 174
  • 1
  • 12

1 Answers1

0

ftruncate can replace it, it does not take offset parameter

georgewhr
  • 174
  • 1
  • 12
  • 1
    While `ftruncate` will set the size it will not necessarily allocate the space, instead leaving it as a sparse file (if supported by the filesystem). `fallocate` fully realizes the file and checks against disk-full now instead of when the bytes are actually written. – Brian White May 04 '17 at 20:01