xiaoxiang781216 commented on a change in pull request #5014:
URL: https://github.com/apache/incubator-nuttx/pull/5014#discussion_r771982974



##########
File path: include/sys/syscall_lookup.h
##########
@@ -218,6 +218,11 @@ SYSCALL_LOOKUP(pwrite,                     4)
 #ifdef CONFIG_EVENT_FD
   SYSCALL_LOOKUP(eventfd,                  2)
 #endif
+#ifdef CONFIG_TIMER_FD
+  SYSCALL_LOOKUP(timerfd_create,           2)
+  SYSCALL_LOOKUP(timerfd_settime,          4)
+  SYSCALL_LOOKUP(timerfd_gettime,          2)

Review comment:
       > I see no problems with `timerfd_gettime` in such approach, but not 
sure about `timerfd_settime` that needs 3 arguments to be passed. In general 
`int flags, const struct itimerspec *new_value, struct itimerspec *old_value` 
should be packed into intermediate structure and pointer to that structure has 
to be passed to `ioctl` call. I also do not have any issues with that, but the 
question comes where the declaration of that intermediate type should be 
located? Should I call something like
   > 
   > ```
   > typedef struct
   > {
   >   int flags;
   >   const struct itimerspec *new_value;
   >   struct itimerspec *old_value;
   > } timerfd_settime_t;
   > ```
   > 
   > into `timerfd.h`? @xiaoxiang781216 what is your opinion?
   
   Yes, it's reasonable. BTW, it's better to use struct directly and change 
pointer to value, like this:
   ```
    struct timerfd_settime_s
    {
      int flags;
      struct itimerspec new_value;
      struct itimerspec old_value;
    };
   ```
   
   > Also `eventfd_read` and `eventfd_write` are `glibc` functions by 
definition. While `timerfd` APIs are a syscalls in Linux
   
   Once we move the action into `timerfd_ioctl`, `timerfd_settime` and 
`timerfd_gettime` can be changed to `libc` function just like `eventfd_read` 
and `eventfd_write`. Only, `timerfd_create` still keep as the syscall.




-- 
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