Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include/spawn.h: Add POSIX_SPAWN_SETSID definition #3672

Merged
merged 1 commit into from
May 9, 2021

Conversation

xiaoxiang781216
Copy link
Contributor

Summary

NuttX doesn't support session yet, but the definition can improve the compatibility.

Impact

Minor, new flag

Testing

Pass the build

include/spawn.h Outdated
@@ -53,6 +53,7 @@
#define POSIX_SPAWN_SETSCHEDULER (1 << 3) /* 1: Set task's scheduler policy */
#define POSIX_SPAWN_SETSIGDEF (1 << 4) /* 1: Set default signal actions */
#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask */
#define POSIX_SPAWN_SETSID (1 << 7) /* 1: Create the new session */
Copy link
Contributor

@gustavonihei gustavonihei May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this flag is not supported by NuttX, I believe that the implementation should at least return the appropriate error code (e.g. ENOSYS) when this flag is used by the API consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is some reason I don't add the code to check the flag:

  1. NuttX doesn't support the session concept, so we can simply model that all processes share a global session and ignore the request safely.
  2. In the standard implementation, tty driver work with the scheduler do some special action for the different session, but the difference is very minor and NuttX actually treat that all processes are equal regarding the session. It isn't good to stop the program just because the minor(no for NuttX) difference.

@gustavonihei what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, seems reasonable. On 2 I agree that would be a bad idea to stop the program for this reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment indicating that this flag (and possible others to come) are not from POSIX standard, or indicating where is it from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ad654a1cb9b74a9f27f52c88fffa8b487a48f33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants