Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3685 → Rev 3686

/branches/dynload/uspace/app/dltest/dltest.c
35,6 → 35,8
*/
 
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
 
static void kputint(unsigned i)
{
60,8 → 62,25
 
int main(int argc, char *argv[])
{
void *a;
void *s;
 
char *lib_name;
char *sym_name;
 
// kputint(-1);
printf("Hello from dltest!\n");
 
lib_name = "libc.so.0";
sym_name = "printf";
 
a = dlopen(lib_name, 0);
if (a != NULL) {
s = dlsym(a, sym_name);
printf("symbol '%s' = 0x%lx\n", sym_name, (long) s);
} else {
printf("failed to dlopen() library '%s'\n");
}
return 0;
}
 
/branches/dynload/uspace/app/dload/dload.c
47,10 → 47,14
 
void program_run(void *entry, pcb_t *pcb);
 
runtime_env_t dload_re;
 
int main(int argc, char *argv[])
{
static module_t prog;
 
runtime_env = &dload_re;
 
DPRINTF("Hello, world! (from dload)\n");
if (__pcb->dynamic == NULL) {
printf("This is the dynamic loader. It is not supposed "
69,11 → 73,11
prog.dyn.soname = "[program]";
 
/* Initialize list of loaded modules */
list_initialize(&runtime_env.modules_head);
list_append(&prog.modules_link, &runtime_env.modules_head);
list_initialize(&runtime_env->modules_head);
list_append(&prog.modules_link, &runtime_env->modules_head);
 
/* Pointer to program module. Used as root of the module graph. */
runtime_env.program = &prog;
runtime_env->program = &prog;
 
/*
* Now we can continue with loading all other modules.
90,6 → 94,9
DPRINTF("Relocate all modules\n");
modules_process_relocs();
 
/* Pass runtime evironment pointer through PCB. */
__pcb->rtld_runtime = (void *) runtime_env;
 
/*
* Finally, run the main program.
*/
/branches/dynload/uspace/app/init/init.c
116,7 → 116,7
console_wait();
version_print();
spawn("/app/klog");
// spawn("/app/klog");
spawn("/app/bdsh");
free(buf);