On Fri, Aug 21, 2020 at 10:10:12PM -0700, Peter Collingbourne wrote: > Most architectures with the exception of alpha, mips, parisc and > sparc use the same values for these flags. Move their definitions into > asm-generic/signal-defs.h and allow the architectures with non-standard > values to override them. Also, document the non-standard flag values > in order to make it easier to add new generic flags in the future. > > Signed-off-by: Peter Collingbourne <pcc@xxxxxxxxxx> While this looks reasonable, I've just realised that you strip the "U" from some arches' definitions here. So, on powerpc and x86, this changes the type of flags other than SA_RESETHAND from unsigned int to int. While I can't see this breaking any sensible use of these flags, there's a chance that there is software relying on this distinction by accident. I wonder whether it's worth doing something like #ifdef ARCH_WANT_STRICTLY_UNSIGNED_SA_FLAGS #define __SA_FLAG_VAL(x) x ## U #else #define __SA_FLAG_VAL(x) x #endif #ifndef SA_NOCLDSTOP #define SA_NOCLDSTOP __SA_FLAG_VAL(0x00000001) #endif /* ... */ Mind you, the historical situation also has issues, e.g. because sa_flags in struct sigaction is an int, assigning struct sigaction sa; sa.sa_flags = SA_RESETHAND; implies an overflow and so isn't portably safe (at least in theory). I guess we are getting away with it today. Preserving the situation by keeping the "U"s where appropriate would at least avoid making the situation worse. [...] Cheers ---Dave