diff options
author | Martin Schwenke <martin@meltin.net> | 2017-12-02 20:06:25 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-07-11 14:47:21 +0200 |
commit | 4628afa3f563924434ccae9918cf60778b8ab91f (patch) | |
tree | c28c1a46924a8eaca31b9060ac476cb3cefec417 /ctdb/config | |
parent | 451c6b668fb076eb0bb99ad70cf1546c4450cc5d (diff) | |
download | samba-4628afa3f563924434ccae9918cf60778b8ab91f.tar.gz |
ctdb-scripts: Provide a gstack function if gstack is not available
gstack isn't widely available, so provide a simple function that does
the same thing if it gstack can't be found.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Jul 11 14:47:21 CEST 2018 on sn-devel-144
Diffstat (limited to 'ctdb/config')
-rwxr-xr-x | ctdb/config/debug_locks.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh index 08676854088..1f89cb7353c 100755 --- a/ctdb/config/debug_locks.sh +++ b/ctdb/config/debug_locks.sh @@ -12,6 +12,19 @@ . "${CTDB_BASE}/functions" +# type is at least mentioned in POSIX and more is portable than which(1) +# shellcheck disable=SC2039 +if ! type gstack >/dev/null 2>&1 ; then + gstack () + { + _pid="$1" + + gdb -batch --quiet -nx "/proc/${_pid}/exe" "$_pid" \ + -ex "thread apply all bt" 2>/dev/null | + grep '^\(#\|Thread \)' + } +fi + # Load/cache database options from configuration file ctdb_get_db_options @@ -72,7 +85,6 @@ ctdb_get_db_options cat "/proc/${pid}/stack" else gstack "$pid" - # gcore -o /var/log/core-deadlock-ctdb $pid fi done fi |