]> granicus.if.org Git - postgresql/commit
Make init_spin_delay() C89 compliant and change stuck spinlock reporting.
authorAndres Freund <andres@anarazel.de>
Wed, 13 Apr 2016 23:42:01 +0000 (16:42 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 14 Apr 2016 00:00:53 +0000 (17:00 -0700)
commit80abbeba23d466b6541cf95082a9e1f36704424e
tree088426c853cdd776344f04ede1d4a3bae9e3b29d
parent6cead413bb92be0579a2dbf6320121edcc32e369
Make init_spin_delay() C89 compliant and change stuck spinlock reporting.

The current definition of init_spin_delay (introduced recently in
48354581a) wasn't C89 compliant. It's not legal to refer to refer to
non-constant expressions, and the ptr argument was one.  This, as
reported by Tom, lead to a failure on buildfarm animal pademelon.

The pointer, especially on system systems with ASLR, isn't super helpful
anyway, though. So instead of making init_spin_delay into an inline
function, make s_lock_stuck() report the function name in addition to
file:line and change init_spin_delay() accordingly. While not a direct
replacement, the function name is likely more useful anyway (line
numbers are often hard to interpret in third party reports).

This also fixes what file/line number is reported for waits via
s_lock().

As PG_FUNCNAME_MACRO is now used outside of elog.h, move it to c.h.

Reported-By: Tom Lane
Discussion: 4369.1460435533@sss.pgh.pa.us
src/backend/storage/buffer/bufmgr.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/s_lock.c
src/include/c.h
src/include/storage/s_lock.h
src/include/utils/elog.h