MINOR: proc: setting the process to produce a core dump on FreeBSD.

using the procctl api to set the current process as traceable, thus being able to produce a core dump as well.

making it as compile option if not wished or using freebsd prior to 11.x (last no EOL release).

(cherry picked from commit 21185970c199761c81b3b21b13b64dc9dd64838a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/Makefile b/Makefile
index 01356d7..a707a60 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,7 @@
 #   USE_ACCEPT4          : enable use of accept4() on linux. Automatic.
 #   USE_CLOSEFROM        : enable use of closefrom() on *bsd, solaris. Automatic.
 #   USE_PRCTL            : enable use of prctl(). Automatic.
+#   USE_PROCCTL          : enable use of procctl(). Automatic.
 #   USE_ZLIB             : enable zlib library support and disable SLZ
 #   USE_SLZ              : enable slz library instead of zlib (default=enabled)
 #   USE_CPU_AFFINITY     : enable pinning processes to CPU on Linux. Automatic.
@@ -314,8 +315,8 @@
            USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4          \
            USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS     \
            USE_DL USE_RT USE_DEVICEATLAS USE_51DEGREES USE_WURFL USE_SYSTEMD  \
-           USE_OBSOLETE_LINKER USE_PRCTL USE_THREAD_DUMP USE_EVPORTS USE_OT   \
-           USE_QUIC USE_PROMEX USE_MEMORY_PROFILING
+           USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL USE_THREAD_DUMP          \
+           USE_EVPORTS USE_OT USE_QUIC USE_PROMEX USE_MEMORY_PROFILING
 
 #### Target system options
 # Depending on the target platform, some options are set, as well as some
@@ -394,7 +395,7 @@
 ifeq ($(TARGET),freebsd)
   set_target_defaults = $(call default_opts, \
     USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   \
-    USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
+    USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO USE_PROCCTL)
 endif
 
 # DragonFlyBSD 4.3 and above