Re: [PATCH]: DragonFlyBSD little build update

2020-12-02 Thread Brad Smith

On 12/2/2020 2:27 PM, Willy Tarreau wrote:

Hi David,

On Wed, Dec 02, 2020 at 10:50:52AM +, David CARLIER wrote:

Hi, heere a little build update for DragonFlyBSD proposal.

I'm having a concern here, which is that by relying on pthread_setaffinity_np
it will add an implicit dependency on pthread, which is not necessary till
now (we'll support nbproc till 2.4 included).

I thought DragonFlyBSD was a derivative of FreeBSD, if so it should have
cpuset_setaffinity(). Maybe it requires an include we're missing, have
you checked this just in case ? Otherwise I'm afraid we'll have to make a
special case for it to condition the feature to pthread on this platform.

Thanks!
Willy


DragonFly forked from FreeBSD 4.8 16 years ago. They do heavily borrow bits
from FreeBSD, but that does not mean that everything is exactly the same 
with

regard to userland and kernel API.

It does not appear as if DragonFly has cpuset_setaffinity(). 
sched_setaffinity()

appears to be the DragonFly equivalent.


https://www.freebsd.org/cgi/man.cgi?query=cpuset_setaffinity

https://man.dragonflybsd.org/?command=sched_setaffinity




Warning during Haiku build

2020-10-12 Thread Brad Smith

Just FYI the only warning during the build on Haiku is the following...

cc -Iinclude -O2 -g -Wall -Wextra -Wdeclaration-after-statement -fwrapv 
-Wno-unused-label -Wno-sign-compare
-Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers 
-Wno-cast-function-type -Wtype-limits
-Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond 
-Wnull-dereference -DUSE_POLL -DUSE_TPROXY
-DCONFIG_HAPROXY_VERSION=\"2.3-dev6-6b736b-1\" 
-DCONFIG_HAPROXY_DATE=\"2020/10/11\" -c -o src/xxhash.o src/xxhash.c

src/xxhash.c:118: warning: "_PACKED" redefined
 #  define _PACKED

In file included from /boot/system/develop/headers/posix/sys/types.h:11,
 from /boot/system/develop/headers/posix/alloca.h:9,
 from /boot/system/develop/headers/posix/stdlib.h:9,
 from /boot/system/develop/headers/bsd/stdlib.h:9, from
 src/xxhash.c:86:
/boot/system/develop/headers/os/BeBuild.h:80: note: this is the location 
of the previous definition

 #define _PACKED __attribute__((packed))




Haiku and Cygwin targets

2020-10-10 Thread Brad Smith

Haiku has getaddrinfo().

Cygwin also appears to have getaddrinfo(). Also the target can be 
simplified a bit

as 2009 was quite some time ago and IPv6 is the norm now.




[PATCH] BUILD: makefile: Enable getaddrinfo() on OS/X

2020-10-09 Thread Brad Smith
Enable getaddrinfo() on OS/X.


diff --git a/Makefile b/Makefile
index db9bbe7e9..2fb05c719 100644
--- a/Makefile
+++ b/Makefile
@@ -382,7 +382,8 @@ endif
 # Mac OS/X
 ifeq ($(TARGET),osx)
   set_target_defaults = $(call default_opts, \
-USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE)
+USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   \
+USE_GETADDRINFO)
   EXPORT_SYMBOL  = -export_dynamic
 endif
 



[PATCH] BUILD: makefile: Update feature flags for NetBSD

2020-10-08 Thread Brad Smith
This updates the feature flags for NetBSD.

NetBSD 8 adds support for accept4().

Enable getaddrinfo().


diff --git a/INSTALL b/INSTALL
index 0263cf34c..2ae98bf6b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -377,7 +377,7 @@ and assign it to the TARGET variable :
   - solaris for Solaris 10 and above
   - freebsd for FreeBSD 10 and above
   - dragonfly   for DragonFlyBSD 4.3 and above
