64 bit types with varargs on ARM

  • From: Justin Cormack <justin@xxxxxxxxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 12 Aug 2012 20:25:40 +0100

The following program works fine on x86 and x64 but on ARM strace
shows issues with the last value:


local ffi = require "ffi"

ffi.cdef [[
int syscall(int number, ...);
]]

local int = ffi.typeof("int")
local uint = ffi.typeof("unsigned int")
local loff = ffi.typeof("uint64_t")

local fa = {
  arm = 352,
  x86 = 324,
  x64 = 285,
}

local function fallocate(fd, mode, offset, len)
  return ffi.C.syscall(fa[ffi.arch], int(fd), uint(0), loff(offset), loff(len))
end

fallocate(0, 0, 0, 4096)

strace on ARM - last argument huge,

fallocate(0, 0, 0, 17592186044416)      = -1 ENODEV (No such device)

strace on x86 - as expected

fallocate(0, 0, 0, 4096)                = -1 ENODEV (No such device)

Other related posts: