xiaoxiang781216 commented on code in PR #3192: URL: https://github.com/apache/nuttx-apps/pull/3192#discussion_r2454947086
########## system/init/builtin.c: ########## @@ -0,0 +1,237 @@ +/**************************************************************************** + * apps/system/init/builtin.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 <errno.h> +#include <stdlib.h> +#include <string.h> +#include <spawn.h> +#include <sys/param.h> +#include <sys/wait.h> + +#include "builtin.h" +#include "init.h" +#include "service.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct cmd_map_s +{ + FAR const char *cmd; + uint8_t minargs; + uint8_t maxargs; + CODE int (*func)(FAR struct action_manager_s *, int, FAR char **); +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int cmd_trigger(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_exec_start(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_start(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_stop(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_exec(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_class_start(FAR struct action_manager_s *am, + int argc, FAR char **argv); +static int cmd_class_stop(FAR struct action_manager_s *am, + int argc, FAR char **argv); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct cmd_map_s g_builtin[] = +{ + {"class_start", 2, 2, cmd_class_start}, + {"class_stop", 2, 2, cmd_class_stop}, + {"exec", 3, 99, cmd_exec}, + {"exec_start", 2, 2, cmd_exec_start}, + {"start", 2, 2, cmd_start}, + {"stop", 2, 2, cmd_stop}, + {"trigger", 2, 2, cmd_trigger}, +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int cmd_class_start(FAR struct action_manager_s *am, Review Comment: this function is called through pointer, inline can't help here anyway. -- 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]