-  - netbsd  for NetBSD
+  - netbsd  for NetBSD 8 and above
   - osx for Mac OS/X
   - openbsd for OpenBSD 6.3 and above
   - aix51   for AIX 5.1
diff --git a/Makefile b/Makefile
index 4aabe34dc..1c64593d0 100644
--- a/Makefile
+++ b/Makefile
@@ -393,10 +393,11 @@ ifeq ($(TARGET),openbsd)
 USE_GETADDRINFO)
 endif
 
-# NetBSD
+# NetBSD 8 and above
 ifeq ($(TARGET),netbsd)
   set_target_defaults = $(call default_opts, \
-USE_POLL USE_TPROXY USE_KQUEUE)
+USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4 USE_CLOSEFROM   \
+USE_GETADDRINFO)
 endif
 
 # AIX 5.1 only



[PATCH] BUILD: Add a DragonFlyBSD target

2020-10-07 Thread Brad Smith
Add a target for DragonFlyBSD 4.3 and above.


diff --git a/INSTALL b/INSTALL
index f562a7102..0263cf34c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -376,6 +376,7 @@ and assign it to the TARGET variable :
   - linux-musl  for Linux kernel 2.6.28 and above with musl libc
   - solaris for Solaris 10 and above
   - freebsd for FreeBSD 10 and above
+  - dragonfly   for DragonFlyBSD 4.3 and above
   - netbsd  for NetBSD
   - osx for Mac OS/X
   - openbsd for OpenBSD 6.3 and above
diff --git a/Makefile b/Makefile
index 7958b89d6..4aabe34dc 100644
--- a/Makefile
+++ b/Makefile
@@ -142,8 +142,9 @@ DOCDIR = $(PREFIX)/doc/haproxy
  TARGET system
 # Use TARGET= to optimize for a specific target OS among the
 # following list (use the default "generic" if uncertain) :
-#linux-glibc, linux-glibc-legacy, linux-musl, solaris, freebsd, openbsd,
-#netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic, custom
+#linux-glibc, linux-glibc-legacy, linux-musl, solaris, freebsd, dragonfly,
+#openbsd, netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic,
+#custom
 TARGET =
 
  TARGET CPU
@@ -371,6 +372,13 @@ ifeq ($(TARGET),freebsd)
 USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
 endif
 
+# DragonFlyBSD 4.3 and above
+ifeq ($(TARGET),dragonfly)
+  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)
+endif
+
 # Mac OS/X
 ifeq ($(TARGET),osx)
   set_target_defaults = $(call default_opts, \
@@ -773,8 +781,9 @@ all:
@echo
@echo "Please choose the target among the following supported list :"
@echo
-   @echo "   linux-glibc, linux-glibc-legacy, linux-musl, solaris, 
freebsd, openbsd, "
-   @echo "   netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic, 
custom"
+   @echo "   linux-glibc, linux-glibc-legacy, linux-musl, solaris, 
freebsd, dragonfly, "
+   @echo "   iopenbs, netbsd, cygwin, haiku, aix51, aix52, aix72-gcc, osx, 
generic, "
+   @echo "   custom"
@echo
@echo "Use \"generic\" if you don't want any optimization, \"custom\" 
if you"
@echo "want to precisely tweak every option, or choose the target which"
@@ -850,8 +859,9 @@ help:
 fi; \
   else \
 echo "TARGET not set, you may pass 'TARGET=xxx' to set one among 
:";\
-echo "  linux-glibc, linux-glibc-legacy, solaris, freebsd, netbsd, 
osx,"; \
-echo "  openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic, 
custom"; \
+echo "  linux-glibc, linux-glibc-legacy, solaris, freebsd, 
dragonfly, netbsd,"; \
+echo "  osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, 
generic,"; \
+echo "  custom"; \
   fi
$(Q)echo;echo "Enabled features for TARGET '$(TARGET)' (disable with 
'USE_xxx=') :"
$(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),$(opt),)); echo "  $$*" | (fmt || cat) 2>/dev/null



