numaapi_stub.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Copyright (c) 2016, libnumaapi authors
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to
  5. // deal in the Software without restriction, including without limitation the
  6. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  7. // sell copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  19. // IN THE SOFTWARE.
  20. //
  21. // Author: Sergey Sharybin (sergey.vfx@gmail.com)
  22. #include "numaapi.h"
  23. #include "build_config.h"
  24. // Stub implementation for platforms which doesn't have NUMA support.
  25. #if !OS_LINUX && !OS_WIN
  26. ////////////////////////////////////////////////////////////////////////////////
  27. // Initialization.
  28. NUMAAPI_Result numaAPI_Initialize(void) {
  29. return NUMAAPI_NOT_AVAILABLE;
  30. }
  31. ////////////////////////////////////////////////////////////////////////////////
  32. // Topology query.
  33. int numaAPI_GetNumNodes(void) {
  34. return 0;
  35. }
  36. bool numaAPI_IsNodeAvailable(int node) {
  37. (void) node; // Ignored.
  38. return false;
  39. }
  40. int numaAPI_GetNumNodeProcessors(int node) {
  41. (void) node; // Ignored.
  42. return 0;
  43. }
  44. ////////////////////////////////////////////////////////////////////////////////
  45. // Topology helpers.
  46. int numaAPI_GetNumCurrentNodesProcessors(void) {
  47. return 0;
  48. }
  49. ////////////////////////////////////////////////////////////////////////////////
  50. // Affinities.
  51. bool numaAPI_RunProcessOnNode(int node) {
  52. (void) node; // Ignored.
  53. return false;
  54. }
  55. bool numaAPI_RunThreadOnNode(int node) {
  56. (void) node; // Ignored.
  57. return false;
  58. }
  59. ////////////////////////////////////////////////////////////////////////////////
  60. // Memory management.
  61. void* numaAPI_AllocateOnNode(size_t size, int node) {
  62. (void) size; // Ignored.
  63. (void) node; // Ignored.
  64. return 0;
  65. }
  66. void* numaAPI_AllocateLocal(size_t size) {
  67. (void) size; // Ignored.
  68. return NULL;
  69. }
  70. void numaAPI_Free(void* start, size_t size) {
  71. (void) start; // Ignored.
  72. (void) size; // Ignored.
  73. }
  74. #endif // !OS_LINUX && !OS_WIN