You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/14 13:00:25 UTC

[GitHub] [incubator-nuttx] pkarashchenko opened a new pull request, #6433: sched: expose nxsched_ set/get APIs as system calls

pkarashchenko opened a new pull request, #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433

   ## Summary
   - expose nxsched_ set/get APIs as syscalls
   - move corresponding sched_ and pthread_ set/get APIs to libc
   - remove _SCHED_XXXX macro based interface
   - reduce number of system calls
   - use nxsched_ set/get APIs in kernel code
   - remove libc stubs for `task_testcancel()` and `task_setcanceltype`
   
   ## Impact
   Should be none. Refactoring only
   
   ## Testing
   Pass CI


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   
   #define __nx_private__
   #define __nx_coreos__
   #define __nx_panecake__
   
   __nx_private__   ... nxsched_get_param (... )
   __nx_coreos__    ... nxsched_get_param (... )
   __nx_panecake__  ... nxsched_get_param (... )
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) similar namespace for functions that should be called only within the OS vs. functions that can be called only from applications.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897235697


##########
arch/arm/src/cxd56xx/cxd56_farapi.c:
##########
@@ -196,14 +196,14 @@ void farapi_main(int id, void *arg, struct modulelist_s *mlist)
     {
       /* Save the current cpuset */
 
-      sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset0);
+      nxsched_get_affinity(getpid(), sizeof(cpu_set_t), &cpuset0);

Review Comment:
   This is a kernel code. No need to call user space APIs here



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   
   #define __nx_private__
   #define __nx_coreos__
   #define __nx_panecake__
   #define __nx_libc__
   
   __nx_private__        ... nxsched_get_param (... )
   __nx_coreos__         ... nxsched_get_param (... )
   __nx_panecake__       ... nxsched_get_param (... )
   
   
   me I would dream 
   __nx_posix_version__  ... sched_getparam  (... )
   
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   
   
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897232384


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   I think there is no explicit rule. If I understand correctly there was an idea to have a POSIX interface as a syscall layer. But looking into syscall list seems that it is not possible.
   I'll convert this PR to draft to keep discussion here.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897233022


##########
arch/arm/src/cxd56xx/cxd56_farapi.c:
##########
@@ -196,14 +196,14 @@ void farapi_main(int id, void *arg, struct modulelist_s *mlist)
     {
       /* Save the current cpuset */
 
-      sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset0);
+      nxsched_get_affinity(getpid(), sizeof(cpu_set_t), &cpuset0);

Review Comment:
   I do not create a new API and just move things around in this PR



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897222929


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   what' rule to add or not add the nx prefix?



##########
include/cxx/csched:
##########
@@ -44,6 +44,12 @@ namespace std
   using ::sched_get_priority_max;
   using ::sched_get_priority_min;
   using ::sched_rr_get_interval;
+#ifdef CONFIG_SMP

Review Comment:
   But, csched is never a standard c++ header. It's better to let C++ code include sched.h directly.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#issuecomment-1624178499

   > @patacongo what is your opinion on making nx API a system calls and implement most of POSIX APIs a libc wrapper? Do you see this benefitial from structure simplification and errno modification point of view?
   
   Yes, in fact I have advocated that for a long time.  I would like to see the application-callable interface in libc that sets the errno and manages cancellation points.  It would then call the nx* version of the interface that performs the basic function.  We then need to be sure that no functions defined in the OS or in libc calls the application interface, but always calls the nx* interface.
   
   That would prevent nested cancellation points and also sneak paths that convert normal application interfaces into cancellation points (like #9716).  @xiaoxiang781216 have discussed this several times.
   
   The only complex part is that cancellation points only work inside the OS.  That is what would have to be fixed first.  I suspect that moving the cancellation data structures into TLS might solve that problem but I have not really looked into that.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   
   #define __nx_private__
   #define __nx_coreos__
   #define __nx_panecake__
   
   __nx_private__        ... nxsched_get_param (... )
   __nx_coreos__         ... nxsched_get_param (... )
   __nx_panecake__       ... nxsched_get_param (... )
   
   
   me I would dream in any OS implementation 
   __nx_posix_version__  ... sched_getparam  (... )
   
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   
   
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897249956


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   I mean that I'm open to any rules if they are serving common sense and are accepted by others.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   
   #define __nx_private__
   #define __nx_coreos__
   #define __nx_panecake__
   #define __nx_libc__
   
   __nx_private__        ... nxsched_get_param (... )
   __nx_coreos__         ... nxsched_get_param (... )
   __nx_panecake__       ... nxsched_get_param (... )
   
   
   me I would dream in any OS implementation 
   __nx_posix_version__  ... sched_getparam  (... )
   
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   
   
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The original idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS (or libc) vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performs application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.  Then they call the corresponding nx* function to perform the core functionality.
   
   Lots of OS internal functions do not begin with nx*.  Is that a problem?  I don't think so if it impossible to confuse them with user APIs.
   
   Other OS function naming rules: https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
   
   That explains why sched_getaffinity() corresponds to nxsched_get_affinity()
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897604919


##########
include/cxx/csched:
##########
@@ -44,6 +44,12 @@ namespace std
   using ::sched_get_priority_max;
   using ::sched_get_priority_min;
   using ::sched_rr_get_interval;
+#ifdef CONFIG_SMP

Review Comment:
   I will 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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#issuecomment-1624152462

   @patacongo what is your opinion on making nx API a system calls and implement most of POSIX APIs a libc wrapper? Do you see this benefitial from structure simplification and errno modification point of view?


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS (or libc) vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performs application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.  Then they call the corresponding nx* function to perform the core functionality.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897504364


##########
include/cxx/csched:
##########
@@ -44,6 +44,12 @@ namespace std
   using ::sched_get_priority_max;
   using ::sched_get_priority_min;
   using ::sched_rr_get_interval;
+#ifdef CONFIG_SMP

Review Comment:
   Yes, here is the patch: https://github.com/apache/incubator-nuttx/pull/6434



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   
   #define __nx_private__
   #define __nx_coreos__
   #define __nx_panecake__
   
   __nx_private__        ... nxsched_get_param (... )
   __nx_coreos__         ... nxsched_get_param (... )
   __nx_panecake__       ... nxsched_get_param (... )
   
   
   me I would dream in any OS implementation 
   __nx_posix_$version__  ... sched_getparam  (... )
   
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   
   
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS (or libc) vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performs application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.  Then they call the corresponding nx* function to perform the core functionality.
   
   Lots of OS internal functions do not begin with nx*.  Is that a problem?  I don't think so if it impossible to confuse them with user APIs.
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) similar namespace for functions that should be called only within the OS vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performance application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The original idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS (or libc) vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performs application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.  Then they call the corresponding nx* function to perform the core functionality.
   
   Lots of OS internal functions do not begin with nx*.  Is that a problem?  I don't think so if it impossible to confuse them with user APIs.
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   __nx_private__ ... nxsched_get_param (... )



