易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 :

linux getopts命令,处理shell脚本参数

#!/bin/bash
while getopts "ab:cd:" Option
# b and d take arguments
#
do
case $Option in
a) echo -e "a = $OPTIND";;
b) echo -e "b = $OPTIND $OPTARG";;
c) echo -e "c = $OPTIND";;
d) echo -e "d = $OPTIND $OPTARG";;
esac
done
shift $(($OPTIND - 1)) ......

linux sock_raw原始套接字编程

from:http://blog.chinaunix.net/u2/62281/showart_1096746.html
sock_raw原始套接字编程可以接收到本机网卡上的数据帧或者数据包,对与监听网络的流量和分析是很有作用的.一共可以有3种方式创建这种socket
 
1.socket(AF_INET, SOCK_RAW, IPPROTO_TCP|IPPROTO_UDP|IPPROTO_ICMP)发送接收ip数据包
2.socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP|ETH_P_ARP|ETH_P_ALL))发送接收以太网数据帧
3.socket(AF_INET, SOCK_PACKET, htons(ETH_P_IP|ETH_P_ARP|ETH_P_ALL))过时了,不要用啊
 
理解一下SOCK_RAW的原理, 比如网卡收到了一个 14+20+8+100+4 的udp的以太网数据帧.
 
首先,网卡对该数据帧进行硬过滤(根据网卡的模式不同会有不同的动作,如果设置了promisc混杂模式的话,则不做任何过滤直接交给下一层输
入例程,否则非本机mac或者广播mac会被直接丢弃).按照上面的例子,如果成功的话,会进入ip输入例程.但是在进入ip输入例程之前,系统会检查系
统中是否有通过socket(AF_PACKET, SOCK_RAW,
..)创建的套接字.如果有的话并且协议相符,在这个例子中就是需要ETH_P_IP或者ETH_P_ALL类型.系统就给每个这样的socket接收缓
冲区发送一个数据帧拷贝.然后进入下一 ......

LINUX使用记录

-------------------------------------------------------------------------------------------------------
By:yuyongbao
QQ:673360056
1、  linux下共享文件。安装smbserver。然后在《系统设置》中打开《服务器设置》的《smb server》服务器,输入相关路径即可。然后在window中,使用网络邻居查找linux。(注意:linux下的work group要与window一致.选择share .不要密码选项).最后,重启smb… 
2、  重启服务的命令为:/etc/init.d/smb restart
3、  linux下上网设置。将window下的两个vmware虚拟网卡设置成自动获取IP,然后,在linux下的网络设置里,设置IP为与window同一个网段,然后设置DNS与window相同即可。现在设置的linux IP为10.10.70.111。
4、  tar –jxvf 用来解.tar.bz2后缀的文件。而zxvf则用来解.tar.gz后缀的文件。
5、 解包:tar xvf FileName.tar
打包:tar cvf FileName.tar DirName打包目录。还可以加上zcvf或是jcvf选项变成.tar.gz或.tar.bz2的格式
6、  .压缩一组文件为tar.gz后缀。
# tar cvf backup.tar /etc
#gzip -q backup.tar

# tar cvfz backup.tar.gz /etc/
2.释放一 ......

从硬盘启动linux系统

 -------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
//平台powerpc mpc8379e linux 2.6.22
1、先用fdisk 给硬盘分一个区,用作文件系统。参照u-boot-ppc编译说明一文。
2、用mke2fs格式化硬盘的一个分区mke2fs /dev/sda2 (比如分区2)
3、设置u-boot参数。bootargs=root=/dev/sda2 rw console=ttyS0,115200 rootfstype=ext2
4、将ramdisk拷贝到硬盘的ext2分区。(可以将ramdisk挂到一个目录下,然后将其中的除dev目录之外的其余目录都拷贝过来。)
5、Usage: makedevs [-d device_table] rootdir
6、makedevs –d /device_table.txt /mnt/cdrom
7、其中-d device_table 为table文件的目录。它会在/mnt/cdrom目录下建立dev目录,并建立相应的nod点(根据device_table.txt来建立)
8、             启动信息见《从硬盘启动完整信息》
9、将setenv bootargs root=0810  rw console=ttyS0,115200 rootdelay=5将可以实现从u盘启动。setenv bootargs root=/dev/sdb1 rw console=ttyS0,11 ......

从SD卡启动linux系统

  -------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
//平台powerpc mpc8379e linux 2.6.22
1、先用fdisk 给SD卡分区,用作文件系统。
将读卡器插入PC机虚拟机,在PC机上执行fdisk /dev/sdb
选择n 。。。。。。。。步骤与硬盘分区一致。
2、用mkfs.ext3格式化SD卡的一个分区mke2fs /dev/sdb1 (比如分区1)
3、将SD卡挂载mount –t ext3 /dev/sdb1 /home/nfs ,然后将文件系统拷贝进去。
4、             设置u-boot参数。bootargs=root=b301 rw console=ttyS0,115200 rootdelay=5(或setenv bootargs root=/dev/mmcblk0p1 rw console=ttyS0,115200 rootdelay=5)
启动信息见《从SD启动完整信息》
启动信息(可能还有一小部分错误)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
U-Boot 1.3.0-rc2 (Apr 24 2008 - 01:32:37) MPC83XX
 
Reset Status:
 
CPU:&n ......

Linux执行以及虚拟内存之用

Linux Execution and Virtual Memory Utilization 
Linux执行以及虚拟内存之用
When Linux boots, it starts with the MMU disabled, so initially it deals only with physical 
memory. The kernel image is copied to physical address 0x8000 in DRAM and executed. First a master page table is created and placed just before the kernel, which describes all available DRAM. The MMU is then switched on, mapping all of DRAM to virtual address 0xC0000000. The kernel reserves 64K of virtual memory for the interrupt handler code (usually at the very top of virtual memory), and sets up all the mappings for the hardware registers (UART, USB, LCD, GPIO, etc). Once kernel space is established and all drivers are initialized, the linux kernel moves on to establishing user space. This involves reading in the file system and actually executing processes. 
当Linux启动时,是以MMU禁用来开启它的旅途的,因此,它起初只关注物理内存。内核映像(kernel image)被拷贝到DRAM的物理地址 0x8000处,并得到执行权。 ......
总记录数:40319; 总页数:6720; 每页6 条; 首页 上一页 [6544] [6545] [6546] [6547] 6548 [6549] [6550] [6551] [6552] [6553]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号