Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
b0f06550
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
8 个月 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b0f06550
编写于
2月 17, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
!250 add namespace create interface for musl
Merge pull request !250 from hhj/dlns-inf
上级
12350b51
eb181742
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
106 addition
and
1 deletion
+106
-1
musl_src.gni
musl_src.gni
+1
-0
porting/linux/user/include/dlfcn.h
porting/linux/user/include/dlfcn.h
+61
-0
porting/linux/user/ldso/dynlink.c
porting/linux/user/ldso/dynlink.c
+44
-1
未找到文件。
musl_src.gni
浏览文件 @
b0f06550
...
...
@@ -1832,6 +1832,7 @@ musl_src_porting_file = [
"include/sys/sysinfo.h",
"src/internal/dynlink.h",
"include/unistd.h",
"include/dlfcn.h",
"src/internal/pthread_impl.h",
"src/internal/syscall.h",
"src/legacy/ulimit.c",
...
...
porting/linux/user/include/dlfcn.h
0 → 100644
浏览文件 @
b0f06550
#ifndef _DLFCN_H
#define _DLFCN_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <features.h>
#define RTLD_LAZY 1
#define RTLD_NOW 2
#define RTLD_NOLOAD 4
#define RTLD_NODELETE 4096
#define RTLD_GLOBAL 256
#define RTLD_LOCAL 0
#define RTLD_NEXT ((void *)-1)
#define RTLD_DEFAULT ((void *)0)
#define RTLD_DI_LINKMAP 2
int
dlclose
(
void
*
);
char
*
dlerror
(
void
);
void
*
dlopen
(
const
char
*
,
int
);
void
*
dlsym
(
void
*
__restrict
,
const
char
*
__restrict
);
/* namespace apis */
typedef
const
char
*
Dl_namespace
;
void
dlns_init
(
Dl_namespace
*
,
const
char
*
);
/* open dso in given namespace which has own lib search paths
* when namespace is null, it's same to dlopen()
* void to use "default" as namespace, which is the default namespace*/
void
*
dlopen_ns
(
Dl_namespace
*
,
const
char
*
,
int
);
/* create the namespace and set lib search paths of namespace,
* the paths should be splited by ':'. When namespace already exist,
* return error */
int
dlns_create
(
Dl_namespace
*
,
const
char
*
);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef
struct
{
const
char
*
dli_fname
;
void
*
dli_fbase
;
const
char
*
dli_sname
;
void
*
dli_saddr
;
}
Dl_info
;
int
dladdr
(
const
void
*
,
Dl_info
*
);
int
dlinfo
(
void
*
,
int
,
void
*
);
#endif
#if _REDIR_TIME64
__REDIR
(
dlsym
,
__dlsym_time64
);
#endif
#ifdef __cplusplus
}
#endif
#endif
porting/linux/user/ldso/dynlink.c
浏览文件 @
b0f06550
...
...
@@ -1083,7 +1083,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
sys_path
=
""
;
}
}
if
(
!
sys_path
)
sys_path
=
"/lib:/usr/local/lib:/usr/lib"
;
if
(
!
sys_path
)
sys_path
=
strdup
(
"/lib:/usr/local/lib:/usr/lib"
)
;
fd
=
path_open
(
name
,
sys_path
,
buf
,
sizeof
buf
);
}
pathname
=
buf
;
...
...
@@ -2427,3 +2427,46 @@ static void error(const char *fmt, ...)
__dl_vseterr
(
fmt
,
ap
);
va_end
(
ap
);
}
void
dlns_init
(
Dl_namespace
*
ns
,
const
char
*
name
)
{
*
ns
=
name
;
}
void
*
dlopen_ns
(
Dl_namespace
*
ns
,
const
char
*
file
,
int
mode
)
{
if
(
!
ns
)
return
NULL
;
return
dlopen
(
file
,
mode
);
}
int
dlns_create
(
Dl_namespace
*
ns
,
const
char
*
search_path
)
{
int
sys_length
=
0
;
int
search_length
=
0
;
char
*
new_path
=
NULL
;
if
(
!
search_path
||
!
ns
)
return
EINVAL
;
sys_length
=
strlen
(
sys_path
);
search_length
=
strlen
(
search_path
);
if
(
search_path
[
0
]
!=
':'
){
sys_length
+=
search_length
+
1
;
}
else
{
sys_length
+=
search_length
;
}
new_path
=
malloc
(
sys_length
+
1
);
if
(
!
new_path
)
return
ENOMEM
;
strcat
(
new_path
,
sys_path
);
if
(
search_path
[
0
]
!=
':'
)
{
strcat
(
new_path
,
":"
);
}
strcat
(
new_path
,
search_path
);
free
(
sys_path
);
sys_path
=
new_path
;
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录