2010-09-20 22:08:53 +02:00
|
|
|
# src/template/linux
|
2006-03-11 05:38:42 +01:00
|
|
|
|
Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform. Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems. Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones. So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions. If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.
It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.
I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.
I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.
Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-10 00:03:45 +02:00
|
|
|
# Prefer unnamed POSIX semaphores if available, unless user overrides choice
|
|
|
|
if test x"$PREFERRED_SEMAPHORES" = x"" ; then
|
|
|
|
PREFERRED_SEMAPHORES=UNNAMED_POSIX
|
|
|
|
fi
|
|
|
|
|
2003-09-26 19:39:13 +02:00
|
|
|
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
|
Use ppoll(2), if available, to wait for input in pgbench.
Previously, pgbench always used select(2) for this purpose, but that's
problematic for very high client counts, because select() can't deal
with file descriptor numbers larger than FD_SETSIZE. It's pretty common
for that to be only 1024 or so, whereas modern OSes can allow many more
open files than that. Using poll(2) would surmount that problem, but it
creates another one: poll()'s timeout resolution is only 1ms, which is
poor enough to cause problems with --rate specifications approaching or
exceeding 1K TPS.
On platforms that have ppoll(2), which includes Linux and recent
FreeBSD, we can use that to avoid the FD_SETSIZE problem without any
loss of timeout resolution. Hence, add configure logic to test for
ppoll(), and use it if available.
This patch introduces an abstraction layer into pgbench that could
be extended to support other kernel event-wait APIs such as kevents.
But actually adding such support is a matter for some future patch.
Doug Rady, reviewed by Robert Haas and Fabien Coelho, and whacked around
a good bit more by me
Discussion: https://postgr.es/m/23D017C9-81B7-484D-8490-FD94DEC4DF59@amazon.com
2018-09-24 20:40:58 +02:00
|
|
|
# This is also required for ppoll(2), and perhaps other things
|
2006-12-12 20:43:19 +01:00
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
2007-09-21 04:33:46 +02:00
|
|
|
|
2019-10-21 18:32:35 +02:00
|
|
|
# Extra CFLAGS for code that will go into a shared library
|
|
|
|
CFLAGS_SL="-fPIC"
|
|
|
|
|
2007-09-21 04:33:46 +02:00
|
|
|
# If --enable-profiling is specified, we need -DLINUX_PROFILE
|
|
|
|
PLATFORM_PROFILE_FLAGS="-DLINUX_PROFILE"
|
2008-10-29 17:06:47 +01:00
|
|
|
|
|
|
|
if test "$SUN_STUDIO_CC" = "yes" ; then
|
|
|
|
CC="$CC -Xa" # relaxed ISO C mode
|
|
|
|
CFLAGS="-v" # -v is like gcc -Wall
|
|
|
|
if test "$enable_debug" != yes; then
|
|
|
|
CFLAGS="$CFLAGS -O" # any optimization breaks debug
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Pick the right test-and-set (TAS) code for the Sun compiler.
|
|
|
|
# We would like to use in-line assembler, but the compiler
|
|
|
|
# requires *.il files to be on every compile line, making
|
|
|
|
# the build system too fragile.
|
|
|
|
case $host_cpu in
|
|
|
|
sparc)
|
|
|
|
need_tas=yes
|
|
|
|
tas_file=sunstudio_sparc.s
|
|
|
|
;;
|
|
|
|
i?86|x86_64)
|
|
|
|
need_tas=yes
|
|
|
|
tas_file=sunstudio_x86.s
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|