LinuxÖÐwaitÓ÷¨
LinuxÖÐwaitÓ÷¨£º
ϵͳÖеĽ©Ê¬½ø³Ì¶¼ÒªÓÉwaitϵͳµ÷ÓÃÀ´»ØÊÕ¡£
º¯ÊýÔÐÍ£º
#include<sys/types.h>
#include<sys/wait.h>
pid_t wait(int *status);
½ø³ÌÒ»µ©µ÷ÓÃÁËwait¾ÍÁ¢¼´×èÈû×Ô¼º£¬ÓÉwait×Ô¶¯·ÖÎöÊÇ·ñµ±Ç°½ø³ÌµÄij¸ö×Ó½ø³ÌÒѾÍ˳ö£¬Èç¹ûÈÃËüÕÒµ½ÁËÕâÑùÒ»¸öÒѾ±ä³É½©Ê¬µÄ×Ó½ø³Ì£¬wait¾Í»áÊÕ¼¯Õâ¸ö×Ó½ø³ÌµÄÐÅÏ¢£¬²¢°ÑËü³¹µ×Ïú»Ùºó·µ»Ø£»Èç¹ûûÓÐÕÒµ½ÕâÑùÒ»¸ö×Ó½ø³Ì£¬wait¾Í»áÒ»Ö±×èÈûÔÚÕâÀֱµ½ÓÐÒ»¸ö³öÏÖΪֹ¡£
²ÎÊýstatusÓÃÀ´±£´æ±»ÊÕ¼¯½ø³ÌÍ˳öʱµÄһЩ״̬£¬ËüÊÇÒ»¸öÖ¸ÏòintÀàÐ͵ÄÖ¸Õë¡£µ«Èç¹ûÎÒÃǶÔÕâ¸ö×Ó½ø³ÌÊÇÈçºÎËÀµôºÁ²»ÔÚÒ⣬ֻÏë°ÑÕâ¸ö½©Ê¬½ø³ÌÏûÃðµô£¬£¨ÊÂʵÉϾø´ó¶àÊýÇé¿öÏ£¬ÎÒÃǶ¼»áÕâÑùÏ룩£¬ÎÒÃǾͿÉÒÔÉ趨Õâ¸ö²ÎÊýΪNULL£¬¾ÍÏñÏÂÃæÕâÑù£º
pid = wait(NULL);
Èç¹û³É¹¦£¬wait»á·µ»Ø±»ÊÕ¼¯µÄ×Ó½ø³ÌµÄ½ø³ÌID£¬Èç¹ûµ÷Óýø³ÌûÓÐ×Ó½ø³Ì£¬µ÷Óþͻáʧ°Ü£¬´Ëʱwait·µ»Ø-1£¬Í¬Ê±errno±»ÖÃΪECHILD¡£
Àý×Ó£º
/*wait.c*/
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int main()
{
pid_t pc, pr;
pc = fork();
if ( pc < 0 ) /* Èç¹û³ö´í */
{
printf("create child prcocess error: %s\n", strerror(errno));
exit(1);
}
else if ( pc == 0) /* Èç¹ûÊÇ×Ó½ø³Ì */
{
printf("I am child process with pid %d \n", getpid());
sleep(3);/* ˯Ãß3ÃëÖÓ */
exit(0);
}
else /* Èç¹ûÊǸ¸½ø³Ì */
&nbs
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
À´Ô´£ºhttp://www.armjishu.com/index.php
´ó²¿·ÖÈ˶¼²»Ì«ÇåÎúµÄÒÉ»ó-----LinuxÖеĵØÖ·¿Õ¼ä
ÓÐÕâôһϵÁеÄÎÊÌ⣬ÊÇ·ñÔÚÀ§ÈÅ×ÅÄ㣺Óû§³ÌÐò±àÒëÁ¬½ÓÐγɵĵØÖ·¿Õ¼äÔÚʲô·¶Î§ÄÚ£¿Äں˱àÒëºóµØÖ·¿Õ¼äÔÚʲô·¶Î§ÄÚ£¿Òª¶ÔÍâÉè½øÐзÃÎÊ£¬I/OµÄµØÖ·¿Õ¼äÓÖÊÇʲôÑùµÄ£¿
ÏȻشðµÚÒ»¸öÎÊÌâ¡£Linux×î³£¼ûµÄ¿ÉÖ´ÐÐÎļþ¸ñʽΪelf(E ......
bootmÃüÁîÊÇÓÃÀ´Òýµ¼¾¹ýu-bootµÄ¹¤¾ßmkimage´ò°üºóµÄkernel imageµÄ£¬Ê²Ã´½Ð×ö¾¹ýu-bootµÄ¹¤¾ßmkimage´ò°üºóµÄkernel image£¬Õâ¸ö¾ÍÒª¿´mkimageµÄ´úÂ룬¿´¿´Ëü×öÁËЩʲô£¬ËäÈ»ÎÒºÜÏ£Íû´ó¼Ò²»ÒªÍµÀÁ£¬ÈÏÕæµØÈ¥¿´¿´£¬µ«ÊÇÎÒÖªµÀ»¹ÊÇÓкܶàÈËÀÁµÃÈ¥×öÕâ¼þ£¬ÄÇôÎÒ¾Íj½«·ÖÎömkimage´úÂëºóµÃµ½µÄ×Ü½á¸æËß´ó¼Ò£¬mkimage×öÁËÐ ......
MySQL :: Linux ÏÂ×Ô¶¯±¸·ÝÊý¾Ý¿âµÄ shell ½Å±¾
Linux ·þÎñÆ÷ÉϵijÌÐòÿÌì¶¼ÔÚ¸üРMySQL Êý¾Ý¿â£¬ÓÚÊǾÍÏëÆðдһ¸ö shell ½Å±¾£¬½áºÏ crontab£¬¶¨Ê±±¸·ÝÊý¾Ý¿â¡£Æäʵ·Ç³£¼òµ¥£¬Ö÷Òª¾ÍÊÇʹÓà MySQL ×Ô´øµÄ mysqldump ÃüÁî¡£
½Å±¾ÄÚÈÝÈçÏ£º
#!/bin/sh
# File: /home/mysql/backup.sh
# Database info
......
Ò»¡¢BootLoaderµÄ¸ÅÄî
BootLoaderÊÇϵͳ¼ÓµçÆôÔËÐеĵÚÒ»¶ÎÈí¼þ´úÂ룮»ØÒäÒ»ÏÂPCµÄÌåϵ½á¹¹ÎÒÃÇ¿ÉÒÔÖªµÀ£¬PC»úÖеÄÒýµ¼¼ÓÔØ³ÌÐòÓÉBIOS£¨Æä±¾ÖʾÍÊÇÒ»¶Î¹Ì¼þ³ÌÐò£©ºÍλÓÚÓ²ÅÌMBRÖеÄÒýµ¼³ÌÐòÒ»Æð×é³É¡£BIOSÔÚÍê³ÉÓ²¼þ¼ì²âºÍ×ÊÔ´·ÖÅäºó£¬½«Ó²ÅÌMBRÖеÄÒýµ¼³ÌÐò¶Áµ½ÏµÍ³µÄRAMÖУ¬È»ºó½«¿ØÖÆÈ¨½»¸øÒýµ¼³ÌÐò¡£Òý ......