patch-mono_utils_mono-proclib_c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. $OpenBSD: patch-mono_utils_mono-proclib_c,v 1.18 2016/10/31 11:45:07 robert Exp $
  2. --- mono/utils/mono-proclib.c.orig Mon Oct 31 11:33:31 2016
  3. +++ mono/utils/mono-proclib.c Mon Oct 31 11:34:11 2016
  4. @@ -73,30 +73,30 @@ mono_process_list (int *size)
  5. {
  6. #if USE_SYSCTL
  7. int res, i;
  8. -#ifdef KERN_PROC2
  9. +#ifdef KERN_PROC
  10. int mib [6];
  11. - size_t data_len = sizeof (struct kinfo_proc2) * 400;
  12. - struct kinfo_proc2 *processes = malloc (data_len);
  13. + size_t data_len = sizeof (struct kinfo_proc) * 400;
  14. + struct kinfo_proc *processes = malloc (data_len);
  15. #else
  16. int mib [4];
  17. size_t data_len = sizeof (struct kinfo_proc) * 16;
  18. struct kinfo_proc *processes;
  19. int limit = 8;
  20. -#endif /* KERN_PROC2 */
  21. +#endif /* KERN_PROC */
  22. void **buf = NULL;
  23. if (size)
  24. *size = 0;
  25. -#ifdef KERN_PROC2
  26. +#ifdef KERN_PROC
  27. if (!processes)
  28. return NULL;
  29. mib [0] = CTL_KERN;
  30. - mib [1] = KERN_PROC2;
  31. + mib [1] = KERN_PROC;
  32. mib [2] = KERN_PROC_ALL;
  33. mib [3] = 0;
  34. - mib [4] = sizeof(struct kinfo_proc2);
  35. + mib [4] = sizeof(struct kinfo_proc);
  36. mib [5] = 400; /* XXX */
  37. res = sysctl (mib, 6, processes, &data_len, NULL, 0);
  38. @@ -126,13 +126,13 @@ mono_process_list (int *size)
  39. break;
  40. }
  41. }
  42. -#endif /* KERN_PROC2 */
  43. +#endif /* KERN_PROC */
  44. -#ifdef KERN_PROC2
  45. - res = data_len/sizeof (struct kinfo_proc2);
  46. +#ifdef KERN_PROC
  47. + res = data_len/sizeof (struct kinfo_proc);
  48. #else
  49. res = data_len/sizeof (struct kinfo_proc);
  50. -#endif /* KERN_PROC2 */
  51. +#endif /* KERN_PROC */
  52. buf = (void **) g_realloc (buf, res * sizeof (void*));
  53. for (i = 0; i < res; ++i)
  54. buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
  55. @@ -218,8 +218,8 @@ get_pid_status_item_buf (int pid, const char *item, ch
  56. #if USE_SYSCTL
  57. -#ifdef KERN_PROC2
  58. -#define KINFO_PROC struct kinfo_proc2
  59. +#ifdef KERN_PROC
  60. +#define KINFO_PROC struct kinfo_proc
  61. #else
  62. #define KINFO_PROC struct kinfo_proc
  63. #endif
  64. @@ -230,10 +230,10 @@ sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
  65. int res;
  66. size_t data_len = sizeof (KINFO_PROC);
  67. -#ifdef KERN_PROC2
  68. +#ifdef KERN_PROC
  69. int mib [6];
  70. mib [0] = CTL_KERN;
  71. - mib [1] = KERN_PROC2;
  72. + mib [1] = KERN_PROC;
  73. mib [2] = KERN_PROC_PID;
  74. mib [3] = GPOINTER_TO_UINT (pid);
  75. mib [4] = sizeof(KINFO_PROC);
  76. @@ -248,7 +248,7 @@ sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
  77. mib [3] = GPOINTER_TO_UINT (pid);
  78. res = sysctl (mib, 4, processi, &data_len, NULL, 0);
  79. -#endif /* KERN_PROC2 */
  80. +#endif /* KERN_PROC */
  81. if (res < 0 || data_len != sizeof (KINFO_PROC))
  82. return FALSE;