Browse Source

[core] server.core-files support on FreeBSD (fixes #3128)

(thx devnexen)

x-ref:
  "server.core-files support on FreeBSD proposal"
  https://redmine.lighttpd.net/issues/3128
master
Glenn Strauss 5 months ago
parent
commit
f36908de33
  1. 1
      SConstruct
  2. 1
      configure.ac
  3. 1
      src/CMakeLists.txt
  4. 1
      src/config.h.cmake
  5. 1
      src/meson.build
  6. 9
      src/server.c

1
SConstruct

@ -388,6 +388,7 @@ if 1:
'sys/loadavg.h',
'sys/poll.h',
'sys/prctl.h',
'sys/procctl.h',
'sys/sendfile.h',
'sys/time.h',
'sys/wait.h',

1
configure.ac

@ -113,6 +113,7 @@ AC_CHECK_HEADERS([\
sys/mman.h \
sys/poll.h \
sys/prctl.h \
sys/procctl.h \
sys/resource.h \
sys/select.h \
sys/sendfile.h \

1
src/CMakeLists.txt

@ -98,6 +98,7 @@ check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H)
check_include_files(sys/poll.h HAVE_SYS_POLL_H)
check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_files(sys/procctl.h HAVE_SYS_PROCCTL_H)
check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)

1
src/config.h.cmake

@ -22,6 +22,7 @@
#cmakedefine HAVE_SYS_MMAN_H
#cmakedefine HAVE_SYS_POLL_H
#cmakedefine HAVE_SYS_PRCTL_H
#cmakedefine HAVE_SYS_PROCCTL_H
#cmakedefine HAVE_SYS_RESOURCE_H
#cmakedefine HAVE_SYS_SENDFILE_H
#cmakedefine HAVE_SYS_SELECT_H

1
src/meson.build

@ -36,6 +36,7 @@ conf_data.set('HAVE_SYS_LOADAVG_H', compiler.has_header('sys/loadavg.h'))
conf_data.set('HAVE_SYS_MMAN_H', compiler.has_header('sys/mman.h'))
conf_data.set('HAVE_SYS_POLL_H', compiler.has_header('sys/poll.h'))
conf_data.set('HAVE_SYS_PRCTL_H', compiler.has_header('sys/prctl.h'))
conf_data.set('HAVE_SYS_PROCCTL_H', compiler.has_header('sys/procctl.h'))
conf_data.set('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h'))
conf_data.set('HAVE_SYS_SENDFILE_H', compiler.has_header('sys/sendfile.h'))
conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h'))

9
src/server.c

@ -65,6 +65,9 @@ static const buffer default_server_tag = { CONST_STR_LEN(PACKAGE_DESC)+1, 0 };
#ifdef HAVE_SYS_PRCTL_H
# include <sys/prctl.h>
#endif
#ifdef HAVE_SYS_PROCCTL_H
# include <sys/procctl.h>
#endif
#ifdef HAVE_MALLOC_H
#ifndef LIGHTTPD_STATIC
@ -1475,6 +1478,12 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
if (srv->srvconf.enable_cores) {
prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
}
#elif defined(HAVE_SYS_PROCCTL_H) && defined(PROC_TRACE_CTL_ENABLE)
/* (DragonFlyBSD has procctl(), but not PROC_TRACE_CTL_ENABLE) */
if (srv->srvconf.enable_cores) {
int dumpable = PROC_TRACE_CTL_ENABLE;
procctl(P_PID, 0, PROC_TRACE_CTL, &dumpable);
}
#endif
}

Loading…
Cancel
Save