<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>编译点滴 &#187; 操作系统 Operating system</title>
	<atom:link href="http://www.lingcc.com/tag/%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f-operating-system/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lingcc.com</link>
	<description>编译器、虚拟机、程序设计语言、体系结构、软件调试、操作系统等等</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:56:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>认识静态链接库</title>
		<link>http://www.lingcc.com/2010/05/25/10951/</link>
		<comments>http://www.lingcc.com/2010/05/25/10951/#comments</comments>
		<pubDate>Tue, 25 May 2010 13:33:01 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[系统软件及库]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>
		<category><![CDATA[系统健壮性]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器开发]]></category>
		<category><![CDATA[运行时技术]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10951</guid>
		<description><![CDATA[介绍静态链接库是什么，为何要有静态链接库，动态链接库和共享库，如何使用，创建，编辑静态练级库。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F08%2F10709%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GNU工具链学习笔记</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F08%2F10609%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC中的pie和fpie选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F11%2F20%2F10065%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gcc和Open64中的-fPIC选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F11%2F11300%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">软链接和硬链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F19%2F9897%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">经验之谈:做好预防措施,保护好自己的电脑的13个Tips</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/07/16/11081/' rel='bookmark' title='多面体模型是编译器循环优化的未来吗？'>多面体模型是编译器循环优化的未来吗？</a></li>
<li><a href='http://www.lingcc.com/2008/08/27/9982/' rel='bookmark' title='zz Linux下的段错误的原因及调试'>zz Linux下的段错误的原因及调试</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<h4>什么是静态链接库？</h4>
<p>静态链接库，即static library或 statically-linked library。和动态链接库，即dynamic library 或dynamicly-linked library相对，是Windows和Linux系统中比较常用的库文件。Windows中分别用SLL和DLL文件表示，Linux中分别是.a和.so文件.</p>
<p>静态链接库实际是一些object files(.o文件)和头文件的压缩包，通过GNU工具链中的ar(archiver)程序创建。</p>
<h5>静态链接库、动态链接库和共享库</h5>
<p>那为何还要有动态链接库呢？静态练级库虽然能很好的节省编译时间。对于一个简单的ls程序，我们需要有屏幕输出，有字符串和格式操作，有文件系统访问等等函数，都要在一个程序中。此时，这个程序会很大。一个小小的ls可能都会有好几兆。如果还有个rm程序，同样也需要屏幕输出，文件系统访问。那么这两个东西，我们可以放到两个库文件里，在执行ls，或者rm的时候，用到屏幕输出操作，就将相应的函数对应的机器码载入内存中，执行。然后再从内存中释放。接着载入文件系统访问的相关函数。这样我们的程序就能变小很多。这种可以动态装载到内存中的库文件就是动态链接库了。Windows下的DLL文件就是动态链接库。</p>
<p><span id="more-10951"></span></p>
<p>还有个问题，其实ls和rm使用的屏幕输出函数是一样的。内存很小的时候，同时执行ls和rm，有必要同时载入两份相同的代码到内存中吗？于是就有了共享库，不同的程序可以共享相同的代码。都可以访问，执行。于是就有了共享库的概念。Linux下的.so文件就是共享库。</p>
<p>这时候又有个问题，程序执行时，访存，跳转的地址是一定的，那两个程序又如何共享相同的库代码呢？这就靠位置无关的代码生成了。本博曾经写过文章介绍它们，请参考<a href="http://www.lingcc.com/2009/11/20/10065/" target="_blank">Gcc和Open64中的-fPIC选项</a> 和<a href="http://www.lingcc.com/2010/01/08/10609/" target="_blank">GCC中的pie和fpie选项</a>两篇文章。</p>
<p>下图是关于共享库和静态链接库的示意图，可以简单看出些区别。</p>
<div id="attachment_10952" class="wp-caption alignnone" style="width: 351px"><a href="http://www.lingcc.com/wp-content/uploads/2010/05/figure2.gif"><img class="size-full wp-image-10952" title="静态链接库和共享库" src="http://www.lingcc.com/wp-content/uploads/2010/05/figure2.gif" alt="" width="341" height="265" /></a><p class="wp-caption-text">静态链接库和共享库</p></div>
<h4>为什么要有静态链接库？</h4>
<p>首先，随着程序规模的增加，有些常用函数可能不需要每次都编译，于是就可以把它们作为库的方式来存放。这样用户就能很方便的链接生成最后的程序，不用一遍遍的重新编译某些常用程序文件。必须内核，硬件驱动，文件系统，glibc等等库文件，一些基本函数都采用了这种形式。</p>
<p>其次，一些闭源代码，可以通过库的方式来发布，这样可以保证代码不公开。</p>
<p>再次，相比动态链接的程序，或者共享库程序，连接到静态库的程序会快1%-5%左右。</p>
<p>另外，有些特殊环境，必须使用静态链接库。比如在Linux系统，需要chroot到另一个系统环境中时，动态链接库就不再起作用，因为那些是在原来系统的文件树下，如/usr/lib.但在chroot的环境中，无法访问。</p>
<h4>怎么用静态链接库？</h4>
<p>既然静态链接库的出现，是为了缩短编译时间。而普通可执行程序又可以分为静态链和动态链两种形式。因此我们就分开介绍之，原因无他，只是想顺便介绍一下动态链可执行程序和静态链可执行程序在运行时的一些区别。</p>
<p>对于静态链接库的应用，加上-lname，就会链接libname.a这个静态链接库文件。一般静态链接库文件的搜索路径为系统默认的路径，如/usr/lib/和当前路径。你也可以用过-L选项，指定GCC搜索某个特定文件夹。注意-l和-L的参数要加载待编译源码文件之后。</p>
<p>静态链接库既可以在编译时用于生成单个可执行文件，也可以在运行时根据编译或者连接时确定的静态偏移量载入内存中。</p>
<h5>编译静态链接可执行程序</h5>
<p>编译静态链可执行程序,对于gcc，只要加上-static即可。</p>
<p>编译时，程序中若有对库函数的调用，编译器或者连接器就会将库中相应的代码拷贝到目标文件中，生成一个独立的可执行文件。</p>
<h5>编译动态链接可执行程序</h5>
<p>不加-static编译生成的可执行程序都是动态链接的，编译时所做工作很少，仅仅记录了该程序需要什么库函数，以及该库函数在库中到索引。</p>
<p>但对于动态链接程序，在系统启动该可执行程序时，装载器loader必须能找到相应的共享库文件.so文件或者静态链接库文件.a(已经很少使用这种形式了)，并将其载入内存中，一般的，有两种途径可以指定链接库文件的位置，</p>
<ul>
<li>编译动态链接可执行程序时，通过rpath指定，这个可以在编译时增加选项-Wl,-rpath=DIRS.这种方式不需要在运行时做任何修改，该选项会在连接时，写入可执行程序中。</li>
<li>运行时由ld.so指定。默认共享库搜索路径是/usr/local/lib，/usr/lib以及当前目录，你可以通过修改$LD_LIBRARY_PATH变量修改。系统管理员也可以在/etc/profile中修改，以便对所有用户有效。当然修改/etc/ld.so.conf也行，这样所有的程序都将更改寻找链接库文件的路径。</li>
</ul>
<div id="attachment_10953" class="wp-caption alignnone" style="width: 487px"><a href="http://www.lingcc.com/wp-content/uploads/2010/05/confused.jpg"><img class="size-full wp-image-10953" title="很晕吧" src="http://www.lingcc.com/wp-content/uploads/2010/05/confused.jpg" alt="" width="477" height="358" /></a><p class="wp-caption-text">很晕吧</p></div>
<h4>静态链接库的常用操作</h4>
<h5>制作静态链接库</h5>
<p><code>$ar rcs liba.a a.o b.o c.o a_header.h b_header.h</code></p>
<p>上面命令，将a.o, b.o, c.o, a_header.h, b_header.h作成静态链接库liba.a.</p>
<ul>
<li>选项r：将 .o , .h文件插入到liba.a文件中</li>
<li>c:创建一个压缩文件。</li>
<li>s：将.o文件的索引信息写入压缩文件中，或者升级已有索引。这和执行 ranlib liba.a的效果过一样。索引信息会存在压缩包的一个符号文件夹内，连接器可以通过名称找到位置，这样可以加速连接时间。</li>
</ul>
<h5>解压静态链接库</h5>
<p><code>$ar xv liba.a</code></p>
<p>该命令会把liba.a中所有的文件解压缩到当前目录下。</p>
<ul>
<li>x：解压缩该压缩包</li>
<li>v：可视化，解压缩同时输出到屏幕</li>
</ul>
<h5>查看内容</h5>
<p><code>$nm --print-armap liba.a</code></p>
<p>该命令查看liba.a中包含哪些文件，每个文件中包含哪些函数。</p>
<ul>
<li>在列出压缩包中所有文件中的符号，同时包含索引：每个元素到符号的映射</li>
</ul>
<h5>实践：</h5>
<p>本文不再给出具体实践，可以参考<a href="http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html" target="_blank">An Introduction to GCC &#8211; Shared libraries and static libraries</a></p>
<h4>参考：</h4>
<ol>
<li><a href="http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html">http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html</a></li>
<li><a href="http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html"></a><a href="http://en.wikipedia.org/wiki/Static_library">http://en.wikipedia.org/wiki/Static_library</a></li>
<li><a href="http://cpp.codenewbie.com/articles/cpp/1444/Static_Link_Librarys-Page_1.html">http://cpp.codenewbie.com/articles/cpp/1444/Static_Link_Librarys-Page_1.html</a></li>
<li><a href="http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html">http://tldp.org/HOWTO/Program-Library-HOWTO/static-libraries.html</a></li>
<li><a href="http://www.faqs.org/docs/linux_scratch/chapter05/whystatic.html">http://www.faqs.org/docs/linux_scratch/chapter05/whystatic.html</a></li>
<li><a href="http://en.wikipedia.org/wiki/Dynamic-link_library">http://en.wikipedia.org/wiki/Dynamic-link_library</a></li>
<li><a href="http://www.ibm.com/developerworks/linux/library/l-dynamic-libraries/index.html" target="_blank">http://www.ibm.com/developerworks/linux/library/l-dynamic-libraries/index.html</a></li>
</ol>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F08%2F10709%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GNU工具链学习笔记</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F08%2F10609%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC中的pie和fpie选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F11%2F20%2F10065%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Gcc和Open64中的-fPIC选项</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F11%2F11300%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">软链接和硬链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F02%2F19%2F9897%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F25%2F10951%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">经验之谈:做好预防措施,保护好自己的电脑的13个Tips</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/07/16/11081/' rel='bookmark' title='多面体模型是编译器循环优化的未来吗？'>多面体模型是编译器循环优化的未来吗？</a></li>
<li><a href='http://www.lingcc.com/2008/08/27/9982/' rel='bookmark' title='zz Linux下的段错误的原因及调试'>zz Linux下的段错误的原因及调试</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/05/25/10951/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为龙芯电脑安装操作系统常见问题</title>
		<link>http://www.lingcc.com/2010/03/25/10717/</link>
		<comments>http://www.lingcc.com/2010/03/25/10717/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 13:20:49 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译技术]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[O32]]></category>
		<category><![CDATA[pmon]]></category>
		<category><![CDATA[rescue]]></category>
		<category><![CDATA[成功]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>
		<category><![CDATA[链接]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10717</guid>
		<description><![CDATA[本博在实际工作中，曾经安装过不少龙芯电脑的系统，可谓稍有经验，这里略微介绍一些常见问题。 内核通用吗？一般龙芯2F使用MIPSIII的指令级，内核格式都为64位的文件。所以不管时O32系统还是N32系统，只要硬件相同都是通用的，不过别忘了连同/lib/modules 和/lib/firmware一起使用：） 龙芯到底有多少种系统？很多，按照ABI分为3类：O32，N32，N64.O32是出厂时自带的系统，一般龙芯盒子中的华镭，龙芯本中的loonux、红旗和龙芯一体机中的共创都是O32系统。这类系统基本都是在debian的基础上做做山寨化。当然也有英文版的debian系统，这个比较干净一些。对于O32的系统，源的问题最头疼，因为各个公司画地为牢，大家都努力维护自己的源，又都缺人手，所以都不完美，试了几个都不太好，装着装着就会出依赖问题，除非一直跟着升级，不然一次apt-get dist-upgrade，那简直是噩梦。N32的系统，zhllg基于Gentoo的已经有了，龙芯论坛里就能找到下载链接。因为Gentoo是自己直接编译，问题相对少些。debian的还没有。N64的系统，有憨牛LFS的，没有试过。至于为啥会有这么多系统，得问问MIPS，因为有不少改进，就产生了不少问题。请参考本博&#60;好大一筐梅普斯&#62;.N32系统据说比O32快20%-30%。因为龙芯本身是64位处理器，所以64位系统也没问题. 龙芯系统好装吗？好装！虽然咱们做的系统很山寨，但咱们的易用性很牛。官方提供了很多中安装和还原方式，硬盘，U盘和网络样样都行，很简单。只要下载一个rescue的内核，就能启动一个迷你的linux系统，有些小命令可以跑，接着再找你想要的系统，下载，解压到龙芯电脑的硬盘上即可。方便快捷，想装N32 就去下gentoo系统，想装O32就去下debian. Android都能装了。北京龙芯俱乐部的FTP里有各种OS，找最新的下就行了。文后有链接地址：） 为啥我的U盘识别不了？呵呵，问题不大，如果你已经确定按照相关步骤执行，并且U盘确实已经插进USB口，还有问题的话，那就换个U盘。因为PMON可能对部分U盘不识别，而且最好把U盘格式化成ext3格式的.pmon的时候可以执行devls，看看有没有usb设备。 装龙芯系统要几步？基本是三四步的样子，load内核，g+内核启动参数启动系统，再解压新系统。龙梦出厂的很多电脑都自带了还原功能，如果你还没有把它折腾坏的话，那就用还原吧。 fdisk对龙芯电脑上的硬盘做了分区，无法启动了咋办？这是我遇到的一个问题。龙芯电脑上本地的系统中对不用的几个分区用fdisk操作，之后重启，发现直接找不到wd0.很可能是硬盘分区表没有写对。这时候最好的方式是想办法再正确的执行一次fdisk。我的解决方法是，找了一个正常系统的内核，启动之，给内核的参数中指定根目录，系统成功启动，再执行了一次fdisk，做了几个小修改，保存，再重启就没问题了。至于为啥换个内核，指定根目录就能启动了，呵呵我也不太清除。 N32的Gentoo系统下载的是带x版本的，但是启动时报错：Warning:unable to open an initial console，然后就卡住了，怎么办？这是因为linux系统中有文件没办法做到压缩包中，需要手动mknod创建。执行下列命令就ok了。 mknod -m 600 dev/console c 5 1 mknod -m 666 dev/null c 1 3 cp -a dev/{console,null} lib/udev/devices/ 请参考一下网址： ftp://www.bjlx.org.cn/  （北京龙芯的ftp，所有的系统都能在这里下载到) http://bbs.lemote.com/redirect.php?tid=25756&#38;goto=lastpost （Gentoo N32系统讨论贴) http://bbs.lemote.com/viewthread.php?tid=4237&#38;extra=page%3D2 (憨牛N64系统讨论贴) http://dev.lemote.com/drupal/book/export/html/62  （操作系统安装方法) 相关文章： WebKit和Firefox的JavaScript性能对比 拥有Nanojit龙芯后端的firefox发布(10年1月14日更新) GCC初窥 用crossdev装龙芯的n32 gnu交叉工具链 使用crossdev安装龙芯的O32 gnu交叉工具链 小例子&#8211;回眸一笑百媚生<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F05%2F10894%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯电脑常见问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F17%2F9957%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">胡伟武：龙芯5年内改变全球CPU格局</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>本博在实际工作中，曾经安装过不少龙芯电脑的系统，可谓稍有经验，这里略微介绍一些常见问题。</p>
<ol>
<li>内核通用吗？一般龙芯2F使用MIPSIII的指令级，内核格式都为64位的文件。所以不管时O32系统还是N32系统，只要硬件相同都是通用的，不过别忘了连同/lib/modules 和/lib/firmware一起使用：）</li>
<li>龙芯到底有多少种系统？很多，按照ABI分为3类：O32，N32，N64.O32是出厂时自带的系统，一般龙芯盒子中的华镭，龙芯本中的loonux、红旗和龙芯一体机中的共创都是O32系统。这类系统基本都是在debian的基础上做做山寨化。当然也有英文版的debian系统，这个比较干净一些。对于O32的系统，源的问题最头疼，因为各个公司画地为牢，大家都努力维护自己的源，又都缺人手，所以都不完美，试了几个都不太好，装着装着就会出依赖问题，除非一直跟着升级，不然一次apt-get dist-upgrade，那简直是噩梦。N32的系统，zhllg基于Gentoo的已经有了，龙芯论坛里就能找到下载链接。因为Gentoo是自己直接编译，问题相对少些。debian的还没有。N64的系统，有憨牛LFS的，没有试过。至于为啥会有这么多系统，得问问MIPS，因为有不少改进，就产生了不少问题。请参考本博<a href="../../../02/25/10698/" target="_blank">&lt;好大一筐梅普斯&gt;</a>.N32系统据说比O32快20%-30%。因为龙芯本身是64位处理器，所以64位系统也没问题.</li>
<p><span id="more-10717"></span></p>
<li>龙芯系统好装吗？好装！虽然咱们做的系统很山寨，但咱们的易用性很牛。官方提供了很多中安装和还原方式，硬盘，U盘和网络样样都行，很简单。只要下载一个rescue的内核，就能启动一个迷你的linux系统，有些小命令可以跑，接着再找你想要的系统，下载，解压到龙芯电脑的硬盘上即可。方便快捷，想装N32 就去下gentoo系统，想装O32就去下debian. Android都能装了。北京龙芯俱乐部的FTP里有各种OS，找最新的下就行了。文后有链接地址：）</li>
<li>为啥我的U盘识别不了？呵呵，问题不大，如果你已经确定按照相关步骤执行，并且U盘确实已经插进USB口，还有问题的话，那就换个U盘。因为PMON可能对部分U盘不识别，而且最好把U盘格式化成ext3格式的.pmon的时候可以执行devls，看看有没有usb设备。</li>
<li>装龙芯系统要几步？基本是三四步的样子，load内核，g+内核启动参数启动系统，再解压新系统。龙梦出厂的很多电脑都自带了还原功能，如果你还没有把它折腾坏的话，那就用还原吧。</li>
<li>fdisk对龙芯电脑上的硬盘做了分区，无法启动了咋办？这是我遇到的一个问题。龙芯电脑上本地的系统中对不用的几个分区用fdisk操作，之后重启，发现直接找不到wd0.很可能是硬盘分区表没有写对。这时候最好的方式是想办法再正确的执行一次fdisk。我的解决方法是，找了一个正常系统的内核，启动之，给内核的参数中指定根目录，系统成功启动，再执行了一次fdisk，做了几个小修改，保存，再重启就没问题了。至于为啥换个内核，指定根目录就能启动了，呵呵我也不太清除。</li>
<li>N32的Gentoo系统下载的是带x版本的，但是启动时报错：Warning:unable to open an initial console，然后就卡住了，怎么办？这是因为linux系统中有文件没办法做到压缩包中，需要手动mknod创建。执行下列命令就ok了。</li>
<p><strong>mknod -m 600 dev/console c 5 1<br />
mknod -m 666 dev/null c 1 3<br />
cp -a dev/{console,null} lib/udev/devices/</strong></ol>
<div><strong>请参考一下网址：</strong></div>
<div><strong>ftp://www.bjlx.org.cn/  （北京龙芯的ftp，所有的系统都能在这里下载到)</strong></div>
<div><strong>http://bbs.lemote.com/redirect.php?tid=25756&amp;goto=lastpost （Gentoo N32系统讨论贴)</strong></div>
<div><strong>http://bbs.lemote.com/viewthread.php?tid=4237&amp;extra=page%3D2 (憨牛N64系统讨论贴)</strong></div>
<div><strong>http://dev.lemote.com/drupal/book/export/html/62  （操作系统安装方法)</strong></div>
<div><strong><br />
</strong></div>
<div><strong><br />
</strong></div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/03/25/10717/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Gentoo 沙盘简介</title>
		<link>http://www.lingcc.com/2010/03/07/10707/</link>
		<comments>http://www.lingcc.com/2010/03/07/10707/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 11:06:11 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[ebuild]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10707</guid>
		<description><![CDATA[emerge一个软件包时Portage的工作方式: 1,Portage下载源码tar包和补丁(如果需要的话) 2,Portage解压缩tar包到指定位置,所有的编译将在该目录展开,Portage默认使用/var/tmp/portage/packagename/work 3,解压和打补丁(如果需要的话)后(ebuild中的src_unpack()函数),Portage开始编译,一般情况下在特定目录(ebuild使用${WORKDIR}变量指定目录)下执行configure和make命令. 4,编译完成后,portage将所有指定目录下的文件合并到正在运行的系统中.(通常为/,但通过合并时设置ROOT=”/路径”可以修改),为了避免非法或不正确的ebuild对整个文件系统造成不可逆的破坏,我们需要严格限制文件系统的哪个区域允许portage在解压和编译时修改,这就是沙盘工作的路径,默认时,沙盘启动,并限定ebuild(和它执行过程中的明林)都在指定的区域内写磁盘.若ebuild越过沙盘保护的环境,试图在外部区域写磁盘,就构成了沙盘越界. 沙盘的用途: 沙盘是portage用来协助调试ebuild的机制.主要目的是提供一个安全的受保护的环境系统来运行功能未知的程序.实质上,它提供了一个可以用于编译源码包但不会干扰操作系统其他部分运行的环境. 在ebuild的src_unpack,src_compile,src_test和src_install阶段,ebuild.sh都在沙盘内操作. http://bugday.gentoo.org/sandbox.html http://devmanual.gentoo.org/general-concepts/sandbox/index.html 相关文章： 使用crossdev安装龙芯的O32 gnu交叉工具链 Ebuild and emerge gentoo的相关配置-make.conf Gentoo中的交叉编译利器&#8211;crossdev gentoo如何处理被屏蔽(masked)的包 by 杨珂 转自linuxsir 用crossdev装龙芯的n32 gnu交叉工具链
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>emerge一个软件包时Portage的工作方式:<br />
1,Portage下载源码tar包和补丁(如果需要的话)<br />
2,Portage解压缩tar包到指定位置,所有的编译将在该目录展开,Portage默认使用/var/tmp/portage/packagename/work<br />
3,解压和打补丁(如果需要的话)后(ebuild中的src_unpack()函数),Portage开始编译,一般情况下在特定目录(ebuild使用${WORKDIR}变量指定目录)下执行configure和make命令.<br />
4,编译完成后,portage将所有指定目录下的文件合并到正在运行的系统中.(通常为/,但通过合并时设置ROOT=”/路径”可以修改),为了避免非法或不正确的ebuild对整个文件系统造成不可逆的破坏,我们需要严格限制文件系统的哪个区域允许portage在解压和编译时修改,这就是沙盘工作的路径,默认时,沙盘启动,并限定ebuild(和它执行过程中的明林)都在指定的区域内写磁盘.若ebuild越过沙盘保护的环境,试图在外部区域写磁盘,就构成了沙盘越界.<br />
<span id="more-10707"></span><br />
沙盘的用途:<br />
沙盘是portage用来协助调试ebuild的机制.主要目的是提供一个安全的受保护的环境系统来运行功能未知的程序.实质上,它提供了一个可以用于编译源码包但不会干扰操作系统其他部分运行的环境.</p>
<p>在ebuild的src_unpack,src_compile,src_test和src_install阶段,ebuild.sh都在沙盘内操作.</p>
<p>http://bugday.gentoo.org/sandbox.html</p>
<p>http://devmanual.gentoo.org/general-concepts/sandbox/index.html</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/02/10570/' rel='bookmark' title='Ebuild and emerge'>Ebuild and emerge</a></li>
<li><a href='http://www.lingcc.com/2008/02/27/9904/' rel='bookmark' title='gentoo的相关配置-make.conf'>gentoo的相关配置-make.conf</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2008/03/28/9963/' rel='bookmark' title='gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir'>gentoo如何处理被屏蔽(masked)的包   by 杨珂 转自linuxsir</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/03/07/10707/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>如何得到当前linux系统的页大小</title>
		<link>http://www.lingcc.com/2009/12/01/10171/</link>
		<comments>http://www.lingcc.com/2009/12/01/10171/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 04:30:10 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>

		<guid isPermaLink="false">http://lingcc.net/?p=10171</guid>
		<description><![CDATA[操作系统的页是虚拟存储的关键技术. [code lang="cpp"] #include &#60;unistd.h&#62; #include &#60;stdio.h&#62; int main() { int pageSize = getpagesize(); printf(&#34;Page size on your system = %i bytes\n&#34;, pageSize); return 0; } [/code] 在我电脑里的运行结果： [code light="true"] $./a.out Page size on your system = 4096 bytes [/code] 相关文章： 如何让程序屏蔽CTRL+C和CTRL+Z Expected unqualified-id before﻿ 查错 调用栈-你还记得吗？ 宏和内联函数 变参函数的压栈问题 Linux内存的属性
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/10/12/11305/' rel='bookmark' title='如何让程序屏蔽CTRL+C和CTRL+Z'>如何让程序屏蔽CTRL+C和CTRL+Z</a></li>
<li><a href='http://www.lingcc.com/2009/12/20/10372/' rel='bookmark' title='Expected unqualified-id before﻿ 查错'>Expected unqualified-id before﻿ 查错</a></li>
<li><a href='http://www.lingcc.com/2010/09/27/11251/' rel='bookmark' title='调用栈-你还记得吗？'>调用栈-你还记得吗？</a></li>
<li><a href='http://www.lingcc.com/2010/10/09/11296/' rel='bookmark' title='宏和内联函数'>宏和内联函数</a></li>
<li><a href='http://www.lingcc.com/2010/09/28/11264/' rel='bookmark' title='变参函数的压栈问题'>变参函数的压栈问题</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>操作系统的页是虚拟存储的关键技术.</p>
<p>[code lang="cpp"]<br />
#include &lt;unistd.h&gt;<br />
#include &lt;stdio.h&gt;<br />
int main()<br />
{<br />
int pageSize = getpagesize();<br />
printf(&quot;Page size on your system = %i bytes\n&quot;, pageSize);<br />
return 0;<br />
}<br />
[/code]</p>
<p>在我电脑里的运行结果：<br />
[code light="true"]<br />
$./a.out<br />
Page size on your system = 4096 bytes<br />
[/code]</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/10/12/11305/' rel='bookmark' title='如何让程序屏蔽CTRL+C和CTRL+Z'>如何让程序屏蔽CTRL+C和CTRL+Z</a></li>
<li><a href='http://www.lingcc.com/2009/12/20/10372/' rel='bookmark' title='Expected unqualified-id before﻿ 查错'>Expected unqualified-id before﻿ 查错</a></li>
<li><a href='http://www.lingcc.com/2010/09/27/11251/' rel='bookmark' title='调用栈-你还记得吗？'>调用栈-你还记得吗？</a></li>
<li><a href='http://www.lingcc.com/2010/10/09/11296/' rel='bookmark' title='宏和内联函数'>宏和内联函数</a></li>
<li><a href='http://www.lingcc.com/2010/09/28/11264/' rel='bookmark' title='变参函数的压栈问题'>变参函数的压栈问题</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2009/12/01/10171/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

