summaryrefslogtreecommitdiff
path: root/src/analysis/scan/scanner.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/scanner.c')
-rw-r--r--src/analysis/scan/scanner.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/src/analysis/scan/scanner.c b/src/analysis/scan/scanner.c
index 1f90393..507fa6f 100644
--- a/src/analysis/scan/scanner.c
+++ b/src/analysis/scan/scanner.c
@@ -482,17 +482,50 @@ bool g_content_scanner_add_rule(GContentScanner *scanner, GScanRule *rule)
* Remarques : - *
* *
******************************************************************************/
-
+#include <sched.h>
GScanContext *g_content_scanner_analyze(GContentScanner *scanner, GScanOptions *options, GBinContent *content)
{
GScanContext *result; /* Bilan global à retourner */
bool status; /* Bilan d'opération locale */
size_t i; /* Boucle de parcours */
+ size_t ids_count; /* Quantité de motifs prévus */
bool global; /* Bilan des règles globales */
GScanRule *rule; /* Règle à consulter */
const char *name; /* Désignation de la règle */
- /* Préparations... */
+#if 0
+
+ int policy;
+ struct sched_param sp;
+
+
+ policy = sched_getscheduler(0);
+ /*
+ switch(policy) {
+ case SCHED_OTHER: printf("SCHED_OTHER\n"); break;
+ case SCHED_RR: printf("SCHED_RR\n"); break;
+ case SCHED_FIFO: printf("SCHED_FIFO\n"); break;
+ default: printf("Unknown...\n");
+ }
+
+ int policy;
+ ...
+ if((policy = sched_getscheduler(0) == -1)) {
+ fprintf(stderr, ...
+ }
+ */
+
+
+ if(policy == SCHED_OTHER) {
+ sp.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ sched_setscheduler(0, SCHED_FIFO, &sp);
+ }
+
+#endif
+
+
+
+ /* Préparations... */
result = g_scan_context_new(options);
@@ -512,11 +545,23 @@ GScanContext *g_content_scanner_analyze(GContentScanner *scanner, GScanOptions *
goto exit;
}
+ g_engine_backend_warm_up(scanner->data_backend);
+
+ for (i = 0; i < scanner->rule_count && status; i++)
+ status = g_scan_rule_define_pattern_ids(scanner->rules[i], scanner->data_backend);
+
+ /* Affichage éventuel de statistiques */
+
+ if (g_scan_options_get_print_stats(options))
+ g_engine_backend_output_stats(scanner->data_backend);
+
}
/* Phase d'analyse */
- g_scan_context_set_content(result, content);
+ ids_count = g_engine_backend_count_plain_pattern_ids(scanner->data_backend);
+
+ g_scan_context_set_content(result, content, ids_count);
g_engine_backend_run_scan(scanner->data_backend, result);