From mint-bounce@lists.fishpool.fi Sun Jul 11 13:22:21 2010 Message-ID: <4C39FD60.7040409@freesbee.fr> Date: Sun, 11 Jul 2010 19:20:32 +0200 From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1 MIME-Version: 1.0 To: mint@lists.fishpool.fi Subject: [MiNT] read() and signals References: <4C389D1D.7030108@freesbee.fr> <1278789068.7311.1378.camel@jetpack.demon.co.uk> In-Reply-To: <1278789068.7311.1378.camel@jetpack.demon.co.uk> Content-Type: multipart/mixed; boundary="------------020103060404030508010605" X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: This is a multi-part message in MIME format. --------------020103060404030508010605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Alan Hourihane wrote: >> The Ctrl+C keystroke requires to press Enter to do its job, it may be = related. >> Alan, by chance, have you investigated this issue ? > > I've seen the same problem, but not investigated yet. I had a look at it, and I think I have found the cause of the bash proble= m. Basically, the read() function should fail with EINTR when a signal is=20 caught, but in MiNT it continues blocking. The attached program is a very simple testcase. On Linux and Cygwin, I get: $ ./mysig Please type ^C ^CSIGINT! ret =3D -1, errno =3D 4, msg =3D Interrupted system call But on MiNT, I can type ^C several times, it does not exit: $ ./mysig Please type ^C SIGINT! SIGINT! SIGINT! SIGINT! However it exits if I type a standard key, of course. I don't know if the problem comes from the kernel or the MiNTLib. --=20 Vincent Rivi=E8re --------------020103060404030508010605 Content-Type: text/plain; name="mysig.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mysig.c" #include #include #include #include #include void myhandler(int sig) { puts("SIGINT!"); } int main(void) { struct sigaction act, oact; int ret; unsigned char c; act.sa_handler = myhandler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigemptyset (&oact.sa_mask); sigaction (SIGINT, &act, &oact); puts("Please type ^C"); errno = 0; ret = read (0, &c, sizeof c); printf("ret = %d, errno = %d, msg = %s\n", ret, errno, strerror(errno)); return 0; } --------------020103060404030508010605--