Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 121658 | Differences between
and this patch

Collapse All | Expand All

(-)src-native-new/src/transport/transportSupport/NoRAtransportSupport.dsp (-4 / +4 lines)
Lines 43-49 Link Here
43
# PROP Ignore_Export_Lib 0
43
# PROP Ignore_Export_Lib 0
44
# PROP Target_Dir ""
44
# PROP Target_Dir ""
45
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /YX /FD /c
45
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /YX /FD /c
46
# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "$(RAC_SDK_HOME)/include" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /YX /FD /c
46
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../RACommon" /I "../RASharedMemory" /I "../RASocket" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /YX /FD /c
47
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
47
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
48
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
48
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49
# ADD BASE RSC /l 0x409 /d "NDEBUG"
49
# ADD BASE RSC /l 0x409 /d "NDEBUG"
Lines 53-59 Link Here
53
# ADD BSC32 /nologo
53
# ADD BSC32 /nologo
54
LINK32=link.exe
54
LINK32=link.exe
55
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
55
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
56
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib /nologo /dll /machine:I386 /def:".\TransportSupport.def" /out:"../../../bin/transportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"$(RAC_SDK_HOME)/lib" /libpath:"../../../lib"
56
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib /nologo /dll /machine:I386 /def:".\TransportSupport.def" /out:"../../../bin/transportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib"
57
# SUBTRACT LINK32 /pdb:none
57
# SUBTRACT LINK32 /pdb:none
58
58
59
!ELSEIF  "$(CFG)" == "NoRAtransportSupport - Win32 Debug"
59
!ELSEIF  "$(CFG)" == "NoRAtransportSupport - Win32 Debug"
Lines 70-76 Link Here
70
# PROP Ignore_Export_Lib 0
70
# PROP Ignore_Export_Lib 0
71
# PROP Target_Dir ""
71
# PROP Target_Dir ""
72
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /YX /FD /GZ /c
72
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /YX /FD /GZ /c
73
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "$(RAC_SDK_HOME)/include" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /YX /FD /GZ /c
73
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../RACommon" /I "../RASharedMemory" /I "../RASocket" /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /YX /FD /GZ /c
74
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
74
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76
# ADD BASE RSC /l 0x409 /d "_DEBUG"
76
# ADD BASE RSC /l 0x409 /d "_DEBUG"
Lines 80-86 Link Here
80
# ADD BSC32 /nologo
80
# ADD BSC32 /nologo
81
LINK32=link.exe
81
LINK32=link.exe
82
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
82
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
83
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib /nologo /dll /debug /machine:I386 /def:".\TransportSupport.def" /out:"../../../bin/transportSupport.dll" /implib:"../../../lib/transportSupport.lib" /pdbtype:sept /libpath:"$(RAC_SDK_HOME)/lib" /libpath:"../../../lib"
83
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib /nologo /dll /debug /machine:I386 /def:".\TransportSupport.def" /out:"../../../bin/transportSupport.dll" /implib:"../../../lib/transportSupport.lib" /pdbtype:sept /libpath:"../../../lib"
84
# SUBTRACT LINK32 /pdb:none
84
# SUBTRACT LINK32 /pdb:none
85
85
86
!ENDIF 
86
!ENDIF 
(-)src-native-new/src/transport/transportSupport/TransportSupport.make (-4 / +4 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include .  ../../../include ${JAVA_HOME}/include ${JAVA_HOME}/include/linux
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket .  ../../../include ${JAVA_HOME}/include ${JAVA_HOME}/include/linux
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 64-70 Link Here
64
#   list of additional library directories to search from
64
#   list of additional library directories to search from
65
#      (separated by blanks)
65
#      (separated by blanks)
66
#-----------------------------------
66
#-----------------------------------
67
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../../lib
67
LIBDIRS    :=  ../../../lib
68
68
69
69
70
#-----------------------------------
70
#-----------------------------------
Lines 93-103 Link Here
93
# shared memory system settings for max value (Bug 129276). It compiled fine
93
# shared memory system settings for max value (Bug 129276). It compiled fine
94
# after removing -fPIC option from CFLAGS list. This option is required for EM64T
94
# after removing -fPIC option from CFLAGS list. This option is required for EM64T
95
95
96
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) $(USE_FPIC_OPTION) $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
96
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) $(USE_FPIC_OPTION) $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
97
97
98
CXXFLAGS   :=  $(CFLAGS)
98
CXXFLAGS   :=  $(CFLAGS)
99
99
100
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
100
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
101
101
102
102
103
#-----------------------------------
103
#-----------------------------------
(-)src-native-new/src/transport/transportSupport/TransportSupportSharedMem.c (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 Intel Corporation.
2
 * Copyright (c) 2005, 2007 Intel Corporation.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-39 Link Here
33
	#include <linux/unistd.h>
33
	#include <linux/unistd.h>
34
	#include <linux/types.h>
34
	#include <linux/types.h>
35
	#include <linux/sysctl.h>
35
	#include <linux/sysctl.h>
36
	_syscall1(int, _sysctl, struct __sysctl_args *, args);
36
	#include <sys/syscall.h>
37
	#include <unistd.h>
37
#else
38
#else
38
#endif
39
#endif
39
40
Lines 105-111 Link Here
105
	size_t shmmaxlen = sizeof(int);
106
	size_t shmmaxlen = sizeof(int);
106
	struct __sysctl_args args = { name, sizeof(name), &shmmax, &shmmaxlen, 0, 0 };
107
	struct __sysctl_args args = { name, sizeof(name), &shmmax, &shmmaxlen, 0, 0 };
107
108
108
	rc = _sysctl(&args);
109
	rc = syscall(SYS__sysctl, &args);
109
	if(rc || (shmmax == 0)) {
110
	if(rc || (shmmax == 0)) {
110
		TPTP_LOG_ERROR_MSG("Cannot get system shared memory setting");
111
		TPTP_LOG_ERROR_MSG("Cannot get system shared memory setting");
111
		shmmax = 33554432; // default for Linux systems
112
		shmmax = 33554432; // default for Linux systems
(-)src-native-new/src/transport/transportSupport/TransportSupport.mak64 (-16 / +15 lines)
Lines 72-81 Link Here
72
"$(OUTDIR)" :
72
"$(OUTDIR)" :
73
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
73
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
74
74
75
CPP_PROJ=/nologo /MTd /W3 /Gm /EHsc /Zi /Od /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /I "$(RAC_SDK_HOME)/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
75
CPP_PROJ=/nologo /MTd /W3 /Gm /EHsc /Zi /Od /I ../RACommon /I ../RASharedMemory /I ../RASocket /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
76
76
77
LINK32=link.exe
77
LINK32=link.exe
78
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /debug /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /libpath:"$(RAC_SDK_HOME)/lib" /machine:IA64
78
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /debug /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /machine:IA64
79
LINK32_OBJS= \
79
LINK32_OBJS= \
80
	"$(INTDIR)\TransportOSCalls_linux.obj" \
80
	"$(INTDIR)\TransportOSCalls_linux.obj" \
81
	"$(INTDIR)\TransportOSCalls_win.obj" \
81
	"$(INTDIR)\TransportOSCalls_win.obj" \
Lines 87-94 Link Here
87
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
87
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
88
	"$(INTDIR)\TransportSupportSocket.obj" \
88
	"$(INTDIR)\TransportSupportSocket.obj" \
89
	"..\..\..\lib\tptpUtils.lib" \
89
	"..\..\..\lib\tptpUtils.lib" \
90
	"$(RAC_SDK_HOME)\lib\hcclco.lib" \
90
	"..\..\..\hcclco.lib" \
91
	"$(RAC_SDK_HOME)\lib\hcclsm.lib"
91
	"..\..\..\hcclsm.lib"
92
92
93
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
94
    $(LINK32) @<<
94
    $(LINK32) @<<
Lines 139-148 Link Here
139
"$(INTDIR)" :
139
"$(INTDIR)" :
140
    if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
140
    if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
141
141
142
CPP_PROJ=/nologo /MD /W3 /O2 /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /I "$(RAC_SDK_HOME)/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
142
CPP_PROJ=/nologo /MD /W3 /O2 /I ../RACommon /I ../RASharedMemory /I ../RASocket /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
143
143
144
LINK32=link.exe
144
LINK32=link.exe
145
LINK32_FLAGS=advapi32.lib uuid.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /libpath:"$(RAC_SDK_HOME)/lib" /machine:IA64 
145
LINK32_FLAGS=advapi32.lib uuid.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /machine:IA64 
146
LINK32_OBJS= \
146
LINK32_OBJS= \
147
	"$(INTDIR)\TransportOSCalls_linux.obj" \
147
	"$(INTDIR)\TransportOSCalls_linux.obj" \
148
	"$(INTDIR)\TransportOSCalls_win.obj" \
148
	"$(INTDIR)\TransportOSCalls_win.obj" \
Lines 154-161 Link Here
154
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
154
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
155
	"$(INTDIR)\TransportSupportSocket.obj" \
155
	"$(INTDIR)\TransportSupportSocket.obj" \
156
	"..\..\..\lib\tptpUtils.lib" \
156
	"..\..\..\lib\tptpUtils.lib" \
157
	"$(RAC_SDK_HOME)\lib\hcclsm.lib" \
157
	"..\..\..\hcclsm.lib" \
158
	"$(RAC_SDK_HOME)\lib\hcclco.lib"
158
	"..\..\..\hcclco.lib"
159
159
160
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
160
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
161
    $(LINK32) @<<
161
    $(LINK32) @<<
Lines 205-214 Link Here
205
"$(OUTDIR)" :
205
"$(OUTDIR)" :
206
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
206
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
207
207
208
CPP_PROJ=/nologo /MTd /W3 /Gm /EHsc /Zi /Od /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /I "$(RAC_SDK_HOME)/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
209
208
210
LINK32=link.exe
209
LINK32=link.exe
211
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /debug /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /libpath:"$(RAC_SDK_HOME)/lib" /machine:AMD64
210
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /debug /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /machine:AMD64
212
LINK32_OBJS= \
211
LINK32_OBJS= \
213
	"$(INTDIR)\TransportOSCalls_linux.obj" \
212
	"$(INTDIR)\TransportOSCalls_linux.obj" \
214
	"$(INTDIR)\TransportOSCalls_win.obj" \
213
	"$(INTDIR)\TransportOSCalls_win.obj" \
Lines 220-227 Link Here
220
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
219
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
221
	"$(INTDIR)\TransportSupportSocket.obj" \
220
	"$(INTDIR)\TransportSupportSocket.obj" \
222
	"..\..\..\lib\tptpUtils.lib" \
221
	"..\..\..\lib\tptpUtils.lib" \
223
	"$(RAC_SDK_HOME)\lib\hcclco.lib" \
222
	"..\..\..\hcclco.lib" \
224
	"$(RAC_SDK_HOME)\lib\hcclsm.lib"
223
	"..\..\..\hcclsm.lib"
225
224
226
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
225
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
227
    $(LINK32) @<<
226
    $(LINK32) @<<
Lines 272-281 Link Here
272
"$(INTDIR)" :
271
"$(INTDIR)" :
273
    if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
272
    if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
274
273
275
CPP_PROJ=/nologo /MD /W3 /O2 /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /I "$(RAC_SDK_HOME)/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
274
CPP_PROJ=/nologo /MD /W3 /O2 /I ../RACommon /I ../RASharedMemory /I ../RASocket /I "$(JAVA_HOME)/include" /I "$(JAVA_HOME)/include/win32" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TRANSPORTSUPPORT_EXPORTS" /D "ENW" /D "SQLWINT" /Fp"$(INTDIR)\TransportSupport.pch" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
276
275
277
LINK32=link.exe
276
LINK32=link.exe
278
LINK32_FLAGS=advapi32.lib uuid.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /libpath:"$(RAC_SDK_HOME)/lib" /machine:AMD64 
277
LINK32_FLAGS=advapi32.lib uuid.lib ws2_32.lib tptpUtils.lib hcclco.lib hcclsm.lib bufferoverflowU.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\TransportSupport.pdb" /def:".\TransportSupport.def" /out:"$(OUTDIR)\TransportSupport.dll" /implib:"../../../lib/transportSupport.lib" /libpath:"../../../lib" /machine:AMD64 
279
LINK32_OBJS= \
278
LINK32_OBJS= \
280
	"$(INTDIR)\TransportOSCalls_linux.obj" \
279
	"$(INTDIR)\TransportOSCalls_linux.obj" \
281
	"$(INTDIR)\TransportOSCalls_win.obj" \
280
	"$(INTDIR)\TransportOSCalls_win.obj" \
Lines 287-294 Link Here
287
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
286
	"$(INTDIR)\TransportSupportSharedMemExt.obj" \
288
	"$(INTDIR)\TransportSupportSocket.obj" \
287
	"$(INTDIR)\TransportSupportSocket.obj" \
289
	"..\..\..\lib\tptpUtils.lib" \
288
	"..\..\..\lib\tptpUtils.lib" \
290
	"$(RAC_SDK_HOME)\lib\hcclsm.lib" \
289
	"..\..\..\hcclsm.lib" \
291
	"$(RAC_SDK_HOME)\lib\hcclco.lib"
290
	"..\..\..\hcclco.lib"
292
291
293
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
292
"$(OUTDIR)\TransportSupport.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
294
    $(LINK32) @<<
293
    $(LINK32) @<<
(-)src-native-new/src/transport/RACommon/RAComm.h (-372 / +77 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-60 Link Here
10
 * IBM - Initial API and implementation
10
 * IBM - Initial API and implementation
11
 **********************************************************************/
11
 **********************************************************************/
12
12
13
#ifndef _ACRACOMM_H_
13
#ifndef _RACOMM_H_
14
#define _ACRACOMM_H_
14
#define _RACOMM_H_
15
15
16
#include "tptp/TPTPTypes.h"
16
#include "RATypes.h"
17
/* Provide unified string access methods across all platforms. */
17
#include "java.h"
18
#if defined(__cplusplus) && (defined(_HPUX) || defined(__powerpc64__))
19
 #define ENV(e) e
20
 #define ENVPARM(e)
21
 #define ENVPARM1(e)
22
#else
23
 #define ENV(e) (*e)
24
 #define ENVPARM(e) e,
25
 #define ENVPARM1(e) e
26
#endif
27
28
29
/**
30
  * Platform specific includes.
31
  */
32
#ifdef _WIN32										/* Win32 */
33
    #include <winsock2.h>
34
	#include <windows.h>
35
	#include <winbase.h>
36
#else												/* else */
37
	#include <pthread.h>
38
	#include <arpa/inet.h>
39
	#if defined(__OS400__)  || defined(MVS)
40
 		#include <stdlib.h>
41
 		#ifdef MVS
42
			/*  228721 - for 390, strings.h is needed to define bzero() */
43
			#include <strings.h>
44
		#endif
45
		/* 190770 - for 390, including string.h causes run-time
46
		library functions to be inlined to improve performance */
47
		#include <string.h>
48
	#else
49
		#include <strings.h>
50
	#endif
51
#endif
52
53
#ifdef _HPUX
54
	#include <string.h>
55
	#include <malloc.h>
56
	#include <unistd.h>
57
#endif
58
18
59
/* Mutex */
19
/* Mutex */
60
#ifdef _WIN32
20
#ifdef _WIN32
Lines 63-121 Link Here
63
	#define ra_critsec_t pthread_mutex_t
23
	#define ra_critsec_t pthread_mutex_t
64
#endif
24
#endif
65
25
66
/**
26
/* Macros for shared library */
67
  * Macros/typedefs to ease the readability of multiplatform code.
27
#ifdef _WIN32
68
  */
28
	#define MODULE_REFERENCE HMODULE
29
	#define DLL_REFERENCE HINSTANCE
30
	#define RESOLVE_MODULE(name) GetModuleHandle(name)
31
	#define LOAD_LIBRARY(name) LoadLibrary(name)
32
	#define RESOLVE_ENTRY_POINT(mod, entry) GetProcAddress(mod, entry)
33
	#ifndef CDECL
34
		#define CDECL __cdecl
35
	#endif
36
#elif MVS
37
	#include <dll.h>
38
	#define MODULE_REFERENCE dllhandle *
39
	#define DLL_REFERENCE dllhandle *
40
	#define RESOLVE_MODULE(name) dllload(name)
41
	#define LOAD_LIBRARY(name) dllload(name)
42
	#define RESOLVE_ENTRY_POINT(mod, entry) dllqueryfn(mod, entry)
43
	#ifndef CDECL
44
		#define CDECL
45
	#endif
46
#elif _HPUX
47
	#include <dlfcn.h>
48
	#define MODULE_REFERENCE void *
49
	#define DLL_REFERENCE void *
50
	#define RESOLVE_MODULE(name) dlopen(name, RTLD_LAZY)
51
	#define LOAD_LIBRARY(name) dlopen(name, RTLD_LAZY)
52
	#define RESOLVE_ENTRY_POINT(mod, entry) dlsym(mod, entry)
53
	#ifndef CDECL
54
		#define CDECL
55
	#endif
56
#elif __OS400__
57
	#define MODULE_REFERENCE void *
58
	#define DLL_REFERENCE void *
59
	#define RESOLVE_MODULE(name) loadServicePgm(name)
60
	#define LOAD_LIBRARY(name) loadServicePgm(name)
61
	#define RESOLVE_ENTRY_POINT(mod, entry) findServicePgmEntry(mod, entry)
62
	#ifndef CDECL
63
		#define CDECL
64
	#endif
65
#else
66
	#include <dlfcn.h>
67
	#define MODULE_REFERENCE void *
68
	#define DLL_REFERENCE void *
69
	#define RESOLVE_MODULE(name) dlopen(name, RTLD_LAZY)
70
	#define LOAD_LIBRARY(name) dlopen(name, RTLD_LAZY)
71
	#define RESOLVE_ENTRY_POINT(mod, entry) dlsym(mod, entry)
72
	#ifndef CDECL
73
		#define CDECL
74
	#endif
75
#endif
76
77
/* Macros to ease the readability of multiplatform code */
69
#ifdef _WIN32										/* Win32 */
78
#ifdef _WIN32										/* Win32 */
70
 #define BZERO(mem, len) ZeroMemory(mem,len)
79
	#define BZERO(mem, len) ZeroMemory(mem,len)
71
 #define SLEEP(millisec) Sleep(millisec)
80
	#define SLEEP(millisec) Sleep(millisec)
72
 #define STRDUP(dest, src)  dest=strdup(src)
81
	#define STRDUP(dest, src)  dest=strdup(src)
73
 #define PATH_SEPARATOR ';'
82
	#define RA_HANDLE_NULL	NULL
74
 #define FILE_SEPARATOR '\\'
83
	#define CLOSE_RA_HANDLE(handle)		CloseHandle(handle)
75
 typedef DWORD TID;
76
/* typedef DWORD PID;*/ /* moved to TPTPTypes.h */
77
 typedef HANDLE RA_HANDLE;
78
 #define RA_HANDLE_NULL	NULL
79
 #define CLOSE_RA_HANDLE(handle)		CloseHandle(handle)
80
#else												/* else */
84
#else												/* else */
81
 #define _MAX_PATH 256 /* This is already defined on Windows */
85
	#define _MAX_PATH 256 /* This is already defined on Windows */
82
 #if defined (__OS400__)
86
	#if defined (__OS400__)
83
  #define BZERO(mem, len) memset(mem, '\0', len)
87
		#define BZERO(mem, len) memset(mem, '\0', len)
84
  #define STRDUP(dest, src)  dest=(char*)malloc(strlen(src)+1); BZERO(dest, strlen(src)+1); strcpy(dest, src) /* 236501 */
88
		#define STRDUP(dest, src)  dest=(char*)malloc(strlen(src)+1); BZERO(dest, strlen(src)+1); strcpy(dest, src) /* 236501 */
85
 #elif defined (_HPUX)
89
	#elif defined (_HPUX)
86
  #define BZERO(mem, len) memset(mem, '\0', len)
90
		#define BZERO(mem, len) memset(mem, '\0', len)
87
  #define STRDUP(dest, src)  dest=strdup(src)
91
		#define STRDUP(dest, src)  dest=strdup(src)
88
 #else
92
	#else
89
  #define BZERO(mem, len) bzero(mem,len)
93
		#define BZERO(mem, len) bzero(mem,len)
90
  #define STRDUP(dest, src)  dest=strdup(src)
94
		#define STRDUP(dest, src)  dest=strdup(src)
91
 #endif
95
	#endif
92
 #define SLEEP(millisec) sleep(millisec/1000)
96
	#define SLEEP(millisec) sleep(millisec/1000)
93
 #define PATH_SEPARATOR ':'
97
	#define RA_HANDLE_NULL 0
94
 #define FILE_SEPARATOR '/'
98
	#define CLOSE_RA_HANDLE(handle)		close(handle)
95
 typedef int SOCKET;
99
	#define WINAPI " "
96
 typedef int HANDLE;
97
 typedef int RA_HANDLE;
98
 #define RA_HANDLE_NULL 0
99
 #define CLOSE_RA_HANDLE(handle)		close(handle)
100
 #define WINAPI " "
101
 typedef pthread_t TID;
102
/* typedef unsigned long PID; 179338 */
103
/* typedef pid_t PID; */   /* 179338 */ /* moved to TPTPTypes.h */
104
 #ifdef FALSE
105
  #undef FALSE
106
 #endif
107
 #ifdef TRUE
108
  #undef TRUE
109
 #endif
110
 /* Unfortunately, the Solaris C++ compiler doesn't like
111
    the version that all the other compilers like
112
 */
113
 #if defined _SOLARIS && defined __cplusplus
114
  typedef enum BOOL {FALSE, TRUE};
115
 #else
116
  enum _BOOL {FALSE, TRUE};
117
  typedef enum _BOOL BOOL;
118
 #endif
119
#endif
100
#endif
120
101
121
102
Lines 128-160 Link Here
128
 #define RA_PIPE_NAMESPACE_SHORT	"/tmp/IBMRAC"
109
 #define RA_PIPE_NAMESPACE_SHORT	"/tmp/IBMRAC"
129
#endif
110
#endif
130
111
131
/**
132
  * Remoteable Agent Data Types
133
  */
134
#ifdef __powerpc64__ /* long is 8 bytes, int is 4 bytes in size on PPC64 */
135
	typedef unsigned int ra_uint_t;
136
	typedef signed int ra_int_t;
137
#else
138
	typedef unsigned long ra_uint_t;
139
	typedef signed long ra_int_t;
140
#endif
141
142
typedef struct {
143
	ra_uint_t length;
144
	char *data;
145
}ra_string_t;
146
147
typedef struct {
148
	ra_uint_t length;
149
	void **data;
150
}ra_array_t;
151
152
153
typedef struct {
154
	ra_string_t type;
155
	ra_string_t name;
156
	ra_string_t value;
157
}ra_agentConfigEntry_t;
158
112
159
/**
113
/**
160
 * GENERAL PROTOCOL FORMAT:
114
 * GENERAL PROTOCOL FORMAT:
Lines 170-424 Link Here
170
124
171
125
172
126
173
/* The structure of a COMMAND */
174
typedef struct {
175
	ra_uint_t tag;								/* COMMAND_ID */
176
	union {
177
		struct {
178
			ra_string_t user;
179
			ra_string_t passwd;
180
		}authenticate;							/* AUTHENTICATE */
181
182
		struct {
183
			ra_string_t key;
184
		}authenticate_successful;				/* AUTHENTICATION_SUCCESSFUL */
185
186
		struct {
187
			ra_uint_t ticket;
188
		}authenticate_failed;					/* AUTHENTICATION_FAILED */
189
190
191
        struct {
192
            ra_uint_t flag;
193
            ra_uint_t securePort;
194
        }serverSecurityRequirements;            /* RA_SERVER_SECURITY_REQUIREMENTS */
195
196
		struct {
197
			ra_uint_t context;
198
			ra_uint_t consoleIP;
199
			ra_uint_t consolePort;
200
			ra_string_t executable;
201
			ra_string_t arguments;
202
			ra_string_t location;
203
			ra_array_t environment;
204
			ra_array_t agents;
205
		}launch_process;						/* LAUNCH_PROCESS*/
206
207
		struct {
208
			ra_uint_t context;
209
			ra_uint_t processId;
210
			ra_string_t processUUID;
211
			ra_string_t executable;
212
			ra_string_t arguments;
213
			ra_array_t environment;
214
		}process_launched;						/* PROCESS_LAUNCHED */
215
216
		struct {
217
			ra_uint_t context;
218
		}query_process_list;					/* QUERY_PROCESS_LIST */
219
220
		struct {
221
			ra_uint_t context;
222
			ra_array_t processes;
223
		}registered_process_list;				/* REGISTERED_PROCESS_LIST */
224
225
		struct {
226
			ra_uint_t context;
227
			ra_uint_t processId;
228
		}query_agent_list,						/* QUERY_AGENT_LIST */
229
		 kill_process,							/* KILL_PROCESS */
230
		 process_exited;						/* PROCESS_EXITED */
231
232
		struct {
233
			ra_uint_t context;
234
			ra_uint_t processId;
235
			ra_string_t executable;
236
			ra_array_t agents;
237
		}registered_agents_list;				/* REGISTERED_AGENTS_LIST */
238
239
		struct {
240
			ra_uint_t context;
241
			ra_uint_t  processId;
242
			ra_string_t agent;
243
		}register_agent_notification,			/* REGISTER_AGENT_NOTIFICATION */
244
		 query_agent_details;					/* QUERY_AGENT_DETAILS */
245
246
		struct {
247
			ra_uint_t context;
248
			ra_uint_t processId;
249
			ra_string_t agent;
250
		}attach,								/* ATTACH */
251
		 detach,								/* DETACH */
252
		 stop_monitor,							/* STOP MONITOR */
253
		 agent_query_state,						/* AGENT_QUERY_ATTACHED */ /* Bug 54376 */
254
		 agent_state;							/* AGENT_ATTACHED, AGENT_DETACHED */ /* Bug 54376 */
255
256
		struct {
257
			ra_uint_t context;
258
			ra_uint_t processId;
259
			ra_string_t agent;
260
			ra_uint_t ip;
261
			ra_uint_t port;
262
		}start_monitor_remote;					/* START_MONITOR_REMOTE */
263
264
		struct {
265
			ra_uint_t context;
266
			ra_uint_t processId;
267
			ra_string_t agent;
268
			ra_string_t file;
269
		}start_monitor_local;					/* START_MONITOR_LOCAL */
270
271
		struct {
272
			ra_uint_t context;
273
			ra_uint_t processId;
274
			ra_string_t agent;
275
			ra_string_t type;
276
			ra_string_t name;
277
			ra_string_t value;
278
		}set_nv_pair;							/* SET_NV_PAIR */
279
280
		struct {
281
			ra_uint_t context;
282
			ra_uint_t processId;
283
			ra_string_t agent;
284
			ra_string_t message;
285
		}custom_command;						/* CUSTOM_COMMAND */
286
287
		struct {
288
			ra_uint_t context;
289
			ra_uint_t processId;
290
			ra_string_t agent;
291
			ra_uint_t severity;
292
			ra_string_t messageId;
293
			ra_string_t message;
294
		}error_string;							/* ERROR_STRING */
295
296
		struct {
297
			ra_uint_t context;
298
			ra_uint_t processId;
299
			ra_string_t processUUID;
300
			ra_string_t agent;
301
			ra_string_t agentUUID;
302
			ra_string_t agentType;
303
		}agent_active,							/* AGENT_ACTIVE */
304
		 agent_inactive,						/* AGENT_INACTIVE */
305
		 agent_details;							/* AGENT_DETAILS */
306
307
		struct {
308
			ra_uint_t context;
309
			ra_uint_t processId;
310
/* BEGIN:  235649 */
311
#if defined __linux__
312
			ra_uint_t messageProcessId;
313
#endif
314
/* END: 235649 */
315
			ra_string_t processUUID;
316
			ra_string_t agent;
317
			ra_string_t agentUUID;
318
			ra_string_t agentType;
319
			ra_string_t nodeUUID;
320
		}agent_scoping_information;				/* AGENT_SCOPING_INFORMATION */
321
322
		struct {
323
			ra_uint_t context;
324
			ra_uint_t processId;
325
			ra_string_t processUUID;
326
			ra_string_t agent;
327
			ra_string_t agentUUID;
328
			ra_string_t agentType;
329
			ra_string_t nodeUUID;
330
			ra_array_t  configuration;
331
		}agent_configuration;					/* AGENT_CONFIGURATION */
332
333
		struct {
334
			ra_uint_t context;
335
			ra_uint_t processId;
336
			ra_string_t agent;
337
			ra_string_t node;
338
			ra_uint_t peerProcessId;
339
			ra_string_t peerAgent;
340
			ra_string_t peerNode;
341
		}agent_request_monitor, 				/* AGENT_REQUEST_ATTACH */
342
		 controller_request_monitor,			/* CONTROLLER_REQUEST_MONITOR */
343
		 peer_unreachable;						/* PEER_UNREACHABLE */
344
345
		/* Bug 77768 begins */
346
		struct {
347
			ra_uint_t context;
348
			ra_uint_t processId;
349
			ra_string_t agent;
350
			ra_string_t node;
351
			ra_uint_t peerProcessId;
352
			ra_string_t peerAgent;
353
			ra_string_t peerNode;
354
			ra_uint_t port;						/* Bug 77768 */
355
			ra_uint_t peerPort;					/* Bug 77768 */
356
		}agent_request_monitor_port, 			/* AGENT_REQUEST_ATTACH */
357
		 controller_request_monitor_port;		/* CONTROLLER_REQUEST_MONITOR */
358
		/* Bug 77768 ends */
359
360
		struct {
361
			ra_uint_t context;
362
			ra_string_t name;
363
			ra_string_t type;
364
			ra_string_t agentUUID;
365
		} query_property_list;					/* GET_PROPERTY_LIST */
366
367
		struct {
368
			ra_uint_t context;
369
			ra_array_t entries;
370
		} property_list;							/* PROPERTY_LIST */
371
372
/** FILE MANAGEMENT STRUCTURES FOR TRANSFERRING HEADPDUMP FILES
373
  * Modified by Giridhar.S on 11/4/04*/
374
375
		struct	{
376
			ra_uint_t context;
377
			ra_uint_t operation;
378
			ra_string_t filename;				/* MANAGE_FILE */
379
		}manage_file;
380
381
		struct	{
382
			ra_uint_t context;
383
			ra_uint_t port;
384
			ra_string_t jobKey;
385
		}resource_location;
386
387
/** END OF MODIFICATIONS TO RACOMM.H **/
388
389
		ra_string_t agentName;
390
391
	}info;
392
} ra_command_t;
393
394
395
typedef struct _command_entry_node {
396
	ra_command_t *command;
397
	struct _command_entry_node *next;
398
	struct _command_entry_node *previous;
399
}ra_command_list_node_t;
400
401
typedef struct {
402
	ra_command_list_node_t *head;
403
	ra_command_list_node_t *tail;
404
	ra_uint_t count;
405
}ra_command_list_t;
406
407
408
typedef struct {
409
	ra_uint_t type;
410
	ra_uint_t ticket;
411
	ra_uint_t length;
412
	ra_string_t key;
413
	ra_command_list_t commands;
414
}ra_message_t;
415
416
417
/* Define an element to be manipulated atomicly */
418
#ifndef _AIX
419
typedef int	*atomic_p;
420
#endif
421
422
127
423
/* The various COMMAND_ID's types from the client (server targeted flows) */
128
/* The various COMMAND_ID's types from the client (server targeted flows) */
424
#define RA_AUTHENTICATE							0x00000001
129
#define RA_AUTHENTICATE							0x00000001
(-)src-native-new/src/transport/RACommon/RATypes.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RACommon/RAError.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RACommon/RACommon.make (-5 / +5 lines)
Lines 22-28 Link Here
22
#
22
#
23
#-----------------------------------
23
#-----------------------------------
24
TARGET         :=  libhcclco
24
TARGET         :=  libhcclco
25
TARGETDIR      :=  $(RAC_SDK_HOME)/lib
25
TARGETDIR      :=  ../../../lib
26
26
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  .  ../../../include ../RASharedMemory
40
INCLUDEDIRS    :=  .  ../../../include ../RASharedMemory $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 50-56 Link Here
50
#   list of additional library directories to search from
50
#   list of additional library directories to search from
51
#      (separated by blanks)
51
#      (separated by blanks)
52
#-----------------------------------
52
#-----------------------------------
53
LIBDIRS    :=  $(RAC_SDK_HOME)/lib ../../../lib
53
LIBDIRS    :=  ../../../lib
54
54
55
55
56
#-----------------------------------
56
#-----------------------------------
Lines 74-84 Link Here
74
74
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
76
76
77
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
77
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
78
78
79
CXXFLAGS   :=  $(CFLAGS)
79
CXXFLAGS   :=  $(CFLAGS)
80
80
81
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
81
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
82
82
83
83
84
#-----------------------------------
84
#-----------------------------------
(-)src-native-new/src/transport/RACommon/RACommon.def (+11 lines)
Lines 36-42 Link Here
36
	ra_readFromNamedPipe		@33
36
	ra_readFromNamedPipe		@33
37
	ra_writeToNamedPipe			@34
37
	ra_writeToNamedPipe			@34
38
	disableAllSecurityOfKernalObject	@35
38
	disableAllSecurityOfKernalObject	@35
39
	fndclsid					@36
40
	getnewstrutf				@37
41
	getmthdid					@38
39
	ra_getEnvironmentVariable	@39
42
	ra_getEnvironmentVariable	@39
40
	isProcessAlive				@40
43
	isProcessAlive				@40
41
	native2unicode				@41
44
	native2unicode				@41
42
	unicode2native				@42
45
	unicode2native				@42
46
	copyJavaStringToNative		@43
47
	ra_createJavaVitualMachine	@44
48
	ra_submitJavaJob			@45
49
	ra_destroyJavaVirtualMachine	@46
50
	ra_isJvmCreated				@47
51
	ra_getJvm					@48
52
	ra_createJavaVitualMachineWithClasspath	@49
53
	ra_submitJavaJobReuseJVMThread	@50
(-)src-native-new/src/transport/RACommon/RAComm.c (-24 / +44 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 101-107 Link Here
101
pthread_mutex_t _cas_mutex=PTHREAD_MUTEX_INITIALIZER;
101
pthread_mutex_t _cas_mutex=PTHREAD_MUTEX_INITIALIZER;
102
#endif
102
#endif
103
103
104
#ifdef _DEBUG
104
#ifdef _DEBUG2
105
#include <stdio.h>
105
#include <stdio.h>
106
#endif
106
#endif
107
107
Lines 117-122 Link Here
117
/**
117
/**
118
  * Function prototypes
118
  * Function prototypes
119
  */
119
  */
120
static BOOL validateControlMessage(unsigned char *msg,
121
								   int length);
122
120
123
121
static unsigned char* copyRAUINTToBuffer(unsigned char *buffer,
124
static unsigned char* copyRAUINTToBuffer(unsigned char *buffer,
122
							   ra_uint_t uintData) {
125
							   ra_uint_t uintData) {
Lines 145-151 Link Here
145
	ra_uint_t nativeLen = 0;
148
	ra_uint_t nativeLen = 0;
146
	char* utf8Buffer = 0;
149
	char* utf8Buffer = 0;
147
	char* nativeBuffer = 0;
150
	char* nativeBuffer = 0;
148
#if _DEBUG
151
#if _DEBUG2
149
	char* dbgBuffer = 0;
152
	char* dbgBuffer = 0;
150
#endif
153
#endif
151
154
Lines 174-180 Link Here
174
			copyRAUINTToBuffer(buffer, 0);
177
			copyRAUINTToBuffer(buffer, 0);
175
		}
178
		}
176
179
177
#if _DEBUG
180
#if _DEBUG2
178
	dbgBuffer = (char*)ra_malloc(sizeof(char*) * (utf8Len + 1));
181
	dbgBuffer = (char*)ra_malloc(sizeof(char*) * (utf8Len + 1));
179
	memcpy(dbgBuffer, utf8Buffer, utf8Len);
182
	memcpy(dbgBuffer, utf8Buffer, utf8Len);
180
	dbgBuffer[utf8Len] = '\0';
183
	dbgBuffer[utf8Len] = '\0';
Lines 241-247 Link Here
241
			newString->length = 0;
244
			newString->length = 0;
242
		}
245
		}
243
246
244
#if _DEBUG
247
#if _DEBUG2
245
	printf("DEBUG: (UTF8->Native) \"%s\" -> \"%s\"\n", utf8Buffer, newString->data);
248
	printf("DEBUG: (UTF8->Native) \"%s\" -> \"%s\"\n", utf8Buffer, newString->data);
246
#endif
249
#endif
247
250
Lines 1834-1840 Link Here
1834
		getout:
1837
		getout:
1835
	}
1838
	}
1836
#else
1839
#else
1837
/* This code needs to be tested.
1840
/* This code crashes piAgent!
1838
	int *old;
1841
	int *old;
1839
	old = (int *)InterlockedCompareExchange( (PLONG)addr, (LONG)oldval_addr, (LONG)&newval ) ;
1842
	old = (int *)InterlockedCompareExchange( (PLONG)addr, (LONG)oldval_addr, (LONG)&newval ) ;
1840
	return ( *old == newval ) ;
1843
	return ( *old == newval ) ;
Lines 2374-2393 Link Here
2374
	return *bytesWritten;
2377
	return *bytesWritten;
2375
#else
2378
#else
2376
	int result;
2379
	int result;
2377
	ssize_t byte;
2380
	/* Bug 146962 begins */
2378
	byte=write(handle, (unsigned char*)buffer+offset, length-offset);
2381
	int start;
2379
	if(byte==0) {
2382
	int bytesWrittenSoFar = 0;
2380
		result=0;
2383
	int retry = 10;
2381
		*bytesWritten=0;
2384
2382
	}
2385
	do {
2383
	else if(byte<0) {
2386
		int written;
2384
		result=-1;
2387
		start = offset + bytesWrittenSoFar;
2385
		*bytesWritten=0;
2388
		written = write(handle, (unsigned char*)buffer + start, length - start);
2389
		if(written > 0) {
2390
			bytesWrittenSoFar += written;
2391
		}
2392
		if(bytesWrittenSoFar < length - offset) {
2393
			SLEEP(500);
2394
		}
2395
	} while((bytesWrittenSoFar < length - offset) && (retry-- > 0));
2396
2397
	if(bytesWrittenSoFar == 0) {
2398
		result = 0;
2399
		*bytesWritten = 0;
2400
	}
2401
	else if(bytesWrittenSoFar < 0) {
2402
		result = -1;
2403
		*bytesWritten = 0;
2386
	}
2404
	}
2387
	else {
2405
	else {
2388
		result=1;
2406
		result = 1;
2389
		*bytesWritten=byte;
2407
		*bytesWritten = bytesWrittenSoFar;
2390
	}
2408
	}
2409
	/* Bug 146962 ends */
2410
2391
	return result;
2411
	return result;
2392
#endif
2412
#endif
2393
}
2413
}
Lines 2885-2897 Link Here
2885
	size_t convLen; /* return value from iconv() */
