aboutsummaryrefslogtreecommitdiff
path: root/src/main/extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/extractor.c')
-rw-r--r--src/main/extractor.c532
1 files changed, 267 insertions, 265 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c
index 3755da9..cb64b95 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -71,9 +71,9 @@ struct PluginReplyProcessor
71 */ 71 */
72static void 72static void
73send_update_message (struct EXTRACTOR_PluginList *plugin, 73send_update_message (struct EXTRACTOR_PluginList *plugin,
74 int64_t shm_off, 74 int64_t shm_off,
75 size_t data_available, 75 size_t data_available,
76 struct EXTRACTOR_Datasource *ds) 76 struct EXTRACTOR_Datasource *ds)
77{ 77{
78 struct UpdateMessage um; 78 struct UpdateMessage um;
79 79
@@ -85,14 +85,14 @@ send_update_message (struct EXTRACTOR_PluginList *plugin,
85 um.file_size = EXTRACTOR_datasource_get_size_ (ds, 0); 85 um.file_size = EXTRACTOR_datasource_get_size_ (ds, 0);
86 if (sizeof (um) != 86 if (sizeof (um) !=
87 EXTRACTOR_IPC_channel_send_ (plugin->channel, 87 EXTRACTOR_IPC_channel_send_ (plugin->channel,
88 &um, 88 &um,
89 sizeof (um)) ) 89 sizeof (um)) )
90 { 90 {
91 LOG ("Failed to send UPDATED_SHM message to plugin\n"); 91 LOG ("Failed to send UPDATED_SHM message to plugin\n");
92 EXTRACTOR_IPC_channel_destroy_ (plugin->channel); 92 EXTRACTOR_IPC_channel_destroy_ (plugin->channel);
93 plugin->channel = NULL; 93 plugin->channel = NULL;
94 plugin->round_finished = 1; 94 plugin->round_finished = 1;
95 } 95 }
96} 96}
97 97
98 98
@@ -109,14 +109,14 @@ send_discard_message (struct EXTRACTOR_PluginList *plugin)
109 109
110 if (sizeof (disc_msg) != 110 if (sizeof (disc_msg) !=
111 EXTRACTOR_IPC_channel_send_ (plugin->channel, 111 EXTRACTOR_IPC_channel_send_ (plugin->channel,
112 &disc_msg, 112 &disc_msg,
113 sizeof (disc_msg)) ) 113 sizeof (disc_msg)) )
114 { 114 {
115 LOG ("Failed to send DISCARD_STATE message to plugin\n"); 115 LOG ("Failed to send DISCARD_STATE message to plugin\n");
116 EXTRACTOR_IPC_channel_destroy_ (plugin->channel); 116 EXTRACTOR_IPC_channel_destroy_ (plugin->channel);
117 plugin->channel = NULL; 117 plugin->channel = NULL;
118 plugin->round_finished = 1; 118 plugin->round_finished = 1;
119 } 119 }
120} 120}
121 121
122 122
@@ -131,12 +131,12 @@ abort_all_channels (struct EXTRACTOR_PluginList *plugins)
131 struct EXTRACTOR_PluginList *pos; 131 struct EXTRACTOR_PluginList *pos;
132 132
133 for (pos = plugins; NULL != pos; pos = pos->next) 133 for (pos = plugins; NULL != pos; pos = pos->next)
134 { 134 {
135 if (NULL == pos->channel) 135 if (NULL == pos->channel)
136 continue; 136 continue;
137 EXTRACTOR_IPC_channel_destroy_ (pos->channel); 137 EXTRACTOR_IPC_channel_destroy_ (pos->channel);
138 pos->channel = NULL; 138 pos->channel = NULL;
139 } 139 }
140} 140}
141 141
142 142
@@ -153,46 +153,46 @@ abort_all_channels (struct EXTRACTOR_PluginList *plugins)
153 */ 153 */
154static void 154static void
155process_plugin_reply (void *cls, 155process_plugin_reply (void *cls,
156 struct EXTRACTOR_PluginList *plugin, 156 struct EXTRACTOR_PluginList *plugin,
157 enum EXTRACTOR_MetaType meta_type, 157 enum EXTRACTOR_MetaType meta_type,
158 enum EXTRACTOR_MetaFormat meta_format, 158 enum EXTRACTOR_MetaFormat meta_format,
159 const char *mime, 159 const char *mime,
160 const void *value, 160 const void *value,
161 size_t value_len) 161 size_t value_len)
162{ 162{
163 static unsigned char cont_msg = MESSAGE_CONTINUE_EXTRACTING; 163 static unsigned char cont_msg = MESSAGE_CONTINUE_EXTRACTING;
164 struct PluginReplyProcessor *prp = cls; 164 struct PluginReplyProcessor *prp = cls;
165 165
166 if (0 != prp->file_finished) 166 if (0 != prp->file_finished)
167 { 167 {
168 /* client already aborted, ignore message, tell plugin about abort */ 168 /* client already aborted, ignore message, tell plugin about abort */
169 return; 169 return;
170 } 170 }
171 if (0 != prp->proc (prp->proc_cls, 171 if (0 != prp->proc (prp->proc_cls,
172 plugin->short_libname, 172 plugin->short_libname,
173 meta_type, 173 meta_type,
174 meta_format, 174 meta_format,
175 mime, 175 mime,
176 value, 176 value,
177 value_len)) 177 value_len))
178 { 178 {
179 prp->file_finished = 1; 179 prp->file_finished = 1;
180#if DEBUG 180#if DEBUG
181 fprintf (stderr, "Sending ABRT\n"); 181 fprintf (stderr, "Sending ABRT\n");
182#endif 182#endif
183 send_discard_message (plugin); 183 send_discard_message (plugin);
184 return; 184 return;
185 } 185 }
186 if (sizeof (cont_msg) != 186 if (sizeof (cont_msg) !=
187 EXTRACTOR_IPC_channel_send_ (plugin->channel, 187 EXTRACTOR_IPC_channel_send_ (plugin->channel,
188 &cont_msg, 188 &cont_msg,
189 sizeof (cont_msg)) ) 189 sizeof (cont_msg)) )
190 { 190 {
191 LOG ("Failed to send CONTINUE_EXTRACTING message to plugin\n"); 191 LOG ("Failed to send CONTINUE_EXTRACTING message to plugin\n");
192 EXTRACTOR_IPC_channel_destroy_ (plugin->channel); 192 EXTRACTOR_IPC_channel_destroy_ (plugin->channel);
193 plugin->channel = NULL; 193 plugin->channel = NULL;
194 plugin->round_finished = 1; 194 plugin->round_finished = 1;
195 } 195 }
196} 196}
197 197
198 198
@@ -245,8 +245,8 @@ struct InProcessContext
245 */ 245 */
246static ssize_t 246static ssize_t
247in_process_read (void *cls, 247in_process_read (void *cls,
248 void **data, 248 void **data,
249 size_t size) 249 size_t size)
250{ 250{
251 struct InProcessContext *ctx = cls; 251 struct InProcessContext *ctx = cls;
252 ssize_t ret; 252 ssize_t ret;
@@ -256,8 +256,8 @@ in_process_read (void *cls,
256 if (size < bsize) 256 if (size < bsize)
257 bsize = size; 257 bsize = size;
258 ret = EXTRACTOR_datasource_read_ (ctx->ds, 258 ret = EXTRACTOR_datasource_read_ (ctx->ds,
259 ctx->buf, 259 ctx->buf,
260 bsize); 260 bsize);
261 if (-1 == ret) 261 if (-1 == ret)
262 *data = NULL; 262 *data = NULL;
263 else 263 else
@@ -279,14 +279,14 @@ in_process_read (void *cls,
279 */ 279 */
280static int64_t 280static int64_t
281in_process_seek (void *cls, 281in_process_seek (void *cls,
282 int64_t pos, 282 int64_t pos,
283 int whence) 283 int whence)
284{ 284{
285 struct InProcessContext *ctx = cls; 285 struct InProcessContext *ctx = cls;
286 286
287 return EXTRACTOR_datasource_seek_ (ctx->ds, 287 return EXTRACTOR_datasource_seek_ (ctx->ds,
288 pos, 288 pos,
289 whence); 289 whence);
290} 290}
291 291
292 292
@@ -326,12 +326,12 @@ in_process_get_size (void *cls)
326 */ 326 */
327static int 327static int
328in_process_proc (void *cls, 328in_process_proc (void *cls,
329 const char *plugin_name, 329 const char *plugin_name,
330 enum EXTRACTOR_MetaType type, 330 enum EXTRACTOR_MetaType type,
331 enum EXTRACTOR_MetaFormat format, 331 enum EXTRACTOR_MetaFormat format,
332 const char *data_mime_type, 332 const char *data_mime_type,
333 const char *data, 333 const char *data,
334 size_t data_len) 334 size_t data_len)
335{ 335{
336 struct InProcessContext *ctx = cls; 336 struct InProcessContext *ctx = cls;
337 int ret; 337 int ret;
@@ -339,12 +339,12 @@ in_process_proc (void *cls,
339 if (0 != ctx->finished) 339 if (0 != ctx->finished)
340 return 1; 340 return 1;
341 ret = ctx->proc (ctx->proc_cls, 341 ret = ctx->proc (ctx->proc_cls,
342 plugin_name, 342 plugin_name,
343 type, 343 type,
344 format, 344 format,
345 data_mime_type, 345 data_mime_type,
346 data, 346 data,
347 data_len); 347 data_len);
348 if (0 != ret) 348 if (0 != ret)
349 ctx->finished = 1; 349 ctx->finished = 1;
350 return ret; 350 return ret;
@@ -363,9 +363,9 @@ in_process_proc (void *cls,
363 */ 363 */
364static void 364static void
365do_extract (struct EXTRACTOR_PluginList *plugins, 365do_extract (struct EXTRACTOR_PluginList *plugins,
366 struct EXTRACTOR_SharedMemory *shm, 366 struct EXTRACTOR_SharedMemory *shm,
367 struct EXTRACTOR_Datasource *ds, 367 struct EXTRACTOR_Datasource *ds,
368 EXTRACTOR_MetaDataProcessor proc, void *proc_cls) 368 EXTRACTOR_MetaDataProcessor proc, void *proc_cls)
369{ 369{
370 unsigned int plugin_count; 370 unsigned int plugin_count;
371 unsigned int plugin_off; 371 unsigned int plugin_off;
@@ -406,153 +406,153 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
406 start.shm_ready_bytes = (uint32_t) ready; 406 start.shm_ready_bytes = (uint32_t) ready;
407 start.file_size = EXTRACTOR_datasource_get_size_ (ds, 0); 407 start.file_size = EXTRACTOR_datasource_get_size_ (ds, 0);
408 for (pos = plugins; NULL != pos; pos = pos->next) 408 for (pos = plugins; NULL != pos; pos = pos->next)
409 {
410 if (EXTRACTOR_OPTION_IN_PROCESS == pos->flags)
411 have_in_memory = 1;
412 if ( (NULL != pos->channel) &&
413 (-1 == EXTRACTOR_IPC_channel_send_ (pos->channel,
414 &start,
415 sizeof (start)) ) )
409 { 416 {
410 if (EXTRACTOR_OPTION_IN_PROCESS == pos->flags) 417 LOG ("Failed to send EXTRACT_START message to plugin\n");
411 have_in_memory = 1; 418 EXTRACTOR_IPC_channel_destroy_ (pos->channel);
412 if ( (NULL != pos->channel) && 419 pos->channel = NULL;
413 (-1 == EXTRACTOR_IPC_channel_send_ (pos->channel,
414 &start,
415 sizeof (start)) ) )
416 {
417 LOG ("Failed to send EXTRACT_START message to plugin\n");
418 EXTRACTOR_IPC_channel_destroy_ (pos->channel);
419 pos->channel = NULL;
420 }
421 } 420 }
421 }
422 if (-1 == ready) 422 if (-1 == ready)
423 { 423 {
424 LOG ("Failed to initialize IPC shared memory, cannot extract\n"); 424 LOG ("Failed to initialize IPC shared memory, cannot extract\n");
425 done = 1; 425 done = 1;
426 } 426 }
427 else 427 else
428 done = 0; 428 done = 0;
429 while (! done) 429 while (! done)
430 {
431 struct EXTRACTOR_Channel *channels[plugin_count];
432
433 /* calculate current 'channels' array */
434 plugin_off = 0;
435 for (pos = plugins; NULL != pos; pos = pos->next)
430 { 436 {
431 struct EXTRACTOR_Channel *channels[plugin_count]; 437 if (-1 == pos->seek_request)
432 438 {
433 /* calculate current 'channels' array */ 439 /* channel is not seeking, must be running or done */
434 plugin_off = 0; 440 channels[plugin_off] = pos->channel;
435 for (pos = plugins; NULL != pos; pos = pos->next) 441 }
436 { 442 else
437 if (-1 == pos->seek_request) 443 {
438 { 444 /* not running this round, seeking! */
439 /* channel is not seeking, must be running or done */ 445 channels[plugin_off] = NULL;
440 channels[plugin_off] = pos->channel; 446 }
441 } 447 plugin_off++;
442 else 448 }
443 { 449 /* give plugins chance to send us meta data, seek or finished messages */
444 /* not running this round, seeking! */ 450 if (-1 ==
445 channels[plugin_off] = NULL; 451 EXTRACTOR_IPC_channel_recv_ (channels,
446 } 452 plugin_count,
447 plugin_off++; 453 &process_plugin_reply,
448 } 454 &prp))
449 /* give plugins chance to send us meta data, seek or finished messages */ 455 {
450 if (-1 == 456 /* serious problem in IPC; reset *all* channels */
451 EXTRACTOR_IPC_channel_recv_ (channels, 457 LOG ("Failed to receive message from channels; full reset\n");
452 plugin_count, 458 abort_all_channels (plugins);
453 &process_plugin_reply, 459 break;
454 &prp)) 460 }
455 { 461
456 /* serious problem in IPC; reset *all* channels */ 462 /* calculate minimum seek request (or set done=0 to continue here) */
457 LOG ("Failed to receive message from channels; full reset\n"); 463 done = 1;
458 abort_all_channels (plugins); 464 min_seek = -1;
459 break; 465 plugin_off = 0;
460 } 466 for (pos = plugins; NULL != pos; pos = pos->next)
461 467 {
462 /* calculate minimum seek request (or set done=0 to continue here) */ 468 plugin_off++;
463 done = 1; 469 if ( (1 == pos->round_finished) ||
464 min_seek = -1; 470 (NULL == pos->channel) )
465 plugin_off = 0; 471 {
466 for (pos = plugins; NULL != pos; pos = pos->next) 472 continue; /* inactive plugin */
467 { 473 }
468 plugin_off++; 474 if (-1 == pos->seek_request)
469 if ( (1 == pos->round_finished) || 475 {
470 (NULL == pos->channel) ) 476 /* possibly more meta data at current position, at least
477 this plugin is still working on it... */
478 done = 0;
479 break;
480 }
481 if (-1 != pos->seek_request)
482 {
483 if (SEEK_END == pos->seek_whence)
484 {
485 /* convert distance from end to absolute position */
486 pos->seek_whence = 0;
487 end = EXTRACTOR_datasource_get_size_ (ds, 1);
488 if (pos->seek_request > end)
471 { 489 {
472 continue; /* inactive plugin */ 490 LOG ("Cannot seek to before the beginning of the file!\n");
491 pos->seek_request = 0;
473 } 492 }
474 if (-1 == pos->seek_request) 493 else
475 { 494 {
476 /* possibly more meta data at current position, at least 495 pos->seek_request = end - pos->seek_request;
477 this plugin is still working on it... */ 496 }
478 done = 0; 497 }
479 break; 498 if ( (-1 == min_seek) ||
480 } 499 (min_seek > pos->seek_request) )
481 if (-1 != pos->seek_request) 500 {
482 { 501 min_seek = pos->seek_request;
483 if (SEEK_END == pos->seek_whence) 502 }
484 { 503 }
485 /* convert distance from end to absolute position */ 504 }
486 pos->seek_whence = 0; 505 data_available = -1;
487 end = EXTRACTOR_datasource_get_size_ (ds, 1); 506 if ( (1 == done) &&
488 if (pos->seek_request > end) 507 (-1 != min_seek) &&
489 { 508 (NULL != shm) )
490 LOG ("Cannot seek to before the beginning of the file!\n"); 509 {
491 pos->seek_request = 0; 510 /* current position done, but seek requested */
492 } 511 done = 0;
493 else 512 if (-1 ==
494 { 513 (data_available = EXTRACTOR_IPC_shared_memory_set_ (shm,
495 pos->seek_request = end - pos->seek_request; 514 ds,
496 } 515 min_seek,
497 } 516 DEFAULT_SHM_SIZE)))
498 if ( (-1 == min_seek) || 517 {
499 (min_seek > pos->seek_request) ) 518 LOG ("Failed to seek; full reset\n");
500 { 519 abort_all_channels (plugins);
501 min_seek = pos->seek_request; 520 break;
502 } 521 }
503 } 522 }
504 } 523 /* if 'prp.file_finished', send 'abort' to plugins;
505 data_available = -1; 524 if not, send 'seek' notification to plugins in range */
506 if ( (1 == done) && 525 for (pos = plugins; NULL != pos; pos = pos->next)
507 (-1 != min_seek) && 526 {
508 (NULL != shm) ) 527 if (NULL == (channel = pos->channel))
509 { 528 {
510 /* current position done, but seek requested */ 529 /* Skipping plugin: channel down */
511 done = 0; 530 continue;
512 if (-1 == 531 }
513 (data_available = EXTRACTOR_IPC_shared_memory_set_ (shm, 532 if ( (-1 != pos->seek_request) &&
514 ds, 533 (1 == prp.file_finished) )
515 min_seek, 534 {
516 DEFAULT_SHM_SIZE))) 535 send_discard_message (pos);
517 { 536 pos->round_finished = 1;
518 LOG ("Failed to seek; full reset\n"); 537 pos->seek_request = -1;
519 abort_all_channels (plugins); 538 }
520 break; 539 if ( (-1 != data_available) &&
521 } 540 (-1 != pos->seek_request) &&
522 } 541 (min_seek <= pos->seek_request) &&
523 /* if 'prp.file_finished', send 'abort' to plugins; 542 ( (min_seek + data_available > pos->seek_request) ||
524 if not, send 'seek' notification to plugins in range */ 543 (min_seek == EXTRACTOR_datasource_get_size_ (ds, 0))) )
525 for (pos = plugins; NULL != pos; pos = pos->next) 544 {
526 { 545 /* Notify plugin about seek to 'min_seek' */
527 if (NULL == (channel = pos->channel)) 546 send_update_message (pos,
528 { 547 min_seek,
529 /* Skipping plugin: channel down */ 548 data_available,
530 continue; 549 ds);
531 } 550 pos->seek_request = -1;
532 if ( (-1 != pos->seek_request) && 551 }
533 (1 == prp.file_finished) ) 552 if (0 == pos->round_finished)
534 { 553 done = 0; /* can't be done, plugin still active */
535 send_discard_message (pos);
536 pos->round_finished = 1;
537 pos->seek_request = -1;
538 }
539 if ( (-1 != data_available) &&
540 (-1 != pos->seek_request) &&
541 (min_seek <= pos->seek_request) &&
542 ( (min_seek + data_available > pos->seek_request) ||
543 (min_seek == EXTRACTOR_datasource_get_size_ (ds, 0))) )
544 {
545 /* Notify plugin about seek to 'min_seek' */
546 send_update_message (pos,
547 min_seek,
548 data_available,
549 ds);
550 pos->seek_request = -1;
551 }
552 if (0 == pos->round_finished)
553 done = 0; /* can't be done, plugin still active */
554 }
555 } 554 }
555 }
556 556
557 if (0 == have_in_memory) 557 if (0 == have_in_memory)
558 return; 558 return;
@@ -567,22 +567,22 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
567 ec.get_size = &in_process_get_size; 567 ec.get_size = &in_process_get_size;
568 ec.proc = &in_process_proc; 568 ec.proc = &in_process_proc;
569 for (pos = plugins; NULL != pos; pos = pos->next) 569 for (pos = plugins; NULL != pos; pos = pos->next)
570 {
571 if (EXTRACTOR_OPTION_IN_PROCESS != pos->flags)
572 continue;
573 if (-1 == EXTRACTOR_plugin_load_ (pos))
574 continue;
575 ctx.plugin = pos;
576 ec.config = pos->plugin_options;
577 if (-1 == EXTRACTOR_datasource_seek_ (ds, 0, SEEK_SET))
570 { 578 {
571 if (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) 579 LOG ("Failed to seek to 0 for in-memory plugins\n");
572 continue; 580 return;
573 if (-1 == EXTRACTOR_plugin_load_ (pos))
574 continue;
575 ctx.plugin = pos;
576 ec.config = pos->plugin_options;
577 if (-1 == EXTRACTOR_datasource_seek_ (ds, 0, SEEK_SET))
578 {
579 LOG ("Failed to seek to 0 for in-memory plugins\n");
580 return;
581 }
582 pos->extract_method (&ec);
583 if (1 == ctx.finished)
584 break;
585 } 581 }
582 pos->extract_method (&ec);
583 if (1 == ctx.finished)
584 break;
585 }
586} 586}
587 587
588 588
@@ -602,11 +602,11 @@ do_extract (struct EXTRACTOR_PluginList *plugins,
602 */ 602 */
603void 603void
604EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins, 604EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
605 const char *filename, 605 const char *filename,
606 const void *data, 606 const void *data,
607 size_t size, 607 size_t size,
608 EXTRACTOR_MetaDataProcessor proc, 608 EXTRACTOR_MetaDataProcessor proc,
609 void *proc_cls) 609 void *proc_cls)
610{ 610{
611 struct EXTRACTOR_Datasource *datasource; 611 struct EXTRACTOR_Datasource *datasource;
612 struct EXTRACTOR_SharedMemory *shm; 612 struct EXTRACTOR_SharedMemory *shm;
@@ -617,47 +617,47 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
617 return; 617 return;
618 if (NULL == filename) 618 if (NULL == filename)
619 datasource = EXTRACTOR_datasource_create_from_buffer_ (data, size, 619 datasource = EXTRACTOR_datasource_create_from_buffer_ (data, size,
620 proc, proc_cls); 620 proc, proc_cls);
621 else 621 else
622 datasource = EXTRACTOR_datasource_create_from_file_ (filename, 622 datasource = EXTRACTOR_datasource_create_from_file_ (filename,
623 proc, proc_cls); 623 proc, proc_cls);
624 if (NULL == datasource) 624 if (NULL == datasource)
625 return; 625 return;
626 shm = NULL; 626 shm = NULL;
627 have_oop = 0; 627 have_oop = 0;
628 for (pos = plugins; NULL != pos; pos = pos->next) 628 for (pos = plugins; NULL != pos; pos = pos->next)
629 { 629 {
630 if (NULL == shm) 630 if (NULL == shm)
631 shm = pos->shm; 631 shm = pos->shm;
632 if (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) 632 if (EXTRACTOR_OPTION_IN_PROCESS != pos->flags)
633 have_oop = 1; 633 have_oop = 1;
634 pos->round_finished = 0; 634 pos->round_finished = 0;
635 } 635 }
636 if ( (NULL == shm) && 636 if ( (NULL == shm) &&
637 (1 == have_oop) ) 637 (1 == have_oop) )
638 {
639 /* need to create shared memory segment */
640 shm = EXTRACTOR_IPC_shared_memory_create_ (DEFAULT_SHM_SIZE);
641 if (NULL == shm)
638 { 642 {
639 /* need to create shared memory segment */ 643 LOG ("Failed to setup IPC\n");
640 shm = EXTRACTOR_IPC_shared_memory_create_ (DEFAULT_SHM_SIZE); 644 EXTRACTOR_datasource_destroy_ (datasource);
641 if (NULL == shm) 645 return;
642 {
643 LOG ("Failed to setup IPC\n");
644 EXTRACTOR_datasource_destroy_ (datasource);
645 return;
646 }
647 } 646 }
647 }
648 for (pos = plugins; NULL != pos; pos = pos->next) 648 for (pos = plugins; NULL != pos; pos = pos->next)
649 if ( (NULL == pos->channel) && 649 if ( (NULL == pos->channel) &&
650 (NULL != shm) && 650 (NULL != shm) &&
651 (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) ) 651 (EXTRACTOR_OPTION_IN_PROCESS != pos->flags) )
652 {
653 if (NULL == pos->shm)
652 { 654 {
653 if (NULL == pos->shm) 655 pos->shm = shm;
654 { 656 (void) EXTRACTOR_IPC_shared_memory_change_rc_ (shm, 1);
655 pos->shm = shm;
656 (void) EXTRACTOR_IPC_shared_memory_change_rc_ (shm, 1);
657 }
658 pos->channel = EXTRACTOR_IPC_channel_create_ (pos,
659 shm);
660 } 657 }
658 pos->channel = EXTRACTOR_IPC_channel_create_ (pos,
659 shm);
660 }
661 do_extract (plugins, 661 do_extract (plugins,
662 shm, 662 shm,
663 datasource, 663 datasource,
@@ -680,14 +680,14 @@ EXTRACTOR_ltdl_init ()
680#endif 680#endif
681 err = lt_dlinit (); 681 err = lt_dlinit ();
682 if (err > 0) 682 if (err > 0)
683 { 683 {
684#if DEBUG 684#if DEBUG
685 fprintf (stderr, 685 fprintf (stderr,
686 _("Initialization of plugin mechanism failed: %s!\n"), 686 _ ("Initialization of plugin mechanism failed: %s!\n"),
687 lt_dlerror ()); 687 lt_dlerror ());
688#endif 688#endif
689 return; 689 return;
690 } 690 }
691#if WINDOWS 691#if WINDOWS
692 plibc_init_utf8 ("GNU", PACKAGE, 1); 692 plibc_init_utf8 ("GNU", PACKAGE, 1);
693 plibc_set_stat_size_size (sizeof (((struct stat *) 0)->st_size)); 693 plibc_set_stat_size_size (sizeof (((struct stat *) 0)->st_size));
@@ -700,11 +700,13 @@ EXTRACTOR_ltdl_init ()
700 * Deinit. 700 * Deinit.
701 */ 701 */
702void __attribute__ ((destructor)) 702void __attribute__ ((destructor))
703EXTRACTOR_ltdl_fini () { 703EXTRACTOR_ltdl_fini ()
704{
704#if WINDOWS 705#if WINDOWS
705 plibc_shutdown (); 706 plibc_shutdown ();
706#endif 707#endif
707 lt_dlexit (); 708 lt_dlexit ();
708} 709}
709 710
711
710/* end of extractor.c */ 712/* end of extractor.c */