mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 16:25:17 +00:00
fatal-signal: SIGPIPE for Windows.
Windows does not have a SIGPIPE. We ignore SIGPIPE for Linux. To compile on Windows, carve out a new function to ignore SIGPIPE on Linux. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -218,6 +218,14 @@ fatal_signal_wait(void)
|
||||
poll_fd_wait_event(signal_fds[0], wevent, POLLIN);
|
||||
}
|
||||
|
||||
void
|
||||
fatal_ignore_sigpipe(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
atexit_handler(void)
|
||||
{
|
||||
|
@@ -27,6 +27,7 @@ void fatal_signal_add_hook(void (*hook_cb)(void *aux),
|
||||
void fatal_signal_fork(void);
|
||||
void fatal_signal_run(void);
|
||||
void fatal_signal_wait(void);
|
||||
void fatal_ignore_sigpipe(void);
|
||||
|
||||
/* Convenience functions for unlinking files upon termination.
|
||||
*
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "daemon.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "json.h"
|
||||
#include "jsonrpc.h"
|
||||
#include "lib/table.h"
|
||||
@@ -88,7 +89,7 @@ main(int argc, char *argv[])
|
||||
proctitle_init(argc, argv);
|
||||
set_program_name(argv[0]);
|
||||
parse_options(argc, argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
|
||||
if (optind >= argc) {
|
||||
ovs_fatal(0, "missing command name; use --help for help");
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "dirs.h"
|
||||
#include "dummy.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "file.h"
|
||||
#include "hash.h"
|
||||
#include "json.h"
|
||||
@@ -137,7 +138,7 @@ main(int argc, char *argv[])
|
||||
proctitle_init(argc, argv);
|
||||
set_program_name(argv[0]);
|
||||
service_start(&argc, &argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
process_init();
|
||||
|
||||
parse_options(&argc, &argv, &remotes, &unixctl_path, &run_command);
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "compiler.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "file.h"
|
||||
#include "lockfile.h"
|
||||
#include "log.h"
|
||||
@@ -56,7 +57,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
set_program_name(argv[0]);
|
||||
parse_options(argc, argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
run_command(argc - optind, argv + optind, get_all_commands());
|
||||
return 0;
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "command-line.h"
|
||||
#include "compiler.h"
|
||||
#include "daemon.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "learning-switch.h"
|
||||
#include "ofp-parse.h"
|
||||
#include "ofp-version-opt.h"
|
||||
@@ -105,7 +106,7 @@ main(int argc, char *argv[])
|
||||
proctitle_init(argc, argv);
|
||||
set_program_name(argv[0]);
|
||||
parse_options(argc, argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
|
||||
if (argc - optind < 1) {
|
||||
ovs_fatal(0, "at least one vconn argument required; "
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "command-line.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "ofp-msgs.h"
|
||||
#include "ofp-util.h"
|
||||
#include "ofpbuf.h"
|
||||
@@ -436,7 +437,7 @@ main(int argc, char *argv[])
|
||||
set_program_name(argv[0]);
|
||||
vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER);
|
||||
vlog_set_levels(NULL, VLF_CONSOLE, VLL_DBG);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
|
||||
time_alarm(10);
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "dirs.h"
|
||||
#include "dpif.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "flow.h"
|
||||
#include "match.h"
|
||||
#include "netdev.h"
|
||||
@@ -73,7 +74,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
set_program_name(argv[0]);
|
||||
parse_options(argc, argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
run_command(argc - optind, argv + optind, get_all_commands());
|
||||
return 0;
|
||||
}
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "compiler.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "nx-match.h"
|
||||
#include "odp-util.h"
|
||||
#include "ofp-actions.h"
|
||||
@@ -113,7 +114,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
set_program_name(argv[0]);
|
||||
parse_options(argc, argv);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
run_command(argc - optind, argv + optind, get_all_commands());
|
||||
return 0;
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "compiler.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "hash.h"
|
||||
#include "json.h"
|
||||
#include "ovsdb-data.h"
|
||||
@@ -176,7 +177,7 @@ main(int argc, char *argv[])
|
||||
char *args;
|
||||
|
||||
set_program_name(argv[0]);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
|
||||
vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN);
|
||||
ovsrec_init();
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "dirs.h"
|
||||
#include "dpif.h"
|
||||
#include "dummy.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "memory.h"
|
||||
#include "netdev.h"
|
||||
#include "openflow/openflow.h"
|
||||
@@ -72,7 +73,7 @@ main(int argc, char *argv[])
|
||||
set_program_name(argv[0]);
|
||||
service_start(&argc, &argv);
|
||||
remote = parse_options(argc, argv, &unixctl_path);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
ovsrec_init();
|
||||
|
||||
daemonize_start();
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "compiler.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "fatal-signal.h"
|
||||
#include "hash.h"
|
||||
#include "json.h"
|
||||
#include "ovsdb-data.h"
|
||||
@@ -167,7 +168,7 @@ main(int argc, char *argv[])
|
||||
char *args;
|
||||
|
||||
set_program_name(argv[0]);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
fatal_ignore_sigpipe();
|
||||
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
|
||||
vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN);
|
||||
vteprec_init();
|
||||
|
Reference in New Issue
Block a user