diff options
| author | Bernard Xiong <[email protected]> | 2013-01-08 18:13:32 -0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2013-01-08 18:13:32 -0800 |
| commit | accace98e05eda28c116eb04502eb92d01b6ef1e (patch) | |
| tree | 4a425c96e0be3980779c8205c7c3fe2f1a144630 /components/libdl | |
| parent | 1fab41d48a490f6483582147500d43f4ca889a8e (diff) | |
| parent | 02b8e9366f362926799bfaecc0891830ba62f646 (diff) | |
Merge pull request #8 from mbbill/correct_crlf
Correct crlf
Diffstat (limited to 'components/libdl')
| -rw-r--r-- | components/libdl/SConscript | 18 | ||||
| -rw-r--r-- | components/libdl/dlclose.c | 72 | ||||
| -rw-r--r-- | components/libdl/dlerror.c | 48 | ||||
| -rw-r--r-- | components/libdl/dlfcn.h | 36 | ||||
| -rw-r--r-- | components/libdl/dlopen.c | 100 | ||||
| -rw-r--r-- | components/libdl/dlsym.c | 74 |
6 files changed, 174 insertions, 174 deletions
diff --git a/components/libdl/SConscript b/components/libdl/SConscript index dbd5bcea32..4b16063eb3 100644 --- a/components/libdl/SConscript +++ b/components/libdl/SConscript @@ -1,9 +1,9 @@ -Import('RTT_ROOT')
-Import('rtconfig')
-from building import *
-
-src = Glob('*.c')
-CPPPATH = [RTT_ROOT + '/components/libdl']
-group = DefineGroup('libdl', src, depend = ['RT_USING_MODULE', 'RT_USING_LIBDL'], CPPPATH = CPPPATH)
-
-Return('group')
+Import('RTT_ROOT') +Import('rtconfig') +from building import * + +src = Glob('*.c') +CPPPATH = [RTT_ROOT + '/components/libdl'] +group = DefineGroup('libdl', src, depend = ['RT_USING_MODULE', 'RT_USING_LIBDL'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/libdl/dlclose.c b/components/libdl/dlclose.c index 854dd6a032..af070891fc 100644 --- a/components/libdl/dlclose.c +++ b/components/libdl/dlclose.c @@ -1,36 +1,36 @@ -/*
- * File : dlclose.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-11-17 yi.qiu first version
- */
-
-#include <rtthread.h>
-#include <rtm.h>
-
-int dlclose (void *handle)
-{
- rt_module_t module;
-
- RT_ASSERT(handle != RT_NULL);
-
- module = (rt_module_t)handle;
- module->nref--;
-
- if(module->nref <= 0)
- {
- rt_module_unload(module);
- }
-
- return RT_TRUE;
-}
-
-RTM_EXPORT(dlclose)
-
+/* + * File : dlclose.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2010-11-17 yi.qiu first version + */ + +#include <rtthread.h> +#include <rtm.h> + +int dlclose (void *handle) +{ + rt_module_t module; + + RT_ASSERT(handle != RT_NULL); + + module = (rt_module_t)handle; + module->nref--; + + if(module->nref <= 0) + { + rt_module_unload(module); + } + + return RT_TRUE; +} + +RTM_EXPORT(dlclose) + diff --git a/components/libdl/dlerror.c b/components/libdl/dlerror.c index 375bd1de3f..dd076412fe 100644 --- a/components/libdl/dlerror.c +++ b/components/libdl/dlerror.c @@ -1,24 +1,24 @@ -/*
- * File : dlerror.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-11-17 yi.qiu first version
- */
-
-#include <rtthread.h>
-#include <rtm.h>
-
-const char *dlerror(void)
-{
- return "TODO";
-}
-
-RTM_EXPORT(dlerror)
-
+/* + * File : dlerror.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2010-11-17 yi.qiu first version + */ + +#include <rtthread.h> +#include <rtm.h> + +const char *dlerror(void) +{ + return "TODO"; +} + +RTM_EXPORT(dlerror) + diff --git a/components/libdl/dlfcn.h b/components/libdl/dlfcn.h index 3c8b0a41b4..069f0d9c46 100644 --- a/components/libdl/dlfcn.h +++ b/components/libdl/dlfcn.h @@ -1,18 +1,18 @@ -#ifndef __DLFCN_H_
-#define __DLFCN_H_
-
-#define RTLD_LAZY 0x00000
-#define RTLD_NOW 0x00001
-
-#define RTLD_LOCAL 0x00000
-#define RTLD_GLOBAL 0x10000
-
-#define RTLD_DEFAULT ((void*)1)
-#define RTLD_NEXT ((void*)2)
-
-void *dlopen (const char *filename, int flag);
-const char *dlerror(void);
-void *dlsym(void *handle, const char *symbol);
-int dlclose (void *handle);
-
-#endif
+#ifndef __DLFCN_H_ +#define __DLFCN_H_ + +#define RTLD_LAZY 0x00000 +#define RTLD_NOW 0x00001 + +#define RTLD_LOCAL 0x00000 +#define RTLD_GLOBAL 0x10000 + +#define RTLD_DEFAULT ((void*)1) +#define RTLD_NEXT ((void*)2) + +void *dlopen (const char *filename, int flag); +const char *dlerror(void); +void *dlsym(void *handle, const char *symbol); +int dlclose (void *handle); + +#endif diff --git a/components/libdl/dlopen.c b/components/libdl/dlopen.c index 3bf6b23b48..8271d2fd4e 100644 --- a/components/libdl/dlopen.c +++ b/components/libdl/dlopen.c @@ -1,50 +1,50 @@ -/*
- * File : dlopen.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-11-17 yi.qiu first version
- */
-
-#include <rtthread.h>
-#include <rtm.h>
-#include <string.h>
-
-#define MODULE_ROOT_DIR "/module/lib"
-
-void* dlopen(const char *filename, int flags)
-{
- rt_module_t module;
- char *fullpath;
- const char*def_path = MODULE_ROOT_DIR;
-
- /* check parameters */
- RT_ASSERT(filename != RT_NULL);
-
- if (filename[0] != '/') /* it's a absolute path, use it directly */
- {
- fullpath = rt_malloc(strlen(def_path) + strlen(filename) + 2);
-
- /* join path and file name */
- rt_snprintf(fullpath, strlen(def_path) + strlen(filename) + 2,
- "%s/%s", def_path, filename);
- }
-
- /* find in module list */
- module = rt_module_find(fullpath);
-
- if(module != RT_NULL) module->nref++;
- else module = rt_module_open(fullpath);
-
- rt_free(fullpath);
- return (void*)module;
-}
-
-RTM_EXPORT(dlopen)
-
+/* + * File : dlopen.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2010-11-17 yi.qiu first version + */ + +#include <rtthread.h> +#include <rtm.h> +#include <string.h> + +#define MODULE_ROOT_DIR "/module/lib" + +void* dlopen(const char *filename, int flags) +{ + rt_module_t module; + char *fullpath; + const char*def_path = MODULE_ROOT_DIR; + + /* check parameters */ + RT_ASSERT(filename != RT_NULL); + + if (filename[0] != '/') /* it's a absolute path, use it directly */ + { + fullpath = rt_malloc(strlen(def_path) + strlen(filename) + 2); + + /* join path and file name */ + rt_snprintf(fullpath, strlen(def_path) + strlen(filename) + 2, + "%s/%s", def_path, filename); + } + + /* find in module list */ + module = rt_module_find(fullpath); + + if(module != RT_NULL) module->nref++; + else module = rt_module_open(fullpath); + + rt_free(fullpath); + return (void*)module; +} + +RTM_EXPORT(dlopen) + diff --git a/components/libdl/dlsym.c b/components/libdl/dlsym.c index 67663bc324..36c7b01fce 100644 --- a/components/libdl/dlsym.c +++ b/components/libdl/dlsym.c @@ -1,37 +1,37 @@ -/*
- * File : dlsym.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-11-17 yi.qiu first version
- */
-
-#include <rtthread.h>
-#include <rtm.h>
-
-void* dlsym(void *handle, const char* symbol)
-{
- int i;
- rt_module_t module;
-
- RT_ASSERT(handle != RT_NULL);
-
- module = (rt_module_t)handle;
-
- for(i=0; i<module->nsym; i++)
- {
- if (rt_strcmp(module->symtab[i].name, symbol) == 0)
- return (void*)module->symtab[i].addr;
- }
-
- return RT_NULL;
-}
-
-RTM_EXPORT(dlsym)
-
+/* + * File : dlsym.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2010-11-17 yi.qiu first version + */ + +#include <rtthread.h> +#include <rtm.h> + +void* dlsym(void *handle, const char* symbol) +{ + int i; + rt_module_t module; + + RT_ASSERT(handle != RT_NULL); + + module = (rt_module_t)handle; + + for(i=0; i<module->nsym; i++) + { + if (rt_strcmp(module->symtab[i].name, symbol) == 0) + return (void*)module->symtab[i].addr; + } + + return RT_NULL; +} + +RTM_EXPORT(dlsym) + |
