You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

  1. --- a/lib/mm/memlock.c
  2. +++ b/lib/mm/memlock.c
  3. @@ -187,12 +187,15 @@ static void _allocate_memory(void)
  4. * memory on free(), this is good enough for our purposes.
  5. */
  6. while (missing > 0) {
  7. +#ifdef __GLIBC__
  8. struct mallinfo inf = mallinfo();
  9. hblks = inf.hblks;
  10. +#endif
  11. if ((areas[area] = malloc(_size_malloc_tmp)))
  12. _touch_memory(areas[area], _size_malloc_tmp);
  13. +#ifdef __GLIBC__
  14. inf = mallinfo();
  15. if (hblks < inf.hblks) {
  16. @@ -202,9 +205,12 @@ static void _allocate_memory(void)
  17. free(areas[area]);
  18. _size_malloc_tmp /= 2;
  19. } else {
  20. +#endif
  21. ++ area;
  22. missing -= _size_malloc_tmp;
  23. +#ifdef __GLIBC__
  24. }
  25. +#endif
  26. if (area == max_areas && missing > 0) {
  27. /* Too bad. Warn the user and proceed, as things are
  28. @@ -525,8 +531,13 @@ static void _lock_mem(struct cmd_context
  29. * will not block memory locked thread
  30. * Note: assuming _memlock_count_daemon is updated before _memlock_count
  31. */
  32. +#ifdef __GLIBC__
  33. _use_mlockall = _memlock_count_daemon ? 1 :
  34. find_config_tree_bool(cmd, activation_use_mlockall_CFG, NULL);
  35. +#else
  36. + /* always use mlockall on musl */
  37. + _use_mlockall = 1;
  38. +#endif
  39. if (!_use_mlockall) {
  40. if (!*_procselfmaps &&