sedna 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/{CHANGES → CHANGES.rdoc} +9 -0
  2. data/{README → README.rdoc} +23 -25
  3. data/Rakefile +32 -9
  4. data/ext/{extconf.rb → sedna/extconf.rb} +33 -21
  5. data/ext/{sedna.c → sedna/sedna.c} +48 -40
  6. data/test/sedna_test.rb +9 -9
  7. data/vendor/sedna/AUTHORS +18 -0
  8. data/vendor/sedna/COPYRIGHT +90 -0
  9. data/vendor/sedna/LICENSE +202 -0
  10. data/vendor/sedna/Makefile.include +423 -0
  11. data/vendor/sedna/Makefile.platform +31 -0
  12. data/vendor/sedna/depend.sed +48 -0
  13. data/vendor/sedna/driver/c/Makefile +98 -0
  14. data/vendor/sedna/driver/c/libsedna.c +1998 -0
  15. data/vendor/sedna/driver/c/libsedna.h +199 -0
  16. data/vendor/sedna/driver/c/sednamt.def +21 -0
  17. data/vendor/sedna/driver/c/sp_defs.h +186 -0
  18. data/vendor/sedna/kernel/common/FastXptrHash.cpp +101 -0
  19. data/vendor/sedna/kernel/common/IntHash.h +314 -0
  20. data/vendor/sedna/kernel/common/IntList.h +224 -0
  21. data/vendor/sedna/kernel/common/Makefile +30 -0
  22. data/vendor/sedna/kernel/common/SSMMsg.cpp +459 -0
  23. data/vendor/sedna/kernel/common/SSMMsg.h +142 -0
  24. data/vendor/sedna/kernel/common/XptrHash.h +435 -0
  25. data/vendor/sedna/kernel/common/argtable.c +972 -0
  26. data/vendor/sedna/kernel/common/argtable.h +896 -0
  27. data/vendor/sedna/kernel/common/base.cpp +339 -0
  28. data/vendor/sedna/kernel/common/base.h +226 -0
  29. data/vendor/sedna/kernel/common/bit_set.cpp +157 -0
  30. data/vendor/sedna/kernel/common/bit_set.h +55 -0
  31. data/vendor/sedna/kernel/common/commutil.h +67 -0
  32. data/vendor/sedna/kernel/common/config.h +62 -0
  33. data/vendor/sedna/kernel/common/counted_ptr.h +74 -0
  34. data/vendor/sedna/kernel/common/errdbg/ErrorCodes.java +1056 -0
  35. data/vendor/sedna/kernel/common/errdbg/Makefile +34 -0
  36. data/vendor/sedna/kernel/common/errdbg/assert.c +133 -0
  37. data/vendor/sedna/kernel/common/errdbg/d_printf.c +150 -0
  38. data/vendor/sedna/kernel/common/errdbg/d_printf.h +91 -0
  39. data/vendor/sedna/kernel/common/errdbg/error.codes +1743 -0
  40. data/vendor/sedna/kernel/common/errdbg/error_codes.c +531 -0
  41. data/vendor/sedna/kernel/common/errdbg/error_codes.h +549 -0
  42. data/vendor/sedna/kernel/common/errdbg/error_codes_scm.scm +527 -0
  43. data/vendor/sedna/kernel/common/errdbg/event_log.c +956 -0
  44. data/vendor/sedna/kernel/common/errdbg/event_log.h +226 -0
  45. data/vendor/sedna/kernel/common/errdbg/exceptions.cpp +155 -0
  46. data/vendor/sedna/kernel/common/errdbg/exceptions.h +559 -0
  47. data/vendor/sedna/kernel/common/errdbg/gen_error_codes +0 -0
  48. data/vendor/sedna/kernel/common/errdbg/gen_error_codes.c +345 -0
  49. data/vendor/sedna/kernel/common/gmm.cpp +192 -0
  50. data/vendor/sedna/kernel/common/gmm.h +29 -0
  51. data/vendor/sedna/kernel/common/ipc_ops.cpp +435 -0
  52. data/vendor/sedna/kernel/common/ipc_ops.h +51 -0
  53. data/vendor/sedna/kernel/common/lfsGlobals.h +12 -0
  54. data/vendor/sedna/kernel/common/lm_base.h +90 -0
  55. data/vendor/sedna/kernel/common/mmgr/Makefile +11 -0
  56. data/vendor/sedna/kernel/common/mmgr/aset.c +1185 -0
  57. data/vendor/sedna/kernel/common/mmgr/mcxt.c +741 -0
  58. data/vendor/sedna/kernel/common/mmgr/memnodes.h +70 -0
  59. data/vendor/sedna/kernel/common/mmgr/memutils.h +145 -0
  60. data/vendor/sedna/kernel/common/mmgr/se_alloc.h +321 -0
  61. data/vendor/sedna/kernel/common/mmgr/track.c +214 -0
  62. data/vendor/sedna/kernel/common/pping.cpp +672 -0
  63. data/vendor/sedna/kernel/common/pping.h +119 -0
  64. data/vendor/sedna/kernel/common/rcv_test.cpp +273 -0
  65. data/vendor/sedna/kernel/common/rcv_test.h +19 -0
  66. data/vendor/sedna/kernel/common/sedna.c +128 -0
  67. data/vendor/sedna/kernel/common/sedna.h +49 -0
  68. data/vendor/sedna/kernel/common/sedna_ef.h +52 -0
  69. data/vendor/sedna/kernel/common/sm_vmm_data.h +144 -0
  70. data/vendor/sedna/kernel/common/sp.c +93 -0
  71. data/vendor/sedna/kernel/common/sp.h +36 -0
  72. data/vendor/sedna/kernel/common/st/Makefile +20 -0
  73. data/vendor/sedna/kernel/common/st/os_linux/stacktrace.c +213 -0
  74. data/vendor/sedna/kernel/common/st/os_nt/stacktrace.c +338 -0
  75. data/vendor/sedna/kernel/common/st/os_other/stacktrace.c +39 -0
  76. data/vendor/sedna/kernel/common/st/stacktrace.h +72 -0
  77. data/vendor/sedna/kernel/common/st/stacktrfmt.c +64 -0
  78. data/vendor/sedna/kernel/common/tr_debug.cpp +112 -0
  79. data/vendor/sedna/kernel/common/tr_debug.h +22 -0
  80. data/vendor/sedna/kernel/common/u/Makefile +14 -0
  81. data/vendor/sedna/kernel/common/u/u.c +268 -0
  82. data/vendor/sedna/kernel/common/u/u.h +715 -0
  83. data/vendor/sedna/kernel/common/u/uatomic.h +12 -0
  84. data/vendor/sedna/kernel/common/u/udl.h +31 -0
  85. data/vendor/sedna/kernel/common/u/uevent.c +406 -0
  86. data/vendor/sedna/kernel/common/u/uevent.h +71 -0
  87. data/vendor/sedna/kernel/common/u/ugnames.cpp +330 -0
  88. data/vendor/sedna/kernel/common/u/ugnames.h +134 -0
  89. data/vendor/sedna/kernel/common/u/uhash_map.h +77 -0
  90. data/vendor/sedna/kernel/common/u/uhdd.c +1018 -0
  91. data/vendor/sedna/kernel/common/u/uhdd.h +206 -0
  92. data/vendor/sedna/kernel/common/u/ummap.cpp +268 -0
  93. data/vendor/sedna/kernel/common/u/ummap.h +60 -0
  94. data/vendor/sedna/kernel/common/u/umutex.c +145 -0
  95. data/vendor/sedna/kernel/common/u/umutex.h +65 -0
  96. data/vendor/sedna/kernel/common/u/upipe.cpp +244 -0
  97. data/vendor/sedna/kernel/common/u/upipe.h +74 -0
  98. data/vendor/sedna/kernel/common/u/uprocess.c +767 -0
  99. data/vendor/sedna/kernel/common/u/uprocess.h +91 -0
  100. data/vendor/sedna/kernel/common/u/usafesync.h +41 -0
  101. data/vendor/sedna/kernel/common/u/usecurity.c +150 -0
  102. data/vendor/sedna/kernel/common/u/usecurity.h +55 -0
  103. data/vendor/sedna/kernel/common/u/usem.c +891 -0
  104. data/vendor/sedna/kernel/common/u/usem.h +83 -0
  105. data/vendor/sedna/kernel/common/u/ushm.c +222 -0
  106. data/vendor/sedna/kernel/common/u/ushm.h +46 -0
  107. data/vendor/sedna/kernel/common/u/usocket.c +541 -0
  108. data/vendor/sedna/kernel/common/u/usocket.h +118 -0
  109. data/vendor/sedna/kernel/common/u/usystem.c +57 -0
  110. data/vendor/sedna/kernel/common/u/usystem.h +46 -0
  111. data/vendor/sedna/kernel/common/u/uthread.c +259 -0
  112. data/vendor/sedna/kernel/common/u/uthread.h +95 -0
  113. data/vendor/sedna/kernel/common/u/utime.c +65 -0
  114. data/vendor/sedna/kernel/common/u/utime.h +40 -0
  115. data/vendor/sedna/kernel/common/u/uutils.c +142 -0
  116. data/vendor/sedna/kernel/common/u/uutils.h +65 -0
  117. data/vendor/sedna/kernel/common/ugc.cpp +156 -0
  118. data/vendor/sedna/kernel/common/ugc.h +15 -0
  119. data/vendor/sedna/kernel/common/utils.cpp +156 -0
  120. data/vendor/sedna/kernel/common/utils.h +133 -0
  121. data/vendor/sedna/kernel/common/version.c +16 -0
  122. data/vendor/sedna/kernel/common/version.h +21 -0
  123. data/vendor/sedna/kernel/common/wustructures.h +18 -0
  124. data/vendor/sedna/kernel/common/wutypes.h +34 -0
  125. data/vendor/sedna/kernel/common/xptr.cpp +17 -0
  126. data/vendor/sedna/kernel/common/xptr.h +211 -0
  127. data/vendor/sedna/ver +1 -0
  128. metadata +142 -14
