Home > Archive > Unix Programming > March 2004 > ioctl and signal interrupts
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ioctl and signal interrupts
|
|
| pat saunders 2004-03-31, 10:43 am |
| Hi,
I am using unix (solaris 2.6) and C and Posix
(#define _POSIX_SOURCE)!!!
In my Code I have noticed that my ioctl systems calls are being
interrupted by
certain defined signals :
ioctl(fd, TCSETS, &tbufsave);
ioctl(fd, TCGETS, &tbuf);
I am wondering it is sufficient to put
do
ioctl ...
while (errno == EINTR) loop
around the system calls, as I have read this can cause problems with
certain ioctl calls
or do certain kernels like solaris ,automatically restart interrupted
systems calls ??
Any help appreciated.
Pat
| |
| Marc Rochkind 2004-03-31, 3:37 pm |
|
"pat saunders" <pat.saunders@sis.securicor.co.uk> wrote in message
news:bc0e3bd8.0403310659.29f72156@posting.google.com...
> Hi,
> I am using unix (solaris 2.6) and C and Posix
> (#define _POSIX_SOURCE)!!!
> In my Code I have noticed that my ioctl systems calls are being
> interrupted by
> certain defined signals :
> ioctl(fd, TCSETS, &tbufsave);
> ioctl(fd, TCGETS, &tbuf);
>
> I am wondering it is sufficient to put
> do
> ioctl ...
> while (errno == EINTR) loop
> around the system calls, as I have read this can cause problems with
> certain ioctl calls
> or do certain kernels like solaris ,automatically restart interrupted
> systems calls ??
> Any help appreciated.
> Pat
The flag to cause system calls to be restarted is SA_RESTART, used with the
sigaction system call, and using it is better than re-calling the
interrupted call. Also, instead of using ioctl for terminal stuff, it's
better to use the newer functions whose names start with "tc", such as
tcsetattr.
--
Marc Rochkind
"Advanced UNIX Programming" (publishing April 2004)
www.basepath.com/aup
|
|
|
|
|