Added
Link Here
|
1 |
--- pkg/proc/native/proc_freebsd.c.orig 2021-05-19 07:24:05 UTC |
2 |
+++ pkg/proc/native/proc_freebsd.c |
3 |
@@ -3,11 +3,13 @@ |
4 |
#include <sys/queue.h> |
5 |
#include <sys/sysctl.h> |
6 |
#include <sys/user.h> |
7 |
+#include <sys/types.h> |
8 |
|
9 |
#include <libprocstat.h> |
10 |
#include <libutil.h> |
11 |
#include <stdlib.h> |
12 |
#include <string.h> |
13 |
+#include <errno.h> |
14 |
|
15 |
#include "proc_freebsd.h" |
16 |
|
17 |
@@ -66,21 +68,23 @@ int find_status(int pid){ |
18 |
return (status); |
19 |
} |
20 |
|
21 |
-int get_entry_point(int pid) { |
22 |
+uintptr_t get_entry_point(int pid) { |
23 |
void *ep = NULL; |
24 |
|
25 |
+ errno = EINVAL; |
26 |
+ |
27 |
struct procstat *ps = procstat_open_sysctl(); |
28 |
if (ps == NULL) |
29 |
- return -1; |
30 |
+ return 0; |
31 |
|
32 |
uint cnt = 0; |
33 |
struct kinfo_proc *kipp = procstat_getprocs(ps, KERN_PROC_PID, pid, &cnt); |
34 |
if (cnt == 0) |
35 |
- return -1; |
36 |
+ return 0; |
37 |
|
38 |
Elf_Auxinfo *auxv = procstat_getauxv(ps, kipp, &cnt); |
39 |
if (auxv == NULL) |
40 |
- return -1; |
41 |
+ return 0; |
42 |
|
43 |
for (int i = 0; i < cnt; i++) { |
44 |
if (auxv[i].a_type == AT_ENTRY) { |
45 |
@@ -89,5 +93,6 @@ int get_entry_point(int pid) { |
46 |
} |
47 |
} |
48 |
procstat_freeauxv(ps, auxv); |
49 |
- return (int)ep; |
50 |
+ errno = 0; |
51 |
+ return (uintptr_t)ep; |
52 |
} |