-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
linux.ppoll
always returns E_INVAL
due to invalid sigsetsize
#3493
Comments
It appears that our definition of the As for the user-facing API i've been considering making sigset a bitset, there was just an issue where first signal would correspond to bit 0, so I didn't want to tie it to a different type. Maybe I'll reconsider this now that I know its not more than register size. |
I'm assuming our #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
{
unsigned long int __val[_SIGSET_NWORDS];
} __sigset_t; I did a little more digging, but I haven't been able to find what the extra memory is for, other than an assumed possible future expansion to keep the API stable until then. There was even an issue on the go project about this too. golang/go#55349 I suppose it's a small comfort that two other projects had run into this confusing issue too. |
I actually have this fixed and working in a my branch. SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
sigset_t __user *, oset, size_t, sigsetsize)
{
sigset_t old_set, new_set;
int error;
/* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
... You will always get We could use a mask: bit_set[0..=63]
mask += { int(linux.Signal.SIGCHLD) - 1 } I guess that is what |
@jasonKercher Didn't realise you were doing core:os2/process work on linux, I was about to double that effort by making it part of my PR haha |
@flysand7 Yup. Now, it runs on the much improved |
Context
It seems the Linux kernel is expecting a specific value for
sigsetsize
(which glibc handles), despite what the man pages say about this syscall. In Odin, we passsize_of(Sig_Set)
, which is 128 bytes, compared to the expected 8 bytes (on a 64-bit system, at least).There's an interesting report over on the zig project related to this issue, including a link to the Linux kernel source where this is checked. ziglang/zig#12715
Using
size_of(c.long)
may fix it, but then I wonder what to do about theSig_Set
structure as far as the Odin user-facing API is concerned.The text was updated successfully, but these errors were encountered: