Skip to content

Commit ec80b78

Browse files
devnexendstogov
authored andcommitted
Haiku opcache jit build update
1 parent 56aebbe commit ec80b78

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

ext/opcache/jit/zend_elf.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <sys/stat.h>
2222
#if defined(__FreeBSD__)
2323
#include <sys/sysctl.h>
24+
#elif defined(__HAIKU__)
25+
#include <kernel/image.h>
2426
#endif
2527
#include <fcntl.h>
2628
#include <unistd.h>
@@ -64,6 +66,21 @@ void zend_elf_load_symbols(void)
6466
#elif defined(__sun)
6567
const char *path = getexecname();
6668
int fd = open(path, O_RDONLY);
69+
#elif defined(__HAIKU__)
70+
image_info ii;
71+
int32_t ic = 0;
72+
73+
while (get_next_image_info(0, &ic, &ii) == B_OK) {
74+
if (ii.type == B_APP_IMAGE) {
75+
break;
76+
}
77+
}
78+
79+
if (ii.type != B_APP_IMAGE) {
80+
return;
81+
}
82+
83+
int fd = open(ii.name, O_RDONLY);
6784
#else
6885
// To complete eventually for other ELF platforms.
6986
// Otherwise APPLE is Mach-O

ext/opcache/jit/zend_jit_perf_dump.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#elif defined(__sun)
3636
// avoiding thread.h inclusion as it conflicts with vtunes types.
3737
extern unsigned int thr_self(void);
38+
#elif defined(__HAIKU__)
39+
#include <kernel/image.h>
3840
#endif
3941

4042
#include "zend_elf.h"
@@ -133,6 +135,21 @@ static void zend_jit_perf_jitdump_open(void)
133135
#elif defined(__sun)
134136
const char *path = getexecname();
135137
fd = open(path, O_RDONLY);
138+
#elif defined(__HAIKU__)
139+
image_info ii;
140+
int32_t ic = 0;
141+
142+
while (get_next_image_info(0, &ic, &ii) == B_OK) {
143+
if (ii.type == B_APP_IMAGE) {
144+
break;
145+
}
146+
}
147+
148+
if (ii.type != B_APP_IMAGE) {
149+
return;
150+
}
151+
152+
fd = open(ii.name, O_RDONLY);
136153
#else
137154
fd = -1;
138155
#endif

0 commit comments

Comments
 (0)