Skip to content

Commit 986680a

Browse files
committed
为posix_signal.c文件中的signal函数进行注释
1 parent 89f6931 commit 986680a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎components/libc/posix/signal/posix_signal.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818

1919
#define sig_valid(sig_no) (sig_no >= 0 && sig_no < RT_SIG_MAX)
2020

21+
22+
/**
23+
* @brief Sets the disposition of a signal.
24+
*
25+
* @note The signal() function chooses one of three ways to handle the signal @p sig.
26+
* The @p func argument specifies the action:
27+
* - SIG_DFL: default handling.
28+
* - SIG_IGN: ignore the signal.
29+
* - function pointer: user-defined handler.
30+
* This function is a simplified interface; the sigaction() function is recommended for portable applications.
31+
*
32+
* @param sig is the signal number (e.g., SIGINT, SIGTERM).
33+
* @param func is the disposition or function to be called when the signal is received.
34+
*
35+
* @return Upon successful completion, signal() returns the previous disposition of the signal.
36+
* On failure, SIG_ERR is returned and errno is set to indicate the error.
37+
*
38+
*/
2139
void (*signal(int sig, void (*func)(int))) (int)
2240
{
2341
return rt_signal_install(sig, func);

0 commit comments

Comments
 (0)