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

linux½ø³ÌͨÐÅ ÐźÅÁ¿Ê¹ÓÃ

±êÌ⣺Linux½ø³ÌͨÐÅ-ʹÓÃÐźÅÁ¿
Ò»¡¢Ïà¹Ø֪ʶ
 ÐźÅÁ¿£ºÒ»¸öÕûÊý£»
  ´óÓÚ»òµÈÓÚ0ʱ´ú±í¿É¹©²¢·¢½ø³ÌʹÓõÄ×ÊԴʵÌåÊý£»
  СÓÚ0ʱ´ú±íÕýÔڵȴýʹÓÃÁÙ½çÇøµÄ½ø³ÌÊý£»
  ÓÃÓÚ»¥³âµÄÐźÅÁ¿³õʼֵӦ´óÓÚ0£»
  Ö»ÄÜͨ¹ýP¡¢VÔ­Óï²Ù×÷¶ø¸Ä±ä£»
 ÐźÅÁ¿ÔªËØ×é³É£º
  1¡¢±íʾÐźÅÁ¿ÔªËصÄÖµ£»
  2¡¢×îºó²Ù×÷ÐźÅÁ¿ÔªËصĽø³ÌID
  3¡¢µÈ´ýÐźÅÁ¿ÔªËØÖµ+1µÄ½ø³ÌÊý£»
  4¡¢µÈ´ýÐźÅÁ¿ÔªËØֵΪ0µÄ½ø³ÌÊý£»
 
