青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Prayer

在一般中尋求卓越
posts - 1256, comments - 190, trackbacks - 0, articles - 0
  C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
https://blog.csdn.net/bugouyonggan/article/details/11962201

轉(zhuǎn):http://blog.yikuyiku.com/?p=2659

 

基本上,在Makefile里會用到install,其他地方會用cp命令。

它們完成同樣的任務——拷貝文件,它們之間的區(qū)別主要如下:

1、最重要的一點,如果目標文件存在,cp會先清空文件后往里寫入新文件,而install則會先刪除掉原先的文件然后寫入新文件。這是因為往正在 使用的文件中寫入內(nèi)容可能會導致一些問題,比如說寫入正在執(zhí)行的文件可能會失敗,比如說往已經(jīng)在持續(xù)寫入的文件句柄中寫入新文件會產(chǎn)生錯誤的文件。而使用 install先刪除后寫入(會生成新的文件句柄)的方式去安裝就能避免這些問題了;

2、install命令會恰當?shù)靥幚砦募?quán)限的問題。比如說,install -c會把目標文件的權(quán)限設置為rwxr-xr-x;

3、install命令可以打印出更多更合適的debug信息,還會自動處理SElinux上下文的問題。

 

轉(zhuǎn):http://blog.csdn.net/stevenliyong/article/details/4663583

 

install  - copy files and set attributes

install 在做拷貝的同時,設置attributes.

 

因此Makefile 中盡量使用install 命令。

 

例如

@install -d /usr/bin

@install -p -D -m 0755 targets /usr/bin

 

相當于

@mkdir -p /usr/bin

@cp targets /usr/bin

@chmod 755 /usr/bin/targets

@touch /usr/bin/tagets       <---- 更新文件時間戳

 

install 命令好強大啊。

另外@前綴的意思是不在控制臺輸出結(jié)果。

 

轉(zhuǎn)載:http://www.cnblogs.com/wwwsinagogogo/archive/2011/08/15/2139124.html

 

【概述】

Install和cp類似,都可以將文件/目錄拷貝到指定的地點。但是,install允許你控制目標文件的屬性。install通常用于程序的makefile,使用它來將程序拷貝到目標(安裝)目錄。

【語法】

install [OPTION]... [-T] SOURCE DEST

install [OPTION]... SOURCE... DIRECTORY

install [OPTION]... -t DIRECTORY SOURCE...

install [OPTION]... -d DIRECTORY...

*如果指定了兩個文件名, `install' 將第一個文件拷貝到第二個

* 如果使用了 `--target-directory' (`-t') 選項,或者如果最后一個文件是一個目錄并且沒有使用`--no-target-directory' (`-T')選項, `install'將每一個源文件拷貝到指定的目錄,目標文件名與SOURCE文件名相同。

* 如果使用了 `--directory' (`-d') 選項, `install' 將逐級創(chuàng)建缺失的目標目錄

【常用選項】

-s:對待拷貝的可執(zhí)行文件進行strip操作,取出文件中的符號表。(一般在做成nand rom時去除符號表,NFS時為了調(diào)試方便,一般不會使用此選項)

-d(--directory):創(chuàng)建制定的目錄結(jié)構(gòu)(逐級創(chuàng)建)。如,指定安裝位置為/usr/local/aaa/bbb,/usr/loacal已存在,install會幫助我們創(chuàng)建aaa和bbb目錄,并把程序安裝到指定位置


If we hand write a Makefile, we should always stick to install instead of using cp for the installation commands. Not only is it more convenient, but it does things right (cp does things wrong).

For example, if we attempt to update /bin/bash, which is currently running, with “cp ... /bin/bash”, we get a “text busy” error. If we attempt to update /lib/libc.so.6 with “cp ... /lib/libc.so.6”, then we either get “text busy” (in ancient versions of Linux) or breaks each and every running program within a fraction of a second (in recent versions of Linux). install does the thing right in both situations.

The reason why cp fails is that it simply attempts to open the destination file in write-only mode and write the new contents. This causes problem because Linux (and all contemporary Unices as well as Microsoft Windows) uses memory mapping (mmap) to load executables and dynamic libraries.

The contents of an executable or dynamic library are mmap’d into the linear address space of relevant processes. Therefore, any change in the underlying file affects the mmap’d memory regions and can potentially break programs. (MAP_PRIVATE guarantees changes by processes to those memory regions are handled by COWwithout affecting the underlying file. On the contrary, POSIX leaves to implementations whether COW should be used if the underlying file is modified. In fact, for purpose of efficiency, in Linux, such modifications are visible to processes even though MAP_PRIVATE may have be used.)

