mirror of
https://github.com/tezc/sc.git
synced 2025-01-28 07:03:06 +08:00
fix global variables for signal.
This commit is contained in:
parent
0d8cfd3130
commit
aa3da7d73f
@ -33,6 +33,24 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <WinSock2.h>
|
||||
volatile SOCKET sc_signal_shutdown_fd;
|
||||
#else
|
||||
volatile sig_atomic_t sc_signal_shutdown_fd;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set log file fd here, logging will be redirected to this fd, otherwise
|
||||
* STDERR_FILENO or STDOUT_FILENO will be used.
|
||||
*/
|
||||
volatile sig_atomic_t sc_signal_log_fd;
|
||||
|
||||
/**
|
||||
* Internal variable to handle twice shutdown signal.
|
||||
*/
|
||||
volatile sig_atomic_t sc_signal_will_shutdown;
|
||||
|
||||
#define get_uint(va, size) \
|
||||
(size) == 3 ? va_arg(va, unsigned long long) : \
|
||||
(size) == 2 ? va_arg(va, unsigned long) : \
|
||||
@ -482,4 +500,3 @@ void sc_signal_log(int fd, char *buf, size_t len, char *fmt, ...)
|
||||
|
||||
(void) write(fd, buf, written);
|
||||
}
|
||||
|
||||
|
@ -37,21 +37,21 @@
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#include <WinSock2.h>
|
||||
volatile SOCKET sc_signal_shutdown_fd;
|
||||
extern volatile SOCKET sc_signal_shutdown_fd;
|
||||
#else
|
||||
volatile sig_atomic_t sc_signal_shutdown_fd;
|
||||
extern volatile sig_atomic_t sc_signal_shutdown_fd;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set log file fd here, logging will be redirected to this fd, otherwise
|
||||
* STDERR_FILENO or STDOUT_FILENO will be used.
|
||||
*/
|
||||
volatile sig_atomic_t sc_signal_log_fd;
|
||||
extern volatile sig_atomic_t sc_signal_log_fd;
|
||||
|
||||
/**
|
||||
* Internal variable to handle twice shutdown signal.
|
||||
*/
|
||||
volatile sig_atomic_t sc_signal_will_shutdown;
|
||||
extern volatile sig_atomic_t sc_signal_will_shutdown;
|
||||
|
||||
/**
|
||||
* Init signal handler, hooks for shutdown signals and some fatal signals.
|
||||
|
Loading…
x
Reference in New Issue
Block a user