Skip to content

Commit

Permalink
ljsyscall: Add migrate_pages.
Browse files Browse the repository at this point in the history
* lib/ljsyscall/syscall/linux/c.lua:
* lib/ljsyscall/syscall/linux/syscalls.lua: Add support for the
  migrate_pages Linux syscall.
  • Loading branch information
wingo committed Oct 17, 2016
1 parent 9a0abb2 commit c2f2d3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ljsyscall/syscall/linux/c.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ function C.set_mempolicy(mode, mask, maxnode)
return syscall(sys.set_mempolicy, int(mode), void(mask), ulong(maxnode))
end

function C.migrate_pages(pid, maxnode, from, to)
return syscall(sys.migrate_pages, int(pid), ulong(maxnode), void(from), void(to))
end

-- in librt for glibc but use syscalls instead of loading another library
function C.clock_nanosleep(clk_id, flags, req, rem)
return syscall(sys.clock_nanosleep, int(clk_id), int(flags), void(req), void(rem))
Expand Down
7 changes: 7 additions & 0 deletions lib/ljsyscall/syscall/linux/syscalls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,13 @@ function S.set_mempolicy(mode, mask)
return retbool(C.set_mempolicy(c.MPOL_MODE[mode], mask.mask, mask.size))
end

function S.migrate_pages(pid, from, to)
from = mktype(t.bitmask, from)
to = mktype(t.bitmask, to)
assert(from.size == to.size, "incompatible nodemask sizes")
return retbool(C.migrate_pages(pid or 0, from.size, from.mask, to.mask))
end

function S.sched_get_priority_max(policy) return retnum(C.sched_get_priority_max(c.SCHED[policy])) end
function S.sched_get_priority_min(policy) return retnum(C.sched_get_priority_min(c.SCHED[policy])) end

Expand Down

0 comments on commit c2f2d3d

Please sign in to comment.