[metadata] Fix leaks when handling a few attributes (#16675)
[mono-project.git] / mono / metadata / w32process-unix-internals.h
blob7ba5f7e002e1378d41b5fd02ca70bc1969525484
1 /**
2 * \file
3 */
5 #ifndef _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
6 #define _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
8 #include <config.h>
9 #include <glib.h>
12 * FOR EXCLUSIVE USE BY w32process-unix.c
15 #if defined(HOST_DARWIN)
16 #define USE_OSX_BACKEND
17 #elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(HAVE_LINK_H)
18 #define USE_BSD_BACKEND
19 #elif defined(__HAIKU__)
20 #define USE_HAIKU_BACKEND
21 /* Define header for team_info */
22 #include <os/kernel/OS.h>
23 #else
24 #define USE_DEFAULT_BACKEND
25 #endif
27 typedef struct {
28 gpointer address_start;
29 gpointer address_end;
30 gchar *perms;
31 gpointer address_offset;
32 guint64 device;
33 guint64 inode;
34 gchar *filename;
35 } MonoW32ProcessModule;
37 gchar*
38 mono_w32process_get_name (pid_t pid);
40 GSList*
41 mono_w32process_get_modules (pid_t pid);
43 static void G_GNUC_UNUSED
44 mono_w32process_module_free (MonoW32ProcessModule *module)
46 g_free (module->perms);
47 g_free (module->filename);
48 g_free (module);
52 * Used to look through the GSList* returned by mono_w32process_get_modules
54 static gint G_GNUC_UNUSED
55 mono_w32process_module_equals (gconstpointer a, gconstpointer b)
57 MonoW32ProcessModule *want = (MonoW32ProcessModule *)a;
58 MonoW32ProcessModule *compare = (MonoW32ProcessModule *)b;
59 return (want->device == compare->device && want->inode == compare->inode) ? 0 : 1;
62 #endif /* _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_ */