ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/gvpe.C
(Generate patch)

Comparing gvpe/src/gvpe.C (file contents):
Revision 1.17 by pcg, Mon Mar 23 15:22:00 2009 UTC vs.
Revision 1.18 by root, Tue Feb 8 23:11:36 2011 UTC

75 75
76/* If zero, don't detach from the terminal. */ 76/* If zero, don't detach from the terminal. */
77static int do_detach = 1; 77static int do_detach = 1;
78 78
79static struct option const long_options[] = 79static struct option const long_options[] =
80 { 80{
81 {"config", required_argument, NULL, 'c'}, 81 {"config", required_argument, NULL, 'c'},
82 {"help", no_argument, &show_help, 1}, 82 {"help", no_argument, &show_help, 1},
83 {"version", no_argument, &show_version, 1}, 83 {"version", no_argument, &show_version, 1},
84 {"no-detach", no_argument, &do_detach, 0}, 84 {"no-detach", no_argument, &do_detach, 0},
85 {"log-level", required_argument, NULL, 'l'}, 85 {"log-level", required_argument, NULL, 'l'},
86 {"mlock", no_argument, &do_mlock, 1}, 86 {"mlock", no_argument, &do_mlock, 1},
87 {NULL, 0, NULL, 0} 87 {NULL, 0, NULL, 0}
88 }; 88};
89 89
90static void 90static void
91usage (int status) 91usage (int status)
92{ 92{
93 if (status != 0) 93 if (status != 0)
106 } 106 }
107 107
108 exit (status); 108 exit (status);
109} 109}
110 110
111void 111static void
112parse_options (int argc, char **argv, char **envp) 112parse_options (int argc, char **argv, char **envp)
113{ 113{
114 int r; 114 int r;
115 int option_index = 0; 115 int option_index = 0;
116 116
149 break; 149 break;
150 } 150 }
151 } 151 }
152} 152}
153 153
154/*
155 Close network connections, and terminate neatly 154// close network connections, and terminate neatly
156*/ 155static void
157void cleanup_and_exit(int c) 156cleanup_and_exit (int c)
158{ 157{
159 network.shutdown_all (); 158 network.shutdown_all ();
160 159
161 if (conf.pidfilename) 160 if (conf.pidfilename)
162 remove_pid (conf.pidfilename); 161 remove_pid (conf.pidfilename);
164 slog (L_INFO, _("terminating with exit code %d"), c); 163 slog (L_INFO, _("terminating with exit code %d"), c);
165 164
166 exit (c); 165 exit (c);
167} 166}
168 167
169/*
170 Signal handlers. 168// signal handlers
171*/ 169static RETSIGTYPE
172RETSIGTYPE
173sigterm_handler (int a) 170sigterm_handler (int a)
174{ 171{
175 network.events |= vpn::EVENT_SHUTDOWN; 172 network.events |= vpn::EVENT_SHUTDOWN;
176 network.event.start (); 173 network.event.start ();
177} 174}
178 175
179RETSIGTYPE 176static RETSIGTYPE
180sighup_handler (int a) 177sighup_handler (int a)
181{ 178{
182 network.events |= vpn::EVENT_RECONNECT; 179 network.events |= vpn::EVENT_RECONNECT;
183 network.event.start (); 180 network.event.start ();
184} 181}
185 182
186RETSIGTYPE 183static RETSIGTYPE
187sigusr1_handler (int a) 184sigusr1_handler (int a)
188{ 185{
189 network.dump_status (); 186 network.dump_status ();
190} 187}
191 188
192RETSIGTYPE 189static RETSIGTYPE
193sigusr2_handler (int a) 190sigusr2_handler (int a)
194{ 191{
195} 192}
196 193
197void 194static void
198setup_signals (void) 195setup_signals (void)
199{ 196{
200 struct sigaction act; 197 struct sigaction act;
201 198
202 sigfillset (&act.sa_mask); 199 sigfillset (&act.sa_mask);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines