Skip to content

ensureSize (linux)

Source (upstream pre-purge) Current
File consensus/ethash/mmap_help_linux.go mmap_help_linux.go
Symbol ensureSize ensureSize
Ref dde2da0ef~1 etc/v1.17.3-full-node

Linux build-tag variant (grows the mmap-backed DAG/cache file via fallocate).

3-way merge — purge → getc ← upstream

pre-purge
// ensureSize expands the file to the given size. This is to prevent runtime
// errors later on, if the underlying file expands beyond the disk capacity,
// even though it ostensibly is already expanded, but due to being sparse
// does not actually occupy the full declared size on disk.
func ensureSize(f *os.File, size int64) error {
// Docs: https://www.man7.org/linux/man-pages/man2/fallocate.2.html
return unix.Fallocate(int(f.Fd()), 0, 0, size)
}
core-geth validation — **Identical** ✅ | | | |---|---| | File | [`mmap_help_linux.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/consensus/ethash/mmap_help_linux.go) | | Symbol | `ensureSize` | | Ref | `v1.12.20` |

← Consensus & Ethash