< prev index next >

src/os/linux/vm/os_linux.cpp

Print this page




 235   return privileges;
 236 }
 237 
 238 
 239 #ifndef SYS_gettid
 240 // i386: 224, ia64: 1105, amd64: 186, sparc 143
 241 #ifdef __ia64__
 242 #define SYS_gettid 1105
 243 #elif __i386__
 244 #define SYS_gettid 224
 245 #elif __amd64__
 246 #define SYS_gettid 186
 247 #elif __sparc__
 248 #define SYS_gettid 143
 249 #else
 250 #error define gettid for the arch
 251 #endif
 252 #endif
 253 
 254 // Cpu architecture string
 255 #if   defined(ZERO)
 256 static char cpu_arch[] = ZERO_LIBARCH;
 257 #elif defined(IA64)
 258 static char cpu_arch[] = "ia64";
 259 #elif defined(IA32)
 260 static char cpu_arch[] = "i386";
 261 #elif defined(AMD64)
 262 static char cpu_arch[] = "amd64";
 263 #elif defined(ARM)
 264 static char cpu_arch[] = "arm";
 265 #elif defined(PPC32)
 266 static char cpu_arch[] = "ppc";
 267 #elif defined(PPC64)
 268 static char cpu_arch[] = "ppc64";
 269 #elif defined(SPARC)
 270 #  ifdef _LP64
 271 static char cpu_arch[] = "sparcv9";
 272 #  else
 273 static char cpu_arch[] = "sparc";
 274 #  endif
 275 #else
 276 #error Add appropriate cpu_arch setting
 277 #endif
 278 
 279 
 280 // pid_t gettid()
 281 //
 282 // Returns the kernel thread id of the currently running thread. Kernel
 283 // thread id is used to access /proc.
 284 //
 285 // (Note that getpid() on LinuxThreads returns kernel thread id too; but
 286 // on NPTL, it returns the same pid for all threads, as required by POSIX.)
 287 //
 288 pid_t os::Linux::gettid() {
 289   int rslt = syscall(SYS_gettid);
 290   if (rslt == -1) {
 291      // old kernel, no NPTL support
 292      return getpid();
 293   } else {
 294      return (pid_t)rslt;
 295   }
 296 }
 297 
 298 // Most versions of linux have a bug where the number of processors are




 235   return privileges;
 236 }
 237 
 238 
 239 #ifndef SYS_gettid
 240 // i386: 224, ia64: 1105, amd64: 186, sparc 143
 241 #ifdef __ia64__
 242 #define SYS_gettid 1105
 243 #elif __i386__
 244 #define SYS_gettid 224
 245 #elif __amd64__
 246 #define SYS_gettid 186
 247 #elif __sparc__
 248 #define SYS_gettid 143
 249 #else
 250 #error define gettid for the arch
 251 #endif
 252 #endif
 253 
 254 // Cpu architecture string
 255 static char cpu_arch[] = HOTSPOT_LIB_ARCH;























 256 
 257 // pid_t gettid()
 258 //
 259 // Returns the kernel thread id of the currently running thread. Kernel
 260 // thread id is used to access /proc.
 261 //
 262 // (Note that getpid() on LinuxThreads returns kernel thread id too; but
 263 // on NPTL, it returns the same pid for all threads, as required by POSIX.)
 264 //
 265 pid_t os::Linux::gettid() {
 266   int rslt = syscall(SYS_gettid);
 267   if (rslt == -1) {
 268      // old kernel, no NPTL support
 269      return getpid();
 270   } else {
 271      return (pid_t)rslt;
 272   }
 273 }
 274 
 275 // Most versions of linux have a bug where the number of processors are


< prev index next >