LINUXÆÚÄ©¸´Ï° ½ø³ÌÓë½ø³Ì¹ÜÀí
Ò»¡¢LINUXµÄ½ø³Ì״̬ ½©ËÀ̬£ºµ±¸¸½ø³Ì»¹Ã»ÓнáÊøÇ°£¬×Ó½ø³Ì¾ÍÒѾÏȽáÊøÁË£¬Õâʱ×Ó½ø³ÌµÄ×ÊԴûÓÐÈËÀ´»ØÊÕ¡£Í¨³£¸¸½ø³ÌÐèÒªÓÃwaitÀ´µÈ´ý×Ó½ø³ÌµÄ½áÊø¡£
½ø³ÌµÄģʽ£ºÓû§Ä£Ê½(Ö´ÐÐÓû§³ÌÐò)£¬ÄÚºËģʽ(Ö´ÐвÙ×÷ϵͳ´úÂë)
½ø³ÌµÄÀàÐÍ£ºÏµÍ³½ø³Ì£¬Óû§½ø³Ì ¶þ¡¢½ø³Ì¹ÜÀí ¢Ùforkº¯Êý
¹¦ÄÜ£º´´½¨Ò»¸öȫеĽø³Ì¡£
Í·Îļþ£º
#include
#include
º¯ÊýÔÐÍ£ºpid_t wait (int * status);
˵Ã÷£ºÕâ¸öϵͳµ÷ÓöԵ±Ç°½ø³Ì½øÐи´ÖÆ£¬ÔÚ½ø³Ì±íÀï´´½¨³öÒ»¸öÏîÄ¿£¬Ð½ø³ÌÓëÔ½ø³Ì¼¸ºõÒ»Ñù£¬Ö´ÐеÄÊÇÏàͬµÄ´úÂ룬ֻÊÇнø³ÌÓÐ×Ô¼ºµÄÊý¾Ý¿Õ¼ä¡¢»·¾³ºÍÎļþÃèÊö·û¡£
·µ»ØÖµ£º¸¸½ø³Ìµ÷Ó÷µ»ØÐÂ×Ó½ø³ÌID£¬Ð½ø³Ì¼ÌÐøÖ´ÐУ»ÔÚ×Ó½ø³Ì·µ»Ø0¡£
¾ÙÀý£º
pid_t new_pid;
new_pid = fork();
switch(new_pid)
{
case -1:break;
case 0:break
default:break;
} ¢Úwaitº¯Êý
º¯Êý´¦ÀíµÄ»ù±¾¹ý³Ì£º
—Èç¹û¸¸½ø³ÌûÓÐ×Ó½ø³Ì£¬Ôò³ö´í·µ»Ø¡£
—Èç¹û·¢ÏÖÓÐÒ»¸öÖÕÖ¹µÄ×Ó½ø³Ì£¬ÔòÈ¡³ö×Ó½ø³ÌµÄ½ø³ÌºÅ£¬°Ñ×Ó½ø³ÌµÄCPUʹÓÃʱ¼äµÈ¼Óµ½¸¸½ø³ÌÉÏ£¬ÊÍ·Å×Ó½ø³ÌÕ¼ÓõÄtask_structºÍϵͳ¿Õ¼ä¶ÑÕ»£¬ÒÔ¹©Ð½ø³ÌʹÓá£
—Èç¹û·¢ÏÖÓÐ×Ó½ø³Ì£¬µ«¶¼²»´¦ÓÚÖÕֹ̬£¬Ôò¸¸½ø³Ì˯Ãߣ¬µÈ´ýÓÉÏàÓ¦µÄÐźŻ½ÐÑ¡£
¹¦ÄÜ£ºµÈ´ý×Ó½ø³ÌÖжϻò½áÊø
Í·Îļþ:
#include
#include
º¯ÊýÔÐÍ:pid_t wait (int * status);
˵Ã÷£ºº¯Êý»áÔÝʱֹͣĿǰ½ø³ÌµÄÖ´ÐУ¬Ö±µ½ÓÐÐźÅÀ´µ½»ò×Ó½ø³Ì½áÊø¡£Èç¹ûÔÚµ÷ÓÃwait()ʱ×Ó½ø³ÌÒѾ½áÊø£¬Ôòwait()»áÁ¢¼´·µ»Ø×Ó½ø³Ì½áÊø״ֵ̬¡£×Ó½ø³ÌµÄ½áÊø״ֵ̬»áÓɲÎÊýstatus ·µ»Ø£¬¶ø×Ó½ø³ÌµÄ½ø³Ìʶ±ðÂëÒ²»áͬʱ·µ»Ø¡£Èç¹û²»ÔÚÒâ½áÊø״ֵ̬£¬Ôò²ÎÊýstatus¿ÉÒÔÉè³ÉNULL¡£×Ó½ø³ÌµÄ½áÊø״ֵ̬Çë²Î¿¼waitpid()¡£
·µ»ØÖµ£ºÈç¹ûÖ´Ðгɹ¦Ôò·µ»Ø×Ó½ø³Ìʶ±ðÂë(PID)£¬Èç¹ûÓдíÎó·¢ÉúÔò·µ»Ø-1¡£Ê§°ÜÔÒò´æÓÚerrnoÖС£
¾ÙÀý£º
¢Ûexeclº¯Êý
Í·Îļþ£º#include
º¯ÊýÔÐÍ£º
int execl(const char * path,const char * arg,....);
·µ»ØÖµ£º³É¹¦Ôòº¯Êý²»»á·µ»Ø£¬Ö´ÐÐʧ°ÜÔòÖ±½Ó·µ»Ø-1£¬Ê§°ÜÔÒò´æÓÚerrnoÖС£
˵Ã÷£º
execl()ÓÃÀ´Ö´ÐвÎÊýpath×Ö·û´®Ëù´ú±íµÄÎļþ·¾¶£¬²ÎÊý´ú±íÖ´ÐиÃÎļþʱ´«µÝ¹ýÈ¥µÄargv(0)¡¢argv[1]¡¡£¬×îºóÒ»¸ö²ÎÊý±ØÐëÓÿÕ
Ïà¹ØÎĵµ£º
¹ØÓÚϵͳµ÷ÓýٳÖ
Èç¹ûÒ»¸öľÂíÒªÒþ²ØÆðÀ´£¬²»±»ÏµÍ³¹ÜÀíÔ±·¢ÏÖ¡£½Ø»ñϵͳµ÷ÓÃËƺõÊDZØÐëµÄ¡£´ó²¿·ÖÇé¿öÏ£¬Í¨¹ýÐÞ¸Äϵͳµ÷ÓñíÀ´ÊµÏÖϵͳµ÷ÓõĽٳ֡£ÏÂÃæÊÇÒ»¸öµäÐ͵Ľػñϵͳµ÷ÓõÄÄ£¿é£º
Ä£¿éÒ»£º
#include
#include
#include
#include
#include
#include
#include
#include
#include
MODULE_LICE ......
At first you have to open a terminal/bash and then enter:
file /path/file.bin
for example file /home/user/file.bin (file is the command)
Now you should see a sentence including the word “executable” and not “non-executable, not executable,… or something completely differ ......
linuxϹ¹½¨½¨ÉèÍêÃÀFTP·þÎñÆ÷£¬¿É¹ÜÀí£¬WEB¹ÜÀí£¬¹ÜÀí½çÃæ¡£
Ò»¡¢°²×°Ubuntu5 Desktop°æ
°²×°¹ý³Ì²»ÄÑ£¬ÒÀÕÕhttp://wiki.ubuntu.org.cn¿ìËÙÉèÖü´¿É,×¢ÒâÏÂÃæÁ½µã£º
1¡¢ÍøͨÓû§ÇëÑ¡ÔñÉϺ£½»´óµÄÔ´£¬±È½Ï¿ì¡£
2¡¢ms·ÖÇøϵÄÖÐÎÄĿ¼ÃûÏÔʾΪ£¿£¿£¿
Õâʱ£¬ÄãÒª±à¼/etc/fstab¡£±ÈÈçÎҵıʼDZ¾ÖеÄfstabÎļþ¸ÄºóÊÇ£º
# ......
vi /etc/rc.d/rc.local
Ôö¼Ó£º/usr/local/httpd/bin/apachectl start
2£º[×¢²áΪService]
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
vi httpd
ÕÒµ½£º#!/bin/sh
ÁíÆðÒ»ÐУ¬Ôö¼Ó£º
# chkconfig: 35 70 30
ÆäÖÐËùÔö¼ÓµÄµÚ¶þÐÐÖÐÈý¸öÊý×ÖµÚÒ»¸ö±íʾÔÚÔËÐ춱ð3ºÍ5ÏÂÆô¶¯apache£¬µÚ¶þ¡¢ÈýÊǹØÓÚÆô¶¯ºÍÍ ......
Ò»¡¢
±³¾°
1
£®Ê²Ã´ÊÇ
Apache
£¿
Apache£¬ÊÇÒ»ÖÖ¿ª·ÅÔ´ÂëµÄ
HTTP·þÎñÆ÷£¬¿ÉÒÔÔÚ´ó¶àÊý²Ù×÷ϵͳÖÐÔËÐУ¬ÓÉÓÚÆä¶àƽ̨ºÍ°²È«ÐÔËùÒÔ±»¹ã·ºÊ¹Óã¬ÊÇÄ¿Ç°×îÁ÷ÐеÄ
Web·þÎñÆ÷Èí¼þÖ®Ò»¡£
Apache Æð³õÓÉ
Illinois ´óѧ
Urbana-Champaign µÄ¹ú¼Ò¸ß¼¶¼ÆËã³ÌÐòÖÐÐÄ¿ª·¢£¬¿ªÊ¼
A ......