Changeset 1383:0daaccf3bca7
- Timestamp:
- 10/21/09 23:19:54 (2 years ago)
- Branch:
- default
- Location:
- trunk
- Files:
-
- 12 edited
-
include/libdodo/exceptionBasic.h (modified) (3 diffs)
-
include/libdodo/pcExecutionProcess.h (modified) (2 diffs)
-
include/libdodo/pcExecutionThread.h (modified) (2 diffs)
-
include/libdodo/toolsOs.h (modified) (3 diffs)
-
include/libdodo/xexec.h (modified) (3 diffs)
-
src/exceptionBasic.cc (modified) (10 diffs)
-
src/pcExecutionProcess.cc (modified) (5 diffs)
-
src/pcExecutionThread.cc (modified) (5 diffs)
-
src/toolsOs.cc (modified) (7 diffs)
-
src/xexec.cc (modified) (7 diffs)
-
tests/toolsmisc_test/module.cc (modified) (2 diffs)
-
tests/xexec_test/module.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/libdodo/exceptionBasic.h
r1379 r1383 152 152 char discription[256]; ///< discription of the library 153 153 char hook[64]; ///< name of the function in module that will be as a hook 154 char cookie[32]; ///< cookie that would be passed to deinitModule 154 155 bool modules[MODULE_ENUMSIZE]; ///< for what modules handler should be set, @see exception::moduleEnum 155 156 }; … … 166 167 * @typedef deinitModule 167 168 * @brief defines type of deinit function for library 169 * @param cookie defines cookie data returned from initModule 168 170 * @note name in the library must be deinitExceptionBasicModule 169 171 */ 170 typedef void (*deinitModule)( );172 typedef void (*deinitModule)(char cookie[32]); 171 173 #endif 172 174 … … 292 294 #ifdef DL_EXT 293 295 static void *handles[MODULE_ENUMSIZE]; ///< handles to the libraries 296 static char cookies[MODULE_ENUMSIZE][32]; ///< handles to the libraries 294 297 295 298 static bool handlesOpened[MODULE_ENUMSIZE]; ///< map of the opened libraries -
trunk/include/libdodo/pcExecutionProcess.h
r1379 r1383 111 111 char discription[256]; ///< discription of module 112 112 char hook[64]; ///< name of function in module that will be a hook 113 char cookie[32]; ///< cookie that would be passed to deinitModule 113 114 short action; ///< action on object destruction, @see onDestructionEnum 114 115 }; … … 126 127 * @brief defines type of deinit function for library 127 128 * @note name in the library must be deinitPcExecutionProcessModule 129 * @param cookie defines cookie data returned from initModule 128 130 */ 129 typedef void (*deinitModule)( );131 typedef void (*deinitModule)(char cookie[32]); 130 132 131 133 /** -
trunk/include/libdodo/pcExecutionThread.h
r1379 r1383 114 114 char discription[256]; ///< discription of module 115 115 char hook[64]; ///< name of function in module that will be a hook 116 char cookie[32]; ///< cookie that would be passed to deinitModule 116 117 bool detached; ///< true if thread is detached 117 118 int stackSize; ///< size of stack for thread in bytes … … 130 131 * @typedef deinitModule 131 132 * @brief defines type of deinit function for library 133 * @param cookie defines cookie data returned from initModule 132 134 * @note name in the library must be deinitPcExecutionThreadModule 133 135 */ 134 typedef void (*deinitModule)( );136 typedef void (*deinitModule)(char cookie[32]); 135 137 136 138 /** -
trunk/include/libdodo/toolsOs.h
r1379 r1383 98 98 char discription[256]; ///< discription of the library 99 99 char hook[64]; ///< name of function in module that will be as a hook 100 char cookie[32]; ///< cookie that would be passed to deinitModule 100 101 long signal; ///< signal to set handler 101 102 int blockSignals; ///< signals to block during signal handling; -1 to ignore … … 113 114 * @typedef deinitSignalModule 114 115 * @brief defines type of deinit function for library 116 * @param cookie defines cookie data returned from initModule 115 117 * @note name in the library must be deinitToolOsSignalModule 116 118 */ 117 typedef void (*deinitSignalModule)( );119 typedef void (*deinitSignalModule)(char cookie[32]); 118 120 #endif 119 121 … … 517 519 static void *handlesSig[SIGNAL_ENUMSIZE]; ///< handles to modules 518 520 static bool handlesOpenedSig[SIGNAL_ENUMSIZE]; ///< map of opened modules 521 static char handlesCookiesSig[SIGNAL_ENUMSIZE][32]; ///< module cookies 519 522 #endif 520 523 -
trunk/include/libdodo/xexec.h
r1382 r1383 72 72 char discription[256]; ///< discription of the library 73 73 char hook[64]; ///< name of function in the library that will be used as hook 74 char cookie[32]; ///< cookie that would be passed to deinitModule 74 75 short type; ///< type of hook, @see xexec::actionEnum, could me grouped with OR 75 76 }; … … 86 87 * @typedef deinitModule 87 88 * @brief defines type of deinit function for library 89 * @param cookie defines cookie data returned from initModule 88 90 * @note name in the library must be deinitXexecModule 89 91 */ 90 typedef void (*deinitModule)( );92 typedef void (*deinitModule)(char cookie[32]); 91 93 #endif 92 94 … … 246 248 #ifdef DL_EXT 247 249 void *handle; ///< handle to library 250 char cookie[32]; ///< cookie that would be passed to deinitModule 248 251 #endif 249 252 }; -
trunk/src/exceptionBasic.cc
r1382 r1383 32 32 #ifdef DL_EXT 33 33 #include <dlfcn.h> 34 #include <string.h> 34 35 #endif 35 36 #ifdef __GNUC__ … … 303 304 NULL, 304 305 NULL 306 }; 307 308 //------------------------------------------------------------------- 309 310 char basic::cookies[][32] = { 311 {'\0', }, 312 {'\0', }, 313 {'\0', }, 314 {'\0', }, 315 {'\0', }, 316 {'\0', }, 317 {'\0', }, 318 {'\0', }, 319 {'\0', }, 320 {'\0', }, 321 {'\0', }, 322 {'\0', }, 323 {'\0', }, 324 {'\0', }, 325 {'\0', }, 326 {'\0', }, 327 {'\0', }, 328 {'\0', }, 329 {'\0', }, 330 {'\0', }, 331 {'\0', }, 332 {'\0', }, 333 {'\0', }, 334 {'\0', }, 335 {'\0', }, 336 {'\0', }, 337 {'\0', }, 338 {'\0', }, 339 {'\0', }, 340 {'\0', }, 341 {'\0', }, 342 {'\0', }, 343 {'\0', }, 344 {'\0', }, 345 {'\0', }, 346 {'\0', }, 347 {'\0', }, 348 {'\0', }, 349 {'\0', }, 350 {'\0', }, 351 {'\0', }, 352 {'\0', }, 353 {'\0', }, 354 {'\0', }, 355 {'\0', }, 356 {'\0', }, 357 {'\0', }, 358 {'\0', }, 359 {'\0', } 305 360 }; 306 361 #endif … … 814 869 deinit = (deinitModule)dlsym(handles[i], "deinitExceptionBasicModule"); 815 870 if (deinit != NULL) 816 deinit( );871 deinit(cookies[i]); 817 872 818 873 handlesOpened[i] = false; … … 881 936 deinit = (deinitModule)dlsym(handles[module], "deinitExceptionBasicModule"); 882 937 if (deinit != NULL) 883 deinit( );938 deinit(cookies[module]); 884 939 885 940 #ifndef DL_FAST … … 916 971 deinit = (deinitModule)dlsym(handles[i], "deinitExceptionBasicModule"); 917 972 if (deinit != NULL) 918 deinit( );973 deinit(cookies[i]); 919 974 920 975 #ifndef DL_FAST … … 946 1001 deinit = (deinitModule)dlsym(handles[module], "deinitExceptionBasicModule"); 947 1002 if (deinit != NULL) 948 deinit( );1003 deinit(cookies[module]); 949 1004 950 1005 #ifndef DL_FAST … … 978 1033 deinit = (deinitModule)dlsym(handles[i], "deinitExceptionBasicModule"); 979 1034 if (deinit != NULL) 980 deinit( );1035 deinit(cookies[i]); 981 1036 982 1037 #ifndef DL_FAST … … 1030 1085 deinit = (deinitModule)dlsym(handles[i], "deinitExceptionBasicModule"); 1031 1086 if (deinit != NULL) 1032 deinit( );1087 deinit(cookies[i]); 1033 1088 1034 1089 #ifndef DL_FAST … … 1048 1103 1049 1104 handlesOpened[i] = true; 1105 memcpy(cookies[i], mod.cookie, 32); 1050 1106 1051 1107 handlers[i] = in; … … 1079 1135 deinitModule deinit = (deinitModule)dlsym(handle, "deinitExceptionBasicModule"); 1080 1136 if (deinit != NULL) 1081 deinit( );1137 deinit(mod.cookie); 1082 1138 1083 1139 #ifndef DL_FAST -
trunk/src/pcExecutionProcess.cc
r1379 r1383 55 55 joined(false), 56 56 status(0) 57 #ifdef DL_EXT 58 , 59 handle(NULL) 60 #endif 57 61 { 62 #ifdef DL_EXT 63 memset(cookie, 0x0, 32); 64 #endif 58 65 } 59 66 … … 67 74 #ifdef DL_EXT 68 75 void *handle; ///< handle to library 76 char cookie[32]; ///< cookie that would be passed to deinitModule 69 77 #endif 70 78 }; … … 135 143 handle->action = m.action; 136 144 handle->func = f; 145 memcpy(handle->cookie, m.cookie, 32); 137 146 } catch (...) { 138 147 if (handle) { … … 179 188 deinit = (deinitModule)dlsym(handle->handle, "deinitPcExecutionProcessModule"); 180 189 if (deinit != NULL) 181 deinit( );190 deinit(handle->cookie); 182 191 183 192 #ifndef DL_FAST … … 292 301 deinitModule deinit = (deinitModule)dlsym(handle, "deinitPcExecutionProcessModule"); 293 302 if (deinit != NULL) 294 deinit( );303 deinit(mod.cookie); 295 304 296 305 #ifndef DL_FAST -
trunk/src/pcExecutionThread.cc
r1379 r1383 55 55 thread(0), 56 56 #endif 57 executed(false), 58 joined(false), 59 status(0) 57 executed(false), 58 joined(false), 59 status(0) 60 #ifdef DL_EXT 61 , 62 handle(NULL) 63 #endif 60 64 { 65 #ifdef DL_EXT 66 memset(cookie, 0x0, 32); 67 #endif 61 68 } 62 69 … … 81 88 #ifdef DL_EXT 82 89 void *handle; ///< handle to library 90 char cookie[32]; ///< cookie that would be passed to deinitModule 83 91 #endif 84 92 }; … … 204 212 handle->action = m.action; 205 213 handle->func = f; 214 memcpy(handle->cookie, m.cookie, 32); 206 215 } catch (...) { 207 216 if (handle) { … … 265 274 deinit = (deinitModule)dlsym(handle->handle, "deinitPcExecutionThreadModule"); 266 275 if (deinit != NULL) 267 deinit( );276 deinit(handle->cookie); 268 277 269 278 #ifndef DL_FAST … … 386 395 deinitModule deinit = (deinitModule)dlsym(handle, "deinitPcExecutionThreadModule"); 387 396 if (deinit != NULL) 388 deinit( );397 deinit(mod.cookie); 389 398 390 399 #ifndef DL_FAST -
trunk/src/toolsOs.cc
r1379 r1383 104 104 false 105 105 }; 106 //------------------------------------------------------------------- 107 108 char os::handlesCookiesSig[][32] = { 109 {'\0', }, 110 {'\0', }, 111 {'\0', }, 112 {'\0', }, 113 {'\0', }, 114 {'\0', }, 115 {'\0', }, 116 {'\0', }, 117 {'\0', }, 118 {'\0', }, 119 {'\0', }, 120 {'\0', }, 121 {'\0', }, 122 {'\0', }, 123 {'\0', }, 124 {'\0', }, 125 {'\0', }, 126 {'\0', }, 127 {'\0', } 128 }; 106 129 #endif 107 130 … … 744 767 deinit = (deinitSignalModule)dlsym(handlesSig[handleSignal], "deinitToolsOsSignalModule"); 745 768 if (deinit != NULL) 746 deinit( );769 deinit(handlesCookiesSig[handleSignal]); 747 770 748 771 #ifndef DL_FAST … … 784 807 deinit = (deinitSignalModule)dlsym(handlesSig[handleSignal], "deinitToolsOsSignalModule"); 785 808 if (deinit != NULL) 786 deinit( );809 deinit(handlesCookiesSig[handleSignal]); 787 810 788 811 #ifndef DL_FAST … … 840 863 deinit = (deinitSignalModule)dlsym(handlesSig[handleSignal], "deinitToolsOsSignalModule"); 841 864 if (deinit != NULL) 842 deinit( );865 deinit(handlesCookiesSig[handleSignal]); 843 866 844 867 #ifndef DL_FAST … … 912 935 deinit = (deinitSignalModule)dlsym(handlesSig[handleSignal], "deinitToolsOsSignalModule"); 913 936 if (deinit != NULL) 914 deinit( );937 deinit(handlesCookiesSig[handleSignal]); 915 938 916 939 #ifndef DL_FAST … … 951 974 __signal_module__ mod = init(toInit); 952 975 976 deinitSignalModule deinit = (deinitSignalModule)dlsym(handle, "deinitToolsOsSignalModule"); 977 if (init != NULL) 978 deinit(mod.cookie); 979 980 953 981 #ifndef DL_FAST 954 982 if (dlclose(handle) != 0) 955 983 throw exception::basic(exception::MODULE_TOOLSOS, OSEX_MODULE, exception::ERRNO_DYNLOAD, 0, dlerror(), __LINE__, __FILE__); 956 957 984 #endif 958 985 … … 988 1015 deinit = (deinitSignalModule)dlsym(handlesSig[handleSignal], "deinitToolsOsSignalModule"); 989 1016 if (deinit != NULL) 990 deinit( );1017 deinit(handlesCookiesSig[handleSignal]); 991 1018 992 1019 #ifndef DL_FAST -
trunk/src/xexec.cc
r1382 r1383 32 32 #ifdef DL_EXT 33 33 #include <dlfcn.h> 34 #include <string.h> 34 35 #endif 35 36 … … 83 84 deinit = (deinitModule)dlsym(i->handle, "deinitXexecModule"); 84 85 if (deinit != NULL) 85 deinit( );86 deinit(i->cookie); 86 87 87 88 #ifndef DL_FAST … … 98 99 deinit = (deinitModule)dlsym(i->handle, "deinitXexecModule"); 99 100 if (deinit != NULL) 100 deinit( );101 deinit(i->cookie); 101 102 102 103 #ifndef DL_FAST … … 147 148 deinit = (deinitModule)dlsym(current->handle, "deinitXexecModule"); 148 149 if (deinit != NULL) 149 deinit( );150 deinit(current->cookie); 150 151 151 152 #ifndef DL_FAST … … 231 232 __module__ mod = init(initData); 232 233 234 deinitModule deinit = (deinitModule)dlsym(handle, "deinitXexecModule"); 235 if (deinit != NULL) 236 deinit(mod.cookie); 237 233 238 #ifndef DL_FAST 234 239 if (dlclose(handle) != 0) … … 265 270 throw exception::basic(exception::MODULE_XEXEC, XEXECEX_ADDXEXEC, exception::ERRNO_DYNLOAD, 0, dlerror(), __LINE__, __FILE__); 266 271 267 __module__ info= init(initData);268 269 hook in = (hook)dlsym(e.handle, info.hook);272 __module__ mod = init(initData); 273 274 hook in = (hook)dlsym(e.handle, mod.hook); 270 275 if (in == NULL) 271 276 throw exception::basic(exception::MODULE_XEXEC, XEXECEX_ADDXEXEC, exception::ERRNO_DYNLOAD, 0, dlerror(), __LINE__, __FILE__); 272 277 273 278 e.func = in; 274 275 if (info.type & ACTION_PREEXEC) { 279 memcpy(e.cookie, mod.cookie, 32); 280 281 if (mod.type & ACTION_PREEXEC) { 276 282 e.id = ++execs; 277 283 preExec.push_back(e); … … 279 285 } 280 286 281 if ( info.type & ACTION_POSTEXEC) {287 if (mod.type & ACTION_POSTEXEC) { 282 288 e.id = ++execs; 283 289 postExec.push_back(e); 284 290 postExecId = e.id; 285 291 } 286 287 deinitModule deinit = (deinitModule)dlsym(e.handle, "deinitXexecModule");288 if (deinit == NULL)289 throw exception::basic(exception::MODULE_XEXEC, XEXECEX_ADDXEXEC, exception::ERRNO_DYNLOAD, 0, dlerror(), __LINE__, __FILE__);290 291 deinit();292 292 } 293 293 -
trunk/tests/toolsmisc_test/module.cc
r1379 r1383 31 31 "test module", 32 32 "handler", 33 "cookie", 33 34 { false, } 34 35 }; … … 40 41 41 42 void 42 deinitExceptionBasicModule( )43 deinitExceptionBasicModule(char cookie[32]) 43 44 { 44 std::cout << "deactivation .";45 std::cout << "deactivation(cookie = " << cookie << ")\n"; 45 46 } 46 47 }; -
trunk/tests/xexec_test/module.cc
r1379 r1383 45 45 initXexecModule(void *data) 46 46 { 47 xexec::__module__ module; 47 xexec::__module__ module = { 48 {'\0', }, 49 {'\0', }, 50 {'\0', }, 51 {'\0', }, 52 0 53 }; 48 54 49 55 std::cout << "activation\n"; … … 51 57 strcpy(module.name, "test"); 52 58 strcpy(module.discription, "test module"); 59 strcpy(module.cookie, "test cookie"); 53 60 module.type = xexec::ACTION_PREEXEC; 54 61 … … 62 69 63 70 void 64 deinitXexecModule( )71 deinitXexecModule(char cookie[32]) 65 72 { 66 std::cout << "deactivation \n";73 std::cout << "deactivation(cookie = " << cookie << ")\n"; 67 74 } 68 75 };
Note: See TracChangeset
for help on using the changeset viewer.
