Skip to content

Commit f952263

Browse files
authored
Fix Solaris 10 build: missing libproc.h (#15525)
The libproc.h header file was added on Solaris as of 11.4. * Also add guard check to the entire function * When libproc.h isn't available also sys/procfs.h is redundant * Move the <sys/lwp.h> out of the guard * Exclude more stuff from Solaris 10
1 parent 0c73553 commit f952263

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Zend/Zend.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ dnl
133133
AC_DEFUN([ZEND_INIT], [dnl
134134
AC_REQUIRE([AC_PROG_CC])
135135
136-
AC_CHECK_HEADERS([cpuid.h])
136+
AC_CHECK_HEADERS(m4_normalize([
137+
cpuid.h
138+
libproc.h
139+
]))
137140
138141
dnl Check for library functions.
139142
AC_CHECK_FUNCS(m4_normalize([

Zend/zend_call_stack.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ typedef int boolean_t;
6464
#include <sys/syscall.h>
6565
#endif
6666
#ifdef __sun
67-
#define _STRUCTURED_PROC 1
68-
#include <sys/lwp.h>
69-
#include <sys/procfs.h>
70-
#include <libproc.h>
67+
# include <sys/lwp.h>
68+
# ifdef HAVE_LIBPROC_H
69+
# define _STRUCTURED_PROC 1
70+
# include <sys/procfs.h>
71+
# include <libproc.h>
72+
# endif
7173
#include <thread.h>
7274
#endif
7375

@@ -699,6 +701,7 @@ static bool zend_call_stack_get_solaris_pthread(zend_call_stack *stack)
699701
return true;
700702
}
701703

704+
#ifdef HAVE_LIBPROC_H
702705
static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack)
703706
{
704707
char buffer[4096];
@@ -771,12 +774,15 @@ static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack)
771774
close(fd);
772775
return r;
773776
}
777+
#endif
774778

775779
static bool zend_call_stack_get_solaris(zend_call_stack *stack)
776780
{
781+
#ifdef HAVE_LIBPROC_H
777782
if (_lwp_self() == 1) {
778783
return zend_call_stack_get_solaris_proc_maps(stack);
779784
}
785+
#endif
780786
return zend_call_stack_get_solaris_pthread(stack);
781787
}
782788
#else

0 commit comments

Comments
 (0)