Skip to contentSkip to conversation

Add config time check for new gettid API

PATCH Sebastien Boisvert 2 participants 5 messages Jul 26, 2019 – Jul 29, 2019 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Khem Raj

glibc 2.30 introduced this function see [1]
so it's best to detect it
and provide fallback only if its not present

nit:

-if its not present
+if it's not present

I cloned the git repository of the glibc, but I could not find the definition of gettid().

Do you know where it is located in glibc ?

Thanks.

Quoted 49 lines

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399

Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2019-July/029131.html]

---
v2: Fix typos in commit message

 configure.ac            | 1 +
 include/lttng/ust-tid.h | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.ac +1 -0
index 7fa059a..b1099c1 100644
@@ -137,6 +137,7 @@ AC_CHECK_FUNCS([ \
 	clock_gettime \
 	ftruncate \
 	getpagesize \
+	gettid \
 	gettimeofday \
 	localeconv \
 	memchr \
include/lttng/ust-tid.h +5 -2
index e669d7e..7995c78 100644
@@ -26,7 +26,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-
+#include <config.h>
+#if HAVE_GETTID
+#include <unistd.h>
+#else
 #ifdef __linux__
 #include <syscall.h>
 #endif
@@ -49,5 +52,5 @@ static inline pid_t gettid(void)
 	return getpid();
 }
 #endif
-
+#endif /* HAVE_GETTID */
 #endif /* _LTTNG_UST_TID_H */

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Review

Quoted 13 lines · Sebastien Boisvert
Quoted 3 lines · Khem Raj

glibc 2.30 introduced this function see [1]
so it's best to detect it
and provide fallback only if its not present

nit:

(quoted diff) +1 -1
-if its not present
+if it's not present

I sent a v3 with this fixed.

Quoted 5 lines

I cloned the git repository of the glibc, but I could not find the definition of gettid().

Do you know where it is located in glibc ?

see
https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92

Quoted 51 lines

Thanks.

Quoted 49 lines

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399

Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2019-July/029131.html]

---
v2: Fix typos in commit message

 configure.ac            | 1 +
 include/lttng/ust-tid.h | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.ac +1 -0
index 7fa059a..b1099c1 100644
@@ -137,6 +137,7 @@ AC_CHECK_FUNCS([ \
      clock_gettime \
      ftruncate \
      getpagesize \
+     gettid \
      gettimeofday \
      localeconv \
      memchr \
include/lttng/ust-tid.h +5 -2
index e669d7e..7995c78 100644
@@ -26,7 +26,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-
+#include <config.h>
+#if HAVE_GETTID
+#include <unistd.h>
+#else
 #ifdef __linux__
 #include <syscall.h>
 #endif
@@ -49,5 +52,5 @@ static inline pid_t gettid(void)
      return getpid();
 }
 #endif
-
+#endif /* HAVE_GETTID */
 #endif /* _LTTNG_UST_TID_H */

A message that is not in the archive (sent off-list or not yet received): CAMKF1sqVkKeEYMn1sPWgKfqFuaEnk68Hd4MfccUJKW4UkT0L=Q@mail.gmail.com

#5 lore raw
Quoted 17 lines · Khem Raj

Review

Quoted 13 lines · Sebastien Boisvert
Quoted 3 lines · Khem Raj

glibc 2.30 introduced this function see [1]
so it's best to detect it
and provide fallback only if its not present

nit:

(quoted diff) +1 -1
-if its not present
+if it's not present

I sent a v3 with this fixed.

Quoted 8 lines
Quoted 5 lines

I cloned the git repository of the glibc, but I could not find the definition of gettid().

Do you know where it is located in glibc ?

see
https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92

In the commit diff at https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92;hp=f289e656ec8221756519a601042bc9fbe1b310fb
I don't see the definition of gettid().

I see the declaration.

There are a bunch of *ABI changes (*.abilist), and test changes (*tst-*).

Quoted 51 lines
Quoted 51 lines

Thanks.

Quoted 49 lines

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399

Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2019-July/029131.html]

---
v2: Fix typos in commit message

 configure.ac            | 1 +
 include/lttng/ust-tid.h | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.ac +1 -0
index 7fa059a..b1099c1 100644
@@ -137,6 +137,7 @@ AC_CHECK_FUNCS([ \
      clock_gettime \
      ftruncate \
      getpagesize \
+     gettid \
      gettimeofday \
      localeconv \
      memchr \
include/lttng/ust-tid.h +5 -2
index e669d7e..7995c78 100644
@@ -26,7 +26,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-
+#include <config.h>
+#if HAVE_GETTID
+#include <unistd.h>
+#else
 #ifdef __linux__
 #include <syscall.h>
 #endif
@@ -49,5 +52,5 @@ static inline pid_t gettid(void)
      return getpid();
 }
 #endif
-
+#endif /* HAVE_GETTID */
 #endif /* _LTTNG_UST_TID_H */

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 30 lines · Sebastien Boisvert
Quoted 17 lines · Khem Raj

Review

Quoted 13 lines · Sebastien Boisvert
Quoted 3 lines · Khem Raj

glibc 2.30 introduced this function see [1]
so it's best to detect it
and provide fallback only if its not present

nit:

(quoted diff) +1 -1
-if its not present
+if it's not present

I sent a v3 with this fixed.

Quoted 8 lines
Quoted 5 lines

I cloned the git repository of the glibc, but I could not find the definition of gettid().

Do you know where it is located in glibc ?

see
https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92

Quoted 7 lines

In the commit diff at https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92;hp=f289e656ec8221756519a601042bc9fbe1b310fb
I don't see the definition of gettid().

I see the declaration.

There are a bunch of *ABI changes (*.abilist), and test changes (*tst-*).

its a syscall wrapper which is generated during build from sysdeps/unix/sysv/linux/syscalls.list

Quoted 52 lines
Quoted 52 lines
Quoted 52 lines

Thanks.

Quoted 49 lines

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399

Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2019-July/029131.html]

---
v2: Fix typos in commit message

 configure.ac            | 1 +
 include/lttng/ust-tid.h | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.ac +1 -0
index 7fa059a..b1099c1 100644
@@ -137,6 +137,7 @@ AC_CHECK_FUNCS([ \
      clock_gettime \
      ftruncate \
      getpagesize \
+     gettid \
      gettimeofday \
      localeconv \
      memchr \
include/lttng/ust-tid.h +5 -2
index e669d7e..7995c78 100644
@@ -26,7 +26,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-
+#include <config.h>
+#if HAVE_GETTID
+#include <unistd.h>
+#else
 #ifdef __linux__
 #include <syscall.h>
 #endif
@@ -49,5 +52,5 @@ static inline pid_t gettid(void)
      return getpid();
 }
 #endif
-
+#endif /* HAVE_GETTID */
 #endif /* _LTTNG_UST_TID_H */

A message that is not in the archive (sent off-list or not yet received): CAMKF1so6z7dk7GkpVLR9bp72c2AD47+j9Cd9xOw=fw8+EG7oQg@mail.gmail.com

#9 lore raw
Quoted 6 lines · Khem Raj
Quoted 2 lines

I don't see the definition of gettid().

its a syscall wrapper which is generated during build from sysdeps/unix/sysv/linux/syscalls.list

OK, now I understand, thanks !