| @@ -1,31 +1,31 @@ | | | @@ -1,31 +1,31 @@ |
1 | /* $NetBSD: util.c,v 1.13 2015/05/19 22:01:19 joerg Exp $ */ | | 1 | /* $NetBSD: util.c,v 1.14 2015/07/04 07:12:08 ryoon Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Missing stuff from OS's | | 4 | * Missing stuff from OS's |
5 | * | | 5 | * |
6 | * $Id: util.c,v 1.13 2015/05/19 22:01:19 joerg Exp $ | | 6 | * $Id: util.c,v 1.14 2015/07/04 07:12:08 ryoon Exp $ |
7 | */ | | 7 | */ |
8 | #if defined(__MINT__) || defined(__linux__) | | 8 | #if defined(__MINT__) || defined(__linux__) |
9 | #include <signal.h> | | 9 | #include <signal.h> |
10 | #endif | | 10 | #endif |
11 | | | 11 | |
12 | #include "make.h" | | 12 | #include "make.h" |
13 | | | 13 | |
14 | #ifndef MAKE_NATIVE | | 14 | #ifndef MAKE_NATIVE |
15 | static char rcsid[] = "$NetBSD: util.c,v 1.13 2015/05/19 22:01:19 joerg Exp $"; | | 15 | static char rcsid[] = "$NetBSD: util.c,v 1.14 2015/07/04 07:12:08 ryoon Exp $"; |
16 | #else | | 16 | #else |
17 | #ifndef lint | | 17 | #ifndef lint |
18 | __RCSID("$NetBSD: util.c,v 1.13 2015/05/19 22:01:19 joerg Exp $"); | | 18 | __RCSID("$NetBSD: util.c,v 1.14 2015/07/04 07:12:08 ryoon Exp $"); |
19 | #endif | | 19 | #endif |
20 | #endif | | 20 | #endif |
21 | | | 21 | |
22 | #include <errno.h> | | 22 | #include <errno.h> |
23 | #include <time.h> | | 23 | #include <time.h> |
24 | #include <signal.h> | | 24 | #include <signal.h> |
25 | | | 25 | |
26 | #if !defined(HAVE_STRERROR) | | 26 | #if !defined(HAVE_STRERROR) |
27 | extern int errno, sys_nerr; | | 27 | extern int errno, sys_nerr; |
28 | extern char *sys_errlist[]; | | 28 | extern char *sys_errlist[]; |
29 | | | 29 | |
30 | char * | | 30 | char * |
31 | strerror(int e) | | 31 | strerror(int e) |
| @@ -373,27 +373,31 @@ getcwd(path, sz) | | | @@ -373,27 +373,31 @@ getcwd(path, sz) |
373 | { | | 373 | { |
374 | return getwd(path); | | 374 | return getwd(path); |
375 | } | | 375 | } |
376 | #endif | | 376 | #endif |
377 | | | 377 | |
378 | /* force posix signals */ | | 378 | /* force posix signals */ |
379 | void (* | | 379 | void (* |
380 | bmake_signal(int s, void (*a)(int)))(int) | | 380 | bmake_signal(int s, void (*a)(int)))(int) |
381 | { | | 381 | { |
382 | struct sigaction sa, osa; | | 382 | struct sigaction sa, osa; |
383 | | | 383 | |
384 | sa.sa_handler = a; | | 384 | sa.sa_handler = a; |
385 | sigemptyset(&sa.sa_mask); | | 385 | sigemptyset(&sa.sa_mask); |
| | | 386 | #ifdef SA_RESTART |
386 | sa.sa_flags = SA_RESTART; | | 387 | sa.sa_flags = SA_RESTART; |
| | | 388 | #else |
| | | 389 | sa.sa_flags = 0; |
| | | 390 | #endif |
387 | | | 391 | |
388 | if (sigaction(s, &sa, &osa) == -1) | | 392 | if (sigaction(s, &sa, &osa) == -1) |
389 | return SIG_ERR; | | 393 | return SIG_ERR; |
390 | else | | 394 | else |
391 | return osa.sa_handler; | | 395 | return osa.sa_handler; |
392 | } | | 396 | } |
393 | | | 397 | |
394 | #if !defined(HAVE_VSNPRINTF) || !defined(HAVE_VASPRINTF) | | 398 | #if !defined(HAVE_VSNPRINTF) || !defined(HAVE_VASPRINTF) |
395 | #include <stdarg.h> | | 399 | #include <stdarg.h> |
396 | #endif | | 400 | #endif |
397 | | | 401 | |
398 | #if !defined(HAVE_VSNPRINTF) | | 402 | #if !defined(HAVE_VSNPRINTF) |
399 | #if !defined(__osf__) | | 403 | #if !defined(__osf__) |