Skip to content

Commit 727ae51

Browse files
devnexennikic
authored andcommitted
Fix JIT build on solaris/illumos
thr_self to detect the proper thread identifier but all related typedef'd types conflict with the vtune part.
1 parent 8b822af commit 727ae51

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ext/opcache/jit/zend_elf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ void zend_elf_load_symbols(void)
6161
return;
6262
}
6363
int fd = open(path, O_RDONLY);
64+
#elif defined(__sun)
65+
const char *path = getexecname();
66+
int fd = open(path, O_RDONLY);
6467
#else
6568
// To complete eventually for other ELF platforms.
6669
// Otherwise APPLE is Mach-O

ext/opcache/jit/zend_jit_perf_dump.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
# include <sys/sysctl.h>
3232
#elif defined(__NetBSD__)
3333
# include <lwp.h>
34+
#elif defined(__sun)
35+
// avoiding thread.h inclusion as it conflicts with vtunes types.
36+
extern unsigned int thr_self(void);
3437
#endif
3538

3639
#include "zend_elf.h"
@@ -126,6 +129,9 @@ static void zend_jit_perf_jitdump_open(void)
126129
return;
127130
}
128131
fd = open(path, O_RDONLY);
132+
#elif defined(__sun)
133+
const char *path = getexecname();
134+
fd = open(path, O_RDONLY);
129135
#else
130136
fd = -1;
131137
#endif
@@ -209,6 +215,8 @@ static void zend_jit_perf_jitdump_register(const char *name, void *start, size_t
209215
thread_id = getthrid();
210216
#elif defined(__NetBSD__)
211217
thread_id = _lwp_self();
218+
#elif defined(__sun)
219+
thread_id = thr_self();
212220
#endif
213221

214222
memset(&rec, 0, sizeof(rec));

0 commit comments

Comments
 (0)