1 /**
2  * \file
3  */
4 
5 #ifndef _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
6 #define _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_
7 
8 #include <config.h>
9 #include <glib.h>
10 
11 /*
12  * FOR EXCLUSIVE USE BY w32process-unix.c
13  */
14 
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
26 
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;
36 
37 gchar*
38 mono_w32process_get_name (pid_t pid);
39 
40 GSList*
41 mono_w32process_get_modules (pid_t pid);
42 
43 static void
mono_w32process_module_free(MonoW32ProcessModule * module)44 mono_w32process_module_free (MonoW32ProcessModule *module)
45 {
46 	g_free (module->perms);
47 	g_free (module->filename);
48 	g_free (module);
49 }
50 
51 /*
52  * Used to look through the GSList* returned by mono_w32process_get_modules
53  */
54 static gint
mono_w32process_module_equals(gconstpointer a,gconstpointer b)55 mono_w32process_module_equals (gconstpointer a, gconstpointer b)
56 {
57 	MonoW32ProcessModule *want = (MonoW32ProcessModule *)a;
58 	MonoW32ProcessModule *compare = (MonoW32ProcessModule *)b;
59 	return (want->device == compare->device && want->inode == compare->inode) ? 0 : 1;
60 }
61 
62 #endif /* _MONO_METADATA_W32PROCESS_UNIX_INTERNALS_H_ */
63