[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pthreads-devel
Subject:    [pthreads-devel] extern vs. static in pth_p.h.in + Java
From:       "Dr. Uwe Girlich" <Uwe.Girlich () philosys ! de>
Date:       2002-06-04 7:51:21
[Download RAW message or body]

Hello list!

I just downloaded ngpt-1.9.2.tar.gz and tried to compile it on RedHat Linux 6.2
(I know, it is old, but it works). In pth_p.h.in several functions are declared
as extern but they are embedded in the header file, so they are in fact static.
The compiler of RH 6.2 does not include the function body (may be a bug of the
compiler), so the test program linking failes with these missing symbols in
the library: 
k_gettid, k_tkill, k_nanosleep, pth_testandset, _pth_release_lock,
_pth_acquire_lock, _pth_try_lock

Attached is a small patch file, which corrects this problem.

After this minimal problem I tried it out (yes, I used Linux 2.4.19-pre8 with
ngpt-cred-2.4.19-pre8.diff and patch-futex-2.4.19-pre8 attached) but unlike
older versions, I could not find the other PID directories in the /proc/pid
directory. Why is this so?

Java 1.3.1 (j2sdk-1_3_1_03-linux-i386-rpm.bin) and 1.4.0
(j2sdk-1_4_0-linux-i386-rpm.bin) both ended with a segfault, if I use my own
compiled ngpt linked to /lib/i686/libpthread.so.0. Is this is a known problem?
Older version of ngpt had problems with missing symbols, this is solved now but
now I get segfault which is equally bad.

How should I track the problem down, are you interested in strace outputs?
Should I try to run Java in gdb?

Bye,
Uwe Girlich


["pth_p.h.in.diff" (text/plain)]

*** pth_p.h.in.orig	Mon May 13 15:53:55 2002
--- pth_p.h.in	Sun Jun  2 19:41:07 2002
***************
*** 176,188 ****
      pth_get_native_descr()->tid
  #endif
  
! extern pid_t k_gettid(void);
! extern int k_tkill(pid_t pid, int sig);
! extern int k_nanosleep(const struct timespec *requested_time, struct timespec *remaining);
! extern int pth_testandset(int * spinlock);
! extern int _pth_release_lock(pth_qlock_t * spinlock, pid_t ptid);
! extern void _pth_acquire_lock(pth_qlock_t * spinlock, pid_t ptid);
! extern int _pth_try_lock(pth_qlock_t * spinlock, pid_t ptid);
  
  #ifndef __NR_gettid
  #if defined(__powerpc__)
--- 176,188 ----
      pth_get_native_descr()->tid
  #endif
  
! static pid_t k_gettid(void);
! static int k_tkill(pid_t pid, int sig);
! static int k_nanosleep(const struct timespec *requested_time, struct timespec *remaining);
! static int pth_testandset(int * spinlock);
! static int _pth_release_lock(pth_qlock_t * spinlock, pid_t ptid);
! static void _pth_acquire_lock(pth_qlock_t * spinlock, pid_t ptid);
! static int _pth_try_lock(pth_qlock_t * spinlock, pid_t ptid);
  
  #ifndef __NR_gettid
  #if defined(__powerpc__)
***************
*** 193,199 ****
  #define __NR_gettid	224
  #endif
  #endif
! extern __inline__ pid_t k_gettid(void) {
  #if defined(__i386__)
  	int __result;
  	__asm__ volatile("int $0x80":"=a"(__result):"0"(__NR_gettid));
--- 193,199 ----
  #define __NR_gettid	224
  #endif
  #endif
! static __inline__ pid_t k_gettid(void) {
  #if defined(__i386__)
  	int __result;
  	__asm__ volatile("int $0x80":"=a"(__result):"0"(__NR_gettid));
***************
*** 212,227 ****
  #define __NR_tkill	238
  #endif
  #endif
! extern __inline__ int k_tkill(pid_t pid, int sig) {
  	return syscall(__NR_tkill, pid, sig);
  }
  
! extern __inline__ int k_nanosleep(const struct timespec *requested_time, struct timespec *remaining) {
  	return syscall(__NR_nanosleep, requested_time, remaining);
  }
  
  
! extern __inline__ int pth_testandset(int * spinlock)
  {
      int ret;
  
--- 212,227 ----
  #define __NR_tkill	238
  #endif
  #endif
! static __inline__ int k_tkill(pid_t pid, int sig) {
  	return syscall(__NR_tkill, pid, sig);
  }
  
! static __inline__ int k_nanosleep(const struct timespec *requested_time, struct timespec *remaining) {
  	return syscall(__NR_nanosleep, requested_time, remaining);
  }
  
  
! static __inline__ int pth_testandset(int * spinlock)
  {
      int ret;
  
***************
*** 270,276 ****
      return ret;
  }
  
! extern __inline__ int _pth_release_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      pid_t tid = 0;
      pth_descr_t descr = NULL;
--- 270,276 ----
      return ret;
  }
  
! static __inline__ int _pth_release_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      pid_t tid = 0;
      pth_descr_t descr = NULL;
***************
*** 300,306 ****
      return 0;
  }
  
! extern __inline__ void _pth_acquire_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      int cnt = 0;
      struct timespec tm;
--- 300,306 ----
      return 0;
  }
  
! static __inline__ void _pth_acquire_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      int cnt = 0;
      struct timespec tm;
***************
*** 337,343 ****
      spinlock->owner = tid;
  }
  
! extern __inline__ int _pth_try_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      pid_t tid = 0;
      pth_descr_t descr = NULL;
--- 337,343 ----
      spinlock->owner = tid;
  }
  
! static __inline__ int _pth_try_lock(pth_qlock_t * spinlock, pid_t ptid)
  {
      pid_t tid = 0;
      pth_descr_t descr = NULL;

_______________________________________________
pthreads-devel mailing list
pthreads-devel@www-124.ibm.com
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/pthreads-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic