search

Home  >  Q&A  >  body text

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

lnmp.org V1.3版本

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

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
}

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

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

可能我问题提的有点问题,我更想知道的是,这个配置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

PHPzPHPz2895 days ago264

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-10 17:42:35

    sed使用参数

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

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

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

    所以你这句代码的意思是

    全局把hwcap 1 nosegneg替换成hwcap 0 nosegneg

    reply
    0
  • 高洛峰

    高洛峰2017-04-10 17:42:35

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

    test_name()
    {
    
    }

    其实就是一个函数!

    reply
    0
  • Cancelreply