Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2011 04:46:14 +0400
From:      Pan Tsu <inyaoo@gmail.com>
To:        freebsd-gecko@freebsd.org
Cc:        freebsd-chromium@freebsd.org
Subject:   Re: [SVN-Commit] r544 - in branches/experimental/www/firefox-devel: . files
Message-ID:  <86bozpnauh.fsf@gmail.com>
In-Reply-To: <201104282319.p3SNJu3R000246@trillian.chruetertee.ch> (svn-freebsd-gecko@chruetertee.ch's message of "Thu, 28 Apr 2011 23:19:56 GMT")
References:  <201104282319.p3SNJu3R000246@trillian.chruetertee.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
svn-freebsd-gecko@chruetertee.ch writes:

> Author: flo
> Date: Thu Apr 28 23:19:55 2011
> New Revision: 544
>
> Log:
> - add a new firefox-devel port which contains a snapshot of the Mozilla Firefox
>   Aurora Channel. Mozilla does not provide source tar balls for this channel
>   we will create snapshots on a regular basis.

> - enable ipc, based on a patch by Pan Tsu <inyaoo@gmail.com>
[...]
>  #elif defined(OS_LINUX)
> -  return syscall(__NR_gettid);
> +  // TODO(BSD): find a better thread ID
> +  return reinterpret_cast<int64>(pthread_self());
>  #endif

Why not use undocumented thr_self(2) syscall like emulators/wine does?

  $ ./test
  pthread_self() = 159413248
  thr_self() = 101107
  pthread_getthreadid_np() = 101107
  procstat -t = 101107

  // wine-1.3.18/dlls/ntdll/server.c
  static int get_unix_tid(void)
  {
      int ret = -1;
  #ifdef linux
      ret = syscall( SYS_gettid );
  #elif defined(__sun)
      ret = pthread_self();
  #elif defined(__APPLE__)
      ret = mach_thread_self();
      mach_port_deallocate(mach_task_self(), ret);
  #elif defined(__FreeBSD__)
      long lwpid;
      thr_self( &lwpid );
      ret = lwpid;
  #endif
      return ret;
  }

%%
Index: www/firefox-devel/files/patch-ipc-chromium-src-base-platform_thread_posix.cc
===================================================================
--- www/firefox-devel/files/patch-ipc-chromium-src-base-platform_thread_posix.cc	(revision 544)
+++ www/firefox-devel/files/patch-ipc-chromium-src-base-platform_thread_posix.cc	(working copy)
@@ -1,12 +1,25 @@
 --- ipc/chromium/src/base/platform_thread_posix.cc.orig	2011-04-27 09:34:28.000000000 +0200
 +++ ipc/chromium/src/base/platform_thread_posix.cc	2011-04-27 19:47:36.344446266 +0200
-@@ -34,7 +33,8 @@
+@@ -10,6 +10,7 @@
+ #include <mach/mach.h>
+ #elif defined(OS_LINUX)
+ #include <sys/syscall.h>
++#include <pthread_np.h>
+ #include <unistd.h>
+ #endif
+ 
+@@ -34,7 +33,13 @@ PlatformThreadId PlatformThread::Current
  #if defined(OS_MACOSX)
    return mach_thread_self();
  #elif defined(OS_LINUX)
 -  return syscall(__NR_gettid);
-+  // TODO(BSD): find a better thread ID
-+  return reinterpret_cast<int64>(pthread_self());
++  long lwpid;
++#if __FreeBSD_version < 900031
++  thr_self(&lwpid);
++#else
++  lwpid = pthread_getthreadid_np();
++#endif
++  return lwpid;
  #endif
  }
  
%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86bozpnauh.fsf>