2905
	size_t convLen; /* return value from iconv() */
2886
	size_t tempLen; /* Length of the allocated output buffer, will actually be the numnber of bytes left in the buffer */
2906
	size_t tempLen; /* Length of the allocated output buffer, will actually be the numnber of bytes left in the buffer */
2887
	size_t inLen_copy; /* a copy of the length of the input buffer */
2907
	size_t inLen_copy; /* a copy of the length of the input buffer */
2888
#if _DEBUG
2908
#if _DEBUG2
2889
	int i;
2909
	int i;
2890
#endif
2910
#endif
2891
2911
2892
	setlocale(LC_CTYPE, "");
2912
	setlocale(LC_CTYPE, "");
2893
	cd = iconv_open(to_cp, from_cp); /* to, from */
2913
	cd = iconv_open(to_cp, from_cp); /* to, from */
2894
#if _DEBUG
2914
#if _DEBUG2
2895
		printf("DEBUG: CP(%s) -> CP(%s)\n", from_cp, to_cp);
2915
		printf("DEBUG: CP(%s) -> CP(%s)\n", from_cp, to_cp);
2896
#endif
2916
#endif
2897
2917
Lines 2900-2906 Link Here
2900
#else
2920
#else
2901
	if(cd == (iconv_t)-1) {
2921
	if(cd == (iconv_t)-1) {
2902
#endif
2922
#endif
2903
#if _DEBUG
2923
#if _DEBUG2
2904
		printf("DEBUG: Error calling iconv_open()\n");
2924
		printf("DEBUG: Error calling iconv_open()\n");
2905
#endif
2925
#endif
2906
		*out = 0; /* Bug 80588 */
2926
		*out = 0; /* Bug 80588 */
Lines 2911-2917 Link Here
2911
	inBuf_copy = (char*)ra_malloc(sizeof(char) * inLen_copy); /* make a copy of the input buffer */
2931
	inBuf_copy = (char*)ra_malloc(sizeof(char) * inLen_copy); /* make a copy of the input buffer */
2912
	memcpy(inBuf_copy, in, size_in);
2932
	memcpy(inBuf_copy, in, size_in);
2913
	inBuf_start = inBuf_copy; /* mark the start of the input buffer */
2933
	inBuf_start = inBuf_copy; /* mark the start of the input buffer */
2914
#if _DEBUG
2934
#if _DEBUG2
2915
	printf("DEBUG: inLen_copy = %d\n", inLen_copy);
2935
	printf("DEBUG: inLen_copy = %d\n", inLen_copy);
2916
	printf("DEBUG: inBuf_copy = ");
2936
	printf("DEBUG: inBuf_copy = ");
2917
	for(i = 0; i < inLen_copy; i++) {
2937
	for(i = 0; i < inLen_copy; i++) {
Lines 2926-2932 Link Here
2926
	tempBuf_start = tempBuf; /* mark the beginning of the output buffer */
2946
	tempBuf_start = tempBuf; /* mark the beginning of the output buffer */
2927
	convLen = iconv(cd, &inBuf_copy, &inLen_copy, &tempBuf, &tempLen); /* perform the conversion */
2947
	convLen = iconv(cd, &inBuf_copy, &inLen_copy, &tempBuf, &tempLen); /* perform the conversion */
2928
	if(convLen == -1) {
2948
	if(convLen == -1) {
2929
#if _DEBUG
2949
#if _DEBUG2
2930
		printf("DEBUG: Error running iconv(), errno = %d\n", errno);
2950
		printf("DEBUG: Error running iconv(), errno = %d\n", errno);
2931
		switch(errno) {
2951
		switch(errno) {
2932
			case EILSEQ:
2952
			case EILSEQ:
Lines 2943-2949 Link Here
2943
		*out = 0; /* Bug 80588 */
2963
		*out = 0; /* Bug 80588 */
2944
		return 0; /* return 0 if it fails */
2964
		return 0; /* return 0 if it fails */
2945
	}
2965
	}
2946
#if _DEBUG
2966
#if _DEBUG2
2947
	printf("DEBUG: Bytes left(tempLen) = %d\n", tempLen);
2967
	printf("DEBUG: Bytes left(tempLen) = %d\n", tempLen);
2948
	printf("DEBUG: Output buffer(tempBuf_start) = ");
2968
	printf("DEBUG: Output buffer(tempBuf_start) = ");
2949
	for(i = 0; i < outLen - tempLen; i++) {
2969
	for(i = 0; i < outLen - tempLen; i++) {
Lines 2955-2961 Link Here
2955
	*out = (char*)ra_malloc(sizeof(char) * (outLen - tempLen + 1)); /* create the output buffer with the actual size, adding a null */
2975
	*out = (char*)ra_malloc(sizeof(char) * (outLen - tempLen + 1)); /* create the output buffer with the actual size, adding a null */
2956
	BZERO(*out, outLen - tempLen + 1);
2976
	BZERO(*out, outLen - tempLen + 1);
2957
	memcpy(*out, tempBuf_start, outLen - tempLen);  /* copy the contents from the temp buffer */
2977
	memcpy(*out, tempBuf_start, outLen - tempLen);  /* copy the contents from the temp buffer */
2958
#if _DEBUG
2978
#if _DEBUG2
2959
	printf("DEBUG: Copied buffer(out)\n");
2979
	printf("DEBUG: Copied buffer(out)\n");
2960
	printf("DEBUG: Output buffer size = %d\n", outLen - tempLen);
2980
	printf("DEBUG: Output buffer size = %d\n", outLen - tempLen);
2961
#endif
2981
#endif
(-)src-native-new/src/transport/RACommon/RACommon.dsp (+12 lines)
Lines 114-119 Link Here
114
# End Source File
114
# End Source File
115
# Begin Source File
115
# Begin Source File
116
116
117
SOURCE=..\RACommon\java.c
118
# End Source File
119
# Begin Source File
120
121
SOURCE=..\RACommon\java.h
122
# End Source File
123
# Begin Source File
124
125
SOURCE=..\RACommon\RATypes.h
126
# End Source File
127
# Begin Source File
128
117
SOURCE=..\RACommon\resource.h
129
SOURCE=..\RACommon\resource.h
118
# End Source File
130
# End Source File
119
# End Group
131
# End Group
(-)src-native-new/src/transport/RACommon/resource.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005,2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/CmdExtractor/CmdExtractor.make (-3 / +3 lines)
Lines 38-44 Link Here
38
#   list of additional INCLUDE directories to search headers from
38
#   list of additional INCLUDE directories to search headers from
39
#      (separated by blanks)
39
#      (separated by blanks)
40
#-----------------------------------
40
#-----------------------------------
41
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../include ${XERCESC_HOME}/include
41
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../include ${XERCESC_HOME}/include
42
42
43
43
44
#-----------------------------------
44
#-----------------------------------
Lines 73-83 Link Here
73
#
73
#
74
#-----------------------------------
74
#-----------------------------------
75
75
76
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
77
77
78
CXXFLAGS   :=  $(CFLAGS)
78
CXXFLAGS   :=  $(CFLAGS)
79
79
80
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
81
81
82
82
83
#-----------------------------------
83
#-----------------------------------
(-)src-native-new/src/javaBaseAgent/JavaBaseAgent.make (-3 / +3 lines)
Lines 25-31 Link Here
25
#   list of additional INCLUDE directories to search headers from
25
#   list of additional INCLUDE directories to search headers from
26
#      (separated by blanks)
26
#      (separated by blanks)
27
#-----------------------------------
27
#-----------------------------------
28
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../include $(JAVA_HOME)/include $(JAVA_HOME)/include/linux 
28
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../include $(JAVA_HOME)/include $(JAVA_HOME)/include/linux 
29
29
30
30
31
#-----------------------------------
31
#-----------------------------------
Lines 60-70 Link Here
60
#
60
#
61
#-----------------------------------
61
#-----------------------------------
62
62
63
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
63
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
64
64
65
CXXFLAGS   :=  $(CFLAGS)
65
CXXFLAGS   :=  $(CFLAGS)
66
66
67
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
67
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
68
68
69
#-----------------------------------
69
#-----------------------------------
70
#   general commands and options
70
#   general commands and options
(-)src-native-new/src/transport/RASharedMemory/ossdebug.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossatomictype.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossramboflush.cpp (-72 / +821 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 49-55 Link Here
49
   216026 Jul/23/2002 dns Added check for writers before detaching from shm buffer
49
   216026 Jul/23/2002 dns Added check for writers before detaching from shm buffer
50
   230611 Nov/19/2002 dns set numUsedSlots correctly when chunk is full
50
   230611 Nov/19/2002 dns set numUsedSlots correctly when chunk is full
51
   232468 Nov/19/2002 dns added code to handle case when continueDataSize > dataLengh
51
   232468 Nov/19/2002 dns added code to handle case when continueDataSize > dataLengh
52
   Last Changed =    02/12/12  12:15:11
52
   94473  Jun/10/2005 dns increased the wait before stopping flushing because
53
                          nobody else is attached to shm
54
   Last Changed =    05/06/10  12:15:11
53
55
54
*******************************************************************************/
56
*******************************************************************************/
55
57
Lines 62-68 Link Here
62
#ifdef SQLWINT
64
#ifdef SQLWINT
63
#include <limits.h>
65
#include <limits.h>
64
#include <io.h>
66
#include <io.h>
65
#include <winsock.h>
67
#include <winsock2.h> /* 134924 */
66
#else
68
#else
67
#ifdef OSS_DEBUG
69
#ifdef OSS_DEBUG
68
#include <errno.h>      /* 198075 */
70
#include <errno.h>      /* 198075 */
Lines 76-81 Link Here
76
#include <unistd.h>
78
#include <unistd.h>
77
#endif
79
#endif
78
80
81
#include <jni.h>
79
82
80
/* MACRO's to simplify the JNI code. */
83
/* MACRO's to simplify the JNI code. */
81
#if defined __cplusplus
84
#if defined __cplusplus
Lines 227-233 Link Here
227
                  }
230
                  }
228
               }
231
               }
229
            }
232
            }
230
	         /* Write data to file */
233
            /* Write data to file */
231
            else {
234
            else {
232
               bytesWritten = write( fileDescriptor, (char *)*pcontinueBuffer, totalRecordSize ) ;
235
               bytesWritten = write( fileDescriptor, (char *)*pcontinueBuffer, totalRecordSize ) ;
233
               if ( (ssize_t)-1 == bytesWritten )
236
               if ( (ssize_t)-1 == bytesWritten )
Lines 285-291 Link Here
285
      /* If the whole record doesn't fit in this buffer then allocate a temporary
288
      /* If the whole record doesn't fit in this buffer then allocate a temporary
286
         buffer for the record and copy the part that is included in this buffer
289
         buffer for the record and copy the part that is included in this buffer
287
         into the temp bufer*/
290
         into the temp bufer*/
288
      if (offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength >= dataLength) {
291
      if (offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength > dataLength) {
289
		
292
		
290
         continueDataSize = offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength - dataLength;
293
         continueDataSize = offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength - dataLength;
291
		   bFlushLen = dataLength - offset;
294
		   bFlushLen = dataLength - offset;
Lines 827-832 Link Here
827
   Uint32 slotIndex = 0 ;
830
   Uint32 slotIndex = 0 ;
828
   Uint32 loopIndex = 0 ;
831
   Uint32 loopIndex = 0 ;
829
   Uint32 timedOut = 0 ;
832
   Uint32 timedOut = 0 ;
833
   Uint32 attachCheckIndex = 0 ;  /* bugzilla 94473 */
830
   int flushDataLen;
834
   int flushDataLen;
831
   OSSRamboCB * pRamboCB ;
835
   OSSRamboCB * pRamboCB ;
832
   OSSRamboChunkCB * pChunkCB = NULL ;
836
   OSSRamboChunkCB * pChunkCB = NULL ;
Lines 944-958 Link Here
944
948
945
      loopIndex = 0;
949
      loopIndex = 0;
946
      timedOut = 0;
950
      timedOut = 0;
951
      attachCheckIndex = 0;  /* 94473 */
947
      /* Wait until the chunk is full or we have been asked to stop or we have waited too long */
952
      /* Wait until the chunk is full or we have been asked to stop or we have waited too long */
948
      for ( ; ; )
953
      for ( ; ; )
949
      {
954
      {
955
         /* If flushing is to be stopped then set the stopping flag and quit the loop */
950
         if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
956
         if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
951
         {
957
         {
952
            stopping = true ;
958
            stopping = true ;
953
            break ;
959
            break ;
954
         }
960
         }
955
961
962
         /* If the chunk is full then quit the loop so it can be flushed. */
956
         if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
963
         if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
957
         {
964
         {
958
#ifdef OSS_DEBUG1
965
#ifdef OSS_DEBUG1
Lines 962-968 Link Here
962
#endif
969
#endif
963
            break ;
970
            break ;
964
         }
971
         }
972
         /* Else If we have looped too long */
965
         else if (loopIndex == 100) {
973
         else if (loopIndex == 100) {
974
            /* If there is any data in the chunk Then quit the loop to flush it */
966
            if ((ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) - ossAtomicPeek(&pChunkCB->flushedCount) > 0  ||
975
            if ((ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) - ossAtomicPeek(&pChunkCB->flushedCount) > 0  ||
967
                (ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0)) {
976
                (ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0)) {
968
               timedOut = 1;
977
               timedOut = 1;
Lines 973-984 Link Here
973
               break ;
982
               break ;
974
            }
983
            }
975
/* 205955 begin */
984
/* 205955 begin */
985
			/* Else get the attach count to see if anyone else is attached */
976
            else {
986
            else {
977
               int attcnt = 0;
987
               int attcnt = 0;
978
               OSSErr osserr = OSS_OK ;
988
               OSSErr osserr = OSS_OK ;
979
               osserr = ossIPCMemAttachCount( pRambo->ipcMemHandle, &attcnt ) ;
989
               osserr = ossIPCMemAttachCount( pRambo->ipcMemHandle, &attcnt ) ;
980
               /* If nobody is attached to the shared memory except for us then stop flushing */
990
               attachCheckIndex++;  /* bugzilla 94473 */
981
               if ( osserr == OSS_OK  &&  attcnt == 1 )
991
               /* If nobody is attached to the shared memory except for us then stop flushing
992
                * bugzilla 94473 - only stop flushing if we have gone through the wait loop four
993
                * times to provide more time for the agent to attach to it (4 seconds instead of 1). */
994
               if ( osserr == OSS_OK  &&  attcnt == 1 && attachCheckIndex >= 4)
982
               {
995
               {
983
                  /* set the user count to 1 so the shared memory gets deleted when it is destroyed */
996
                  /* set the user count to 1 so the shared memory gets deleted when it is destroyed */
984
                  ossIPCMemSetUserCount( pRambo->ipcMemHandle, attcnt ) ;
997
                  ossIPCMemSetUserCount( pRambo->ipcMemHandle, attcnt ) ;
Lines 1505-1510 Link Here
1505
}
1518
}
1506
1519
1507
1520
1521
/*******************************************************************************
1522
1523
   Function Name
1524
      dataToStrProcessor
1525
1526
   Function
1527
      Processes data from a RAMBO buffer and writes it out a java OutputStream
1528
1529
   Inputs
1530
      pTraceData - addr of trace data to process
1531
      dataLength - length of data to process
1532
      continueDataSize - size of data at the start of the buffer to send without processing because it is the remainder of a record
1533
      jenv - Java environment
1534
	  jobj - Java OutputStream object
1535
	  jmethod  - the OutputStream write method ID
1536
1537
   Normal Return
1538
      returns size of last part of the data record that did not fit in this buffer
1539
1540
   Error Return
1541
      -1
1542
**********************************************************************************/
1543
1544
int dataToStrProcessor(
1545
	void *pTraceData,
1546
	int dataLength,
1547
	int continueDataSize,   /* size of end of msg from previous buffer to send */
1548
	JNIEnv *jenv,     /* Java environemnt */
1549
	jobject jobj,     /* OutputStream object */
1550
	jmethodID jmethod ) {  /* write method ID */
1551
1552
	char *pFlushData;
1553
	Uint32 recordLength;
1554
	int offset = 0;
1555
	int endOffset = dataLength - OSS_RAMBO_DATA_HEADER_SIZE;
1556
	int flushLen;     /* length of data to flush to file descriptor */
1557
	int bFlushLen;    /* length of data to flush from buffer (includes rambo data header length) */
1558
1559
#ifdef OSS_DEBUG
1560
	ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"dataProcessor:  pTraceData=%p *pTraceData=%x/%x/%x/%x/%x  contSize=%d\n",
1561
		pTraceData, (*(char *)pTraceData & 0x000000ff),(*((char *)pTraceData+1) & 0x000000ff),
1562
		(*((char *)pTraceData+2) & 0x000000ff), (*((char *)pTraceData+3) & 0x000000ff),
1563
		(*((char *)pTraceData+4) & 0x000000ff), continueDataSize);
1564
#endif
1565
1566
	/* If there was a record that started in the previous buffer but the buffer was not big
1567
		enough to contain the whole record, then the rest of the record is at the beginning
1568
		of this buffer so flush the remainder of the record.
1569
	*/
1570
	if (continueDataSize > 0) {
1571
		int conFlushLen;
1572
1573
		/* The remainder of the record may be bigger than the size of this buffer */
1574
		if (continueDataSize > dataLength) {
1575
		/* Flush this whole buffer to the file or socket */
1576
			conFlushLen = dataLength;
1577
		}
1578
		else {
1579
			/* Write the remaninder of the previous record out to the file or socket */
1580
			conFlushLen = continueDataSize;
1581
		}
1582
1583
		/* Format the java input arguments */
1584
		
1585
		/* Possible memory leak here if we create a new byte array every time
1586
		 *  - need to confirm this
1587
		 */
1588
		if(conFlushLen > 0) {
1589
			jbyteArray jbarr;
1590
			jthrowable jexc;
1591
			jbyte *tmpBuffer;
1592
1593
			jbarr = ENV(jenv)->NewByteArray(ENVPARM(jenv) conFlushLen);
1594
			if(jbarr == NULL) {
1595
				return -1;
1596
			}
1597
1598
			tmpBuffer = (signed char*)malloc(sizeof(signed char) * conFlushLen);
1599
			memcpy(tmpBuffer, (signed char*)pTraceData, sizeof(signed char) * conFlushLen);
1600
1601
			ENV(jenv)->SetByteArrayRegion(ENVPARM(jenv) jbarr, 0, conFlushLen, tmpBuffer);
1602
1603
			/* Write the data out to the java OutputStream */
1604
			ENV(jenv)->CallVoidMethod(ENVPARM(jenv) jobj, jmethod, jbarr, 0, conFlushLen);
1605
1606
			/* Check for a java exception */
1607
			jexc = ENV(jenv)->ExceptionOccurred(ENVPARM1(jenv));
1608
			if(jexc) {
1609
				ENV(jenv)->ExceptionClear(ENVPARM1(jenv));
1610
			}
1611
1612
//			ENV(jenv)->ReleaseByteArrayElements(ENVPARM(jenv) jbarr, tmpBuffer, 0);
1613
			ENV(jenv)->DeleteLocalRef(ENVPARM(jenv) jbarr);
1614
			free(tmpBuffer);
1615
1616
			if(jexc) {
1617
				return -1;
1618
			}
1619
		}
1620
1621
		offset += OSS_RAMBO_ROUND_SLOT_SIZE( conFlushLen );
1622
		continueDataSize -= conFlushLen;
1623
   }
1624
1625
   /* Process the data until we have reached the end of the buffer */
1626
   while (offset < endOffset) {
1627
1628
#ifdef OSS_DEBUG
1629
      ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"dataProcessor: *pTraceData at offset %d =%x/%x/%x/%x %x/%x/%x/%x/%x\n",
1630
			                    offset, (*((char *)pTraceData+offset) & 0x000000ff),(*((char *)pTraceData+offset+1) & 0x000000ff),
1631
								(*((char *)pTraceData+offset+2) & 0x000000ff), (*((char *)pTraceData+offset+3) & 0x000000ff),
1632
                        (*((char *)pTraceData+offset+4) & 0x000000ff), (*((char *)pTraceData+offset+5) & 0x000000ff),
1633
                        (*((char *)pTraceData+offset+6) & 0x000000ff), (*((char *)pTraceData+offset+7) & 0x000000ff),
1634
                        (*((char *)pTraceData+offset+8) & 0x000000ff));
1635
#endif
1636
1637
      pFlushData = (char *)pTraceData + offset;
1638
      flushLen = 0;
1639
      bFlushLen = 0;
1640
      /* read the data length from the buffer */
1641
      recordLength = *(Uint32 *)pFlushData;
1642
1643
      /* If the whole record doesn't fit in this buffer then flush what is included
1644
            in this buffer */
1645
      if (offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength >= dataLength) {
1646
		   continueDataSize = offset + OSS_RAMBO_DATA_HEADER_SIZE + recordLength - dataLength;
1647
		   bFlushLen = dataLength - offset;
1648
#ifdef OSS_DEBUG
1649
         ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"dataProcessor:  Reached end of buffer recordLength=%d bflushLen=%d  pFlushData=%p\n",
1650
			                    recordLength, bFlushLen, pFlushData);
1651
#endif
1652
		}
1653
      /* Else the whole record is contained in this buffer so flush it */
1654
      else {
1655
         bFlushLen = OSS_RAMBO_DATA_HEADER_SIZE + recordLength;
1656
      }
1657
1658
      flushLen = bFlushLen - OSS_RAMBO_DATA_HEADER_SIZE;
1659
      pFlushData = (char *)pFlushData + OSS_RAMBO_DATA_HEADER_SIZE;
1660
1661
#ifdef OSS_DEBUG
1662
		ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"dataProcessor:  recordLength=%d flushLen=%d bFlushLen=%d pFlushData=%p",
1663
			recordLength, flushLen, bFlushLen, pFlushData);
1664
#endif
1665
1666
		/* Format the java input arguments */
1667
		
1668
		/* Possible memory leak here if we create a new byte array every time
1669
			*  - need to confirm this
1670
		*/
1671
		if(flushLen > 0) {
1672
			jbyteArray jbarr;
1673
			jthrowable jexc;
1674
			jbyte *tmpBuffer;
1675
1676
			jbarr = ENV(jenv)->NewByteArray(ENVPARM(jenv) flushLen);
1677
			if(jbarr == NULL) {
1678
				return -1;
1679
			}
1680
1681
			tmpBuffer = (signed char*)malloc(sizeof(signed char) * flushLen);
1682
			memcpy(tmpBuffer, (signed char*)pFlushData, sizeof(signed char) * flushLen);
1683
1684
			ENV(jenv)->SetByteArrayRegion(ENVPARM(jenv) jbarr, 0, flushLen, tmpBuffer);
1685
1686
			/* Write the data out to the java OutputStream */
1687
			ENV(jenv)->CallVoidMethod(ENVPARM(jenv) jobj, jmethod, jbarr, 0, flushLen);
1688
1689
			/* Check for a java exception */
1690
			jexc = ENV(jenv)->ExceptionOccurred(ENVPARM1(jenv));
1691
			if(jexc) {
1692
				ENV(jenv)->ExceptionClear(ENVPARM1(jenv));
1693
			}
1694
1695
//			ENV(jenv)->ReleaseByteArrayElements(ENVPARM(jenv) jbarr, tmpBuffer, 0);
1696
			ENV(jenv)->DeleteLocalRef(ENVPARM(jenv) jbarr);
1697
			free(tmpBuffer);
1698
1699
			if(jexc) {
1700
				return -1;
1701
			}
1702
		}
1703
1704
		/* increase the offset by the number of slots that were flushed */
1705
		offset += OSS_RAMBO_ROUND_SLOT_SIZE( bFlushLen );
1706
   }
1707
   return continueDataSize;
1708
}
1709
1508
1710
1509
1711
1510
/*******************************************************************************
1712
/*******************************************************************************
Lines 1544-1549 Link Here
1544
   Uint32 chunkIndex = 0 ;
1746
   Uint32 chunkIndex = 0 ;
1545
   Uint32 slotIndex = 0 ;
1747
   Uint32 slotIndex = 0 ;
1546
   Uint32 loopIndex = 0 ;
1748
   Uint32 loopIndex = 0 ;
1749
   Uint32 attachCheckIndex = 0 ;  /* bugzilla 94473 */
1547
   Uint32 timedOut = 0 ;
1750
   Uint32 timedOut = 0 ;
1548
   int flushDataLen;
1751
   int flushDataLen;
1549
   OSSRamboCB * pRamboCB ;
1752
   OSSRamboCB * pRamboCB ;
Lines 1661-1669 Link Here
1661
1864
1662
      loopIndex = 0;
1865
      loopIndex = 0;
1663
      timedOut = 0;
1866
      timedOut = 0;
1867
      attachCheckIndex = 0;  /* 94473 */
1664
      /* Wait until the chunk is full or we have been asked to stop or we have waited too long */
1868
      /* Wait until the chunk is full or we have been asked to stop or we have waited too long */
1665
      for ( ; ; )
1869
      for ( ; ; )
1666
      {
1870
      {
1871
         /* If flushing is to be stopped then set the stopping flag and quit the loop */
1667
         if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
1872
         if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
1668
         {
1873
         {
1669
            stopping = true ;
1874
            stopping = true ;
Lines 1673-1678 Link Here
1673
            break ;
1878
            break ;
1674
         }
1879
         }
1675
1880
1881
         /* If the chunk is full then quit the loop so it can be flushed. */
1676
         if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
1882
         if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
1677
         {
1883
         {
1678
#ifdef OSS_DEBUG
1884
#ifdef OSS_DEBUG
Lines 1680-1686 Link Here
1680
#endif
1886
#endif
1681
            break ;
1887
            break ;
1682
         }
1888
         }
1889
         /* Else If we have looped too long */
1683
         else if (loopIndex == 100) {
1890
         else if (loopIndex == 100) {
1891
            /* If there is any data in the chunk Then quit the loop to flush it */
1684
            if ((ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) - ossAtomicPeek(&pChunkCB->flushedCount) > 0  ||
1892
            if ((ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) - ossAtomicPeek(&pChunkCB->flushedCount) > 0  ||
1685
                (ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0)) {
1893
                (ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0)) {
1686
               timedOut = 1;
1894
               timedOut = 1;
Lines 1690-1695 Link Here
1690
               break ;
1898
               break ;
1691
            }
1899
            }
1692
/* 205955 begin */
1900
/* 205955 begin */
1901
			/* Else get the attach count to see if anyone else is attached */
1693
            else {
1902
            else {
1694
               int attcnt = 0;
1903
               int attcnt = 0;
1695
               OSSErr osserr = OSS_OK ;
1904
               OSSErr osserr = OSS_OK ;
Lines 1697-1704 Link Here
1697
#ifdef OSS_DEBUG
1906
#ifdef OSS_DEBUG
1698
					ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"flushToFD:  attach count = %d", attcnt);
1907
					ra_logServiceMessage(__FILE__, __LINE__,RA_DEBUG,"flushToFD:  attach count = %d", attcnt);
1699
#endif
1908
#endif
1700
               /* If nobody is attached to the shared memory except for us then stop flushing */
1909
               attachCheckIndex++;  /* bugzilla 94473 */
1701
               if ( osserr == OSS_OK  &&  attcnt == 1 )
1910
               /* If nobody is attached to the shared memory except for us then stop flushing
1911
                * bugzilla 94473 - only stop flushing if we have gone through the wait loop four
1912
                * times to provide more time for the agent to attach to it (4 seconds instead of 1). */
1913
               if ( osserr == OSS_OK  &&  attcnt == 1 && attachCheckIndex >= 4)
1702
               {
1914
               {
1703
                  /* set the user count to 1 so the shared memory gets deleted when it is destroyed */
1915
                  /* set the user count to 1 so the shared memory gets deleted when it is destroyed */
1704
                  ossIPCMemSetUserCount( pRambo->ipcMemHandle, attcnt ) ;
1916
                  ossIPCMemSetUserCount( pRambo->ipcMemHandle, attcnt ) ;
Lines 1905-1930 Link Here
1905
               goto errorProcessingFailed ;
2117
               goto errorProcessingFailed ;
1906
            }
2118
            }
1907
2119
1908
				/* Get a pointer to the chunk of memory */
2120
            /* Get a pointer to the chunk of memory */
1909
				pChunk  = (void *)( (uintptr_t)pMemBuffer(pRamboCB)
2121
            pChunk  = (void *)( (uintptr_t)pMemBuffer(pRamboCB)
1910
							+ ( chunkIndex * OSS_RAMBO_CHUNK_SIZE ) ) ;
2122
                    + ( chunkIndex * OSS_RAMBO_CHUNK_SIZE ) ) ;
1911
				if (ossAtomicPeek(&pChunkCB->flushedCount) > 0)
2123
            if (ossAtomicPeek(&pChunkCB->flushedCount) > 0)
1912
					pChunk = (void *)((char *)pChunk + ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE);
2124
               pChunk = (void *)((char *)pChunk + ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE);
1913
				OSS_ASSERT( pChunk != NULL ) ;
2125
            OSS_ASSERT( pChunk != NULL ) ;
1914
				OSS_ASSERT( (uintptr_t)pChunk >= (uintptr_t)pMemBuffer(pRamboCB) ) ;
2126
            OSS_ASSERT( (uintptr_t)pChunk >= (uintptr_t)pMemBuffer(pRamboCB) ) ;
1915
2127
1916
				/* Pass the chunk to the data processor, but only process the filled slots */
2128
            /* Pass the chunk to the data processor, but only process the filled slots */
1917
2129
1918
				err = dataProcessor( pChunk, numUsedSlots * OSS_RAMBO_SLOT_SIZE, continueDataSize, fileDescriptor, descriptorType ) ;
2130
            err = dataProcessor( pChunk, numUsedSlots * OSS_RAMBO_SLOT_SIZE, continueDataSize, fileDescriptor, descriptorType ) ;
1919
				if ( 0 > err ) {
2131
            if ( 0 > err ) {
1920
#ifdef OSS_DEBUG1
2132
#ifdef OSS_DEBUG1
1921
					fprintf(dbgfd,"ossRamboFlushToFD:  failed writing the chunk %d of shared memory. error=%d\n", chunkIndex, err ) ;
2133
               fprintf(dbgfd,"ossRamboFlushToFD:  failed writing the chunk %d of shared memory. error=%d\n", chunkIndex, err ) ;
1922
					fflush(dbgfd);
2134
               fflush(dbgfd);
1923
#endif
2135
#endif
1924
					goto errorProcessingFailed ;
2136
               goto errorProcessingFailed ;
1925
				}
2137
            }
1926
				else
2138
			   else
1927
					continueDataSize = err;
2139
				   continueDataSize = err;
1928
2140
1929
#ifdef OSS_DEBUG1
2141
#ifdef OSS_DEBUG1
1930
            fprintf(dbgfd,"Flushed unfilled chunk index %lu has fillCount %lu\n",
2142
            fprintf(dbgfd,"Flushed unfilled chunk index %lu has fillCount %lu\n",
Lines 1982-2079 Link Here
1982
/* 198075 end */
2194
/* 198075 end */
1983
2195
1984
2196
1985
1986
1987
/*******************************************************************************
2197
/*******************************************************************************
1988
2198
1989
   Name
2199
   Function Name
1990
      ossRamboStopFlusherAndDetach
2200
      ossRamboFlushToStream
1991
2201
1992
   Function
2202
   Function
1993
      Tells flusher routine to stop flushing buffer and detach from buffer.
2203
      Flushes the RAMBO buffer to a Java Stream on a timed basis.  It
2204
      does not wait for a chunk to be filled before flushing the data in it.
1994
2205
1995
   Inputs
2206
   Inputs
1996
      1. pRambo
2207
      1. pRambo
1997
         Address of a RAMBO handle.
2208
         Address of a RAMBO buffer control block.
2209
	  2. outStrObj
2210
		   java OutputStream object
1998
2211
1999
   Normal Return
2212
   Normal Returns
2000
      OSS_OK
2213
      OSS_OK
2001
2214
2002
   Error Return
2215
   Error Returns
2003
      OSS_ERR_INVALID
2216
      OSS_ERR_INVALID
2004
      OSS_ERR_RAMBO_NOT_INIT
2217
      OSS_ERR_RAMBO_NOT_INIT
2218
      OSS_ERR_RAMBO_AUTOFLUSHER_ENABLED
2219
      OSS_ERR_RAMBO_IO_ERROR
2005
2220
2006
 ******************************************************************************/
2221
 ******************************************************************************/
2007
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusherAndDetach( OSSRambo * pRambo )
2222
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToStream(
2223
      OSSRambo *pRambo,
2224
	  JNIEnv   *jenv,
2225
      jobject   jOutStrObj )
2008
{
2226
{
2009
   OSSErr osserr = OSS_OK ;
2227
   OSSErr osserr = OSS_OK ;
2228
   ssize_t bytesWritten = 0 ;
2229
   Uint32 chunkIndex = 0 ;
2230
   Uint32 slotIndex = 0 ;
2231
   Uint32 loopIndex = 0 ;
2232
   Uint32 timedOut = 0 ;
2233
   Uint32 attachCheckIndex = 0 ;  /* bugzilla 94473 */
2234
   int flushDataLen;
2235
   OSSRamboCB * pRamboCB ;
2236
   OSSRamboChunkCB * pChunkCB = NULL ;
2237
   void * pChunk = NULL ;
2238
   bool wrappedChunk = false ;
2239
   bool flushUnfilledChunks = false ;
2240
   bool stopping = false;
2241
   Sint32 err = 0 ;
2242
   Sint32 continueDataSize = 0;
2243
	jclass jcls = NULL;
2244
	jmethodID jmethod = NULL;
2010
2245
2011
   /* Validate parameters */
2246
#ifdef OSS_DEBUG1
2247
   FILE *dbgfd;
2248
#endif
2249
2250
#ifdef OSS_DEBUG1
2251
   dbgfd = fopen("flushdbg.txt", "ac+");
2252
   if (dbgfd == NULL) {
2253
	   osserr = errno;
2254
	   goto exit;
2255
   }
2256
   if ( 0 > fprintf(dbgfd,"ossRamboFlushToFD:  Entered.\n" ) ) {
2257
	   osserr = OSS_ERR_RAMBO_IO_ERROR;
2258
	   goto exit;
2259
   }
2260
   fflush(dbgfd);
2261
#endif
2262
2263
   /* Validate the parameters */
2012
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo, sizeof( *pRambo ) ) ) ;
2264
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo, sizeof( *pRambo ) ) ) ;
2013
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2265
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2014
   OSS_ASSERT( !ossIsBadWritePtr( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2266
   OSS_ASSERT( !ossIsBadWritePtr( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2015
   if ( NULL == pRambo )
2267
2268
#ifdef OSS_DEBUG1
2269
   fprintf(dbgfd,"ossRamboFlushToFD:  After asserts.\n" ) ;
2270
   fflush(dbgfd);
2271
#endif
2272
2273
   if ( ( NULL == pRambo ) || ( NULL == pRambo->pRamboCB ) )
2016
   {
2274
   {
2017
      goto errorInvalid ;
2275
      goto errorInvalid ;
2018
   }
2276
   }
2019
2277
2020
   OSS_ASSERT( ossRamboIsInitialized( pRambo->pRamboCB ) ) ;
2278
   pRamboCB = pRambo->pRamboCB ;
2021
   if ( !ossRamboIsInitialized( pRambo->pRamboCB ) )
2279
2280
   OSS_ASSERT( ossRamboIsInitialized( pRamboCB ) ) ;
2281
2282
   if ( !ossRamboIsInitialized( pRamboCB ) )
2022
   {
2283
   {
2023
      goto errorNotInitialized ;
2284
      goto errorNotInitialized ;
2024
   }
2285
   }
2025
2286
2026
   /* Check if the auto flusher is started */
2287
   /* If the auto flusher is on, don't allow manual flushing */
2027
   if ( !ossRamboIsAutoFlusherStarted( pRambo->pRamboCB ) )
2288
   if ( ossRamboIsAutoFlusherStarted( pRamboCB ) )
2028
   {
2289
   {
2029
      osserr = OSS_OK ;
2290
      osserr = OSS_ERR_RAMBO_AUTOFLUSHER_ENABLED ;
2030
      goto exit ;
2291
      goto exit ;
2031
   }
2292
   }
2032
2293
2033
   /* Notify the auto-flusher to stop */
2294
	/* Get java method ID */
2034
   pRambo->pRamboCB->l2.h2.status |= OSS_RAMBO_AUTOF_STOP_NOW ;
2035
2036
#ifdef OSS_DEBUG
2295
#ifdef OSS_DEBUG
2037
   printf("After setting the stop flag\n");
2296
	printf("ossRamboFlushToStream: Before trying to get java method ID\n");
2038
#endif
2297
#endif
2298
	jcls = ENV(jenv)->GetObjectClass(ENVPARM(jenv) jOutStrObj);
2299
	if(jcls != NULL) {
2300
		jmethod = ENV(jenv)->GetMethodID(ENVPARM(jenv) jcls, "write", "([BII)V");
2301
	}
2039
2302
2040
/* 216026 begin */
2303
	if (jmethod == NULL) {
2041
/* Wait until there are no more writers to the shared memory */
2304
		osserr = OSS_ERR_RAMBO_IO_ERROR ;
2042
2305
		goto exit ;
2043
	while ( ossAtomicPeek(&pRambo->writers) > 0 ) {
2306
	}
2044
#ifdef OSS_DEBUG
2307
#ifdef OSS_DEBUG
2045
		printf("ossRamboStopFlusher: waiting because there are still %d writers\n", ossAtomicPeek(&pRambo->writers));
2308
	printf("ossRamboFlushToStream: After getting java method ID\n");
2046
#endif
2309
#endif
2047
		ossYield() ;
2048
	}
2049
/* 216026 end */
2050
2051
/* 186134 - Add a call to detach from the shared memory so it can be destroyed
2052
            by the server */
2053
   ossIPCMemDetach( pRambo->ipcMemHandle ) ;
2054
2310
2055
   OSS_ASSERT( OSS_OK == osserr ) ;
2056
2311
2057
exit:
2312
   /* If already flushing, wait. */
2058
   return osserr ;
2313
   /* TODO */
2314
   /*
2315
    * There is a timing hole here.  The flushing status may have been
2316
    * cleared and then set by another process before we get to set it.
2317
    */
2318
   while ( ossRamboIsFlushing( pRamboCB ) )
2319
   {
2320
      ossYield() ;
2321
   }
2322
//   pRamboCB->l2.h2.status |= OSS_RAMBO_FLUSHING ;
2323
   /* Pretend we are auto flushing instead of manual flushing so we don't hold up writing
2324
      to the buffer */
2325
   pRamboCB->l2.h2.status |= OSS_RAMBO_AUTOF_STARTED ;
2326
   /* TODO */
2059
2327
2060
errorInvalid :
2061
   osserr = OSS_ERR_INVALID ;
2062
   goto exit ;
2063
2328
2064
errorNotInitialized :
2329
   /* Examine the first chunk control block to see if we wrapped. */
2065
   osserr = OSS_ERR_RAMBO_NOT_INIT ;
2330
   if ( ossAtomicPeek(&(pFirstChunkCB(pRamboCB)->fillCount)) > OSS_RAMBO_SLOTS_PER_CHUNK )
2066
   goto exit ;
2331
   {
2067
}
2332
      pOnDiskCB(pRamboCB)->bufferWrapped = 1 ;   /* True */
2333
   }
2068
2334
2335
   /* Write RAMBO storage header information */
2336
   OSS_ASSERT( ossRamboIsValidOnDiskCB( pOnDiskCB(pRamboCB) ) ) ;
2069
2337
2070
/*******************************************************************************
2071
2338
2072
   Name
2339
   /* TODO */
2073
      ossRamboStopFlusher
2340
   /* Start flushing */
2341
#ifdef OSS_DEBUG1
2342
// printf("ossRamboFlushFD:  Started flushing.\n" ) ;
2343
   fprintf(dbgfd,"ossRamboFlushToFD:  Started flushing.\n" ) ;
2344
   fflush(dbgfd);
2345
#endif
2074
2346
2075
   Function
2347
   /* Try to find the least recently filled chunk if the buffer has
2076
      Tells flusher routine to stop flushing buffer.
2348
	  been wrapped and start flushing at it. */
2349
2350
   if ( ossAtomicPeek(&(pFirstChunkCB(pRamboCB)->fillCount)) > OSS_RAMBO_SLOTS_PER_CHUNK )
2351
   {
2352
      slotIndex   = ossAtomicPeek(&pRamboCB->l1.h1.nextSlotIndex) % pRamboCB->l2.h2.maxSlots ;
2353
      chunkIndex  = slotIndex / OSS_RAMBO_SLOTS_PER_CHUNK + 1;
2354
   }
2355
   else
2356
	  chunkIndex = 0;
2357
2358
#ifdef OSS_DEBUG
2359
	printf("ossRamboFlushToStream: About to go into waiting loop\n");
2360
#endif
2361
2362
   for ( ; ; )
2363
   {
2364
      /* Get pointer to the chunk control block */
2365
      pChunkCB = pFirstChunkCB(pRamboCB) + chunkIndex ;
2366
	   OSS_ASSERT( ossRamboIsValidChunkCB( pChunkCB, pRamboCB ) ) ;
2367
2368
      loopIndex = 0;
2369
      timedOut = 0;
2370
      attachCheckIndex = 0;  /* 94473 */
2371
      /* Wait until the chunk is full or we have been asked to stop or we have waited too long */
2372
      for ( ; ; )
2373
      {
2374
         /* If flushing is to be stopped then set the stopping flag and quit the loop */
2375
         if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
2376
         {
2377
            stopping = true ;
2378
            break ;
2379
         }
2380
2381
         /* If the chunk is full then quit the loop so it can be flushed. */
2382
         if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
2383
         {
2384
#ifdef OSS_DEBUG1
2385
// printf("ossRamboFlushFD:  Started flushing.\n" ) ;
2386
            fprintf(dbgfd,"ossRamboFlushToFD:  Data found in buffer.\n" ) ;
2387
            fflush(dbgfd);
2388
#endif
2389
            break ;
2390
         }
2391
         /* Else If we have looped too long */
2392
         else if (loopIndex == 100) {
2393
            /* If there is any data in the chunk Then quit the loop to flush it */
2394
            if ((ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) - ossAtomicPeek(&pChunkCB->flushedCount) > 0  ||
2395
                (ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0)) {
2396
               timedOut = 1;
2397
#ifdef OSS_DEBUG1
2398
               fprintf(dbgfd,"ossRamboFlushToFD:  We've waited too long, flush data found in chunk.\n" ) ;
2399
               fflush(dbgfd);
2400
#endif
2401
               break ;
2402
            }
2403
/* 205955 begin */
2404
			/* Else get the attach count to see if anyone else is attached */
2405
            else {
2406
               int attcnt = 0;
2407
               OSSErr osserr = OSS_OK ;
2408
               osserr = ossIPCMemAttachCount( pRambo->ipcMemHandle, &attcnt ) ;
2409
               attachCheckIndex++;  /* bugzilla 94473 */
2410
               /* If nobody is attached to the shared memory except for us then stop flushing
2411
                * bugzilla 94473 - only stop flushing if we have gone through the wait loop four
2412
                * times to provide more time for the agent to attach to it (4 seconds instead of 1). */
2413
               if ( osserr == OSS_OK  &&  attcnt == 1 && attachCheckIndex >= 4)
2414
               {
2415
#ifdef OSS_DEBUG
2416
   				  printf("ossRamboFlushToStream: Nobody is attached to write to the buffer yet.\n");
2417
#endif
2418
                  /* set the user count to 1 so the shared memory gets deleted when it is destroyed */
2419
/*
2420
                  ossIPCMemSetUserCount( pRambo->ipcMemHandle, attcnt ) ;
2421
                  stopping = true ;
2422
                  break ;
2423
*/
2424
               }
2425
               /* Else continue checking for writes to shared memory */
2426
               loopIndex = 0;
2427
            }
2428
/* 205955 end */
2429
         }
2430
2431
         ossSleep( 10 ) ;
2432
         loopIndex++;
2433
      }
2434
2435
      /* If we should stop, break out of the flushing loop */
2436
      if ( stopping )
2437
      {
2438
#ifdef OSS_DEBUG1
2439
// printf("ossRamboFlushFD:  Started flushing.\n" ) ;
2440
            fprintf(dbgfd,"ossRamboFlushToFD:  We are stopping flushing so flush unfilled chunks.\n" ) ;
2441
            fflush(dbgfd);
2442
#endif
2443
         flushUnfilledChunks = true ;
2444
         break ;
2445
      }
2446
2447
      /* If the chunk is full, flush it to disk */
2448
#ifdef ENW
2449
      if ( ossAtomicPeek(&pChunkCB->fillCount) > 0  &&  (ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK) == 0 )
2450
#else
2451
      if ( pChunkCB->fillCount >= OSS_RAMBO_SLOTS_PER_CHUNK )
2452
#endif
2453
      {
2454
         unsigned int i;
2455
         if (ossAtomicPeek(&pChunkCB->flushedCount) == 0) {
2456
            OSS_ASSERT( (Uint32)-1 == ossAtomicPeek(&pChunkCB->slotMap[0]) ) ;
2457
         }
2458
         OSS_ASSERT( (Uint32)-1 == ossAtomicPeek(&pChunkCB->slotMap[OSS_RAMBO_SLOT_BITMAP_ARRAY_SIZE-1]) ) ;
2459
2460
         if ( ossAtomicPeek(&pChunkCB->fillCount) > OSS_RAMBO_SLOTS_PER_CHUNK )
2461
         {
2462
            wrappedChunk = true ;
2463
         }
2464
/*
2465
		 if (!flushStarted)
2466
			 flushStarted = true;
2467
*/
2468
         /* Get a pointer to the chunk of memory */
2469
         pChunk  = (void *)( (uintptr_t)pMemBuffer(pRamboCB)
2470
                 + ( chunkIndex * OSS_RAMBO_CHUNK_SIZE ) ) ;
2471
         if (ossAtomicPeek(&pChunkCB->flushedCount) > 0) {
2472
            pChunk = (void *)((char *)pChunk + ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE);
2473
            flushDataLen = OSS_RAMBO_CHUNK_SIZE - ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE;
2474
         }
2475
         else
2476
            flushDataLen = OSS_RAMBO_CHUNK_SIZE;
2477
2478
         OSS_ASSERT( pChunk != NULL ) ;
2479
         OSS_ASSERT( (uintptr_t)pChunk >= (uintptr_t)pMemBuffer(pRamboCB) ) ;
2480
2481
         /* Pass the chunk to the data processor */
2482
2483
         err = dataToStrProcessor( pChunk, flushDataLen, continueDataSize, jenv, jOutStrObj, jmethod ) ;
2484
         if ( 0 > err ) {
2485
//      perror("ossRamboFlushFD failed writing the storage header info");
2486
#ifdef OSS_DEBUG1
2487
            fprintf(dbgfd,"ossRamboFlushToFD:  failed writing the chunk %d of shared memory. wsa error=%d\n", chunkIndex, WSAGetLastError() ) ;
2488
            fflush(dbgfd);
2489
#endif
2490
            goto errorProcessingFailed ;
2491
         }
2492
         else
2493
            continueDataSize = err;
2494
2495
         if ( wrappedChunk )
2496
         {
2497
            /*
2498
             * The flusher has been lapped.  The chunk has been filled
2499
             * more than once.  Log this so we know it has happened but
2500
             * don't exit.
2501
             */
2502
#ifdef OSS_DEBUG1
2503
//            printf("RC = ERR_CHUNK_OVERWRITTEN:  Flushed chunk %lu fillCount %lu\n",
2504
//                        chunkIndex, pChunkCB->fillCount ) ;
2505
            fprintf(dbgfd,"RC = ERR_CHUNK_OVERWRITTEN:  Flushed chunk %lu fillCount %lu\n",
2506
                        chunkIndex, ossAtomicPeek(&pChunkCB->fillCount) ) ;
2507
            fflush(dbgfd);
2508
#endif
2509
            wrappedChunk = false ;
2510
         }
2511
#ifdef OSS_DEBUG1
2512
         else {
2513
//            printf("Flushed chunk %lu fillCount %lu\n",
2514
//                        chunkIndex, pChunkCB->fillCount ) ;
2515
            fprintf(dbgfd,"Flushed chunk %lu fillCount %lu\n",
2516
                        chunkIndex, ossAtomicPeek(&pChunkCB->fillCount) ) ;
2517
            fflush(dbgfd);
2518
         }
2519
#endif
2520
2521
         //pause() ;
2522
         /* Reset the chunk control block */
2523
/* 186134 begin
2524
         memset( (void *)&pChunkCB->slotMap[0], 0x00, sizeof( pChunkCB->slotMap ) ) ;
2525
*/
2526
         for(i=0; i < OSS_RAMBO_SLOT_BITMAP_ARRAY_SIZE; i++) {
2527
            ossAtomicPoke(&(pChunkCB->slotMap[i]), 0);
2528
         }
2529
/* 186134 end */
2530
         ossAtomicPoke(&pChunkCB->fillCount, 0) ;
2531
         ossAtomicPoke(&pChunkCB->flushedCount, 0) ;
2532
      }
2533
      else if ( timedOut ) {
2534
         /* Get a pointer to the chunk of memory */
2535
         pChunk  = (void *)( (uintptr_t)pMemBuffer(pRamboCB)
2536
                 + ( chunkIndex * OSS_RAMBO_CHUNK_SIZE ) ) ;
2537
2538
         slotIndex = ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK;
2539
         if (ossAtomicPeek(&pChunkCB->flushedCount) > 0) {
2540
            pChunk = (void *)((char *)pChunk + ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE);
2541
            flushDataLen = (slotIndex - ossAtomicPeek(&pChunkCB->flushedCount)) * OSS_RAMBO_SLOT_SIZE;
2542
         }
2543
         else
2544
            flushDataLen = slotIndex * OSS_RAMBO_SLOT_SIZE;
2545
2546
         OSS_ASSERT( pChunk != NULL ) ;
2547
         OSS_ASSERT( (uintptr_t)pChunk >= (uintptr_t)pMemBuffer(pRamboCB) ) ;
2548
2549
         /* Pass the chunk to the data processor */
2550
2551
         err = dataToStrProcessor( pChunk, flushDataLen, continueDataSize, jenv, jOutStrObj, jmethod ) ;
2552
         if ( 0 > err ) {
2553
//      perror("ossRamboFlushFD failed writing the storage header info");
2554
#ifdef OSS_DEBUG1
2555
            fprintf(dbgfd,"ossRamboFlushToFD:  failed writing the chunk %d of shared memory. wsa error=%d\n", chunkIndex, WSAGetLastError() ) ;
2556
            fflush(dbgfd);
2557
#endif
2558
            goto errorProcessingFailed ;
2559
         }
2560
         else
2561
            continueDataSize = err;
2562
2563
         /* Reset the chunk control block */
2564
         ossRamboMarkSlotsEmpty(pChunkCB, ossAtomicPeek(&pChunkCB->flushedCount), slotIndex-ossAtomicPeek(&pChunkCB->flushedCount));
2565
      }
2566
#ifdef OSS_DEBUG1
2567
      else if (ossAtomicPeek(&pChunkCB->fillCount) > 0) {
2568
//         printf("Unfilled chunk %lu fillCount %lu\n",
2569
//                        chunkIndex, pChunkCB->fillCount ) ;
2570
         fprintf(dbgfd,"Unfilled chunk %lu fillCount %lu\n",
2571
                        chunkIndex, ossAtomicPeek(&pChunkCB->fillCount) ) ;
2572
         fflush(dbgfd);
2573
      }
2574
#endif
2575
/*
2576
      else if (flushStarted)
2577
         printf("Empty chunk %lu\n", chunkIndex) ;
2578
*/
2579
      /* Move to next chunk if we didn't time out */
2580
      if ( !timedOut )
2581
         chunkIndex = (chunkIndex + 1) % pRamboCB->l2.h2.maxChunks ;
2582
2583
      /* Check if we have been asked to stop */
2584
      if ( pRamboCB->l2.h2.status & OSS_RAMBO_AUTOF_STOP_NOW )
2585
      {
2586
         flushUnfilledChunks = true ;
2587
         break ;
2588
      }
2589
#ifdef OSS_DEBUG
2590
	   printf("ossRamboFlushToStream: About to do another iteration of the waiting loop\n");
2591
#endif
2592
   }
2593
2594
	/* Flush unfilled chunks */
2595
	if ( flushUnfilledChunks )
2596
	{
2597
		int numUsedSlots;
2598
2599
		/* Start flushing at the current chunk index so the flushing continues in the correct order */
2600
		unsigned int i;
2601
#ifdef OSS_DEBUG
2602
		printf("ossRamboFlushToStream: Flushing unfilled chunks\n");
2603
#endif
2604
		for ( i = 0; i < pRamboCB->l2.h2.maxChunks; i++ )
2605
		{
2606
			/* Get pointer to the chunk control block */
2607
			pChunkCB = pFirstChunkCB(pRamboCB) + chunkIndex ;
2608
			OSS_ASSERT( ossRamboIsValidChunkCB( pChunkCB, pRamboCB ) ) ;
2609
2610
			/* If the chunk contains data, flush it to disk */
2611
			if ( ossAtomicPeek(&pChunkCB->fillCount) > 0 )
2612
			{
2613
				unsigned int j;
2614
            numUsedSlots = ossAtomicPeek(&pChunkCB->fillCount) % OSS_RAMBO_SLOTS_PER_CHUNK;
2615
2616
            /* Check if chunk is full */
2617
            if (numUsedSlots == 0) {
2618
               numUsedSlots = OSS_RAMBO_SLOTS_PER_CHUNK;
2619
            }
2620
2621
            /* subtract the slots that have already been flushed */
2622
            numUsedSlots -= ossAtomicPeek(&pChunkCB->flushedCount);
2623
2624
            /* if there are no used slots in this chunk */
2625
            if (numUsedSlots == 0) {
2626
               /* Move to next chunk */
2627
               chunkIndex = (chunkIndex + 1) % pRamboCB->l2.h2.maxChunks ;
2628
               continue;
2629
            }
2630
            else if (numUsedSlots < 0) {
2631
               /* Note: flushedCount should never be bigger than fillCount but we'll
2632
                  catch this case and stop flushing because we are in an inconsistent
2633
                  state
2634
               */
2635
               goto errorProcessingFailed ;
2636
            }
2637
2638
				/* Get a pointer to the chunk of memory */
2639
				pChunk  = (void *)( (uintptr_t)pMemBuffer(pRamboCB)
2640
							+ ( chunkIndex * OSS_RAMBO_CHUNK_SIZE ) ) ;
2641
				if (ossAtomicPeek(&pChunkCB->flushedCount) > 0)
2642
					pChunk = (void *)((char *)pChunk + ossAtomicPeek(&pChunkCB->flushedCount) * OSS_RAMBO_SLOT_SIZE);
2643
				OSS_ASSERT( pChunk != NULL ) ;
2644
				OSS_ASSERT( (uintptr_t)pChunk >= (uintptr_t)pMemBuffer(pRamboCB) ) ;
2645
2646
				/* Pass the chunk to the data processor, but only process the filled slots */
2647
2648
				err = dataToStrProcessor( pChunk, numUsedSlots * OSS_RAMBO_SLOT_SIZE, continueDataSize, jenv, jOutStrObj, jmethod ) ;
2649
				if ( 0 > err ) {
2650
#ifdef OSS_DEBUG1
2651
					fprintf(dbgfd,"ossRamboFlushToFD:  failed writing the chunk %d of shared memory. error=%d\n", chunkIndex, err ) ;
2652
					fflush(dbgfd);
2653
#endif
2654
					goto errorProcessingFailed ;
2655
				}
2656
				else
2657
					continueDataSize = err;
2658
2659
#ifdef OSS_DEBUG1
2660
//            printf("Flushed unfilled chunk index %lu has fillCount %lu\n",
2661
//                        chunkIndex, pChunkCB->fillCount ) ;
2662
            fprintf(dbgfd,"Flushed unfilled chunk index %lu has fillCount %lu\n",
2663
                        chunkIndex, ossAtomicPeek(&pChunkCB->fillCount) ) ;
2664
            fflush(dbgfd);
2665
#endif
2666
2667
				/* Reset the chunk control block */
2668
/* 186134 begin
2669
				memset( (void *)&pChunkCB->slotMap[0], 0x00, sizeof( pChunkCB->slotMap ) ) ;
2670
*/
2671
				for(j=0; j < OSS_RAMBO_SLOT_BITMAP_ARRAY_SIZE; j++) {
2672
					ossAtomicPoke(&(pChunkCB->slotMap[j]), 0);
2673
				}
2674
/* 186134 end */
2675
				ossAtomicPoke(&pChunkCB->fillCount, 0) ;
2676
				ossAtomicPoke(&pChunkCB->flushedCount, 0) ;
2677
			}
2678
#ifdef OSS_DEBUG1
2679
			else {
2680
//            printf("empty chunk index %lu\n", chunkIndex ) ;
2681
				fprintf(dbgfd,"empty chunk index %lu\n", chunkIndex ) ;
2682
				fflush(dbgfd);
2683
			}
2684
#endif
2685
			/* Move to next chunk */
2686
			chunkIndex = (chunkIndex + 1) % pRamboCB->l2.h2.maxChunks ;
2687
2688
		}
2689
		/* Clear the auto-flusher status flags */
2690
		pRamboCB->l2.h2.status &= ~OSS_RAMBO_AUTOF_STOP_NOW ;
2691
		pRamboCB->l2.h2.status &= ~OSS_RAMBO_AUTOF_STARTED ;
2692
	}
2693
#ifdef OSS_DEBUG
2694
	printf("ossRamboFlushToStream: Returning with osserr = %d\n", osserr);
2695
#endif
2696
2697
// pRamboCB->l2.h2.status &= ~OSS_RAMBO_FLUSHING ;
2698
2699
   OSS_ASSERT( OSS_OK == osserr ) ;
2700
2701
exit :
2702
   #ifdef OSS_DEBUG1
2703
     fclose(dbgfd);
2704
   #endif
2705
   OSS_ASSERT( !( pRamboCB->l2.h2.status & OSS_RAMBO_FLUSHING ) ) ;
2706
   return osserr ;
2707
2708
errorInvalid :
2709
   osserr = OSS_ERR_INVALID ;
2710
   goto exit ;
2711
2712
errorNotInitialized :
2713
   osserr = OSS_ERR_RAMBO_NOT_INIT ;
2714
   goto exit ;
2715
2716
errorProcessingFailed :
2717
// pRamboCB->l2.h2.status &= ~OSS_RAMBO_FLUSHING ;
2718
   pRamboCB->l2.h2.status &= ~OSS_RAMBO_AUTOF_STOP_NOW ;
2719
   pRamboCB->l2.h2.status &= ~OSS_RAMBO_AUTOF_STARTED ;
2720
   osserr = OSS_ERR_RAMBO_IO_ERROR ;
2721
   goto exit ;
2722
}
2723
2724
2725
/*******************************************************************************
2726
2727
   Name
2728
      ossRamboStopFlusherAndDetach
2729
2730
   Function
2731
      Tells flusher routine to stop flushing buffer and detach from buffer.
2732
2733
   Inputs
2734
      1. pRambo
2735
         Address of a RAMBO handle.
2736
2737
   Normal Return
2738
      OSS_OK
2739
2740
   Error Return
2741
      OSS_ERR_INVALID
2742
      OSS_ERR_RAMBO_NOT_INIT
2743
2744
 ******************************************************************************/
2745
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusherAndDetach( OSSRambo * pRambo )
2746
{
2747
   OSSErr osserr = OSS_OK ;
2748
2749
   /* Validate parameters */
2750
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo, sizeof( *pRambo ) ) ) ;
2751
   OSS_ASSERT( !ossIsBadReadPtr ( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2752
   OSS_ASSERT( !ossIsBadWritePtr( pRambo->pRamboCB, sizeof( *pRambo->pRamboCB ) ) ) ;
2753
   if ( NULL == pRambo )
2754
   {
2755
      goto errorInvalid ;
2756
   }
2757
2758
   OSS_ASSERT( ossRamboIsInitialized( pRambo->pRamboCB ) ) ;
2759
   if ( !ossRamboIsInitialized( pRambo->pRamboCB ) )
2760
   {
2761
      goto errorNotInitialized ;
2762
   }
2763
2764
   /* Check if the auto flusher is started */
2765
   if ( !ossRamboIsAutoFlusherStarted( pRambo->pRamboCB ) )
2766
   {
2767
      osserr = OSS_OK ;
2768
      goto exit ;
2769
   }
2770
2771
   /* Notify the auto-flusher to stop */
2772
   pRambo->pRamboCB->l2.h2.status |= OSS_RAMBO_AUTOF_STOP_NOW ;
2773
2774
#ifdef OSS_DEBUG
2775
   printf("After setting the stop flag\n");
2776
#endif
2777
2778
/* 216026 begin */
2779
/* Wait until there are no more writers to the shared memory */
2780
2781
	while ( ossAtomicPeek(&pRambo->writers) > 0 ) {
2782
#ifdef OSS_DEBUG
2783
		printf("ossRamboStopFlusher: waiting because there are still %d writers\n", ossAtomicPeek(&pRambo->writers));
2784
#endif
2785
		ossYield() ;
2786
	}
2787
/* 216026 end */
2788
2789
/* 186134 - Add a call to detach from the shared memory so it can be destroyed
2790
            by the server */
2791
   ossIPCMemDetach( pRambo->ipcMemHandle ) ;
2792
2793
   OSS_ASSERT( OSS_OK == osserr ) ;
2794
2795
exit:
2796
   return osserr ;
2797
2798
errorInvalid :
2799
   osserr = OSS_ERR_INVALID ;
2800
   goto exit ;
2801
2802
errorNotInitialized :
2803
   osserr = OSS_ERR_RAMBO_NOT_INIT ;
2804
   goto exit ;
2805
}
2806
2807
2808
/*******************************************************************************
2809
2810
   Name
2811
      ossRamboStopFlusher
2812
2813
   Function
2814
      Tells flusher routine to stop flushing buffer.
2077
2815
2078
   Inputs
2816
   Inputs
2079
      1. pRambo
2817
      1. pRambo
Lines 2263-2266 Link Here
2263
   return (ra_shm_err_t)shmerr;
3001
   return (ra_shm_err_t)shmerr;
2264
}
3002
}
2265
/* 175248 end */
3003
/* 175248 end */
3004
  
3005
OSSErr ra_stopFlusher(OSSRambo *handle) {
3006
   OSSErr shmerr;
3007
3008
   if (handle != NULL) 
3009
      shmerr = ossRamboStopFlusher(handle);
3010
   else
3011
      shmerr = OSS_OK;
3012
3013
   return shmerr;
3014
}
2266
 
3015
 
(-)src-native-new/src/transport/RASharedMemory/RASharedMemory.def (-3 / +2 lines)
Lines 36-41 Link Here
36
    ossYield                        @33
36
    ossYield                        @33
37
    ra_getShmAttachCount            @45
37
    ra_getShmAttachCount            @45
38
    ra_setShmAttachCount            @46
38
    ra_setShmAttachCount            @46
39
    
39
    ra_stopFlusher            		@47
40
	
40
    ossRamboClose                   @48
41
(-)src-native-new/src/transport/RASharedMemory/ossexs.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossmemory.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/oss.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossdebug.cpp (-2 / +2 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 113-119 Link Here
113
            "ASSERTION FAILED = %s\nFile = %s\nLine = %lu\n",
113
            "ASSERTION FAILED = %s\nFile = %s\nLine = %lu\n",
114
            pszExpression,
114
            pszExpression,
115
            pszFilename,
115
            pszFilename,
116
            (unsigned long)lineNumber ) ;
116
            lineNumber ) ;
117
117
118
#if defined SQLWINT
118
#if defined SQLWINT
119
   /*
119
   /*
(-)src-native-new/src/transport/RASharedMemory/ossipcmemory.h (-1 / +6 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 109-114 Link Here
109
OSS_EXTERNC OSSErr OSS_API ossIPCMemDestroy( OSSMemRes memRes ) ;
109
OSS_EXTERNC OSSErr OSS_API ossIPCMemDestroy( OSSMemRes memRes ) ;
110
110
111
/*******************************************************************************
111
/*******************************************************************************
112
   Close IPC memory resource
113
 ******************************************************************************/
114
OSS_EXTERNC OSSErr OSS_API ossIPCMemClose( OSSMemRes memRes ) ;
115
116
/*******************************************************************************
112
   Attach to IPC memory resource
117
   Attach to IPC memory resource
113
 ******************************************************************************/
118
 ******************************************************************************/
114
OSS_EXTERNC OSSErr OSS_API ossIPCMemAttach(
119
OSS_EXTERNC OSSErr OSS_API ossIPCMemAttach(
(-)src-native-new/src/transport/RASharedMemory/RASharedMemory.make (-5 / +5 lines)
Lines 22-28 Link Here
22
#
22
#
23
#-----------------------------------
23
#-----------------------------------
24
TARGET         :=  libhcclsm
24
TARGET         :=  libhcclsm
25
TARGETDIR      :=  $(RAC_SDK_HOME)/lib
25
TARGETDIR      :=  ../../../lib
26
26
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  .  ../../../include  ../RACommon  ../RASocket
40
INCLUDEDIRS    :=  .  ../../../include  ../RACommon  ../RASocket $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 50-56 Link Here
50
#   list of additional library directories to search from
50
#   list of additional library directories to search from
51
#      (separated by blanks)
51
#      (separated by blanks)
52
#-----------------------------------
52
#-----------------------------------
53
LIBDIRS    :=  $(RAC_SDK_HOME)/lib ../../../lib
53
LIBDIRS    :=  ../../../lib
54
54
55
55
56
#-----------------------------------
56
#-----------------------------------
Lines 74-84 Link Here
74
74
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
76
76
77
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
77
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
78
78
79
CXXFLAGS   :=  $(CFLAGS)
79
CXXFLAGS   :=  $(CFLAGS)
80
80
81
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
81
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
82
82
83
83
84
#-----------------------------------
84
#-----------------------------------
(-)src-native-new/src/transport/RASharedMemory/ossipc.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/osstime.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossrambo.h (-5 / +4 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 153-162 Link Here
153
 * RAMBO BUFFER CONTROL BLOCK
153
 * RAMBO BUFFER CONTROL BLOCK
154
 */
154
 */
155
#define OSS_RAMBO_BUFFER_NAME_SIZE  23
155
#define OSS_RAMBO_BUFFER_NAME_SIZE  23
156
/*  Buffer size increases to accommodate UUID length as the name */
157
//We need to use the same length as the RAC for compatibility.
158
//#define OSS_RAMBO_BUFFER_NAME_SIZE  256
159
160
156
161
typedef struct
157
typedef struct
162
{
158
{
Lines 263-268 Link Here
263
OSS_EXTERNC OSSErr OSS_API ossRamboAttach( char *, OSSRambo *, void **,
259
OSS_EXTERNC OSSErr OSS_API ossRamboAttach( char *, OSSRambo *, void **,
264
                                           void ** ) ;
260
                                           void ** ) ;
265
OSS_EXTERNC OSSErr OSS_API ossRamboDestroy( OSSRambo * ) ;
261
OSS_EXTERNC OSSErr OSS_API ossRamboDestroy( OSSRambo * ) ;
262
OSS_EXTERNC OSSErr OSS_API ossRamboClose( OSSRambo * ) ;
266
OSS_EXTERNC OSSErr OSS_API ossRamboAutoFlusherStart( OSSRambo *,
263
OSS_EXTERNC OSSErr OSS_API ossRamboAutoFlusherStart( OSSRambo *,
267
                                                     const char *,
264
                                                     const char *,
268
                                                     const char *,
265
                                                     const char *,
Lines 275-282 Link Here
275
                                                  Uint32 ) ;
272
                                                  Uint32 ) ;
276
OSS_EXTERNC OSSErr OSS_API ossRamboFlush( OSSRambo *, const char * ) ;
273
OSS_EXTERNC OSSErr OSS_API ossRamboFlush( OSSRambo *, const char * ) ;
277
#ifdef ENW
274
#ifdef ENW
275
#include <jni.h>
278
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToFD( OSSRambo *, int, int ) ;
276
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToFD( OSSRambo *, int, int ) ;
279
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToFunc( OSSRambo *, RA_Data_Processing_Routine, void * ) ;
277
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToFunc( OSSRambo *, RA_Data_Processing_Routine, void * ) ;
278
OSS_EXTERNC OSSErr OSS_API ossRamboFlushToStream( OSSRambo *, JNIEnv *, jobject ) ;
280
OSS_EXTERNC OSSErr OSS_API ossRamboFlushFullChunksToFunc( OSSRambo *, RA_Data_Processing_Routine, void * ) ;
279
OSS_EXTERNC OSSErr OSS_API ossRamboFlushFullChunksToFunc( OSSRambo *, RA_Data_Processing_Routine, void * ) ;
281
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusher( OSSRambo * ) ;
280
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusher( OSSRambo * ) ;
282
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusherAndDetach( OSSRambo * ) ;
281
OSS_EXTERNC OSSErr OSS_API ossRamboStopFlusherAndDetach( OSSRambo * ) ;
(-)src-native-new/src/transport/RASharedMemory/ossramboinl.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossmemory.cpp (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossatomic.h (-2 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1380-1386 Link Here
1380
)
1380
)
1381
{
1381
{
1382
   OSSRegister32 *old ;
1382
   OSSRegister32 *old ;
1383
1384
/* 186134 - changed this so it would compile on Win NT and because the return
1383
/* 186134 - changed this so it would compile on Win NT and because the return
1385
            value was being interpretted incorrectly - a PVOID is returned,
1384
            value was being interpretted incorrectly - a PVOID is returned,
1386
            not an int
1385
            not an int
(-)src-native-new/src/transport/RASharedMemory/RAShm.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/osserror.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossipcmemory.cpp (-8 / +61 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 66-72 Link Here
66
#define OSS_MARKER_MEM     ((OSSMarker)(0xDB2ADB2B))
66
#define OSS_MARKER_MEM     ((OSSMarker)(0xDB2ADB2B))
67
#define OSS_MEM_HASH_SZ    64
67
#define OSS_MEM_HASH_SZ    64
68
68
69
/* bugzilla 99740 begin */
70
#ifdef SQLWINT
71
#define OSS_MEM_NAME       "Global\\OSSMEM%s"
72
#else
69
#define OSS_MEM_NAME       "OSSMEM%s"
73
#define OSS_MEM_NAME       "OSSMEM%s"
74
#endif
75
/* bugzilla 99740 end */
76
70
#define OSS_RES_SIZE       (1024*1024*4)
77
#define OSS_RES_SIZE       (1024*1024*4)
71
78
72
79
Lines 273-278 Link Here
273
   }
280
   }
274
281
275
   sprintf( memName, OSS_MEM_NAME, pResName ) ;
282
   sprintf( memName, OSS_MEM_NAME, pResName ) ;
283
#ifdef OSS_DEBUG
284
         printf("IPCMemAttach:  Try to attach to shared memory %s\n",memName);
285
#endif
276
286
277
#ifdef SQLWINT
287
#ifdef SQLWINT
278
   /* 32-bit Windows implementation */
288
   /* 32-bit Windows implementation */
Lines 371-387 Link Here
371
381
372
         shmID = shmget( shmKey, 0, 0 ) ;
382
         shmID = shmget( shmKey, 0, 0 ) ;
373
#ifdef OSS_DEBUG
383
#ifdef OSS_DEBUG
374
         printf("IPCMemAttach:  about to delete shared memory because it already exists\n");
384
         printf("IPCMemAttach:  about to delete shared memory %s because it already exists\n",memName);
375
#endif
385
#endif
376
         if (-1 == shmctl( shmID, IPC_RMID, 0 )) {
386
         if (-1 == shmctl( shmID, IPC_RMID, 0 )) {
377
#ifdef OSS_DEBUG
387
#ifdef OSS_DEBUG
378
            printf("IPCMemAttach:  shmctl(IPC_RMID) failed - errno=%d %s\n", errno, strerror(errno));
388
            printf("IPCMemAttach:  shmctl(IPC_RMID) for mem %s failed - errno=%d %s\n", memName, errno, strerror(errno));
389
#endif
390
            struct shmid_ds shmCtl;
391
            if (-1 == shmctl(shmID, IPC_STAT, &shmCtl)) {
392
            	shmID = -1;
393
#ifdef OSS_DEBUG
394
            	printf("IPCMemAttach:  shmctl(IPC_STAT) for mem %s failed - errno=%d %s\n", memName, errno, strerror(errno));
379
#endif
395
#endif
380
            shmID = -1;
396
            }
397
            else if (shmCtl.shm_nattch == 0) {
398
#ifdef OSS_DEBUG
399
            	printf("IPCMemAttach:  no attachments for mem %s, opening for read/write\n", memName);
400
#endif
401
            }
402
            else
403
            	shmID = -1;
381
         }
404
         }
382
         else {
405
         else {
383
#ifdef OSS_DEBUG
406
#ifdef OSS_DEBUG
384
            printf("IPCMemAttach:  about to create shared memory again after deleting it\n");
407
            printf("IPCMemAttach:  about to create shared memory %s again after deleting it\n",memName);
385
#endif
408
#endif
386
            shmID = shmget( shmKey, setSize, shmPerms ) ;
409
            shmID = shmget( shmKey, setSize, shmPerms ) ;
387
			errnoval = errno;
410
			errnoval = errno;
Lines 418-424 Link Here
418
   if ( -1 == shmID )
441
   if ( -1 == shmID )
419
   {
442
   {
420
#ifdef OSS_DEBUG
443
#ifdef OSS_DEBUG
421
      printf("IPCMemAttach:  shmget failed with errno=%d %s\n", errno, strerror(errno));
444
      printf("IPCMemAttach:  shmget for mem %s failed with errno=%d %s\n", memName, errno, strerror(errno));
422
#endif
445
#endif
423
	  if (EEXIST == errnoval) 
446
	  if (EEXIST == errnoval) 
424
		  osserr = OSS_ERR_IPC_DUPLICATE;
447
		  osserr = OSS_ERR_IPC_DUPLICATE;
Lines 437-443 Link Here
437
   if ( (OSSMemSet *)-1 == pMemSet )
460
   if ( (OSSMemSet *)-1 == pMemSet )
438
   {
461
   {
439
#ifdef OSS_DEBUG
462
#ifdef OSS_DEBUG
440
      printf("IPCMemAttach:  shmat failed with errno=%d %s\n", errno, strerror(errno));
463
      printf("IPCMemAttach:  shmat for mem %s failed with errno=%d %s\n", memName, errno, strerror(errno));
441
#endif
464
#endif
442
      osserr = OSS_ERR_IPC_SHMEM_ATTACH_FAILED ;
465
      osserr = OSS_ERR_IPC_SHMEM_ATTACH_FAILED ;
443
      goto exit ;
466
      goto exit ;
Lines 471-477 Link Here
471
   ossLatchGet( &(pMemSet->usersExs) ) ;      /* 186134 */
494
   ossLatchGet( &(pMemSet->usersExs) ) ;      /* 186134 */
472
   pMemSet->users++ ;
495
   pMemSet->users++ ;
473
#ifdef OSS_DEBUG
496
#ifdef OSS_DEBUG
474
   printf("IPCMemAttach:  users = %d for shared memory addr %x\n", pMemSet->users, pMemSet);
497
   printf("IPCMemAttach:  users = %d for shared memory %s addr %x\n", pMemSet->users, memName, pMemSet);
475
#endif
498
#endif
476
   ossLatchRelease( &(pMemSet->usersExs) ) ;  /* 186134 */
499
   ossLatchRelease( &(pMemSet->usersExs) ) ;  /* 186134 */
477
500
Lines 953-958 Link Here
953
/******************************************************************************
976
/******************************************************************************
954
977
955
   Name
978
   Name
979
      ossIPCMemClose
980
981
   Function
982
      Marks an IPC memory resource to be removed by OS when all users deatched.
983
984
   Inputs
985
      1. memRes   - memory resource
986
987
988
   Normal Returns
989
      OSS_OK
990
991
   Error Returns
992
      OSS_ERR_FAILED
993
994
******************************************************************************/
995
OSSErr OSS_API ossIPCMemClose(OSSMemRes memRes) {
996
   	OSSMemHdl *pMemHdl = (OSSMemHdl*) memRes;
997
	OSSErr	osserr = OSS_OK;
998
999
#if SQLUNIX
1000
    if (-1 == shmctl(pMemHdl->id, IPC_RMID, 0)) osserr = OSS_ERR_FAILED;
1001
#endif
1002
1003
	return osserr;
1004
}
1005
1006
/******************************************************************************
1007
1008
   Name
956
      ossIPCMemAttach
1009
      ossIPCMemAttach
957
1010
958
   Function
1011
   Function
(-)src-native-new/src/transport/RASharedMemory/ossipc.cpp (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/osstime.cpp (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASharedMemory/ossrambo.cpp (-2 / +6 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 64-70 Link Here
64
#ifdef SQLWINT 
64
#ifdef SQLWINT 
65
#include <limits.h> 
65
#include <limits.h> 
66
#include <io.h> 
66
#include <io.h> 
67
#include <winsock.h> 
67
#include <winsock2.h> /* 134924 */
68
#else 
68
#else 
69
#ifdef OSS_DEBUG 
69
#ifdef OSS_DEBUG 
70
#include <errno.h>      /* 198075 */ 
70
#include <errno.h>      /* 198075 */ 
Lines 711-716 Link Here
711
   goto exit ; 
711
   goto exit ; 
712
} 
712
} 
713
 
713
 
714
OSS_EXTERNC OSSErr OSS_API ossRamboClose( OSSRambo * pRambo ) 
715
{ 
716
   return ossIPCMemClose( pRambo->ipcMemHandle ) ; 
717
} 
714
 
718
 
715
/******************************************************************************* 
719
/******************************************************************************* 
716
 
720
 
(-)src-native-new/src/transport/RASharedMemory/osslatch.h (-540 / +547 lines)
Lines 1-540 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: osslatch.h,v 1.7 2005/08/19 19:50:24 vnaikawadi Exp $
7
 * $Id: osslatch.h,v 1.7 2005/08/19 19:50:24 vnaikawadi Exp $
8
 *
8
 *
9
 * Contributors:
9
 * Contributors:
10
 * IBM - Initial API and implementation
10
 * IBM - Initial API and implementation
11
 **********************************************************************/
11
 **********************************************************************/
12
12
13
/*******************************************************************************
13
/*******************************************************************************
14
14
15
15
16
   Change Activity:
16
   Change Activity:
17
   defect Date        Who Description
17
   defect Date        Who Description
18
   ====== =========== === ==============================================
18
   ====== =========== === ==============================================
19
   161881 Nov/30/2000 pj  Various changes.
19
   161881 Nov/30/2000 pj  Various changes.
20
   162293 Jan/29/2001 hdp IA64 Windows port
20
   162293 Jan/29/2001 hdp IA64 Windows port
21
   165795 Feb/02/2001 jpk Forward fitted v7.2 EXS implementation
21
   165795 Feb/02/2001 jpk Forward fitted v7.2 EXS implementation
22
   166622 Feb/12/2001 jpk Fix SUN build
22
   166622 Feb/12/2001 jpk Fix SUN build
23
   170450 Mar/20/2001 ssu AS400 port changes
23
   170450 Mar/20/2001 ssu AS400 port changes
24
   173377 Apr/24/2001 jpk Removed SQLSIN
24
   173377 Apr/24/2001 jpk Removed SQLSIN
25
   179937 Jun/16/2001 jpk Added ossExsTestEnter() and changed 32-bit Windows
25
   179937 Jun/16/2001 jpk Added ossExsTestEnter() and changed 32-bit Windows
26
                          to use InterlockedExchanged()
26
                          to use InterlockedExchanged()
27
   191482 Oct/19/2001 jpk Added some comments
27
   191482 Oct/19/2001 jpk Added some comments
28
   192160 Oct/23/2001 jpk Added more comments
28
   192160 Oct/23/2001 jpk Added more comments
29
   192091 Nov/12/2001 yka Code cleanup Phase V
29
   192091 Nov/12/2001 yka Code cleanup Phase V
30
   195526 Nov/13/2001 yka Code cleanup Phase VI
30
   195526 Nov/13/2001 yka Code cleanup Phase VI
31
   189356 Nov/15/2001 yka Added OSSEXS_STATIC_INITIALIZER
31
   189356 Nov/15/2001 yka Added OSSEXS_STATIC_INITIALIZER
32
   195525 Nov/20/2001 yka Rename OSSExs to OSSLatch
32
   195525 Nov/20/2001 yka Rename OSSExs to OSSLatch
33
   186134 Mar/01/2002 dns changes so this file can be compiled as C code
33
   186134 Mar/01/2002 dns changes so this file can be compiled as C code
34
                          on some platforms
34
                          on some platforms
35
35
36
*******************************************************************************/
36
*******************************************************************************/
37
37
38
/**
38
/**
39
   \file osslatch.h
39
   \file osslatch.h
40
   \brief OSSe short-duration exclusive spin latch (lock)
40
   \brief OSSe short-duration exclusive spin latch (lock)
41
 */
41
 */
42
42
43
#ifndef OSSLATCH_HEADER_INCLUDED
43
#ifndef OSSLATCH_HEADER_INCLUDED
44
#define OSSLATCH_HEADER_INCLUDED
44
#define OSSLATCH_HEADER_INCLUDED
45
45
46
/* System includes */
46
/* System includes */
47
#include <stdio.h>
47
#include <stdio.h>
48
#include <stdlib.h>
48
#include <stdlib.h>
49
#include <memory.h>
49
#include <memory.h>
50
50
51
/* OSSe includes */
51
/* OSSe includes */
52
#include "oss.h"
52
#include "oss.h"
53
#include "ossdebug.h"
53
#include "ossdebug.h"
54
#ifndef ENW
54
#ifndef ENW
55
#include "ossfeat.h"
55
#include "ossfeat.h"
56
#endif
56
#endif
57
#include "osstime.h"
57
#include "osstime.h"
58
58
59
#if defined SQL_OS400
59
#if defined SQL_OS400
60
  #include <mih/locksl.h>
60
  #include <mih/locksl.h>
61
  #include <mih/unlocksl.h>
61
  #include <mih/unlocksl.h>
62
  #include <mih/matobjlk.h>
62
  #include <mih/matobjlk.h>
63
  #include <except.h>
63
  #include <except.h>
64
#endif
64
#endif
65
65
66
#if defined SQL_OS400
66
#if defined SQL_OS400
67
  #define OSS_LATCH_LOCK    _LENR_LOCK
67
  #define OSS_LATCH_LOCK    _LENR_LOCK
68
  #define OSS_LATCH_UNLOCK  0
68
  #define OSS_LATCH_UNLOCK  0
69
#else
69
#else
70
  #if !defined HPUX
70
  #if !defined HPUX
71
    #define OSS_LATCH_LOCK    1
71
    #define OSS_LATCH_LOCK    1
72
    #define OSS_LATCH_UNLOCK  0
72
    #define OSS_LATCH_UNLOCK  0
73
  #else
73
  #else
74
    #define OSS_LATCH_LOCK    0
74
    #define OSS_LATCH_LOCK    0
75
    #define OSS_LATCH_UNLOCK  1
75
    #define OSS_LATCH_UNLOCK  1
76
    #define OSS_DEBUG_CHAR 0xCC      /* 186134 - used by HP code */
76
    #define OSS_DEBUG_CHAR 0xCC      /* 186134 - used by HP code */
77
  #endif
77
  #endif
78
#endif
78
#endif
79
79
80
/*******************************************************************************
80
/*******************************************************************************
81
81
82
   IMPORTANT: Keep the size and layout of the lock type and OSSLatch structure
82
   IMPORTANT: Keep the size and layout of the lock type and OSSLatch structure
83
   the consistent between 32- and 64-bit architectures.
83
   the consistent between 32- and 64-bit architectures.
84
84
85
   The size/layout does NOT have to be the same cross-platforms.  For example,
85
   The size/layout does NOT have to be the same cross-platforms.  For example,
86
   AIX and NT don't require a common lock type.  BUT, the size/layout must be
86
   AIX and NT don't require a common lock type.  BUT, the size/layout must be
87
   common between 32- and 64-bit AIX.
87
   common between 32- and 64-bit AIX.
88
88
89
   Why?  It is not uncommon for these structures to be used in shared
89
   Why?  It is not uncommon for these structures to be used in shared
90
   memory that is accessed by both 32- and 64-bit processes.
90
   memory that is accessed by both 32- and 64-bit processes.
91
91
92
*******************************************************************************/
92
*******************************************************************************/
93
93
94
/*
94
/*
95
 * LOCK TYPE
95
 * LOCK TYPE
96
 */
96
 */
97
#if defined SQLSUN
97
#if defined SQLSUN
98
typedef volatile unsigned char OSSLock ;
98
typedef volatile unsigned char OSSLock ;
99
#elif defined SQLWINT
99
#elif defined SQLWINT
100
/* Note: LONG is the same on 32- and 64-bit Windows platforms */
100
/* Note: LONG is the same on 32- and 64-bit Windows platforms */
101
#include <windows.h>   /* 186134 */
101
#include <windows.h>   /* 186134 */
102
#include <winbase.h>   /* 186134 - required for InterlockedExchange */
102
#include <winbase.h>   /* 186134 - required for InterlockedExchange */
103
typedef volatile LONG OSSLock ;
103
typedef volatile LONG OSSLock ;
104
#elif defined HPUX
104
#elif defined HPUX
105
typedef volatile struct { int x[5] ; }  OSSLock ;
105
typedef volatile struct { int x[5] ; }  OSSLock ;
106
#elif defined SQL_OS400
106
#elif defined SQL_OS400
107
typedef volatile unsigned char OSSLock ;
107
typedef volatile unsigned char OSSLock ;
108
#elif defined SQLSGI
108
#elif defined SQLSGI
109
/* The lock word size in abilock_t is the same for both 32- and 64-bit */
109
/* The lock word size in abilock_t is the same for both 32- and 64-bit */
110
#include <abi_mutex.h>
110
#include <abi_mutex.h>
111
typedef volatile abilock_t OSSLock ;
111
typedef volatile abilock_t OSSLock ;
112
#else
112
#else
113
typedef volatile int OSSLock ;
113
typedef volatile int OSSLock ;
114
#endif
114
#endif
115
115
116
116
117
/** \brief Exclusive section handle */
117
/** \brief Exclusive section handle */
118
typedef struct OSSLatch
118
typedef struct OSSLatch
119
{
119
{
120
   OSSLock lock ;
120
   OSSLock lock ;
121
#ifdef ENW
121
#ifdef ENW
122
   Uint32  init ;    /* Used to help identify uninitialized EXS - changed to Uint32 because this file may be included by C code */
122
   Uint32  init ;    /* Used to help identify uninitialized EXS - changed to Uint32 because this file may be included by C code */
123
#else
123
#else
124
   bool    init ;    /* Used to help identify uninitialized EXS */
124
   bool    init ;    /* Used to help identify uninitialized EXS */
125
#endif
125
#endif
126
} OSSLatch ;
126
} OSSLatch ;
127
127
128
128
129
/*
129
/*
130
 * Special purpose internal initializer macro for OSSLatch types.
130
 * Special purpose internal initializer macro for OSSLatch types.
131
 * OSS and OSSe use only.
131
 * OSS and OSSe use only.
132
 */
132
 */
133
#if defined HPUX
133
#if defined HPUX
134
#define OSSLATCH_STATIC_INITIALIZER \
134
#define OSSLATCH_STATIC_INITIALIZER \
135
{ {0x00010001, 0x00010001, 0x00010001, 0x00010001, 0x00010001}, 1 }
135
{ {0x00010001, 0x00010001, 0x00010001, 0x00010001, 0x00010001}, 1 }
136
#elif defined SQLSGI
136
#elif defined SQLSGI
137
#define OSSLATCH_STATIC_INITIALIZER { {0}, 1 }
137
#define OSSLATCH_STATIC_INITIALIZER { {0}, 1 }
138
#else
138
#else
139
#define OSSLATCH_STATIC_INITIALIZER { 0, 1 }
139
#define OSSLATCH_STATIC_INITIALIZER { 0, 1 }
140
#endif
140
#endif
141
141
142
142
143
/*******************************************************************************
143
/*******************************************************************************
144
144
145
   Lock Macros
145
   Lock Macros
146
146
147
   oss_lockaddr
147
   oss_lockaddr
148
      Returns the address of the lock in the OSSLatch structure.  This
148
      Returns the address of the lock in the OSSLatch structure.  This
149
      macro provides the proper cast and/or alignment adjustment
149
      macro provides the proper cast and/or alignment adjustment
150
      for the lock.
150
      for the lock.
151
151
152
   oss_trylock
152
   oss_trylock
153
      Tries to acquire a lock.  If successful, the return value is non-zero.
153
      Tries to acquire a lock.  If successful, the return value is non-zero.
154
      If the lock could not be acquired the return value is zero.
154
      If the lock could not be acquired the return value is zero.
155
155
156
   oss_checklock
156
   oss_checklock
157
      Returns non-zero if the lock is free.  Otherwise, the return value
157
      Returns non-zero if the lock is free.  Otherwise, the return value
158
      is 0 if the lock is held.
158
      is 0 if the lock is held.
159
159
160
   oss_unlock
160
   oss_unlock
161
      Frees a lock.  Void return.
161
      Frees a lock.  Void return.
162
162
163
   oss_initlock
163
   oss_initlock
164
      Initializes the lock.  Void return.
164
      Initializes the lock.  Void return.
165
165
166
*******************************************************************************/
166
*******************************************************************************/
167
#if defined _AIX
167
#if defined _AIX
168
#include <sys/atomic_op.h>
168
#include <sys/atomic_op.h>
169
169
170
#if defined SQLO_USING_VACPP50
170
#if defined SQLO_USING_VACPP50
171
/*
171
/*
172
 * vacpp5 accidentally removed __iospace_sync() as one of the magic known
172
 * vacpp5 accidentally removed __iospace_sync() as one of the magic known
173
 * compiler builtins, so we work around it by explictly including their
173
 * compiler builtins, so we work around it by explictly including their
174
 * internal header.
174
 * internal header.
175
 */
175
 */
176
#include "builtins.h"
176
#include "builtins.h"
177
#endif
177
#endif
178
178
179
/*
179
/*
180
 * If we acquire the lock, _check_lock will return FALSE because the
180
 * If we acquire the lock, _check_lock will return FALSE because the
181
 * compare and swap was successful.
181
 * compare and swap was successful.
182
 */
182
 */
183
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
183
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
184
#define oss_trylock(pLatch)   (FALSE==_check_lock(((atomic_p)oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK,OSS_LATCH_LOCK))
184
#define oss_trylock(pLatch)   (FALSE==_check_lock(((atomic_p)oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK,OSS_LATCH_LOCK))
185
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
185
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
186
#define oss_unlock(pLatch)    (__iospace_sync(), (void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
186
#define oss_unlock(pLatch)    (__iospace_sync(), (void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
187
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
187
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
188
188
189
189
190
/******************************************************************************/
190
/******************************************************************************/
191
#elif defined SQLSUN
191
#elif defined SQLSUN
192
#include <synch.h>
192
#include <synch.h>
193
193
194
OSS_EXTERNC volatile int ldstub( volatile unsigned char * ) ;
194
OSS_EXTERNC volatile int ldstub( volatile unsigned char * ) ;
195
195
196
/*
196
/*
197
 * ldstub returns the previous value of the lock.  If the previous
197
 * ldstub returns the previous value of the lock.  If the previous
198
 * value of the lock is OSS_LATCH_UNLOCK then we have obtained the lock.
198
 * value of the lock is OSS_LATCH_UNLOCK then we have obtained the lock.
199
 */
199
 */
200
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
200
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
201
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==ldstub(oss_lockaddr(pLatch)))
201
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==ldstub(oss_lockaddr(pLatch)))
202
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
202
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
203
#define oss_unlock(pLatch)    ((void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
203
#define oss_unlock(pLatch)    ((void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
204
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
204
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
205
205
206
206
207
/******************************************************************************/
207
/******************************************************************************/
208
#elif defined HPUX
208
#elif defined HPUX
209
209
210
OSS_EXTERNC int  LDCWS(  volatile void * ) ;
210
OSS_EXTERNC int  LDCWS(  volatile void * ) ;
211
OSS_EXTERNC int  LDWSMA( volatile void * ) ;
211
OSS_EXTERNC int  LDWSMA( volatile void * ) ;
212
OSS_EXTERNC void STWSMA( volatile void *, int ) ;
212
OSS_EXTERNC void STWSMA( volatile void *, int ) ;
213
213
214
/*
214
/*
215
 * HPUX lock implementation is the reverse of the other platforms.
215
 * HPUX lock implementation is the reverse of the other platforms.
216
 * To obtain a lock, we clear (zero) the lock word.  When the lock is
216
 * To obtain a lock, we clear (zero) the lock word.  When the lock is
217
 * free, the lock word value is non-zero.  Because of this, the
217
 * free, the lock word value is non-zero.  Because of this, the
218
 * ossLatchInit funtion must be used to initialize an EXS.  You cannot
218
 * ossLatchInit funtion must be used to initialize an EXS.  You cannot
219
 * just memset the EXS to zero and assume you are safe.
219
 * just memset the EXS to zero and assume you are safe.
220
 *
220
 *
221
 * If a lock is acquired, LDCWS will return the previous lock word
221
 * If a lock is acquired, LDCWS will return the previous lock word
222
 * value (OSS_LATCH_UNLOCK).  If the lock is free, LDWSMA will return
222
 * value (OSS_LATCH_UNLOCK).  If the lock is free, LDWSMA will return
223
 * OSS_LATCH_UNLOCK.
223
 * OSS_LATCH_UNLOCK.
224
 */
224
 */
225
#define oss_lockaddr(pLatch)  ((volatile void *)(((uintptr_t)(&((pLatch)->lock))+15)&~15UL))
225
#define oss_lockaddr(pLatch)  ((volatile void *)(((uintptr_t)(&((pLatch)->lock))+15)&~15UL))
226
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==LDCWS(oss_lockaddr(pLatch)))
226
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==LDCWS(oss_lockaddr(pLatch)))
227
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==LDWSMA(oss_lockaddr(pLatch)))
227
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==LDWSMA(oss_lockaddr(pLatch)))
228
#define oss_unlock(pLatch)    ((void)(STWSMA(oss_lockaddr(pLatch),OSS_LATCH_UNLOCK)))
228
#define oss_unlock(pLatch)    ((void)(STWSMA(oss_lockaddr(pLatch),OSS_LATCH_UNLOCK)))
229
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
229
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
230
230
231
231
232
/******************************************************************************/
232
/******************************************************************************/
233
#elif defined SQLSGI
233
#elif defined SQLSGI
234
#include <abi_mutex.h>
234
#include <abi_mutex.h>
235
235
236
/*
236
/*
237
 * If acquire_lock gets the lock, the return value is zero.
237
 * If acquire_lock gets the lock, the return value is zero.
238
 * stat_lock returns UNLOCKED if the lock is free.
238
 * stat_lock returns UNLOCKED if the lock is free.
239
 * release_lock returns 0 if the lock was successfully freed.
239
 * release_lock returns 0 if the lock was successfully freed.
240
 * init_lock returns 0 if the lock was successfully initialized.
240
 * init_lock returns 0 if the lock was successfully initialized.
241
 */
241
 */
242
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
242
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
243
#define oss_trylock(pLatch)   (0==acquire_lock((abilock_t*) oss_lockaddr(pLatch)))
243
#define oss_trylock(pLatch)   (0==acquire_lock((abilock_t*) oss_lockaddr(pLatch)))
244
#define oss_checklock(pLatch) (UNLOCKED==stat_lock((abilock_t*) oss_lockaddr(pLatch)))
244
#define oss_checklock(pLatch) (UNLOCKED==stat_lock((abilock_t*) oss_lockaddr(pLatch)))
245
#define oss_unlock(pLatch)    ((void)(release_lock((abilock_t*) oss_lockaddr(pLatch))))
245
#define oss_unlock(pLatch)    ((void)(release_lock((abilock_t*) oss_lockaddr(pLatch))))
246
#define oss_initlock(pLatch)  ((void)(init_lock((abilock_t*) oss_lockaddr(pLatch))))
246
#define oss_initlock(pLatch)  ((void)(init_lock((abilock_t*) oss_lockaddr(pLatch))))
247
247
248
/******************************************************************************/
248
/******************************************************************************/
249
#elif defined SQLWINT
249
#elif defined SQLWINT
250
250
251
/*
251
/*
252
 * Windows
252
 * Windows
253
 */
253
 */
254
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
254
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
255
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==InterlockedExchange((LONG *)oss_lockaddr(pLatch),OSS_LATCH_LOCK))
255
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==InterlockedExchange((LONG *)oss_lockaddr(pLatch),OSS_LATCH_LOCK))
256
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
256
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
257
#define oss_unlock(pLatch)    ((void)(InterlockedExchange((LONG *)(oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK)))
257
#define oss_unlock(pLatch)    ((void)(InterlockedExchange((LONG *)(oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK)))
258
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
258
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
259
259
260
260
261
/******************************************************************************/
261
/******************************************************************************/
262
#elif defined SQLO_INTEL_IA32 || defined SQLLinux
262
#elif defined SQLO_INTEL_IA32 || defined SQLLinux
263
263
264
/*
264
/*
265
 * 32-bit Intel (Linux, Dynix, Unixware, OS/2, ...) or Linux 390 or Linux IA64.
265
 * 32-bit Intel (Linux, Dynix, Unixware, OS/2, ...) or Linux 390 or Linux IA64.
266
 *
266
 *
267
 * Note: this must be kept in sync with the way this is defined
267
 * Note: this must be kept in sync with the way this is defined
268
 * in OSS (spinlock.h).  This prototype is different than the
268
 * in OSS (spinlock.h).  This prototype is different than the
269
 * spinlock.h proto for OS/2, but we don't really care about that
269
 * spinlock.h proto for OS/2, but we don't really care about that
270
 * anymore.
270
 * anymore.
271
 */
271
 */
272
#ifdef ENW
272
#ifdef ENW
273
/* 186134 - using the xchg linux function instead of the DB2 defined sqloxchg */
273
/* 186134 - using the xchg linux function instead of the DB2 defined sqloxchg */
274
#if defined(__linux__) && defined(__i386__)
274
#if defined(__linux__) && defined(__i386__)
275
	/* 186134 - system.h file uses new as a function parameter name which causes errors
275
	/* 186134 - system.h file uses new as a function parameter name which causes errors
276
	 * compiling as C++ code - so we will redefine new because it is not used
276
	 * compiling as C++ code - so we will redefine new because it is not used
277
	 * in the oss code */
277
	 * in the oss code */
278
	#define new newval
278
	#define new newval
279
#else
279
#elif defined(__linux__) && defined(__powerpc64__) /* SW: Need to revisit this  - why Linux/ppc64 is so different */
280
	#include <asm/types.h>
280
	#include "osslatch.linux_ppc64.h"
281
	/* panic function is used to print error messages in asm/system.h */
281
	#define panic(a) printf(a)
282
	#define panic(a) printf(a)
282
#else
283
#endif
283
	#include <asm/types.h>
284
284
	/* panic function is used to print error messages in asm/system.h */
285
#if defined(__linux__) && (defined SQLO_INTEL_EM64T || defined SQLO_INTEL_IA64)
285
	#define panic(a) printf(a)
286
	/* 186134 - system.h file uses new as a function parameter name which causes errors
286
#endif
287
	 * compiling as C++ code - so we will redefine new because it is not used
287
288
	 * in the oss code */
288
#if defined(__linux__) && (defined SQLO_INTEL_EM64T || defined SQLO_INTEL_IA64)
289
	#define new newval
289
	/* 186134 - system.h file uses new as a function parameter name which causes errors
290
#endif
290
	 * compiling as C++ code - so we will redefine new because it is not used
291
291
	 * in the oss code */
292
/* the following pre-processor handles various versions of */
292
	#define new newval
293
/*    asm/system.h and asm/bitops.h                        */
293
#endif
294
#include <asm/bitops.h>
294
295
#ifndef  LOCK_PREFIX
295
/* the following pre-processor handles various versions of */
296
   #ifdef CONFIG_SMP
296
/*    asm/system.h and asm/bitops.h                        */
297
      #define LOCK_PREFIX "lock ; "
297
#include <asm/bitops.h>
298
   #else
298
#ifndef  LOCK_PREFIX
299
      #define LOCK_PREFIX ""
299
   #ifdef CONFIG_SMP
300
   #endif
300
      #define LOCK_PREFIX "lock ; "
301
#endif
301
   #else
302
302
      #define LOCK_PREFIX ""
303
#include <asm/system.h>
303
   #endif
304
304
#endif
305
#define sqloxchg(a,b) xchg(a,b)
305
306
#else
306
#if defined(__linux__) && defined(__powerpc64__) /* SW: Need to revisit this  - why Linux/ppc64 is so different */
307
OSS_EXTERNC int sqloxchg( int *, int ) ;
307
	/* Do not include system.h since it won't compile */
308
#endif
308
#else
309
309
	#include <asm/system.h>
310
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
310
#endif
311
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==sqloxchg(((int *)oss_lockaddr(pLatch)),OSS_LATCH_LOCK))
311
312
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
312
#define sqloxchg(a,b) xchg(a,b)
313
#define oss_unlock(pLatch)    ((void)(sqloxchg(((int *)oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK)))
313
#else
314
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
314
OSS_EXTERNC int sqloxchg( int *, int ) ;
315
315
#endif
316
316
317
/******************************************************************************/
317
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
318
#elif defined SQLOS390
318
#define oss_trylock(pLatch)   (OSS_LATCH_UNLOCK==sqloxchg(((int *)oss_lockaddr(pLatch)),OSS_LATCH_LOCK))
319
319
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
320
/*
320
#define oss_unlock(pLatch)    ((void)(sqloxchg(((int *)oss_lockaddr(pLatch)),OSS_LATCH_UNLOCK)))
321
 * OS390
321
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
322
 */
322
323
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
323
324
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
324
/******************************************************************************/
325
#define oss_unlock(pLatch)    ((void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
325
#elif defined SQLOS390
326
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
326
327
327
/*
328
#ifdef __cplusplus
328
 * OS390
329
inline int oss_trylock(OSSLatch * pLatch)
329
 */
330
#else
330
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
331
#pragma inline(oss_trylock)
331
#define oss_checklock(pLatch) (OSS_LATCH_UNLOCK==(*oss_lockaddr(pLatch)))
332
int oss_trylock(OSSLatch * pLatch)
332
#define oss_unlock(pLatch)    ((void)(*oss_lockaddr(pLatch)=OSS_LATCH_UNLOCK))
333
#endif
333
#define oss_initlock(pLatch)  ((void)(oss_unlock((pLatch))))
334
{
334
335
  cs_t oldval = OSS_LATCH_UNLOCK;
335
#ifdef __cplusplus
336
  return (0==cs(&oldval,((cs_t*)oss_lockaddr(pLatch)),OSS_LATCH_LOCK));
336
inline int oss_trylock(OSSLatch * pLatch)
337
}
337
#else
338
338
#pragma inline(oss_trylock)
339
339
int oss_trylock(OSSLatch * pLatch)
340
/******************************************************************************/
340
#endif
341
#elif defined SQL_OS400       /*@d170450ssu*/
341
{
342
342
  cs_t oldval = OSS_LATCH_UNLOCK;
343
/*
343
  return (0==cs(&oldval,((cs_t*)oss_lockaddr(pLatch)),OSS_LATCH_LOCK));
344
 * AS/400
344
}
345
 */
345
346
346
347
/*The lock is implemented using the locksl and unlocksl mi instructions.
347
/******************************************************************************/
348
 *locksl will lock the byte and unlocksl will unlock it. Note that this
348
#elif defined SQL_OS400       /*@d170450ssu*/
349
 *instruction does not actually change the value of the byte. The
349
350
 *matobjlk instruction can be used to get the status of the lock on the
350
/*
351
 *byte.
351
 * AS/400
352
 */
352
 */
353
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
353
354
#define oss_unlock(pLatch)    unlocksl((_SPCPTR)oss_lockaddr(pLatch), OSS_LATCH_LOCK )
354
/*The lock is implemented using the locksl and unlocksl mi instructions.
355
#define oss_initlock(pLatch)
355
 *locksl will lock the byte and unlocksl will unlock it. Note that this
356
356
 *instruction does not actually change the value of the byte. The
357
inline int oss_checklock(OSSLatch * pLatch) {
357
 *matobjlk instruction can be used to get the status of the lock on the
358
    /* The receiver template used by 'matobjlk'. */
358
 *byte.
359
    _MOBJL_Template_T    allocated_locks;
359
 */
360
360
#define oss_lockaddr(pLatch)  (&((pLatch)->lock))
361
    allocated_locks.Template_Size = sizeof( _MOBJL_Template_T );
361
#define oss_unlock(pLatch)    unlocksl((_SPCPTR)oss_lockaddr(pLatch), OSS_LATCH_LOCK )
362
362
#define oss_initlock(pLatch)
363
    //Look at the bit pattern returned by
363
364
    //'matobjlk' in the 'Lock_Alloc' field of the template. The fifth
364
inline int oss_checklock(OSSLatch * pLatch) {
365
    //bit (bit 4) of this field represents the Lock-Exclusive-No-Read
365
    /* The receiver template used by 'matobjlk'. */
366
    //(LENR) lock.
366
    _MOBJL_Template_T    allocated_locks;
367
    matobjlk(&allocated_locks, (_ANYPTR)oss_lockaddr(pLatch));
367
368
368
    allocated_locks.Template_Size = sizeof( _MOBJL_Template_T );
369
    if ( allocated_locks.Lock_Alloc & OSS_LATCH_LOCK ) {
369
370
       return 0;
370
    //Look at the bit pattern returned by
371
    }
371
    //'matobjlk' in the 'Lock_Alloc' field of the template. The fifth
372
    return 1;
372
    //bit (bit 4) of this field represents the Lock-Exclusive-No-Read
373
}
373
    //(LENR) lock.
374
374
    matobjlk(&allocated_locks, (_ANYPTR)oss_lockaddr(pLatch));
375
inline int oss_trylock(OSSLatch * pLatch) {
375
376
    //See if already locked
376
    if ( allocated_locks.Lock_Alloc & OSS_LATCH_LOCK ) {
377
    if(!oss_checklock(pLatch)) {
377
       return 0;
378
       return 0;
378
    }
379
    }
379
    return 1;
380
380
}
381
    //Exclusive lock the byte. Catch MCH5804 = locked time out exception
381
382
    #pragma exception_handler(isLocked, 0, 0,  \
382
inline int oss_trylock(OSSLatch * pLatch) {
383
            _C2_MH_ESCAPE, _CTLA_HANDLE, "MCH5804")
383
    //See if already locked
384
    locksl((_SPCPTR)oss_lockaddr(pLatch), OSS_LATCH_LOCK );
384
    if(!oss_checklock(pLatch)) {
385
    #pragma disable_handler
385
       return 0;
386
386
    }
387
    //Make sure that it really is locked
387
388
    return !oss_checklock(pLatch);
388
    //Exclusive lock the byte. Catch MCH5804 = locked time out exception
389
389
    #pragma exception_handler(isLocked, 0, 0,  \
390
    isLocked:
390
            _C2_MH_ESCAPE, _CTLA_HANDLE, "MCH5804")
391
       return 0;
391
    locksl((_SPCPTR)oss_lockaddr(pLatch), OSS_LATCH_LOCK );
392
}
392
    #pragma disable_handler
393
393
394
394
    //Make sure that it really is locked
395
/******************************************************************************/
395
    return !oss_checklock(pLatch);
396
#else
396
397
#error Unsupported platform
397
    isLocked:
398
#endif
398
       return 0;
399
399
}
400
/* bugzilla 64229 - adding #include "RASharedMemory.h" to RAServerTypes2.h
400
401
   causes this file to be included for all of the RAServer c files.  On
401
402
	Solaris this causes a link problem because the following functions are
402
/******************************************************************************/
403
   mutiply defined.  So for Solaris we won't define these functions for
403
#else
404
	C files
404
#error Unsupported platform
405
*/
405
#endif
406
#if (!defined(SQLSUN) && !defined(__powerpc64__)) || defined(__cplusplus)
406
407
407
/* bugzilla 64229 - adding #include "RASharedMemory.h" to RAServerTypes2.h
408
#ifdef ENW
408
   causes this file to be included for all of the RAServer c files.  On
409
#ifndef __cplusplus
409
	Solaris this causes a link problem because the following functions are
410
void OSS_API ossLatchInit ( OSSLatch * pLatch );
410
   mutiply defined.  So for Solaris we won't define these functions for
411
void OSS_API ossLatchGet( OSSLatch * pLatch );
411
	C files
412
int OSS_API ossLatchTestGet( OSSLatch * pLatch );
412
*/
413
void OSS_API ossLatchRelease ( OSSLatch * pLatch );
413
#if (!defined(SQLSUN) && !defined(__powerpc64__)) || defined(__cplusplus)
414
#endif
414
415
#endif
415
#ifdef ENW
416
416
#ifndef __cplusplus
417
/**
417
void OSS_API ossLatchInit ( OSSLatch * pLatch );
418
   \brief Initializes a latch.
418
void OSS_API ossLatchGet( OSSLatch * pLatch );
419
419
int OSS_API ossLatchTestGet( OSSLatch * pLatch );
420
   \param pLatch [in]
420
void OSS_API ossLatchRelease ( OSSLatch * pLatch );
421
      Address of a latch handle.
421
#endif
422
 */
422
#endif
423
#ifdef __cplusplus
423
424
inline void OSS_API ossLatchInit ( OSSLatch * pLatch )
424
/**
425
#else
425
   \brief Initializes a latch.
426
#pragma inline(ossLatchInit)
426
427
void OSS_API ossLatchInit ( OSSLatch * pLatch )
427
   \param pLatch [in]
428
#endif
428
      Address of a latch handle.
429
{
429
 */
430
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
430
#ifdef __cplusplus
431
431
inline void OSS_API ossLatchInit ( OSSLatch * pLatch )
432
#if defined HPUX
432
#else
433
   /*
433
#pragma inline(ossLatchInit)
434
    * Fill the OSSLatch structure with a unique eye-catching value then
434
void OSS_API ossLatchInit ( OSSLatch * pLatch )
435
    * oss_unlock the particular lock word within the structure.  This way
435
#endif
436
    * it will be easier to identify the lock word in a dump of an HPUX
436
{
437
    * OSSLatch structure.
437
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
438
    */
438
439
   memset( (void *)&(pLatch->lock), OSS_DEBUG_CHAR, sizeof( pLatch->lock ) ) ;
439
#if defined HPUX
440
#endif
440
   /*
441
   oss_initlock( pLatch ) ;
441
    * Fill the OSSLatch structure with a unique eye-catching value then
442
   pLatch->init = 1 ;
442
    * oss_unlock the particular lock word within the structure.  This way
443
   return ;
443
    * it will be easier to identify the lock word in a dump of an HPUX
444
}
444
    * OSSLatch structure.
445
445
    */
446
446
   memset( (void *)&(pLatch->lock), OSS_DEBUG_CHAR, sizeof( pLatch->lock ) ) ;
447
/**
447
#endif
448
   \brief Gets a latch.
448
   oss_initlock( pLatch ) ;
449
449
   pLatch->init = 1 ;
450
   \note The latch handle must be initialized prior to using this function!
450
   return ;
451
451
}
452
   \param pLatch [in]
452
453
      Address of a latch handle.
453
454
 */
454
/**
455
#ifdef __cplusplus
455
   \brief Gets a latch.
456
inline void OSS_API ossLatchGet( OSSLatch * pLatch )
456
457
#else
457
   \note The latch handle must be initialized prior to using this function!
458
#pragma inline(ossLatchGet)
458
459
void OSS_API ossLatchGet( OSSLatch * pLatch )
459
   \param pLatch [in]
460
#endif
460
      Address of a latch handle.
461
{
461
 */
462
   volatile int i, j, k ;
462
#ifdef __cplusplus
463
463
inline void OSS_API ossLatchGet( OSSLatch * pLatch )
464
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
464
#else
465
   OSS_ASSERT( pLatch->init ) ;
465
#pragma inline(ossLatchGet)
466
466
void OSS_API ossLatchGet( OSSLatch * pLatch )
467
   while ( !oss_trylock( pLatch ) )
467
#endif
468
   {
468
{
469
      /* Spin */
469
   volatile int i, j, k ;
470
      for ( k = 0, i = 1; !oss_checklock( pLatch ); i++ )
470
471
      {
471
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
472
         if ( ( i & 0x1 ) && ( k & 0xFFFF ) )
472
   OSS_ASSERT( pLatch->init ) ;
473
            ossYield() ;
473
474
         else
474
   while ( !oss_trylock( pLatch ) )
475
            for ( j = 0 ; j < 20 ; j++ )
475
   {
476
               k += i * j + 5 ;
476
      /* Spin */
477
      }
477
      for ( k = 0, i = 1; !oss_checklock( pLatch ); i++ )
478
   }
478
      {
479
   return ;
479
         if ( ( i & 0x1 ) && ( k & 0xFFFF ) )
480
}
480
            ossYield() ;
481
481
         else
482
482
            for ( j = 0 ; j < 20 ; j++ )
483
/**
483
               k += i * j + 5 ;
484
   \brief Tests and gets a latch if available.
484
      }
485
485
   }
486
   \note The latch handle must be initialized prior to using this function!
486
   return ;
487
487
}
488
   \param pLatch [in]
488
489
      Address of a latch handle.
489
490
490
/**
491
   \returns If the latch is available, the function returns true and
491
   \brief Tests and gets a latch if available.
492
      gets the latch.  Otherwise, the return value is false.
492
493
 */
493
   \note The latch handle must be initialized prior to using this function!
494
/* 186134 - changed return type to int from bool because this could be included from C code */
494
495
#ifdef __cplusplus
495
   \param pLatch [in]
496
inline int OSS_API ossLatchTestGet( OSSLatch * pLatch )
496
      Address of a latch handle.
497
#else
497
498
#pragma inline(ossLatchTestGet)
498
   \returns If the latch is available, the function returns true and
499
int OSS_API ossLatchTestGet( OSSLatch * pLatch )
499
      gets the latch.  Otherwise, the return value is false.
500
#endif
500
 */
501
{
501
/* 186134 - changed return type to int from bool because this could be included from C code */
502
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
502
#ifdef __cplusplus
503
   OSS_ASSERT( pLatch->init ) ;
503
inline int OSS_API ossLatchTestGet( OSSLatch * pLatch )
504
504
#else
505
   if ( oss_trylock( pLatch ) )
505
#pragma inline(ossLatchTestGet)
506
   {
506
int OSS_API ossLatchTestGet( OSSLatch * pLatch )
507
      return 1 ;
507
#endif
508
   }
508
{
509
   else
509
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
510
   {
510
   OSS_ASSERT( pLatch->init ) ;
511
      return 0 ;
511
512
   }
512
   if ( oss_trylock( pLatch ) )
513
}
513
   {
514
514
      return 1 ;
515
515
   }
516
/**
516
   else
517
   \brief Release the latch.
517
   {
518
518
      return 0 ;
519
   \note The latch handle must be initialized prior to using this function!
519
   }
520
520
}
521
   \param pLatch [in]
521
522
      Address of a latch handle.
522
523
 */
523
/**
524
#ifdef __cplusplus
524
   \brief Release the latch.
525
inline void OSS_API ossLatchRelease ( OSSLatch * pLatch )
525
526
#else
526
   \note The latch handle must be initialized prior to using this function!
527
#pragma inline(ossLatchRelease)
527
528
void OSS_API ossLatchRelease ( OSSLatch * pLatch )
528
   \param pLatch [in]
529
#endif
529
      Address of a latch handle.
530
{
530
 */
531
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
531
#ifdef __cplusplus
532
   OSS_ASSERT( pLatch->init ) ;
532
inline void OSS_API ossLatchRelease ( OSSLatch * pLatch )
533
533
#else
534
   oss_unlock( pLatch ) ;
534
#pragma inline(ossLatchRelease)
535
   return ;
535
void OSS_API ossLatchRelease ( OSSLatch * pLatch )
536
}
536
#endif
537
537
{
538
#endif  /* 64229 */
538
   OSS_ASSERT( !ossIsBadWritePtr( pLatch, sizeof( *pLatch ) ) ) ;
539
539
   OSS_ASSERT( pLatch->init ) ;
540
#endif
540
541
   oss_unlock( pLatch ) ;
542
   return ;
543
}
544
545
#endif  /* 64229 */
546
547
#endif
(-)src-native-new/src/transport/RASharedMemory/RASharedMemory.h (-1 / +2 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 81-85 Link Here
81
81
82
RASHMEXTERN int ra_getShmAttachCount(ra_shm_handle_t *handle);
82
RASHMEXTERN int ra_getShmAttachCount(ra_shm_handle_t *handle);
83
RASHMEXTERN ra_shm_err_t ra_setShmAttachCount(ra_shm_handle_t *handle, int count);
83
RASHMEXTERN ra_shm_err_t ra_setShmAttachCount(ra_shm_handle_t *handle, int count);
84
RASHMEXTERN ra_shm_err_t ra_stopFlusher(ra_shm_handle_t *handle);
84
85
85
#endif
86
#endif
(-)src-native-new/bin/readme.txt (-21 / +9 lines)
Lines 260-284 Link Here
260
   (c) [EM64T only:] Change /machine:IA64 to /machine:AMD64 for those same
260
   (c) [EM64T only:] Change /machine:IA64 to /machine:AMD64 for those same
261
       LINK32_FLAGS specifications.
261
       LINK32_FLAGS specifications.
262
262
263
2) Download the current RAC SDK from the download site at
263
2) Download the current CBE SDK from the from the download site at
264
http://www.eclipse.org/tptp/home/downloads/downloads.php
265
(i.e., tptpdc.win_<platform>.sdk-<timestamp>.zip) and unzip that package into a
266
directory, then set the environment variable RAC_SDK_HOME to point to that
267
directory.
268
269
3) Download the current CBE SDK from the from the download site at
270
http://www.eclipse.org/tptp/home/downloads/downloads.php
264
http://www.eclipse.org/tptp/home/downloads/downloads.php
271
(i.e., cbe.win_<platform>.sdk-<timestamp>.zip) and unzip that package into a
265
(i.e., cbe.win_<platform>.sdk-<timestamp>.zip) and unzip that package into a
272
directory, then set the environment variable CBE_SDK_HOME to point to that
266
directory, then set the environment variable CBE_SDK_HOME to point to that
273
directory.
267
directory.
274
268
275
4) Install Java - J2SE 1.4.0 or above and follow the install intructions on
269
3) Install Java - J2SE 1.4.0 or above and follow the install intructions on
276
http://java.sun.com/j2se/index.jsp website.
270
http://java.sun.com/j2se/index.jsp website.
277
271
278
Set the environment variable JAVA_HOME to point to the directory containing the
272
Set the environment variable JAVA_HOME to point to the directory containing the
279
Java include and lib directories.
273
Java include and lib directories.
280
274
281
5) For Windows-IA32, open the agent controller MSVC++ workspace file,
275
4) For Windows-IA32, open the agent controller MSVC++ workspace file,
282
tptp_ac.dsw, located in the build directory. Under Project, Set Active Project
276
tptp_ac.dsw, located in the build directory. Under Project, Set Active Project
283
to "BuildMost" and then under Build, select "Build".
277
to "BuildMost" and then under Build, select "Build".
284
278
Lines 293-299 Link Here
293
=> Set Win Svr 2003 {IA64 for IPF | x64 for EM64T} Build Env), change directory
287
=> Set Win Svr 2003 {IA64 for IPF | x64 for EM64T} Build Env), change directory
294
to your installation build directory, and invoke "NMAKE BuildAll.mak64".
288
to your installation build directory, and invoke "NMAKE BuildAll.mak64".
295
289
296
6) To build the C++ samples on Windows-IA32, open the MSVC++ workspace
290
5) To build the C++ samples on Windows-IA32, open the MSVC++ workspace
297
tptp_samples.dsw. Under Project, Set Active Project to "BuildAllSamples" and
291
tptp_samples.dsw. Under Project, Set Active Project to "BuildAllSamples" and
298
then under Build, select "Build".
292
then under Build, select "Build".
299
293
Lines 305-311 Link Here
305
NOTE: The Agent Controller must be running prior to executing any of these
299
NOTE: The Agent Controller must be running prior to executing any of these
306
samples in order for them to succeed.
300
samples in order for them to succeed.
307
301
308
7) To build the Java Base Agent, open the MSVC++ workspace tptp_javaagent.dsw.
302
6) To build the Java Base Agent, open the MSVC++ workspace tptp_javaagent.dsw.
309
Set the JAVA_HOME environment variable to point to the directory where java is
303
Set the JAVA_HOME environment variable to point to the directory where java is
310
installed. Under Project, Set Active Project to "javaBaseAgent" and then under
304
installed. Under Project, Set Active Project to "javaBaseAgent" and then under
311
Build, select "Build".
305
Build, select "Build".
Lines 322-349 Link Here
322
Set the environment variable XERCESC_HOME to point to the directory containing
316
Set the environment variable XERCESC_HOME to point to the directory containing
323
the Xerces include and lib directories.
317
the Xerces include and lib directories.
324
318
325
2) Download the current RAC SDK from the download site at
319
2) Download the current CBE SDK from the from the download site at
326
http://www.eclipse.org/tptp/home/downloads/downloads.php
327
(i.e., tptpdc.linux_<platform>.sdk-<timestamp>.zip) and unzip that package into
328
a directory, then set the environment variable RAC_SDK_HOME to point to that
329
directory.
330
331
3) Download the current CBE SDK from the from the download site at
332
http://www.eclipse.org/tptp/home/downloads/downloads.php
320
http://www.eclipse.org/tptp/home/downloads/downloads.php
333
(i.e., cbe.linux_<platform>.sdk-<timestamp>.zip) and unzip that package into a
321
(i.e., cbe.linux_<platform>.sdk-<timestamp>.zip) and unzip that package into a
334
directory, then set the environment variable CBE_SDK_HOME to point to that
322
directory, then set the environment variable CBE_SDK_HOME to point to that
335
directory.
323
directory.
336
324
337
4) Install Java - J2SE 1.4.0 or above and follow the install intructions on
325
3) Install Java - J2SE 1.4.0 or above and follow the install intructions on
338
http://java.sun.com/j2se/index.jsp website.
326
http://java.sun.com/j2se/index.jsp website.
339
327
340
Set the environment variable JAVA_HOME to point to the directory containing the
328
Set the environment variable JAVA_HOME to point to the directory containing the
341
Java include and lib directories.
329
Java include and lib directories.
342
330
343
5) Add the AC's lib directory and $XERCESC_HOME/lib to the LD_LIBRARY_PATH
331
4) Add the AC's lib directory and $XERCESC_HOME/lib to the LD_LIBRARY_PATH
344
environment variable.
332
environment variable.
345
333
346
6) Run the following build script files located in the build directory. You may
334
5) Run the following build script files located in the build directory. You may
347
need to run dos2unix if they were checked out in DOS format and add execute
335
need to run dos2unix if they were checked out in DOS format and add execute
348
permissions (chmod a+x) on these files before executing them:
336
permissions (chmod a+x) on these files before executing them:
349
   build_tptp_ac.script[64] (add the 64 extension for IPF and EM64T)
