From 986680a3c8333abb2ec245f1d6c58fd5bbdf5a85 Mon Sep 17 00:00:00 2001 From: langqwu <1627071801@qq.com> Date: Sat, 16 May 2026 17:13:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAposix=5Fsignal.c=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E7=9A=84signal=E5=87=BD=E6=95=B0=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/posix/signal/posix_signal.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/libc/posix/signal/posix_signal.c b/components/libc/posix/signal/posix_signal.c index 780d872faf4..90850b5dd03 100644 --- a/components/libc/posix/signal/posix_signal.c +++ b/components/libc/posix/signal/posix_signal.c @@ -18,6 +18,24 @@ #define sig_valid(sig_no) (sig_no >= 0 && sig_no < RT_SIG_MAX) + +/** + * @brief Sets the disposition of a signal. + * + * @note The signal() function chooses one of three ways to handle the signal @p sig. + * The @p func argument specifies the action: + * - SIG_DFL: default handling. + * - SIG_IGN: ignore the signal. + * - function pointer: user-defined handler. + * This function is a simplified interface; the sigaction() function is recommended for portable applications. + * + * @param sig is the signal number (e.g., SIGINT, SIGTERM). + * @param func is the disposition or function to be called when the signal is received. + * + * @return Upon successful completion, signal() returns the previous disposition of the signal. + * On failure, SIG_ERR is returned and errno is set to indicate the error. + * + */ void (*signal(int sig, void (*func)(int))) (int) { return rt_signal_install(sig, func);