What is the purpose of sending (2) receiving SIGPIPE?

Possible duplicate:
Why is writing a private TCP socket worse than reading?

Why is there no erroneous return value?
What can I do in a signal handler that I cannot do by checking the return value for EPIPE?

+3
source share
2 answers

In the old days, almost every signal ended the Unix program. Since the interaction between processes across channels is fundamental in Unix, it was SIGPIPEintended to terminate programs that did not handle write(2)/ errors read(2).

, . , . SIGPIPE .

:

cat myfile | grep find_something

cat , grep , SIGPIPE. , grep read, grep - .

+1

, , , - , POSIX . , -, , , - Bad Thing ™, , , , ?

0

Source: https://habr.com/ru/post/1773920/


All Articles