¶þ¡¢Ö÷Òªº¯Êý
 
 1.1 ´´½¨ÐźÅÁ¿
 int semget(
  key_t key,  //±êʶÐźÅÁ¿µÄ¹Ø¼ü×Ö£¬ÓÐÈýÖÖ·½·¨£º1¡¢Ê¹ÓÃIPC——PRIVATEÈÃϵͳ²úÉú£¬
     // 2¡¢ÌôÑ¡Ò»¸öËæ»úÊý£¬3¡¢Ê¹ÓÃftok´ÓÎļþ·¾¶ÃûÖвúÉú
  int nSemes,  //ÐźÅÁ¿¼¯ÖÐÔªËظöÊý
  int flag  //IPC_CREAT£»IPC_EXCL Ö»ÓÐÔÚÐźÅÁ¿¼¯²»´æÔÚʱ´´½¨
 )
 ³É¹¦£º·µ»ØÐźÅÁ¿¾ä±ú
 Ê§°Ü£º·µ»Ø-1
 
 1.2 ʹÓÃftokº¯Êý¸ù¾ÝÎļþ·¾¶Ãû²úÉúÒ»¸ö¹Ø¼ü×Ö
 key_t ftok(const char *pathname,int proj_id);
 Â·¾¶Ãû³Æ±ØÐëÓÐÏàӦȨÏÞ
 
 1.3 ¿ØÖÆÐźÅÁ¿
 int semctl(
  int semid,  //ÐźÅÁ¿¼¯µÄ¾ä±ú
  int semnum,  //ÐźÅÁ¿¼¯µÄÔªËØÊý
  int cmd,  //ÃüÁî
  /*union senum arg */... // 
 )
 ³É¹¦£º·µ»ØÏàÓ¦µÄÖµ
 Ê§°Ü£º·µ»Ø-1
 
 ÃüÁîÏêϸ˵Ã÷:
 cmd:   IPC_RMID ɾ³ýÒ»¸öÐźÅÁ¿
  IPC_EXCL Ö»ÓÐÔÚÐźÅÁ¿¼¯²»´æÔÚʱ´´½¨
  IPC_SET ÉèÖÃÐźÅÁ¿µÄÐí¿ÉȨ
  SETVAL ÉèÖÃÖ¸¶¨ÐźÅÁ¿µÄÔªËصÄֵΪ agc.val
  GETVAL »ñµÃÒ»¸öÖ¸¶¨ÐźÅÁ¿µÄÖµ
  GETPID »ñµÃ×îºó²Ù×Ý´ËÔªËصÄ×îºó½ø³ÌID
  GETNCNT »ñµÃµÈ´ýÔªËرäΪ1µÄ½ø³ÌÊý
  GETZCNT »ñµÃµÈ´ýÔªËرäΪ0µÄ½ø³ÌÊý
 
 union senum ¶¨ÒåÈçÏ£º
 union senum{
  int val;
  struct semid_ds *buf;
  unsigned short * array;
 }agc;
 ÆäÖÐ semid_ds ¶¨ÒåÈçÏ£º
 struct semid_ds{
  struct ipc_pem sem_pem;  //operation pemission struct
  time_t sem_otime;  //last semop()time
  time_t sem_ctime;  //last


Ïà¹ØÎĵµ£º

Linux ºÍ ¶àÏß³Ì

ÿ´Î¶¼ÊÇÓõ½£¬²éһϣ¬Ð´Ï£¬Õâ´ÎÉÔ΢¼Ç¼Ï±ʼǡ£
ºÍThreadÏà¹Ø£¬»ù±¾µÄÓÐ3¸ö¸ÅÄÏ̵߳Ľ¨Á¢ºÍÏú»Ù£»Ïß³ÌËø£»Ïß³ÌÌõ¼þ
¹ØÓÚ½¨Á¢Ị̈߳º
ret = pthread_create(&thread_id, NULL, Do_Thread, &Do_Thread_Para);
// µÚ2²ÎÊýÊÇthread ÊôÐÔ£¬Ò»°ãÎÒ²»ÓÃÉèÖÃ
// µÚ4¸ö²ÎÊýÊÇDo_ThreadµÄÈë¿Ú²ÎÊý£¬Ò»°ãÎÒ´«Ò»¸ö½á ......

Linux ѧϰʹÓà iptables


ÔÚÕýʽ½éÉÜ iptables
µÄʹÓÃ
֮ǰ£¬ÎÒÃÇÏÈÀ´¿´Ò»ÏÂºÍ iptables

Ïà¹ØµÄһЩ»ù±¾¸ÅÄî¡£ÎÒÃÇÏÂÃ潫»áƵ·±Ê¹ÓÃ
µ½
ËüÃÇ¡£
Æ¥Å䣨match£©£º·ûºÏÖ¸¶¨µÄÌõ¼þ£¬±ÈÈçÖ¸¶¨µÄ IP µØÖ·ºÍ¶Ë¿Ú¡£
¶ªÆú£¨drop£©£ºµ±Ò»¸ö°üµ½´ïʱ£¬¼òµ¥µØ¶ªÆú£¬²»×öÆäËüÈκδ¦Àí¡£
½ÓÊÜ£¨accept£©£ººÍ¶ªÆúÏà·´£¬½ÓÊÜÕâ¸ö°ü£¬ÈÃÕâ¸ö°üͨ¹ý¡£
¾ ......

LinuxÏÂTelnet¡¢ssh·þÎñµÄÅäÖúÍʹÓÃ

¡¡¡¡Telnet·þÎñµÄÅäÖò½ÖèÈçÏÂ:
¡¡¡¡Ò»¡¢°²×°telnetÈí¼þ°ü(ͨ³£ÒªÁ½¸ö£©¡£
¡¡¡¡1¡¢ telnet-client (»ò telnet)£¬Õâ¸öÈí¼þ°üÌṩµÄÊÇ telnet ¿Í»§¶Ë³ÌÐò£»
¡¡¡¡2¡¢ÊÇ telnet-server Èí¼þ°ü£¬Õâ¸ö²ÅÊÇÕæÕýµÄ Telnet server Èí¼þ°ü£¡
¡¡¡¡°²×°Ö®Ç°Ïȼì²âÊÇ·ñÕâЩÈí¼þ°üÒÑ°²×°£¬·½·¨ÈçÏ£º
¡¡¡¡[root@wljs root]#rpm &ndas ......

linux shell½Å±¾Ö®ifÅжÏ

ÎÞÂÛʲô±à³ÌÓïÑÔ¶¼Àë²»¿ªÌõ¼þÅжϡ£SHELLÒ²²»ÀýÍâ¡£
 if list then
          do something here
      elif list then
          do another thing here
      ......

Linux Ï etc/ Ŀ¼ÎļþÏê½â

3. ÍøÂçÅäÖÃÎļþ
3.1 /etc/hosts
#/etc/hosts
#Îļþ¸ñʽ: IPaddress hostname aliases
#Îļþ¹¦ÄÜ: ÌṩÖ÷»úÃûµ½IPµØÖ·µÄ¶ÔÓ¦¹Øϵ£¬½¨Ò齫×Ô¼º¾­³£Ê¹ÓõÄÖ÷»ú
# ¼ÓÈë´ËÎļþÖУ¬Ò²¿É½«Ã»ÓÐDNS¼Ç¼µÄ»úÆ÷¼ÓÈëµ½´ËÎļþÖУ¬
# ÕâÑù»á·½±ãÍøÂçÓ¦ÓÃ
127.0.0.1 localhost localhost.localdomain
202.118.66.81 helius.dlut. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