xiaoxiang781216 commented on code in PR #20130:
URL: https://github.com/apache/nuttx/pull/20130#discussion_r4019189375


##########
include/nuttx/fdpic.h:
##########
@@ -105,24 +105,23 @@ static inline FAR void *fdpic_callback(FAR void *fn)
  *   carries no module base.  Elsewhere fdpic_callback() is enough.
  *
  * Input Parameters:
- *   arg   - The one word argument.
- *   entry - The code address to enter, already resolved from the descriptor.
- *   got   - The module data base to install.
+ *   arg  - The one word argument.
+ *   desc - The entry point to enter and the data base to install.
  *
  ****************************************************************************/
 
-static inline void fdpic_invoke(uintptr_t arg, uintptr_t entry,
-                                uintptr_t got)
+static inline void fdpic_invoke(uintptr_t arg,
+                                FAR const struct fdpic_desc_s *desc)
 {
-  up_fdpic_invoke(arg, entry, got);
+  up_fdpic_invoke(arg, desc->entry, desc->got);
 }
 
 #else
 
 #  define fdpic_base()       (0)
 #  define fdpic_callback(fn) (fn)
-#  define fdpic_invoke(arg, entry, got) \
-          ((void)(got), (((CODE void (*)(uintptr_t))(uintptr_t)(entry))(arg)))
+#  define fdpic_invoke(arg, desc) \
+          (((CODE void (*)(uintptr_t))(uintptr_t)(desc)->entry)(arg))

Review Comment:
   should we cast desc to function pointer directly for no fdpic case?



##########
sched/signal/sig_notification.c:
##########
@@ -70,7 +74,23 @@ static void nxsig_notification_worker(FAR void *arg)
 
   /* Perform the callback */
 
+#ifdef CONFIG_FDPIC
+  /* The worker does not carry the module's data base.  Install the base
+   * captured at registration around the call.  A zero base means the
+   * callback is not a module's.
+   */
+
+  if (work->desc.got != 0)
+    {
+      fdpic_invoke((uintptr_t)work->value.sival_ptr, &work->desc);

Review Comment:
   why not call `fdpic_invoke(work->value, xxx->sigev_notify_function)` 
directly? and remove the change in mq_notify.c and desc field in sigwork_s.



##########
libs/libc/dirent/lib_scandir.c:
##########


Review Comment:
   why not change to `fdpic_invoke(d, filter)` here? and revert the change at 
line 103



##########
libs/libc/signal/sig_signal.c:
##########
@@ -71,6 +71,10 @@ _sa_handler_t signal(int signo, _sa_handler_t func)
 
   DEBUGASSERT(func != SIG_ERR && func != SIG_HOLD);
 
+  /* Not resolved here.  nxsig_action() resolves the handler, which covers

Review Comment:
   revert



##########
include/nuttx/signal.h:
##########
@@ -67,7 +70,14 @@ struct sigwork_s
 {
   struct work_s work;           /* Work queue structure */
   union sigval value;           /* Data passed with notification */
+#ifdef CONFIG_FDPIC
+  struct fdpic_desc_s desc;     /* Notification function, and the data base
+                                 * of a module callback or zero.  The base is
+                                 * captured at registration and installed
+                                 * around the call on the worker thread. */
+#else
   sigev_notify_function_t func; /* Notification function */

Review Comment:
   why need define desc at line 74? I suppose that func should point to 
fdpic_desc_s in fdpic case.



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