On Thu, Jun 29, 2017 at 02:42:38PM -0700, Palmer Dabbelt wrote: > On Wed, 28 Jun 2017 15:42:37 PDT (-0700), james.hogan@imgtec.com wrote: > > On Wed, Jun 28, 2017 at 11:55:37AM -0700, Palmer Dabbelt wrote: > >> diff --git a/arch/riscv/include/uapi/asm/ucontext.h b/arch/riscv/include/uapi/asm/ucontext.h > >> new file mode 100644 > >> index 000000000000..52eff9febcfd > >> --- /dev/null > >> +++ b/arch/riscv/include/uapi/asm/ucontext.h > > ... > >> +struct ucontext { > >> + unsigned long uc_flags; > >> + struct ucontext *uc_link; > >> + stack_t uc_stack; > >> + sigset_t uc_sigmask; > >> + /* glibc uses a 1024-bit sigset_t */ > >> + __u8 __unused[1024 / 8 - sizeof(sigset_t)]; > >> + /* last for future expansion */ > >> + struct sigcontext uc_mcontext; > >> +}; > > > > Any particular reason not to use the asm-generic ucontext? > > In the generic ucontext, 'uc_sigmask' is at the end of the structure so it can > be expanded. Since we want our mcontext to be expandable as well, we > pre-allocate some expandable space for sigmask and then put mcontext at the > end. > > We stole this idea from arm64. Curious. __unused seems like overkill to be honest given that expanding the number of signals up to 128 causes other issues (as discovered on MIPS e.g. the waitpid() status, with stopsig not fitting below the exit code (shift 8) and core dump flag (bit 7)), but perhaps it could be carefully expanded by splitting the stopsig field. Looks harmless here I suppose so I defer to others. If it is the preferred approach does it make sense to make it the "default" for new architectures at some point? Cheers James