[libc-commits] [PATCH] D75802: [libc] Add sigaction
    Alex Brachet via Phabricator via libc-commits 
    libc-commits at lists.llvm.org
       
    Sat Mar  7 02:42:53 PST 2020
    
    
  
abrachet marked 3 inline comments as done.
abrachet added inline comments.
================
Comment at: libc/config/linux/signal.h.in:11
 
+#define sigaction __kernel_sigaction
 #include <linux/signal.h>
----------------
This is very not ideal, but the Linux headers expose a different `struct sigaction` than POSIX expects, it has no `sa_action` member.
================
Comment at: libc/spec/stdc.td:217
       [
-        NamedType<"sigset_t">,
         SizeTType,
----------------
I moved this in this patch because I realized `sigset_t` doesn't belong here but rather posix.td, I can do this in a separate patch if reviewers want.
================
Comment at: libc/src/signal/linux/sigaction.cpp:20
+// the signals stack context.
+asm(".text\n"
+    "nop\n"
----------------
To elaborate more on why we can't use a function written in C, we need a way to guarantee that no stack allocations can be made, to my knowledge there is no attribute which satisfies this. The closest is `optimize("O1")` which we can assume wouldn't bother pushing anything but clang doesn't have this. Also see __restore_rt.s, to make this useable with gdb there are a lot of prerequisites which must be met that we cannot do in C (at least easily) unfortunately.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75802/new/
https://reviews.llvm.org/D75802
    
    
More information about the libc-commits
mailing list