##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```__nx_private__ ... nxsched_get_param (... )```
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
acassis commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897231328


##########
arch/arm/src/cxd56xx/cxd56_farapi.c:
##########
@@ -196,14 +196,14 @@ void farapi_main(int id, void *arg, struct modulelist_s *mlist)
     {
       /* Save the current cpuset */
 
-      sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset0);
+      nxsched_get_affinity(getpid(), sizeof(cpu_set_t), &cpuset0);

Review Comment:
   @pkarashchenko since the POSIX API name is sched_getaffinity/setaffinity, shouldn't be better to create nxsched_getaffinity/setaffinity?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897235287


##########
arch/arm/src/cxd56xx/cxd56_farapi.c:
##########
@@ -196,14 +196,14 @@ void farapi_main(int id, void *arg, struct modulelist_s *mlist)
     {
       /* Save the current cpuset */
 
-      sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset0);
+      nxsched_get_affinity(getpid(), sizeof(cpu_set_t), &cpuset0);

Review Comment:
   POSIX sched_getaffinity/setaffinity is kept unchanged, but just moved to libc



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6433:
URL: https://github.com/apache/incubator-nuttx/pull/6433#discussion_r897230196


##########
include/cxx/csched:
##########
@@ -44,6 +44,12 @@ namespace std
   using ::sched_get_priority_max;
   using ::sched_get_priority_min;
   using ::sched_rr_get_interval;
+#ifdef CONFIG_SMP

Review Comment:
   I just extended existing functionality. Do you recommend removing this file at all?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] mu578 commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "mu578 (via GitHub)" <gi...@apache.org>.
mu578 commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254897266


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   yes I concur make syscalls private ; not forcibly by programming or compiler extension but by tagging like
   
   ```c
   __nx_private__   ... nxsched_get_param (... )
   __nx_coreos__    ... nxsched_get_param (... )
   __nx_panecake__  ... nxsched_get_param (... )
   ```
   
   whatever the naming convention ; it is all about being explicit, and with an editor to be able to search them.
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performs application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] patacongo commented on a diff in pull request #6433: sched: expose nxsched_ set/get APIs as system calls

Posted by "patacongo (via GitHub)" <gi...@apache.org>.
patacongo commented on code in PR #6433:
URL: https://github.com/apache/nuttx/pull/6433#discussion_r1254818887


##########
include/sys/syscall_lookup.h:
##########
@@ -33,13 +33,13 @@ SYSCALL_LOOKUP(gettid,                     0)
   SYSCALL_LOOKUP(getppid,                  0)
 #endif
 
-SYSCALL_LOOKUP(sched_getparam,             2)
-SYSCALL_LOOKUP(sched_getscheduler,         1)
+SYSCALL_LOOKUP(nxsched_get_param,          2)
+SYSCALL_LOOKUP(nxsched_get_scheduler,      1)
 SYSCALL_LOOKUP(sched_lock,                 0)

Review Comment:
   > what' rule to add or not add the nx prefix?
   
   The idea in the naming was to create a separate (but very similar) namespace for functions that should be called only within the OS vs. functions that can be called only from applications.
   
   Often the nx* named functions and application interface of the same name differ only in that the application interface performance application related housekeeping like setting the errno value and/or handling cancellation points, neither of which apply within the OS.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org