ldconfig与 /etc/ld.so.conf
来源:互联网 发布:豪世华邦新员工端口费 编辑:程序博客网 时间:2024/04/28 20:03
现在我们知道了动态与静态函数库,也知道了当前的Linux大多是将函数库做成动态函数库,下面来讨论增加函数库读取性能的方法。我们知道,内存的访问速度是硬盘的好几倍,所以,如果将常用的动态函数库加载到内存中(高速缓存,cache),当软件套件要采用动态函数库时,就不需要重新从硬盘里读出,这样就可以提高动态函数库的读取速度。这个时候需要ldconfig与 /etc/ld.so.conf的帮助。
将动态函数库加载到高速缓存(cache)中的过程如下:
1. 首先,要在 /etc/ld.so.conf中写下“想要读入高速缓存中的动态函数库所在的目录”,注意,是目录而不是文件。
2. 利用ldconfig执行文件将 /etc/ld.so.conf的数据读入高速缓存中。
3. 同时在 /etc/ld.so.cache文件中记录数据。
事实上,ldconfig还可以用来判断动态函数库的连接信息。赶紧使用Fedora Core 4来测试吧。假设要将MySQL函数库加入到高速缓存中:
[root@linux ~]# ldconfig [-f conf] [ -C cache] [-p]
参数:
-f conf : conf指的是某个文件名称,也就是说,使用conf作为libarary
函数库的取得路径,而不以 /etc/ld.so.conf为默认值
-C cache : cache指的是某个文件名称,也就是说,使用cache作为高速缓存暂存
函数库信息,而不以 /etc/ld.so.cache为默认值
-p : 列出当前所拥有的所有函数库数据内容(在 /etc/ld.so.cache中的数据)。
范例:
范例一:假设MySQL数据库函数库在 /usr/lib/mysql中,如何读入高速缓存?
[root@linux ~]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib/mysql <==这一行是新增的。
[root@linux ~]# ldconfig
# 画面上不会显示任何信息,正常。
[root@linux ~]# ldconfig -p
928 libs found in cache `/etc/ld.so.cache'
libz.so.1 (libc6) => /usr/lib/libz.so.1
libz.so (libc6) => /usr/lib/libz.so
......中间省略......
- ldconfig与 /etc/ld.so.conf
- ldconfig与 /etc/ld.so.conf
- ldconfig与 /etc/ld.so.conf
- 函式库管理:ldconfig 与 /etc/ld.so.conf 以及 ldd
- 函式库管理:ldconfig 与 /etc/ld.so.conf 以及 ldd
- ldconfig命令与/etc/ld.so.conf的作用
- /etc/ld.so.conf和ldconfig, PKG_CONFIG_PATH
- /etc/ld.so.conf & ldconfig & PKG_CONFIG_PATH[转]
- /etc/ld.so.conf和ldconfig, PKG_CONFIG_PATH
- /etc/ld.so.conf.d/ 与/etc/ld.so.conf
- (转)/etc/ld.so.conf和ldconfig, PKG_CONFIG_PATH
- 关系到能否成功编译 /etc /ld.so.conf ; ldconfig ; PKG_CONFIG
- 查看和刷新动态库:ldconfig与 /etc/ld.so.conf
- 动态函数库加载的配置ldconfig与 /etc/ld.so.conf
- are /etc/ld.so.conf and ld-elf.so.conf still used by ldconfig(8) ?
- ldconfig命令以及/etc/ld.so.cache , /etc/ld.so.conf等文件详细说明
- /etc/ld.so.conf 和 ldconfig和/etc/ld.so.cache和LD_LIBRARY_PATH的关系
- ld.so.conf 和 ldconfig
- JSTL标签使用
- java实现https协议
- 图片是否加载完毕
- 配置weblogic启动用户名和密码
- 学Android---MultiAutoCompleteTextView
- ldconfig与 /etc/ld.so.conf
- 数据库新建
- utf8编码问题深究
- Activity
- Linux那些事儿之我是Block层(5)浓缩就是精华?(二) .
- [C++]linux下使用occi连接oracle遇到的两个错误
- 多维分析OLAP引擎Mondrian学习
- oracle定时任务更新数据
- php手册之clone