@@ -0,0 +1,29 @@
1
+ /*
2
+ * File: gmm.h
3
+ * Copyright (C) 2004 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
4
+ */
5
+
6
+
7
+ #ifndef _GMM_H
8
+ #define _GMM_H
9
+
10
+
11
+ #include "common/u/ummap.h"
12
+
13
+
14
+ void create_global_memory_mapping(int os_primitives_id_min_bound);
15
+
16
+ void release_global_memory_mapping();
17
+
18
+ void open_global_memory_mapping(int err_code);
19
+
20
+ void close_global_memory_mapping();
21
+
22
+ UMMap get_global_memory_mapping();
23
+
24
+ void get_vmm_region_values();
25
+
26
+ void set_vmm_region_values();
27
+
28
+
29
+ #endif
@@ -0,0 +1,435 @@
1
+ /*
2
+ * File: ipc_ops.cpp
3
+ * Copyright (C) 2004 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
4
+ */
5
+
6
+
7
+ #include <string>
8
+
9
+ #include "common/sedna.h"
10
+
11
+ #include "common/ipc_ops.h"
12
+ #include "common/base.h"
13
+ #include "common/utils.h"
14
+ #include "common/u/usocket.h"
15
+ #include "common/u/uhdd.h"
16
+ #include "common/u/uutils.h"
17
+ #include "common/errdbg/d_printf.h"
18
+ #include "expat/expat.h"
19
+
20
+
21
+ static std::string elem_content;
22
+ char* SEDNA_DATA;
23
+ void* sedna_gov_shm_ptr = NULL;
24
+ static UShMem gov_shm_service_dsc;
25
+
26
+ /******************************************************************************
27
+ Governor shared memory open/close
28
+ ******************************************************************************/
29
+
30
+
31
+ void
32
+ open_gov_shm()
33
+ {
34
+ if ( NULL == sedna_gov_shm_ptr )
35
+ {
36
+ if (0 != uOpenShMem(&gov_shm_service_dsc,
37
+ GOVERNOR_SHARED_MEMORY_NAME,
38
+ sizeof(gov_config_struct),
39
+ __sys_call_error))
40
+ throw USER_EXCEPTION2(SE4400, "Can't open governor shared memory"); /// SEDNA server is not running
41
+
42
+
43
+ sedna_gov_shm_ptr = uAttachShMem(gov_shm_service_dsc,
44
+ NULL,
45
+ sizeof(gov_config_struct),
46
+ __sys_call_error);
47
+
48
+ if (NULL == sedna_gov_shm_ptr)
49
+ throw USER_EXCEPTION2(SE4023, "Governor shared memory"); /// Can't attach to shared memory
50
+ }
51
+ }
52
+
53
+
54
+ int
55
+ close_gov_shm()
56
+ {
57
+ if ( NULL != sedna_gov_shm_ptr )
58
+ {
59
+ if ( 0 != uDettachShMem(gov_shm_service_dsc, sedna_gov_shm_ptr, __sys_call_error))
60
+ return -1;
61
+
62
+ if ( 0 != uCloseShMem(gov_shm_service_dsc, __sys_call_error))
63
+ return -1;
64
+ }
65
+
66
+ return 0;
67
+ }
68
+
69
+
70
+ /******************************************************************************
71
+ Governor communication mechanism
72
+ ******************************************************************************/
73
+
74
+
75
+ void send_command_to_gov(int port_number, int cmd)
76
+ {
77
+ USOCKET s;
78
+ int rc;
79
+ char *ptr;
80
+ __int32 tmp;
81
+
82
+ s = usocket(AF_INET, SOCK_STREAM, 0, __sys_call_error);
83
+
84
+ if (uconnect_tcp(s, port_number, "127.0.0.1", __sys_call_error) == 0)
85
+ {
86
+ tmp = htonl(cmd);
87
+ ptr = (char*) &(tmp);
88
+ rc = 0;
89
+ while(rc < 4)
90
+ {
91
+ rc += usend(s, ptr+rc, 4-rc, __sys_call_error);
92
+ }
93
+ rc = 0;
94
+ ptr = (char*) &(rc);
95
+ while(rc < 4)
96
+ {
97
+ rc += usend(s, ptr+rc, 4-rc, __sys_call_error);
98
+ }
99
+ ushutdown_close_socket(s, __sys_call_error);
100
+ }
101
+ else
102
+ d_printf2("SOCKET ERROR: %s\n",usocket_error_translator());
103
+ }
104
+
105
+
106
+ int get_db_id_by_name(gov_config_struct* cfg, const char* db_name)
107
+ {
108
+ for(int i=0; i< MAX_DBS_NUMBER; ++i)
109
+ {
110
+ if (strcmp(cfg->db_vars[i].db_name, db_name) == 0)
111
+ return i;
112
+ }
113
+
114
+ return -1;
115
+ }
116
+
117
+ int get_next_free_db_id(gov_config_struct* cfg)
118
+ {
119
+ for (int i=0; i< MAX_DBS_NUMBER; ++i)
120
+ {
121
+ if (cfg->db_vars[i].db_name[0] == '\0')
122
+ return i;
123
+ }
124
+
125
+ return -1;
126
+ }
127
+
128
+ void erase_database_cell_in_gov_shm(int db_id, gov_config_struct* cfg)
129
+ {
130
+ if (!cfg) return;
131
+ if (db_id >= MAX_DBS_NUMBER || db_id < 0) return;
132
+
133
+ memset(&(cfg->db_vars[db_id]), '\0', sizeof(gov_db_struct));
134
+ }
135
+
136
+
137
+ void fill_database_cell_in_gov_shm(gov_config_struct* cfg,
138
+ int db_id,
139
+ const char* db_name,
140
+ int bufs_num,
141
+ int max_trs_num,
142
+ double upd_crt,
143
+ int max_log_files,
144
+ int tmp_file_initial_size /* size in PAGES */)
145
+ {
146
+ strcpy(cfg->db_vars[db_id].db_name, db_name);
147
+ cfg->db_vars[db_id].is_stop = -1;
148
+ cfg->db_vars[db_id].sm_pid = -1;
149
+ cfg->db_vars[db_id].bufs_num = bufs_num;
150
+ cfg->db_vars[db_id].max_trs_num = max_trs_num;
151
+ cfg->db_vars[db_id].upd_crt = upd_crt;
152
+ cfg->db_vars[db_id].max_log_files = max_log_files;
153
+ cfg->db_vars[db_id].tmp_file_initial_size = tmp_file_initial_size;
154
+ }
155
+
156
+
157
+ /******************************************************************************
158
+ Parser for sednaconf file
159
+ ******************************************************************************/
160
+
161
+
162
+ static void startElement_gov_cfg(void *cfg, const char *name, const char **atts)
163
+ {
164
+ }
165
+
166
+ static void endElement_gov_cfg(void *cfg, const char *name)
167
+ {
168
+ if (strcmp(name, "sedna_data") == 0)
169
+ {
170
+ strcpy(((gov_header_struct*)cfg)->SEDNA_DATA, trim(elem_content).c_str());
171
+ }
172
+ if (strcmp(name, "listener_port") == 0)
173
+ {
174
+ ((gov_header_struct*)cfg)->lstnr_port_number = atoi(trim(elem_content).c_str());
175
+ }
176
+ if (strcmp(name, "ping_port") == 0)
177
+ {
178
+ ((gov_header_struct*)cfg)->ping_port_number = atoi(trim(elem_content).c_str());
179
+ }
180
+ if (strcmp(name, "os_primitives_id_min_bound") == 0)
181
+ {
182
+ ((gov_header_struct*)cfg)->os_primitives_id_min_bound = atoi(trim(elem_content).c_str());
183
+ }
184
+ if (strcmp(name, "event_log_level") == 0)
185
+ {
186
+ ((gov_header_struct*)cfg)->el_level = atoi(trim(elem_content).c_str());
187
+ }
188
+ if (strcmp(name, "keep_alive_timeout") == 0)
189
+ {
190
+ ((gov_header_struct*)cfg)->ka_timeout = atoi(trim(elem_content).c_str());
191
+ }
192
+ if (strcmp(name, "session_stack_depth") == 0)
193
+ {
194
+ ((gov_header_struct*)cfg)->pp_stack_depth = atoi(trim(elem_content).c_str());
195
+ }
196
+
197
+ elem_content = "";
198
+ }
199
+
200
+ static void characterData_gov_cfg(void *cfg, const XML_Char *s, int len)
201
+ {
202
+ elem_content.append(s, len);
203
+ }
204
+
205
+ static void parse_config_file(gov_header_struct* cfg, std::string& cfg_text)
206
+ {
207
+ XML_Parser parser = XML_ParserCreate (NULL);
208
+ XML_SetElementHandler (parser, startElement_gov_cfg, endElement_gov_cfg);
209
+ XML_SetCharacterDataHandler (parser, characterData_gov_cfg);
210
+ XML_SetUserData (parser, cfg);
211
+
212
+ int parse_res = XML_Parse (parser, cfg_text.c_str(), cfg_text.length(), 1);
213
+
214
+ if(parse_res == XML_STATUS_ERROR)
215
+ throw USER_EXCEPTION2(SE4201, "sednaconf.xml");
216
+
217
+ XML_ParserFree(parser);
218
+ }
219
+
220
+
221
+ /******************************************************************************
222
+ Retrieve system config parameters
223
+ ******************************************************************************/
224
+
225
+
226
+ void get_sednaconf_values(gov_header_struct* cfg)
227
+ {
228
+ char sedna_cfg_file[U_MAX_PATH + 30];
229
+ char proc_buf[U_MAX_PATH + 1];
230
+
231
+ FILE* fs;
232
+ char buf[1024];
233
+ int size;
234
+ std::string cfg_text;
235
+ cfg_text.reserve(10240);
236
+
237
+ uGetImageProcPath(proc_buf, __sys_call_error);
238
+ if (proc_buf[0] == '\0')
239
+ throw USER_EXCEPTION(SE4081);
240
+
241
+ cfg->is_server_stop = SE_STOP_NO;
242
+ cfg->lstnr_port_number = 5050;
243
+ cfg->ping_port_number = 5151;
244
+ cfg->os_primitives_id_min_bound = 1500;
245
+ cfg->el_level = 3;
246
+ cfg->ka_timeout = 0;
247
+ cfg->pp_stack_depth = 5000;
248
+
249
+ strcpy(cfg->SEDNA_DATA, proc_buf);
250
+ strcpy(sedna_cfg_file, proc_buf);
251
+
252
+ #ifdef _WIN32
253
+ strcat(cfg->SEDNA_DATA, "\\..");
254
+ strcat(sedna_cfg_file, "\\..\\etc\\sednaconf.xml");
255
+ #else
256
+ strcat(cfg->SEDNA_DATA, "/..");
257
+ strcat(sedna_cfg_file, "/../etc/sednaconf.xml");
258
+ #endif
259
+
260
+ fs = fopen(sedna_cfg_file, "r");
261
+
262
+ #ifndef _WIN32
263
+ if(NULL == fs)
264
+ {
265
+ strcpy(sedna_cfg_file, "/etc/sednaconf.xml");
266
+ fs = fopen(sedna_cfg_file, "r");
267
+ }
268
+ #endif /* _WIN32 */
269
+
270
+ if (fs != NULL)
271
+ {
272
+ d_printf2("sedna_cfg_file=%s\n", sedna_cfg_file);
273
+
274
+ while (true)
275
+ {
276
+ size = fread(buf, sizeof(char), 1024, fs);
277
+ if (ferror(fs)) throw USER_EXCEPTION2(SE4044, sedna_cfg_file);
278
+ cfg_text.append(buf, size);
279
+ if (feof(fs)) break;
280
+ }
281
+
282
+ fclose(fs);
283
+ parse_config_file(cfg, cfg_text);
284
+ }
285
+ }
286
+
287
+
288
+ /***************************************************************************
289
+ Helper to retrieve sedna data path
290
+ ****************************************************************************/
291
+
292
+
293
+ /*
294
+ The following methods fulfill given buffer with the sedna_data path.
295
+ They MUST not throw exception and should use fprintf(stderr, " ... ") to
296
+ log out error message.
297
+ The reason why we need this method is sedna soft fault mechanism, which
298
+ can be triggred at the very begining of any sedna process when
299
+ SEDNA_DATA variable is not set.
300
+ */
301
+
302
+
303
+ static void get_sedna_data_path(const char* cfg_text, char* buf)
304
+ {
305
+ const char* beg, *fin;
306
+ const char* sedna_data_open_tag = "<sedna_data>";
307
+ const char* sedna_data_close_tag = "</sedna_data>";
308
+ unsigned short value_shift = strlen(sedna_data_open_tag);
309
+ std::string save_buf(buf);
310
+
311
+ beg = strstr(cfg_text, sedna_data_open_tag);
312
+ fin = strstr(cfg_text, sedna_data_close_tag);
313
+
314
+ d_printf2("cfg_text=%s\n", cfg_text);
315
+ if (beg == NULL || fin == NULL) return;
316
+
317
+ memcpy(buf, beg + value_shift, (int)fin-((int)beg + value_shift));
318
+ buf[(int)fin-((int)beg + value_shift)] = '\0';
319
+
320
+ std::string tmp(buf);
321
+ tmp = trim(tmp);
322
+
323
+ if(tmp.length() > U_MAX_PATH)
324
+ {
325
+ fprintf(stderr, "Path in the 'sedna_data' parameter is too long in sednaconf.xml. Going to use default value.\n");
326
+ strcpy(buf, save_buf.c_str());
327
+ }
328
+ else
329
+ strcpy(buf, tmp.c_str());
330
+ }
331
+
332
+ int set_sedna_data(char* sd_buf, sys_call_error_fun fun)
333
+ {
334
+ char proc_buf[U_MAX_PATH + 1];
335
+ char sedna_cfg_file[U_MAX_PATH + 1];
336
+ FILE* fs;
337
+ char buf[1024];
338
+ int size;
339
+ std::string cfg_text;
340
+ cfg_text.reserve(10240);
341
+
342
+ uGetImageProcPath(proc_buf, fun);
343
+ if (proc_buf[0] == '\0')
344
+ { fprintf(stderr, "Can't get process path to set sedna data\n");
345
+ return 0;
346
+ }
347
+
348
+ strcpy(sd_buf, proc_buf); /// Copy default SEDNA_DATA value
349
+ strcpy(sedna_cfg_file, proc_buf);
350
+
351
+ #ifdef _WIN32
352
+ strcat(sd_buf, "\\..");
353
+ strcat(sedna_cfg_file, "\\..\\etc\\sednaconf.xml");
354
+ #else
355
+ strcat(sd_buf, "/..");
356
+ strcat(sedna_cfg_file, "/../etc/sednaconf.xml");
357
+ #endif
358
+
359
+ fs = fopen(sedna_cfg_file, "r");
360
+
361
+ #ifndef _WIN32
362
+ if(NULL == fs)
363
+ {
364
+ strcpy(sedna_cfg_file, "/etc/sednaconf.xml");
365
+ fs = fopen(sedna_cfg_file, "r");
366
+ }
367
+ #endif /* _WIN32 */
368
+
369
+ if (fs != NULL)
370
+ {
371
+ d_printf2("sedna_cfg_file=%s\n", sedna_cfg_file);
372
+ while (true)
373
+ {
374
+ size = fread(buf, sizeof(char), 1024, fs);
375
+ if (ferror(fs))
376
+ {
377
+ fclose(fs);
378
+ fprintf(stderr, "Can't read sednaconf.xml to set sedna data path. Going to use default value.\n");
379
+ return 1;
380
+ }
381
+ cfg_text.append(buf, size);
382
+ if (feof(fs)) break;
383
+ }
384
+ fclose(fs);
385
+
386
+ get_sedna_data_path(cfg_text.c_str(), sd_buf);
387
+ }
388
+
389
+ d_printf2("sedna data path retrieved=%s\n", sd_buf);
390
+
391
+ return 1;
392
+ }
393
+
394
+
395
+ /***************************************************************************
396
+ Legacy && Old Code
397
+ ****************************************************************************/
398
+
399
+
400
+ /*int WriteHead(UPIPE p, int *cmd, int *len)
401
+ {
402
+ int res = uWritePipeAll(p, cmd, sizeof(int), __sys_call_error);
403
+ if(res < 0)
404
+ {
405
+ d_printf1("Pipe error\n");
406
+ return -1;
407
+ }
408
+
409
+ res = uWritePipeAll(p, len, sizeof(int), __sys_call_error);
410
+ if(res < 0)
411
+ {
412
+ d_printf1("Pipe error\n");
413
+ return -1;
414
+ }
415
+ return 0;
416
+ }
417
+
418
+ int ReadHead(UPIPE p, int *cmd, int *len)
419
+ {
420
+ int res = uReadPipeAll(p, cmd, sizeof(int), __sys_call_error);
421
+ if (res < 0)
422
+ {
423
+ d_printf1("Pipe error\n");
424
+ return -1;
425
+ }
426
+
427
+ res = uReadPipeAll(p, len, sizeof(int), __sys_call_error);
428
+ if (res < 0)
429
+ {
430
+ d_printf1("Pipe error\n");
431
+ return -1;
432
+ }
433
+
434
+ return 0;
435
+ }*/