|
From: Tom H. <th...@cy...> - 2004-10-13 08:27:30
|
There is an issue with a number of kernels in the 2.4.7-2.4.9 time frame which seem to have had the getpid system call changed to return the ID of the process (ie of the main thread) but which have not yet had the gettid system call added to get the ID of the current thread. I'm not entirely sure if this is an issue in the master kernel source or only in certain RedHat patched kernels, but it has come up a number of times - bug 82114 is the main bug but it has others attached. The problem is that VG_(gettid) needs to get the ID of the current thread and it assumes that if the gettid system call returns ENOSYS then the getpid system call will do that. On the broken systems it gets the wrong ID and all sorts of wierd things happen. I have a patch of sorts, but it is horrible. Basically if gettid fails then instead of using getpid we do a readlink on /proc/self and use what it points to as the thread ID. This seems to work, but it is horrible, so what do people think about putting it in? or does anybody have a better way to get the real ID of the current thread on these systems? Tom -- Tom Hughes (th...@cy...) Software Engineer, Cyberscience Corporation http://www.cyberscience.com/ |