[libc-commits] [libc] [libc] add proxy header for struct_sigaction (PR #96224)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Thu Jun 20 15:14:19 PDT 2024
https://github.com/SchrodingerZhu updated https://github.com/llvm/llvm-project/pull/96224
>From e1644ac83b3eb56f8234c6d01926ca4deac8819f Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Thu, 20 Jun 2024 11:44:20 -0700
Subject: [PATCH 1/2] [libc] add proxy header for struct_sigaction
---
libc/hdr/types/CMakeLists.txt | 9 +++++++++
libc/hdr/types/struct_sigaction.h | 21 +++++++++++++++++++++
libc/src/signal/linux/CMakeLists.txt | 1 +
libc/src/signal/sigaction.h | 2 +-
4 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 libc/hdr/types/struct_sigaction.h
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 9b3373a0ca390..1cab1d3b812cf 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -126,3 +126,12 @@ add_proxy_header_library(
libc.include.llvm-libc-types.atexithandler_t
libc.include.stdlib
)
+
+add_proxy_header_library(
+ struct_sigaction
+ HDRS
+ struct_sigaction.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.struct_sigaction
+ libc.include.signal
+)
diff --git a/libc/hdr/types/struct_sigaction.h b/libc/hdr/types/struct_sigaction.h
new file mode 100644
index 0000000000000..60f6caeb4af10
--- /dev/null
+++ b/libc/hdr/types/struct_sigaction.h
@@ -0,0 +1,21 @@
+//===-- Proxy for struct sigaction ---------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H
+#define LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/struct_sigaction.h"
+
+#else
+
+#include <signal.h>
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H
diff --git a/libc/src/signal/linux/CMakeLists.txt b/libc/src/signal/linux/CMakeLists.txt
index 7606b4b21d3dd..b03d06a0bc4c7 100644
--- a/libc/src/signal/linux/CMakeLists.txt
+++ b/libc/src/signal/linux/CMakeLists.txt
@@ -60,6 +60,7 @@ add_entrypoint_object(
DEPENDS
.__restore
libc.hdr.types.sigset_t
+ libc.hdr.types.struct_sigaction
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
libc.src.errno.errno
diff --git a/libc/src/signal/sigaction.h b/libc/src/signal/sigaction.h
index c36a3ec9fedfa..293093f6a0751 100644
--- a/libc/src/signal/sigaction.h
+++ b/libc/src/signal/sigaction.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_SIGNAL_SIGACTION_H
#define LLVM_LIBC_SRC_SIGNAL_SIGACTION_H
-#include <signal.h>
+#include <hdr/types/struct_sigaction.h>
namespace LIBC_NAMESPACE {
>From 3e30a4ea8d3d2c5d974fce93417f8424880b8a59 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Thu, 20 Jun 2024 15:14:04 -0700
Subject: [PATCH 2/2] [libc] correct inclusion style
---
libc/src/signal/sigaction.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/signal/sigaction.h b/libc/src/signal/sigaction.h
index 293093f6a0751..15b689b7dacc7 100644
--- a/libc/src/signal/sigaction.h
+++ b/libc/src/signal/sigaction.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_SIGNAL_SIGACTION_H
#define LLVM_LIBC_SRC_SIGNAL_SIGACTION_H
-#include <hdr/types/struct_sigaction.h>
+#include "hdr/types/struct_sigaction.h"
namespace LIBC_NAMESPACE {
More information about the libc-commits
mailing list