acassis commented on code in PR #3504:
URL: https://github.com/apache/nuttx-apps/pull/3504#discussion_r3310798075


##########
system/nxinit/service.c:
##########
@@ -0,0 +1,682 @@
+/****************************************************************************
+ * apps/system/nxinit/service.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/clock.h>
+#include <sys/boardctl.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <signal.h>
+#include <spawn.h>
+#include <sys/param.h>
+
+#include "init.h"
+#include "parser.h"
+#include "service.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define SYSTEM_NXINIT_SERVICE_GENTLE_KILL_TIMEOUT 200
+
+#define check_flags(s, f) ((s)->flags & (f))
+
+#ifdef CONFIG_SYSTEM_NXINIT_DEBUG
+#  define dump_flags(fmt, flags) \
+          do \
+            { \
+              size_t _i; \
+              for (_i = 0; _i < nitems(g_flag_str); _i++) \
+                { \
+                  if (g_flag_str[_i].flag & (flags)) \
+                    { \
+                      init_debug(fmt, g_flag_str[_i].str); \
+                    } \
+                } \
+            } \
+          while(0)
+#else
+#  define dump_flags(...)
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct cmd_map_s
+{
+  FAR const char *cmd;
+  uint8_t minargs;
+  uint8_t maxargs;
+  int (*func)(FAR struct service_manager_s *, int, FAR char **);
+};
+
+#ifdef CONFIG_SYSTEM_NXINIT_DEBUG
+struct flag_str_s
+{
+  uint32_t flag;
+  FAR const char *str;
+};
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int option_class(FAR struct service_manager_s *sm,
+                        int argc, FAR char **argv);
+static int option_gentle_kill(FAR struct service_manager_s *sm,
+                              int argc, FAR char **argv);
+static int option_restart_period(FAR struct service_manager_s *sm,
+                                 int argc, FAR char **argv);
+static int option_override(FAR struct service_manager_s *sm,
+                           int argc, FAR char **argv);
+static int option_oneshot(FAR struct service_manager_s *sm,
+                          int argc, FAR char **argv);
+#ifdef CONFIG_BOARDCTL_RESET
+static int option_reboot_on_failure(FAR struct service_manager_s *sm,
+                                    int argc, FAR char **argv);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct cmd_map_s g_option[] =
+{
+  {"class", 2, 99, option_class},

Review Comment:
   Ok, I created a NXINIT_ACTION_CMD_ARGS_MAX, but kept the value of 99. Since 
it is not allocated, not a big issue



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