On Tue, 12 Jul 2005 10:38:11 +0200 Paolo Ornati wrote: > The particular case you analized (blocking connect interrupted by a > SA_RESTART signal) is interesting... and since SUSV3 says > "but the connection request shall not be aborted, and the > connection shall be established asynchronously" (with select() > or poll()...) > both for EINPROGRESS and EINTR, I think it's quite stupit to > automatically restart it and then return EALREADY. > > The logically correct behaviur with blocking connect interrupted and > then restarted should be to continue the blocking wait... IHMO. it seems that Linux is doing the Right Thing... see the attached program... $ make gcc -O2 -Wall -o conntest connect_test.c FROM ANOTHER CONSOLE: this is needed to block connect()... # iptables -A OUTPUT -p tcp --dport 3500 -m state --state NEW -j DROP $ ./conntest WITHOUT_SA_RESTART connect(): errno = 4 # EINTR, as expected Cannot setup client! $ ./conntest # connect is restarted after SIGALRM, and then it blocks again FROM ANOTHER CONSOLE: # iptables -D OUTPUT -p tcp --dport 3500 -m state --state NEW -j DROP and then "conntest" (thanks to TCP protocol retries) will terminate. :-) -- Paolo Ornati Linux 2.6.12.2 on x86_64