⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1036.html

📁 著名的linux英雄站点的文档打包
💻 HTML
📖 第 1 页 / 共 4 页
字号:
#include &lt;linux/sched.h&gt;<br>
#include &lt;linux/tty.h&gt;<br>
#include &lt;linux/signal.h&gt;<br>
#include &lt;linux/errno.h&gt;<br>
#include &lt;linux/malloc.h&gt;<br>
#include &lt;linux/mm.h&gt;<br>
#include &lt;asm/io.h&gt;<br>
#include &lt;asm/segment.h&gt;<br>
#include &lt;asm/system.h&gt;<br>
#include &lt;asm/irq.h&gt;<br>
#include "drgn.h"<br>
static int drgn_trace;<br>
static int write_busy;<br>
static int read_busy;<br>
static struct drgn_buf * qhead;<br>
static struct drgn_buf * qtail;<br>
static int drgn_read(struct inode * , struct file * , char * , int );<br>
static int drgn_write(struct inode * , struct file * , const char *, int );<br>
static int drgn_ioctl(struct inode * , struct file * , unsigned int , unsig<br>
ned long );<br>
static int drgn_open(struct inode *,struct file *);<br>
static void drgn_release(struct inode *,struct file *);<br>
/* extern void console_print(char *);*/<br>
struct file_operations drgn_fops=<br>
{<br>
NULL,<br>
drgn_read,<br>
drgn_write,<br>
NULL,<br>
NULL,<br>
drgn_ioctl,<br>
NULL,<br>
drgn_open,<br>
drgn_release,<br>
NULL,<br>
NULL,<br>
NULL,<br>
NULL<br>
};<br>
void drgn_init(void)<br>
{<br>
drgn_trace=TRUE;<br>
if(register_chrdev(30,"drgn",&drgn_fops))<br>
TRACE_TXT("Cannot register drgn driver as major device 30.")<br>
else<br>
TRACE_TXT("Tiny devie driver registered successfully.")<br>
qhead=0;<br>
write_busy=FALSE;<br>
read_busy=FALSE;<br>
/* drgn_trace=FALSE;*/<br>
return;<br>
}<br>
static int drgn_open(struct inode * inode,struct file * file)<br>
{<br>
TRACE_TXT("drgn_open")<br>
switch (MINOR(inode-&gt;i_rdev))<br>
{<br>
case DRGN_WRITE:<br>
if(write_busy)<br>
return -EBUSY;<br>
else{<br>
write_busy=TRUE;<br>
return 0;<br>
}<br>
case DRGN_READ:<br>
if(read_busy)<br>
return -EBUSY;<br>
else{<br>
read_busy=TRUE;<br>
return 0;<br>
}<br>
default:<br>
return -ENXIO;<br>
}<br>
}<br>
static void drgn_release(struct inode * inode,struct file * file)<br>
{<br>
TRACE_TXT("drgn_release")<br>
switch (MINOR(inode-&gt;i_rdev))<br>
{<br>
case DRGN_WRITE:<br>
write_busy=FALSE;<br>
return;<br>
case DRGN_READ:<br>
read_busy=FALSE;<br>
return;<br>
}<br>
}<br>
static int drgn_write(struct inode * inode,struct file * file,<br>
const char * buffer,int count)<br>
{<br>
int i,len;<br>
struct drgn_buf * ptr;<br>
TRACE_TXT("drgn_write")<br>
if (MINOR(inode-&gt;i_rdev)!=DRGN_WRITE)<br>
return -EINVAL;<br>
if ((ptr=kmalloc(sizeof(struct drgn_buf),GFP_KERNEL))==0)<br>
return -ENOMEM;<br>
len=count &lt; MAX_BUF?count:MAX_BUF;<br>
if (verify_area(VERIFY_READ,buffer,len))<br>
return -EFAULT;<br>
for(i=0;i &lt; count && i&lt;MAX_BUF;++i)<br>
{<br>
ptr-&gt;buffer[i]=(char) get_user((char*)(buffer+i));<br>
TRACE_CHR("w")<br>
}<br>
ptr-&gt;link=0;<br>
if(qhead==0)<br>
qhead=ptr;<br>
else<br>
qtail-&gt;link=ptr;<br>
qtail=ptr;<br>
TRACE_CHR("")<br>
ptr-&gt;buf_size=i;<br>
return i;<br>
}<br>
static int drgn_read(struct inode * inode , struct file * file,<br>
char * buffer, int count)<br>
{<br>
int i,len;<br>
struct drgn_buf * ptr;<br>
TRACE_TXT("drgn_read")<br>
if(MINOR(inode-&gt;i_rdev)!=DRGN_READ)<br>
return -EINVAL;<br>
if (qhead==0)<br>
return -ENODATA;<br>
ptr=qhead;<br>
qhead=qhead-&gt;link;<br>
len=count &lt; ptr-&gt;buf_size?count:ptr-&gt;buf_size;<br>
if (verify_area(VERIFY_WRITE,buffer,len))<br>
return -EFAULT;<br>
for (i=0; i&lt;count && i&lt;ptr-&gt;buf_size; ++i)<br>
{<br>
put_user((char) ptr-&gt;buffer[i],(char *)(buffer+i));<br>
TRACE_CHR("r")<br>
}<br>
TRACE_CHR("")<br>
kfree_s(ptr,sizeof(struct drgn_buf));<br>
return i;<br>
}<br>
static int drgn_ioctl(struct inode * inode, struct file * file,<br>
unsigned int cmd, unsigned long arg)<br>
{<br>
TRACE_TXT("drgn_ioctl")<br>
/* if (cmd==DRGN_TRON){<br>
drgn_trace=TRUE;<br>
return 0;<br>
}<br>
else<br>
if (cmd==DRGN_TROFF){<br>
drgn_trace=FALSE;<br>
return 0;<br>
}<br>
else<br>
return -EINVAL;*/<br>
switch(cmd)<br>
{<br>
case DRGN_TRON:<br>
drgn_trace=TRUE;<br>
return 0;<br>
case DRGN_TROFF:<br>
drgn_trace=FALSE;<br>
return 0;<br>
default:<br>
return -EINVAL;<br>
}<br>
}
</FONT><br>
                                      </TD>
                                    </TR>
                                <TR>
                                <TD colSpan=2><FONT 
                                class=middlefont></FONT><BR>
                                        <FONT 
                                class=normalfont>全文结束</FONT> </TD>
                                    </TR>
                                <TR>
                                <TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2 
                                height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
                        <TD vAlign=top width="20%" 
                      background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2> 
                          <DIV align=center> 
                            <table class=tableoutline cellspacing=1 cellpadding=4 
                        width="100%" align=center border=0>
                              <tr class=firstalt> 
                                <td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
                                <font class=normalfont><b>所有分类</b></font></td>
                              </tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td>    </tr>  </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td>    </tr>  </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%>   <table width=100% border=0>    <tr>       <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td>    </tr>  </table></td></tr>                            </table>
                          </DIV></TD></TR>
                    <TR vAlign=top>
                        <TD width="80%"> 
                          <DIV align=center><BR>
                          </DIV>
                        </TD></TR></TBODY></TABLE></TD></TR>
                </TABLE></TD></TR>
          </TABLE>
      <TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee 
        border=0><TBODY>
        <TR>
          <TD width="50%">
              <P><FONT class=middlefont>版权所有 &copy; 2004 <A 
            href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
                违者必究. </FONT></P>
            </TD>
          <TD width="50%">
              <DIV align=right><FONT class=middlefont>Powered by: <A 
            href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
            </TD></TR></TBODY></TABLE>
      <CENTER></CENTER></TD></TR>
    </TABLE></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -