Skip to content

Conversation

miztake
Copy link
Contributor

@miztake miztake commented Jun 6, 2020

Pthread library does not set errno.
Pthread library's errno is returned by return value.

@practicalswift
Copy link
Contributor

Concept ACK: nice catch and nice first-time contribution!

May I ask how did you found this issue? :)

Warm welcome as a contributor @miztake :)

@pstratem
Copy link
Contributor

pstratem commented Jun 7, 2020

ACK c7601ab

you can move the declaration into the if statement like this:
if ((int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param)) != 0) {

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c7601ab, tested on Linux Mint 19.3 (x86_64).

From the pthread_setschedparam() docs:

On success, these functions return 0; on error, they return a nonzero error number.

@hebasto
Copy link
Member

hebasto commented Jun 7, 2020

you can move the declaration into the if statement like this:
if ((int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param)) != 0) {

It won't compile :) (at least on GCC 7.5).

@miztake
Copy link
Contributor Author

miztake commented Jun 7, 2020

Hi, @practicalswift

May I ask how did you found this issue? :)

Thank you for your comment.
I didn't actually output this log.
It's a common bug when using pthread and I found it in a code review.
( just greped "pthread" :) )

@donaloconnor
Copy link
Contributor

ACK 0e7b64b

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 0e7b64b.

Mind squashing commits into one commit?

@kristapsk
Copy link
Contributor

Concept ACK, checked man pthread_setschedparam, change seems correct, but commits should be squashed into one.

Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
@miztake
Copy link
Contributor Author

miztake commented Jun 8, 2020

Hi, @kristapsk

Thank you for your comment.
I squashed the commits into one.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cb38b06, only squashed commits since the previous review.

@maflcko
Copy link
Member

maflcko commented Jun 8, 2020

review ACK cb38b06

@practicalswift
Copy link
Contributor

ACK cb38b06 -- patch looks correct

@fanquake fanquake merged commit 9573d2b into bitcoin:master Jun 8, 2020
@laanwj
Copy link
Member

laanwj commented Jun 9, 2020

Poshumous ACK, good catch!

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Jun 9, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: bitcoin#19194
Rebased-From: cb38b06
@fanquake fanquake mentioned this pull request Jun 9, 2020
fanquake added a commit that referenced this pull request Jul 10, 2020
2b79ac7 Clean up separated ban/discourage interface (Pieter Wuille)
0477348 Replace automatic bans with discouragement filter (Pieter Wuille)
e7f06f9 test: remove Cirrus CI FreeBSD job (fanquake)
eb6b82a qa: Test concurrent wallet loading (João Barbosa)
c9b49d2 wallet: Handle concurrent wallet loading (João Barbosa)
cf0b5a9 tests: Check that segwit inputs in psbt have both UTXO types (Andrew Chow)
3228b59 psbt: always put a non_witness_utxo and don't remove it (Andrew Chow)
ed5ec30 psbt: Allow both non_witness_utxo and witness_utxo (Andrew Chow)
68e0e6f rpc: show both UTXOs in decodepsbt (Andrew Chow)
27786d0 trivial: Suggested cleanups to surrounding code (Russell Yanofsky)
654420d wallet: Minimal fix to restore conflicted transaction notifications (Russell Yanofsky)
febebc4 Fix WSL file locking by using flock instead of fcntl (Samuel Dobson)
5c7151a gui: update Qt base translations for macOS release (fanquake)
c219d21 build: improved output of configure for build OS (sachinkm77)
0596a6e util: Don't reference errno when pthread fails. (MIZUTA Takeshi)

Pull request description:

  Currently backports the following to the 0.20 branch:
  * #18700 - Fix locking on WSL using flock instead of fcntl
  * #18982 - wallet: Minimal fix to restore conflicted transaction notifications
  * #19059 - gui: update Qt base translations for macOS release
  * #19152 - build: improve build OS configure output
  * #19194 -  util: Don't reference errno when pthread fails.
  * #19215 - psbt: Include and allow both non_witness_utxo and witness_utxo for segwit inputs
  * #19219 - Replace automatic bans with discouragement filter
  * #19300 - wallet: Handle concurrent wallet loading

ACKs for top commit:
  amitiuttarwar:
    ACK 0477348 2b79ac7 by comparing to original changes, double checking the diff
  sipa:
    utACK 2b79ac7
  laanwj:
    ACK 2b79ac7

Tree-SHA512: e5eb31d08288fa4a6e8aba08e60b16ce1988f14f249238b1cfd18ab2c8f6fcd9f07e3c0c491d32d2361fca26e3037fb0374f37464bddcabecea29069d6737539
backpacker69 referenced this pull request in peercoin/peercoin Sep 8, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: #19194
Rebased-From: cb38b06
fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Oct 14, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: bitcoin#19194
Rebased-From: cb38b06
fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Oct 15, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: bitcoin#19194
Rebased-From: cb38b06
@fanquake fanquake mentioned this pull request Oct 15, 2020
fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Oct 16, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: bitcoin#19194
Rebased-From: cb38b06
Bushstar pushed a commit to Bushstar/omnicore that referenced this pull request Oct 21, 2020
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

Github-Pull: bitcoin#19194
Rebased-From: cb38b06
maflcko pushed a commit that referenced this pull request Dec 2, 2020
9c71499 rpc: Adjust witness-tx deserialize error message (MarcoFalke)
a7bdf5c rpc: Properly deserialize txs with witness before signing (MarcoFalke)
0b64310 Avoid the use of abs64 in timedata (Pieter Wuille)
5b2de04 Bump vcpkg commit ID to get new msys mirror list (Aaron Clauson)
6957419 build: set minimum required Boost to 1.48.0 (fanquake)
27bb2cc util: Don't reference errno when pthread fails. (MIZUTA Takeshi)
8bd2ab1 docs: Correct description for getblockstats's txs field (Nadav Ivgi)
a8411b3 qt: Fix QFileDialog for static builds (Hennadii Stepanov)

Pull request description:

  Backports the following to the 0.19 branch:
  * #19194 - util: Don't reference errno when pthread fails. - not clean.
  * #19536 - qt, build: Fix QFileDialog for static builds
  * #19777 - docs: Correct description for getblockstats's txs field
  * #19836 - rpc: Properly deserialize txs with witness before signing
  * #20095 - CI: Bump vcpkg commit ID to get new msys mirror list
  * #20141 - Avoid the use of abs64 in timedata
  * #20142 - [0.20] build: set minimum required Boost to 1.48.0

ACKs for top commit:
  jnewbery:
    utACK 9c71499
  dergoegge:
    utACK 9c71499
  MarcoFalke:
    ACK 9c71499

Tree-SHA512: 2151f22bc37a6a2f51a8f36c27376622016b51ff99b570e95354356fce1f1761cf19cb4f8ebfa26d38485a0bff6ff6ee834d2798fb383e2ae2abb175548b8fe6
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 14, 2021
Summary:
Pthread library does not set errno.
Pthread library's errno is returned by return value.

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>

This is a backport of [[bitcoin/bitcoin#19194 | core#19194]]

Test Plan: `ninja check-functional`

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D9524
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants