patacongo commented on a change in pull request #3517: URL: https://github.com/apache/incubator-nuttx/pull/3517#discussion_r611645689
########## File path: include/nuttx/tls.h ########## @@ -78,10 +78,17 @@ struct tls_info_s #if CONFIG_TLS_NELEM > 0 uintptr_t tl_elem[CONFIG_TLS_NELEM]; /* TLS elements */ #endif - FAR struct libvars_s *tl_libvars; /* Task-specific C library data */ int tl_errno; /* Per-thread error number */ }; +struct task_info_s +{ + struct tls_info_s ta_tls; /* Must be first field */ +#ifndef CONFIG_BUILD_KERNEL + struct getopt_s ta_getopt; /* Globals used by getopt() */ +#endif Review comment: This is incorrect. This mean that there will be a copy of the getopt() variables in every thread right? But only the copy in the main thread will used. This seems wrong. Before your questionable change, there was a single copy of the getopt() variables in the main thread created by up_stack_frame. Each thread pointed to that single copied. But it looks like you have ruined that. Your solution is incorrect. It is VERY important to restore this to the way it was. The number of per-task variables will grow a lot (see #3168). It is critical that there be only a single copy of the per-task data. Please revert this change. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org