There is an option MAP_DENWRITE which disallows any modification to the underlying file, designed to avoid situations described above. Executables and dynamic libraries are all mmap’d with this option. Unfortunately, it turned out MAP_DENYWRITE became a source of DoS attacks, forcing Linux to ignore this option in recent versions.

Executables are mmap’d by the kernel (in the execve syscall). For kernel codes, MAP_DENYWRITE still works, and therefore we get “text busy” errors if we attempt to modify the executable.

On the other hand, dynamic libraries are mmap’d by userspace codes (for example, by loaders like /lib/ld-linux.so). These codes still pass MAP_DENYWRITE to the kernel, but newer kernels silently ignores this option. The bad consequence is that you can break the whole system if you think you’re only upgrading the C runtime library.

Then, how does install solve this problem? Very simple – unlinking the file before writing the new one. Then the old file (no longer present in directory entries but still in disk until the last program referring to it exits) and the new file have different inodes. Programs started before the upgrading (continuing using the old file) and those after the upgrading (using the new version) will both be happy.



記得在大學的時候在編譯LFS 6 的時候, 一直搞不懂 install 的命令 和 cp 以及和 chmod, chgrp 的區(qū)別? 


工作之后才明白一個Running 的進程不能隨便進行 cp , 經(jīng)常會提示  "text busy", 運維部的前輩們給的建議是采用mv 來替代 cp , 今天看起來前輩好像不知道install 這個命令啊. 

今天就簡單介紹一下 install 命令. 



install copy 文件列表且同時能夠設置文件的屬性(包括 owner, group) , 通常用在 Makefiles 中 用來copy 程序到指定的目錄.  

常見的用法有以下3中形式: 
1:  install  -d [option]   DIRECTORY [DIRECTORY...]  支持多個. 類似 mkdir -p  支持遞歸. 
例如:  install -d a/b/c e/f  結(jié)果和 mkdir -p  a/b/c  e/f 一樣.  
2: install [option]  SOURCE DEST 
復制 SOURCE  文件(測試不能是目錄)   到DEST file(文件) . 
install  a/e   c   結(jié)果類似  cp  a/e  c   # 注意c必須是文件. 
有用選項 -D
install -D x a/b/c    # 效果類似 mkdir -p a/b  && cp  x a/b/c  
3: install [option]  SOURCE [SOURCE...] DIRECTORY
復制  多個SOURCE 文件到目的目錄.  
install a/*  d   其中 d 是目錄. 

有用選項
 -b :自動備份. 
-m : 設置安裝文件的權(quán)限
-p :保留文件的timestamps. 也就是說文件的timestaamps 和 source 文件一樣.  當我們想要利用安裝文件的mtime來跟蹤文件的build時間而不是 安裝時間. 
-s : Strip the symbol tables from installed binary executables.
-S : 備份文件的后綴. 
install  -S .bak new  old  #old 文件自動被 mv 為 old.bak. 
-v: verbose ,打印install 的文件的詳細信息. 
`-c'
     Ignored; for compatibility with old Unix versions of `install'.  #用來兼容舊版的unix. 

-C: (大寫) 
安裝文件, 但是如果目標文件和源文件一樣( 判斷方法需要看看代碼確認) 就跳過, 這樣的好處是 能夠保持一樣文件的mtime.  

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲精品久久久久久久久久久久| 欧美日韩在线观看一区二区| 日韩一级视频免费观看在线| 午夜亚洲影视| 欧美h视频在线| 在线观看亚洲精品| 欧美日韩国产黄| 一道本一区二区| 久久国产精品电影| 亚洲国语精品自产拍在线观看| 欧美成人亚洲成人日韩成人| 中日韩美女免费视频网址在线观看| 小辣椒精品导航| 在线精品高清中文字幕| 久久夜色精品一区| 一区二区免费看| 国产精品成人v| 欧美福利网址| 久久综合久色欧美综合狠狠 | 狠狠色狠狠色综合系列| 欧美理论在线播放| 久久精品久久综合| 欧美一区二区日韩| 一本色道**综合亚洲精品蜜桃冫| 猛男gaygay欧美视频| 欧美在线free| 亚洲一区二区三区精品在线| 亚洲精品看片| 亚洲毛片一区二区| 99热免费精品在线观看| 亚洲第一区在线| 一区二区三区在线高清| 激情六月婷婷久久| 在线观看91精品国产入口| 国产欧美一区二区三区久久人妖| 欧美黑人一区二区三区| 久久九九精品99国产精品| 欧美一区影院| 欧美在线亚洲在线| 久久精品一二三区| 久久午夜精品一区二区| 玖玖综合伊人| 99re66热这里只有精品3直播 | 免费在线观看成人av| 久久亚洲图片| 欧美激情黄色片| 国产精品免费在线| 国产一区二区三区四区三区四| 国产精品一二三| 亚洲第一页自拍| 亚洲伊人久久综合| 久久综合九色综合欧美就去吻| 久久久国产午夜精品| 亚洲激情午夜| 久久精品国产免费| 欧美精品一二三| 国产一区在线免费观看| 亚洲片在线资源| 久久嫩草精品久久久精品一| 亚洲精品一级| 麻豆久久婷婷| 国产亚洲日本欧美韩国| 亚洲图片欧美一区| 亚洲国产天堂久久综合| 欧美在线视屏 | 亚洲久久一区二区| 久久看片网站| 亚洲欧美在线免费观看| 欧美激情黄色片| 一区二区三区在线视频播放| 中文一区二区| 亚洲二区在线视频| 免费成人网www| 国产午夜精品理论片a级探花| 亚洲免费一区二区| 亚洲精品欧美日韩| 毛片av中文字幕一区二区| 亚洲国产视频一区二区| 久久精品成人| 欧美一区二区三区视频在线 | 欧美成人一区二区在线| 国产欧美日韩视频一区二区三区| 亚洲一区二区三区高清不卡| 正在播放欧美视频| 国产欧美日韩一区二区三区在线观看| 亚洲一区二区三区午夜| 中国亚洲黄色| 国产一区二区三区四区五区美女| 香蕉久久夜色精品国产使用方法| 亚洲一区二区三区四区在线观看 | 欧美在线视频在线播放完整版免费观看 | 亚洲欧美日韩直播| 亚洲靠逼com| 亚洲在线一区| 一区二区视频免费在线观看| 麻豆精品精华液| 欧美日韩在线另类| 欧美一级久久久| 久久―日本道色综合久久| 亚洲精品老司机| 亚洲永久网站| 日韩视频在线一区二区| 亚洲欧美精品中文字幕在线| 在线成人av网站| 午夜视频一区二区| 在线免费观看日韩欧美| 亚洲欧美日韩高清| 亚洲精品久久久一区二区三区| 午夜精品一区二区三区在线播放| 欧美在线观看www| 亚洲一区999| 欧美国产一区在线| 久久久精品一区| 欧美日韩亚洲一区| 亚洲国产毛片完整版| 1769国产精品| 午夜精品理论片| 欧美一区二区视频在线| 国产精品户外野外| 亚洲激情偷拍| 91久久久亚洲精品| 老司机精品福利视频| 久久影视精品| 亚洲高清资源| 麻豆成人精品| 国产精品毛片| 性色一区二区| 久久天天躁夜夜躁狠狠躁2022| 国产精品草草| 欧美一区二区视频在线观看2020| 午夜影院日韩| 黄色成人片子| 美国十次成人| 在线亚洲欧美视频| 午夜精品一区二区在线观看| 国产免费成人在线视频| 久久久免费av| 亚洲美女色禁图| 羞羞答答国产精品www一本| 国产一区二区三区无遮挡| 久久久免费精品视频| 亚洲国产精品专区久久| 一区二区三区鲁丝不卡| 国产一区二三区| 欧美国产精品人人做人人爱| 一区二区三区精品国产| 久久伊人亚洲| 亚洲一区二区欧美| 亚洲人成在线观看网站高清| 国产精品久久一区二区三区| 久久艳片www.17c.com| 亚洲免费观看视频| 久久性色av| 欧美一区二区视频在线| 一区二区三区久久网| 国产主播精品| 国产精品自拍小视频| 欧美日韩 国产精品| 麻豆精品在线播放| 亚洲欧美日韩综合国产aⅴ| 尤物精品国产第一福利三区| 国产精品久99| 欧美日在线观看| 欧美激情综合五月色丁香小说| 久久久久久9| 久久久久久午夜| 欧美在线观看一区二区| 妖精成人www高清在线观看| 免费在线观看精品| 久久夜色精品亚洲噜噜国产mv| 欧美一级视频免费在线观看| 亚洲夜间福利| 亚洲欧美日本日韩| 午夜欧美视频| 久久久久久久久一区二区| 久久精品亚洲精品| 玖玖玖国产精品| 欧美国产精品久久| 最近中文字幕mv在线一区二区三区四区 | 先锋a资源在线看亚洲| 欧美亚洲在线| 欧美成人久久| 99这里有精品| 久久狠狠一本精品综合网| 久久成人一区| 欧美日本在线播放| 国产色综合久久| 99精品视频免费| 欧美在线免费播放| 亚洲欧洲另类国产综合| 国产精品99久久久久久www| 久久国产精品网站| 欧美香蕉大胸在线视频观看| 国内精品一区二区| 亚洲一区二区3| 你懂的国产精品永久在线| 亚洲图片欧洲图片av| 久久久人成影片一区二区三区观看| 欧美国产第一页| 亚洲国产成人精品女人久久久 |