| Author |
Message |
|
|
Post subject: How to get other process data ?
Posted: Apr 21, 2008 - 10:12 AM
|
|
Senior Member
Joined: May 16, 2006
Posts: 136
|
|
I have process with some threads and every thread has its own name:
pthread_key_t th_key;
char* th_buff = "sysinfo.main_thread";
pthread_key_create( &th_key, NULL );
pthread_setspecific( th_key, (void *)th_buff );
When I get tls data (in other process):
struct _thread_local_storage tls;
devctl( fd, DCMD_PROC_TIDSTATUS, ... );
lseek64( fd, ... )
read( fd, &tls, sizeof(struct _thread_local_storage) );
it gives me pointer to th_buff string,
but it is not within my process so I cannot read it:
(char *)tls.keydata[0]
How to read this pointer (outside owner process)?
/or how to set thread name and than get it? |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: How to get other process data ?
Posted: Apr 21, 2008 - 12:57 PM
|
|
Senior Member
Joined: Jul 22, 2004
Posts: 353
|
|
if this are different processes, the memory would be protected against another access.
So try putting your data into a shared memory object, whicht could be read
from other processes too. (shm_*) |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: How to get other process data ?
Posted: Apr 21, 2008 - 03:38 PM
|
|
QNX Master
Joined: Jun 25, 2003
Posts: 1099
|
|
| Why not send the name instead of a pointer to the name? Micro, I think if he uses shared memory that it will defeat the purpose as he most likely will no longer be able to distinguish one thread from another, which sounds important. On top of that, the address will not be the same unless the shared memory is aligned, although an offset would be. |
|
|
| |
|
|
|
 |
|
|
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group Credits |
|
|