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 14:10:23 UTC
[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #4027: sched: Restore the prototype of task_spawn
xiaoxiang781216 opened a new pull request #4027:
URL: https://github.com/apache/incubator-nuttx/pull/4027
## Summary
which was changed in this commit:
```
commit ae216cf9e92e91b4b74d91d3fbd9079839df13ba
Author: Xiang Xiao <xi...@xiaomi.com>
Date: Wed May 12 11:34:50 2021 +0800
sched/task: Simplify the syscall handling of task_spawn
It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.
```
Note: The implementation isn't really changed.
## Impact
Avoid API compability issue
## Testing
--
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
[GitHub] [incubator-nuttx] hartmannathan commented on a change in pull request #4027: sched: Restore the prototype of task_spawn
Posted by GitBox <gi...@apache.org>.
hartmannathan commented on a change in pull request #4027:
URL: https://github.com/apache/incubator-nuttx/pull/4027#discussion_r662388058
##########
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:
`s/task_spwan/task_spawn/`
##########
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:
This line (`-ret;`) isn't doing anything.
##########
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:
`s/then/they/`
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4027: sched: Restore the prototype of task_spawn
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4027:
URL: https://github.com/apache/incubator-nuttx/pull/4027#issuecomment-873597804
Ok, let's close this PR.
--
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
[GitHub] [incubator-nuttx] slorquet commented on pull request #4027: sched: Restore the prototype of task_spawn
Posted by GitBox <gi...@apache.org>.
slorquet commented on pull request #4027:
URL: https://github.com/apache/incubator-nuttx/pull/4027#issuecomment-872335793
Well, the change is not bad, so it may not be required to revert it.
I was surprised by this break but this is more a "future documentation" 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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 closed pull request #4027: sched: Restore the prototype of task_spawn
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed pull request #4027:
URL: https://github.com/apache/incubator-nuttx/pull/4027
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4027: sched: Restore the prototype of task_spawn
Posted by GitBox <gi...@apache.org>.
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