When sending a SIGINT to a ptraced process (run under gdb), an interrupted
select() call returns with errno==514. linux/include/linux/errno.h says:
/* Should never be seen by user programs */
#define ERESTARTSYS 512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514 /* restart if no handler.. */
#define ENOIOCTLCMD 515 /* No ioctl command */
As gdb is a user program, and the printf is printing it, there's something
wrong. This might be due to a problem in gdb, but the fact that the errno
is being seen in userspace seems bad.
A simple test program is included. To test, build and run it under gdb.
Hit ^C to get back to the gdb prompt, and enter 'signal SIGINT' to send a
SIGINT.
This has been reproduced on 2.4.18 (the Red Hat 7.3 errata kernel) and
2.4.19 (built from scratch).
Brian
---- #include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/select.h> #include <sys/signal.h>void printsig(int sig) { fprintf(stderr, "got sig %d\n", sig); }
int main(int argc, char **argv) { int n; struct sigaction sa; memset(&sa, 0, sizeof sa); sa.sa_handler = printsig; n = sigaction(SIGINT, &sa, NULL); if (n < 0) { fprintf(stderr, "sigaction: %s\n", strerror(errno)); exit(1); } n = select(0, NULL, NULL, NULL, NULL); if (n < 0) { fprintf(stderr, "select: %s\n", strerror(errno)); exit(1); } exit(0); }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:40 EST