-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
posix: signal: APIs implementation #60083
Conversation
a70b15f
to
09c4b29
Compare
3a97035
to
d0bb37c
Compare
d0bb37c
to
b9fcfdf
Compare
b9fcfdf
to
26c03ad
Compare
7357b31
to
a3098a2
Compare
64d3496
to
17c8337
Compare
aef42c0
to
0b11d7a
Compare
@keith-packard may I have your review again? |
#define SIGSYS 31 /**< Bad system call */ | ||
|
||
#define SIGRTMIN 32 | ||
#define SIGRTMAX (SIGRTMIN + CONFIG_POSIX_RTSIG_MAX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you should define RTSIG_MAX
to be CONFIG_POSIX_RTSIG_MAX
in <limits.h>
and that it must be at least 8.
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this Kconfig will make the implementation of limits.h
a bit easier, but I think limits.h
can probably be in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that sounds like it's getting close to sysconf()
. There is another PR in draft for that, so I can add RTSIG_MAX
separately.
lib/posix/Kconfig.signal
Outdated
int "Maximum real-time signal number" | ||
default 31 | ||
help | ||
Define the maximum real-time signal number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing (as is the POSIX definition of the related RTSIG_MAX
value). Might be good to clarify that this defines the POSIX value and that the range of RT signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the desc to align with the doc:
config POSIX_RTSIG_MAX
int "Maximum number of realtime signals"
default 31
help
Define the maximum number of realtime signals (RTSIG_MAX).
The range of realtime signals is [SIGRTMIN .. (SIGRTMIN+RTSIG_MAX)]
Initial header for the signal APIs. APIs to be implemented in later commit. Signed-off-by: Yong Cong Sin <[email protected]>
0b11d7a
to
c4c904e
Compare
c4c904e
to
522817d
Compare
#define SIGRTMAX (SIGRTMIN + CONFIG_POSIX_RTSIG_MAX) | ||
#define _NSIG (SIGRTMAX + 1) | ||
|
||
BUILD_ASSERT(CONFIG_POSIX_RTSIG_MAX >= 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX says 8; that could get checked here or Kconfig, or just stick a note in Kconfig indicating what will make the system POSIX compliant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added Kconfig.limits
to specify the default limit to be posix compliant, but user can freely changes this Kconfig to be anything >= 0, let me know what you think about this approach
These Kconfigs serve as direct translation when we implement limits.h
in the future
cc @cfriedt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds perfect -- tell people how to make POSIX compliant systems, but also allow them to reduce resources if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
Implementation and ztest for sigemptyset. Signed-off-by: Yong Cong Sin <[email protected]>
Implementation and ztest for sigfillset. Signed-off-by: Yong Cong Sin <[email protected]>
Implementation and ztest for sigaddset. Signed-off-by: Yong Cong Sin <[email protected]>
Implementation and ztest for sigdelset. Signed-off-by: Yong Cong Sin <[email protected]>
Implementation and ztest for sigismember. Signed-off-by: Yong Cong Sin <[email protected]>
Implementation and ztest for strsignal. Signed-off-by: Yong Cong Sin <[email protected]>
Add an extra test config to test large number of signals. Signed-off-by: Yong Cong Sin <[email protected]>
Use build assert to make sure that the realtime signal constants are configured properly in the Kconfig. Signed-off-by: Yong Cong Sin <[email protected]>
8b5d7a8
to
e1896cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Implementation for the following POSIX signal APIs:
int sigemptyset(sigset_t *set);
int sigfillset(sigset_t *set);
int sigaddset(sigset_t *set, int signo);
int sigdelset(sigset_t *set, int signo);
int sigismember(const sigset_t *set, int signo);
char *strsignal(int signum);
fixes #59929
fixes #59931
fixes #59927
fixes #59928
fixes #59932