[PATCH] DOC: update INSTALL with supported OpenBSD / FreeBSD versions

2020-10-02 Thread Brad Smith
Update INSTALL with the OpenBSD / FreeBSD versions that are supported.



diff --git a/INSTALL b/INSTALL
index 04b034908..f562a7102 100644
--- a/INSTALL
+++ b/INSTALL
@@ -375,10 +375,10 @@ and assign it to the TARGET variable :
   - linux-glibc-legacy  for Linux kernel 2.6.28 and above without new features
   - linux-musl  for Linux kernel 2.6.28 and above with musl libc
   - solaris for Solaris 10 and above
-  - freebsd for FreeBSD 5 to 12 (others untested)
+  - freebsd for FreeBSD 10 and above
   - netbsd  for NetBSD
   - osx for Mac OS/X
-  - openbsd for OpenBSD 5.7 and above
+  - openbsd for OpenBSD 6.3 and above
   - aix51   for AIX 5.1
   - aix52   for AIX 5.2
   - aix72-gcc   for AIX 7.2 (using gcc)



Re: [PATCH] BUILD: makefile: Enable closefrom() support on Solaris

2020-10-01 Thread Brad Smith
On Thu, Oct 01, 2020 at 10:08:47AM +0200, Willy Tarreau wrote:
> On Wed, Sep 30, 2020 at 04:54:30PM -0400, Brad Smith wrote:
> > On 9/30/2020 4:22 PM,  ??? wrote:
> > > there also several documentation files like this one
> > > https://github.com/haproxy/haproxy/blob/master/INSTALL#L159
> > > <https://github.com/haproxy/haproxy/blob/master/INSTALL#L159>
> > > 
> > > can you please review documentation as well ?
> > 
> > That seems to be the only file. I will update the relevant bits there too.
> 
> OK so I'll take your new patch instead.



diff --git a/INSTALL b/INSTALL
index 69fe94f42..04b034908 100644
--- a/INSTALL
+++ b/INSTALL
@@ -374,7 +374,7 @@ and assign it to the TARGET variable :
   - linux-glibc for Linux kernel 2.6.28 and above
   - linux-glibc-legacy  for Linux kernel 2.6.28 and above without new features
   - linux-musl  for Linux kernel 2.6.28 and above with musl libc
-  - solaris for Solaris 8 or 10 (others untested)
+  - solaris for Solaris 10 and above
   - freebsd for FreeBSD 5 to 12 (others untested)
   - netbsd  for NetBSD
   - osx for Mac OS/X
diff --git a/Makefile b/Makefile
index 197126db5..77bf9ff3c 100644
--- a/Makefile
+++ b/Makefile
@@ -353,12 +353,11 @@ ifneq ($(shell echo __arm__/__aarch64__ | $(CC) -E -xc - 
| grep '^[^\#]'),__arm_
 endif
 endif
 
-# Solaris 8 and above
+# Solaris 10 and above
 ifeq ($(TARGET),solaris)
-  # We also enable getaddrinfo() which works since solaris 8.
   set_target_defaults = $(call default_opts, \
 USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD \
-USE_RT USE_OBSOLETE_LINKER USE_EVPORTS)
+USE_RT USE_OBSOLETE_LINKER USE_EVPORTS USE_CLOSEFROM)
   TARGET_CFLAGS  = -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 
-D__EXTENSIONS__
   TARGET_LDFLAGS = -lnsl -lsocket
 endif



Re: [PATCH] BUILD: makefile: Enable closefrom() support on Solaris

2020-09-30 Thread Brad Smith

On 9/30/2020 4:22 PM, Илья Шипицин wrote:

there also several documentation files like this one
https://github.com/haproxy/haproxy/blob/master/INSTALL#L159 



can you please review documentation as well ?


That seems to be the only file. I will update the relevant bits there too.

Thanks.




[PATCH] BUILD: makefile: Enable closefrom() support on Solaris

2020-09-30 Thread Brad Smith
Solaris 9 (released 2002) added support for closefrom().

I bumped the version in the comment to 10 as the default feature
flags already has event ports enabled which were introduced in
Solaris 10.


diff --git a/Makefile b/Makefile
index 197126db5..e7d716dd3 100644
--- a/Makefile
+++ b/Makefile
@@ -353,12 +353,11 @@ ifneq ($(shell echo __arm__/__aarch64__ | $(CC) -E -xc - 
| grep '^[^\#]'),__arm_
 endif
 endif
 
-# Solaris 8 and above
+# Solaris 10 and above
 ifeq ($(TARGET),solaris)
-  # We also enable getaddrinfo() which works since solaris 8.
   set_target_defaults = $(call default_opts, \
 USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD \
-USE_RT USE_OBSOLETE_LINKER USE_EVPORTS)
+USE_RT USE_OBSOLETE_LINKER USE_EVPORTS USE_CLOSEFROM)
   TARGET_CFLAGS  = -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 
-D__EXTENSIONS__
   TARGET_LDFLAGS = -lnsl -lsocket
 endif



Re: [PATCH] BUILD: makefile: Fix building with closefrom() support enabled

2020-09-29 Thread Brad Smith

Looks like this should be back ported to 2.0, 2.1 and 2.2.

On 9/30/2020 1:04 AM, Brad Smith wrote:

I noticed the USE_CLOSEFROM define was not being passed along like the rest
during the build.

Looking around I see this was broken with the following two commits and related
series..

BUILD: Makefile: also report disabled options in the BUILD_OPTIONS variable
http://git.haproxy.org/?p=haproxy.git;a=commit;h=05fd82da76d1bbc8d65d63ab246bda7cbcf8481a

BUILD: pass all "USE_*" variables as -DUSE_* to the compiler
http://git.haproxy.org/?p=haproxy.git;a=commit;h=824cd00d3bda8f7f6d4c30baf77ba6c19ab47811



diff --git a/Makefile b/Makefile
index 197126db5..d84b032c2 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@
  #   USE_LUA  : enable Lua support.
  #   USE_FUTEX: enable use of futex on kernel 2.6. Automatic.
  #   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_ZLIB : enable zlib library support.
  #   USE_SLZ  : enable slz library instead of zlib (pick at most 
one).
@@ -291,7 +292,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER   
  \
 USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY   
\
 USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H  
\
 USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4  
\
-   USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS   \
+   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
  





[PATCH] BUILD: makefile: Fix building with closefrom() support enabled

2020-09-29 Thread Brad Smith
I noticed the USE_CLOSEFROM define was not being passed along like the rest
during the build.

Looking around I see this was broken with the following two commits and related
series..

BUILD: Makefile: also report disabled options in the BUILD_OPTIONS variable
http://git.haproxy.org/?p=haproxy.git;a=commit;h=05fd82da76d1bbc8d65d63ab246bda7cbcf8481a

BUILD: pass all "USE_*" variables as -DUSE_* to the compiler
http://git.haproxy.org/?p=haproxy.git;a=commit;h=824cd00d3bda8f7f6d4c30baf77ba6c19ab47811



diff --git a/Makefile b/Makefile
index 197126db5..d84b032c2 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@
 #   USE_LUA  : enable Lua support.
 #   USE_FUTEX: enable use of futex on kernel 2.6. Automatic.
 #   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_ZLIB : enable zlib library support.
 #   USE_SLZ  : enable slz library instead of zlib (pick at most 
one).
@@ -291,7 +292,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER   
  \
USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY   \
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H  \
USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4  \
-   USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS   \
+   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
 



Re: [PATCH] BUILD: makefile: Update feature flags for FreeBSD

2020-09-29 Thread Brad Smith

On 9/29/2020 5:12 AM, Willy Tarreau wrote:

