patacongo commented on issue #37: examples: hello: Show CPU index when running in SMP mode URL: https://github.com/apache/incubator-nuttx-apps/pull/37#issuecomment-580560510 "Yes, hello isn't a good place but how about apps/testing/smp/smp_main.c? It's reasonable to query the current cpu for the diagnose, actually it call up_cpu_index now!" This is incorrect. Nothing in apps/ can call up_cpuindex(). That violates the portable POSIX interface and will not work in PROTECTED or KERNEL mode. In those modes, there must be system calls. I am still opposed to this as will and will close and/or revert any such PR. It is just a bad idea no metter where you put it. The interface does not work. It serves no functional pupose because it DOES NOT tell you CPU you are running on; it tells what CPU you were running on in the past. So the returned CPU number cannot be used programmatically for anything meaninful. I will do everything to prevent the implementation of the non-standard interface. It is wrong in so many ways. These best way to print the CPU number would to be extend syslog so that when SMP is enabled it decorates each syslog output with the CPU number. This is done inside the OS and so does not require any special application interface. Then a special version of "Hello, World!" that uses syslog could safely print the CPU number at the moment that the syslog() executes. That would show the CPU, remain POSIX compliant, and would work in PROTECTED and KERNEL builds without introducing a useless system call.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
