123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- $OpenBSD: patch-mono_utils_mono-proclib_c,v 1.18 2016/10/31 11:45:07 robert Exp $
- --- mono/utils/mono-proclib.c.orig Mon Oct 31 11:33:31 2016
- +++ mono/utils/mono-proclib.c Mon Oct 31 11:34:11 2016
- @@ -73,30 +73,30 @@ mono_process_list (int *size)
- {
- #if USE_SYSCTL
- int res, i;
- -#ifdef KERN_PROC2
- +#ifdef KERN_PROC
- int mib [6];
- - size_t data_len = sizeof (struct kinfo_proc2) * 400;
- - struct kinfo_proc2 *processes = malloc (data_len);
- + size_t data_len = sizeof (struct kinfo_proc) * 400;
- + struct kinfo_proc *processes = malloc (data_len);
- #else
- int mib [4];
- size_t data_len = sizeof (struct kinfo_proc) * 16;
- struct kinfo_proc *processes;
- int limit = 8;
- -#endif /* KERN_PROC2 */
- +#endif /* KERN_PROC */
- void **buf = NULL;
-
- if (size)
- *size = 0;
-
- -#ifdef KERN_PROC2
- +#ifdef KERN_PROC
- if (!processes)
- return NULL;
-
- mib [0] = CTL_KERN;
- - mib [1] = KERN_PROC2;
- + mib [1] = KERN_PROC;
- mib [2] = KERN_PROC_ALL;
- mib [3] = 0;
- - mib [4] = sizeof(struct kinfo_proc2);
- + mib [4] = sizeof(struct kinfo_proc);
- mib [5] = 400; /* XXX */
-
- res = sysctl (mib, 6, processes, &data_len, NULL, 0);
- @@ -126,13 +126,13 @@ mono_process_list (int *size)
- break;
- }
- }
- -#endif /* KERN_PROC2 */
- +#endif /* KERN_PROC */
-
- -#ifdef KERN_PROC2
- - res = data_len/sizeof (struct kinfo_proc2);
- +#ifdef KERN_PROC
- + res = data_len/sizeof (struct kinfo_proc);
- #else
- res = data_len/sizeof (struct kinfo_proc);
- -#endif /* KERN_PROC2 */
- +#endif /* KERN_PROC */
- buf = (void **) g_realloc (buf, res * sizeof (void*));
- for (i = 0; i < res; ++i)
- buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
- @@ -218,8 +218,8 @@ get_pid_status_item_buf (int pid, const char *item, ch
-
- #if USE_SYSCTL
-
- -#ifdef KERN_PROC2
- -#define KINFO_PROC struct kinfo_proc2
- +#ifdef KERN_PROC
- +#define KINFO_PROC struct kinfo_proc
- #else
- #define KINFO_PROC struct kinfo_proc
- #endif
- @@ -230,10 +230,10 @@ sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
- int res;
- size_t data_len = sizeof (KINFO_PROC);
-
- -#ifdef KERN_PROC2
- +#ifdef KERN_PROC
- int mib [6];
- mib [0] = CTL_KERN;
- - mib [1] = KERN_PROC2;
- + mib [1] = KERN_PROC;
- mib [2] = KERN_PROC_PID;
- mib [3] = GPOINTER_TO_UINT (pid);
- mib [4] = sizeof(KINFO_PROC);
- @@ -248,7 +248,7 @@ sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
- mib [3] = GPOINTER_TO_UINT (pid);
-
- res = sysctl (mib, 4, processi, &data_len, NULL, 0);
- -#endif /* KERN_PROC2 */
- +#endif /* KERN_PROC */
-
- if (res < 0 || data_len != sizeof (KINFO_PROC))
- return FALSE;
|