~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to vswitchd/ovs-vswitchd.c

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
 
1
/* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
2
2
 *
3
3
 * Licensed under the Apache License, Version 2.0 (the "License");
4
4
 * you may not use this file except in compliance with the License.
32
32
#include "dirs.h"
33
33
#include "dpif.h"
34
34
#include "dummy.h"
35
 
#include "leak-checker.h"
36
35
#include "memory.h"
37
36
#include "netdev.h"
38
37
#include "openflow/openflow.h"
43
42
#include "simap.h"
44
43
#include "stream-ssl.h"
45
44
#include "stream.h"
46
 
#include "stress.h"
47
45
#include "svec.h"
48
46
#include "timeval.h"
49
47
#include "unixctl.h"
51
49
#include "vconn.h"
52
50
#include "vlog.h"
53
51
#include "lib/vswitch-idl.h"
54
 
#include "worker.h"
55
52
 
56
53
VLOG_DEFINE_THIS_MODULE(vswitchd);
57
54
 
76
73
 
77
74
    proctitle_init(argc, argv);
78
75
    set_program_name(argv[0]);
79
 
    stress_init_command();
80
76
    remote = parse_options(argc, argv, &unixctl_path);
81
77
    signal(SIGPIPE, SIG_IGN);
82
78
    sighup = signal_register(SIGHUP);
88
84
    if (want_mlockall) {
89
85
#ifdef HAVE_MLOCKALL
90
86
        if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
91
 
            VLOG_ERR("mlockall failed: %s", strerror(errno));
 
87
            VLOG_ERR("mlockall failed: %s", ovs_strerror(errno));
92
88
        }
93
89
#else
94
90
        VLOG_ERR("mlockall not supported on this system");
95
91
#endif
96
92
    }
97
93
 
98
 
    worker_start();
99
 
 
100
94
    retval = unixctl_server_create(unixctl_path, &unixctl);
101
95
    if (retval) {
102
96
        exit(EXIT_FAILURE);
108
102
 
109
103
    exiting = false;
110
104
    while (!exiting) {
111
 
        worker_run();
112
105
        if (signal_poll(sighup)) {
113
106
            vlog_reopen_log_file();
114
107
        }
127
120
        unixctl_server_run(unixctl);
128
121
        netdev_run();
129
122
 
130
 
        worker_wait();
131
123
        signal_wait(sighup);
132
124
        memory_wait();
133
125
        bridge_wait();
140
132
    }
141
133
    bridge_exit();
142
134
    unixctl_server_destroy(unixctl);
143
 
    signal_unregister(sighup);
144
135
 
145
136
    return 0;
146
137
}
153
144
        OPT_MLOCKALL,
154
145
        OPT_UNIXCTL,
155
146
        VLOG_OPTION_ENUMS,
156
 
        LEAK_CHECKER_OPTION_ENUMS,
157
147
        OPT_BOOTSTRAP_CA_CERT,
158
148
        OPT_ENABLE_DUMMY,
159
149
        OPT_DISABLE_SYSTEM,
160
150
        DAEMON_OPTION_ENUMS
161
151
    };
162
 
    static struct option long_options[] = {
 
152
    static const struct option long_options[] = {
163
153
        {"help",        no_argument, NULL, 'h'},
164
154
        {"version",     no_argument, NULL, 'V'},
165
155
        {"mlockall",    no_argument, NULL, OPT_MLOCKALL},
166
156
        {"unixctl",     required_argument, NULL, OPT_UNIXCTL},
167
157
        DAEMON_LONG_OPTIONS,
168
158
        VLOG_LONG_OPTIONS,
169
 
        LEAK_CHECKER_LONG_OPTIONS,
170
159
        STREAM_SSL_LONG_OPTIONS,
171
160
        {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
172
161
        {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
202
191
 
203
192
        VLOG_OPTION_HANDLERS
204
193
        DAEMON_OPTION_HANDLERS
205
 
        LEAK_CHECKER_OPTION_HANDLERS
206
194
        STREAM_SSL_OPTION_HANDLERS
207
195
 
208
196
        case OPT_PEER_CA_CERT:
261
249
           "  --unixctl=SOCKET        override default control socket name\n"
262
250
           "  -h, --help              display this help message\n"
263
251
           "  -V, --version           display version information\n");
264
 
    leak_checker_usage();
265
252
    exit(EXIT_SUCCESS);
266
253
}
267
254