Lines 1673-1678
static gboolean match_procname_to_modulename (char *procname, char *modulename)
Link Here
|
1673 |
if (procname == NULL || modulename == NULL) |
1673 |
if (procname == NULL || modulename == NULL) |
1674 |
return (FALSE); |
1674 |
return (FALSE); |
1675 |
|
1675 |
|
|
|
1676 |
DEBUG ("%s: procname=\"%s\", modulename=\"%s\"", __func__, procname, modulename); |
1676 |
pname = mono_path_resolve_symlinks (procname); |
1677 |
pname = mono_path_resolve_symlinks (procname); |
1677 |
mname = mono_path_resolve_symlinks (modulename); |
1678 |
mname = mono_path_resolve_symlinks (modulename); |
1678 |
|
1679 |
|
Lines 1701-1706
static gboolean match_procname_to_modulename (char *procname, char *modulename)
Link Here
|
1701 |
g_free (pname); |
1702 |
g_free (pname); |
1702 |
g_free (mname); |
1703 |
g_free (mname); |
1703 |
|
1704 |
|
|
|
1705 |
DEBUG ("%s: result is %d", __func__, result); |
1704 |
return result; |
1706 |
return result; |
1705 |
} |
1707 |
} |
1706 |
|
1708 |
|
Lines 1727-1732
open_process_map (int pid, const char *mode)
Link Here
|
1727 |
} |
1729 |
} |
1728 |
#endif |
1730 |
#endif |
1729 |
|
1731 |
|
|
|
1732 |
static char *get_process_name_from_proc (pid_t pid); |
1733 |
|
1730 |
gboolean EnumProcessModules (gpointer process, gpointer *modules, |
1734 |
gboolean EnumProcessModules (gpointer process, gpointer *modules, |
1731 |
guint32 size, guint32 *needed) |
1735 |
guint32 size, guint32 *needed) |
1732 |
{ |
1736 |
{ |
Lines 1755-1760
gboolean EnumProcessModules (gpointer process, gpointer *modules,
Link Here
|
1755 |
|
1759 |
|
1756 |
if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) { |
1760 |
if (WAPI_IS_PSEUDO_PROCESS_HANDLE (process)) { |
1757 |
pid = WAPI_HANDLE_TO_PID (process); |
1761 |
pid = WAPI_HANDLE_TO_PID (process); |
|
|
1762 |
proc_name = get_process_name_from_proc (pid); |
1758 |
} else { |
1763 |
} else { |
1759 |
process_handle = lookup_process_handle (process); |
1764 |
process_handle = lookup_process_handle (process); |
1760 |
if (!process_handle) { |
1765 |
if (!process_handle) { |
Lines 1879-1885
get_process_name_from_proc (pid_t pid)
Link Here
|
1879 |
|
1884 |
|
1880 |
free(pi); |
1885 |
free(pi); |
1881 |
#endif |
1886 |
#endif |
1882 |
#elif defined(__OpenBSD__) || defined(__FreeBSD__) |
1887 |
#elif defined(__FreeBSD__) |
|
|
1888 |
mib [0] = CTL_KERN; |
1889 |
mib [1] = KERN_PROC; |
1890 |
mib [2] = KERN_PROC_PID; |
1891 |
mib [3] = pid; |
1892 |
if (sysctl(mib, 4, NULL, &size, NULL, 0) < 0) { |
1893 |
DEBUG ("%s: sysctl() failed: %d", __func__, errno); |
1894 |
return(ret); |
1895 |
} |
1896 |
|
1897 |
if ((pi = malloc(size)) == NULL) |
1898 |
return(ret); |
1899 |
|
1900 |
if (sysctl (mib, 4, pi, &size, NULL, 0) < 0) { |
1901 |
if (errno == ENOMEM) { |
1902 |
free(pi); |
1903 |
DEBUG ("%s: Didn't allocate enough memory for kproc info", __func__); |
1904 |
} |
1905 |
return(ret); |
1906 |
} |
1907 |
|
1908 |
if (strlen (pi->ki_comm) > 0) |
1909 |
ret = g_strdup (pi->ki_comm); |
1910 |
free(pi); |
1911 |
#elif defined(__OpenBSD__) |
1883 |
mib [0] = CTL_KERN; |
1912 |
mib [0] = CTL_KERN; |
1884 |
mib [1] = KERN_PROC; |
1913 |
mib [1] = KERN_PROC; |
1885 |
mib [2] = KERN_PROC_PID; |
1914 |
mib [2] = KERN_PROC_PID; |
Lines 1888-1895
get_process_name_from_proc (pid_t pid)
Link Here
|
1888 |
mib [5] = 0; |
1917 |
mib [5] = 0; |
1889 |
|
1918 |
|
1890 |
retry: |
1919 |
retry: |
1891 |
if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0) |
1920 |
if (sysctl(mib, 6, NULL, &size, NULL, 0) < 0) { |
|
|
1921 |
DEBUG ("%s: sysctl() failed: %d", __func__, errno); |
1892 |
return(ret); |
1922 |
return(ret); |
|
|
1923 |
} |
1893 |
|
1924 |
|
1894 |
if ((pi = malloc(size)) == NULL) |
1925 |
if ((pi = malloc(size)) == NULL) |
1895 |
return(ret); |
1926 |
return(ret); |