On Tue, Sep 15, 2020 at 03:10:04AM -0400, Brad Smith wrote:

This updates the feature flags for FreeBSD.

FreeBSD 10 adds support for accept4().

Enable getaddrinfo().

>From the FreeBSD port / package.

Applied, thanks Brad! And sorry for missing it the first time, it simply
went out of my scrolling area :-)

Willy


Thanks.



Re: [PATCH] BUILD: makefile: Update feature flags for FreeBSD

2020-09-27 Thread Brad Smith

Willy?

They've been shipping with these enabled with their 1.7 - 2.3 ports / 
packages.


MAKE_ARGS=    TARGET=freebsd DEFINE=-DFREEBSD_PORTS USE_GETADDRINFO=1 \
    USE_ZLIB=1 USE_CPU_AFFINITY=1 USE_ACCEPT4=1 \
    CC="${CC}" DEBUG_CFLAGS="" CPU_CFLAGS="${CFLAGS}"

On 9/15/2020 3:10 AM, Brad Smith wrote:

This updates the feature flags for FreeBSD.

FreeBSD 10 adds support for accept4().

Enable getaddrinfo().

 From the FreeBSD port / package.



diff --git a/Makefile b/Makefile
index 934ca1666..e69870595 100644
--- a/Makefile
+++ b/Makefile
@@ -363,11 +363,11 @@ ifeq ($(TARGET),solaris)
TARGET_LDFLAGS = -lnsl -lsocket
  endif
  
-# FreeBSD 5 and above

+# FreeBSD 10 and above
  ifeq ($(TARGET),freebsd)
set_target_defaults = $(call default_opts, \
  USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   
\
-USE_CLOSEFROM)
+USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
  endif
  
  # Mac OS/X






[PATCH] BUILD: makefile: Update feature flags for OpenBSD

2020-09-26 Thread Brad Smith
Update the OpenBSD target features being enabled.

I updated the list of features after noticing
"BUILD: makefile: disable threads by default on OpenBSD".

The Makefile utilizing gcc(1) by default resulted in utilizing
our legacy and obsolete compiler (GCC 4.2.1) instead of the
proper system compiler (Clang), which does support TLS. With
"BUILD: makefile: change default value of CC from gcc to cc"
that is resolved.


diff --git a/Makefile b/Makefile
index 934ca1666..197126db5 100644
--- a/Makefile
+++ b/Makefile
@@ -377,10 +377,11 @@ ifeq ($(TARGET),osx)
   EXPORT_SYMBOL  = -export_dynamic
 endif
 
-# OpenBSD 5.7 and above
+# OpenBSD 6.3 and above
 ifeq ($(TARGET),openbsd)
   set_target_defaults = $(call default_opts, \
-USE_POLL USE_TPROXY USE_KQUEUE USE_ACCEPT4)
+USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4 USE_CLOSEFROM   \
+USE_GETADDRINFO)
 endif
 
 # NetBSD



Re: [PATCH] BUILD: makefile: Update feature flags for FreeBSD

2020-09-22 Thread Brad Smith

ping.

On 9/15/2020 3:10 AM, Brad Smith wrote:

This updates the feature flags for FreeBSD.

FreeBSD 10 adds support for accept4().

Enable getaddrinfo().

 From the FreeBSD port / package.



diff --git a/Makefile b/Makefile
index 934ca1666..e69870595 100644
--- a/Makefile
+++ b/Makefile
@@ -363,11 +363,11 @@ ifeq ($(TARGET),solaris)
TARGET_LDFLAGS = -lnsl -lsocket
  endif
  
-# FreeBSD 5 and above

+# FreeBSD 10 and above
  ifeq ($(TARGET),freebsd)
set_target_defaults = $(call default_opts, \
  USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   
\
-USE_CLOSEFROM)
+USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
  endif
  
  # Mac OS/X






Re: [PATCH] BUILD: makefile: Update feature flags for Solaris / FreeBSD / NetBSD / OpenBSD

