pussuw commented on PR #12320:
URL: https://github.com/apache/nuttx/pull/12320#issuecomment-2404748839

   @yf13 yes apparently getprogname() was the only reference from children 
threads to the group argument vector, so maybe I'm just foaming about nothing.
   
   Why I started foaming:
   It made no sense to me that the threads of a process could not access the 
process argument vector but this is just nonsense; the program can always make 
a local copy or reference for them (in case of just making a reference it would 
cause the same crash as getprogname did previously; the parent stack / TLS is 
simply released too soon).
   
   Making getprogname() to work from pthreads is quite simple, just make a 
const char * reference to TLS and point the parent argv[0] to it (making sure 
the string is NOT released before the process itself has completed / fully 
exited). In kernel mode it's even easier, you don't need TLS just declare 
something similar to __thread instead (as every process has its own address 
environment).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to