The stream ID type is free and can be executed in any version by different compilers. You can draw as a list of bytes like this:
// g++ -Wall -Wpedantic showthrid.cpp # include <iostream> typedef union { volatile pthread_t tid; volatile uint8_t bid [sizeof(pthread_t)]; } uid ; int main(){ uid u ; u.tid = pthread_self(); std::cout<<"pthread_self = "<<std::hex; for(int i=sizeof(pthread_t);i;){ -- i ; std::cout<<((unsigned int )u.bid[i])<<"."; } std::cout<<std::endl; std::cout<<" = "<<((size_t)u.tid)<<std::endl; } $ ./a.out pthread_self = 0.0.7f.3b.21.d0.4d.80. = 7f3b21d04d80
And if you find a numeric type with the right size, then throw that value onto that type. I have a size of 8 bytes. That is, you can cram into size_t .
syscall(SYS_gettid)- VTTtypedef unsigned long int pthread_t;so cast into this type before output. - NewView 1:14 pmpthread_tis of arithmetic type. Trying to print it this way is useless. - AnT 1:14 pm