Project

General

Profile

Bug #342

libprelude >= 0.9.20 can't create thread

Added by over 15 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
Due date:
% Done:

0%

Resolution:
invalid

Description

If I put the following test program (test.c) into the unpacked libprelude tarball (libprelude-0.9.xx):

#include <prelude.h>
#include <prelude-list.h>
#include <prelude-timer.h>
#include <prelude-log.h>
#include <prelude-async.h>
#include <prelude-io.h>
#include <prelude-plugin.h>
#include <prelude-msg.h>
#include <prelude-message-id.h>
#include <prelude-msgbuf.h>
#include <prelude-client.h>
#include <prelude-string.h>
#include <prelude-timer.h>
#include <idmef-message-id.h>
#include <idmef-tree-wrap.h>
#include <idmef-data.h>

#include <stdio.h>
#include <string.h>

static prelude_client_t *client = NULL;

int main(int argc, char **argv) {
  int ret = 0;
  char *profile;
  prelude_client_flags_t flags;

  profile = strdup("test");
  ret = prelude_thread_init(NULL);
  printf("ret: %d\n", ret);
  ret = prelude_init(NULL, NULL);
  printf("ret: %d\n", ret);
  ret = prelude_client_new(&client, profile);
  printf("ret: %d\n", ret);

  flags = PRELUDE_CLIENT_FLAGS_ASYNC_SEND | PRELUDE_CLIENT_FLAGS_ASYNC_TIMER;
  ret = prelude_client_set_flags(client, prelude_client_get_flags(client) | flags);
  printf("ret: %d\n", ret);
}

compile it with

gcc -L src/.libs/ -I . -I src/include -I src/libprelude-error -lprelude test.c -o test

and run it via

LD_LIBRARY_PATH=src/.libs/ ./test

I get the following result with libprelude <= 0.9.19 (i.e. 0.9.16):

ret: 0
ret: 0
ret: 0
ret: 0

and with libprelude >= 0.9.20 (i.e. 0.9.21.3) I get the following
output:

ret: 0
ret: 0
ret: 0
18 Dec 14:07:16 (process:14773) ERROR: error creating asynchronous thread: Function not implemented. (prelude-async.c:243 do_init_async)
ret: 0

I'd expect that prelude_client_set_flags() should return != 0 if
something goes wrong, but maybe I just got the initialisation sequence
wrong.

This behaviour occurs on openSUSE 10.3, i586, gcc 4.2.1, glibc 2.6.1.

If you need any additional information for me or would like me to
perform some tests for you, feel free to ask, I'll be glad to help.

History

#1 Updated by Yoann VANDOORSELAERE over 15 years ago

  • Status changed from New to Closed
  • Resolution set to invalid

Replying to "delgado@

#2 Updated by over 15 years ago

I can confirm that this works, so I simply used the wrong linkage options. Thanks!

However libprelude-config --help gives me:

Usage: libprelude-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--config-prefix] [--version] [--c++] [--libs] [--ldflags] [--cflags] [--pthread-cflags]

i.e. the --thread option is not mentioned.

#3 Updated by Yoann VANDOORSELAERE almost 15 years ago

  • Project changed from PRELUDE SIEM to Libprelude
  • Category deleted (1)
  • Target version deleted (92)

Also available in: Atom PDF