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

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 04:54:47 PST 2018


devnexen 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();
----------------
krytarowski wrote:
> 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);
> ```
You got a point I looked at the wrong man page :-) 
https://www.freebsd.org/cgi/man.cgi?query=thr_self&manpath=SunOS+5.10


https://reviews.llvm.org/D43909





More information about the llvm-commits mailing list