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
This commit is contained in:
Peter Kokot 2024-08-22 20:26:44 +02:00 committed by GitHub
parent 0c73553959
commit f952263bcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 5 deletions

View File

@ -133,7 +133,10 @@ dnl
AC_DEFUN([ZEND_INIT], [dnl
AC_REQUIRE([AC_PROG_CC])
AC_CHECK_HEADERS([cpuid.h])
AC_CHECK_HEADERS(m4_normalize([
cpuid.h
libproc.h
]))
dnl Check for library functions.
AC_CHECK_FUNCS(m4_normalize([

View File

@ -64,10 +64,12 @@ typedef int boolean_t;
#include <sys/syscall.h>
#endif
#ifdef __sun
#define _STRUCTURED_PROC 1
#include <sys/lwp.h>
#include <sys/procfs.h>
#include <libproc.h>
# include <sys/lwp.h>
# ifdef HAVE_LIBPROC_H
# define _STRUCTURED_PROC 1
# include <sys/procfs.h>
# include <libproc.h>
# endif
#include <thread.h>
#endif
@ -699,6 +701,7 @@ static bool zend_call_stack_get_solaris_pthread(zend_call_stack *stack)
return true;
}
#ifdef HAVE_LIBPROC_H
static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack)
{
char buffer[4096];
@ -771,12 +774,15 @@ end:
close(fd);
return r;
}
#endif
static bool zend_call_stack_get_solaris(zend_call_stack *stack)
{
#ifdef HAVE_LIBPROC_H
if (_lwp_self() == 1) {
return zend_call_stack_get_solaris_proc_maps(stack);
}
#endif
return zend_call_stack_get_solaris_pthread(stack);
}
#else