Changeset 4fe3b6d in mainline for uspace/lib/c/generic/dlfcn.c


Ignore:
Timestamp:
2011-05-20T11:07:00Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8bb61e6
Parents:
3476be8 (diff), 7941bd6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with development

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/dlfcn.c

    r3476be8 r4fe3b6d  
    11/*
    2  * Copyright (c) 2011 Lubos Slovak
     2 * Copyright (c) 2008 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup drvusbhid
     29/** @addtogroup rtld rtld
     30 * @brief
    3031 * @{
    31  */
    32 /** @file
    33  * USB HID keyboard autorepeat facilities
     32 */ 
     33/**
     34 * @file
    3435 */
    3536
    36 #ifndef USB_KBDREPEAT_H_
    37 #define USB_KBDREPEAT_H_
     37#include <stdio.h>
     38#include <stdlib.h>
     39#include <dlfcn.h>
    3840
    39 struct usb_kbd_t;
     41#include <rtld/module.h>
     42#include <rtld/symbol.h>
    4043
    41 /*----------------------------------------------------------------------------*/
    42 /**
    43  * Structure for keeping information needed for auto-repeat of keys.
     44void *dlopen(const char *path, int flag)
     45{
     46        module_t *m;
     47
     48        if (runtime_env == NULL) {
     49                printf("Dynamic linker not set up -- initializing.\n");
     50                rtld_init_static();
     51        }
     52
     53        printf("dlopen(\"%s\", %d)\n", path, flag);
     54
     55        printf("module_find('%s')\n", path);
     56        m = module_find(path);
     57        if (m == NULL) {
     58                printf("NULL. module_load('%s')\n", path);
     59                m = module_load(path);
     60                printf("module_load_deps(m)\n");
     61                module_load_deps(m);
     62                /* Now relocate. */
     63                printf("module_process_relocs(m)\n");
     64                module_process_relocs(m);
     65        } else {
     66                printf("not NULL\n");
     67        }
     68
     69        return (void *) m;
     70}
     71
     72/*
     73 * @note Symbols with NULL values are not accounted for.
    4474 */
    45 typedef struct {
    46         /** Last pressed key. */
    47         unsigned int key_new;
    48         /** Key to be repeated. */
    49         unsigned int key_repeated;
    50         /** Delay before first repeat in microseconds. */
    51         unsigned int delay_before;
    52         /** Delay between repeats in microseconds. */
    53         unsigned int delay_between;
    54 } usb_kbd_repeat_t;
     75void *dlsym(void *mod, const char *sym_name)
     76{
     77        elf_symbol_t *sd;
     78        module_t *sm;
    5579
    56 /*----------------------------------------------------------------------------*/
     80        printf("dlsym(0x%lx, \"%s\")\n", (long)mod, sym_name);
     81        sd = symbol_bfs_find(sym_name, (module_t *) mod, &sm);
     82        if (sd != NULL) {
     83                return symbol_get_addr(sd, sm);
     84        }
    5785
    58 int usb_kbd_repeat_fibril(void *arg);
     86        return NULL;
     87}
    5988
    60 void usb_kbd_repeat_start(struct usb_kbd_t *kbd, unsigned int key);
    61 
    62 void usb_kbd_repeat_stop(struct usb_kbd_t *kbd, unsigned int key);
    63 
    64 #endif /* USB_KBDREPEAT_H_ */
    65 
    66 /**
    67  * @}
     89/** @}
    6890 */
Note: See TracChangeset for help on using the changeset viewer.