2020-09-15 Thread Brad Smith

On 9/15/2020 3:45 AM, Lukas Tribus wrote:

On Tue, 15 Sep 2020 at 09:05, Brad Smith  wrote:

NetBSD 8.0 adds support for accept4() and closefrom(). Enable getaddrinfo().

We just had to disable threading on OpenBSD 6.7 for the build to succeed:

https://github.com/haproxy/haproxy/issues/725

Did you actually test all those combinations? Because otherwise it
does not seem like a good idea to commit this.

I know. I saw that. That was wrong. The other diff I submitted switching
the compiler default
as well as this came from that bogus diff.

2 of the 4 targets are (FreeBSD / OpenBSD). The other 2 are just based
on being aware of the API
and what has been implemented and when. I'll split up my diff and send
in the tested bits first.

Ok thanks (I was concerned about disabling threading on OpenBSD as well).

Please add the information that your previous patch switching gcc to
cc is required for the OpenBSD change to work; it's obvious to me now,
but when looking at the single change we are not always aware of the
history (especially later during bisects).


I will do so. Yes, those details can be important.



[PATCH] BUILD: makefile: Update feature flags for FreeBSD

2020-09-15 Thread Brad Smith
This updates the feature flags for FreeBSD.

FreeBSD 10 adds support for accept4().

Enable getaddrinfo().

>From the FreeBSD port / package.



diff --git a/Makefile b/Makefile
index 934ca1666..e69870595 100644
--- a/Makefile
+++ b/Makefile
@@ -363,11 +363,11 @@ ifeq ($(TARGET),solaris)
   TARGET_LDFLAGS = -lnsl -lsocket
 endif
 
-# FreeBSD 5 and above
+# FreeBSD 10 and above
 ifeq ($(TARGET),freebsd)
   set_target_defaults = $(call default_opts, \
 USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   \
-USE_CLOSEFROM)
+USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
 endif
 
 # Mac OS/X



Re: [PATCH] BUILD: makefile: Update feature flags for Solaris / FreeBSD / NetBSD / OpenBSD

2020-09-15 Thread Brad Smith

On 9/14/2020 5:39 AM, Lukas Tribus wrote:

Hello Brad,

On Sun, 13 Sep 2020 at 09:08, Brad Smith  wrote:

The following diff updates the feature flags for Solaris / FreeBSD / NetBSD / 
OpenBSD.

Bump the baseline Solaris to 9 which intruduced closefrom().

FreeBSD 10 is already EOL for support but its the new baseline. Introduces 
accept4().
Enable getaddrinfo(). The FreeBSD port enables these.

OpenBSD 6.3 is pretty old but it brings a compiler that supports TLS for the 
threads
support. 5.7 already supported closefrom(). Enable getaddrinfo().

NetBSD 8.0 adds support for accept4() and closefrom(). Enable getaddrinfo().

We just had to disable threading on OpenBSD 6.7 for the build to succeed:

https://github.com/haproxy/haproxy/issues/725

Did you actually test all those combinations? Because otherwise it
does not seem like a good idea to commit this.


I know. I saw that. That was wrong. The other diff I submitted switching 
the compiler default

as well as this came from that bogus diff.

2 of the 4 targets are (FreeBSD / OpenBSD). The other 2 are just based 
on being aware of the API
and what has been implemented and when. I'll split up my diff and send 
in the tested bits first.




Re: [PATCH] BUILD: makefile: change default value of CC from gcc to cc

2020-09-15 Thread Brad Smith

On 9/15/2020 1:31 AM, Willy Tarreau wrote:

On Mon, Sep 14, 2020 at 11:42:47PM -0400, Brad Smith wrote:

It's not about package maintainers as they know to do the right
thing. It's
about end users that don't know any better. In this case someone
submitted
a bogus patch which was commited based on using the wrong compiler.

why they do not just use package system ?

