[PATCH] D43909: [3/3] OpenBSD UBsan support / common

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 04:49:41 PST 2018


krytarowski added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:476
 tid_t GetTid() {
-#if SANITIZER_FREEBSD || SANITIZER_OPENBSD
-  return (uptr)pthread_self();
+#if SANITIZER_FREEBSD || SANITIZER_SOLARIS
+  return (uptr)thr_self();
----------------
devnexen wrote:
> krytarowski wrote:
> > This is still wrong. thr_self returns 0 on success, -1 on error.
> > 
> > Cast to (uptr) in both cases is wrong.
> > 
> > Also tid_t shall be corrected and marked u64 for everybody.
> On Solaris ? Because on FreeBSD it s thread_t type.
FreeBSD 11.1 notes:

```
SYNOPSIS
     #include <sys/thr.h>

     int
     thr_self(long *id);
```


https://reviews.llvm.org/D43909





More information about the llvm-commits mailing list