[libc-commits] [PATCH] D75802: [libc] Add sigaction

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Mar 14 09:06:23 PDT 2020


sivachandra added a comment.

Sorry for the long delay here. I am feeling much better now and should be more responsive.



================
Comment at: libc/config/linux/signal.h.in:11
 
+#define sigaction __kernel_sigaction
 #include <linux/signal.h>
----------------
abrachet wrote:
> This is very not ideal, but the Linux headers expose a different `struct sigaction` than POSIX expects, it has no `sa_action` member.
What do you think of using the other way round scheme. As in, in our public signal.h header, we will define `sigaction` like this:

```
struct __sigaction {
  ...
};

#ifndef __LLVM_LIBC_INTERNAL_SIGACTION
typedef __sigaction sigaction;
#endif
```

This will allow us to include our public header in internal code as:

```
#define __LLVM_LIBC_INTERNAL_SIGACTION
#include "include/signal.h"
```

Throughout the internal implementation code, we will use `struct __sigaction` instead of `struct sigaction`. This way, we don't have to mess with the kernel headers. Does this make sense?


================
Comment at: libc/src/signal/linux/CMakeLists.txt:15
 
+add_custom_target(__restore
+  COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR}/__restore.cpp -fomit-frame-pointer
----------------
I have a similar requirement for a change I have been working on. I will share more on this soon. I am OK with this setup as is, but I have a feeling we can make use of similar items elsewhere as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75802/new/

https://reviews.llvm.org/D75802





More information about the libc-commits mailing list