HomePhabricator

util: Make thread names shorter

Description

util: Make thread names shorter

Summary:

Thread names at the process level are limited by 15 characters. This
commit ensures that name 'b-httpworker.42' will not be cropped.

Backport of core PR16984.

Depends on D5540.

Test Plan:

ninja check

bitcoind -daemon -testnet
ps -T -p $(cat ~/.bitcoin/testnet3/bitcoind.pid)

Check no thread name is truncated.

Before:

PID  SPID TTY          TIME CMD
3749  3749 ?        00:00:07 bitcoind
3749  3750 ?        00:00:00 bitcoin-scriptc
3749  3751 ?        00:00:00 bitcoin-scriptc
3749  3752 ?        00:00:00 bitcoin-scriptc
3749  3753 ?        00:00:00 bitcoin-scriptc
3749  3754 ?        00:00:00 bitcoin-scriptc
3749  3755 ?        00:00:00 bitcoin-schedul
3749  3756 ?        00:00:00 bitcoin-http
3749  3757 ?        00:00:00 bitcoin-httpwor
3749  3758 ?        00:00:00 bitcoin-httpwor
3749  3759 ?        00:00:00 bitcoin-httpwor
3749  3760 ?        00:00:00 bitcoin-httpwor
3749  3761 ?        00:00:01 bitcoind
3749  3765 ?        00:00:00 bitcoin-torcont
3749  3766 ?        00:00:00 bitcoin-net
3749  3768 ?        00:00:00 bitcoin-addcon
3749  3769 ?        00:00:00 bitcoin-opencon
3749  3770 ?        00:00:02 bitcoin-msghand

After:

 PID  SPID TTY          TIME CMD
5191  5191 ?        00:00:06 b-init
5191  5192 ?        00:00:00 b-scriptch.0
5191  5193 ?        00:00:00 b-scriptch.1
5191  5194 ?        00:00:00 b-scriptch.2
5191  5195 ?        00:00:00 b-scriptch.3
5191  5196 ?        00:00:00 b-scriptch.4
5191  5197 ?        00:00:00 b-scheduler
5191  5198 ?        00:00:00 b-http
5191  5199 ?        00:00:00 b-httpworker.0
5191  5200 ?        00:00:00 b-httpworker.1
5191  5201 ?        00:00:00 b-httpworker.2
5191  5202 ?        00:00:00 b-httpworker.3
5191  5206 ?        00:00:00 b-torcontrol
5191  5207 ?        00:00:00 b-net
5191  5208 ?        00:00:00 b-dnsseed
5191  5209 ?        00:00:00 b-addcon
5191  5210 ?        00:00:00 b-opencon
5191  5211 ?        00:00:00 b-msghand

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D5543

Details

Provenance
Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>Authored on Sep 29 2019, 18:49
FabienCommitted on Mar 24 2020, 09:41
FabienPushed on Mar 24 2020, 09:41
Reviewer
Restricted Project
Differential Revision
D5543: util: Make thread names shorter
Parents
rABCbd90ec836099: Fix portability issue with pthreads
Branches
Unknown
Tags
Unknown