I don't know, but it's beside the point now. All kinds of people for various
reasons (re)build software outside of pre-built packages.

Well, after sleeping over it, I think your points above are valid. We
used to support exclusively gcc by extensively using GNU extensions,
but over time other compilers like icc, clang, and tcc have adopted a
lot of these GNU extensions and are compatible. And it makes sense not
to ask them to call themselves gcc of course. So I think we can do this,
and that 2.3 is the right version to do it, and it will leave us enough
time to see if any issues are reported. In practice I expect the vast
majority of systems where development packages are installed to have
at least one working "cc".

I'm going to take your patch, thanks!


Thanks.



Re: [PATCH] BUILD: makefile: change default value of CC from gcc to cc

2020-09-14 Thread Brad Smith

On 9/14/2020 11:25 PM, Илья Шипицин wrote:



вт, 15 сент. 2020 г. в 02:42, Brad Smith <mailto:b...@comstyle.com>>:


On 9/14/2020 5:26 AM, Willy Tarreau wrote:
> Hi Brad,
>
> On Sun, Sep 13, 2020 at 02:53:06AM -0400, Brad Smith wrote:
>> Change the default value of CC from gcc to cc to be more
appropriate
>> for modern day mix of compilers. On GCC based OS's cc -> gcc.
On Clang
>> based OS's cc -> clang. FreeBSD / OpenBSD have switched to
Clang and
>> this corrects building with the proper compiler on OS's using Clang
>> as the default compiler. This especially matters for the
necessity for
>> TLS on OpenBSD. I would expect this affects OpenMandriva and other
>> Linux OS's using Clang as well.
> I don't have a strong opinion on this one, I'd like to get feedback
> from distro maintainers first. In any case it's trivial to set CC
> while building so it's no big deal for sure.

It's not about package maintainers as they know to do the right
thing. It's
about end users that don't know any better. In this case someone
submitted
a bogus patch which was commited based on using the wrong compiler.



why they do not just use package system ?


I don't know, but it's beside the point now. All kinds of people for 
various reasons

(re)build software outside of pre-built packages.


Re: [PATCH] BUILD: makefile: change default value of CC from gcc to cc

2020-09-14 Thread Brad Smith

On 9/14/2020 5:26 AM, Willy Tarreau wrote:

Hi Brad,

On Sun, Sep 13, 2020 at 02:53:06AM -0400, Brad Smith wrote:

Change the default value of CC from gcc to cc to be more appropriate
for modern day mix of compilers. On GCC based OS's cc -> gcc. On Clang
based OS's cc -> clang. FreeBSD / OpenBSD have switched to Clang and
this corrects building with the proper compiler on OS's using Clang
as the default compiler. This especially matters for the necessity for
TLS on OpenBSD. I would expect this affects OpenMandriva and other
Linux OS's using Clang as well.

I don't have a strong opinion on this one, I'd like to get feedback
from distro maintainers first. In any case it's trivial to set CC
while building so it's no big deal for sure.


It's not about package maintainers as they know to do the right thing. It's
about end users that don't know any better. In this case someone submitted
a bogus patch which was commited based on using the wrong compiler.



[PATCH] BUILD: makefile: Update feature flags for Solaris / FreeBSD / NetBSD / OpenBSD

2020-09-13 Thread Brad Smith
The following diff updates the feature flags for Solaris / FreeBSD / NetBSD / 
OpenBSD.

Bump the baseline Solaris to 9 which intruduced closefrom().

FreeBSD 10 is already EOL for support but its the new baseline. Introduces 
accept4().
Enable getaddrinfo(). The FreeBSD port enables these.

OpenBSD 6.3 is pretty old but it brings a compiler that supports TLS for the 
threads
support. 5.7 already supported closefrom(). Enable getaddrinfo().

NetBSD 8.0 adds support for accept4() and closefrom(). Enable getaddrinfo().


