diff options
author | Armin Weatherwax | 2010-03-03 19:44:59 +0100 |
---|---|---|
committer | Armin Weatherwax | 2010-03-04 22:43:04 +0100 |
commit | e417a8dad62c484ffbc961727ca43870e3510529 (patch) | |
tree | 7790f80d09322d655a5bc87dc150606e93e00778 /linden/indra/newview/llappviewerlinux_api_dbus.cpp | |
parent | Robin Cornelius: SNOW-485 Fix deadlock in LLTextureFetchWorker. (diff) | |
download | meta-impy-e417a8dad62c484ffbc961727ca43870e3510529.zip meta-impy-e417a8dad62c484ffbc961727ca43870e3510529.tar.gz meta-impy-e417a8dad62c484ffbc961727ca43870e3510529.tar.bz2 meta-impy-e417a8dad62c484ffbc961727ca43870e3510529.tar.xz |
Linux: de-obfuscate dbus handling; better handle_secondlifeprotocol.sh.
Diffstat (limited to 'linden/indra/newview/llappviewerlinux_api_dbus.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerlinux_api_dbus.cpp | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/linden/indra/newview/llappviewerlinux_api_dbus.cpp b/linden/indra/newview/llappviewerlinux_api_dbus.cpp deleted file mode 100644 index ee160d0..0000000 --- a/linden/indra/newview/llappviewerlinux_api_dbus.cpp +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /** | ||
2 | * @file llappviewerlinux_api_dbus.cpp | ||
3 | * @brief dynamic DBus symbol-grabbing code | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at | ||
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
22 | * | ||
23 | * By copying, modifying or distributing this software, you acknowledge | ||
24 | * that you have read and understood your obligations described above, | ||
25 | * and agree to abide by those obligations. | ||
26 | * | ||
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
29 | * COMPLETENESS OR PERFORMANCE. | ||
30 | * $/LicenseInfo$ | ||
31 | */ | ||
32 | |||
33 | #if LL_DBUS_ENABLED | ||
34 | |||
35 | #include "linden_common.h" | ||
36 | |||
37 | extern "C" { | ||
38 | #include <dbus/dbus-glib.h> | ||
39 | |||
40 | #include "apr_pools.h" | ||
41 | #include "apr_dso.h" | ||
42 | } | ||
43 | |||
44 | #define DEBUGMSG(...) lldebugs << llformat(__VA_ARGS__) << llendl | ||
45 | #define INFOMSG(...) llinfos << llformat(__VA_ARGS__) << llendl | ||
46 | #define WARNMSG(...) llwarns << llformat(__VA_ARGS__) << llendl | ||
47 | |||
48 | #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL | ||
49 | #include "llappviewerlinux_api_dbus_syms_raw.inc" | ||
50 | #undef LL_DBUS_SYM | ||
51 | |||
52 | static bool sSymsGrabbed = false; | ||
53 | static apr_pool_t *sSymDBUSDSOMemoryPool = NULL; | ||
54 | static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL; | ||
55 | |||
56 | bool grab_dbus_syms(std::string dbus_dso_name) | ||
57 | { | ||
58 | if (sSymsGrabbed) | ||
59 | { | ||
60 | // already have grabbed good syms | ||
61 | return TRUE; | ||
62 | } | ||
63 | |||
64 | bool sym_error = false; | ||
65 | bool rtn = false; | ||
66 | apr_status_t rv; | ||
67 | apr_dso_handle_t *sSymDBUSDSOHandle = NULL; | ||
68 | |||
69 | #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0) | ||
70 | |||
71 | //attempt to load the shared library | ||
72 | apr_pool_create(&sSymDBUSDSOMemoryPool, NULL); | ||
73 | |||
74 | if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle, | ||
75 | dbus_dso_name.c_str(), | ||
76 | sSymDBUSDSOMemoryPool) )) | ||
77 | { | ||
78 | INFOMSG("Found DSO: %s", dbus_dso_name.c_str()); | ||
79 | |||
80 | #include "llappviewerlinux_api_dbus_syms_raw.inc" | ||
81 | |||
82 | if ( sSymDBUSDSOHandle ) | ||
83 | { | ||
84 | sSymDBUSDSOHandleG = sSymDBUSDSOHandle; | ||
85 | sSymDBUSDSOHandle = NULL; | ||
86 | } | ||
87 | |||
88 | rtn = !sym_error; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str()); | ||
93 | rtn = false; // failure | ||
94 | } | ||
95 | |||
96 | if (sym_error) | ||
97 | { | ||
98 | WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries."); | ||
99 | } | ||
100 | #undef LL_DBUS_SYM | ||
101 | |||
102 | sSymsGrabbed = rtn; | ||
103 | return rtn; | ||
104 | } | ||
105 | |||
106 | |||
107 | void ungrab_dbus_syms() | ||
108 | { | ||
109 | // should be safe to call regardless of whether we've | ||
110 | // actually grabbed syms. | ||
111 | |||
112 | if ( sSymDBUSDSOHandleG ) | ||
113 | { | ||
114 | apr_dso_unload(sSymDBUSDSOHandleG); | ||
115 | sSymDBUSDSOHandleG = NULL; | ||
116 | } | ||
117 | |||
118 | if ( sSymDBUSDSOMemoryPool ) | ||
119 | { | ||
120 | apr_pool_destroy(sSymDBUSDSOMemoryPool); | ||
121 | sSymDBUSDSOMemoryPool = NULL; | ||
122 | } | ||
123 | |||
124 | // NULL-out all of the symbols we'd grabbed | ||
125 | #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0) | ||
126 | #include "llappviewerlinux_api_dbus_syms_raw.inc" | ||
127 | #undef LL_DBUS_SYM | ||
128 | |||
129 | sSymsGrabbed = false; | ||
130 | } | ||
131 | |||
132 | #endif // LL_DBUS_ENABLED | ||