1 |
/* Interfaces to system-dependent kernel and library entries. |
/* Interfaces to system-dependent kernel and library entries. |
2 |
Copyright (C) 1985, 86,87,88,93,94,95,1999,2000,01,2003 |
Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, |
3 |
Free Software Foundation, Inc. |
2003, 2004 Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
6 |
|
|
2768 |
struct sigaction new_action, old_action; |
struct sigaction new_action, old_action; |
2769 |
sigemptyset (&new_action.sa_mask); |
sigemptyset (&new_action.sa_mask); |
2770 |
new_action.sa_handler = action; |
new_action.sa_handler = action; |
2771 |
#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) |
#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT) |
2772 |
/* Emacs mostly works better with restartable system services. If this |
/* Emacs mostly works better with restartable system services. If this |
2773 |
flag exists, we probably want to turn it on here. |
flag exists, we probably want to turn it on here. |
2774 |
However, on some systems this resets the timeout of `select' |
However, on some systems this resets the timeout of `select' |
2775 |
which means that `select' never finishes if it keeps getting signals. |
which means that `select' never finishes if it keeps getting signals. |
2776 |
BROKEN_SA_RESTART is defined on those systems. */ |
BROKEN_SA_RESTART is defined on those systems. */ |
2777 |
|
/* It's not clear why the comment above says "mostly works better". --Stef |
2778 |
|
When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll |
2779 |
|
for pending input so we need long-running syscalls to be interrupted |
2780 |
|
after a signal that sets the interrupt_input_pending flag. */ |
2781 |
new_action.sa_flags = SA_RESTART; |
new_action.sa_flags = SA_RESTART; |
2782 |
#else |
#else |
2783 |
new_action.sa_flags = 0; |
new_action.sa_flags = 0; |
3229 |
#endif |
#endif |
3230 |
|
|
3231 |
while ((rtnval = open (path, oflag, mode)) == -1 |
while ((rtnval = open (path, oflag, mode)) == -1 |
3232 |
&& (errno == EINTR)); |
&& (errno == EINTR)) |
3233 |
|
QUIT; |
3234 |
return (rtnval); |
return (rtnval); |
3235 |
} |
} |
3236 |
|
|
3263 |
register int rtnval; |
register int rtnval; |
3264 |
|
|
3265 |
while ((rtnval = read (fildes, buf, nbyte)) == -1 |
while ((rtnval = read (fildes, buf, nbyte)) == -1 |
3266 |
&& (errno == EINTR)); |
&& (errno == EINTR)) |
3267 |
|
QUIT; |
3268 |
return (rtnval); |
return (rtnval); |
3269 |
} |
} |
3270 |
|
|
3285 |
if (rtnval == -1) |
if (rtnval == -1) |
3286 |
{ |
{ |
3287 |
if (errno == EINTR) |
if (errno == EINTR) |
3288 |
continue; |
{ QUIT; continue; } |
3289 |
else |
else |
3290 |
return (bytes_written ? bytes_written : -1); |
return (bytes_written ? bytes_written : -1); |
3291 |
} |
} |