Mercurial > emacs
comparison src/sysdep.c @ 83231:549734260e34
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-714
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-271
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 08 Dec 2004 22:20:27 +0000 |
parents | 22658e29bd48 62f194448b68 |
children | 4ee39d9428b0 |
comparison
equal
deleted
inserted
replaced
83230:d8738586aaec | 83231:549734260e34 |
---|---|
1 /* Interfaces to system-dependent kernel and library entries. | 1 /* Interfaces to system-dependent kernel and library entries. |
2 Copyright (C) 1985, 86,87,88,93,94,95,1999,2000,01,2003 | 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, |
3 Free Software Foundation, Inc. | 3 2003, 2004 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
6 | 6 |
7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
2870 sys_signal (int signal_number, signal_handler_t action) | 2870 sys_signal (int signal_number, signal_handler_t action) |
2871 { | 2871 { |
2872 struct sigaction new_action, old_action; | 2872 struct sigaction new_action, old_action; |
2873 sigemptyset (&new_action.sa_mask); | 2873 sigemptyset (&new_action.sa_mask); |
2874 new_action.sa_handler = action; | 2874 new_action.sa_handler = action; |
2875 #if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) | 2875 #if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT) |
2876 /* Emacs mostly works better with restartable system services. If this | 2876 /* Emacs mostly works better with restartable system services. If this |
2877 flag exists, we probably want to turn it on here. | 2877 flag exists, we probably want to turn it on here. |
2878 However, on some systems this resets the timeout of `select' | 2878 However, on some systems this resets the timeout of `select' |
2879 which means that `select' never finishes if it keeps getting signals. | 2879 which means that `select' never finishes if it keeps getting signals. |
2880 BROKEN_SA_RESTART is defined on those systems. */ | 2880 BROKEN_SA_RESTART is defined on those systems. */ |
2881 /* It's not clear why the comment above says "mostly works better". --Stef | |
2882 When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll | |
2883 for pending input so we need long-running syscalls to be interrupted | |
2884 after a signal that sets the interrupt_input_pending flag. */ | |
2881 new_action.sa_flags = SA_RESTART; | 2885 new_action.sa_flags = SA_RESTART; |
2882 #else | 2886 #else |
2883 new_action.sa_flags = 0; | 2887 new_action.sa_flags = 0; |
2884 #endif | 2888 #endif |
2885 sigaction (signal_number, &new_action, &old_action); | 2889 sigaction (signal_number, &new_action, &old_action); |
3327 if (oflag & O_CREAT) | 3331 if (oflag & O_CREAT) |
3328 return creat (path, mode); | 3332 return creat (path, mode); |
3329 #endif | 3333 #endif |
3330 | 3334 |
3331 while ((rtnval = open (path, oflag, mode)) == -1 | 3335 while ((rtnval = open (path, oflag, mode)) == -1 |
3332 && (errno == EINTR)); | 3336 && (errno == EINTR)) |
3337 QUIT; | |
3333 return (rtnval); | 3338 return (rtnval); |
3334 } | 3339 } |
3335 | 3340 |
3336 int | 3341 int |
3337 emacs_close (fd) | 3342 emacs_close (fd) |
3360 unsigned int nbyte; | 3365 unsigned int nbyte; |
3361 { | 3366 { |
3362 register int rtnval; | 3367 register int rtnval; |
3363 | 3368 |
3364 while ((rtnval = read (fildes, buf, nbyte)) == -1 | 3369 while ((rtnval = read (fildes, buf, nbyte)) == -1 |
3365 && (errno == EINTR)); | 3370 && (errno == EINTR)) |
3371 QUIT; | |
3366 return (rtnval); | 3372 return (rtnval); |
3367 } | 3373 } |
3368 | 3374 |
3369 int | 3375 int |
3370 emacs_write (fildes, buf, nbyte) | 3376 emacs_write (fildes, buf, nbyte) |
3381 rtnval = write (fildes, buf, nbyte); | 3387 rtnval = write (fildes, buf, nbyte); |
3382 | 3388 |
3383 if (rtnval == -1) | 3389 if (rtnval == -1) |
3384 { | 3390 { |
3385 if (errno == EINTR) | 3391 if (errno == EINTR) |
3386 continue; | 3392 { |
3393 #ifdef SYNC_INPUT | |
3394 /* I originally used `QUIT' but that might causes files to | |
3395 be truncated if you hit C-g in the middle of it. --Stef */ | |
3396 if (interrupt_input_pending) | |
3397 handle_async_input (); | |
3398 #endif | |
3399 continue; | |
3400 } | |
3387 else | 3401 else |
3388 return (bytes_written ? bytes_written : -1); | 3402 return (bytes_written ? bytes_written : -1); |
3389 } | 3403 } |
3390 | 3404 |
3391 buf += rtnval; | 3405 buf += rtnval; |