aboutsummaryrefslogtreecommitdiff
path: root/src/cli.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2014-02-18 18:34:35 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2014-02-18 18:34:35 (GMT)
commit43bdf499d56c09a520dc3bc03438dee4092d3d58 (patch)
treefc08fe113eb7c577eb402bf9ffebd8038d4f90da /src/cli.hh
parent3696562aa87c7e68cb8b00b85f0e8d5cf2d199bf (diff)
downloadfluxbox-43bdf499d56c09a520dc3bc03438dee4092d3d58.zip
fluxbox-43bdf499d56c09a520dc3bc03438dee4092d3d58.tar.bz2
Fix race condition on shutdown
This commit fixes primarily a race condition that occurs when xinit(1) shuts down: by not acting properly fluxbox gets caught in an infinite loop. It caused bug #1100. xinit(1) sends a SIGHUP signal to all processes. fluxbox tries to shutdown itself properly by shutting down workspaces and screens. While doing that, the Xserver might be gone already. Additionally, fluxbox used to restart() itself on SIGHUP, which is clearly not the right thing to do when xinit(1) is about to end the session. So, fluxbox does this: * handling SIGHUP now shuts down fluxbox without clearing workspaces and screens. * A 2 second alarm() is triggered in Fluxbox::shutdown() as a last resort * XSetIOErrorHandler() is used to recognize the disconnect from the xserver. * SIGUSR1 is for restarting fluxbox, SIGUSR2 for reloading the config * FbTk/SignalHandler.cc/hh is gone; this unused abstraction served currently no real purpose. Signal handling is now done in main.cc * Unrelated to the issue itself src/main.cc was trimmed down quite a bit and the code (responsible for handling the command line interface) was moved to src/cli*
Diffstat (limited to 'src/cli.hh')
-rw-r--r--src/cli.hh50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/cli.hh b/src/cli.hh
new file mode 100644
index 0000000..ac1e655
--- /dev/null
+++ b/src/cli.hh
@@ -0,0 +1,50 @@
1#ifndef CLI_HH
2#define CLI_HH
3
4// cli.hh for Fluxbox Window Manager
5// Copyright (c) 2014 - Mathias Gumz <akira at fluxbox.org>
6//
7// Permission is hereby granted, free of charge, to any person obtaining a
8// copy of this software and associated documentation files (the "Software"),
9// to deal in the Software without restriction, including without limitation
10// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11// and/or sell copies of the Software, and to permit persons to whom the
12// Software is furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25#include <fstream>
26#include <string>
27
28namespace FluxboxCli {
29
30struct Options {
31 Options();
32 int parse(int argc, char** argv);
33
34 std::string session_display;
35 std::string rc_path;
36 std::string rc_file;
37 std::string log_filename;
38 bool xsync;
39};
40
41
42void showInfo(std::ostream&);
43
44void setupConfigFiles(const std::string& dirname, const std::string& rc);
45void updateConfigFilesIfNeeded(const std::string& rc_file);
46
47}
48
49#endif /* end of include guard: CLI_HH */
50