Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
int puts(const char*);リエントラントですか?シグナルハンドラに安全に入れることはできますか?
int puts(const char*);
以下は、シグナル処理に対して安全であると考えられるすべての関数の表です。
「次の表は、再入可能またはシグナルによる割り込み不可であり、非同期シグナルセーフである一連の関数を定義しています。」
putsそのリストにはないようですが、これによると、再入可能であると見なされますが、非同期セーフではないと見なされます。おそらく、上記のリストにない理由です。
puts
いいえ、そうではありませんが、write()非同期シグナルセーフである を使用して、シグナルハンドラーからメッセージを出力できます。
write()
#include <unistd.h> const char* msg = "The message to print."; write(STDOUT_FILENO, msg, strlen(msg));