Linux Ï CÓïÑÔ´óÎļþ¶Áд(´óÓÚ4G£©
ÒÔϵÄ×ö·¨ÕûÀí×ÔÂÛ̳ÉϵÄÌû×Ó¡£
ÈçºÎcreate´óÎļþ
Òª´ó¾Í·Ç³£´ó£¬1T°É¡£
ÓÐÁ½ÖÖ·½·¨£º
Ò».dd
dd if=/dev/zero of=1T.img bs=1G seek=1024 count=0
bs=1G±íʾÿһ´Î¶Áд1GÊý¾Ý£¬count=0±íʾ¶Áд0´Î£¬seek=1024±íʾÂÔ¹ý1024¸öBlock²»Ð´£¬Ç°Ãæblock sizeÊÇ1G£¬ËùÒÔ¹²ÂÔ¹ý1T£¡
ÕâÊÇ´´½¨´óÐÍsparseÎļþ×î¼òµ¥µÄ·½·¨¡£
¶þ.ftruncate64/ftruncate
Èç¹ûÓÃϵͳº¯Êý¾ÍÉÔ΢ÓÐЩÂé·³£¬ÒòÎªÉæ¼°µ½ºêµÄÎÊÌâ¡£ÎÒ»á½áºÏÒ»¸öʵ¼ÊÀý×ÓÏêϸ˵Ã÷£¬ÆäÖÐOPTION±êÖ¾µÄ¾ÍÊDzâÊÔÏî¡£
Îļþsparse.c:
//OPTION 1:ÊÇ·ñ¶¨ÒåÓë´óÎļþÏà¹ØµÄºê
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#define FILENAME "bigfile"
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
int main(int argc, char **argv)
{
int fd, ret;
off_t offset;
int total = 0;
if ( argc >= 2 )
{
total = atol(argv[1]);
printf("total=%d\n", total);
}
//OPTION 2:ÊÇ·ñÓÐO_LARGEFILEÑ¡Ïî
//fd = open(FILENAME, O_RDWR|O_CREAT|O_LARGEFILE, 0644);
fd = open(FILENAME, O_RDWR|O_CREAT, 0644);
if (fd < 0) {
perror(FILENAME);
return -1;
}
offset = (off_t)total *1024ll*1024ll*1024ll;
printf("offset=%ld\n", offset);
//OPTION 3£ºÊÇ·ñµ÷ÓÃ64λϵͳº¯Êý
//if (ftruncate64(fd, offset) < 0)
if (ftruncate(fd, offset) < 0)
{
printf("[%d]-ftruncate64 error: %s\n", errno, strerror(errno));
close(fd);
return 0;
}
close(fd);
printf("OK\n");
return 0;
}
²âÊÔ»·¾³£º
linux:/disk/test/big # gcc --version
gcc (GCC) 3.3.5 20050117 (prerelease) (SUSE Linux)
linux:/disk/test/big # uname -a
Linux linux 2.6.11.4-20a-default #1 Wed Mar 23 21:52:37 UTC 2005 i686 i686 i386 GNU/Linux
²âÊÔ½á¹û
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
µÚÒ»²½:ÏÂÔØFLASHµÄ²å¼þ
http://www.adobe.com/ÔÚÕâ¸öÒ³ÃæÉÏÓкܶà²å¼þ,ÔÚÕâÀïÄãÖ»ÓÃÏÂÔØ
ÎļþÃû×Ö:install_flash_player_9_linux.tar.gz
µÚ¶þ²½:½âѹÎļþ°ü
µ±Ç°µÄ¹¤×÷Ŀ¼ÊÇ:USR
[root@isitqnx usr]#tar zvxf install_flash_player_7_linux.tar.gz µÃµ½Ò»¸öͬÃûÎļ ......
pid_t pid=fork()
it has 3 situation for the return result pid
0 child
>0 parent process
<0 fork fail
fork create a new process and it parent live alse when the child process had been created ......
http://www.edn.com/article/457428-Can_C_beat_RTL_.php
With the appearance of higher speeds and more DSP macrocells in low-cost FPGAs, more and more design teams are seeing the configurable chips not as glue but as a way to accelerate the inner loops of numerical algorithms, either in conjun ......
; ±àÒëÁ´½Ó·½·¨
; (ld µÄ‘-s’Ñ¡ÏîÒâΪ“strip all”)
; gcc -c not link
;
; [root@XXX XXX]# nasm -f elf foo.asm -o foo.o
; [root@XXX XXX]# gcc -c bar.c -o bar.o
; [root@XXX XXX]# ld -s foo.o bar.o -o foobar
; [root@XXX XXX]# ./foobar
; the 2nd one
; [root@XXX XXX]#
exter ......