From: SASADA Koichi Date: 2010-12-01T23:38:55+09:00 Subject: [ruby-dev:42667] Re: Errno::EINTR: Interrupted system call on console#echo= (2010/12/01 23:13), SASADA Koichi wrote: >  現実的にはほぼ無さそうなんですが、setattr()(tcsetattr()) が EINTR を > 返す可能性が、無くはないようです。どういうシチュエーションだろう。  こうかな。 Index: ext/io/console/console.c =================================================================== --- ext/io/console/console.c (revision 29985) +++ ext/io/console/console.c (working copy) @@ -26,7 +26,16 @@ #if defined HAVE_TERMIOS_H # include typedef struct termios conmode; -# define setattr(fd, t) (tcsetattr(fd, TCSAFLUSH, t) == 0) + +static int +setattr(int fd, conmode *t) +{ + int r; + retry: + r = tcsetattr(fd, TCSAFLUSH, t); + if (r != 0 && errno == EINTR) goto retry; + return r == 0; +} # define getattr(fd, t) (tcgetattr(fd, t) == 0) #elif defined HAVE_TERMIO_H # include -- // SASADA Koichi at atdot dot net