When writing a simple server-client application, this question came to my mind. When someone tries to write a broken pipe, SIGPIPE is generated. Say I'm processing a signal in my code.
Now what error causes a write call - EPIPE or EINTR (since it was interrupted by a signal). I tried with a sample program, and I seem to get EPIPE always. Is this a guaranteed behavior or can it be any of two error values?
POSIX says that EPIPE should be returned and SIGPIPE sent:
POSIX
write(2) -1 , , errno(3).
write(2)
-1
errno(3)
EPIPE, , . , signal(7).
EPIPE
signal(7)
, " " (EINTR) Unix System V, , ( ) . do ... while (ret==-1 && errno==EINTR); . POSIX - , ( "BSD" ) , , GNU/Linux, BSD . BSD, sigaction .
do ... while (ret==-1 && errno==EINTR);
sigaction
, EINTR SIGPIPE, .
Source: https://habr.com/ru/post/1753203/More articles:Haskell Structures and Conditional Data - designPHP: Как преобразовать массив в XML с поддержкой атрибутов (DOMi?) - arraysЕсли переключение на насыщенный воздух будет хорошим шагом? - javascriptHow to execute JS from Python, which uses "Document" and / or "Window" - javascriptremove stop words in java - javaASP.NET: versioning of the same website - c #OpenERP cache functions - pythonCreating good permalinks in WAMP - apacheVisual Studio Add-in for C # Development - c #signature of Object.getClass () method - javaAll Articles