aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorIgor Mikhailov (imichail) <imichail@cisco.com>2018-02-05 12:09:36 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-06 10:35:04 +0000
commit7d25415a9384d4c3d786d0c1ae5c0fcff3112acd (patch)
tree4946f7d77fa9986a4af76997824db538de98c6b1 /src/vppinfra
parenta332c46a51f9b4e13963340dfee1318e7513c124 (diff)
Provide page-aligned length to ftruncate.
For some files such as hugepages files, ftruncate() fails with the error "Invalid argument" if the 'length' parameter is not on a page boundary. Change-Id: I42a9cde98707da15e3c5d1653046e2277fc7a424 Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/linux/mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vppinfra/linux/mem.c b/src/vppinfra/linux/mem.c
index 350ccf855ce..c4973a6b8e0 100644
--- a/src/vppinfra/linux/mem.c
+++ b/src/vppinfra/linux/mem.c
@@ -194,7 +194,7 @@ clib_mem_vm_ext_alloc (clib_mem_vm_alloc_t * a)
}
if (fd != -1)
- if ((ftruncate (fd, a->size)) == -1)
+ if ((ftruncate (fd, n_pages * (1 << log2_page_size))) == -1)
{
err = clib_error_return_unix (0, "ftruncate");
goto error;