diff --git a/Makefile b/Makefile
index 48c595511..0a3ac70e8 100644
--- a/Makefile
+++ b/Makefile
@@ -353,21 +353,20 @@ ifneq ($(shell echo __arm__/__aarch64__ | $(CC) -E -xc - 
| grep '^[^\#]'),__arm_
 endif
 endif
 
-# Solaris 8 and above
+# Solaris 9 and above
 ifeq ($(TARGET),solaris)
-  # We also enable getaddrinfo() which works since solaris 8.
   set_target_defaults = $(call default_opts, \
 USE_POLL USE_TPROXY USE_LIBCRYPT USE_CRYPT_H USE_GETADDRINFO USE_THREAD \
-USE_RT USE_OBSOLETE_LINKER USE_EVPORTS)
+USE_RT USE_OBSOLETE_LINKER USE_EVPORTS USE_CLOSEFROM)
   TARGET_CFLAGS  = -DFD_SETSIZE=65536 -D_REENTRANT -D_XOPEN_SOURCE=500 
-D__EXTENSIONS__
   TARGET_LDFLAGS = -lnsl -lsocket
 endif
 
-# FreeBSD 5 and above
+# FreeBSD 10 and above
 ifeq ($(TARGET),freebsd)
   set_target_defaults = $(call default_opts, \
 USE_POLL USE_TPROXY USE_LIBCRYPT USE_THREAD USE_CPU_AFFINITY USE_KQUEUE   \
-USE_CLOSEFROM)
+USE_ACCEPT4 USE_CLOSEFROM USE_GETADDRINFO)
 endif
 
 # Mac OS/X
@@ -377,16 +376,18 @@ ifeq ($(TARGET),osx)
   EXPORT_SYMBOL  = -export_dynamic
 endif
 
-# OpenBSD 5.7 and above
+# OpenBSD 6.3 and above
 ifeq ($(TARGET),openbsd)
   set_target_defaults = $(call default_opts, \
-USE_POLL USE_TPROXY USE_KQUEUE USE_ACCEPT4)
+USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4 USE_CLOSEFROM   \
+USE_GETADDRINFO)
 endif
 
-# NetBSD
+# NetBSD 8 and above
 ifeq ($(TARGET),netbsd)
   set_target_defaults = $(call default_opts, \
-USE_POLL USE_TPROXY USE_KQUEUE)
+USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4 USE_CLOSEFROM   \
+USE_GETADDRINFO)
 endif
 
 # AIX 5.1 only



[PATCH] BUILD: makefile: change default value of CC from gcc to cc

2020-09-13 Thread Brad Smith
Change the default value of CC from gcc to cc to be more appropriate
for modern day mix of compilers. On GCC based OS's cc -> gcc. On Clang
based OS's cc -> clang. FreeBSD / OpenBSD have switched to Clang and
this corrects building with the proper compiler on OS's using Clang
as the default compiler. This especially matters for the necessity for
TLS on OpenBSD. I would expect this affects OpenMandriva and other
Linux OS's using Clang as well.


diff --git a/Makefile b/Makefile
index 48c595511..841b4a639 100644
--- a/Makefile
+++ b/Makefile
@@ -58,8 +58,8 @@
 # given TARGET is enumerated at the end of "make help".
 #
 # Variables useful for packagers :
-#   CC is set to "gcc" by default and is used for compilation only.
-#   LD is set to "gcc" by default and is used for linking only.
+#   CC is set to "cc" by default and is used for compilation only.
+#   LD is set to "cc" by default and is used for linking only.
 #   ARCH may be useful to force build of 32-bit binary on 64-bit systems
 #   CFLAGS is automatically set for the specified CPU and may be overridden.
 #   LDFLAGS is automatically set to -g and may be overridden.
@@ -157,8 +157,7 @@ CPU = generic
 ARCH =
 
  Toolchain options.
-# GCC is normally used both for compiling and linking.
-CC = gcc
+CC = cc
 LD = $(CC)
 
  Debug flags (typically "-g").