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 2021/07/01 17:54:18 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4027: sched: Restore the prototype of task_spawn

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



##########
File path: libs/libc/spawn/lib_task_spawn.c
##########
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * libs/libc/spawn/lib_task_spawn.c
+ *
+ * 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/config.h>
+
+#include <spawn.h>
+#include <nuttx/spawn.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: task_spawn
+ *
+ * Description:
+ *   This function marshals task_spwan() parameters and invokes the
+ *   nx_task_spawn() system call.
+ *
+ *   task_spawn() and posix_spawn() are NuttX OS interfaces.  In PROTECTED
+ *   and KERNEL build modes, then can be reached from applications only via

Review comment:
       Done.

##########
File path: libs/libc/spawn/lib_task_spawn.c
##########
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * libs/libc/spawn/lib_task_spawn.c
+ *
+ * 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/config.h>
+
+#include <spawn.h>
+#include <nuttx/spawn.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: task_spawn
+ *
+ * Description:
+ *   This function marshals task_spwan() parameters and invokes the
+ *   nx_task_spawn() system call.
+ *
+ *   task_spawn() and posix_spawn() are NuttX OS interfaces.  In PROTECTED
+ *   and KERNEL build modes, then can be reached from applications only via
+ *   a system call.  Currently, the number of parameters in a system call
+ *   is limited to six; these spawn function have seven parameters.  Rather
+ *   than extend the maximum number of parameters across all architectures,
+ *   I opted instead to marshal the seven parameters into a structure.
+ *
+ *
+ * Input Parameters:
+ *   file_actions - The address of the posix_spawn_file_actions_t to be
+ *   initialized.
+ *
+ * Returned Value:
+ *   On success, these functions return 0; on failure they return an error
+ *   number from <errno.h>.
+ *
+ ****************************************************************************/
+
+int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry,
+               FAR const posix_spawn_file_actions_t *file_actions,
+               FAR const posix_spawnattr_t *attr,
+               FAR char * const argv[], FAR char * const envp[])
+{
+  int ret;
+
+  ret = nxtask_spawn(name, entry, file_actions, attr, argv, envp);
+  if (ret < 0)
+    {
+      -ret;

Review comment:
       Done.

##########
File path: libs/libc/spawn/lib_task_spawn.c
##########
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * libs/libc/spawn/lib_task_spawn.c
+ *
+ * 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/config.h>
+
+#include <spawn.h>
+#include <nuttx/spawn.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: task_spawn
+ *
+ * Description:
+ *   This function marshals task_spwan() parameters and invokes the

Review comment:
       Done.




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