]> git.pld-linux.org Git - packages/libreoffice.git/blob - openoffice-use-fork.patch
- up
[packages/libreoffice.git] / openoffice-use-fork.patch
1 --- tools/source/solar/solar.c  15 Apr 2003 17:55:43 -0000      1.2
2 +++ tools/source/solar/solar.c  22 Oct 2003 13:08:21 -0000
3 @@ -58,17 +58,22 @@
4   *
5   *
6   ************************************************************************/
7 -#include <stdio.h>
8  
9 -#ifdef UNX
10 +/* POSIX defines that a program is undefined after a SIG_SEGV.  The
11 + * code stopped working on Linux Kernel 2.6 so I have moved this back to
12 + * use FORK.
13 + * If at a later time the signals work correctly with the Linux Kernel 2.6
14 + * then this change may be reverted although not strictly posix safe. */
15 +#define USE_FORK_TO_CHECK 1
16 +
17 +#include <stdio.h>
18 +#include <stdlib.h>
19 +#include <errno.h>
20 +#include <string.h>
21  
22  #include <unistd.h>
23  #include <sys/types.h>
24  
25 -#ifdef HPUX
26 -#include <stdlib.h>
27 -#endif
28 -
29  #define I_STDARG
30  #ifdef I_STDARG
31  #include <stdarg.h>
32 @@ -84,9 +89,6 @@
33  #include <setjmp.h>
34  #endif
35  
36 -#else
37 -#endif
38 -
39  #define printTypeSize(Type,Name)       printf( "sizeof(%s)\t= %d\n", Name, sizeof (Type) )
40  
41  #define isSignedType(Type)     (((Type)-1) < 0)
42 @@ -133,7 +135,7 @@
43  
44  /*************************************************************************
45  |*
46 -|*     IsStackGrowingDown()
47 +|*     GetStackAlignment()
48  |*
49  |*     Beschreibung            Alignment von char Parametern, die (hoffentlich)
50  |*                                             ueber den Stack uebergeben werden
51 @@ -176,8 +178,6 @@
52  typedef int (*TestFunc)( Type, void* );
53  
54  
55 -#ifdef UNX
56 -
57  /*************************************************************************
58  |*
59  |*     PrintArgs()
60 @@ -230,11 +230,11 @@
61  void SignalHdl( int sig )
62  {
63    bSignal = 1;
64 -  /*
65 +  
66    fprintf( stderr, "Signal %d caught\n", sig );
67 -  signal( sig, SignalHdl );
68 -  /**/
69 -  longjmp( check_env, sig );
70 +  signal( SIGSEGV,     SIG_DFL );
71 +  signal( SIGBUS,      SIG_DFL );
72 +  siglongjmp( check_env, sig );
73  }
74  #endif
75  
76 @@ -270,7 +270,7 @@
77  
78    bSignal = 0;
79  
80 -  if ( !setjmp( check_env ) )
81 +  if ( !sigsetjmp( check_env, 0 ) )
82    {
83         signal( SIGSEGV,        SignalHdl );
84         signal( SIGBUS,         SignalHdl );
85 @@ -286,9 +286,6 @@
86  #endif
87  }
88  
89 -#endif
90 -
91 -
92  /*************************************************************************
93  |*
94  |*     GetAtAddress()
95 @@ -373,6 +370,7 @@
96  int CheckSetAccess( Type eT, void* p )
97  {
98    int b;
99 +
100    b = -1 != check( (TestFunc)SetAtAddress, eT, p );
101  #if OSL_DEBUG_LEVEL > 1
102    fprintf( stderr,
103 @@ -437,7 +435,7 @@
104  |*     Letzte Aenderung
105  |*
106  *************************************************************************/
107 -Description_Ctor( struct Description* pThis )
108 +void Description_Ctor( struct Description* pThis )
109  {
110    pThis->bBigEndian                    = IsBigEndian();
111    pThis->bStackGrowsDown       = IsStackGrowingDown();
112 @@ -468,16 +466,21 @@
113  |*     Letzte Aenderung
114  |*
115  *************************************************************************/
116 -Description_Print( struct Description* pThis, char* name )
117 +void Description_Print( struct Description* pThis, char* name )
118  {
119    int i;
120    FILE* f = fopen( name, "w" );
121 +  if( ! f ) {
122 +         fprintf( stderr, "Unable to open file %s: %s\n", name, strerror( errno ) );
123 +         exit( 99 );
124 +  }
125    fprintf( f, "#define __%s\n",
126                    pThis->bBigEndian ? "BIGENDIAN" : "LITTLEENDIAN" );
127    for ( i = 0; i < 3; i++ )
128         fprintf( f, "#define __ALIGNMENT%d\t%d\n",
129 -                        1 << i+1, pThis->nAlignment[i] );
130 -  fprintf( f, "#define __STACKALIGNMENT wird nicht benutzt\t%d\n", pThis->nStackAlignment );
131 +                        1 << (i+1), pThis->nAlignment[i] );
132 +  fprintf( f, "/* Stack alignment is not used... */\n" );
133 +  fprintf( f, "#define __STACKALIGNMENT\t%d\n", pThis->nStackAlignment );
134    fprintf( f, "#define __STACKDIRECTION\t%d\n",
135                    pThis->bStackGrowsDown ? -1 : 1 );
136    fprintf( f, "#define __SIZEOFCHAR\t%d\n", sizeof( char ) );
137 @@ -538,8 +541,12 @@
138         printf( ( CheckGetAccess( eT, (long*)&a[i] ) ? "OK\n" : "ERROR\n" ) );
139    }
140  }
141 -
142 -main( int argc, char* argv[] )
143 +/************************************************************************
144 + *
145 + *     Use C code to determine the characteristics of the building platform.
146 + *
147 + ************************************************************************/
148 +int main( int argc, char* argv[] )
149  {
150    printTypeSign( char, "char" );
151    printTypeSign( short, "short" );
152 @@ -574,7 +581,6 @@
153         Description_Ctor( &description );
154         Description_Print( &description, argv[1] );
155    }
156 -
157    {
158         char* p = NULL;
159         InfoMemoryAccess( p );
This page took 0.039036 seconds and 3 git commands to generate.