Mercurial > emacs
comparison lib-src/=timer.c @ 2102:b11495a4ecdf
* timer.c (main): Set the ownership of the stdin file descriptor
to the current process. Print error messages if either of the
fcntl's fails.
* timer.c (sigcatch): Declare this to return SIGTYPE (defined in
../src/config.h), not void.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 11 Mar 1993 07:00:12 +0000 |
| parents | f149ad4ad9d4 |
| children | 2e57e16282f0 |
comparison
equal
deleted
inserted
replaced
| 2101:df8249aa4901 | 2102:b11495a4ecdf |
|---|---|
| 211 | 211 |
| 212 /* Who knows what this interrupted, or if it said "now"? */ | 212 /* Who knows what this interrupted, or if it said "now"? */ |
| 213 notify (); | 213 notify (); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void | 216 SIGTYPE |
| 217 sigcatch (sig) | 217 sigcatch (sig) |
| 218 int sig; | 218 int sig; |
| 219 /* dispatch on incoming signal, then restore it */ | 219 /* dispatch on incoming signal, then restore it */ |
| 220 { | 220 { |
| 221 struct event *ep; | 221 struct event *ep; |
| 260 signal (SIGIO, sigcatch); | 260 signal (SIGIO, sigcatch); |
| 261 signal (SIGALRM, sigcatch); | 261 signal (SIGALRM, sigcatch); |
| 262 signal (SIGTERM, sigcatch); | 262 signal (SIGTERM, sigcatch); |
| 263 | 263 |
| 264 #ifndef USG | 264 #ifndef USG |
| 265 fcntl (0, F_SETFL, FASYNC); | 265 if (fcntl (0, F_SETOWN, getpid ()) == -1) |
| 266 { | |
| 267 fprintf (stderr, "%s: can't set ownership of stdin\n", pname); | |
| 268 fprintf (stderr, "%s\n", sys_errlist[errno]); | |
| 269 exit (1); | |
| 270 } | |
| 271 if (fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | FASYNC) == -1) | |
| 272 { | |
| 273 fprintf (stderr, "%s: can't request asynchronous I/O on stdin\n", pname); | |
| 274 fprintf (stderr, "%s\n", sys_errlist[errno]); | |
| 275 exit (1); | |
| 276 } | |
| 266 #endif /* USG */ | 277 #endif /* USG */ |
| 267 | 278 |
| 268 while (1) pause (); | 279 while (1) pause (); |
| 269 } | 280 } |
| 270 | 281 |