337
   build_tptp_ac.script[64] (add the 64 extension for IPF and EM64T)
(-)src-native-new/src/transport/RASocket/RASocket.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASocket/RASocket.make (-5 / +5 lines)
Lines 22-28 Link Here
22
#
22
#
23
#-----------------------------------
23
#-----------------------------------
24
TARGET         :=  libhccls
24
TARGET         :=  libhccls
25
TARGETDIR      :=  $(RAC_SDK_HOME)/lib
25
TARGETDIR      :=  ../../../lib
26
26
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
27
if [ x$VERSIONNUM = x ]; then export VERSIONNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
28
if [ x$MINORNUM = x ]; then export MINORNUM=0; fi
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  .  ../../../include  ../RACommon
40
INCLUDEDIRS    :=  .  ../../../include  ../RACommon $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 50-56 Link Here
50
#   list of additional library directories to search from
50
#   list of additional library directories to search from
51
#      (separated by blanks)
51
#      (separated by blanks)
52
#-----------------------------------
52
#-----------------------------------
53
LIBDIRS    :=  $(RAC_SDK_HOME)/lib ../../../lib
53
LIBDIRS    :=  ../../../lib
54
54
55
55
56
#-----------------------------------
56
#-----------------------------------
Lines 74-84 Link Here
74
74
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
75
DEFINES    := -DSQLUNIX -DSQLLinux -DENW -DREENTRANT -D_REENTRANT -DCONFIG_X86_CMPXCHG
76
76
77
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
77
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86  $(DEFINES)
78
78
79
CXXFLAGS   :=  $(CFLAGS)
79
CXXFLAGS   :=  $(CFLAGS)
80
80
81
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
81
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
82
82
83
83
84
#-----------------------------------
84
#-----------------------------------
(-)src-native-new/src/transport/RASocket/resource.h (-1 / +1 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005,2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
(-)src-native-new/src/transport/RASocket/RASocket.c (-4 / +3 lines)
Lines 1-5 Link Here
1
/**********************************************************************
1
/**********************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-25 Link Here
14
#ifdef _WIN32									/* Win32 */
14
#ifdef _WIN32									/* Win32 */
15
#include <winsock2.h> /* 9707 */
15
#include <winsock2.h> /* 9707 */
16
#include <io.h>
16
#include <io.h>
17
#include <stdio.h>
17
#else											/* else */
18
#else											/* else */
18
#include <sys/types.h>
19
#include <sys/types.h>
19
#include <sys/socket.h>
20
#include <sys/socket.h>
20
#include <netinet/in.h>
21
#include <netinet/in.h>
21
#include <stdlib.h>
22
#include <string.h>
23
#ifndef MVS
22
#ifndef MVS
24
#include <netinet/tcp.h>
23
#include <netinet/tcp.h>
25
#endif
24
#endif
Lines 663-669 Link Here
663
						  SOCKET  *sockfd) {
662
						  SOCKET  *sockfd) {
664
663
665
	struct sockaddr_in serverAddress;
664
	struct sockaddr_in serverAddress;
666
	/* unsigned short localPortNum=DATA_PORT_NUM_CLIENT;*/
665
	unsigned short localPortNum=DATA_PORT_NUM_CLIENT;
667
	int enable=1;
666
	int enable=1;
668
	BOOL nagle=FALSE;
667
	BOOL nagle=FALSE;
669
	struct linger linger;
668
	struct linger linger;
(-)src-native-new/test/PerfmonAgent/PerfmonAgent.make (-1 / +1 lines)
Lines 15-21 Link Here
15
15
16
TARGETDIR      :=  ../../bin
16
TARGETDIR      :=  ../../bin
17
LIBDIR         :=  ../../lib
17
LIBDIR         :=  ../../lib
18
LIBDIRS        :=  ${RAC_SDK_HOME}/lib ../../lib
18
LIBDIRS        :=  ../../lib
19
PERFLINLIB     :=  $(LIBDIR)/libperflin.so
19
PERFLINLIB     :=  $(LIBDIR)/libperflin.so
20
SUPPORTLIB     :=  $(LIBDIR)/libresutils.a
20
SUPPORTLIB     :=  $(LIBDIR)/libresutils.a
21
RESUTILOBJS    :=  library.o clock.o hashtable.o random.o streq.o thread.o mutex.o
21
RESUTILOBJS    :=  library.o clock.o hashtable.o random.o streq.o thread.o mutex.o
(-)src-native-new/src/agents/tptpProcessController/TPTPProcessController.make (-4 / +4 lines)
Lines 20-26 Link Here
20
#   list of additional INCLUDE directories to search headers from
20
#   list of additional INCLUDE directories to search headers from
21
#      (separated by blanks)
21
#      (separated by blanks)
22
#-----------------------------------
22
#-----------------------------------
23
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include ${XERCESC_HOME}/include
23
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include ${XERCESC_HOME}/include
24
24
25
25
26
#-----------------------------------
26
#-----------------------------------
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 54-64 Link Here
54
#
54
#
55
#-----------------------------------
55
#-----------------------------------
56
56
57
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
57
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
58
59
CXXFLAGS   :=  $(CFLAGS)
59
CXXFLAGS   :=  $(CFLAGS)
60
60
61
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
61
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
62
63
63
64
#-----------------------------------
64
#-----------------------------------
(-)src-native-new/src/transport/TPTPClientCompTL/TPTPClientCompTL.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include $(JAVA_HOME)/include $(JAVA_HOME)/include/linux
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/samples/MyFileTransferClient/MyFileTransferClient.make (-3 / +3 lines)
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 55-65 Link Here
55
#
55
#
56
#-----------------------------------
56
#-----------------------------------
57
57
58
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
59
59
60
CXXFLAGS   :=  $(CFLAGS)
60
CXXFLAGS   :=  $(CFLAGS)
61
61
62
LINKOPTS   :=  $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
63
64
64
65
#-----------------------------------
65
#-----------------------------------
(-)src-native-new/src/agentController/AgentController.make (-3 / +3 lines)
Lines 21-27 Link Here
21
#      (separated by blanks)
21
#      (separated by blanks)
22
#-----------------------------------
22
#-----------------------------------
23
23
24
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../include ${XERCESC_HOME}/include
24
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../include ${XERCESC_HOME}/include
25
25
26
26
27
#-----------------------------------
27
#-----------------------------------
Lines 58-68 Link Here
58
#
58
#
59
#-----------------------------------
59
#-----------------------------------
60
60
61
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86 -D_TPTP_DIAGNOSTIC_
61
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86 -D_TPTP_DIAGNOSTIC_
62
62
63
CXXFLAGS   :=  $(CFLAGS)
63
CXXFLAGS   :=  $(CFLAGS)
64
64
65
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
65
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
66
66
67
67
68
#-----------------------------------
68
#-----------------------------------
(-)src-native-new/samples/Compatibility/CompClient.make (-3 / +3 lines)
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 55-65 Link Here
55
#
55
#
56
#-----------------------------------
56
#-----------------------------------
57
57
58
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
59
59
60
CXXFLAGS   :=  $(CFLAGS)
60
CXXFLAGS   :=  $(CFLAGS)
61
61
62
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
63
64
64
65
#-----------------------------------
65
#-----------------------------------
(-)src-native-new/src/shared/TPTPUtil/TPTPUtils.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include ${XERCESC_HOME}/include
40
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include ${XERCESC_HOME}/include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/makefile (-1 lines)
Lines 57-63 Link Here
57
	cp about.linux.html packaging/about.html
57
	cp about.linux.html packaging/about.html
58
	cp -d lib/lib* packaging/lib
58
	cp -d lib/lib* packaging/lib
59
	cp $(XERCESC_HOME)/lib/libxer* packaging/lib
59
	cp $(XERCESC_HOME)/lib/libxer* packaging/lib
60
	cp -d $(RAC_SDK_HOME)/lib/* packaging/lib
61
	cp -r about_files packaging
60
	cp -r about_files packaging
62
	cp -r config packaging
61
	cp -r config packaging
63
	cp -r agents packaging
62
	cp -r agents packaging
(-)src-native-new/makefile.win_ipf (-2 lines)
Lines 22-29 Link Here
22
22
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
25
	copy /y $(RAC_SDK_HOME)\bin\*.dll packaging\bin
26
	copy /y $(RAC_SDK_HOME)\bin\*.exe packaging\bin
27
	copy /y bin\readme.txt packaging\bin
25
	copy /y bin\readme.txt packaging\bin
28
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
26
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
29
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
27
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
(-)src-native-new/makefile.win_em64t (-2 lines)
Lines 22-29 Link Here
22
22
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
25
	copy /y $(RAC_SDK_HOME)\bin\*.dll packaging\bin
26
	copy /y $(RAC_SDK_HOME)\bin\*.exe packaging\bin
27
	copy /y bin\readme.txt packaging\bin
25
	copy /y bin\readme.txt packaging\bin
28
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
26
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
29
	if exist $(TEMP_LICENSE_HOME)\notice.html copy /y $(TEMP_LICENSE_HOME)\notice.html packaging
27
	if exist $(TEMP_LICENSE_HOME)\notice.html copy /y $(TEMP_LICENSE_HOME)\notice.html packaging
(-)src-native-new/makedebug.win_ipf (-2 lines)
Lines 22-29 Link Here
22
22
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
25
	copy /y $(RAC_SDK_HOME)\bin\*.dll packaging\bin
26
	copy /y $(RAC_SDK_HOME)\bin\*.exe packaging\bin
27
	copy /y bin\readme.txt packaging\bin
25
	copy /y bin\readme.txt packaging\bin
28
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
26
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
29
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
27
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
(-)src-native-new/makedebug.win_em64t (-2 lines)
Lines 22-29 Link Here
22
22
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
23
	if exist $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll copy /y $(CBE_SDK_HOME)\lib\CommonBaseEvent.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
24
	copy /y bin\*.dll packaging\bin
25
	copy /y $(RAC_SDK_HOME)\bin\*.dll packaging\bin
26
	copy /y $(RAC_SDK_HOME)\bin\*.exe packaging\bin
27
	copy /y bin\readme.txt packaging\bin
25
	copy /y bin\readme.txt packaging\bin
28
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
26
	if exist $(XERCESC_HOME)\bin\xerces-c_2_6.dll copy /y $(XERCESC_HOME)\bin\xerces-c_2_6.dll packaging\bin
29
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
27
	if exist $(TEMP_LICENSE_HOME)\epl-v10.html copy /y $(TEMP_LICENSE_HOME)\epl-v10.html packaging
(-)src-native-new/src/agents/agentBase/AgentBase.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include ../../../include ../../include ${XERCESC_HOME}/include 
40
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket ../../../include ../../include ${XERCESC_HOME}/include 
41
41
42
#-----------------------------------
42
#-----------------------------------
43
#   list of additional libraries to be linked with
43
#   list of additional libraries to be linked with
Lines 70-80 Link Here
70
#
70
#
71
#-----------------------------------
71
#-----------------------------------
72
72
73
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
73
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
74
74
75
CXXFLAGS   :=  $(CFLAGS)
75
CXXFLAGS   :=  $(CFLAGS)
76
76
77
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
77
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
78
78
79
79
80
#-----------------------------------
80
#-----------------------------------
(-)src-native-new/src/agents/FileTransferAgent/FileTransferAgent.make (-4 / +4 lines)
Lines 20-26 Link Here
20
#   list of additional INCLUDE directories to search headers from
20
#   list of additional INCLUDE directories to search headers from
21
#      (separated by blanks)
21
#      (separated by blanks)
22
#-----------------------------------
22
#-----------------------------------
23
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include ${XERCESC_HOME}/include
23
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include ${XERCESC_HOME}/include
24
24
25
25
26
#-----------------------------------
26
#-----------------------------------
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 54-64 Link Here
54
#
54
#
55
#-----------------------------------
55
#-----------------------------------
56
56
57
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
57
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
58
59
CXXFLAGS   :=  $(CFLAGS)
59
CXXFLAGS   :=  $(CFLAGS)
60
60
61
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
61
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
62
63
63
64
#-----------------------------------
64
#-----------------------------------
(-)src-native-new/samples/SampleClient/SampleClient.make (-3 / +3 lines)
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 55-65 Link Here
55
#
55
#
56
#-----------------------------------
56
#-----------------------------------
57
57
58
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
59
59
60
CXXFLAGS   :=  $(CFLAGS)
60
CXXFLAGS   :=  $(CFLAGS)
61
61
62
LINKOPTS   :=  $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
63
64
64
65
#-----------------------------------
65
#-----------------------------------
(-)src-native-new/samples/SimpleAppl/SimpleAppl.make (-2 / +2 lines)
Lines 54-64 Link Here
54
#
54
#
55
#-----------------------------------
55
#-----------------------------------
56
56
57
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
57
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
58
59
CXXFLAGS   :=  $(CFLAGS)
59
CXXFLAGS   :=  $(CFLAGS)
60
60
61
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
61
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
62
63
63
64
#-----------------------------------
64
#-----------------------------------
(-)src-native-new/src/shared/tptpConfig/tptpConfig.make (-3 / +3 lines)
Lines 38-44 Link Here
38
#   list of additional INCLUDE directories to search headers from
38
#   list of additional INCLUDE directories to search headers from
39
#      (separated by blanks)
39
#      (separated by blanks)
40
#-----------------------------------
40
#-----------------------------------
41
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include ${XERCESC_HOME}/include
41
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include ${XERCESC_HOME}/include
42
42
43
43
44
#-----------------------------------
44
#-----------------------------------
Lines 73-83 Link Here
73
#
73
#
74
#-----------------------------------
74
#-----------------------------------
75
75
76
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
77
77
78
CXXFLAGS   :=  $(CFLAGS)
78
CXXFLAGS   :=  $(CFLAGS)
79
79
80
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
81
81
82
82
83
#-----------------------------------
83
#-----------------------------------
(-)src-native-new/build/build_tptp_samples.script (-1 lines)
Lines 21-27 Link Here
21
then
21
then
22
    export XERCESC_HOME=../../../../depends/xerces-c-src_2_6_0
22
    export XERCESC_HOME=../../../../depends/xerces-c-src_2_6_0
23
fi
23
fi
24
if [ x$RAC_SDK_HOME = x ]; then export RAC_SDK_HOME=`pwd`/../../../depends/RAC_SDK_HOME; fi
25
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
24
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
26
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
25
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
27
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
26
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
(-)src-native-new/build/tptp_ac.dsw (+3 lines)
Lines 284-289 Link Here
284
    Begin Project Dependency
284
    Begin Project Dependency
285
    Project_Dep_Name TPTPUtil
285
    Project_Dep_Name TPTPUtil
286
    End Project Dependency
286
    End Project Dependency
287
    Begin Project Dependency
288
    Project_Dep_Name transportSupport
289
    End Project Dependency
287
}}}
290
}}}
288
291
289
###############################################################################
292
###############################################################################
(-)src-native-new/build/build_tptp_ac.script (-1 / +12 lines)
Lines 22-28 Link Here
22
22
23
if [ x$XERCESC_HOME = x ]; then export XERCESC_HOME=`pwd`/../../../depends/xerces-c-src_2_6_0; fi
23
if [ x$XERCESC_HOME = x ]; then export XERCESC_HOME=`pwd`/../../../depends/xerces-c-src_2_6_0; fi
24
if [ x$JAVA_HOME = x ]; then export JAVA_HOME=`pwd`/../../../depends/java; fi
24
if [ x$JAVA_HOME = x ]; then export JAVA_HOME=`pwd`/../../../depends/java; fi
25
if [ x$RAC_SDK_HOME = x ]; then export RAC_SDK_HOME=`pwd`/../../../depends/RAC_SDK_HOME; fi
26
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
25
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
27
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
26
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
28
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
27
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
Lines 51-56 Link Here
51
50
52
echo "----------------------------------------------"
51
echo "----------------------------------------------"
53
52
53
make -C ../src/transport/RACommon -f RACommon.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\nRACommon"
54
55
echo "----------------------------------------------"
56
57
make -C ../src/transport/RASocket -f RASocket.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\nRASocket"
58
59
echo "----------------------------------------------"
60
61
make -C ../src/transport/RASharedMemory -f RASharedMemory.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\nRASharedMemory"
62
63
echo "----------------------------------------------"
64
54
make -C ../src/transport/transportSupport -f TransportSupport.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\ntransportSupport"
65
make -C ../src/transport/transportSupport -f TransportSupport.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\ntransportSupport"
55
66
56
echo "----------------------------------------------"
67
echo "----------------------------------------------"
(-)src-native-new/build/build_tptp_ac.script64 (-1 / +4 lines)
Lines 22-29 Link Here
22
22
23
if [ x$XERCESC_HOME = x ]; then export XERCESC_HOME=`pwd`/../../../depends/xerces-c-src_2_6_0; fi
23
if [ x$XERCESC_HOME = x ]; then export XERCESC_HOME=`pwd`/../../../depends/xerces-c-src_2_6_0; fi
24
if [ x$JAVA_HOME = x ]; then export JAVA_HOME=`pwd`/../../../depends/java; fi
24
if [ x$JAVA_HOME = x ]; then export JAVA_HOME=`pwd`/../../../depends/java; fi
25
if [ x$RAC_SDK_HOME = x ]; then export RAC_SDK_HOME=`pwd`/../../../depends/RAC_SDK_HOME; fi
26
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
25
if [ x$CBE_SDK_HOME = x ]; then export CBE_SDK_HOME=`pwd`/../../../depends/CBE_SDK_HOME; fi
26
if [ x$KERNEL_SRC = x ]; then export KERNEL_SRC=`pwd`/../../../depends/linux; fi
27
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
27
if [ x$OPTIMIZABLE = x ]; then export OPTIMIZABLE=-O3; fi
28
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
28
#if [ x$DEBUGABLE = x ]; then export DEBUGABLE=-g; fi
29
29
Lines 31-36 Link Here
31
NUM_FAILURES=0
31
NUM_FAILURES=0
32
FAILURES=""
32
FAILURES=""
33
33
34
export C_FLAGS="-m64 -I $KERNEL_SRC/include"
35
export L_FLAGS=-L/usr/lib64
36
34
make -C ../src/shared/TPTPLogUtils -f TPTPLogUtils.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\nTPTPLogUtils"
37
make -C ../src/shared/TPTPLogUtils -f TPTPLogUtils.make $1 || NUM_FAILURES=`expr $NUM_FAILURES + 1` FAILURES="$FAILURES\nTPTPLogUtils"
35
38
36
echo "----------------------------------------------"
39
echo "----------------------------------------------"
(-)src-native-new/src/transport/TPTPAgentCompTL/TPTPAgentCompTL.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/CompSupport/CompSupport.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/BaseTransport/BaseTransport.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  . ${RAC_SDK_HOME}/include ../../../include
40
INCLUDEDIRS    :=  . ../RACommon ../RASharedMemory ../RASocket ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/shared/TPTPLogUtils/TPTPLogUtils.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include ${XERCESC_HOME}/include ${CBE_SDK_HOME}/include
40
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include ${XERCESC_HOME}/include ${CBE_SDK_HOME}/include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/sharedMemTL/SharedMemTL.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/samples/TimeCollector/TimeCollector.make (-3 / +3 lines)
Lines 34-40 Link Here
34
#   list of additional library directories to search from
34
#   list of additional library directories to search from
35
#      (separated by blanks)
35
#      (separated by blanks)
36
#-----------------------------------
36
#-----------------------------------
37
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../lib
37
LIBDIRS    :=  ../../lib
38
38
39
39
40
#-----------------------------------
40
#-----------------------------------
Lines 56-66 Link Here
56
#
56
#
57
#-----------------------------------
57
#-----------------------------------
58
58
59
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
59
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
60
60
61
CXXFLAGS   :=  $(CFLAGS)
61
CXXFLAGS   :=  $(CFLAGS)
62
62
63
LINKOPTS   :=  $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
64
64
65
65
66
#-----------------------------------
66
#-----------------------------------
(-)src-native-new/samples/ConsoleTestClient/ConsoleTestClient.make (-3 / +3 lines)
Lines 33-39 Link Here
33
#   list of additional library directories to search from
33
#   list of additional library directories to search from
34
#      (separated by blanks)
34
#      (separated by blanks)
35
#-----------------------------------
35
#-----------------------------------
36
LIBDIRS    :=  ${RAC_SDK_HOME}/lib ../../lib ${XERCESC_HOME}/lib
36
LIBDIRS    :=  ../../lib ${XERCESC_HOME}/lib
37
37
38
38
39
#-----------------------------------
39
#-----------------------------------
Lines 55-65 Link Here
55
#
55
#
56
#-----------------------------------
56
#-----------------------------------
57
57
58
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
58
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
59
59
60
CXXFLAGS   :=  $(CFLAGS)
60
CXXFLAGS   :=  $(CFLAGS)
61
61
62
LINKOPTS   :=  $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
62
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE)  -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
63
64
64
65
#-----------------------------------
65
#-----------------------------------
(-)src-native-new/src/client/Client.make (-3 / +3 lines)
Lines 48-54 Link Here
48
#   list of additional INCLUDE directories to search headers from
48
#   list of additional INCLUDE directories to search headers from
49
#      (separated by blanks)
49
#      (separated by blanks)
50
#-----------------------------------
50
#-----------------------------------
51
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../include ${XERCESC_HOME}/include
51
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../include ${XERCESC_HOME}/include
52
52
53
53
54
#-----------------------------------
54
#-----------------------------------
Lines 83-93 Link Here
83
#
83
#
84
#-----------------------------------
84
#-----------------------------------
85
85
86
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
86
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
87
87
88
CXXFLAGS   :=  $(CFLAGS)
88
CXXFLAGS   :=  $(CFLAGS)
89
89
90
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
90
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
91
91
92
92
93
#-----------------------------------
93
#-----------------------------------
(-)src-native-new/src/ChkPass/ChkPass.make (-2 / +2 lines)
Lines 56-66 Link Here
56
#
56
#
57
#-----------------------------------
57
#-----------------------------------
58
58
59
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86 -D_TPTP_DIAGNOSTIC_
59
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86 -D_TPTP_DIAGNOSTIC_
60
60
61
CXXFLAGS   :=  $(CFLAGS)
61
CXXFLAGS   :=  $(CFLAGS)
62
62
63
LINKOPTS   :=  $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
63
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -o $(TARGETDIR)/$(TARGET) $(addprefix -L,$(LIBDIRS))
64
64
65
65
66
#-----------------------------------
66
#-----------------------------------
(-)src-native-new/src/shared/processControlUtil/ProcessControlUtil.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../transport/RACommon ../transport/RASharedMemory ../transport/RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/namedPipeTL/NamedPipeTL.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/socketTL/SocketTL.make (-3 / +3 lines)
Lines 37-43 Link Here
37
#   list of additional INCLUDE directories to search headers from
37
#   list of additional INCLUDE directories to search headers from
38
#      (separated by blanks)
38
#      (separated by blanks)
39
#-----------------------------------
39
#-----------------------------------
40
INCLUDEDIRS    :=  ${RAC_SDK_HOME}/include . ../../../include
40
INCLUDEDIRS    :=  ../RACommon ../RASharedMemory ../RASocket . ../../../include
41
41
42
42
43
#-----------------------------------
43
#-----------------------------------
Lines 72-82 Link Here
72
#
72
#
73
#-----------------------------------
73
#-----------------------------------
74
74
75
CFLAGS     :=  $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
75
CFLAGS     :=  $(C_FLAGS) $(DEBUGABLE) -Wall $(OPTIMIZABLE) -fPIC $(addprefix -I,$(INCLUDEDIRS))  -D_LINUX_X86
76
76
77
CXXFLAGS   :=  $(CFLAGS)
77
CXXFLAGS   :=  $(CFLAGS)
78
78
79
LINKOPTS   :=  $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
79
LINKOPTS   :=  $(L_FLAGS) $(DEBUGABLE) -shared -Wl,-soname,$(TARGETSONAME) -o $(TARGETDIR)/$(TARGETREALNAME) $(addprefix -L,$(LIBDIRS))
80
80
81
81
82
#-----------------------------------
82
#-----------------------------------
(-)src-native-new/src/transport/RACommon/java.h (+113 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: java.h,v 1.3 2006/04/06 15:48:11 samwai Exp $
8
 *
9
 * Contributors:
10
 * IBM - Initial API and implementation
11
 **********************************************************************/
12
13
#ifndef _JAVA_H_
14
#define _JAVA_H_
15
16
#include <jni.h>
17
#include "RAComm.h"
18
#include "RATypes.h"
19
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
24
/* JVM creation macros */
25
#if defined(_HPUX)
26
	#define ATTACH_THREAD(env) (ra_getJvm())->AttachCurrentThread((void**)&env, NULL)
27
	#define DETACH_THREAD() (ra_getJvm())->DetachCurrentThread()
28
#else
29
	#define ATTACH_THREAD(env) (*ra_getJvm())->AttachCurrentThread(ra_getJvm(),  (void**)&env, NULL)
30
	#define DETACH_THREAD() (*ra_getJvm())->DetachCurrentThread(ra_getJvm())
31
#endif
32
33
/* JVM interface macros */
34
#if defined(__cplusplus) && (defined(_HPUX) || defined(__powerpc64__))
35
	#define ENV(e) e
36
	#define ENVPARM(e)
37
	#define ENVPARM1(e)
38
#else
39
	#define ENV(e) (*e)
40
	#define ENVPARM(e) e,
41
	#define ENVPARM1(e) e
42
#endif
43
44
struct _ra_javaJob;
45
46
/* Typedef for out Java job completion listener */
47
typedef int (ra_javaJobImplementation)(struct _ra_javaJob *job);
48
49
typedef struct _ra_javaJob {
50
	TID threadHandle;
51
	JNIEnv *env;
52
} ra_javaJob;
53
54
55
/* Typedef for our JVM creation routine */
56
typedef jint (JNICALL *ra_CreateJavaVM)(JavaVM**, void**, void*);
57
58
#ifdef __OS400__
59
/* This structure is to be used with AS/400 for pthread creation, so that a function pointer can be passed as a variable pointer. */
60
typedef struct {
61
    ra_javaJobImplementation *fcn_ptr;
62
} fcn_ptr_wrp;
63
#endif
64
65
extern int ra_createJavaVitualMachine(char *dllPath);
66
extern int ra_createJavaVitualMachineWithClasspath(char *dllPath, char *classpath);
67
extern int ra_destroyJavaVirtualMachine();
68
extern JavaVM* ra_getJvm();
69
extern BOOL ra_isJvmCreated();
70
extern int ra_submitJavaJob(ra_javaJobImplementation *jobImpl, BOOL asynchronous, TID *tid);
71
extern int ra_submitJavaJobReuseJVMThread(ra_javaJobImplementation *jobImpl, BOOL asynchronous, TID *tid, JNIEnv *jenv);
72
extern char* copyJavaStringToNative(JNIEnv *env, jstring str);
73
74
/** fndclsid **************************************************************************************
75
  * This function finds the class ID corresponding to the class name given, taking care of
76
  * platform-dependent encoding on AS/400 and OS/390.
77
  *
78
  * @param env          the environment in which the search is to be performed
79
  * @param clsname      the name of the class in native encoding
80
  * @returns the Java class ID corresponding to the requested class if any.
81
  */
82
extern jclass fndclsid(JNIEnv *env, char *clsname);
83
84
85
/** getnewstrutf **********************************************************************************
86
  * This function creates a new UTF8 string using the string given, taking care of platform-
87
  * dependent encoding on AS/400 and OS/390.
88
  *
89
  * @param env  the environment in which the search is to be performed
90
  * @param str  the content of the string to be created
91
  * @returns the Java string corresponding to the string given.
92
  */
93
extern jstring getnewstrutf(JNIEnv *env, char *str);
94
95
96
/** fndmthdid *************************************************************************************
97
  * This function finds the method ID corresponding to the method given, taking care of platform-
98
  * dependent encoding on AS/400 and OS/390.
99
  *
100
  * @param env        the environment in which the search is to be performed
101
  * @param clsid      the class ID to which the method belongs
102
  * @param mthd       the name of the method in native encoding
103
  * @param sig        the signature of the method in native encoding
104
  * @returns the Java method ID corresponding to the requested method if any.
105
  */
106
extern jmethodID getmthdid(JNIEnv *env, jclass clsid, char *mthd, char *sig);
107
108
109
#ifdef __cplusplus
110
}
111
#endif
112
113
#endif /* _JAVA_H_ */
(-)src-native-new/src/transport/RACommon/java.c (+542 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved.   This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * $Id: java.c,v 1.4 2006/04/24 13:29:35 samwai Exp $
8
 *
9
 * Contributors:
10
 * IBM - Initial API and implementation
11
 **********************************************************************/
12
13
#include "java.h"
14
#include "RAComm.h"
15
16
#include <stdlib.h>
17
18
/* Bug 62342 begins */
19
#ifdef _WIN32
20
	#define NUM_JVM_OPTIONS 2
21
#elif defined(__OS400__) /* Bug 95493 */
22
	#define NUM_JVM_OPTIONS 2
23
#else
24
	#define NUM_JVM_OPTIONS 1
25
#endif
26
/* Bug 62342 ends */
27
28
#ifdef __cplusplus
29
extern "C" {
30
#endif
31
32
/**
33
 * GLOBALS
34
 */
35
36
/* The global JVM handle*/
37
JavaVM *_java_VM = NULL;
38
JNIEnv *_mainThread;
39
int _currentJavaJobId = 0;
40
BOOL _isJvmCreated = FALSE;
41
42
/**
43
 * PROTOTYPES
44
 */
45
#ifdef _WIN32
46
DWORD WINAPI win32JavaJobProxy(LPVOID args);
47
#endif
48
49
void *JavaJob(void *args);
50
51
JavaVM* ra_getJvm() {
52
	return _java_VM;
53
}
54
55
BOOL ra_isJvmCreated() {
56
	return _isJvmCreated;
57
}
58
59
int ra_createJavaVitualMachine(char *dllPath) {
60
	return ra_createJavaVitualMachineWithClasspath(dllPath, NULL);
61
}
62
63
int ra_createJavaVitualMachineWithClasspath(char *dllPath, char *classpath) {
64
    jint result; /* the result of JVM creation */
65
    JavaVMInitArgs vmArgs; /* the JVM arguments */
66
    JavaVMOption options[NUM_JVM_OPTIONS]; /* the options inside the JVM argument structure */ /* Bug 62342 */
67
    char *classpathBuffer; /* the pointer to the class path to be loaded with the JVM */
68
#if defined(__OS400__) /* Bug 95493 */
69
    char *versionBuffer;  /* Bug 95493 the pointer to the version to be loaded with the JVM */
70
#endif
71
    int size, offset; /* the size and offset of the string buffer to be allocated for the class path */
72
#ifdef _WIN32
73
	char *jvmArgBuffer; /* Bug 62342 */
74
#endif
75
76
#ifndef __OS400__
77
    ra_CreateJavaVM vmCreationFunction; /* the entry point of JNI_CreateJavaVM() call */
78
    DLL_REFERENCE dllRef; /* the pointer to the dynamic library */
79
80
    /* Load the dynamic library. */
81
    if (!(dllRef = LOAD_LIBRARY(dllPath))) {
82
        printf("Couldn't load JVM library %s\n", dllPath);
83
        return -1;
84
    }
85
	else {
86
#if _DEBUG
87
        printf("Loaded JVM library %s\n", dllPath);
88
#endif
89
	}
90
91
    /* Resolve the entry point. */
92
    if (!(vmCreationFunction = (ra_CreateJavaVM) RESOLVE_ENTRY_POINT(dllRef, "JNI_CreateJavaVM"))) {
93
        printf("Couldn't resolve entrypoint for JNI_CreateJavaVM\n");
94
        return -2;
95
    }
96
	else {
97
#if _DEBUG
98
        printf("Resolved entrypoint for JNI_CreateJavaVM\n");
99
#endif
100
	}
101
#endif
102
103
    /* Construct the class path for this JVM.  This path can be of an arbitrary length. */
104
    offset = strlen("-Djava.class.path=");
105
    for (size = 1024; ; size <<= 1) {
106
107
        /* Make sure there is enough memory. */
108
        if (!(classpathBuffer = (char *)ra_malloc(size))) {
109
            return -1;
110
        }
111
		BZERO(classpathBuffer, size);
112
113
        result = ra_getEnvironmentVariable("CLASSPATH", classpathBuffer + offset, size - offset);
114
		if(classpath == NULL) {
115
			if (result + offset <= size) {
116
				break;
117
			}
118
		}
119
		else {
120
			if (result + offset + (int)strlen(classpath) + 1 <= size) {
121
				break;
122
			}
123
		}
124
125
        ra_free(classpathBuffer);
126
    }
127
128
#if _DEBUG
129
	printf("System CLASSPATH = %s, rc = %d\n", classpathBuffer + offset, result);
130
#endif
131
132
	if(classpath != NULL) {
133
		strcat(classpathBuffer + offset, FILE_PATH_SEPARATOR_STR);
134
		strcat(classpathBuffer + offset, classpath);
135
		result = 1; /* force this to be non-zero if environment has nothing */
136
	}
137
138
#if _DEBUG
139
		printf("Agent Controller CLASSPATH = %s\n",  classpathBuffer + offset);
140
#endif
141
142
	/* Bug 62342 begins */
143
	vmArgs.nOptions = 0;
144
145
#ifdef _WIN32
146
	/* Add the -Xrs option to prevent JVM shutdown upon user logoff */
147
	jvmArgBuffer = (char*)ra_malloc(sizeof(char) * (strlen("-Xrs") + 1));
148
	BZERO(jvmArgBuffer, strlen("-Xrs") + 1);
149
	memcpy(jvmArgBuffer, "-Xrs", strlen("-Xrs"));
150
	options[vmArgs.nOptions].optionString = jvmArgBuffer;
151
	vmArgs.nOptions++;
152
#endif
153
154
	/* Set all options for the JVM. */
155
	if (result) {
156
#if defined(__OS400__) /* Bug 95493 */
157
		versionBuffer = (char*)ra_malloc(sizeof(char) * 19);
158
		BZERO(versionBuffer, 19);
159
		memcpy(versionBuffer, "-Djava.version=1.4", 18);
160
		options[vmArgs.nOptions].optionString = as400_etoa(versionBuffer);
161
		vmArgs.nOptions++;
162
#endif
163
164
		memcpy(classpathBuffer, "-Djava.class.path=", offset);
165
#if _DEBUG
166
		printf("CLASSPATH used for starting Java job is: %s\n", classpathBuffer + offset);
167
#endif
168
#ifdef __OS400__
169
		/* Set the class path using what is in the CLASSPATH variable. The encoding conversion must be done at run-time. */
170
		options[vmArgs.nOptions].optionString = as400_etoa(classpathBuffer);
171
#elif defined MVS
172
		__etoa(classpathBuffer);
173
		options[vmArgs.nOptions].optionString = classpathBuffer;
174
#else
175
		options[vmArgs.nOptions].optionString = classpathBuffer;
176
#endif
177
178
		vmArgs.nOptions++;
179
	}
180
181
	if(vmArgs.nOptions == 0) {
182
		vmArgs.options = NULL;
183
	}
184
	else {
185
		vmArgs.options = options;
186
	}
187
188
	/* Bug 62342 ends */
189
190
    vmArgs.version = JNI_VERSION_1_2;
191
    vmArgs.ignoreUnrecognized = JNI_FALSE;
192
193
    /* Instantiate the JVM, and clean up. */
194
#ifdef __OS400__
195
    result = JNI_CreateJavaVM(&_java_VM, (void**)&_mainThread, (void*)&vmArgs);
196
    ra_free(options[0].optionString);
197
#else
198
    result = (*vmCreationFunction)(&_java_VM, (void**)&_mainThread, (void*)&vmArgs);
199
#endif
200
201
    ra_free(classpathBuffer);
202
#ifdef _WIN32
203
	ra_free(jvmArgBuffer); /* Bug 62342 */
204
#elif defined(__OS400__)
205
	ra_free(versionBuffer); /* Bug 95493 */
206
#endif
207
208
	if(result == 0) { /* Success */
209
		_isJvmCreated = TRUE;
210
		return 0;
211
	}
212
	else {
213
		_isJvmCreated = FALSE;
214
		return -1;
215
	}
216
}
217
218
int ra_submitJavaJob(ra_javaJobImplementation *jobImpl, BOOL asynchronous, TID *tid) {
219
	return ra_submitJavaJobReuseJVMThread(jobImpl, asynchronous, tid, NULL);
220
}
221
222
int ra_submitJavaJobReuseJVMThread(ra_javaJobImplementation *jobImpl, BOOL asynchronous, TID *tid, JNIEnv *jenv) {
223
	int rc = 0;
224
#ifdef __OS400__
225
    fcn_ptr_wrp* ptr; /* the pointer to the wrapper for the function pointer */
226
227
    /* On AS/400, function and variable pointers are not interchangable.  This wrapper is therefore needed
228
       to create threads properly. This pointer is dynamically allocated to avoid a race condition.  It is
229
       to be freed after the function pointer is passed properly.  Currently, this is done in JavaJob(). */
230
    ptr = ra_malloc(sizeof(fcn_ptr_wrp));
231
    ptr -> fcn_ptr = jobImpl;
232
#endif
233
234
#if _DEBUG
235
	printf("Inside ra_submitJavaJobReuseJVMThread()\n");
236
#endif
237
238
    if (asynchronous) {
239
#if _DEBUG
240
		printf("Asynchronous java job\n");
241
#endif
242
        /* Create a thread to run the job on */
243
#ifdef _WIN32
244
        CreateThread(NULL,              /* default security attributes */
245
                     0,                 /* same stack size as current thread */
246
                     win32JavaJobProxy, /* Thread entry point */
247
                     (LPVOID) jobImpl,  /* params */
248
                     0,                 /* start executing immediately */
249
                     tid);              /* the thread ID */
250
#elif defined __OS400__
251
        if (pthread_create(tid, NULL, JavaJob, ptr)) {
252
#if _DEBUG
253
			printf("Failed to create thread for asynchronous java job\n");
254
#endif
255
            rc = -1;
256
        }
257
#else
258
        if (pthread_create(tid, NULL, JavaJob, jobImpl)) {
259
#if _DEBUG
260
			printf("Failed to create thread for asynchronous java job\n");
261
#endif
262
            rc = -1;
263
        }
264
#endif
265
    } else {
266
        ra_javaJob *job;
267
268
#if _DEBUG
269
		printf("Synchronous java job\n");
270
#endif
271
		/* Allocate memory for the job. */
272
		job = (ra_javaJob*) ra_malloc(sizeof(ra_javaJob));
273
		BZERO(job, sizeof(ra_javaJob));
274
275
		if(jenv == NULL) {
276
			rc = ATTACH_THREAD(job->env);
277
#if _DEBUG
278
			printf("Attached to running jvm thread\n");
279
#endif
280
		}
281
		else {
282
			job->env = jenv;
283
			rc = 0;
284
#if _DEBUG
285
			printf("Reuse existing attached jvm thread\n");
286
#endif
287
		}
288
289
		if(!rc) {
290
#if _DEBUG
291
			printf("Running the java job\n");
292
#endif
293
			/* Run the job */
294
			rc = jobImpl(job);
295
#if _DEBUG
296
			printf("Returned from the java job, rc = %d\n", rc);
297
#endif
298
299
            /* Detach the thread from the JVM */
300
			if(jenv == NULL) {
301
				DETACH_THREAD();
302
#if _DEBUG
303
				printf("Detached from the jvm thread\n");
304
#endif
305
			}
306
307
			/* cleanup */
308
			ra_free(job);
309
		} else {
310
			/* couldn't attach thread to jvm */
311
			/* cleanup */
312
#if _DEBUG
313
			printf("Cannot attach to the jvm thread\n");
314
#endif
315
			ra_free(job);
316
			rc = -1;
317
		}
318
	}
319
	return rc;
320
}
321
322
323
int ra_destroyJavaVirtualMachine() {
324
	/* TODO: Currently, JVMs on most platforms do not handle the JVM destruction gracefully, e.g., process crash upon the DestroyJavaVM().
325
	 *	As a result, this call cannot be made until better support is available.
326
	 */
327
	jint rc = 0;
328
329
#if 0 /* disable the whole block */
330
	if(_isJvmCreated) {
331
#if defined(_HPUX)
332
		rc = (_java_VM)->DestroyJavaVM();
333
#else
334
		rc = (*_java_VM)->DestroyJavaVM(_java_VM);
335
#endif
336
		_java_VM = NULL;
337
		_isJvmCreated = FALSE;
338
	}
339
#endif
340
341
    return (int)rc;
342
}
343
344
345
void javaJobCleanup(void *arg) {
346
    ra_javaJob *job=(ra_javaJob*)arg;
347
    /* Notify the listener we have exited */
348
349
    ra_free(job);
350
}
351
352
353
354
void *JavaJob(void *args) {
355
    ra_javaJobImplementation *jobImpl; /* the entry point to the startup method */
356
    ra_javaJob *job; /* the job object */
357
358
#ifdef __OS400__
359
    /* The pointer args is allocated in ra_submitJavaJob() as a wrapper to pass the function pointer
360
       on AS/400 properly.  Freeing it here the correct behaviour.  */
361
    jobImpl = ((fcn_ptr_wrp *) args) -> fcn_ptr;
362
    ra_free(args);
363
#else
364
    /* On other platforms, the entry point is stored directly in the paremeter. */
365
    jobImpl = (ra_javaJobImplementation *) args;
366
#endif
367
368
    /* Allocate the job. */
369
    job = (ra_javaJob *) ra_malloc(sizeof(ra_javaJob));
370
    BZERO(job, sizeof(ra_javaJob));
371
372
#ifndef _WIN32
373
    /* Prepare for cleanup. */
374
    pthread_cleanup_push(javaJobCleanup, job);
375
#endif
376
377
    /* Start the job. */
378
    if (!ATTACH_THREAD(job -> env)) {
379
#if _DEBUG
380
			printf("Attached to running jvm thread\n");
381
#endif
382
        jobImpl(job);
383
        DETACH_THREAD();
384
#if _DEBUG
385
			printf("Detached from the jvm thread\n");
386
#endif
387
    } else {
388
        printf("Couldn't run job because couldn't attach thread to JVM\n");
389
    }
390
391
#ifndef _WIN32
392
    pthread_cleanup_pop(1);
393
#else
394
    javaJobCleanup(job);
395
#endif
396
    return (void*) NULL;
397
}
398
399
400
#ifdef _WIN32
401
DWORD WINAPI win32JavaJobProxy(LPVOID args) {
402
	DWORD returnVal = 0;
403
	JavaJob(args);
404
	return returnVal;
405
}
406
#endif
407
408
/* Creates a native representation of a Java String */
409
char* copyJavaStringToNative(JNIEnv *env, jstring str) {
410
	char *utf8Bytes;
411
	jsize utf8Length;
412
	char *nativeStr = NULL;
413
	int nativeLength;
414
415
	utf8Length = (jsize)ENV(env)->GetStringUTFLength(ENVPARM(env) str);
416
	utf8Bytes = (char*)ENV(env)->GetStringUTFChars(ENVPARM(env) str, NULL);
417
	if(utf8Length > 0) {
418
		nativeLength = unicode2native(&nativeStr, utf8Bytes, utf8Length);
419
	}
420
	else {
421
		nativeStr = (char*)ra_malloc(sizeof(char)); /* Bug 103601 */
422
		nativeStr[0] = '\0'; /* Bug 103601 */
423
	}
424
	ENV(env)->ReleaseStringUTFChars(ENVPARM(env) str, utf8Bytes);
425
426
	return nativeStr;
427
}
428
429
/** fndclsid **************************************************************************************
430
  * This function finds the class ID corresponding to the class name given, taking care of
431
  * platform-dependent encoding on AS/400 and OS/390.
432
  *
433
  * @param env          the environment in which the search is to be performed
434
  * @param clsname      the name of the class in native encoding
435
  * @returns the Java class ID corresponding to the requested class if any.
436
  */
437
jclass fndclsid(JNIEnv *env, char *clsname) {
438
    jclass clsid; /* the class ID for the class name */
439
    char *asciicls; /* the class name in ASCII format */
440
441
/* On AS/400 and OS/390, convert the class name at run-time into the ASCII format for the lookup. */
442
#ifdef __OS400__
443
    asciicls = as400_etoa(clsname);
444
#elif defined MVS
445
    asciicls = (char *) ra_malloc(strlen(clsname) + 1);
446
    strcpy(asciicls, clsname);
447
    __etoa(asciicls);
448
#else
449
    asciicls = clsname;
450
#endif
451
452
    /* Look up the class ID, after appropriate transformation. */
453
    clsid = ENV(env) -> FindClass(ENVPARM(env) asciicls);
454
455
/* On AS/400 and OS/390, free the ASCII class name before the class ID is returned. */
456
#if defined __OS400__ || defined MVS
457
    ra_free(asciicls);
458
#endif
459
    return clsid;
460
}
461
462
463
/** getnewstrutf **********************************************************************************
464
  * This function creates a new UTF8 string using the string given, taking care of platform-
465
  * dependent encoding on AS/400 and OS/390.
466
  *
467
  * @param env  the environment in which the search is to be performed
468
  * @param str  the content of the string to be created
469
  * @returns the Java string corresponding to the string given.
470
  */
471
jstring getnewstrutf(JNIEnv *env, char *str) {
472
#if defined __OS400__ || defined MVS
473
    char *asciistr; /* the temporary ASCII string */
474
    jstring javastr; /* the new Java string */
475
476
	if (!str) { 
477
		return 0;
478
	}
479
 #ifdef __OS400__
480
    asciistr = as400_etoa(str);
481
 #else
482
    asciistr = (char *) ra_malloc(strlen(str) + 1);
483
    strcpy(asciistr, str);
484
    __etoa(asciistr);
485
 #endif
486
    javastr = ENV(env) -> NewStringUTF(ENVPARM(env) asciistr);
487
    ra_free(asciistr);
488
    return javastr;
489
#else
490
	if (!str) {
491
		return 0; 
492
	}
493
    return ENV(env) -> NewStringUTF(ENVPARM(env) str);
494
#endif
495
}
496
497
498
/** fndmthdid *************************************************************************************
499
  * This function finds the method ID corresponding to the method given, taking care of platform-
500
  * dependent encoding on AS/400 and OS/390.
501
  *
502
  * @param env        the environment in which the search is to be performed
503
  * @param clsid      the class ID to which the method belongs
504
  * @param mthd       the name of the method in native encoding
505
  * @param sig        the signature of the method in native encoding
506
  * @returns the Java method ID corresponding to the requested method if any.
507
  */
508
jmethodID getmthdid(JNIEnv *env, jclass clsid, char *mthd, char *sig) {
509
    jmethodID mthdid; /* the resulting method ID */
510
    char *asciimthd; /* the method name in ASCII format */
511
    char *asciisig; /* the method signature in ASCII format */
512
513
    /* On each platform, obtain the ASCII forms of the method name and signature. */
514
#ifdef __OS400__
515
    asciimthd = as400_etoa(mthd);
516
    asciisig = as400_etoa(sig);
517
#elif defined MVS
518
    asciimthd = (char *) ra_malloc(strlen(mthd) + 1);
519
    asciisig = (char *) ra_malloc(strlen(sig) + 1);
520
    strcpy(asciimthd, mthd);
521
    strcpy(asciisig, sig);
522
    __etoa(asciimthd);
523
    __etoa(asciisig);
524
#else
525
    asciimthd = mthd;
526
    asciisig = sig;
527
#endif
528
529
    /* Look up the method ID. */
530
    mthdid = ENV(env) -> GetMethodID(ENVPARM(env) clsid, asciimthd, asciisig);
531
532
    /* free memory before the methid ID is returned. */
533
#if defined __OS400__ || defined MVS
534
    ra_free(asciimthd);
535
    ra_free(asciisig);
536
#endif
537
    return mthdid;
538
}
539
540
#ifdef __cplusplus
541
}
542
#endif

Return to bug 121658