Skip to content

Commit

Permalink
linux: warn if we ever fail to find membinding syscall numbers
Browse files Browse the repository at this point in the history
This is unlikely since we should get them from asm/unistd.h through
sys/syscall.h and we have a hardwired fallback for the most common
architectures.

If this actually ever happens, we should disable the corresponding
membind hooks so that support doesn't say we support them.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Apr 16, 2018
1 parent f24d14f commit a9182ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hwloc/topology-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ static __hwloc_inline long hwloc_mbind(void *addr __hwloc_attribute_unused,
#if (defined __NR_mbind) && (defined HWLOC_HAVE_SYSCALL)
return syscall(__NR_mbind, (long) addr, len, mode, (long)nodemask, maxnode, flags);
#else
#warning Couldn't find __NR_mbind syscall number, memory binding won't be supported
errno = ENOSYS;
return -1;
#endif
Expand All @@ -216,6 +217,7 @@ static __hwloc_inline long hwloc_set_mempolicy(int mode __hwloc_attribute_unused
#if (defined __NR_set_mempolicy) && (defined HWLOC_HAVE_SYSCALL)
return syscall(__NR_set_mempolicy, mode, nodemask, maxnode);
#else
#warning Couldn't find __NR_set_mempolicy syscall number, memory binding won't be supported
errno = ENOSYS;
return -1;
#endif
Expand Down Expand Up @@ -243,6 +245,7 @@ static __hwloc_inline long hwloc_get_mempolicy(int *mode __hwloc_attribute_unuse
#if (defined __NR_get_mempolicy) && (defined HWLOC_HAVE_SYSCALL)
return syscall(__NR_get_mempolicy, mode, nodemask, maxnode, addr, flags);
#else
#warning Couldn't find __NR_get_mempolicy syscall number, memory binding won't be supported
errno = ENOSYS;
return -1;
#endif
Expand All @@ -269,6 +272,7 @@ static __hwloc_inline long hwloc_migrate_pages(int pid __hwloc_attribute_unused,
#if (defined __NR_migrate_pages) && (defined HWLOC_HAVE_SYSCALL)
return syscall(__NR_migrate_pages, pid, maxnode, oldnodes, newnodes);
#else
#warning Couldn't find __NR_migrate_pages syscall number, memory migration won't be supported
errno = ENOSYS;
return -1;
#endif
Expand Down Expand Up @@ -297,6 +301,7 @@ static __hwloc_inline long hwloc_move_pages(int pid __hwloc_attribute_unused,
#if (defined __NR_move_pages) && (defined HWLOC_HAVE_SYSCALL)
return syscall(__NR_move_pages, pid, count, pages, nodes, status, flags);
#else
#warning Couldn't find __NR_move_pages syscall number, getting memory location won't be supported
errno = ENOSYS;
return -1;
#endif
Expand Down

0 comments on commit a9182ed

Please sign in to comment.