Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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
 
²âÊÔ½á¹û


Ïà¹ØÎĵµ£º

LinuxÄÚºËÅäÖÃÎĵµ(make menuconfig)

Ò»¡¢ÒýÑÔ£º
    ±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØͼ£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾­Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾­Ñ飨Õâ¸ö»¹µ ......

Èý¿î Linux ϵÄÃâ·Ñ×ÀÃ漶ɱ¶¾Èí¼þ(ͼ)


ÓÉÓÚ Linux Á¼ºÃµÄÓû§È¨ÏÞ¹ÜÀíÌåϵ£¬²¡¶¾ÍùÍùÊÇ Linux ϵͳ¹ÜÀíÔ±×îºó²ÅÐèÒª¿¼ÂǵÄÎÊÌâ¡£ÒÔÍù£¬Linux ÉϵÄɱ¶¾Èí¼þÖ÷ÒªÊÇΪÆóÒµµÄÓʼþºÍÎļþ·þÎñÆ÷ËùÉè¼ÆµÄ¡£Èç½ñ£¬Ëæ×Å Linux ×ÀÃæÓû§ÊýÁ¿µÄÔö³¤£¬×ÀÃæÓû§ÔÚÊÜÒæÓÚ Linux ϵͳ¶Ô²¡¶¾½ÏÇ¿µÄÌìÈ»ÃâÒßÁ¦µÄͬʱ£¬Ò²ÐèҪɱ¶¾Èí¼þÇåÀí´ÓÍøÂç»òUÅÌ´øÀ´µÄWIndows²¡¶¾¡£¾¡¹ÜÄÇЩ ......

LinuxÃüÁî find grep vim²å¼þ

linux find ÃüÁîʹÓÃ
-name Ñ¡Ïî
ÎļþÃûÑ¡ÏîÊÇfindÃüÁî×î³£ÓõÄÑ¡ÏҪôµ¥¶ÀʹÓøÃÑ¡ÏҪôºÍÆäËûÑ¡ÏîÒ»ÆðʹÓá£
¿ÉÒÔʹÓÃijÖÖÎļþÃûģʽÀ´Æ¥ÅäÎļþ£¬¼ÇסҪÓÃÒýºÅ½«ÎļþÃûģʽÒýÆðÀ´¡£
ÏëÒªµÄµ±Ç°Ä¿Â¼¼°×ÓĿ¼ÖвéÕÒÎļþÃûÒÔÒ»¸ö´óд×Öĸ¿ªÍ·µÄÎļþ£¬¿ÉÒÔÓãº
$ find . -name "[A-Z]*" -print
ÏëÒªÔÚ/etcĿ¼Öв ......

linuxϵͳÏ°²×°flashplayer

µÚÒ»²½:ÏÂÔØ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 µÃµ½Ò»¸öͬÃûÎļ ......

fork compare to exec in linux c program

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