copperplate tunables with dso
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.
Is there a way to override the default values when using dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?
kind regards,
Henning
Quoted 7 lines · Henning Schild
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with
dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.
this may help you.
char **fakeargv;
int *fakeargc;
#ifdef __COBALT__
fakeargc = (int*)malloc(sizeof(int));
*fakeargc =1;
fakeargv = (char**)malloc(2*sizeof(char*));
fakeargv[0] = (char*)malloc(7);
strcpy(fakeargv[0],"python");
fakeargv[1] = NULL;
xenomai_init(fakeargc,(char* const**)&fakeargv);#endif
Quoted 11 lines
Is there a way to override the default values when using
dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?kind regards,
Henning_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai
Quoted 71 lines · Stéphane Ancelot
Quoted 7 lines · Henning Schild
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with
dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.this may help you.
#include <xenomai/init.h>
#include <xenomai/tunables.h>static int
foo_tune(void){ set_config_tunable(mem_pool_size,5000000); printf("mem pool size=%ld\n", get_config_tunable(mem_pool_size)); return 0; /* Success, otherwise -errno */ }/*
* CAUTION: we assume that all omitted handlers are zeroed
* due to the static storage class. Make sure to initialize them
* explicitly to NULL if the descriptor belongs to the .data
* section instead.
*/
static structsetup_descriptorfoo_setup= {
.name = "foo",
.tune =foo_tune,
.parse_option = NULL,
.help = NULL,
.init = NULL,
.options = NULL,
};/* Register the setup descriptor. */
user_setup_call(foo_setup);char **fakeargv;
int *fakeargc;#ifdef __COBALT__ fakeargc = (int*)malloc(sizeof(int)); *fakeargc =1; fakeargv = (char**)malloc(2*sizeof(char*)); fakeargv[0] = (char*)malloc(7); strcpy(fakeargv[0],"python"); fakeargv[1] = NULL; xenomai_init(fakeargc,(char* const**)&fakeargv);#endif
Quoted 11 lines
Is there a way to override the default values when using
dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?kind regards,
Henning_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai_______________________________________________
Xenomai mailing list
[email protected]
https://xenomai.org/mailman/listinfo/xenomai
Quoted 8 lines · Henning Schild
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with
dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.
Quoted 4 lines
Is there a way to override the default values when using
dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?
Since 3.0.4, DSOs can have their own bootstrap module [1]. So I would define some setup descriptor with the proper ->tune() handler in the DSO code the same way one would do in the main executable, then use xeno-config's --auto-init-solib flags for linking the resulting DSO, which would glue the bootstrap code in charge of running the setup calls.
[1]
http://git.xenomai.org/xenomai-3.git/commit/?id=d6d8047ecd093bd827026678b3c7619b08dd7dd2
Signature · 1 line
Philippe.
Am Wed, 10 May 2017 17:36:21 +0200
schrieb Philippe Gerum <[email protected]>:
Quoted 21 lines · Henning Schild
Quoted 8 lines
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with
dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.Quoted 4 lines
Is there a way to override the default values when using
dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?Since 3.0.4, DSOs can have their own bootstrap module [1]. So I would define some setup descriptor with the proper ->tune() handler in the DSO code the same way one would do in the main executable, then use xeno-config's --auto-init-solib flags for linking the resulting DSO, which would glue the bootstrap code in charge of running the setup calls.
Quoted 3 lines
[1]
http://git.xenomai.org/xenomai-3.git/commit/?id=d6d8047ecd093bd827026678b3c7619b08dd7dd2
Thanks, i guess i was just missing the --auto-init-solib, lets see how that works out. I also saw some code copying /proc/self/cmdline and it looks like that gets passed to xeno_init. I am guessing if the first main() would not fail on xenomais args they would also work?
Henning
Quoted 24 lines · Henning Schild
Am Wed, 10 May 2017 17:36:21 +0200
schrieb Philippe Gerum <[email protected]>:Quoted 21 lines · Henning Schild
Quoted 8 lines
Hi,
today i have to a question from an application developers point of view. How do i override the default value of a tunable when libcobalt is linked with
dlopen()?
This article https://xenomai.org/2015/05/application-setup-and-init/
describes the tunables but not the dso-case.Quoted 4 lines
Is there a way to override the default values when using
dlopen()? Maybe delaying the call to the constructors, or passing some arguments to them?Since 3.0.4, DSOs can have their own bootstrap module [1]. So I would define some setup descriptor with the proper ->tune() handler in the DSO code the same way one would do in the main executable, then use xeno-config's --auto-init-solib flags for linking the resulting DSO, which would glue the bootstrap code in charge of running the setup calls.
Quoted 9 lines
Quoted 3 lines
[1]
http://git.xenomai.org/xenomai-3.git/commit/?id=d6d8047ecd093bd827026678b3c7619b08dd7dd2Thanks, i guess i was just missing the --auto-init-solib, lets see how that works out. I also saw some code copying
/proc/self/cmdlineand it looks like that gets passed toxeno_init. I am guessing if the firstmain()would not fail on xenomais args they would also work?
Yes.
Signature · 1 line
Philippe.