Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/envoy/common/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,15 @@ struct mmsghdr {
unsigned int msg_len;
};
#endif

#ifdef __linux__
#define SUPPORTS_PTHREAD_GETNAME_NP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggest defining it to 1 or 0, rather than defining/not-defining it. That would make it less cumbersome to use in logical expressions at call-sites.

I think that's more consistent with other similar definitions in this file.

#endif

// https://android.googlesource.com/platform/bionic/+/master/docs/status.md
// pthread_getname_np is introduced in API 26
#ifdef __ANDROID_API__
#if __ANDROID_API__ < 26
#define SUPPORTS_PTHREAD_GETNAME_NP
#endif // __ANDROID_API__ < 26
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
#endif // ifdef __ANDROID_API__
4 changes: 2 additions & 2 deletions source/common/common/posix/thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ThreadImplPosix : public Thread {
this);
RELEASE_ASSERT(rc == 0, "");

#ifdef __linux__
#ifdef SUPPORTS_PTHREAD_GETNAME_NP
// If the name was not specified, get it from the OS. If the name was
// specified, write it into the thread, and assert that the OS sees it the
// same way.
Expand Down Expand Up @@ -93,7 +93,7 @@ class ThreadImplPosix : public Thread {
}

private:
#ifdef __linux__
#ifdef SUPPORTS_PTHREAD_GETNAME_NP
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
// Attempts to get the name from the operating system, returning true and
// updating 'name' if successful. Note that during normal operation this
// may fail, if the thread exits prior to the system call.
Expand Down
1 change: 1 addition & 0 deletions tools/spelling/spelling_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ getaddrinfo
getaffinity
gethostname
getifaddrs
getname

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it looks like this is not needed; maybe it was in an intermediate state of this PR?

If I'm wrong go ahead an put it back.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's complaining for the comment I wrote which uses pthread_getname_np

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pretty sure you can wrap the word in back ticks (maybe double back ticks?) to avoid the spell checker, i think thats the preferred way to handle these special words

getpeername
getsockname
getsockopt
Expand Down