首页  >  文章  >  后端开发  >  我在看lnmp安装脚本的时候,有一段修改配置文件libc6-xen.conf的代码,不是特别理解。

我在看lnmp安装脚本的时候,有一段修改配置文件libc6-xen.conf的代码,不是特别理解。

WBOY
WBOY原创
2016-12-01 00:56:551612浏览

lnmp.org V1.3版本

有一个方法Xen_Hwcap_Setting,我看把配置文件libc6-xen.confhwcap 1 nosegneg改为了hwcap 0 nosegneg,这样有什么作用吗?代码如下:

<code>Xen_Hwcap_Setting()
{
    if [ -s /etc/ld.so.conf.d/libc6-xen.conf ]; then
        sed -i 's/hwcap 1 nosegneg/hwcap 0 nosegneg/g' /etc/ld.so.conf.d/libc6-xen.conf
    fi
}</code>

到网上搜了一下,但不是特别明白,期待大家能给我解答,谢谢

============== 补充下 ===========

可能我问题提的有点问题,我更想知道的是,这个配置hwcap 1 nosegneg起什么作用?为什么要修改这个配置为hwcap 0 nosegneg

来自apt-browse的一段话.

# This directive teaches ldconfig to search in nosegneg subdirectories
# and cache the DSOs there with extra bit 1 set in their hwcap match
# fields. In Xen guest kernels, the vDSO tells the dynamic linker to
# search in nosegneg subdirectories and to match this extra hwcap bit
# in the ld.so.cache file.
hwcap 1 nosegneg

回复内容:

lnmp.org V1.3版本

有一个方法Xen_Hwcap_Setting,我看把配置文件libc6-xen.confhwcap 1 nosegneg改为了hwcap 0 nosegneg,这样有什么作用吗?代码如下:

<code>Xen_Hwcap_Setting()
{
    if [ -s /etc/ld.so.conf.d/libc6-xen.conf ]; then
        sed -i 's/hwcap 1 nosegneg/hwcap 0 nosegneg/g' /etc/ld.so.conf.d/libc6-xen.conf
    fi
}</code>

到网上搜了一下,但不是特别明白,期待大家能给我解答,谢谢

============== 补充下 ===========

可能我问题提的有点问题,我更想知道的是,这个配置hwcap 1 nosegneg起什么作用?为什么要修改这个配置为hwcap 0 nosegneg

来自apt-browse的一段话.

# This directive teaches ldconfig to search in nosegneg subdirectories
# and cache the DSOs there with extra bit 1 set in their hwcap match
# fields. In Xen guest kernels, the vDSO tells the dynamic linker to
# search in nosegneg subdirectories and to match this extra hwcap bit
# in the ld.so.cache file.
hwcap 1 nosegneg

-s在shell文件判断中的意思是文件是否有内容,如果没有内容,就执行下面的sed
至于最开始的

<code>test_name()
{

}</code>

其实就是一个函数!

sed使用参数

<code>
-i :直接修改读取的文件内容,而不是输出到终端

   </code>

数据的搜寻并替换
除了整行的处理模式之外, sed 还可以用行为单位进行部分数据的搜寻并取代。基本上 sed 的搜寻与替代的与 vi 相当的类似!他有点像这样:

<code>
sed 's/要被取代的字串/新的字串/g'

</code>

所以你这句代码的意思是

<code>全局把hwcap 1 nosegneg替换成hwcap 0 nosegneg</code>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn