Permalink
Browse files

ljsyscall: Add migrate_pages.

* lib/ljsyscall/syscall/linux/c.lua:
* lib/ljsyscall/syscall/linux/syscalls.lua: Add support for the
  migrate_pages Linux syscall.
  • Loading branch information...
1 parent 9a0abb2 commit c2f2d3d9cdfcbcc6fbbf105c9bc513ddbfa606bf @wingo wingo committed Jun 2, 2016
Showing with 11 additions and 0 deletions.
  1. +4 −0 lib/ljsyscall/syscall/linux/c.lua
  2. +7 −0 lib/ljsyscall/syscall/linux/syscalls.lua
@@ -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))
@@ -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

0 comments on commit c2f2d3d

Please sign in to comment.