Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Another data item that should, eventually, be included in the TLS data is the process ID (pid) of the currently executing thread. In some analysis of PROTECTED and KERNEL builds, it was found that getpid() was the most highly accessed OS interface. By moving the PID into TLS, we could eliminate this system call overhead (at least in the aligned TLS case).  The same mechanism would be used by pthread_self() which, in NuttX, would be the equivalent function, but following pthread semantics.

Streams

In NuttX, C buffered I/O streams are represented with a pre-group array of type FILE.  A stream is accessed from the OS vis the nxched_get_streams() interface (system call).  The streams array is not used by OS and would be another candidate to move into TLS.

Re-Entrant getopt()

getopt() is an important C library function used by applications for parsing of task command line parameters.  It is, however, not re-entrant due to the use of global variables:  optarg, opterr, optind, and optopt. There are several, non-standard implementations for a re-entrant version of called getopt_r(), however, these are all wildly different and do not conform to any standard.  Non-standard interfaces are not desirable in NuttX.

...