summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-12 09:18:09 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-12 09:18:09 +0000
commit083eee51aba0e72a72cbac3c80cb5a34835b94e9 (patch)
treec31cdf382c4363289534202ad5e4cb825c2362da /sal
parentbcf26e36bbdb1c48c91e351d3968d4600922d764 (diff)
CWS-TOOLING: integrate CWS sb103
2009-01-15 15:28:08 +0100 sb r266375 : #i97629# set UNO_PATH in python start program and use it in bootstrap function in officehelper.py (and do not erroneously encode a vnd.sun.star.pathname URE_BOOTSTRAP value in tools::extendApplicationEnvironment) 2009-01-15 10:40:17 +0100 sb r266338 : #i97424# explicit shut down of ImplImageTree singleton in DeInitVCL still required 2009-01-14 12:07:15 +0100 sb r266276 : CWS-TOOLING: rebase CWS sb103 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 08:53:02 +0100 sb r266266 : #i96284# remove implementation of unused (but expensive) link feature; plus some general cleanup 2009-01-08 14:42:59 +0100 sb r266010 : #i96683# enable dlclose for GCC 3 (based on a patch by cmc) 2009-01-06 14:18:23 +0100 sb r265920 : #i97424# spurious unreferenced local variables 2008-12-19 15:33:39 +0100 sb r265727 : #i57359# no need for a special glibc 2.2.4 based libgcc_s.so.1 for URE any more as the general one used for OOo is guaranteed to be based on at least glibc 2.2.4, anyway 2008-12-19 13:54:37 +0100 sb r265724 : #i97424# clean up and speed up vcl ImplImageTree 2008-12-18 14:28:10 +0100 sb r265690 : #i97132# spread usage of the rtl::Static pattern (patch by cmc) 2008-12-15 14:33:00 +0100 sb r265499 : #i90492# generate UTF-8 encoded output (patch by tora) 2008-12-15 11:45:05 +0100 sb r265469 : #i95593# -Djava.library.path to find libtest_javauno_any.so 2008-12-15 11:23:14 +0100 sb r265468 : #i93769# it appears that Java nowadays expects file URIs in UTF-8, so ExternalUriReferenceTranslator.toExternal must not be called 2008-12-10 12:02:50 +0100 sb r265164 : #i93219# use (corrected) signal handling instead of forking again (to avoid unintended generation of core files)
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/module.c12
-rw-r--r--sal/typesconfig/typesconfig.c98
2 files changed, 30 insertions, 80 deletions
diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c
index ae323a663..4ae21e196 100644
--- a/sal/osl/unx/module.c
+++ b/sal/osl/unx/module.c
@@ -150,22 +150,16 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
if (hModule)
{
#ifndef NO_DL_FUNCTIONS
-#ifndef GCC
- /* gcc (2.9.1 (egcs), 295) registers atexit handlers for
- * static destructors which obviously cannot
- * be called after dlclose. A compiler "feature". The workaround for now
- * is not to dlclose libraries. Since most of them are closed at shutdown
- * this does not make that much a difference
- */
int nRet = dlclose(hModule);
#if OSL_DEBUG_LEVEL > 1
if (nRet != 0)
{
- fprintf(stderr, "Error osl_unlocadModule: %s\n", dlerror());
+ fprintf(stderr, "Error osl_unloadModule: %s\n", dlerror());
}
+#else
+ (void) nRet;
#endif /* if OSL_DEBUG_LEVEL */
-#endif /* ifndef GCC */
#endif /* ifndef NO_DL_FUNCTIONS */
}
diff --git a/sal/typesconfig/typesconfig.c b/sal/typesconfig/typesconfig.c
index 62a025a40..4a9dd6ba2 100644
--- a/sal/typesconfig/typesconfig.c
+++ b/sal/typesconfig/typesconfig.c
@@ -28,13 +28,6 @@
*
************************************************************************/
-/* POSIX defines that a program is undefined after a SIG_SEGV. The
- * code stopped working on Linux Kernel 2.6 so I have moved this back to
- * use FORK.
- * If at a later time the signals work correctly with the Linux Kernel 2.6
- * then this change may be reverted although not strictly posix safe. */
-#define USE_FORK_TO_CHECK 1
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -43,20 +36,10 @@
#include <unistd.h>
#include <sys/types.h>
-#define I_STDARG
-#ifdef I_STDARG
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#define NO_USE_FORK_TO_CHECK
-#ifdef USE_FORK_TO_CHECK
-#include <sys/wait.h>
-#else
#include <signal.h>
#include <setjmp.h>
-#endif
#define printTypeSize(Type,Name) printf( "sizeof(%s)\t\t= %d\n", Name, (int) sizeof (Type) )
@@ -99,22 +82,12 @@ typedef int (*TestFunc)( Type, void* );
|* Letzte Aenderung
|*
*************************************************************************/
-#ifdef I_STDARG
void PrintArgs( int p, ... )
-#else
-void PrintArgs( p, va_alist )
-int p;
-va_dcl
-#endif
{
int value;
va_list ap;
-#ifdef I_STDARG
va_start( ap, p );
-#else
- va_start( ap );
-#endif
printf( "value = %d", p );
@@ -125,7 +98,6 @@ va_dcl
va_end(ap);
}
-#ifndef USE_FORK_TO_CHECK
/*************************************************************************
|*
|* SignalHdl()
@@ -136,18 +108,16 @@ va_dcl
|* Letzte Aenderung
|*
*************************************************************************/
-static jmp_buf check_env;
-static int bSignal;
+
+static sigjmp_buf jmpbuf;
+static volatile sig_atomic_t hit;
+
void SignalHdl( int sig )
{
- bSignal = 1;
-
- fprintf( stderr, "Signal %d caught\n", sig );
- signal( SIGSEGV, SIG_DFL );
- signal( SIGBUS, SIG_DFL );
- siglongjmp( check_env, sig );
+ (void) sig; // ignored
+ hit = 1;
+ siglongjmp(jmpbuf, 0);
}
-#endif
/*************************************************************************
|*
@@ -161,40 +131,26 @@ void SignalHdl( int sig )
*************************************************************************/
int check( TestFunc func, Type eT, void* p )
{
-#ifdef USE_FORK_TO_CHECK
- pid_t nChild = fork();
- if ( nChild )
- {
- int exitVal;
- wait( &exitVal );
- if ( exitVal & 0xff )
- return -1;
- else
- return exitVal >> 8;
- }
- else
- {
- exit( func( eT, p ) );
- }
-#else
- int result;
-
- bSignal = 0;
-
- if ( !sigsetjmp( check_env, 1 ) )
- {
- signal( SIGSEGV, SignalHdl );
- signal( SIGBUS, SignalHdl );
- result = func( eT, p );
- signal( SIGSEGV, SIG_DFL );
- signal( SIGBUS, SIG_DFL );
- }
-
- if ( bSignal )
- return -1;
- else
- return 0;
-#endif
+ hit = 0;
+ if (sigsetjmp(jmpbuf, 1) == 0) {
+ struct sigaction sa;
+ sa.sa_handler = SignalHdl;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ if (sigaction(SIGBUS, &sa, NULL) != 0 ||
+ sigaction(SIGSEGV, &sa, NULL) != 0)
+ {
+ abort();
+ }
+ func(eT, p);
+ sa.sa_handler = SIG_DFL;
+ if (sigaction(SIGBUS, &sa, NULL) != 0 ||
+ sigaction(SIGSEGV, &sa, NULL) != 0)
+ {
+ abort();
+ }
+ }
+ return hit ? -1 : 0;
}
/*************************************************************************