<<
Home , API

NU IX SYSTEM RP OGR IMMA GN

cejbuS t Code: 01 CS62 I.A. M ra ks : 25 H ruo s/Week : 04 axE m Hours: 30 oT tal Ho ru s : 52 Exam M ra ks: 100

RAP T – A

INU T – 1 6 Hours Introduction: a dn ANSI Stan ad rd :s The NA SI C Standard, The AN OSI/IS ++C Standa sdr , Dif ef re cn e between NA SI C and C ++ , The POSIX Stand dra ,s The POSIX.1 FIPS Standard, The X/Open S at ndards. a dn P ISO X AP :sI The P SO IX , The NU IX and POSIX Development nE v ori nment, API ommoC n hC a car teris it cs.

NU IT – 2 6 oH urs INU X F seli : F li e Types, The XINU a dn P ISO X F li e Sy ts em, The UNIX a dn P XISO F li e tubirttA es, onI des in INU X Sy ts em V, App il ac it on Program tnI e fr ace ot Fi el s, XINU Kernel Sup op tr for F li es, Rela it ons ih p of C St er am P io n ret s and F eli Descript ro s, D rotceri y eliF s, H ra d and Symbolic Links.

NU IT – 3 7 Hours NU IX liF e APIs: General File AP sI , F li e and eR cord Loc ik ng, Directory F li e AP ,sI Devi ec File APIs, F OFI F li e AP sI , Symbol ci Link F li e APIs, Gener la F eli Cla ,ss re fg eli lC a ss of r Re alug r F li e ,s di fr li e Class for Di cer tory F li es, FIFO File lC ass, Device F eli Class, Symbo cil Link Fi el lC ass, F li e Listing Pro rg am.

NU IT – 4 7 Hours INU X Pro ec ss se : The Env mnori e tn of a UNIX Pro ec :ss In ort d oitcu ,n main f nu c it o ,n P or ec ss www.vtucs.comTe mr ination, Co mm and-L ni e Argume tn s, nE v mnori e tn Lis ,t Memory Layo tu of a C Progra ,m Shared Lib ar rie ,s Me om ry Allo tac io ,n Env ri onme tn Va ir ables, setjmp a dn longj pm F nu c oit ns, ge lrt im ti , se lrt i tim Fu tcn i no s, UNIX K re n le Supp ro t for

Proce ss es.

Dept.of CS&E,SJBIT AP RT - B NU IT – 5 7 Hours Proce ss Control : udortnI c it on, P or ec ss Identifiers, f ro k, vfork, exit, wait, w ia tpid, w ia t ,3 w ia t4 F tcnu io sn , Ra ec noC d ti ions, xe ec Fun tc i no s, Changing sU er DI s and rG o pu sDI , tnI erpreter F li es, sy ts em Func it on, Pro ec ss A cc ountin ,g User Identif taci io ,n Pro ec ss Time ,s I/O Redirection. P or ec ss Rela pihsnoit :s udortnI c oit n, Terminal Logi sn , Net ow rk Logi sn , P or ec ss uorG ps, Se noiss s, Co illortn ng Ter nim al, tcgetpgrp and tcsetpgrp Func snoit , Job ,lortnoC xE ec itu on of Progra sm , Orphaned G uor ps.

NU IT – 6 7 Hours S gi n sla a dn aD emon Proce ss es: Signal :s The NU IX Kernel Support for Signals, signal, Signal Mask, is gac it on, The SIGCHLD Signal and the wa dipti F nu c it no , The sigsetjmp a dn s gi longj pm F nu c it ons, Kill, lA arm, nI terv la Ti rem ,s POSI .X lb T mi ers. Dae nom P cor e ss es: I udortn c it on, Daemon hC ar ca te tsir ics, Cod ni g R lu es, rrE or L go gin ,g Client-Server M do el.

NU IT – 7 6 Hours Interpro sec s Commu cin ation – :1 Overview of IPC Method ,s Pipes, pope ,n pc esol F nu c ,snoit rpoC o ec sses, FIF sO , Sy ts em V IPC, Me ss age Queues, Sema ohp res.

NU IT – 8 6 Hours Interpro ec ss Co mm uni ac t oi n – 2: S erah d Me rom y, Client-Server P or per it es, Stream Pipes, Pa ss i gn F eli Descript ro s, An Open Server-Version ,1 C il ent-Server noC n tce ion F cnu tions.

www.vtucs.com

Dept.of CS&E,SJBIT xeT t oB oks:

1. T erre n ec Chan: INU X Sy ts em P or gra mm ing U is ng +C +, Pren it ce H lla nI d ai , 91 99. C( hapters 1, 5, 6, 7, 8, 9, 1 )0 2. W. R hci ard tS e ev ns: Advanced Pro marg ming in the NU IX Envi or nment, 2 dn Ed oiti n, Pearson Education, 2005. C( hapters 7, 8, 9, 13, 14, 1 )5

eR f re e cn e Books:

1. Marc .J oR chkind: dA vanced XINU Progra mm ing, 2 dn Ed iti on, Pearson Education, 2 00 5. 2. Ma iru ec J Bach: The De is gn of eht UNIX Operating Sy ts em, Pearson Education, 1 89 7. 3. Ure hs Va lah ia: U XIN tnI erna sl : The New Fro itn ers, Pearson Education, 2 00 1.

www.vtucs.com

Dept.of CS&E,SJBIT

T elba o f noc t ne ts

Sl no Ch tpa re Des rc ip oit n egaP no

1 TINU 1 – I noitcudortn … …………………… ……. ………………….… . 1- 6

2 TINU 2 – inU x .……………seliF ..… ……… …… …………………… … 7-9

3 TINU 3 – inU x eliF A PI s’ ……… …… ……… …… .…………………… . 10-36

4 TINU 4 – inU x sessecorP .. ……… …………… …… ………………… … 73 -41

5 TINU 5 – ssecorP ortnoC l ………… ………… …… …………………… . 24 -73

6 TINU 6 – iS g slan & eaD m no ..……ssecorP …… … .……… ………… … 47 - 01 7

7 TINU 7 – I ssecorpretn oC mm noitacinu … ……… … ………………… … 801 - 931

8 TINU 8 – eN twork I :CP S co k …ste .………… …… …………… .……… . 041 - 741

www.vtucs.com

Dept.of CS&E,SJBIT INU X S YS MET PROGRAMM GNI

NI TRODUCT OI N

.1 1 XINU DNA SNA I St na d dra s hT e ISO tnI( erna oit nal Sta dn a dr s rO ga zin a )noit d fe ines “sta dn a dr s a er doc mu ented agr ee ments c niniatno g t ce hn ci al eps cifi ac t noi s or o ht er pre esic c ir t aire to eb su ed c sisno te ltn y as ur les, g diu e il nes or ed f ni i noit s fo char ca te tsir ics to e usn re ht at materials, udorp cts, orp c sse es and servi ec s a re if t f ro their pu sopr e .” tsoM offic ai l c pmo uter sta dn a dr s a er set by eno of eht f niwollo g ro ga zin a it o :sn

 NA SI mA( e ir ac n Na oit nal Standa sdr snI t uti te)

 UTI tnI( e nr a oit nal eleT c mo m inu c oita n noinU )

 EEEI etutitsnI( of elE c rt ical a nd Ele cinortc nE g ni ee sr )

 ISO tnI( e nr a oit nal Standa sdr O rga zin a noit )

 EV SA diV( eo Elec inort cs tS anda sdr

.1 2 ehT NA SI C St na ad dr sihT sta dn ard was soporp ed by mA erican NA SI ni the year 9891 f ro C orp gra nimm g Language sta dn ard called X3. 951 - 9891 to standa ezidr the C orp gram nim g language c urtsno cts and l rbi a ir es. .1 3 jaM or d fi f nere ec s eb tw ee n SNA I C a dn K & R C

x NA SI C troppus s F nu ction P totor y gnip x NA SI C roppus t of eht tsnoc & v italo le data ty ep uq alifier x NA SI C roppus t ediw cha ar cters and ni te nr at noi al zi a oit n, eD fines se lt o ac le f oitcnu n x NA SI C pe timr s f nu ct oi n niop ters to be su ed with tuo de er ef re nicn g x NA SI C d fe ines a es t fo rp e orp ce oss r sy lobm s x NA SI C d fe ines a es t fo sta dn ard l rbi ary f unc noit s and a ss ociated eh aders.

.1 4 hT e NA SI / I OS +C + St dna ard

ehT +C + language is one of eht OO P language .s tI was deve ol ped by Bja enr S urtsuort p at At T& Bell Lwww.vtucs.coma rob a irot es. C ++ si an e tx en nois of C htiw a maj ro a dd i noit of ht e class c no s urt ct fea serut of S umi la 67. The ht ree som t ropmi ta tn facil ti ies that ++C a dd s no ot C are classes, f oitcnu n ove olr a nid g, & po era ot r ove olr a nid g.

Dept.of CS&E,SJBIT

nI 891 9, Bja enr S tsuort r pu up b sil hed “T eh onnA t ta ed +C + feR erence Ma laun ” , iht s manual b ce ome eht base for the rd fa t NA IS +C + sta dn ar .d W 2G 1 c mmo ittee fo t eh ISO nioj ed the NA SI 61J3X c timmo t ee ot deve pol a nu ify NA S /I ISO ++C ts a dn ard. A rd a tf ve noisr of NA S /I ISO ts a dn ard was hsilbup ed in 991 4. .1 5 jaM or D r ne ces eb tw ee n SNA I a nd C ++

 F nu c noit De lc ara oit n or F nu c noit P totor y ep

 F nu c snoit aht t take a va ir a elb nu bm er of a rg mu ents

 Type efas nil kage , L akni ge eriD c it ves

.1 6 OP S XI St na dards

P XISO is ca nor my for P tro a elb Opera nit g yS s et m nI te fr a ec . The er are rht ee bus g spuor ni P XISO . They a er : PO IS X 1. :

x timmoC t ee soporp es a sta dn ard f ro base po era nit g sy ts em AP sI . x sihT standa dr i s f ro ma ll y wonk n a s eht EEI E standa dr 001 3.1- 991 0. x sihT standa dr specif ei s the AP sI f or the elif m anip lu a oit n and orp cesses (for P or ec ss erC a oit n and Co .)lortn PO IS X :b1.

x timmoC t ee soporp es a sta dn ard f ro r ae l it me po era nit g sy ts em AP sI x sihT standa dr is f ro ma ll y wonk n a s eht EEI E standa dr 001 3.4- 991 3 x sihT standa dr specifies eht AP sI for t eh ni te orpr ec ss com cinum a oit n (Sema rohp es,Me ss age P nissa g Shared romeM y). PO IS X.1c:

x timmoC t ee soporp es a sta dn ard f ro htitlum r ae ded rgorp a nimm g tni e afr ce x sihT standa dr spe ific es the AP sI f ro hT r ae d Crea oit n, ortnoC l, and Cle ,puna erhT ad Sche nilud g, erhT ad yS nc zinorh a oit n a nd for Signal Ha nildn g . oT e usn re a su er orp gram c no f mro s to the POS XI .1 standa ,dr the su er dluohs d fe ine the mani ef stedwww.vtucs.com c sno tant _POS XI _S ECRUO at eht beg ninni g fo e ca h progra b(m fe ero the ni c oisul n of any eh ader files) a :s d# e enif _ POS OS_XI U CR E or

Dept.of CS&E,SJBIT

2

spe ic fy the –D_ POS XI _S ECRUO oitpo n to a C++ c mo p li er nirud g c ipmo la oit n.

$g ++ –D_ POS XI _S ECRUO filename c. pp

nI general a user orp gram aht t sum t eb rts ic lt y P XISO .1and POS XI . b1 c lpmo iant may be ttirw en a s fol swol :

d# e enif _POS UOS_XI R EC

d# e enif _POS C_XI _SO ECRU 903991 L

ni# c ul de ertsoi< am. >h

ni# c ul de tsinu< d. >h

m tni m a ni ( )

{

....

}

OP SIX Fe ta ure Test aM rc os

Fe ta ure Test M a rc o fE fects if de if ned on a S tsy em tI wolla us to ts art mult elpi j (sbo g spuor fo corp e ss e )s f or m a nis g el te animr l and c ortno l ihw ch jobs can _P TNOC_BOJ_XISO R LO acc se s the term ni al and hw ich j bo s a er to ur n ni the b ca kg .dnuor He ecn It troppus s BSD ve oisr n oJ b ortnoC l Fea ut r .e E ca h corp ess ninnur g on the sy ts em k ee ps eht saved set- DIU and set- ,DIG so that it ac n change e ff ce tive _P XISO _S DEVA _IDS su er DI a dn g puor DI to oht se values v ai se ut id a dn se igt d AP sI respec it vely. If eht de nif ed value is - ,1 use sr may change wo ne ihsr p fo files wo ned by th .me O ht e iwr se lno y users with _P OHC_XISO W DETCIRTSER_N ps e ic al rp ev li ege may change nwo e ihsr p of any files on a sy ts em. If the def ni ed va eul is -1, any nol g path eman ap ssed to _P ON_XISO _ CNURT an API is is le ltn y urt ncated to XAM_EMAN byte ,s hto e esiwr e rorr is generated. fI eht defined va eul is - ,1 the er is no id sa nilb g ch ra ca ter _P V_XISO www.vtucs.comD BASI LE f ro special cha ar cte sr rof la l te nimr al dev eci files, hto e esiwr the va eul i s the id sa nilb g cha ar cter va .eul

Dept.of CS&E,SJBIT

iL m sti Ch ce king ta Comp li e Time a dn ta R nu iT me

x ehT POS XI .1 and POS XI .1b sta dn a dr s specify a mun ber fo pa mar eters that desc ir be ac pa tic y li im ta noit s of the sy ts em. x L stimi a re ed fined in

  • h . x hT e es a er erp fixed tiw h t eh name _POS XI _ ys scon ,f p ta hcomf a dn f p ta hconf

    oT f ni d uo t the actual mi lp eme tn ed config ru a oit n timil s

    x Sy ts em iw de nisu g sysco fn nirud g ur n it me x nO idni v udi al ob ej cts ud r ni g nur ti em nisu g, pathc no f and htapf co fn .

    ni# c edul h.dtsinu< >

    long s nocsy f tni( parame et r);

    long tapf h fnoc ni( t sedlif , i tn f il m an_ti m )e );

    long htap c fno c( onst c ah r * tap h, i tn ilf m n_ti ame);

    x F ro pathc no f(), eht path arg mu e tn po tni s to the nhtap ame fo a file ro d ri e rotc y.

    x F ro f htap conf ,)( the f sedli arg mu e tn i s a n open file desc otpir r.

    .1 7 ehT OP SIX.1 PIF S natS d ra d

    FI SP ts a sdn for Federal nI f mro a oit n P or c nisse g Sta dn ard. hT is standa dr was deve pol ed by Na lanoit snI t uti te of Standa sdr a dn Tec olonh yg . hT e l atest ve noisr of iht s sta dn ard, F PI S 151 - ,1 is based on eht SOP XI .1- 991 8 sta dn ard. ehT FI SP ts a dn ard is a re oitcirts n of the P XISO .1- 8991 ts andard, suhT a FI SP 151 -1 c no f nimro g sy ts em is al os POS XI .1- 8991 c no f nimro g, b tu on t vice ve sr a. FI SP 151 -1 c no f nimro g sy ts em re iuq res fol iwol gn fea rut es to eb i elpm me tn ed in all F SPI c no f nimro g sy mets s. _P BOJ_XISO TNOC_ R LO _P TNOC_BOJ_XISO ROL tsum be ed fined. _P XISO _S DEVA _IDS _P XISO _S DEVA _IDS sum t eb de nif ed. _P OHC_XISO W DETCIRTSER_N sum t be de nif ed and ti s value is on t -1, ti m ae ns users tiw h sp ce ial _P OHC_XISO W DETCIRTSER_N www.vtucs.comrp ev li ege may change nwo e ihsr p of any files no a sy ts e .m If the def ni ed va eul is -1, any nol g path eman ap ssed to _P ON_XISO _ CNURT an API is is le ltn y urt ncated to XAM_EMAN byte ,s hto e esiwr e rorr is generated.

    Dept.of CS&E,SJBIT

    4

    P V_XISO D BASI LE mu ts eb de nif ed and ti s v ula e is _P V_XISO D BASI LE ton -1. tsuM be de nif ed and i st va eul is on t - ,1 L no g pa ht name _P ON_XISO _ CNURT si not .troppus UORGN P M_ XA Sy s’lobm va eul um st be at l ae ts 8. ehT er ad and rw i et API s dluoh re rut n the mun ber fo bytes that have eb en tra fsn e rr ed a tf er ht e AP sI have b ee n ehT g puor DI fo a ne lw y c er ated file um ts hni er ti t eh g puor DI fo ti s c atno i nin g rid e rotc y.

    oC nte tx Sw ti ching

    A su er edom is the ron mal ex ce u noit c no text fo na y su er corp ess, and it al swol the rp o ec ss to acc se s ti s spe cific data o ln y.

    A ek rnel om de is the pr to e itc ve exec oitu n env mnori ent ht at wolla s a user corp ess to ca ec ss ke nr els data in a re rts ic det ma nn er. When the AP sI e ex c itu on c pmo le et s, eht user rp o ec ss is iws tched b ca k to t eh su er om d .e ihT s c tno e tx iws tc nih g for ae ch API c la l e rusn es that orp ec ss access ke lenr s da at in a c lortno led ma nn er and m zimini es any chance of a awnur y su er app cil a oit n may damage an e itn re sy ts e .m oS in general nillac g an APIs is erom it em c nimusno g ht an ca ll ing a user func oit n eud to eht conte tx iws t nihc g. uhT s for oht se time c tir i ac l app cil at noi s, user luohs d call rieht sy ts em AP sI lno y fi ti is n ecessary. An sIPA c mo mon Charac et r itsi cs

    soM t sy ts em c lla s re rut n a sp ce ial value to dni icate that ht ey have f lia ed. T eh sp ce ial value si ty ip ac ll y -1, a null niop t ,re ro a c sno tant us ch as EOF ht at is defined f or th ta oprup s .e oT f ni d uo t what nik d fo e rorr it was, y uo n ee d to kool at eht e rorr c edo ts ored in the va ir able e onrr . ihT s va ir ab el is declared in the eh ader file onrre .h as wohs n be ol w. v lo a elit ni t e rr on

    o ehT va ir a elb e onrr c no tai sn the sy ts em e rorr mun be .r v dio p rre or (c sno t c ah r * em s gas e)

    o ehT f unc oit n pe rorr is declared in idts o.h.

    www.vtucs.com

    Dept.of CS&E,SJBIT

    5

    F niwollo g ta elb swohs S emo rorrE oC des a nd rieht m ae n ni g:

    rE rors eM aning EP MRE API was a trob ed because eht c nilla g corp ess seod on t have the pus er us re irp v li ege. RTNIE nA AP sI e xec oitu n was troba ed eud to signal tni er .noitpur IE O nA uptuO/tupnI t e rorr co c rru ed in a n AP sI ex ce u it .no EXEONE C A corp ess c ould on t e x etuce orp gram v ai eno of the cexE AP .I FDABE nA API was c lla ed with an ni va il d file desc otpir r. LIHCE D A corp ess eod s on t have any c hild corp ess ihw ch it ac n wait on. IAGAE N nA API was a rob ted be ac use os me sy mets reso ru ce it is requested was te ropm a lir y unavailabl .e ehT API luohs d call again late .r MEMONE nA API was a trob ed be esuac it c luo d on t a ll oc eta d yna cim romem y. ECCAE SS ehT orp c se s od es on t have e uon gh irp v li ege to perf ro m eht ope oitar n. EFAULT A niop ter po tni s to an i vn a dil a rdd ess. EPIPE nA API a ttempted t o etirw data to a ip pe ihw ch h sa no er ade .r NEONE T nA ni va il d file eman was spe ic fied to an AP .I

    www.vtucs.com

    Dept.of CS&E,SJBIT

    aP ge INU X S YS MET PROGRAMM GNI 01 C 26S TINU – 2 NU IX LIF ES

    NU IX / OP SIX file yT pes

    ehT ffid erent type’s files ava li able in XINU / P XISO a er :

    x Reg lu ar files xE a pm le: lA l . e ex files, ,C ,++C PDF oD cument files. x riD ce rot y files xE a pm le: F dlo ers in Win .swod x Device files

    o olB ck Device files: A hp y is ac l dev eci aht t timsnart s lb ock fo data at a .emit F ro e elpmax : f ppol y devi ec s MORDC s, hard ksid s.

    o hC a ar cter Device lif es: A hp y cis al device that tra timsn s data in a based m anne .r F ro e elpmax : L ni e nirp t ,sre om dems .cte

    x FIFO f iles xE a pm le: PIP sE . x L kni F li es

    aH rd Li kn s tI is a XINU tap h ro file n a ,em by de af ult elif s a er hav ni g lno y eno hard il nk

    Symb ilo c iL kn s Sy ilobm c l skni a er ac l del tfos l kni s. S tfo l kni are c er ated in the same ma nn er as hard knil s, tub ti re riuq es –s op it on to the ln c mo mand. Sy cilobm knil s a er j su t il ke rohs tc tu s in .swodniw

    iD f ef er nces be ewt en Hard il kn s a dn S my b ilo c iL kn s

    aH rd Link Soft iL kn s .1 Do on t c er a et new ni o .ed .1 Cr ae te a new oni d .e .2 Ca onn t nil k id re irotc es selnu s .2 Can nil k d ri e irotc es. pus er user irp v li ege .s .3 Cawww.vtucs.comonn t l ni k f i el ca sor s file sy ts ems. .3 Can nil k files ca sor s fi el sy ts ems. .4 nI cr ae se the hard nil k c nuo t. .4 oD es n to c hange eht ha dr nil k c uo tn . 5. wlA ays fer er to the dlo file lno y, .5 wlA ays er ef re ecn to eht latest

    Dept.of CS&E,SJBIT

    aP ge 7 01 C 26S m ae sn hard knil s can eb korb en by ve noisr fo the files to ihw ch ht ey nil k.

    re om val of one ro erom knil s.

    NU IX eK rnel s ppu or st f ro file / Kernel ataD structure f ro file man pi ul oita n

    fI po en call succ ee ds, ke nr el esta lb ish the path betw ee n rp e corp ess ta elb to edoni ta elb uorht gh file tab el ehT Steps ni v lo ved in ht is corp ess are:

    Step :1 ehT ke enr l iw ll search the corp ess fi el desc ir p rot tab el and lo ko for srif t esunu d e rtn y, fi an e rtn y is f nuo d, that e rtn y liw l be de is gnated t o er ef re ecn the .elif

    Step :2 hT e ke enr l cs an the fi el table in ti s ke nr el space ot f ni d an sunu ed e rtn y that can be a iss gned to er ef re ecn the fil .e

    If an unu sed e rtn y is fou ,dn the f niwollo g eve stn lliw occ .ru

    ehT orp c s’sse file table rtne y lliw be set to niop t to ht is fi el table e n rt y.

    o hT e f i el table e rtn y liw l eb set ot po ni t to the oni de tab el e rtn y hw e er the in edo r ce ro d fo eht file is ots r .de

    o ehT f i el table e rtn y liw l tnoc ain the c rru e tn elif p io tn er fo the open .elif o hT e file table en rt y lliw c niatno open edom that ps e ic fies that eht if le is po en f ro r ae d- lno y, irw te- lno y ro er ad- etirw .cte

    o ehT er ef re ecn c nuo t in eht file table e rtn y is s te to 1. The fer erence co tnu k ee ps art ck of oh w many file desc ir p rot s f or m a yn orp ec ss a er re ef renc ni g the e rtn y.

    o ehT er ef re ecn c nuo t of t eh ni -me rom y edoni fo t eh if le is inc er ased by 1. sihT c nuo t sp ce ifies oh w ma yn f ile ta elb e rtn ies a re op i nitn g to aht t .edoni If e ti her step1 ro step2 fa li s, the open func oit n w lli re nrut tiw h a -1 af i rul e stat su , on file desc otpir r ta elb or fi el ta elb e rtn y liw l be a ll o ac ted.

    ehT if g ru e wohs s a corp e ’ss s elif desc otpir r tabl ,e the ke nr el fi el table and the oni de a tf er the www.vtucs.comcorp ess has opened eerht lif e :s cba for er ad lno y, and xyz for r ae d- irw te and xyz aga ni for etirw only.

    Dept.of CS&E,SJBIT

    8 INU X S YS MET PROGRAMM GNI 01 C 26S

    F eli D esc tpir or elbaT F eli aT elb Ino ed elbaT

    r =cr 1 =cr 1 cba

    wr

    =cr 1 =cr 2 yx z

    w

    =cr 1 Pr co sse S ap ce

    ehT er ef ren ec c nuo t of na a ll o ac ted file ta elb e tn yr si su ua ll y 1, b tu a rp ocess may lenreK S ap ec When a rp o ec ss cal sl t eh f nu ct oi n c esol to cl eso an opened fi ,el eht f niwollo g se uq en ec fo eve tn s liw l o cc ur. rc = nerefeR ce Co nu t )1 ehT ke enr l tes s eht c rro es nidnop g f ile desc otpir r t elba e n rt y to eb unu sed. r = daeR o yln )2 tI d ce mer ents eht refe ner ce c nuo t in eht c rro esp nidno g file table en rt y by .1 fI the r e wfe r =e nce cetirW o nnuo lty is s lit l non-ze ,or go to step 6.

    )3 rwehT =f i el tadaeR b le eetirW rtn y is mFi kra erug e:d D asta a Sunu sed. erutcurt o f File talupinaM ion )4 hT e fer erence c uo nt in the c rro e nidnops g elif ni ode table e rtn y si set ed cremented by

    .eno fI the c uo tn is ts ill n no -ze or go to step 6. )5 If the ha dr l kni c tnuo of eht oni de is on t zero, it re snrut ot the caller iw th a ccus ess ts a ut s to he ,esiwr it ma skr the oni de ta elb e rtn y as unu sed and de- allo ac tes la l eht hp y is ac l sid k ots rage of t eh .elif )6 tI re nrut s to eht c lla er to t eh corp ess tiw h 0 cus( ces )s sta ut ses.

    www.vtucs.com

    Dept.of CS&E,SJBIT

    aP ge 9

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 TINU – 3 NU IX ELIF PA ’I S

    1.3 Ge en r la F i el IPA s A elif ehT elif A PIs taht a re a v elbalia ot frep o mr oirav us snoitarepo no selif ni a elif sy mets a er :

    ELIF SU E IPA s nepo ( ) sihT A PI si desu by a pro ssec ot nepo a elif rof ad ta a c ssec . ( daer ( ) ehT A PI si esu d by a rp o ssec ot daer d ata f mor a f eli ( etirw ( ) ehT A PI si desu by a rp o ssec ot etirw atad ot a lif e ( keesl ( ) ehT A PI si desu by a rp o ssec ot wolla modnar acc sse ot a lif e ( esolc ( ) ehT A PI si desu by a rp o ssec ot etanimret noc n ce t noi ot a elif tats ( ) A ehT A PI si desu by a rp o ssec ot euq ry elif setubirtta ( tatsf ( ) ( domhc ( ) ehT A PI si desu by a rp o ssec ot ahc n eg elif a secc s .snoissimrep ( nwohc ( ) ehT A PI si desu by a rp o ssec ot ahc n eg UID dna / ro GID fo a lif e ehT API si desu by a pr eco ss ot ahcnge eht tsal noitacifidom dna ) ( emitu ( ) ca c sse emit spmats fo a f eli ) ( knil ( ) ehT A PI si desu by a rp o ssec ot rc e eta a h dra knil ot a .elif ) ( knilnu ( ) ehT A PI si desu by a rp o ssec ot eteled h dra knil fo a lif e ( ksamu ( ) ehT A PI si desu by a rp o ssec ot es ted f tlua elif c er noita .ksam

    nepO : It si desu ot nepo ro cr ae te a elif by nihsilbatse g a noitcennoc wteb e ne eht c nilla g orp c sse .elif a dna a .elif Pro epytot : # edulcni < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< > h.ltncf< edulcni# h.ltncf< > tni nepo tsnoc( rahc * eman_htap , tni om_ssecca de, t_edom noissimrep ;)

    an_htap me : The htap an em fo a elif ot eb op ene d ro cr .detae It ac n eb na etulosba htap man e ro an htap evitaler htap an m .e ehT p emanhta c na osla eb a sy cilobm knil .eman ssecca _m www.vtucs.comdo e: nA tni e reg seulav ni eht mrof fo detsefinam stnatsnoc wh hci seificeps woh eht elif si ot eb dessecca by nillac g orp c .sse ehT detsefinam stnatsnoc nac eb deifissalc sa ac sec s lf edom lf ags dna acc sse reifidom lf ags.

    Dept.of CS&E,SJBIT

    egaP 10

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 sseccA edom f :sgal x :YLNODR_O Op ne ht e elif rof aer d no ly. If t eh elif si to be enepo d for aer d no ly eht n eht elif aerla dluohs aerla dy e x tsi ni t he elif syst me dna on om d reifi lf ags c na eb desu . x :YLNORW_O nepO eht elif rof etirw no ly. If ht e elif si to eb denepo rof etirw no ly, neht any of ca eht ca c sse reifidom lf ags nac eb ps e deific . x :RWDR_O nepO ht e elif rof daer dna .etirw If the elif si ot eb denepo rof etirw no ly, neht any fo ca eht ca c sse reifidom lf ags nac eb ps e deific . sseccA reifidom lf ags are lanoitpo dna nac eb sp deifice by esiwtib - niRO g meht htiw eno fo eht evoba a ssecc edom lf ags ot retla ht e a c ssec m e hc a msin fo eht .elif

    sseccA idoM f rei F sgal : x DNEPPA_O : sdneppA atad ot the dne of eht elif . If siht si ton eificeps d, atad eb nac eb w nettir a ny hw e er ni eht .elif x AERC_O T : etaerC ht e elif fi ti do se ton ex .tsi If the elif ex stsi ti sah on ceffe t .s ewoH v re fi eht fi el d o se n ot e ix st a dn AERC_O TE i s on t ps ecifi ,de epo n iw ll a bort w i ht a f ia l eru re ut rn s t ta us. x E_O X LC : desU htiw ERC_O AT, fi eht elif ex si t ,s eht llac iaf .sl ehT tset rof ex etsi n ec na d rc eht rc e noita fi eht elif d o se ton ex .stsi x _O T CNUR : If t he elif e x ,sti acsid r sd eht elif stnetnoc a dn s ste eht elif is ze ot z .ore x CON_O TT Y : seicepS ton to esu ht e deman lanimret ed eciv f eli sa eht nillac g ssecorp lortnoc .lanimret x COLBNON_O K: pS e fic i se taht any qesbus u tne er da or tirw e no ht e lif e sh dluo eb non - lb o nikc g. Ex ,elpma a ssecorp si no lamr ly dekcolb no idaer ng na pme ty epip ro no nitirw g ot a epip taht is .lluf It m ay be desu ot s p ice fy taht hcus r dae dna etirw epo r snoita era non - nikcolb g.

    Ex elpma : epo = csedf tni csedf = epo n /rsu/“( xyz orp/ g ,”1 DR_O RW |O_ ;)0,DNEPPA If a elif si ot eb denepo rof re da - no ly, eht elif sh dluo aerla dy ex tsi dna on rehto reifidom lf ags desu eb nac eb desu . www.vtucs.com ,DNEPPA_O URT_O N ,C TAERC_O dna _O EXCL ra e bacilppa le of r reg alu r ,selif wh re eas ON_O NBL KCO si rof FI OF dna d ecive selif no ly, dna _O N YTTCO si rof lanimret ecived lif e no ly.

    Dept.of CS&E,SJBIT

    egaP 11

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2

    P re m :noissi  ehT noissimrep arg mu e tn si deriuqer no ly fi t eh TAERC_O lf ag si tes ni eht dom_ssecca e arg .tnemu It ceps i seif eht ac ssec noissimrep fo t eh elif rof sti nwo e ,r gr puo dna lla eht ehto r elpoep .  I st d ata ty ep si tni dna sti eulav si latco tni e reg v ,eula hcus sa .4670 The tfel - ,tsom elddim na d ir g th - tsom stib iceps fy t he a c ssec noissimrep rof o ,renw g puor dna srehto r evitcepse ly.  In e hca latco id g ti eht tfel - ,tsom elddim dna r gi th - tsom stib iceps fy re ,da etirw dna ex etuce evitcepser noissimrep evitcepser ly.  F e ro x elpma 4670 ficeps i se 7 si rof nwo e ,r 6 si of r g puor dna 4 si rof hto e .r seificeps 111 = 7 = 111 seificeps ,daer w etir dna e x noituce imrep s nois rof renwo . seificeps 011 = 6 = 011 seificeps ,daer w r eti noissimrep rof g puor . seificeps 001 = 4 = 001 seificeps daer ep noissimr rof srehto . ihw ,1 rehtie si tib hcaE tib si rehtie ,1 ihw ch snaem a r ig th si tnarg ed ro z ,ore rof on hcus .sthgir  OP SI 1.X ifed n se eht ep r noissim atad ty ep sa om d t_e dna sti eulav si detsefinam stnatsnoc cihw h ila era ila as se ot latco tni eger .seulav For e x ,elpma 4670 noissimrep eulav dluohs eb deificeps :sa UXWRI_S | I_S RGRP|S WI_ GRP| HTORI_S  noissimreP eulav si deifidom by sti c nilla g rp o sec s ksamu .eulav nA u ksam eulav ficeps i se emos ca c sse ir g sth ot eb m ksa ed ffo ro( at k ne away) a lacitamotu ly no any selif c r detae by rp o ssec .  ehT noitcnuf otorp ty ep of eht ksamu API si :

    m edo _t um ksa (m do e t_ en w u_ m )ksa ; It sekat n we ksam eulav sa arg ,tnemu hcihw si desu by c nilla g rp o ssec and eht noitcnuf nruter s .eulav ksamu dlo eht dlo ksamu .eulav For ex ,elpma m edo _t _dlo m ksa = um ksa GXI_S( RP | HTOWI_S | ;)HTOXI_S ehT oba ve uf n noitc stes eht en w ksamu v eula ot on“ ex tuce e of r g puor ” a dn on“ w etir -ex uce et ”srehto rof ”srehto .

     ehT epo n noitcnuf at ek s sti noissimrep arg mu e tn eulav na d esiwtib -A sDN ti w hti eht on ’e s www.vtucs.comtnemelpmoc fo eht c nilla g rp o ssec ksamu lav u .e T ,suh ep_lautca rm noissi = ep rm noissi & u~ m eulav_ksa Ex :elpma rep_lautca mis nois = 7550 & )130~( = 6450

    Dept.of CS&E,SJBIT egaP 12

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2

    ehT ter u nr ulav e fo po en noitcnuf si -1 fi the API f slia dna er onr noc t snia a n rre or sutats eulav . If eht API su cc e ,sde ht e r nrute ulav e si lif e sed c rotpir taht ac n eb us de ot er f nere ce the lif e na d ti s wteb eb dluohs eulav dluohs eb wteb e ne 0 dna XAM_NEPO - .1

    taerC :

    c ehT c r tae sy mets llac si u des ot rc e eta wen reg lu ra .selif I st p otor ty ep si : # edulcni < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< >

    tni taerc ( tsnoc hc ar * eman_htap , t_edom ;)edom .1 ehT eman_htap arg nemu t si eht htap eman a fo lif e ot eb rc e deta . .2 ehT edom a rgum tne si emas sa taht rof nepo API. ecniS TAERC_O alf g w sa dedda ot nepo API ti saw desu ot htob aerc et dna nepo reg ralu .selif ,oS eht taerc API h sa emoceb .etulosbo It si r deniate rof ba wkc a dr -co ilibitapm ty htiw rae ly U fo snoisrev fo U NI .X c ehT c r tae noitcnuf c na b e detnemelpmi nisu g eht o nep noitcnuf sa : ed# f eni taerc ,eman_htap( m edo ) an_htap(nepo m ,e _O W YLNOR | AERC_O T|O_ ,CNURT m edo )

    daer :

    sehctef noitcnuf sihT noitcnuf sehctef a f xi de s ize kcolb fo atad from a elif er fer decne by a nevig elif rotpircsed . I st otorp ty ep si : < edulcni# < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< > iss z t_e daer ( tni csedf , v *dio ,fub t_ezis is z ;)e x f :csed si na etni ger elif d rotpircse taht r fe e sr ot a n denepo elif . x ub f: si eht sserdda fo a b reffu idloh ng a ny d ata er .da x :ezis ceps iwww.vtucs.comseif woh am ny by set fo d ata a er ot eb re da morf eht .elif

    Dept.of CS&E,SJBIT

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 :etoN** r dae noitcnuf can daer et xt ro anib ry elif s. sihT si why eht atad type fo fub si a revinu s la retniop diov( .)* F ro e ax elpm eht niwollof g edoc ,sdaer qes u laitne ly one or erom r roce d fo curts t elpmas -typ de atad morf a elif dellac abd s :e tni { elpmas tcurts elpmas { tni x; od u elb y; c h *ra };a v Xra ; d“(nepo = df tni df = d“(nepo b ,”esa O ODR_ NL )Y ; r ( elihw ( r e ,df(da &va ,Xr siz Xrav(foe ) 0>) )

     ehT nruter eulav fo aer d si eht rebmun fo by set fo atad seccus s luf ly read dna derots ni eht ub f arg .tnemu It dluohs eb e q lau ot eht ezis .eulav  If a elif sniatnoc ssel ht an ezis by set o f atad r ame i nin g ot eb r dae , eht uter rn eulav fo daer lliw eb fo taht naht ssel naht taht fo ezis . If e dn - fo - elif si r cae h ,de er ad lliw nruter a z ore ulav e.  t_ezis si denifed sa tni ni aeh d ,re us sre dluohs ton tes ezis ot ex deec I M_TN AX in any r dae noitcnuf c .lla  If a r dae noitcnuf llac si i detpurretn b y a c aug th is g lan dna eht SO seod on t tratser eht s yst me llac lacitamotua ly, OP SI 1.X swolla owt elbissop heb a :sroiv .1 ehT re da noitcnuf lliw r nrute -1 v ,eula nrre o lliw eb tes ot EI ,RTN na d lla eht tad a lliw be dedracsid . .2 ehT re da uf n tc noi lliw re nrut eht ebmun r fo by et s fo atad re da oirp r ot eht s ig lan tni e .noitpurr ot ssecorp a swolla sihT swolla a ssecorp ot eunitnoc idaer ng eht elif .  ehT re da uf n noitc may bl kco a illac ng rp o ssec e ex noituc fi ti si re gnida a FI OF o r ved i ec elif na d atad si ton y te aliava elb ot sitas fy eht re da uqer e .ts sresU may ps e ic fy eht ON_O NBL KCO ro DN_O EL YA lf ags on a elif ed s rotpirc ot tseuqer ikcolbnon ng er da epo r snoita no eht idnopserroc ng elif .

    wr eti :

    uf etirw ehT etirw uf n noitc stup a if x de is ze kcolb fo atad ot a elif r e ef r ne c de by a fi el otpircsed r I st otorp ty ep si : < edulcni# < sy /s typ h.se > h.dtsinu< edulcni# www.vtucs.comh.dtsinu< > iss z t_e etirw ( tni csedf , tsnoc *diov ,fub t_ezis is z ;)e x f :csed si na etni ger elif d rotpircse taht r fe e sr ot a n denepo elif . x ub f: si eht sserdda fo a b reffu hcihw sniatnoc ad at ot eb nettirw ot eht elif .

    Dept.of CS&E,SJBIT

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 x :ezis ceps i seif woh am ny by set fo d ata a er ni eht b fu a rg tnemu .

    :etoN** w etir noitcnuf nac re da et xt ro anib ry .selif sihT si why the atad type fo fub si a lasrevinu retniop diov( .)* F ro ex ,elpma eht niwollof g edoc frag tnem rw it se net sdrocer fo tcurts elpmas -typ se atad ot a elif dellac d b 2esa :

    tni { elpmas tcurts elpmas { tni x; od u elb y; c h *ra };a v Xra [ 01 ]; d“(nepo = df tni df = d“(nepo b ,”2esa _O W OR NL )Y ; diov( ,df(etirw diov( * ,Xrav) s zi foe )Xrav ;

     ehT nruter eulav fo etirw si eht rebmun fo b y set o f atad us lufssecc ly ttirw en ot a .elif It dluohs eb eht ot lauqe ot eht ezis eulav .  If eht etirw lliw esuac the elif is ze ot ex deec a sy mets desopmi timil ro fi eht elif syst me ksid si ,lluf eht nruter eulav of etirw lliw eb eht tca u la rebmun fo by set nettirw b erofe the f noitcnu aw s detroba .  If a sig lan evirra s irud ng a etirw noitcnuf c lla dna ht e SO eod s ton er trats eht sy ets m llac lacitamotua ly, eht w etir noitcnuf may rehtie r ute rn a -1 eulav dna tes rre no ot EI RTN ro r nrute fo rebmun eht rebmun fo by set fo d ata nettirw roirp ot t eh s ig lan etni r .noitpur  ehT tirw e noitcnuf may mrofrep gnikcolbnon op noitare if eht O_ ON NBL CO K ro DN_O ELAY alf gs era s te no eht edf sc arg tnemu ot eht noitcnuf .

    lc o es : uf esolc ehT esolc uf n noitc stcennocsid a elif f mor a rp oce .ss I st otorp ty ep si :

    tsinu< edulcni# tsinu< h.d > tni esolc tni( )csedf ; x f :csed si na etni ger elif d rotpircse taht r fe e sr ot a n denepo elif . x ehT nruter v eula fo solc e si z ore fi eht llac cus cee sd ro -1 fi ti .sliaf x ehT esolc noitcnuf rf ees desunu elif srotpircsed os taht ht ey nac eb r ue s de ot efer r ne ce rehto .selif x www.vtucs.com ehT esolc noitcnuf lliw etacollaed sy mets oser urc se hcihw uder c se eht omem ry r tnemeriuqe fo a ssecorp .

    Dept.of CS&E,SJBIT

    egaP 15

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 x If a rp o ssec setanimret tuohtiw nisolc g lla eht selif ti sah ,denepo eht ke lenr lliw esolc selif of r ssecorp eht ssecorp .

    ltncf :

    ehT ltncf f noitcnu spleh t o euq ry or tes a cc sse oc n lort lf ags dna the solc e-on-ex ce lf ag o f any elif .rotpircsed sU e sr nac la so esu ltncf ot issa gn elpitlum elif srotpircsed ot efer r ne ce eht emas elif . I st otorp ty ep si :

    h.ltncf< edulcni# h.ltncf< > ( ltncf tni ltncf ( tni csedf , tni c ,dm ;).… x f :csed si na etni ger elif d rotpircse taht r fe e sr ot a n denepo elif . x cm :d ficeps i se hcihw o p noitare ot frep o mr no a f i el er f ere n dec by eht edf sc a rg tnemu . x ehT driht arg tnemu lav u ,e hcihw may eb ps e fic i de retfa dmc si dneped e tn no eht lautca dmc av eul . x ehT elbissop dmc seulav era d e denif ni eht < ltncf . >h aeh d .re ehT se seulav dna rieht sesu a er : cmd sU e eulav F EG_ T LF snruteR eht ca c sse rtnoc ol alf gs fo a elif d otpircse r csedf . F LFTES_ steS ro sraelc ca c sse lortnoc alf gs taht era ficeps i de ni eht ht dri ra g tnemu ot .ltncf ehT dewolla ac ssec noc t lor alf gs O era O _ DNEPPA dna O _ BNON . F EG_ TFD snruteR eht esolc - no -ex ce lf ag of a elif er f re e decn by .csedf If a r nrute eulav is z ,ore eht lf ag si ,ffo hto e esiwr ht e nruter eulav si non z ore dna eht lf ag si no . ehT esolc - no - ex ce lf ag fo a n we ly po e den elif si ffo by d e tluaf . F TES_ FD steS ro elc a sr eht esolc - no -ex ce lf ag of a elif d otpircse r .csedf ehT driht ra g emu nt ot ltncf si etni g re eulav , hcihw si eht tes ot 1 ro ,raelc ot 0 ot ,raelc ro 1 ot tes eht alf g. F FPUD_ D setacilpuD eht f eli ed s rotpirc edf sc htiw na o reht lif e .rotpircsed ehT driht ar tnemug ot ltncf is na tni ge er ulav e hcihw seificeps taht eht detacilpud elif otpircsed r tsum be gr tae er naht or lauqe to taht .eulav The r nrute eulav of eht si esac siht ni ,ltncf ni siht esac si eht d detacilpu if el sed c rotpir .

     ehT ltncf www.vtucs.comnoitcnuf si esu f lu ni nahc ging eht ac sec s lortnoc lf ag fo a elif ed s rotpirc .

    Dept.of CS&E,SJBIT

    egaP 16

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 For xe am lp e: A etf r a fi el si epo n de for ikcolb ng re da - tirw e a secc s na d eht orp c sse ne sde ot ahc nge eht ac ssec ot nikcolbnon g dna ni tirw e- dneppa ,edom it nac c lla ltncf no eht ’elif s sa rotpircsed sa : lf_ruc tni lf_ruc ags = f edf(ltnc s ,c F EG TFL); ltncf = cr tni cr = ltncf ( ,csedf F S_ E FT L, uc r lf_ ag | PPA_O E DN | ON_O NBL CO K ;)  ehT esolc - no -ex ce lf ag of a elif rotpircsed ps e fic i se taht fi eht ssecorp ht at snwo eht otpircsed r sllac ht e ex ce API ot ex etuce ffid e tner rp o ,marg t eh edf sc dluohs eb olc es d by ht e rek n le feb o er rp wen eht wen rp ogr ma snur ro .ton  ehT e x elpma stroper eht esolc - no -ex ce lf ag fo a fd ,cse stes ti ot no retfa war :sd <

    sl eek: www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 17

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 eesl ehT eesl k sy mets c lla ac n eb esu d ot c hange eht if le ffo s te ot a fid f tnere val .eu It swolla a p or c sse ot mrofrep modnar ca ec ss fo atad no any epo en d .elif L kees si elbitapmocni htiw FIFO selif , rahc a detc ved ice selif and sy cilobm knil .selif

    I st otorp ty ep si : < edulcni# < sy /s typ h.se > >h.dtsinu< edulcni# >h.dtsinu< ( keesl t_ffo keesl ( tni fd cse , o ff t_ ,sop tni )ecnehw ; x f :csed si na etni ger elif d rotpircse taht r fe e sr ot a n denepo elif . x :sop seificeps a by et o ff tes ot eb dedda ot a nerefer ce noitacol ni nivired g eht wen elif ffo s te eulav . x w :ecneh seificeps eht ref nere ce noitacol . eulav ecnehW eulav eR f ecnere l o noitac RUC_KEES tnerruc elif tniop er dda er ss TES_KEES ehT b eg ninni g of a lif e NE_KEES D ehT dne fo a lif e :ETON** .a It si elli g la ot iceps fy a evitagen sop eulav wi ht eht ecnehw eulav tes ot TES_KEES sa ht si en tes lliw tes en g evita o tesff . .b If na keesl llac lliw tluser ni a wen elif esffo t taht si bey dno dne -of-fi ,el owt semoctuo era :elbissop .1 If a elif si epo n de rof r dae no ly eht keesl lliw af .li .2 If a elif si epo n de of r etirw ac ,ssec sl e ke lliw s ccu e de dna ti lliw ex dnet eht elif is ze pu ot eht ffo elif wen elif ffo s te dda r sse . x ehT nruter v eula fo l s ee k si eht wen elif o f tesf da d sser hw e er eht daer fo rw eti po e noitar lliw ro ,rucco ro -1 fi keesl llac f .slia ehT maertsoi cl ssa nifed es gllet dna es e gk oitcnuf ns ot wolla sresu ot r dna omly ac ssec d ata f mor any tosi r mae .ssalc T h se e snoitcnuf nac eb elpmi m detne nisu g eht ls kee uf n noitc sa :swollof www.vtucs.comtsoih h.dtsinu

    Dept.of CS&E,SJBIT

    egaP 18

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 sopmaerts (gllet::maertsoi ) { nruter rts( e eesl)sopma k siht( - )(onelif> , S,0)t_ffo( E ;)RUC_KE } maertsoi & rtsoi e ees::ma kg ts( r sopmae d_kees,sop ri col_fer ) { l_fer(fi oc == b::soi eg) siht(keesl)diov( ->f (oneli ), ,sop)t_ffo( TES_KEES ); esle (fi r col_fe == uc::soi r) siht(keesl)diov( -> (onelif ), ,sop)t_ffo( UC_KEES R ;) esle (fi r col_fe == e::soi n )d siht(keesl)diov( -> (onelif ), ,sop)t_ffo( NE_KEES D ;) nruter ;siht* }

     ehT llet::maertsoi g pmis ly sllac keesl ot uter rn eht tnerruc elif retniop detaicossa htiw na maertsoi .tcejbo ehT elif rotpircsed fo na tsoi r ae m tcejbo tsnoc *rahc si deniatbo morf eht nelif o noitcnuf rebmem noitcnuf .  ehT ees::maertsoi kg r seile no keesl ot retla eht f eli retniop detaicossa wi ht na maertsoi tcejbo . ehT arg stnemu era elif o tesff dna a er fer ecne ol c noita rof eht .tesffo sihT noitcnuf osla strevnoc ot eulav rid_kees eulav ot na esl ek ecnehw v eula . no si erehT si no e- ot - eno am p nip g fo eht s rid_kee lav u se ot eht nehw ce seulav u des by sl e ke : av rid_kees av eul keesl w ecneh eulav geb::soi TES_KEES ruc::soi RUC_KEES dne::soi NE_KEES D

    nil k: ehT knil noitcnuf cr etae s a wen knil for na ex itsi gn elif . sihT noitcnuf od es ton aerc te a n we elif . It cre eta a n we htap an me rof na ex nitsi g .elif I st otorp ty ep si :

    h.dtsinu< edulcni# www.vtucs.comh.dtsinu< > ( knil tni knil ( tsnoc *rahc uc r knil_ , tsnoc *rahc _wen l )kni x :knil_ruc si a htap eman fo na e x nitsi g elif .

    Dept.of CS&E,SJBIT

    egaP 19

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 x en w l_ i :kn si a wen htap eman ot eb ssa ig den ot t he emas elif . x If siht llac cus c ,sdee eht drah knil tnuoc etubirtta fo eht elif liw l eb cni r ae s de by 1 . x knil tonnac eb us de ot rc etae h dra sknil a ssorc if le syst .sme It c tonna eb u des no rid e otc ry elif s dellac si ti sselnu ti si dellac by a rp sseco taht sah pus e resur liverp ege. ehT nl dnammoc si detnemelpmi nisu g eht knil A PI. T he rp ogr ma si g nevi be :wol

    h.oidts h.dtsinu hc,cgra tni(niam tni tni(niam hc,cgra a *r a rgv ][ ) { a(fi rgc 3=! ) { (ftnirp "u as g %:e s", ra gv[0]); crs<"(ftnirp _ <>elif d _tse f eli >\n"); nruter 0 ; } a(knil(fi rgv[1] ra, gv[2]) == -1) { orrep r(" nil k"); nruter 1 ; } nruter 0 ; }

    nilnu k:

    sihT noitcnuf seteled a knil fo na ex nitsi g .elif It rced e sesa eht ha dr knil c tnuo setubirtta fo eht dna ,elif deman ,elif dna sevomer eht elif eman tne ry fo ht e knil morf a otcerid ry lif e. If siht noitcnuf ccus e sde eht elif nac on ol nger eb fer e ner c de by taht .knil F eli lliw eb devomer by eht elif syst me fi eht drah knil nuoc t fo eht elif is z ore dna on secorp s csedf sah csedf er f ere n ic ng ht at .elif I st otorp ty ep si : h.dtsinu< edulcni# h.dtsinu< > ( knilnu tni knilnu ( www.vtucs.comtsnoc *rahc knil_ruc ) x :knil_ruc si a htap eman fo na e x nitsi g elif . x ehT nruter v eula si 0 fi ti sdeeccus or -1 fi ti sliaf .

    Dept.of CS&E,SJBIT

    egaP 20

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 x ehT eruliaf nac be eud ot dilavni l kni eman dna nillac g orp c sse skcal ca c sse noissimrep to htap eht evomer eht htap n ema . x It c tonna eb desu ot r me o ev otcerid ry selif sselnu eht illac ng orp c sse sah s up resure p egelivir . NA SI C de senif r evome noitcnuf hcihw seod eht ralimis noitarepo fo .knilnu If eht argum tne ot eht evomer snoitcnuf si pme ty id r otce ry ti lliw r evome eht id r otce ry. The otorp type of er n ma e :si noitcnuf :si h.dtsinu< edulcni# h.dtsinu< > emaner tni emaner ( tsnoc *rahc eman_htap_dlo , tsnoc c h *ra _htap_wen n )ema er ehT er n ema lliw liaf hw en eht wen knil ot eb c r ae t de si ni a effid r tne elif sy mets naht eht iro gin la .elif ehT vm dnammoc nac eb detnemelpmi nisu g eht l i kn dna knilnu A PIs by t he rp og mar g nevi :woleb ulcni# .maertsoih h.dtsinu irts hc ,cgra tni(niam tni tni(niam ,cgra hc a *r argv ][ ) { a(fi rgc 3=! || (pmcrts! ra g [v 1] ra, gv[2] )) rec r<< su“ ag :e ”<knil_dlo<“<< w knil_ >\ ”n ; esle knil(fi a( rgv[1], a rg [v 2] )0==) nruter a(knilnu rgv[1] ;) nruter -1; }

    sta ,t sf t ta : snoitcnuf esehT snoitcnuf r eveirte t eh elif setubirtta fo a g nevi .elif ehT f i tsr a rg emu nt fo tats si elif htap w eman ehw re sa tatsf si a f eli .rotpircsed ehT p totor ype si g nevi b :wole

    < edulcni# < sy /s typ h.se > >h.dtsinu< edulcni# >h.dtsinu< ats tni www.vtucs.comats t tsnoc( *rahc tap h tcurts,eman_ *tats vtats ) ,csedf tni tsnoc( tatsf tni tatsf tsnoc( tni ,csedf s tcurt *tats )vtats

    Dept.of CS&E,SJBIT

    egaP 21

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 dnoces ehT dnoces arg tnemu ot tats & tatsf si eht dda r se s fo a tcurts tats -ty dep var .elbai ehT d e noitaralc si tats tcurts fo tcurts tats si g nevi b :wole s tcurt tats { t_ved s ;ved_t elif// sy mets ID t_oni oni_ts ; // F eli edoni ebmun r t_edom ;edom_ts sniatnoc// elif ty ep dna a ssecc lf ags t_kniln niln_ts k; drah// knil tnuoc t_diu diu_ts ; elif// resu ID g t_di _ts g di ; elif// g puor ID t_ved ;vedr_ts sniatnoc// rojam dna ronim ecived bmun ers t_ffo is_ts ze; elif// is ze ni rebmun fo b ytes t_emit ;emita_ts tsal// ssecca mit e t_emit tm_ts mi e; // tsal noitacifidom mit e t_emit emitc_ts ; tsal// sutats nahc ge mit e ;} x ehT nruter v eula fo htob snoitcnuf si 0 fi ti eccus e sd ro -1 fi ti .sliaf x elbissoP seruliaf may be taht a g nevi elif htap eman fo elif rotpircsed si ,dilavni eht illac gn skcal ssecorp skcal p noissimre ot ssecca eht ,elif ro eht f noitcnu detpurretni by a sig lan . x If a htap n ema argum tne deificeps ot tats si a sym cilob knil ,elif tats lliw r evlose eht nil k dna ca c sse eht non symb cilo knil .elif B hto eht snoitcnuf tonnac eb desu ot niatbo eht etubirtta s fo sy cilobm knil elif . x oT niatbo eht setubirtta fo sy cilobm knil elif tatsl noitcnuf saw .detnevni Its otorp ty ep si : i tn l tats tsnoc( *rahc ap t tcurts,eman_h *tats tats v) U ehT U NIX sl dnammoc si detnemelpmi by eht progr ma giv ne leb wo : .maertsoi< edulcni# .maertsoi< >h < edulcni# < sy /s typ h.se > < edulcni# < sy h.tats/s > h.dtsinu< edulcni# www.vtucs.comh.dtsinu< > h.dwp< edulcni# h.dwp< > edulcni#

    Dept.of CS&E,SJBIT

    egaP 22

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 rahc citats rahc x lbt [10] = "r xw wr xrwx";

    lpsid diov citats diov lpsid ay _elif_ type ( aertso m& ,sfo tni s t edom_ ) { hctiws edom_ts( &S_I )TMF { esac S _IFDI :R sfo << d' '; r ;nrute */ otcerid ry elif * / esac S _ FI C :RH sfo << 'c'; ;nruter */ hc a tcar er ived ce elif * / esac S _I BF L :K o sf << b' '; r ;nrute */ kcolb ecived elif /* esac S _ FI RE :G sfo << ' '; ter u ;nr */ r egu ral elif * / esac S _IFL :KN sfo << 'l'; ;nruter */ sym cilob knil elif /* esac S _IFI OF : sfo << 'p'; r ;nrute */ F I OF elif * / } } p ssecca wohS */ wohS ssecca p e noissimr rof nwo e ,r g ,puor hto e ,sr dna any ps e laic lf ags /* lpsid diov citats diov lpsid ay_a ecc s mrep_s ( rtso e ma & ,sfo i tn edom_ts ) { rahc oma de[ 01 ]; rof tni( ,0=i =j ( 1 << ;)8 i < ;9 ,++i j =>> )1 edoma [i] = edom_ts( & )j ? x bt l[i] : '-'; */ tes ssecca p noissimre /* fi edom_ts( &S_ SI UID) edoma [2] = ma( o ed [2] == 'x') ? 'S' : 's'; fi edom_ts( &S_ SI GID) edoma [5] = ma( o ed [5] == 'x') ? 'G' : g' '; fi edom_ts( &S_ )XTVSI edoma [8] = ma( o ed [8] == 'x') ? 'T' : 't'; sfo << oma de < < ' '; } */ L si t setubirtta fo eno elif /* nol diov citats diov nol g tsil_ maertso( & o ,sf hc a *r n_htap a )em { tcurts tats ;vtats tcurts www.vtucs.compuorg *g p_r ; tcurts p_wp*dwssap ; fi ( l tats ,eman_htap( & ))vtats

    Dept.of CS&E,SJBIT

    egaP 23

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 { c re r< ”< I dilavn htap an m <<”:e p man_hta e e<< ldn ; nruter ; } lpsid ay _elif_ type( o f ,s edom_ts.vtats ;) lpsid ay_a _ssecc per (m ,sfo edom_ts.vtats ;) sfo << ;kniln_ts.vtats */ sid play h dra knil tnuoc /* g p_r = getgrg tats(di v _ts. g ;)di */ noc v tre GID ot g puor n ema * / p_wp = g ts(diuwpte a ;)diu_ts.vt trevnoc*/ UID ot resu n ema * /

    sfo << ' ' <<( _wp p-> eman_wp ? p_wp - eman_wp> )diu_ts.vtats: << ' ' <<(g _r p-> eman_rg ? g p_r -> man_rg e _ts.vtats: g )di << ' '; fi edom_ts.vtats(( & _S FI )TM == S _ FI C RH || ( edom_ts.vtats &S_ FI TM ) S== _I BF L )K sfo << AM J )vedr_ts.vtats(RO << ',' << MI RON ( ;)vedr_ts.vtats esle sfo << is_ts.vtats z ;e */ wohs elif is ze ro ronim/rojam .on * / sfo << ' ' << emitc ( ts.vtats& ;)emitm_ */ tnirp tsal noitacifidom emit /* sfo << ' ' << n_htap a em << ldne ; */ wohs elif eman * / } lpsid ot pool niaM */ niaM pool ot lpsid ay elif setubirtta eno elif ta a emit /* hc ,cgra tni( niam tni niam tni( ,cgra hc a *r argv ][ ) { fi a( rgc == 1) rrec << " su a :eg " << a rgv[0] << " elif< p hta n a >em .. .\n"; esle elihw ( --ar cg => 1) l no g (tsil_ ,tuoc * + a+ rgv ;) nruter 0 ; }

    cca es :s

    a ehT a c ssec www.vtucs.com uf n noitc ehc c sk eht e x ecnetsi ro/dna a ssecc p e noissimr fo resu ot a deman elif . T he otorp ty ep si g nevi b :wole h.dtsinu< edulcni# h.dtsinu< > i tn ssecca ( tsnoc *rahc p ,eman_hta tni lf ag);

    Dept.of CS&E,SJBIT

    egaP 24

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 :eman_htap ehT htap n ema fo a elif . alf g: sniatnoc eno ro om re fo eht iwollof ng tib - lf ags. tiB F al g sU e F O_ K skcehC htehw er a eman d elif e x stsi . KO_R skcehC htehw er a c gnilla ssecorp sah daer p noissimre W KO_ C skceh htehw er a c gnilla ssecorp sah w etir imrep s nois O_X K skcehC htehw er a c gnilla ssecorp sah ex etuce ep r oissim n

    lf ehT lf ag ra g tnemu eulav ot ssecca llac si sopmoc ed by esiwtib - iRO ng eno ro erom fo eht evoba tib - alf g .s T he iwollof ng tnemetats skcehc tehw her a resu h sa r e da dna w etir snoissimrep no a :cod.1elif/bjs/rsu/ elif :cod.1elif/bjs/rsu/ a = cr tni cr = a c ssec ( ,”cod.1elif/bjs/rsu/“ O_R K| _W KO );

    x If a lf ag v eula si F_ ,KO t eh noitcnuf snruter 0 fi t he elif e x stsi dna -1 ehto r .esiw If a lf ag v eula si a ny noitanibmoc fo ,KO_R W KO_ dna ,KO_X eht ac ssec noitcnuf sesu nillac eht nillac g p ssecor laer u res ID dna r e la puorg ID ot kcehc a tsniag eht elif resu ID dna g puor I .D ehT noitcnuf r snrute 0 fi lla eht qer u detse noissimrep si dettimrep dna -1 esiwrehto .

    niwollof ehT niwollof g prog mar u ses ca c sse ot ,enimreted f ro hcae dnammoc enil ra g ,tnemu w h rehte a e elif deman elif e x .stsi If a n a dem elif seod ton e x ,tsi i t lliw eb aerc t de dna itini a il z de htiw a carahc t re nirts g “ H olle ”dlrow . h.dtsinu h.ltncf gra tni(niam tni tni(niam gra ,c hc a a*r rgv ][ ) { rahc fub [ 652 ]; tni nel,csedf ; (elihw www.vtucs.com-- ra gc )0> { fi a( c (ssec * ++ ra ,vg F KO_ )) { a// dnarb wen lif e csedf = o p (ne *arg ,v _O W OR NLY| C_O R ,TAE )4470 ;

    Dept.of CS&E,SJBIT

    egaP 25

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 f(etirw d ,cse “ eH oll lrow d\ ,”n )21 ; } esle { csedf = o p (ne *arg ,v _O R OD NL )Y ; nel(elihw = r dae ( ,csedf b )652,fu ) ,1(etirw ,fub el n ;) } f(esolc d se c ;) } } chm ,do hcf m do :

    dna domhc ehT domhc dna f domc f un snoitc ahc nge elif ca cess snoissimrep rof ,renwo g puor dna srehto dna tes osla tes -UI ,D s te -GID and cits ky lf ags. taht ssecorp A ssecorp taht sllac eno fo eseht snoitcnuf luohs d evah eht e ff e evitc resu DI fo rehtie eht us p re wo eht ro resu ro eht wo n re fo t he f .eli otorp ehT otorp type fo eht se f u snoitcn si g nevi woleb : < edulcni# < sy /s typ h.se > < edulcni# < sy h.tats/s > h.dtsinu< edulcni# h.dtsinu< > *rahc tsnoc( domhc tni domhc tsnoc( *rahc p ,eman_hta t_edom lf a ;)g m ,cesdf tni( domhcf tni domhcf tni( ,cesdf m o t_ed lf ag);

    esu noitcnuf domhc ehT domhc noitcnuf esu s htap eman fo a elif sa a f tsri ra gum tne ehw r sae fc domh sesu csedf sa a tsrif eht tsrif a rg tnemu . lf ehT lf ag ra g tnemu atnoc i sn eht wen a c ssec p noissimre dna a ny laiceps f al sg ot eb tes no eht elif .

    F ro xe am :elp The llof o niw g uf n noitc snrut no eht tes -UID lf ag, r sevome g puor etirw p e noissimr r srehto dna srehto r e da dna exe etuc noissimrep no a elif n dema orp/bjs/rsu/ g1 c. www.vtucs.com < edulcni# < sy /s typ h.se > < edulcni# < sy h.tats/s >

    Dept.of CS&E,SJBIT

    egaP 26

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 h.dtsinu< edulcni# h.dtsinu< >

    diov ahc ng (edom_e ) { tcurts tats ;vtats tni alf g = S( _IW RG P|S_I TOR H|S_IX )HTO ; fi rp/bjs/rsu/“(tats( o ,”c.1g & )vtats ) orrep r tats“( ” ;) esle { alf g = edom_ts.vtats( & lf~ ag) | S _I US ID; fi u“(domhc( s orp/bjs/r g1. ,”c lf a )g ) orrep r omhc“( d )” ; } }

    chow ,n cf oh w ,n cl oh wn:

    a nwohc ehT nwohc a nd nwohcf f noitcnu s ahc nge eht u s re ID dna g puor ID fo selif . They d i ff er no ly ni a tsrif rieht tsrif a rg tnemu ihw ch fer er ot a elif by rehtie a htap eman ro a elif d se c .rotpir ehT nwohcl uf n noitc hc ang se eht pihsrenwo fo sy cilobm knil elif . ehT nwohc noitcnuf ahc n seg eht fo pihsrenwo eht pihsrenwo fo eht elif ot hcihw eht sy cilobm il nk elif er f sre . otorp noitcnuf ehT noitcnuf otorp ty sep fo eseht snoitcnuf a er giv ne woleb : h.dtsinu< edulcni# h.dtsinu< > < edulcni# < sy /s typ h.se > tni nwohc ( tsnoc *rahc ,eman_htap t_diu ,diu t_dig g ;)di tni f hc own (i tn ,csedf t_diu ,diu t_dig g ;)di tni nwohcl ( tsnoc *rahc ,eman_htap t_diu ,diu t_dig g )di ;

    .1 :eman_htap si eht htap n a em fo a elif . .2 :diu www.vtucs.com seificeps eht wen u s re ID ot eb issa gn de ot eht elif . .3 g di : ficeps i se eht wen gr puo ID ot eb ssa ig den ot eht .elif If eht a lautc eulav fo diu ro g di ra g tnemu si -1 eht ID fo eht elif si ton c hang de .

    Dept.of CS&E,SJBIT

    egaP 27

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 2.3 Fi el dna ceR o dr coL k gni : UNIX sy smets wolla m elpitlu sessecorp ot r ae d dna etirw eht emas elif ucnoc r tner ly hcihw sedivorp atad hs a ir ng am no g rp o .sessec It osla re sredn luciffid ty for any ssecorp ni ted e gninimr a ni atad nehw atad ni a elif nac eb dirrevo ned by rehtona p r sseco . In os me fo eht itacilppa o sn ekil a atad b esa am an ,reg hw e er on to h re rp o ec ss nac tirw e ro r dae a elif elihw a ssecorp si ac nissec g a abatad se .elif To emocrevo siht ward bac ,k UNIX dna OP SIX sy smets troppus a elif l co nik g cem h .msina F eli nikcol g si bacilppa le no ly rof reg ralu .selif It swolla a ssecorp ot im esop a kcol no a lif e taht os taht rehto sessecorp c tonna m o id fy eht elif nu t li it i s nu l dekco by eht .ssecorp A ssecorp nac esopmi a etirw kcol ro a re da kcol no rehtie a noitrop fo a fi el ro na eritne elif . ehT ecnereffid neewteb etirw skcol and daer ol c sk si taht nehw a wr eti l kco si es t, it neverp st rehto sessecorp rf om sett ni g any nippalrevo g aer d ro tirw e kcol s on eht dekcol reg noi fo a .elif nO eht rehto ,dnah wh ne a re da kcol si ,tes ti stneverp rehto orp c se s se morf tes t ni g any nippalrevo g etirw col ks no eht l dekco er g noi fo a elif . T eh noitnetni of a tirw e kcol si ot pr neve t rehto essecorp s orf m htob rea nid g dna w gnitir eht dekcol reg noi elihw eht ssecorp taht stes eht l co k si om id fy ni g eht er g .noi A etirw kcol is sla o na sa nwonk sa na lcxe u evis l o kc . ehT esu fo a daer kcol si ot tneverp rehto ecorp s ses morf nitirw g ot eht l dekco reg noi lihw e eht orp c sse taht s ste eht kcol si re ida ng ad ta from eht reg noi . ehtO r orp c sesse a er dewolla to morf atad daer dna kcol dna daer atad morf t eh dekcol er g .snoi ,ecneH a daer kcol si a l os lac l de a hs a der kcol . 2.3 .1 naM datory L ock M otadna ry skcol era ne f decro by na nitarepo g sy mets ek r .len If a otadnam ry ex evisulc kcol is tes no a ,elif on ssecorp nac esu eht daer ro etirw sy mets llac s no atad ssecca ot ssecca atad no eht ol c dek er g .noi If a otadnam ry derahs l o kc si tes no a er g noi fo a ,elif on ssecorp nac esu eht rw i et sy mets llac om ot om dify eht dekcol noiger . It si desu ot sy inorhcn ze nidaer g dna nitirw g fo s derah selif by itlum p el orp :sessec If a orp c se s skcol pu a ,elif hto er rp o sessec aht t stpmetta ot w etir ot eht col k de er g noi s era dekcolb litnu t eh sesaeler ssecorp remrof www.vtucs.comssecorp sesaeler i st kcol .

    Dept.of CS&E,SJBIT

    egaP 28

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 M otadna ry skcol m ay ca esu :smelborp If a anur aw y orp c sse stes a m adna tory ex evisulc kcol no a if el dna ven er skcolnu ,ti on rehto sessecorp c na ca c sse eht dekcol re noig fo eht elif itnu l ur eht rehtie eht ur n wa ay rp oce ss si ki dell ro eht sy mets si etoober .d Sy mets 3.V dna 4.V us p trop adnam tory skcol .

    2.3 .2 dA visory L ock osivda nA osivda ry kcol si on t decrofne by a rek n le ta t eh sy mets llac level . sihT snaem taht ev ne ht ough col k (r dae or etirw ) may be tes no a ,elif to h re sessecorp nac its ll eht esu eht daer ro wr eti A IP s ot ssecca eht elif . oT ekam esu fo osivda ry skcol , orp c sesse taht etalupinam eht mas e lif e tsum c arepoo te cus h ht taht ht ey wollof siht erudecorp rof eve ry r e da ro etirw noitarepo ot eht if l :e

    .a Try ot tes a kcol ta t eh er g noi ot eb .dessecca If siht af i ,sl a ssecorp nac rehtie tiaw of r eht kcol r tseuqe ot b ce o em cus c lufsse ro go od nihtemos g sle e dna try to kcol eht elif ag nia retal . .b retfA a kcol si qca u deri lufsseccus ly, daer ro etirw eht dekcol er g noi r le e esa eht col k .c ehT rd a kcabw of sivda ro y lo skc are taht rp o rg a sm taht aerc te orp c esse s ot erahs elif s tsum wollof eht evoba fi el nikcol g decorp u er ot eb c .evitarepoo sihT may eb tluciffid ot noc lort nehw orp g smar era deniatbo morf tnereffid secruos . NU llA NU IX dna OP SIX sy smets s troppu a d osiv ry skcol .

    UNIX Sy mets V dna P SO IX.I esu the ltncf API f ro elif ikcol ng. The torp to y ep of eht f ltnc API si :

    alf_dmc tni ,csedf tni(ltncf tni tni(ltncf ,csedf tni alf_dmc g, )… ;

    ehT csedf ra g tnemu si a elif ircsed p rot rof a fi el ot eb dessecorp . hT e dmc fl ga ar ug tnem o hcihw senifed hcihw o p noitare is ot eb rofrep m de . dmc Flag esU F ES_ TLKwww.vtucs.com steS a elif .kcol oD ton kcolb fi siht tonnac cus ceed emmi d etai ly F ES_ TLKW steS a f i el kcol na d olb c sk eht lac l ni g ssecorp u n lit eht kcol si eriuqca d F EG_ TLK seireuQ sa ot w h hci orp c sse dekcol a iceps f dei er g noi fo a lif e

    Dept.of CS&E,SJBIT

    egaP 29

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 For file l co ik n ,g the th ri d ar ug em tn to ltncf si an addre ss of a tcurts kcolf - depyt vari ba l .e sihT airav b el iceps f sei a er g noi fo a fi el erehw eht col k is to eb es t, un ,tes ro .deireuq The ts r cu t f kcol si deralced in eht >h.ltncf< a :s

    colf tcurts colf k { s troh l_ty ep ; // tahw kcol to eb tes ro to kcolnu f li e trohs l ;ecnehw_ // a ecnerefer dda sser rof eht n ext f lei d t_ffo _l s trat ; tesffo// orf m eht ehw_l n ec nerefer ce sserdda t_ffo l _ nel ; // woh am ny byt se ni ht e dekcol er g noi t_dip p_l id; P// ID fo a ssecorp hcihw sah dekcol t eh lif e };

    ssop ehT ssop i elb eulav s fo l _type era : _l epyt av l eu sU e F_RDL KC steS a a r e da ahs( r )de ol ck no a deificeps reg oi n F_ RW LCK steS a etirw e( x )evisulc l kco no a ceps i deif r eg oi n F U_ NLCK skcolnU a ceps i deif r egion

    l fo seulav elbissop ehT elbissop seulav fo l _ ecnehw dna rieht sesu ar :e _l w ecneh ulav e sU e RUC_KEES ehT trats_l eulav si dda ed ot eht tnerruc elif niop t re dda r sse . RUC_KEES ehT ! ts_ a tr eulav si dedda ot eht tnerruc elif niop t re esU serdda s TES_KEES ehT l trats_ eulav is dedda ot byte 0 fo eht f i el NE_KEES D ehT l trats_ eulav st ' dda ed ot eht dne uc( r tner is z )e fo ht e lif e

    2.3 .3 Lock orP m ito on dna L ock ttilps ing: If a rp o ssec tes s a aer d l kco no a elif , of r ex elpma orf m dda r sse 0 to ,652 neht stes a tirw e kcol no eht elif morf dda r sse 0 ot ,215 eht ssecorp lliw nwo no ly eno w etir col k no eht elif morf 0 ot .215 www.vtucs.com ehT p suoiver re da kcol f mor 0 ot 652 si on w oc v dere by the w etir ,kcol a dn eht orp c sse seod r eht no skcol owt nwo ton nwo owt skcol no eht r eg noi morf 0 ot .652 T h si ssecorp si dellac kcol p itomor on.

    Dept.of CS&E,SJBIT

    egaP 30

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 F mrehtru o ,er fi eht p or ec ss won skcolnu eht elif rf mo 821 ot ,084 ti lliw nwo owt w etir skcol o n 1 ot 0 morf eno :elif eht :elif eno morf 0 ot 1 27 dna eht rehto f mor 184 ot .215 sihT ssecorp si ca dell kcol lps itt gni .

    orp ehT orp c erude rof ittes ng eht otadnam ry skcol f or UNIX sy mets 3V dna V4 era : The f o oll w ni g file_lo .kc C p or g ar m ulli strat se a esu of fcn lt for f li e l ock ni g: ni# c edul i< ost aer m h. > i# cn ul de s< td oi .h> ni# c edul s< ys/ty h.sep > i# cn ul de f< cntl h. > i# cn ul de

    tni m nia i( nt arg ,c nc a *r ar vg )][ { struct flock fva ;r i tn df es ;c hw i el (-- ra gc > )0 { */ od eht of l wol ing rof e ca h f i el /* if (( fdes =c o ep n(*++ ra vg RWDR_O, )) == -1 ) { ep rr ro ("open"); oc tn ni ;eu } fv ra .l_ty ep = F _ LRW CK; fv ra . _l w eh nce = ES EK_ ES T; fv ra .l s_ tart = ;0 fv ra .l l_ ne = ;0 */ tA et m tp to s et na exclusive ( rw ite) l co k o n t eh e itn er f ile */ hw i el ( cf ltn f( des ,c SF ETLK,&fvar)==- )1 { S */ S et l ock af l ,sl if nd o ut ohw sah col k de eht fi el */ hw i el ( cf ltn f( des ,c F G_ E LT K,&fvar)!=-1 && fv .ra _l yt ep != U_F N CL K){ ra*<

    ( fi ( !fv )nel_l.ra rb eak; fv trats_l.ra += f v nel_l.ra ; fv nel_l.ra www.vtucs.com= ;0 /} * elihw ereht era col ks tes by rehto sessecorp * / l tes elihw */ } */ elihw tes l ock u n- ccus e lufss * /

    Dept.of CS&E,SJBIT

    egaP 31

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 coL k eht elif O K. woN ssecorp atad ni eht f i el * / colnu woN */ woN colnu k eht eritne f li e /* fv .ra _l ty ep = CLNU_F K; fv l.ra _ ecnehw = EES K ES_ T; fv rats_l.ra t = ;0 fv el_l.ra n = ;0 if ( ncf t ,csodf(l S_F ETLKW,& =)raef =- )1 (rorrep "fc ltn ");

    } 0 nruter 0 ; ) /* m nia /*

    3.3 yrotceriD F i el sIPA otceriD ry selif ni NU IX dna SOP IX sy smets era desu ot he pl resu s ni ro g ina zing rieht elif s ni to urts emos urts c erut desab no eht cificeps esu fo elif .

    They ra e also u sed by ht e nitarepo g sy mets ot trevnoc elif ap th seman ot t rieh edoni n u srebm .

    otceriD ry selif era taerc ed ni B DS NU IX dna OP SI 1.X by ridkm PA I: < edulcni# < sys >h.tats/ u< edulcni# u< n tsi d >h. tni km dir ( tsnoc *rahc ,eman_htap m edo t mode ;)

    .1 ehT eman_htap arg nemu t si eht htap eman fo a id r otce ry ot eb cre deta . .2 ehT edom arg emu tn eps c seifi eht ca c sse noissimrep rof eht ,renwo g puor a dn srehto ot be issa g den ot eht f eli . .3 ehT nruter v eula fo dkm ir si 0 fi ti sdeeccus ro -1 fi ti .sliaf

    UNIX Sy mets 3.V sesu t eh donkm PA I ot etaerc otcerid ry .selif UNIX Sy mets 4.V pus po str ob th eht mkdir dna m donk IPA s rof nitaerc g otcerid ry .selif ehT ecnereffid neewteb eht owt sIPA si taht a otcerid ry c aer t de by m donk seod ton niatnoc eht "." dna " ..www.vtucs.com" sknil . nO t eh rehto ,dnah a tcerid ory rc e deta by m ridk ah s eht "." dna " .. " sknil ota eno ni detaerc ni eno ota m ci o p ,noitare dna it is aer dy t o eb desu . A otcerid ry elif si a drocer - detneiro fi ,el erehw hcae drocer serots a if le eman dna eht m edo elif a fo rebmun fo a elif taht ser i sed ni t tah otcerid ry.

    Dept.of CS&E,SJBIT

    egaP 32

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 T eh niwollof g p o elbatr f snoitcnu era d e denif rof otcerid ry elif b niswor g. esehT snoitcnuf a er id< eht htob ni denifed ni htob eht id< er >h.tn dna < sy >h.rid/s hea sred .

    lcni# edu < sy /s typ h.se > denifed fi# denifed (B )DS && ! _ OP SI CRUOS_X E < edulcni# < sy h.rid/s > ty ep d fe tcurts id r tce iD r ;tne esle# >h.tnerid< edulcni# >h.tnerid< ty ep d fe tcurts id r tne riD e ;tn fidne# DI *R idnepo r tsnoc( *rahc ;)eman_htap *tneriD ddaer ir (DI *R ;)csedf_rid tni lc o des ir (DI *R f_rid d )cse ; diov er windd ri D( I *R d i sedf_r c ;)

    eht fo sesu ehT sesu fo eht se itcnuf o sn era :

    ridnepo : snepO a d i er c ot yr elif rof er ad- lno y. ruteR ns a file ah n eld D I *R rof fut eru ref re e ecn of t eh fi el . riddaer : sdaeR a r ce o dr f or m a rid e tc ory f i el r fe e er n dec b y d ri f_ csed dna r et ru sn t h ta cer o dr fni orm noita . ridesolc : esolC s a d ri e tc ory if le r efe ner c de b y rid f_ csed . er w dni d ri : seR e st eht fi el iop n ret ot eht beg ninni g fo eht direc rot y f i el er fer cne de b y rid f_ .csed T eh txen ac ll ot riddaer iw ll r e da t he f ri st cer ord f or m eht fi el .

    UNIX sy smets troppus a tidd i lano cnuf t noi s rof modnar ssecca fo d otceri ry elif .sdrocer esehT n era snoitcnuf era n ot us p rop t de by OP SI :1.X :ridllet snruteR eht elif retniop fo a g nevi d f_ri d .cse :ridkees nahC g se eht if le retniop fo a g nevi _rid f csed ot a deificeps a d sserd .

    otceriD ry www.vtucs.comselif era omer v de by t he idmr r API. I st rp ototy ep i s g vi en below: h.dtsinu< edulcni# h.dtsinu< > tni rmdir oc( n ts *rahc eman_htap );

    Dept.of CS&E,SJBIT

    egaP 33 eD v eci QIIF ' MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 sIPA niwollof ehT niwollof g _tsil dir.C margorp setartsulli sesu fo eht ridkm , epo ndi ,r re da d ri , lc o es d ri , na d mr dir PA Is:

    ni# c edul i< ost aer m h. > ni# c edul ni# c edul s< ys/ty h.sep > ni# c edul u< n si t h.d > ni# c edul h. ni# c edul s< y /s sta h.t > fi# def deni )DSB( && ! OP_ SIX ECRUOS_ ni# c edul s< y /s d .ri >h ty fedep tcurts d i tcer D i ner ;t le# es ni# c edul d< i er n h.t > ty ep fed tcurts d i tner D i tner ; dne# fi

    tni m nia tni( a rg ,c c *rah a r [vg ] ) { tneriD * ;pd DIR* sedf_rid ;c ( elihw ( -- ra gc > 0 ) { */ od eht iwollof ng rof ae ch elif /* ( fi ( ! rid( _fd cse = dnepo i (r * ra++ vg ) )) { ( fi ( km (rid ra* vg , _S I WR UX |S_I WR GX |S_I WR X )O == -1 ) (rorrep idnepo" r" ) ; eunitnoc ; }

    */ nacs hcae d i tcer ory elif t w eci */ i( rof i( nt 0=i ;i 2< i; ++ ) { ( rof ( tni =tnc 0; d p= er a dd i (r csedf_rid );) { fi (i) oc ut << pd - n_d> ame << ldne ; if s( t cr m (p d www.vtucs.comp- n_d> am ,e " .") && crts m (p d p- n_d> am ,e ." . )" ) ++tnc ; */ oc u tn how many elif s ni id r otce ry*/

    ( fi ( ! )tnc { rm (rid ra* vg ;) aerb k ); */ empty rotcerid y /*

    Dept.of CS&E,SJBIT

    egaP 34

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 (riddniwer d ri df e cs ) ; / teser retniop rof dnoces or u dn */ } (ridesolc d ri df e cs ) ; } }

    4.3 eciveD eliF IPA s

    selif eciveD selif era u s de ot fretni a ec p hy lacis d ecive s htiw noitacilppa rgorp a .sm lacificepS ly, wh ne a rp o ssec r sdae or w setir ot a cived e ,elif the rek n le u ses eht ojam r a dn ronim ecived srebmun of a elif ot tceles a ecived revird noitcnuf ot rac ry tuo t eh lautca atad .refsnart m selif eciveD selif m ay eb ahc r retca - desab ro kcolb - ab s .de UNIX sy smets enifed eht mk don PA I ot aerc te ecived selif . < edulcni# < sy >h.tats/s u< edulcni# u< n tsi d >h. tni km n do ( oc n ts rahc * ,eman_htap m edo t om d ,e tni ed v di_eci ) ;

    .1 ehT eman_htap arg nemu t si eht htap eman fo a id r otce ry ot eb cre ta de . .2 ehT edom arg emu tn eps c seifi eht ca c sse noissimrep rof eht ,renwo g puor a dn srehto ot be issa g den ot eht elif . .3 T eh ived c di_e sniatnoc eht rojam dna ronim ecived srebmun dna si noc st detcur in tsom UNIX sy smets sa :swollof ehT tsewol byte fo a d ecive _ di si tes ot a ronim ecived mun ber dna eht en xt b yte si tes to eht rojam ecived .rebmun F ro ex ,elpma ot etaerc a kcolb ecived elif dellac SCSI5 htiw rojam dna nim ro n bmu e sr fo 51 dna ,3 itcepser vely, dna ca c se s ir g sth fo daer - etirw -exec etu rof eve ry ,eno eht m donk sy mets llac si : I_S ,"5ISCS"(donkm I_S BF LK | UXWRI_S | WRI_S XG | RI_S W ,OX <51( < )8 1 3); .4 T eh rojam dna ronim d e eciv srebmun era ex net d de ot fo ru t nee and ie hg te ne ib st , epser cti lev y. .5 In UNI ,X fi a illac ng p ssecor sah on nillortnoc g lanimret dna ti snepo a hc ar tca re www.vtucs.comecived ,elif eht k re n le wi ll tes siht cived e elif sa t eh illortnoc ng animret l of eht rp o .ssec woH -ev ,re fi eht _O N YTTCO lf ag si tes ni eht epo n ,llac hcus noitca lliw eb desserppus .

    Dept.of CS&E,SJBIT

    egaP 35

    MMARGORP METSYS XINU METSYS MMARGORP GNI 10 6SC 2 .6 ehT N_O NO BLOCK f al g ps e ific es aht t eht nepo ac ll dna any s u esb q neu t er ad ro etirw ecived a ot sllac ot a ecived elif ohs u dl eb nikcolbnon g ot eht ssecorp .

    niwollof ehT niwollof g tset nkm o .d C orp g mar setartsulli u es fo eht ,donkm o nep , r ,dae wr ti e, dna solc e APIs no a kcolb ed eciv elif . ni# c edul i< ost aer m >h. ni# c edul ni# c edul s< edulcni# s< y t/s y >h.sep ni# c edul u< n si t >h.d ni# c edul f< cnt >h.l ni# c edul s< y /s sta h.t > tni m nia ( i nt arg ,c hc a *r ar vg [ ] ) { fi ( ra gc! )4= { c tuo << asu" g :e " << ar vg [0] << " < f >eli < major >on on \n”; ter u nr ;0 } tni major = a ot i( ar vg ,)]2[ mi ron = ta oi( ra vg ]3[ ;) (v )dio km (don gra v ,]1[ S _I RHCF | S_I WR XU | S_IRWXG | S_I WR X ,O ( major )8<< | m roni ) ; epo = df ,1=cr tni ,1=cr df = epo n ra( vg ,]1[ RWDR_O | _O NON OLB KC | O_ CON TT Y ;) rahc ub f 52[ 6]; elihw ( rc && df != -1 ) if (( rc = r e da ( f d, ub f, is ze fo ( b fu ) ) ) < 0 ) ep rro (r r" ead" ;) sle e if ( cr ) cout << fub << dne l; olc se( df ;) }

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 36

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 INU T - 5 RP O SSEC C NO ORT L 1.5 Pr co e ss nedi tifiers

     evE ry orp c sse sah a inu q eu ssecorp I ,D a non en evitag egetni r  laicepS secorp s se : corp e ss ID 0 s ludehc er orp ec ss osla nwonk sa ppaws er ssecorp ID 1 tini p ssecor tini ssecorp n reve seid s’ti, a lamron resu p r sseco nur htiw repus esu r elivirp ge p or c sse ID 2 p dega a nome

    h.dtsinu< edulcni# h.dtsinu< > < edulcni# < sy /s typ h.se > t_dip g dipte )diov( ; t_dip g dippte )diov( ; t_diu g diute )diov( ; t_diu g diuete )diov( ; g t_di getg di )diov( ; g t_di g te eg di ( )diov ;

    F kro f noitcnu  ehT no ly way a new pr sseco si detaerc by UNIX k lenre si nehw na xe is nit g ssecorp c slla eht krof uf n noitc < edulcni# < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< > t_dip krof ;)diov(  ehT wen rp o ssec c aer t de b y f o kr si dellac dlihc p r sseco  ehT cnuf noit si dellac o n ec tub snruter iwt ec  ehT nruter v eula ni eht c dlih si 0  ehT www.vtucs.com nruter v eula ni ap rent si eht ssecorp ID fo t he wen lihc d  ehT dlihc si a oc py fo par tne

    egaP 42 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  dlihC g ste a oc py fo pa er stn et x ,t atad , paeh dna cats k  I tsn e da fo elpmoc tely c po ying ew nac u se OC W oc py no w etir uqinhcet e edulcni# edulcni# " uo r .rdh h" tni g bol = 6 ; e */ e x lanret elbairav ni ilaitini z de atad /* ahc r fub [ ] = "a etirw ot tuodts \n"; )diov(niam tni )diov(niam { tni ;rav no elbairav citamotua */ citamotua elbairav no t eh kcats * / t_dip ;dip av r = 88 ; fi DTS(etirw( O _TU FILE ,ON ,fub is z fub(foe )- )1 != is z )fub(foe - )1 _rre sys(" etirw rre ro "); (ftnirp "b ofe re rof k\n"); fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); esle fi dip( == )0 { */ dlihc /* g bol + ;+ */ idom fy rav i selba /* ++rav ; } esle )2(peels ; */ tnerap /* (ftnirp " dip = ,d% g bol = ,d% rav = %d\n", dipteg ( ,) g ,bol v )ra ; ex )0(ti ; } www.vtucs.com tuptuO

    egaP 43 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    irahs elif irahs ng  F kro c aer t se a etacilpud c opy fo t he elif sed c otpir rs enepo d by ap r ne t  erehT era owt ways fo ah nildn g sed c srotpir tfa er f kro .1 ehT ap r tne stiaw rof eht dlihc ot etelpmoc .2 retfA fo kr eht p tnera lc o ses lla sed c srotpir taht ti t’nseod ne de dna the d seo eht niht emas niht g B sedise o p ne selif eht o t reh porp e seitr detirehni by dlihc are x laeR resu I ,D puorg I ,D e evitceff u s re I ,D fe f itce ve puorg ID x atnemelppuS ry puorg ID x ssecorP g puor ID x noisseS ID x nillortnoC g lanimret x tes - resu -ID dna s te -g uor p-ID x tnerruC ikrow ng rid e otc ry x tooR otcerid ry x F eli edom c r noitae sam k x iS gwww.vtucs.comlan am ks dna snoitisopsid x ehT esolc -on-ex ce lf ag f ro a ny nepo elif d tpircse o sr

    egaP 44 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 x tnemnorivnE x dehcattA hs a der omem ry es g tnem s x ecruoseR stimil ffid ehT ffid e ner ce teb w nee t eh tnerap dna lihc d x ehT nruter v eula fo f ork x ehT orp c sse ID x tneraP orp c sse ID x ehT seulav fo itu_smt em , emits_smt , tuc_smt i em , emitsu_smt si 0 rof ihc ld x elif skcol tes by par tne a re ton detirehni by dlihc x nidneP g la r sma era elc ra de rof eht dlihc x ehT tes fo idnep ng s ig an ls rof eht dlihc si tes ot e pm ty es t

     ehT snoitcnuf fo f ork .1 A ssecorp nac ilpud c ta e flesti os taht tnerap dna dlihc nac e hca ex etuce d nereffi t edoc fo snoitces fo edoc .2 A ssecorp nac e x etuce a tnereffid prog ar m

    fv ork  It si emas sa rof k  It si netni d de ot c aer te a wen rp o ssec wh ne eht pu esopr fo n we p ssecor si to exec rp wen a wen rp o arg m  ehT dlihc nur s ni eht as me sserdda s p eca sa ap r ne t litnu ti sllac e rehtie x ce ro e xit  krofv g au r seetna taht eht dlihc snur tsrif , litnu eht dlihc e sllac x ce ro e x ti

    tni g bol = 6 ; */ e x lanret elbairav ni ilaitini z de atad /* )diov(niam tni )diov(niam { www.vtucs.com tni ;rav

    egaP 45 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 /* citamotua elbairav no t eh kcats * / t_dip ;dip rav = 88 ; (ftnirp "b ofe re rofv k\n"); fi ( dip( = fv o ))(kr < 0 ) _rre sys(" fv o kr e r or r"); == dip( fi esle fi dip( == 0) { */ dlihc /* g bol + ;+ */ idom fy ap r ne t's airav b sel /* ++rav ; e_ x )0(ti ; */ c dlih setanimret /* } */ tnerap /* (ftnirp " dip = ,d% g bol = ,d% rav = %d\n", dipteg ( ,) g ,bol v )ra ; ex )0(ti ; }

    2.5 exit cnuf tions  lamroN oitanimret n .1 nruteR morf iam n .2 nillaC g e x ti – sedulcni nillac g e x ti sreldnah .3 nillaC g e_ x ti – ti si llac ed by e x ti nuf noitc  lamronbA oitanimret n .1 nillaC g troba – SIGABRT .2 W neh ssecorp r e seviec c niatre is gn sla  Ex ti s sutat si desu ot ton ify p tnera woh a dlihc et r detanim  W neh a tnerap t e tanimr es erofeb eht ,dlihc eht c h dli si detirehni by tini secorp s  If eht dlihc tanimret se be erof eht tnerap neht eht noitamrofni tuoba eht si o deniatb by www.vtucs.comp a tner hw en ti e x setuce tiaw ro iptiaw d

    egaP 46 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  ehT noitamrofni stsisnoc fo eht ssecorp I ,D eht te noitanimr sutats dna tnuoma of nekat emit UPC emit nekat by rp oce ss  A ssecorp taht sah mret i detan , tub ohw es rap e stn sah ton y te detiaw f ro ,ti si a dellac a z eibmo  W neh a ssecorp hni e etir d by tini setanimret ti t’nseod emoceb a z eibmo  I tin e x setuce o ne fo eht tiaw snoitcnuf ot hctef t eh noitanimret sutats

    3.5 aW ti dna wa ti ip d tcnuf io sn  W neh a dlihc di te mr detani eht p tnera si iton f dei by eht k lenre by se nidn g a SI CG HLD s ig an l  ehT noitanimret fo a dlihc si na a syn suonorhc e ev tn  ehT ap r tne ac n igno er or nac p edivor a oitcnuf n taht si dellac wh ne ht e is g an l rucco s  ehT orp c sse taht sllac w a ti ro diptiaw ac n .1 B col k .2 nruteR etaidemmi ly tiw h noitanimret sutats fo eht dlihc .3 nruteR etaidemmi ly tiw h na rre ro < edulcni# < sy h.tiaw/s > < edulcni# < sy /s typ h.se > ;)coltats* tni( tiaw t_dip tiaw tni( ;)coltats* ,dip t_dip( diptiaw t_dip diptiaw t_dip( ,dip i tn coltats* , tni snoitpo ) ;  coltatS si a retniop ot ni t rege  If coltats si ton a llun retniop eht, noitanimret sutats fo eht detanimret ssecorp si ot detniop noitacol eht ni derots ni eht noitacol detniop ot by eht arg nemu t  ehT tni eger sutats nruter ed b y ht e owt uf n snoitc g evi noitamrofni tuoba ex ti sutats , is g lan rebmun dna tuoba gen noitare fo eroc lif e  sorcaM hcihw p edivor i n noitamrof tuoba woh a p r sseco detanimret orP gr ma ot etartsnomed t eh esu fo eht ex ti utats s www.vtucs.comedulcni# .eupa" h" < edulcni# < sy h.tiaw/s >

    egaP 47 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 e_rp dioV e_rp x tni(ti sutats ) { fi ( W FI EXIT tats(DE u )s ) (ftnirp "no lamr mret i ,noitan ex ti sutats = d% \n",WEXI tats(SUTATST u ;))s esle fi ( W FI SIGNALE )sutats(D ) lamronba"(ftnirp et r ,noitanim is g lan rebmun = %d% s\n",W MRET SIG ,)sutats( fedfi# W PMUDEROC W )sutats(PMUDEROC ? " oc( re elif ge etaren d)" : ""); esle# ""); fidne#

    esle fi ( W FI EPPOTS D )sutats( ) dlihc"(ftnirp ,deppots is g lan rebmun = % d\n",W POTS SI sutats(G ) ;) } WIF XE I ET D EURT – fi dlihc detanimret lamron ly WEXI SUTATST – si us de ot ctef h eht wol er 8 stib fo a rg tnemu lihc d p a dess ot e x ti ro ixe_ t WIFSIGNALED EURT – fi dlihc detanimret lamronba ly W SMRET IG – si us de ot hctef the sig lan un m eb r t desuac taht desuac t e noitanimr W PMUDEROC – si eurt si eroc elif w sa g ne e etar d

    WIF EPPOTS D EURT – rof a dlihc taht si tnerruc ly eppots d WS SPOT IG -- si desu ot hctef eht is g lan bmun re ots ot dlihc desuac taht desuac dlihc ot ots p

    4.5 aW pti www.vtucs.comdi  ehT erpretni t noita fo dip ni diptiaw sdneped no sti ulav e

    egaP 48 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .1 diP == -1 – stiaw rof any dlihc .2 diP > 0 – stiaw rof ihc ld esohw orp c sse ID qe u sla dip .3 diP == 0 – w stia of r c dlih esohw rp o ssec org up ID slauqe aht t fo gnillac secorp s .4 diP < -1 – stiaw rof ihc ld esohw ssecorp g puor DI slauqe ot etulosba eulav of dip

     W diptia spleh su tiaw rof a lucitrap ar orp c sse  It si ikcolbnon ng noisrev fo tiaw  It stroppus boj ortnoc l

    W NAHON G W diptia liw l ton kcolb fi eht dlihc deificeps si lbaliava ton lbaliava e W DECARTNU stroppus boj lortnoc

    edulcni# h edulcni# edulcni# " .rdhruo h" I tn diov(niam ) { t_dip ;dip tni ;sutats fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); esle fi dip( == )0 */ dlihc /* ex )7(ti ; tiaw( fi tiaw( (& )sutats =! ip )d www.vtucs.com */ tiaw rof dlihc /* _rre sys("w tia orre r ;)"

    egaP 49 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 e_rp x )sutats(ti ; */ dna tnirp sti sutats * / fi ( ( dip = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); esle fi dip( == )0 */ dlihc /* )(troba ; */ gen etare s SIGAB TR * / tiaw( fi tiaw( (& )sutats =! ip )d */ tiaw rof dlihc /* _rre sys("w tia orre r ;)" _rp ex )sutats(ti ; */ dna tnirp sti sutats * / fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); esle fi dip( == )0 */ dlihc /* sutats =/ ;0 */ edivid by 0 gen setare SIGF EP /* fi tiaw( (& )sutats =! ip )d */ tiaw rof dlihc /* _rre sys("w tia orre r ;)" e_rp x )sutats(ti ; */ dna tnirp sti sutats * /

    ex )0(ti ; }

    5.5 aW iti d < edulcni# < sy >h.tiaw/s di(ditiaw tni www.vtucs.comdi(ditiaw typ t_e di ty ep , t_di ,di is g t_ofni ,pofni* tni ;)snoitpo e no 1 ,KO fi 0 :snruteR 0 fi ,KO 1 no e r or r

    egaP 50 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    6.5 wait3 dna wait4 tcnuf io sn  esehT snoitcnuf are as me sa diptiaw tub edivorp lanoitidda noitamrofni tuoba eht ruoser c se desu by eht t re detanim secorp s edulcni# < sy .tiaw/s h> < edulcni# < sy /s typ h.se > < edulcni# < sy >h.semit/s < edulcni# < sy uoser/s r .ec h> asur tcurts ,snoitpo tni, coltats* tni( 3tiaw t_dip 3tiaw tni( coltats* tni, ,snoitpo tcurts asur ge sur* age ) ; i, dip t_dip( 4tiaw t_dip 4tiaw t_dip( dip i, nt coltats* tni, ,snoitpo ts r tcu sur age ur* as ge ;) www.vtucs.com 7.5 Ra ec c idno it on

    egaP 51 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  ecaR noitidnoc cco ru s nehw elpitlum ssecorp a er trying ot od ihtemos ng htiw ad derahs ad ta dna lanif tuo emoc sdneped no eht ord re ni hcihw eht rp o essec s nur orP gr ma htiw ar ce idnoc t noi edulcni# h edulcni# " .rdhruo h" mitatarahc diov citats diov mitatarahc e(c rah )* ; )diov(niam tni )diov(niam { t_dip ;dip fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); == dip( fi esle fi dip( == 0) { arahc t emita (" tuptuo orf m lihc d\n"); } esle { arahc t emita (" tuptuo orf m nerap t\ )"n ; } ex )0(ti ; } diov citats diov arahc t hc(emita ar rts* ) { ahc r ;rtp* tni c; ,tuodts(fubtes N ULL); */ tes effubnu r de /* rof www.vtucs.comrtp( = ;rts c = rtp* + ;+ ) ,c(ctup ;)tuodts

    egaP 52 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 } rp deretla*/ rp ogr /*ma edulcni# h edulcni# " .rdhruo h" mitatarahc diov citats diov mitatarahc e(c rah )* ; I tn diov(niam ) { t_dip ;dip TE LL _ AW IT )( ; fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); == dip( fi esle fi dip( == 0) { AW I TNERAP_T ( ;) */ tnerap g seo tsrif /* arahc t emita (" tuptuo orf m lihc d\n"); } esle { arahc t emita (" tuptuo orf m nerap t\ )"n ; TE LL C_ HIL dip(D ); } ex )0(ti ; } mitatarahc diov citats diov mitatarahc e(c rah rts* ) { ahc r ;rtp* tni ;c ,tuodts(fubtes N ULL); */ tes effubnu r de * / rof www.vtucs.comrtp( = ;rts c = rtp* + ;+ ) ,c(ctup ;)tuodts

    egaP 53 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 }

    8.5 e cex uf n tc io sn  Ex ce alper c se eht illac ng ssecorp by a n we rp o rg am  ehT wen rp o marg sah as em ssecorp ID sa eht nillac g orp c se s  oN en w rp ogr ma si c er deta , ex ce tsuj lper aces eht uc r tner p secor s by a new argorp m edulcni# h.dtsinu< > e tni e x 1ce ( tsnoc rahc * p ,emanhta tsnoc c h ra * ra g0 …, */ ( rahc *) ;)/*0 e tni e x vce tsnoc( rahc * ap ,emanht rahc * tsnoc a r vg [ ]); e tni e x elce tsnoc( rahc * ap ,emanht tsnoc hc ar a* r 0g …, rahc(*/ *) 0 , rahc * tsnoc pvne [ ] )/* ;

    e tni e x evce ( tsnoc hc ar * ,emanhtap c h ra tsnoc* argv[ ] , rahc tsnoc* vne p [ ]); e tni e x plce tsnoc( rahc if* l ,emane tsnoc c h ra *arg0 ,… rahc(*/ )* ;)/*0 e tni e x pvce tsnoc( rahc * emanelif c, h ra tsnoc* ra vg [ ] ;)

    edulcni# h edulcni# edulcni# " .rdhruo h" ahc r tini_vne* [ ] = { " wonknu=RESU n", "P pmt/=HTA ", UN LL } ; )diov(niam tni )diov(niam { t_dip ;dip fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); == dip( fi esle fi dip( == 0) { iceps */ iceps fy www.vtucs.com,emanhtap s ep ic fy tnemnorivne * / e ( fi ( e x elce (" vets/emoh/ e llaohce/nib/sn ",

    egaP 54 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 "e llaohc ", "my ra g1", YM" 2GRA ", rahc( *) ,0 )tini_vne < )0 _rre sys("ex elce rre o )"r ; } fi ,dip(diptiaw( N ULL, 0) < 0 ) _rre sys("w tia orre r ;)"

    fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r");

    == dip( fi esle fi dip( == 0) { iceps */ iceps fy ,emanelif ni her ti tnemnorivne /* fi e( x hce"(plce o lla ", "e llaohc ", " no ly 1 arg", rahc( *) )0 < )0 _rre sys("ex plce e orr r"); } ex )0(ti ; }

    gnignahC resu sDI dna puorg sDI  otorP ty ep < edulcni# < sy /s typ h.se > inu< edulcni# inu< h.dts > )diu t_diu( diutes tni diutes t_diu( )diu ; tes tni tes g di (g t_di g )di ;  www.vtucs.comseluR

    egaP 55 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .1 If eht rp o ssec sah us per resu livirp eg ,e ht e diutes noitcnuf stes – re la u res ID, ffe e evitc resu ID , as v de tes - resu -ID ot diu .2 If the ssecorp tonseod ha ev resurepus p ,egelivir tub diu slauqe htie re laer resu ID tes devas ro devas tes -us re -I ,D tes u di stes no ly e f evitcef u ser ID ot diu .3 If n rehtie fo eht owt co snoitidn si ,eurt onrre si tes ot MREPE dna na rorre is denruter ID exec ex ce

    teS - resu -ID tib fo f teS - resu -Id tib o n

    resu laeR resu ID ahcnu ng de ahcnu nged

    u evitceffE u s re ID ahcnu ng de teS morf resu ID of margorp lif e resu tes devaS tes resu ID deipoc morf fe f vitce e deipoc morf e ff e vitc e resu ID resu ID

    ID repuS esu r nU degelivirp esu r resu laeR resu ID teS ot iu d ahcnu nged u evitceffE u s re ID teS ot iu d teS ot iu d tes devaS tes - resu ID teS ot iu d ahcnu nged 9.5 ertes u di dna s te r ge di edulcni# < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< > ;)diue t_diu ,diur t_diu( diuertes tni diuertes t_diu( ,diur t_diu ;)diue ertes tni ertes g di (g t_di rg di ,gi t_d e g ;)di www.vtucs.com es te iu d a nd s te ge id

    egaP 56 Dept.of CS&E,SJBIT

    SC01 26 GNIMMARGORP METSYS XINU METSYS edulcni# < sy /s typ GNIMMARGORP h.se > # edulcni h.dtsinu< > ;)diue t_diu( diuetes tni diuetes t_diu( ;)diue etes tni etes g di (g t_di eg ;)di erpretnI t re f seli  F seli hcihw b eg ni htiw a enil fo eht mrof !# emanhtap [ lanoitpo arg tnemu ] e nommoc tsom nommoc e x elpma : !# hsab/nib/  ehT lautca elif e x dece by lenrek si eht eno ps e ic if ed ni eht manhtap e

    e*/ x elpma fo reterpretni /*elif kwa/nib/!# -f BEGIN { rof i( = ;0 i < ;CGRA +i +) ftnirp " VGRA [ d% ] = % s\n", ,i VGRA [ ]i exit }  sesU fo pretni r rete selif .1 hT ey ih de eht f tca taht c e niatr rp og smar a er s c stpir ni emos rehto al nguage .2 hT ey p edivor na ffe i eic cn y iag n .3 hT ey h ple su etirw llehs stpircs nisu g sllehs rehto naht s/nib/ h

    .5 10 sys et m itcnuf no  It spleh su ex etuce a oc m dnam nirts g nihtiw a rp ogr ma  Sy mets si detnemelpmi b y c nilla g f o ,kr e x ce dna dipdiaw >h.bildts< edulcni# >h.bildts< tni syst me tsnoc( c h ra * nirtsdmc g);  www.vtucs.comnruteR seulav fo sy mets f noitcnu  -1 – fi rehtie f o kr sliaf o r diptiaw snruter na e rorr rehto naht EI TN R

    egaP 57 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  721 -- If ex ce sliaf [ sa fi llehs sah e x detuce e x ti ]  noitanimret sutats fo llehs -- fi lla eerht snoitcnuf deeccus

    # edulcni h edulcni# edulcni# .onrre< >h edulcni# >h.dtsinu< tni syst tsnoc(me c h ra * c nirtsdm g) is tuohtiw noisrev */ noisrev tuohtiw is g lan nildnah g * / { t_dip ;dip tni ;sutats nirtsdmc( fi nirtsdmc( g == UN LL) )1(nruter ; wla */ wla ays a dnammoc rp rosseco htiw inU x /* fi ( dip( = f o ))(kr < )0 { sutats = - ;1 */ baborp ly tuo fo p or c sesse /*

    } esle fi dip( == 0) { */ dlihc /* ex (lce " hs/nib/ ", "sh", "-c", irtsdmc ng, ahc( r *) )0 ; e_ x )721(ti ; */ e x lce rorre * /  } { esle { */ tnerap /* elihw ,dip(diptiaw( & ats t ,su )0 < 0 ) www.vtucs.com fi onrre( =! EIN )RT { sutats = - ;1

    egaP 58 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 */ rorre rehto t h na EI RTN rf mo )(diptiaw /* kaerb ; } } s(nruter )sutat ; }

    */ call ni g s y ets m nuf ctio /*n edulcni# h edulcni# edulcni# " .rdhruo h" )diov(niam tni )diov(niam { tni ;sutats fi ( sutats( = sy mets (" ad t ))"e < )0 _rre sys("sy )(mets rre ro "); e_rp x )sutats(ti ; = sutats( ( fi ( sutats( = sy mets (" on s nammochcu d" )) < 0 ) _rre sys("sy )(mets rre ro "); e_rp x )sutats(ti ; fi ( sutats( = sy mets ("wh e ;o x ti 44 " )) < 0 ) _rre sys("sy )(mets rre ro "); e_rp x )sutats(ti ; ex )0(ti ; }

    .5 11 orP cess a cc oun it gn  ssecorP ac nitnuoc g : w eh n delbane ke lenr setirw an itnuocca ng r droce cae h emit a www.vtucs.comssecorp animret t se  itnuoccA ng r e sdroc : 23 b y set fo ib nary tad a

    .tpeD fo SI E, TIBJS egaP 59 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 cca tcurtS cca t { rahc a lf_c ag; rahc a tats_c ; t_diu ;diu_ca g t_di ca _g di ; t_ved tt_ca ty; t_emit ;emitb_ca t_pmoc ;emitu_ca t_pmoc ;emits_ca t_pmoc emite_ca ; t_pmoc mem_ca ; t_pmoc ;oi_ca t_pmoc wr_ca ; rahc a mmoc_c ; }

    orp*/ g: ot g ne e etar ca cou nitn g atad * /

    edulcni# " uo r .rdh h" TCCA enifed# TCCA FILE " p/mda/rav/ a cc t" isnu citats isnu g den ol ng nolu2tpmoc g )t_pmoc( ; ni t )diov(niam { tcurts cca t atadca ; IF LE ;pf* = pf( ( fi ( www.vtucs.compf( = nepof ( IFTCCA L ,E "r")) == N ULL) _rre sys("can't nepo % s", IFTCCA L )E ;

    egaP 60 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 elihw rf( e da (&a ,atadc is z foe ( tadca a ,) ,1 )pf == 1 ) { %"(ftnirp - s*.* e = dl6% , srahc = ,dl7% " " tats = :% c% %c %c % c\n", is z a(foe c ca.atad _ )mmoc , is z atadca(foe . ca _ ,)mmoc atadca .ac ,mmoc_ adca(gnolu2tpmoc t ca.a _ ,)emite nolu2tpmoc g(a dc ata . )oi_ca , isnu( g den hc a )r atadca . tats_ca ,

    edfi# f EROCA */ 4RVS nseod 't ifed ne EROCA /* atadca . f_ca al g & EROCA ? 'D' : ' ', esle# ' ', fidne# edfi# f XA SIG */ 4RVS nseod 't ifed ne XA SIG */ atadca . f_ca al g & XA SIG ? 'X' : ' ', esle# ' ', fidne# atadca . f_ca al g & AFORK ? 'F' : ' ', atadca . f_ca al g & USA ? 'S' : ' )' ; } ef( fi ef( r ror ( )pf ) _rre sys("r dae e orr r"); www.vtucs.comex )0(ti ; }

    egaP 61 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 isnu citats isnu g den ol ng nolu2tpmoc g t_pmoc( c o tpm )emi isnu ot t_pmoc trevnoc */ trevnoc t_pmoc ot isnu g den ol ng * / { isnu g den ol ng ;lav tni exp; lav = emitpmoc & 7710 7 ;7 */ 31 - tib noitcarf /* exp = emitpmoc( >> )31 & 7 ; */ 3 - tib e x tnenop 0( - )7 /* elihw e( xp -- > 0) lav =* ;8 av(nruter l ;) }

    .5 12 resU nedi tificat oi n ol eht niatbo oT niatbo eht ol g ni man e h.dtsinu< edulcni# h.dtsinu< > rahc *g lte og ni )diov( ; semit ssecorP semit < edulcni# < sy >h.semit/s ;)fub* smt tcurts( semit t_kcolc semit tcurts( smt ;)fub* mt tcurtS mt s { t_kcolc emitu_smt ; kcolc t_ emits_smt ; t_kcolc ;emituc_smt t_kcolc ;emitsc_smt } www.vtucs.com

    egaP 62 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 h.semit/s edulcni# " uo r .rdh h" diov citats diov semit_rp ,t_kcolc( rts u tc smt ,* tcurts smt )* ; diov citats diov hc(dmc_od ar )* ; hc ,cgra tni( niam tni niam tni( ,cgra hc ar *argv[ ]) { tni ;i rof i( = ;1 i < ra g ;c i ++) a(dmc_od rgv[i] ;) */ ecno rof hcae dnammoc - enil a rg * / ex )0(ti ; } diov citats diov hc( dmc_od hc( ar dmc* ) e */ e x etuce dna emit eht dmc" " * / { tcurts smt ,tratssmt dnesmt ; t_kcolc ,trats ;dne tni ;sutats f ,rredts(ftnirp "\n :dnammoc % s\n", )dmc ; fi ( trats( = semit (& ))tratssmt == - )1 */ nitrats g seulav /* _rre sys(" semit e r or r"); = sutats( ( fi ( sutats( = sy mc(mets d )) < 0 ) */ e x etuce c o dnamm /* _rre sys("sy )(mets rre ro "); fi ( dne( = (semit & esmt n ))d == -1) */ nidne g v seula /* www.vtucs.com_rre sys(" semit e r or r"); dne(semit_rp - ,trats & ,tratssmt & )dnesmt ;

    egaP 63 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 e_rp x )sutats(ti ; } diov citats diov semit_rp t_kcolc( r e ,la tcurts smt tratssmt* , tcurts smt )dnesmt* nol citats { citats nol g kctklc = ;0 fi kctklc( == 0 ) */ hctef kcolc skcit per dnoces tsrif emit /* fi ( kctklc( = sys _(fnoc S _C CL ))KCT_K < 0 ) _rre sys("sy ocs nf e r or r"); ftnirpf rredts( , " :laer % 2.7 f\n", r lae / elbuod( ) cl ;)kctk ftnirpf edts( r ,r " :resu 2.7% f\n", dnesmt( - smt> _ emitu - >tratssmt )emitu_smt / lbuod( e) ;)kctklc ,rredts(ftnirpf " sy :s % 7 2. f\n", dnesmt( - emits_smt> - tratssmt - )emits_smt> / )elbuod( )kctklc ; rredts(ftnirpf , " dlihc u :res 2.7% f\n" nesmt(, d-> emituc_smt - tratssmt -> )emituc_smt / )kctklc )elbuod( )kctklc ; ftnirpf dts( e ,rr " dlihc sys: 2.7% f\n", dnesmt( - emitsc_smt> - tratssmt -> )emitsc_smt / )kctklc )elbuod( )kctklc ; }

    .5 12 orP cess g uor sp  A ssecorp g puor si a loc l noitce fo eno ro om re rp o .sessec  hcaE rp o ssec g puor h sa a euqinu ssecorp g puor ID.  ssecorP g puor IDs are si ralim ot ssecorp I sD --- ht ey are evitisop tni eg sre a dn ht ey ots eb nac eb ots r de ni a t_dip atad type.  ehT noitcnuf g te pg pr er t snru eht ssecorp puorg DI fo eht illac ng rp o ssec .  hcaE orp c sse g puor nac evah a rp o ssec ael d .re T eh dael er si deifitnedi by gnivah puorg ssecorp sti www.vtucs.comssecorp puorg ID uqe al sti ssecorp ID. edulcni# < sy /s typ h.se >

    egaP 64 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 h.dtsinu< edulcni# h.dtsinu< > t_dip g te pg pr )diov( ;  It si elbissop of r a rp o ec ss g puor l dae er ot cr etae a ssecorp g puor , cr etae rp co sesse eht ni eht g ,puor dna neht et r .etanim  ehT rp o ssec puorg llits xe is ,st sa gnol as eht re si ta tsael one p secor s ni the g puor , reg dra l sse htehw er eht gr puo redael t e setanimr ro ton  ssecorp g puor il f emite — eht doirep fo emit ht at eb g sni wh ne eht g puor si taerc de t nehw sdne dna sdne nehw t he tsal p r sseco ni eht g puor ael ves eht g or pu  A ssecorp snioj na ex nitsi g rp o ssec g ,puor ro cr setae a n we rp o ssec gro pu by nillac g tes pg di . < edulcni# < sy /s typ h.se > h.dtsinu< edulcni# h.dtsinu< > ptes tni ptes g di t_dip( dip , t_dip digp ;)  sihT stes eht orp c sse gro pu ID ot p g di of eht p or c sse .dip If the owt argum stne ra e orp eht ,lauqe eht orp c sse ficeps i de by dip b semoce a p or c sse puorg ael d re .  A ssecorp nac tes eht pr sseco puorg ID fo no ly flesti ro eno fo sti .nerdlihc If dip si ,0 eht ssecorp ID fo the llac er si .desu oslA fi p dig si ,0 eht ssecorp ID s eificep d by dip si desu sa eht p or c sse puorg ID.  In tsom boj - lortnoc lehs ls siht noitcnuf si dellac a retf a krof ot h eva the pa tner tes eht ssecorp gr puo ID fo t eh ,dlihc dna ot ah ve ht e dlihc tes sti nwo corp se s g uor p ID.

    21.5 SES S NOI S  A noisseS si a noitcelloc fo eno ro om re g .spuor  ehT orp c sesse ni a rp co sse puorg are lausu ly depuorg rehtegot otni a secorp s g puor by a llehs enilepip .  A ssecorp sehsilbatse a n we noisses by illac ng ht e distes .noitcnuf cni# edul < sy /s typ h.se > www.vtucs.comedulcni# h.dtsinu< > )diov( distes t_dip distes )diov(

    egaP 65 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  If eht c nilla g rp o ssec si ton a ssecorp g puor lea ,red siht noitcnuf rc e eta s a en w iht eerhT .noisses eerhT iht ngs ah p :nep .1 ehT orp c sse semoceb ht e noisses redael of siht wen .noisses .2 ehT rp o ssec b emoce s eht rp o ssec gro pu le eda r of a en w orp c sse g puor . ehT orp wen orp c sse g puor ID si eht ssecorp ID fo eht nillac g orp c sse . .3 ehT orp c sse sah on tnoc r nillo g lanimret . nillortnoC g lanimret x rahc a scitsiretc fo s snoisse dna ssecorp spuorg x A noisses nac ah ve a is ng el lortnoc nil g t e .lanimr x ehT noisses dael er taht sehsilbatse eht nnoc e noitc ot eht nillortnoc g et r lanim is illortnoc eht dellac eht illortnoc ng rp o ssec . x ehT orp c sse g spuor nihtiw a noisses c na be dedivid otni a is ng el foreg uor dn ssecorp g puor dna eno o r erom cab k dnuorg orp cess gr spuo . x If a noisses sah a tnoc r nillo g ,lanimret eht n ti sah a is ng el rofe nuorg d ssecorp g ,puor dna lla rehto rp co sse spuorg ni eht noisses era b ackg dnuor p r sseco .spuorg x W reveneh ew type uo r s’lanimret etni r tpur key or tiuq key siht uac s se ie t reh ht e rretni tpu is gn la or eht q tiu is g lan ot be tnes ot lla secorp s se ni eht rof eg uor dn ssecorp g puor . x If a medom nnocsid e tc si detceted by eht te lanimr afretni c ,e eht ah ng- pu sig lan is nillortnoc eht ot tnes ot eht nillortnoc g p r seco s

    .5 13 tc teg p prg dna t tesc p prg cnuF it no s  We deen ot llet eht lenrek hcihw ssecorp g puor is eht rof eg dnuor orp c se s g ,puor os taht eht t lanimre ved i ec d revir nk o sw wh re e to dnes ht e lanimret upni t dna ht e lanimret - g ne e detar s igna sl < edulcni# < sy /s typ h.se > h.dtsinu ct t_dip ct g te pgrp tni( sedelif ;) tni www.vtucs.comptesct g tni(pr sedelif , p t_di diprgp );

    egaP 66 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  ehT noitcnuf prgptegct snruter eht ssecorp g or up ID fo eht of er g dnuor secorp s g puor detaicossa htiw eht lanimret nepo no sedelif .  If ht e orp c sse ah s a noc t nillor g te ,lanimr eht p or c sse ac n c lla tesct pgrp ot tes eht of reg dnuor p ssecor org up ID ot ..diprgp

    .5 14 J bo oC n rt lo  oT wolla su ot trats um l elpit sboj morf a is ng el t lanimre dna lortnoc hw i hc boj s nac a ssecc eht t lanimre a dn hcihw sboj era ot eb r nu ni eht cab kg .dnuor  It r seriuqe 3 f smro fo us p :trop . A llehs taht s stroppu boj .lortnoc . ehT lanimret vird er ni eht lenrek tsum troppus oj b .lortnoc . troppuS rof rec t nia boj -c lortno is g lan s . A boj si tsuj a noitcelloc fo secorp s ,se netfo a ip ep enil fo secorp s .se . W neh ew trats a rgkcab o dnu ,boj eht lehs l issa g sn ti a oj b edi reifitn dna tnirp s erom ro eno ro erom p ssecor IDs. . $ ekam lla > aM k tuo.e & [ ]1 5741 $ rp c.* | rpl & [ ]2 0941 $ tsuj sserp NRUTER [2] + enoD rp c.* | rpl & [1] + enoD ekam lla > aM k tuo.e & . ehT re nosa why we vah e ot sserp NRUTER si ot evah eht ehs ll tnirp sti p .tpmor ehT llehs ’nseod t tnirp eht ahc n deg sutats of cab kg nuor d sboj ta any r na d mo emit -- no ly rig th ofeb re ti stnirp sti ,tpmorp ot tel su e retn a wen dnammoc nil e. . niretnE g the dnepsus ek y lrtC( + Z) c sesua t eh lanimret revird ot s dne t eh SI PTSTG is gn la ot lla p r sesseco ni eht f oreg nuor d ssecorp g .puor ehT lanimret ird v re r e la ly skool f or 3 ceps i la ahc r tca e ,sr hcihw ge en etar is gwww.vtucs.comslan ot eht of r dnuorge orp c sse g puor : • ehT tpurretni c h ra a retc areneg t se SIGINT

    egaP 67 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 • hT e tiuq ahc r retca eneg ar set SIG UQ IT • ehT dnepsus c h ra a retc ge setaren SI TSTG P

    MARGORP oof.pmet tac$ oof.pmet & trats ni cab kg ,dnuor tub ll’tI daer morf dradnats upni t [ ]1 1861 $ ew sserp RUTER N [1] + S deppot t( ty tupni ) tac > oof.pmet & f $ f g %1 nirb g boj n rebmu 1 ot f ro nuorge d of.pmet > tac > of.pmet o eht llehs sllet su hcihw boj si won ni eht rof eg uor nd dlrow ,olleh dlrow retne eno nil e D^ ty ep ruo dne -of- lif e of.pmet tac $ tac www.vtucs.comof.pmet o kcehc taht eht o ne enil p tu otni eht elif dlrow ,olleh dlrow

    egaP 68 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26  W tah sneppah fi a b ackgro dnu boj stuptuo ot eht nillortnoc g lanimret ?  sihT noitpo ew nac wolla ro .wollasid lamroN ly ew esu eht ts ty(1) oc m dnam ot ahcnge siht .noitpo $ tac oof.pmet & ex etuce ni cab kgro dnu [ ]1 9171 dlrow ,olleh $ ,olleh dlrow eht tuptuo morf eht cab kg uor nd eppa a sr tfa er eht tpmorp ew p r sse ruter n [1] + enoD tac t e oof.pm & ts $ ts ty potsot elbasid iliba ty fo b ca kg dnuor j sbo ot tuptuo ot nillortnoc g lanimret [ ]1 1271 $ ew sserp r ute rn dna dnif eht boj si deppots [1] + S t(deppot ty tuptuo ) tac oof.pmet &

    hS e ll Ex ce tu ion fO P or g ar ms  B enruo s h lle t’nseod us p trop boj lortnoc  sp –xj g sevi eht niwollof g uptuo t

    PPID PID P GID S DI PT GID AMMOC ND 1 361 361 361 361 - hs 361 861 361 361 361 sp  B hto eht llehs dna eht sp dnammoc are ni ht e emas noisses na d of er g nuor d ssecorp g uor p .)361( ehT tnerap fo eht sp ammoc nd si eht .llehs  A ssecorp d o t’nse evah a lanimret ssecorp lortnoc g puor .  A ssecorp oleb ngs ot a p ssecor g ,puor dna eht rp o ssec puorg oleb ngs ot a sses .noi m noisses ehT noisses m ay ro m ay ton evah a illortnoc ng et r .lanim  ehT rof e dnuorg rp o ssec g puor ID si na etubirtta of eht ,lanimret ton eht rp o .ssec  If sp sdnif taht eht sses i no seod ton evah a tnoc r nillo g ,lanimret ti stnirp - .1 If www.vtucs.comew ex etuce eht c om dnam ni eht cab kg uor n ,d sP – jx &

    egaP 69 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 ehT no ly v eula taht c segnah si eht orp c sse ID. sp –xj | c 1ta

    PPID PID P GID S DI PT GID MMOC A DN 1 361 361 361 361 - hs 361 002 361 361 361 tac 1 002 102 361 361 361 sp ehT tsal rp o ssec in eht pi enilep si eht dlihc fo ht e ,llehs dna ht e tsrif rp o ec ss ni eht .ssecorp tsal eht fo dlihc a si enilepip si a dlihc fo eht tsal .ssecorp  If ew ex etuce eht ilepip ne ni eht cab kg nuor d sp –xj | c 1ta &  nO ly eht p ssecor IDs hc ang .e  ecniS eht s h lle ’nseod t h eldna boj ,lortnoc ht e rp o ssec g uor p ID o f eht backg nuor d sessecorp sniamer ,361 as seod eht lanimret orp ec ss g puor I .D

    ahprO n de p r co e ss g uor sp  We wonk taht a ecorp ss esohw tnerap mret ni a set si dellac na ahpro n dna is detirehni by t he tini orp c .sse  semitemoS eht eritne rp o ssec g spuor c na eb pro ah .den  sihT si a boj - lortnoc sh .lle ehT llehs alp c se ht e rof eg nuor d orp c sse ni sti nwo ssecorp g (puor 215 ni eht ex )elpma dna eht llehs ts ays ni sti nwo p secor s g uor p .)244( ehT dlihc stirehni eht ssecorp puorg fo sti .)215(tnerap retfA t eh krof , . ehT tnerap speels rof 5 .sdnoces sihT si eht i( m frep e )tc way fo nittel g eht dlihc ex etuce ofeb re eht p a ner t etanimret s . ehT dlihc sehsilbatse a is g lan dnah l re rof the ah ng- pu is g lan (SIG .)PUH Th si si so nac ew nac s ee fi SIG PUH si tnes ot eht .dlihc . ehT dlihc flesti eht pots is g (lan SIG )PTST htiw eht llik .noitcnuf . W neh eht tnerap ,setanimret eht dlihc si ,denahpro os eht s’dlihc tnerap secorp s ID www.vtucs.comsemoceb ,1 t he tini ssecorp ID. . tA siht tniop eht dlihc si won a rebmem of na ro p denah ssecorp puorg .

    egaP 70 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 . ecniS eht ssecorp g puor is denahpro nehw eht p ra tne ,setanimret ti si deriuqer aht t eve ry p ssecor in eht newly o enahpr d orp c sse puorg taht si deppots be tnes eht gnah - pu is gn la ( SI UHG P) dewollof by eht nitnoc ue is g lan . . sihT sesuac eht dlihc to eb ,deunitnoc fa t re rp o nissec g the ah ng- pu si .lang ehT tluafed noitca rof eht hang- pu sig lan si ot etanimret eht ,ssecorp hcihw si hw y we s a edivorp ot evah ot edivorp a s ign la reldnah ot ac t hc t eh s ignal

    nitaerC g na ahpro n de rp o ssec g uor p edulcni# h edulcni# .onrre< >h edulcni# h.ltncf< > edulcni# is< gn h.la > edulcni# " .rdhruo h" diov citats diov is g )tni(puh_ ; diov citats diov rahc(sdi_rp *); )diov(niam tni www.vtucs.com)diov(niam {

    egaP 71 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 ahc r ;c t_dip ;dip (sdi_rp "p era nt"); fi ( dip( = f o ))(kr < 0 ) _rre sys("fo kr e r or r"); esle fi dip( > 0 ) { */ tnerap * / ;)5(peels ex )0(ti ; } { esle { */ dlihc /* dlihc"(sdi_rp "); is g (lan SIG ,PUH is g uh_ p ;) */ e hsilbats is g lan h reldna * / llik ( g ,)(dipte SI STG T ;)P dlihc"(sdi_rp "); */ siht stnirp no ly fi we' er deunitnoc /* fi aer( d ,0( & ,c )1 =! 1 ) ftnirp daer"( rre or f mor lortnoc onrre,lanimret = % d\n", nrre o ;) ex )0(ti ; } } is diov citats diov is g puh_ tni( is g on ) { (ftnirp "SIG PUH r e viec e ,d dip = % d\n", g dipte ( )) ; nruter ; } citats diov sdi_rp rahc( eman* ) { www.vtucs.com :s%"(ftnirp dip = ,d% p p di = ,d% pg pr =

    egaP 72 Dept.of CS&E,SJBIT

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 d\n", ,eman ,)(dipteg ,)(dippteg g te pg pr ( )) ; ;)tuodts(hsulff } TUPTUO */ TUPTUO tuo.a $ tuo.a dipp ,215 = dip :tneraP dip = ,215 dipp = ,244 p g pr = 15 2 15 = prgp ,215 = dipp ,315 = tnerap :dlihC tnerap = ,315 dipp = ,215 prgp = 15 2 $ SIGHUP er c ,devie dip = 315 = dipp , 315 = dip :dlihC dip = 315 , dipp = ,1 p g pr = 15 2 rre daeR rre or morf lortnoc ,lanimret onrre = 5 /* . ehT ap r tne ssecorp ID o f eht dlihc sah emoceb 1 . . retfA c nilla g p sdi_r ni eht ,dlihc eht rp ogr ma rt i se ot daer morf dnats ard tupni . W neh eht kcab gro dnu ssecorp g puor seirt ot er ad morf sti nillortnoc g ,lanimret SI TG TIN si g ne e detar fr mo eht cab kg dnuor rp oce ss g puor . . ehT dlihc semoceb eht cab kg dnuor rp o ssec rg o pu nehw eht tnerap et r ,setanim ap eht ecnis eht ap r tne saw e xec detu sa a of er g dnuor boj b y eht s h le l

    www.vtucs.com

    egaP 73 Dept.of CS&E,SJBIT

    XINU METSYS GNIMMARGORP SC01 26 TINU – 6 LANGIS S A ND OMAED N P COR SESSE 6 .1. I tn r cudo t oi n

    .1 iS g slan a er rt i eregg d by stneve na d a re etsop d no a orp c sse ot iton fy i t taht emos gniht deneppah sah deneppah dna r riuqe es emos .noitca

    .2 iS g slan nac be g ne e detar morf a orp c ,sse a su e ,r o r eht U NIX k lenre .

    .3 Ex :elpma -

    .a A ssecorp p smrofre a edivid by z ore or ed r fe e ner c se a N ULL tniop er. .b A resu stih eD< l >ete ro < lrtC - >C k ey ta eht keybo dra .

    .4 A ap r tne na d dlihc p essecor s ac n nes d slangis ot e hca to h re for orp c se s sy cn h inor z .noita

    .5 ,suhT is g slan a er eht fos t eraw v noisre fo h a wdr are .stpurretni

    .6 iS g slan a re denifed sa regetni f al gs ni eht s< ig lan . >h aeh d re elif .

    .7 ehT niwollof g elbat 1.6 tsil s eht POSIX – fed i den is g slan dnuof ni m tso UNIX sy smets .

    maN e oitpircseD n tluafeD a noitc SIGALRM remit e x derip mrala( ) mret tani e SIGABRT lamronba noitanimret a( b )tro c+etanimret ore SIGF EP citemhtira e x noitpec c+etanimret ore SIGH PU nillortnoc g lanimret ah n pug tanimret e SIG LI L elli g la ihcam ne noitcurtsni c+etanimret ore SIGI TN lanimret tpurretni hc a car t re ed< l >ete or rtc< l-c> ek ys tanimret e SIGK LLI llik a ,ssecorp llik -9 p< i >d dnammoc . tanimret e SIGPIPE etirw ot epip htiw on er a red s tanimret e SIG UQ ITwww.vtucs.com lanimret tiuq rahc a etc r c+etanimret ore SI GESG V es g nem t noita tluaf - vni a dil omem ry r fe e ner ec c+etanimret ore SI RETG M t imre tan e orp c ,sse llik >dip< nammoc d tanimret e

    Dept.of CS&E,SJBIT

    egaP 74 XINU METSYS GNIMMARGORP SC01 26 SI RSUG 1 resu -de denif s ig an l tanimret e SI RSUG 2 resu -de denif s ig an l tanimret e SI CG HLD ahc nge ni sutats fo lihc d ig ron e SI NOCG T eunitnoc deppots orp c sse i/eunitnoc g on er SI OTSG P s pot a ssecorp e x oituce n pots corp se s a pots a cab kg dnuor p ecor ss nehw ti daer morf sti SI TG TIN pots secorp s t lortnoc t ty SI TSTG P pots a ssecorp e x noituce b y eht lrtc -z k ey pots secorp s cab a pots a cab kg dnuor p ecor ss nehw ti setirw ot sti lortnoc SI TG TOU pots secorp s tty .8 W neh a is g lan si tnes ot a ,ssecorp ti si gnidnep no eht ssecorp ot eldnah ti .

    .9 ehT orp c sse nac rea tc ot is g slan ni eno fo eht t hree w ays.

    .a tpeccA eht d tluafe a noitc fo eht is gn la – tsom is gn sla etanimret eht rp o ssec . .b I ng o er eht s ig lan . .c I ovn ke a resu denifed fu noitcn – ehT cnuf noit is dellac langis rednah enituor dna eht is g lan si dias ot eb thguac nehw eht uf cn noit si .dellac If eht uf cn oit n sehsinif ex noituce tuohtiw nitanimret g eht rp oce ,ss eht ssecorp lliw eunitnoc ex noituce morf eht tniop ti saw detpurretni by eht is g lan .

    .01 tsoM is g slan nac be ac u thg ro i g on r de e x tpec eht S IGK LI L dna SI POTSG is g slan .

    .11 A noinapmoc is g lan ot SI POTSG si SI TNOCG , hcihw semuser a ecorp ss ex oituce n etfa r ti sah b ee n ppots e ,d htob SI POTSG na d SI NOCG T sig slan are u des of r oj b U ni lortnoc ni U NIX.

    .21 A corp sse si dewolla ot ig on re ce niatr is gn sla os taht ti si ton detpurretni elihw niod g noissim niatrec noissim – lacitirc krow .

    .31 Ex :elpma - A DB SM rp o ssec itadpu ng a d abata se elif dluohs ton eb rretni u detp litnu it si ,dehsinif esle abatad se elif lliw eb detpurroc , ti dluohs erotser is g an l nildnah g s rof snoitca rof s ig slan nehw dehsinif noissim – lacitirc .krow

    .41 Bec esua sig slan era ge en detar asy cn h suonor ly ot a ,ssecorp a orp c sse may iceps fy a rep is g lan reldnah uf n noitc , eseht noitcnuf dluow neht eb dellac nehw ieht r serroc idnop ng s ig slan are ac ug th . www.vtucs.com .51 A nommoc pr itca ce of a sig an l ldnah er uf n noitc si ot lc e na up a pr sseco work lc sa hcus ,tnemnorivne hcus sa lc o nis g lla tupni – tuptuo ,selif ofeb re itanimret ng gr lufeca ly.

    Dept.of CS&E,SJBIT

    egaP 75 XINU METSYS GNIMMARGORP SC01 26 eK XINU ehT .2.6 ehT XINU eK nr le puS p ro ts fo iS ng als

    .1 In inU x Sy ets m ,3.V each tne ry ni eht k lenre pro ssec elbat tols h sa na ra ar y fo sig an l alf g ,s o ne rof ea hc nifed ed ni eht sy mets .

    .2 W neh a is g lan si g ene rat de rof a ,ssecorp eht ek r len lliw tes eht nidnopserroc g is gn la alf g ni eht p or c sse elbat s tol fo eht tneipicer rp o ec s .s

    .3 If the re tneipic ssecorp is peelsa (w nitia g a dlihc t o etanimret ro ex nituce g esuap API) a lliw lenrek eht lenrek lliw a w neka t he ssecorp by s iludehc ng .ti

    .4 W neh eht tneipicer rp o ssec ,snur eht k lenre w lli kcehc eht rp o ssec U- ra ea aht t sniatnoc na ra ray fo si lang ildnah ng ps e itacific o ,sn erehw e hca tne ry fo eht rra ay s a ot sdnopserroc ot a s ign la denifed ni eht sy mets .

    .5 ehT ke lenr lliw tlusnoc t eh a rr ay ot nif d tuo oh w eht orp c sse lliw rea tc ot t eh idnep ng is g lan .

    .6 If eht ra ray tne ry atnoc i sn a z ore v ,eula eht p or c sse lliw ca c tpe eht d afe u tl noitca of is eht is g ,lan dna t he rek nel lliw dracsid .ti

    .7 If eht a rray tne ry iatnoc ns a eno ,eulav eht p or c sse lliw i g eron eht s ig lan .

    .8 F lani ly, fi ht e array tne ry c sniatno any ehto r av l ,eu ti si desu sa ht e nuf c noit retniop desu a rof a desu d enife d s ig lan rednah enituor .

    .9 ehT rek n le lliw putes eht ssecorp ot e x etuce t he f u noitcn etaidemmi ly, na d eht orp c sse lliw nruter ot sti uc r ner t tniop fo ex noituce o( r ot emos rehto pl ca e fi sig lan h dna er ol a seod a ol ng ,)pmuj fi eht is g lan nah d re seod ton t e animr et eht orp c sse .

    .01 If th ere a er fid f tnere is gn sla nidnep g no a orp c sse , eht redro ni hcihw ht ey era tnes ot tneipicer a tneipicer p ssecor ni nu d denife .

    .11 If elpitlum secnatsni fo a is gn la are idnep ng on a orp c ,sse ti si noitatnemelpmi – tnedneped no rehtehw a nis g el ni ecnats ro elpitlum secnatsni fo eht is g lan lliw eb rp eht ot dereviled ot eht rp o ssec .

    .21 In UNIX Sy mets ,3.V ea hc is g lan lf ag ni a corp e ss elbat ols t sdrocer no ly rehtehw a is g lan si idnep ng, tub ton woh am ny of meht a re p tneser .

    .3.6 is ng la

    .1 llA UNwww.vtucs.comIX s y smets dna NA SI – C troppus eht is g lan API, hcihw nac eb su ed ot enifed rep eht rep -sig lan idnah ng m .dohte

    .2 ehT noitcnuf otorp ty ep of eht is gn la :si

    Dept.of CS&E,SJBIT

    egaP 76 XINU METSYS GNIMMARGORP SC01 26 edulcni# is< gn h.la > is*( diov is*( g lan tni( s ig lan _ ,mun diov tni()reldnah*( ) ;)tni()

    mun_langis si eht is g lan reifitnedi l eki SIGI TN ro SI MRETG denifed ni eht is< gn >h.la . reldnah si eht itcnuf on retniop of a su er d e nif ed is gn la ldnah er oitcnuf n. sihT noitcnuf dluohs ekat na tni eger lamrof ra g tnemu dna d o se ton nruter a ny v eula .

    .3 Ex elpma woleb tpmetta s ot hctac eht SI ,MRETG ig on r se eht S IGIN ,T dna ca c stpe eht t fo noitca tluafed noitca fo t he SIG VGES is g lan .

    .4 ehT uap se API dnepsus s eht c gnilla orp c sse litnu ti si etpurretni d by a si lang dna the idnopserroc ng s ig lan ah n reld seod a r nrute :

    edulcni# .maertsoi< >h edulcni# is< gna h.l >

    diov tni(gis_hctac is g n_ u )m { is g s(lan ig ,mus_ ac t is_hc g); tuoc << “ s_hctac ig ”: << is g mun_ << ;ldne }

    tni )(niam { is g (lan SIGT ,MRE hctac _ is g); is g (lan SIGI ,TN SIG_IG ;)N is g (lan SI ,VGESG SI _G FD L); )(esuap ; // tiaw rof is g lan tni e urr pt noi }

    .5 ehT SIG_I NG dna SIG_ FD L a er inam f tse tsnoc a stn denifed ni is< gn h.la >

    enifed# SI _G D LF diov )tni()*( 0 // tluafeD oitca n enifed# SIG_I NG diov )tni()*( 1 // gI on re eht is gnal .6 ehT nruter v eula fo s ignal A PI si eht p r suoive is gn la reldnah f or eht s ig an l.

    .7 UNIX syst me 3.V dna 4.V troppus eht is g tes API, hcihw sah eht emas otorp ty ep dna is a esu ralimis esu a is gn .la

    edulcni# is< gn h.la >

    www.vtucs.comdiov is*( g tes tni( langis _ ,mun diov tni()reldnah*( ) ;)tni()

    eht is g tes ra g stnemu dna nruter v eula si eht s a em sa taht o f is gn la .

    Dept.of CS&E,SJBIT

    egaP 77 XINU METSYS GNIMMARGORP SC01 26 .8 B hto eht snoitcnuf tes is g lan ildnah ng sdohtem f ro any n dema sig ;lan ,tub is g lan API s dna elbailernu si elbailernu dna s ig tes si elbailer .

    .9 sihT snaem taht nehw a sig lan si tes ot eb caug th by a sig lan h reldna aiv sig ,tes when elpitlum secnatsni fo eht is g lan a evirr eno of ht em si deldnah elihw rehto ecnatsni s colb era colb k .de Fu ,rehtr eht is g lan ldnah er si ton eser t ot SI _G DFT nehw ti si i .dekovn

    saM langiS .4.6 langiS saM k

    .1 hcaE rp o ssec ni NU IX ro OP SI 1.X s y mets h sa si lang ksam taht ifed n se wh hci is g slan colb era colb k de nehw eg en ar det ot a ssecorp .

    .2 A dekcolb is gn la ped e sdn no eht tneipicer pr sseco ot kcolbnu ti dna eldnah ti idrocca ngly.

    .3 If a sig lan si ficeps i de ot eb igno der dna olb c dek , ti si noitatnemelpmi ed p tnedne on s eht rehtehw eht s ig lan lliw be racsid d de ro tfel p nidne g w h ne ti si tnes ot eht ssecorp .

    .4 A ssecorp laitini ly hni e stir eht s’tnerap is gn la ksam nehw ti si taerc e ,d tub any nidnep g s ig slan f or eht p tnera rp o ssec a re ton sap s de .no

    .5 A ssecorp m ay q uery ro s te sti is g lan ksam aiv eht is g corp m ksa A PI:

    edulcni# is< gn h.la > tni is g tni(ksamcorp ,dmc tsnoc is g t_tes am_wen* s ,k is g t_tes )ksam_dlo* ;

    ksam_wen ifed n se a s te fo ot eb tes ro r tese ni a illac ng orp c sse is gn la .ksam c dm seificeps woh t eh ksam_wen eulav si ot eb desu by eht API. ehT lbissop e v seula dmc a re:

    ulav dmc ulav e gninaeM edirrevO s eht c gnilla rp o ssec sig lan sam k htiw eht ulav e ficeps i de in SI SAMTES_G K ksam_wen eht ksam_wen ra g nemu t sddA eht is g slan ficeps i de ni eht ksam_wen ar tnemug ot eht nillac g SIG_BL CO K s ssecorp s ig lan sam k evomeR s eht is gn sla deificeps ni eht n am_we sk arg tnemu ot ht e SI _G U BN LO KC nillac g rp o ssec s ig lan m a ks

    .6 If eht a lautc argum tne ot ksam_wen ra g tnemu si a NULL ,retniop the cmd arg nemu t i eb lliw eb i g ,deron dna eht c tnerru orp c sse is gn la am sk lliw ton eb deretla .

    .7 ehT ksam_dlo arg tnemu si eht sserdda fo a t_tesgis elbairav taht lliw eb issa g den ht e nillac g www.vtucs.comp secor s s’ ro ig lani is g lan m ksa roirp to a ksamcorpgis .llac If eht autca l arg tnemu ot ksam_dlo si a N ULL ,retniop on p er v suoi is g lan ksam lliw eb denruter .

    .8 ehT nruter v eula fo sigpr ksamco llac si z ore fi ti ccus e sde ro -1 fi ti sliaf .

    Dept.of CS&E,SJBIT

    egaP 78 XINU METSYS GNIMMARGORP SC01 26 .9 ehT seg t_tes si a d ata ty ep enifed d ni s< ig >h.lan . It sniatnoc a noitcelloc fo tib lf ag ,s lf tib hcae htiw hcae tib lf ag r erpe es nitn g eno s ig lan d e denif in eht sy mets .

    .01 ehT B DS NU IX dna OP SI 1.X d enife a tes fo API nwonk sa potesgis s ,snoitcnuf er ,tes hcihw ,tes er s ,te dna euq ry eht p r ese n ec fo s ig slan ni a is g t_tes ty dep v a air b .el

    edulcni# is< gn h.la > tni is g pme tys is(te gs t_te is* g )ksam ; tni is g s(tesdda ig t_tes is* g ,ksam c tsno tni is g _lan n ;)mu tni is g s(tesled ig t_tes ,ksamgis* tsnoc tni is g n_lan u ;)m tni is g is(tesllif g t_tes s i ;)ksamg tni is g tsnoc(rebmemsi s ig t_tes s* ig ,ksam tsnoc i nt is g )mun_lan ; .11 ehT pmegis ty tes A PI lc e sra lla is gn la lf ags ni eht is g ksam ra g .tnemu

    .21 ehT tesddagis A PI stes t he lf ag c o idnopserr ng ot t eh is g mun_lan sig lan ni sig ksam .

    .31 ehT is gd tesle A PI lc e sra eht lf ag oc r idnopser ng t o eht is g mun_lan s ig lan i n is g ksam .

    .41 ehT is g tesllif A PI stes la l eht lf ags ni eht is g ksam .

    .51 ehT nruter eulav fo eht sig pme ty ,tes ,tesddagis is g ,tesled dna sig tesllif ac l sl si z ore fi cus llac eht llac cus c dee ro -1 fi they liaf .

    .61 ehT is g rebmemsi API er snrut 1 fi eht alf g co err s nidnop g ot eht is g n_lan um is g lan ni is eht is g ksam si ,tes z ore i f ton ,tes dna -1 fi eht c lla .sliaf

    .71 ehT iwollof ng ex elpma skcehc ehtehw r eht SIGINT sig lan si pr se tne in a rp o ssec is g lan sam k dna sdda ti t o eht ksam if ti si ton ht e .er Th ne lc e sra the S IGS VGE sig lan orp eht morf eht orp c sse is gn la .ksam

    edulcni# h.oidts< > edulcni# is< gn h.la > tni )(niam { is g t_tes is g ksam ; is g pme ty tes (&sig )ksam ; laitini*/ ize /*tes fi is( g rp o ,0(ksamc ,0 &m )ksa == - )1 { */ g te c u tnerr s ig lan sam k /* orrep r s“( ig corp m )”ksa ; ex )1(ti ; } esle is g dda es t(&sig ,ksam SIGIN )T ; tes*/ SIGINT lf ag*/ is g tesled (&sig ,ksam SIG ;)VGES raelc*/ SI VGESG lf ag*/ www.vtucs.comfi is( g rp o (ksamc SI S_G E ,KSAMT &sig ,ksam )0 == -1) orrep r s“( ig corp m )”ksa ; tes*/ a wen s ig lan ksam */ }

    Dept.of CS&E,SJBIT

    egaP 79 XINU METSYS GNIMMARGORP SC01 26 .81 If eht re a er elpitlum in secnats of eht as me si lang idnep ng for eht pro ,ssec ti is noitatnemelpmi dneped e tn ehtehw r no e ro lla fo esoht ecnatsni s lliw eb d derevile ot ssecorp eht ssecorp . .91 A ssecorp nac uq ery hw i hc is g slan era p nidne g for ti aiv eht is g idnep ng PA I

    edulcni# is< gn h.la > tni is g is(gnidnep gs t_te is* g )ksam ;

    is g ksam si ssa ig den t he tes fo s ig slan idnep ng f ro eht illac ng orp c sse by eht A PI. is g idnep ng r snrute a z ore fi i t ccus e sde dna a -1 eulav fi ti .sliaf

    .02 UNIX syst me 3.V dna 4.V troppus eht niwollof g APIs sa deifilpmis snaem rof is g an l .noitalupinam ksam .noitalupinam

    edulcni# is< gn h.la > tni is g tni(dloh is g n_lan u ;)m tni is g tni(esler s ig n_lan u ;)m tni is gig on r tni(e is gn _la n ;)mu tni is g tni(esuap s ig _lan n ;)mu

    .12 ehT is g dloh API sdda ht e deman sig lan sig n_lan um ot eht nillac g p ssecor s ig lan ksam .

    .22 ehT eslergis API r vome es eht deman is gn la is g an mun_l ot eht nillac g rp o ssec is gn la .ksam

    .32 ehT sigignore API s ste eht sig lan h gnildna tem hod of r eht n dema sig an l is g mun_lan ot SI _G DFT.

    .42 ehT sig suap e API mer o sev eht n ema d is gn la sig mun_lan morf the c gnilla orp c sse is g lan ksam dna sus p ne ds eht ssecorp litnu ti si ni t detpurre by a is gn .la

    5.6 siga tc ion

    .1 ehT sig noitca API is a re tnemecalp rof ht e is gn la API in eht tsetal UNIX a dn OP SIX sy smets .

    .2 ehT noitcagis API is lac l de by a orp c sse ot tes up a sig lan h nildna g m dohte rof ae hc is g lan ti stnaw ot laed w i .ht

    .3 is g noitca A PI snruter eht suoiverp is gn la nildnah g dohtem rof a g nevi s ig an l.

    .4 ehT cagis noit A PI otorp type si : www.vtucs.com edulcni# is< gn h.la > tni is ga tni(noitc is gn ,mun_la tcurts sig noitca * tca i ,no tcurts siga noitc )noitca_dlo* ;

    Dept.of CS&E,SJBIT

    egaP 80 XINU METSYS GNIMMARGORP SC01 26 .5 ehT tcurts noitcagis atad t y ep si d e denif ni eht s< ig .lan h> aeh d re sa : tcurts is ga noitc { diov eldnah_as*( r )tni() ; is g t_tes ;ksam_as tni lf_as ag; ;}

    .6 ehT ldnah_as er dleif ac n eb tes ot SIG_IG ,N SI _G DFL, ro a resu ed denif is gnal uf reldnah uf n .noitc .7 ehT ksam_as fi dle iceps f sei lanoitidda is g slan ht at ssecorp sehsiw ot colb k nehw ti is nildnah g s ig mun_lan .langis

    .8 hT e sig mun_lan ra g mu e tn ised gn seta hw i hc sign la ildnah ng a noitc si d fe deni ni eht noitca arg tnemu .

    .9 ehT suoiverp sig lan ah nildn g dohtem of r is gn mun_la lliw eb ruter en d aiv eht a noitca_dlo a rg tnemu fi ti si ton a N ULL retniop .

    .01 If noitca arg tnemu si a NULL iop tn e ,r eht nillac g orp c s’sse ex nitsi g is g lan gnildnah is rof dohtem rof is gn mun_la lliw eb ahcnu ng de .

    .11 ehT niwollof g C rp o rg am setartsulli eht esu fo is ga :noitc

    edulcni# .maertsoi< >h edulcni# h.oidts< > edulcni# h.dtsinu< > edulcni# is< gn h.la >

    diov emllac ( i tn is g n_ um ) { tuoc << “ hctac s ig ”:lan < < is g mun_ << ldne ; }

    tni niam ( tni ,cgra hc ar *argv ][ ) { is g t_tes is g ksam ; tcurts is ga noitc ,noitca o ;noitca_dl

    is g pme ty tes (&sig )ksam ;

    fi ( is gad (tesd & is gm ,ksa SI )MRETG == -1 || www.vtucs.com is g corp m ksa ( SI ES_G T ,KSAM & is gm ,ksa )0 == -1) orrep r teS“( s ig lan ksam ” ;)

    is g pme ty (tes &a as.noitc _ ;)ksam

    Dept.of CS&E,SJBIT

    egaP 81 XINU METSYS GNIMMARGORP SC01 26 is g esdda t( _as.noitca& m ,ksa SI ESG G )V ; ldnah_as.noitca er = c ;emlla lf_as.noitca ags = 0 ; fi is( ga noitc ( SIGIN ,T ,noitca& & _dlo a )noitc == -1) orrep r( s“ ig noitca ”); )(esuap ; */ tiaw rof is gn la urretni p *noit / tuoc << ra gv[0] << e“ xits\ ”n ; }

    .21 In eht oba ve ex ,elpma eht ssecorp sig lan ksam si tes htiw SI MRETG sig lan . hT e ssecorp neht senifed a sig lan ldnah er rof eht SIG TNI is g lan dna osla iceps f sei taht ht e SI VGESG sig lan si ot eb dekcolb nehw eht orp c sse si nildnah g eht SIG TNI is g lan . orp ehT orp c sse neht nimret a set sti e x noituce aiv eht esuap A PI.

    .31 ehT tuptuo fo eht evoba margorp dluow eb :sa

    % cc s iga c.noitc –o gis a noitc % is/. ga noitc & [1] 94 5 % k lli –I TN 94 5 hctac s ig :lan 2 is g noitca e x sti [ ]1 noD e is g oitca n

    .41 ehT lf_as ag dleif fo eht tcurts is g noitca si desu ot iceps fy sp laice ildnah ng rof rec t ia n is g slan .

    .51 OP SI 1.X d e senif no ly two seulav rof eht s lf_a ag: z ore ro CON_AS HL SD T .PO

    .61 ehT CON_AS HL SD TOP alf g si na etni g re etil r la denifed ni eht is< gna >h.l redaeh nac dna nac be desu w h ne mun_langis si SI CG HL .D

    .71 ehT ef tcef of eht AS _ CON HL POTSD lf ag is taht eht rek n le lliw areneg te ht e SI CG HLD sign la ot a pr sseco nehw sti dlihc rp co sse sah ,detanimret tub n to nehw eht sah ssecorp dlihc ssecorp sah b nee s t .deppo

    .81 If eht s lf_a ag eulav si tes ot z ore in is g noitca llac rof SI CG HLD, eht nrek el lliw dnes eht SI CG HLD is gn la ot eht nillac g ssecorp w reveneh sti dlihc corp e ss si htie re deppots ro detanimret ro deppots .

    .91 UNIX Sy mets 4.V de if sen lanoitidda f al gs of r the f_as al gs dleif . sehT e flags can be iceps ot desu ot iceps fy eht NU IX Sy mets 3.V s tyle fo s ign la nildnah g dohtem : www.vtucs.com lf_as ags ulav e tceffE no h nildna g s ig an l mun_ If sig mun_lan si ac ug th , eht dnah_as l re si tes to SIG_ FD L feb ore DNAHTESER_AS eht is g lan reldnah uf n noitc si ,dellac dna is g mun_lan lliw on t eb

    Dept.of CS&E,SJBIT

    egaP 82 XINU METSYS GNIMMARGORP SC01 26 dedda ot eht rp o ssec si lang ksam nehw eht signal reldnah uf n noitc e si e x .detuce If a is gn la si ac ug th elihw a orp c sse si ex nituce g a sy mets c ,lla eht lenrek lliw tratser eht sys met llac retfa eht sig lan reldnah ter u .snr If RATSER_AS T siht alf g si ton tes ni ht e alf_as g ,s a retf eht is g an l reldnah ,snruter eht sy mets c lla lliw be ab detro htiw a r nrute v eula fo -1 dna lliw es t onrre ot EI RTN

    ehT .6.6 ehT S DLHCGI giS an l dna t eh wa ti p di PA I

    .1 W neh a dlihc orp c sse et r setanim ro ,spots eht k re len lliw eneg r eta a SIG HC LD is gn la ssecorp tnerap sti ot sti tnerap ssecorp .

    .2 idnepeD ng nopu woh eht tnerap stes pu is gn la nildnah g fo eht SI CG HLD sig lan , tnereffid stneve m ay o cc :ru

    .a tneraP ac stpec eht d uafe lt noitca fo eht SI CG HLD is g :lan The SI CG H DL is g an l seod ton etanimret eht tnerap rp o .ssec It affe stc no ly eht ap r tne orp cess fi it sevirra ta eht s ema emit eht ap r tne orp c sse si us s dednep by the w diptia sys et m .llac In siht c ,esa ht e ap er tn ssecorp si awa k ,dene t eh API lliw r e nrut dlihc ’s exit sutats dna ssecorp ID ot eht ,tnerap dna eht ke lenr lliw raelc pu eht rp o ssec elbat tols detacolla rof eht hc i dl .ssecorp ,suhT htiw siht ,putes a tnerap ecorp ss nac A diptiaw llac diptiaw A PI er p etae ld y ot tiaw rof ea hc dlihc ti detaerc . .b tneraP ig on r se eht SIG HC LD is g :lan ehT SIG HC LD is g lan lliw eb dedracsid , dna eht tnerap lliw ton eb ,debrutsid neve fi ti si ex nituce g eht diptiaw sy mets .llac ehT fe f tce fo siht putes si taht fi eht tnerap sllac diptiaw PA I, eht API liw l dnepsus eht tnerap litnu a ll sti lihc d sessecorp evah .detanimret F htru e ,eromr ht e dlihc ssecorp lbat e stols lliw eb aelc r de b y eht ek ,lenr dna eht API lliw er t nru -1 ap eht ot eulav ot eht ap r tne orp ec .ss

    .c ssecorP ac t sehc eht S CGI HLD is gn :la ehT sign la reldnah noitcnuf lliw eb ellac d ni eht pa tner enehw ver eht dlihc orp c sse t re .setanim F tru h eromre , if eht SI CG HLD sig lan a virr es elihw eht tnerap rp co sse si ex nituce g eht wa ipti d sy mets ,llac tfa er eht langis reldnah ,snruter eht diptiaw API may be ser t detra to tcelloc eht dlihc ex ti ats t su dna lc e ra sti rp o ssec elbat .tols nO eht ehto r ,dnah eht API may eb etroba d dna eht dlihc rp o ssec t elba tols ton rf e ,de ped e gnidn fo putes tnerap eht nopu eht tnerap putes fo t eh is g lan noitca rof eht SI CG HLD is gn la .

    tesgis ehT .7.6 ehT tesgis jmp dna s jgnolgi mp APIs

    .1 ehT is g pmjtes dna is glong pmj APIs ah ve ralimis snoitcnuf sa rieht roc r nidnopse g nol dna pmjtes dna nol g pmj A PIs. www.vtucs.com .2 ehT is g pmjtes dna siglong pmj APIs are ifed ned ni OP SI 1.X dna no m tso UN XI sy smets taht troppus is gn la .ksam

    Dept.of CS&E,SJBIT

    egaP 83 XINU METSYS GNIMMARGORP SC01 26 .3 ehT noitcnuf otorp ty sep fo eht A PIs a r :e

    edulcni# < pmjtes h. > tni is g pmjtes ( is g ubpmj f ,vne tni is_evas gm ksa ) ; tni is g nol g pmj ( s ig fubpmj ,vne tni lav_ter ) ;

    .4 ehT sig pmjtes dna sigl no g pmj a er rc e deta to troppus is gn la ksam issecorp ng. lacificepS ly, ti si i noitatnemelpm tnedneped no rehtehw a orp c sse is gn la am ks si dna devas dna r derotse w h ne ti sekovni eht pmjtes dna nol g pmj A PIs pser e vitc le y.

    .5 ehT is g pmjtes API eb ah sev ralimis ly ot eht pmjtes API, ex tpec taht ti h sa a dnoces arg ,tnemu ksamgis_evas , hcihw swolla a resu to iceps fy htehw er a c nilla g rp o ssec is g lan m ksa dluohs eb s a dev ot eht dedivorp env arg tnemu .

    .6 If eht as v ksamgis_e argu tnem si non z ,ore eht lac l s’re s ig lan ksam si s deva , esle s ig lan .devas ton si ksam si ton .devas

    .7 ehT is g ol ng pmj API do se lla snoitarepo sa eht nol g pmj API, tub ti osla serotser a nillac g rp o ssec sig lan m a ks fi eht ksam saw as v de ni sti vne arg tnemu .

    .8 ehT lav_ter arg tnemu sp seifice eht ter u nr eulav fo eht idnopserroc ng si pmjtesg API nehw dellac by is g ol ngj pm API. I st eulav dluohs eb non z ore ,rebmun dna fi ti is z re o is eht is g ol ng pmj A PI lliw teser i t ot .1

    .9 ehT is g ol ng pmj API si lausu ly dellac f mor esu r- denifed sig lan gnildnah snoitcnuf . uaceb si sihT si uaceb se a orp c se s is g an l ksam si deifidom nehw a is gn la ldnah er si ,dellac na d is g ol ng pmj dluohs eb c della ot usne re taht ht e ssecorp sig lan m ksa si erotser d reporp ly nehw nipmuj“ g ”tuo morf a s ig lan ldnah ing uf n .noitc

    .01 ehT niwollof g C rp o rg am setartsulli eht esu fo is g pmjtes dna s ig ol ng pmj A PIs.

    edulcni# .maertsoi< >h edulcni# h.oidts< > edulcni# h.dtsinu< > edulcni# is< gn h.la > edulcni# h.pmjtes< >

    is g pmj ub_ f ;vne

    diov emllac ( tni is g n_ um ) { tuoc << “ hctac s ig ”:lan < < is g mun_ << ldne ; www.vtucs.comis g ol ng pmj ( ,vne 2 ) ; }

    tni niam ( tni ,cgra hc ar *argv ][ )

    Dept.of CS&E,SJBIT

    egaP 84 XINU METSYS GNIMMARGORP SC01 26 { is g t_tes is g ksam ; tcurts is ga noitc ,noitca o ;noitca_dl is g pme ty tes (&sig )ksam ;

    fi ( is gad (tesd & is gm ,ksa SI )MRETG == -1 || is g corp m (ksa SI ES_G T ,KSAM & is gm ,ksa )0 == -1) orrep r teS“( s ig lan ksam ” ;)

    is g pme ty (tes &a as.noitc _ ;)ksam is g esdda t( _as.noitca& m ,ksa SI ESG G )V ;

    ldnah_as.noitca er = iov( d ()*( ) emllac) ; lf_as.noitca ags = 0 ;

    fi is( ga noitc ( SIGIN ,T ,noitca& & _dlo a )noitc == -1) orrep r s“( ig noitca ”);

    fi is( g (pmjtes ,vne 1) =! 0 ) { rrec << nruteR“ morf s i lang oitpurretni n\n ;” nruter 0 ; } esle rrec << nruteR“ morf f i tsr emit is g pmjtes si ellac d\ ;”n

    )(esuap ; */ tiaw rof is gn la urretni p *noit /

    }

    .11 ehT rp ogr ma stes sti is gn la ksam ot niatnoc SIGT ,MRE dna neht stes pu a is g lan tr pa eht rof eht SIGINT is gn .la

    .21 ehT margorp neht sllac is g pmjtes ot erots ti s edoc noitacol ni eht vne g labol .elbairav etoN ht e tesgis jmp ca ll snruter a z ore lav ue w neh yltcerid llac ed ni esu r rgorp am dna ton aiv is g jgnol mp.

    .31 ehT rp og mar sus p sdne sti e x noituce aiv eht suap e A PI.

    .41 W neh reve eht us re etni r stpur eht ssecorp morf t eh key ob a ,dr eht c emlla noitcnuf is dellac . .51 ehT emllac noitcnuf ac l sl is g nol g pmj API ot tr refsna wolf b kca ot eht is g pmjtes 2 a snruter won hcihw ,niam ni noitcnuf ni ,niam hcihw won snruter a 2 v eula .

    .61 ehT www.vtucs.comelpmas tuptuo fo ht e evoba rp ogr ma :si

    % cc s ig .pmjtes c % tuo.a/. &

    Dept.of CS&E,SJBIT

    egaP 85 XINU METSYS GNIMMARGORP SC01 26 [1] 73 7 nruteR morf tsrif emit pmjtesgis si dellac % llik –I TN 73 7 ac hct s ig :lan 2 nruteR morf is gn la retni r noitpu [ ]1 enoD tuo.a %

    .8.6 k li l

    .1 A ssecorp nac dnes s ignal ot a detaler rp o ssec aiv t eh llik A PI.

    .2 sihT si a elpmis snaem fo I CP ro lortnoc .

    .3 ehT nes d re dna eipicer nt secorp s se tsum be er al det hcus th ta ehtie r es n red rp o sec s laer ro fe f evitce resu ID sehctam taht fo eht tneipicer ,ssecorp ro eht rednes sah us elivirp g se .

    .4 F ro ex ,elpma a ap r tne a nd dlihc orp c sse ac n dnes is g slan ot e hca to h re iv a eht llik A PI.

    .5 ehT llik A PI si ifed n de ni tsom U NIX sy mets dna si a OP SI 1.X nats d dra .

    .6 ehT noitcnuf otorp ty ep i s :sa

    edulcni# is< gn h.la > tni llik ( t_dip ,dip tni is g mun_lan ;)

    .7 ehT mun_gis arg tnemu si eht etni g re eulav fo a is g lan ot eb tnes ot eno ro rom e sessecorp d ise gn deta by .dip

    .8 ehT elbissop seulav fo p id dna sti esu by eht llik API era :

    av dip av l eu fE f stce no eht llik A PI eulav evitisop A evitisop eulav dip si a ssecorp I .D neS ds is g mun_lan ot taht orp c .sse sdneS is g mun_lan ot la l sessecorp esohw rp oce ss g puor ID si ht e 0 eht sa emas sa eht c nilla g rp oce .ss sdneS is g mun_lan ot lla sessecorp ohw se re la su er ID si eht emas as eht fe f vitce e resu ID fo eht c nilla g p .ssecor If eht illac ng rp o sec s ffe e evitc su er ID si us resu ID, sig mun_lan lliw eb tnes ot la l i sessecorp i n eht sy mets ( ex tpec secorp s se – 0 dna .)1 ehT l reta sac e si -1 u des nehw eht sy mets si nittuhs g nwod – lenrek sllac eht llik API to etanimret lla sessecorp ex tpec 0 dna .1 :etoN P 1.XISO seod on t www.vtucs.comiceps fy eht roivaheb of eht llik API w neh eht dip eulav si - .1 ihT s e ff tce si f ro XINU tsys ems ylno . sdneS is gn mun_la ot la l orp c sesse ohw se p ecor ss puorg ID am t ehc s n A n eg evita lav eu dip fo eulav etulosba eht etulosba eulav fo dip .

    Dept.of CS&E,SJBIT

    egaP 86 XINU METSYS GNIMMARGORP SC01 26 .9 ehT nruter v eula fo llik si z ore fi ti sdeeccus ro -1 if ti .sliaf

    .01 ehT niwollof g C rp o rg am setartsulli eht noitatnemelpmi fo eht U NIX llik .dnammoc

    edulcni# maertsoi< . >h edulcni# h.oidts< > edulcni# h.dtsinu< > edulcni# irts< ng h. > edulcni# is< gn h.la >

    tni niam ( tni ,cgra hc ar *argv ][ ) { tni ,dip is g = SI ;MRETG

    fi a( rgc == 3) { fi ( nacss f a( rgv[1], ”d%“ , & )gis != 1 ) { // g te is gn la ebmun r rrec << “ I avn dil rebmun :” << argv[1] << ;ldne nruter -1; } argv+ ;+ a rgc -- ; } elihw ( -- ra gc > 0 ) fi nacss( f +*( +arg ,v d%“ ”, & )dip == )1 { // g te orp c sse ID fi ( llik ( ,dip is g) == -1 ) orrep r )”llik“( ; } esle rrec << “ I dilavn ”:dip << a rgv[0] << ;ldne nruter 0 ; }

    .9.6 la ra m

    .1 ehT mrala API nac eb ac dell b y a orp c sse ot qer u tse eht rek n le ot dnes eht SIGALRM is g lan a retf a ce niatr rebmun fo r lae kcolc s sdnoce .

    .2 ehT mrala A PI si d e enif d ni tsom U NIX sy smets a dn si a OP SI 1.X nats d ra d.

    .3 ehT noitcnuf otorp ty ep of eht A PI si :sa

    edulcni# is< gn h.la > isnu g den tni la a mr ( isnu g den tni lavretni_emit ) ;

    .4 ehT www.vtucs.comlavretni_emit arg tnemu si eht rebmun fo CPU sdnoces espale ,emit retfa cihw h eht dnes lliw lenrek eht lenrek lliw dnes eht SI AG L MR is gn la ot eht c a nill g ssecorp .

    .5 If a lavretni_emit v eula is z ,ore ti snrut ffo eht la a mr kcolc .

    Dept.of CS&E,SJBIT

    egaP 87 XINU METSYS GNIMMARGORP SC01 26 .6 ehT nruter eulav fo eht mrala API si eht ebmun r fo UPC sdnoces tfel ni eht ssecorp tes sa ,remit sa tes by a p r suoive mrala syst me llac .

    .7 ehT fe f tce fo eht pr suoive mrala API llac si nac c ,dele dna eht orp c sse remit si eser t mrala wen htiw wen mrala c .lla

    .8 A ssecorp la a mr kcolc si ton dessap no ot its dekrof dlihc ,ssecorp tub na ex e’ce d ssecorp r sniate eht emas mrala kcolc v eula sa was roirp ot eht e x ce A PI ac l .l

    .9 ehT mrala A PI nac eb u s de ot tnemelpmi eht s el ep A PI.

    edulcni# is< gn h.la > edulcni# h.oidts< > edulcni# h.dtsinu< >

    diov )(puekaw { }

    isnu g den tni peels ( snu i deng tni remit ) { tcurts is ga noitc ;noitca

    ldnah_as.noitca er = w ka e ;pu lf_as.noitca ags = 0 ;

    is g pme ty tes ( &a s.noitc a ksam_ ;)

    fi ( is ga noitc ( SIGALRM, &a ,noitc )0 == -1 ) { orrep r s“( ig noitca ”); nruter -1; } (mrala)diov( remit ); (esuap)diov( ); }

    .01 ehT peels noitcnuf oba ve stes pu a is gn la ldnah er rof the SIGAL ,MR c slla eht ala mr API ot qer u tse eht nrek el ot dnes eht SI AG LRM is g lan tfa er eht remit ,lavretni na d lanif ly, sdnepsus sti e xec noitu aiv eht esuap sys et m .llac

    .11 ehT aw k pue is gn la dnah l re noitcnuf si c della hw en eht SI AG L MR s ign la si tnes ot eht .ssecorp W eh n ti ruter n ,s eht uap se sy mets ac ll lliw eb ba o detr , dna t eh c gnilla nruter lliw ssecorp lliw nruter morf eht peels uf n noitc .

    .21 B DS Uwww.vtucs.comNIX de senif eht mralau uf n ,noitc hcihw is eht emas sa eht al mra API ex tpec a eht taht eht a rg tnemu dna er t nru eulav fo eht u mrala f noitcnu era ni sorcim eco dn .stinu

    Dept.of CS&E,SJBIT

    egaP 88 XINU METSYS GNIMMARGORP SC01 26 .6 1 .0 nI t re av l iT m re s

    .1 ehT esu fo eht mrala A PI si ot tes pu a lavretni remit ni a rp o ssec .

    .2 ehT lavretni remit nac be desu ot udehcs le a pro ssec ot od emos sksat at if x de mit e ,lavretni ot emit eht ex noituce fo emos itarepo o ,sn ro timil eht emit lla o dew rof ht e ex noituce fo emos t .sksa

    .3 ehT niwollof g rp o marg setartsulli woh ot tes pu a laer - emit kcolc retni v la remit gnisu A mrala eht mrala A PI.

    edulcni# h.oidts< > edulcni# h.dtsinu< > edulcni# is< gn h.la >

    enifed# INT VRE AL 5 diov emllac ( tni is g on_ ) { (mrala IN VRET AL ) ; */ od cs deludeh sksat /* }

    tni niam ( ) { tcurts is ga noitc ;noitca

    is g pme ty (tes &a as.noitc _ ;)ksam ldnah_as.noitca er = iov( d ()*( ) emllac) ; lf_as.noitca ags = R_AS E ;TRATS

    fi ( is ga (noitc SIGALRM, &a ,noitc )0 == - )1 { orrep r s“( ig noitca ”); nruter 1; } fi ( (mrala I VRETN AL ) == -1 ) orrep r a“( l )”mra ; esle elihw )1( { */ od lamron noitarepo * / } nruter 0 ; } www.vtucs.com .4 ehT sig noitca API si c della ot tes pu emllac sa t eh is gn la ildnah ng cnuf t noi rof ht e SIGAL MR s ig lan .

    Dept.of CS&E,SJBIT

    egaP 89 XINU METSYS GNIMMARGORP SC01 26 .5 ehT margorp neht ni sekov eht mrala API ot dnes flesti eht SIGAL MR langis retfa 5 kcolc laer kcolc s sdnoce .

    .6 ehT rp og mar neht go se o ff ot frep o mr sti lamron noitarepo ni na etinifni .pool

    .7 W neh eht remit ex ,srerip eht emllac noitcnuf is ,dekovni hcihw stratser eht rala m rof kcolc rof a rehton 5 s e oc n sd dna neht seod eht cs eh delud .sksat

    .8 W neh eht emllac noitcnuf ,snruter eht orp gr ma co seunitn sti ”lamron“ noitarepo tnu li remit rehtona remit ex .noitarip

    .9 B DS UNIX detnevni the remitites API, hcihw sedivorp ac p seitiliba lanoitidda ot eht fo esoht fo eht mrala A PI.

    .01 ehT remitites noituloser emit si in ,sdnocesorcim saerehw eht r noitulose emit rof sdnoces ni si mrala si ni sdnoces .

    .11 ehT la a mr API c na be us de ot tes pu aer l- emit lc o kc remit per rp o .ssec The remitites API nac eb u s de ot ifed ne pu ot eerht fid fer tne typ se fo sremit ni a orp c :sse

    .a laeR emit kcolc remit .

    .b remiT desab no eht u s re t emi tneps by a p or c sse

    .c remiT desab no eht latot resu dna sy mets semit tneps by a orp c sse .

    .21 ehT remititeg API si sla o denifed ni B DS dna Sys met V UNIX rof us sre ot euq ry t eh av remit av seul taht a re tes b y eht remitites A PI

    .31 ehT remitites dna g remitite noitcnuf otorp ty sep ar :e

    edulcni# < sy h.emit/s > tni (remitites tni ,hcihw tsnoc tcurts remiti lav ,lav* tcurts lavremiti dlo* ;) tni g (remitite tni ,hcihw s tcurt lavremiti dlo* ;)

    .41 ehT hcihw arg tnemu ps e ic fy hcihw remit ot orp ec ,ss eht elbissop seulav a r :e

    hcihw ugra m tne ulav e iT mer pyt e remiT desab no aer l- emit .kcolc G ener seta a SIGALRM ITI ER_REM AL is g lan w h ne e x serip remiT desab no esu r- emit tneps by a p ssecor . eneG r seta a ITI _REM VI UTR AL SI VG AT L MR s ig lan wh ne ti e x serip remiT desab no latot resu dna sy mets semit tneps by a ITI www.vtucs.comFORP_REM .ssecorp G ene r seta a SIG ORP F is g lan w h ne ti e x serip

    .51 ehT tcurts lavremiti atad t y ep si d e denif ni eht < sy >h.emit/s redaeh :sa

    Dept.of CS&E,SJBIT

    egaP 90 XINU METSYS GNIMMARGORP SC01 26 s tcurt lavremiti { tcurts lavremit ;lavretni_ti remit// lavretni tcurts lavremit ;eulav_ti tnerruc// ulav e }

    .61 F ro remitites API, eht eulav_ti.lav si eht ti em ot tes eht deman t ,remi dna ht e w remit eht daoler ot emit eht si lavretni_ti.lav si eht emit ot daoler eht remit w hen ti e x serip .

    .71 ehT etni_ti.lav lavr may eb tes ot z ore fi eht it rem si ot nur no ly cno e dna fi eht ot tes si eulav_ti.lav si tes ot z ,ore ti spots eht deman remit fi ti si ninnur g.

    .81 F ro g remitite API, eulav_ti.dlo dna eht ti.dlo _ lavretni nruter eht an m de ’remit s niniamer g emit dna eht r daole emit , pser e evitc ly.

    .91 ehT dlo a rg tnemu fo eht remitites A PI si ekil eht dlo ra gum tne fo eht g remitite A PI.

    .02 If siht si na da d sser of a tcurts avremiti l typ de v elbaira , ti nruter s eht pre suoiv remit N ot tes fi ,eulav fi tes ot N ULL ht e dlo remit eulav lliw ton eb ruter n de .

    .12 ehT ITI _REM VI UTR AL dna ITI ORP_REM F sremit are amirp ry lufesu ni nimit g ht e latot ex noituce ti em fo detceles su er ,snoitcnuf as eht remit snur no ly wh eli eht resu ssecorp si innur ng ro ht e lenrek si ex nituce g syst me snoitcnuf no flaheb fo eht esu r ssecorp fo r eht ITI REM _ ORP F .remit

    .22 B hto eht A PIs ter u nr zero no sseccus ro -1 eulav if ht ey liaf .

    .32 sremiT tes by the tites i rem API in a p nera t pr sseco a er on t etirehni d by sti lihc d eht tub ,sessecorp tub eht se sremit era deniater nehw a rp sseco e x s’ce a n we rp ogr .ma

    .42 T eh niwollof g prog mar i l setartsul eht esu fo tites i rem A PI.

    edulcni# h.oidts< > edulcni# h.dtsinu< > edulcni# is< gn h.la > edulcni# < sy h.emit/s > enifed# INT VRE AL 2

    diov emllac ( tni is g on_ ) { */ od emos deludehcs at s sk /* } www.vtucs.com tni niam ( ) { rts tcu lavremiti ;lav

    Dept.of CS&E,SJBIT

    egaP 91 XINU METSYS GNIMMARGORP SC01 26 tcurts is ga noitc ;noitca

    is g pme ty (tes &a as.noitc _ ;)ksam ldnah_as.noitca er = iov( d ()*( ) emllac) ; lf_as.noitca ags = R_AS E ;TRATS

    fi ( is ga (noitc SIGALRM, &a ,noitc )0 == - )1 { orrep r s“( ig noitca ”); nruter 1 ; } ni_ti.lav ces_vt.lavret = VRETNI AL; cesu_vt.lavretni_ti.lav = ;0 ces_vt.eulav_ti.lav = INT VRE AL; cesu_vt.eulav_ti.lav = 0 ;

    fi ( (remitites ITI _REM REAL, &v ,la 0 ) == -1 ) orrep r remitites“( ” ;) esle elihw )1( { */ od lamron noitarepo * / } ter nru 0 ; }

    .52 ecniS eht remitites dna a mral APIs iuqer re taht sresu tes pu is g lan nildnah g ot ctac h remit ex ,noitarip ht ey sh dluo ton eb desu ni noc j noitcnu htiw eht peels PA I, b uace se A peels A PI m ay idom fy eht is g lan h nildna g itcnuf on rof eht SIGAL MR s ign .la

    .6 1 .1 .XISOP 1b iT m re s

    .1 OP SI b1.X d e senif a tes of A PIs rof retni v la remit .noitalupinam

    .2 ehT OP SI b1.X remit s ra e rom e elf x elbi na d op w lufre aht n UNIX remit s in niwollof g way :s

    .a sresU m ay d e enif elpitlum tnednepedni sremit p re s y mets kcolc .

    .b ehT remit oser noitul si ni sdnocesonan .

    .c sresU may sp ice fy, no a remit ,sisab eht is g lan ot eb desiar nehw a remit ex .serip

    .d www.vtucs.comehT remit lavretni m ay be deificeps sa rehtie na a etulosb ro a evitaler emit .

    .3 erehT si a imil t no how am ny OP SIX sremit nac eb rc e deta rep orp ce ,ss siht si TI XAM_REM tnatsnoc denifed ni >h.stimil< eh a red .

    Dept.of CS&E,SJBIT

    egaP 92 XINU METSYS GNIMMARGORP SC01 26 .4 OP SIX sremit rc e deta by a orp c sse are ton ni h detire by sti dlihc orp ec ,ss tub era deniater a ssorc eht ex ce s ys met c .lla

    .5 A OP SI 1.X remit seod ton esu eht SI AG L MR sig lan nehw ti ex ,serip ti c na eb desu efas ly htiw eht peels A PI ni eht emas rp og mar .

    .6 ehT OP SI b1.X APIs rof t remi noitalupinam era :

    edulcni# is< gn h.la > edulcni# h.emit< >

    tni taerc_remit e dikcolc( _t ,kcolc tcurts tnevegis * s ,cep t_remit rdh_remit* p ;) tni _remit(emittes_remit t h_remit ,rd tni alf g, urts ct cepsrmiti ,lav* tcurts i it epsrm c ;)dlo* tni _remit g _remit(emitte t ,rdh_remit tcurts cepsrmiti )dlo* ; tni _remit g vote e t_remit(nurr )rdh_remit ; tni t_remit(eteled_remit )rdh_remit ;

    .7 ehT c_remit r etae A PI si desu ot dyn lacima ly crea et a remit dna r snrute sti reldnah .

    .8 ehT kcolc ra g tnemu eps c seifi hcihw sy mets colc k dluow eb eht wen emit r desab ,no sti eulav may eb CLOC ER_K ALTI EM rof rc eat ni g a r lae emit kcolc ti rem – iht s denifed by OP SI b1.X – o reht seulav a er sy mets d e tnednep .

    .9 ehT ps ec arg tnemu d fe i sen ahw t noitca to kat e nehw ht e remit ex .serip ehT rts u tc is g tneve d ata ty ep si fed i den :sa

    tcurts is gev tne { tni is g iton_ve fy; tni is g s_ve ig on ; noinu is g av l is g lav_ve u ;e ;}

    .01 ehT sig s_ve ig on dleif sp seifice a sig an l ebmun r ot eb esiar d ta ht e remit ex .noitarip I st dilav no ly nehw t he is g iton_ve fy dleif si tes ot SI _VEG SIGNAL.

    .11 If si iton_veg fy dleif si tes ot SIG ,ENON_VE on sig lan si desiar by eht remit nehw it ex .serip

    .21 Bec esua elpitlum sremit may eneg r eta ht e emas sig ,lan the eulav_vegis dleif si esu d ot niatnoc any esu r ifed n de atad ot itnedi fy taht a is g lan si r desia by a s ep cific .remit tcurts atad ehT www.vtucs.comatad tcurts u er fo eht is g f_ve i dle :si

    noinu is g av l {

    Dept.of CS&E,SJBIT

    egaP 93

    XINU METSYS GNIMMARGORP SC01 26 tni tni_lavis ; diov ;rtp_lavis* }

    .31 F ro ex ,elpma a ssecorp may ssa ign e hca remit a euqinu etni g re ID dengissa ot eht ceps vegis→ _ lavis.eulav _ tni dleif .41 oT ssap siht atad nola g htiw eht is gn la ( is g ongis_ve ) nehw ti si r ,desia eht _AS SIGINFO f al g dluohs eb tes ni na noitcagis ,llac hcihw stes pu eht nildnah g of r is eht is g lan dna t he ldnah ing uf n noitc otorp type dluohs eb :

    diov < lanhis >reldnah ( tni is g ,on is g *t_ofni e ,pv diov etnocu* xt ) ;

    nehw eht is g lan ha reldn si ,dellac eht pve eulav_is→ sniatnoc eht atad fo ht e ceps vegis→ _ .eulav T eh is g t_ofni ad ta type si denifed ni s< ig h.ofni >

    .51 If ps ec si es t ot NULL dna ht e remit si bas de no CL ER_KCO ALTI EM , eht n SIGAL MR s ig lan si siar ed nehw eht remit e x serip .

    .61 F lani ly eht prdh_remit ra g tnemu si na dda r sse fo a t_remit ty dep va elbair ot dloh ht e reldnah of eht newly ge detaren mit e .r sihT ohs u dl ton eb NULL sa ti si desu ot ac ll P rehto P OI b1.SX remit PA Is.

    .71 llA OP SI b1.X remit A P sI nruter z ore no us c ssec a dn -1 fi ht ey liaf .

    .81 ehT emittes_remit strats dna spots a ti rem ninnur g. ehT remit _g emitte si desu to euq ry eht c u tnerr lav u se fo eht remit .

    .91 ehT tcurts cepsremiti d ata type si denifed :sa

    tcurts epsremiti c { tcurts epsremit c ;lavretni_ti tcurts epsremit c ;eulav_ti ;}

    dna eht tcurts sremit p ce si denifed :sa

    tcurts epsremit c { t_emit ;ces_vt gnol ;cesn_vt ;} www.vtucs.com .02 ehT psremiti e ulav_ti.c e eificeps s the emit iniamer ng in eht ,remit na d lavretni_ti.cepsremiti ps e seific eht wen emit ot re daol eht remit nehw ti ex .serip lA l

    Dept.of CS&E,SJBIT

    egaP 94 XINU METSYS GNIMMARGORP SC01 26 semit era ficeps i de ni sdnoces aiv psremit e ces_vt.c dna ni onan s sdnoce iv a t.cepsremit v .cesn_

    .12 ehT lf ag emarap t re ni ti emittes_rem may eb 0 ro TI ER_REM ALTIME fi eht remit a lav( emit trats emit lav( a rg )tnemu si evitaler ot eht uc r tner .emit

    .22 If eht lf ag v eula si TIME A_R BSTI ,EM eht remit trats emit si na etulosba .emit

    .32 ehT dlo ra g tnemu si su ed ot niatbo pr suoive remit lav u ,se fi NULL no remit lav u se era r denrute .

    .42 ehT dlo a rg tnemu fo mit e emitteg_r snruter eht ruc r tne seulav fo an m de .remit

    .52 ehT nurrevoteg_remit PA I snruter eht rebmun fo is g slan eneg r deta b y a remit tub saw tsol .)nurrevo( remiT s gi slan are ton deueuq by eht lenrek fi ht ey are ar i des tub on t essecorp d by t ra g te p or c ,sse daetsni the k enre l re sdroc ht e ebmun r of evo r nur sig lan s remit rep remit .

    .62 ehT rtsed_remit oy si su ed ot rtsed oy a remit c r ae t de by remit _cr etae A PI.

    .6 1 .2 eaD m no orP ec ss e :s tnI r cudo it on

    .1 snomeaD are orp c sesse taht evil f ro a ol ng .emit hT ey are netfo ts a tr ed nehw eht sy mets si deppartstoob a dn etanimret no ly nehw t eh sy mets si tuhs .nwod

    .2 hT ey od ton ah ve a noc t nillor g ;lanimret os ew say taht ht ey nur ni eht b ca kg dnuor . UNIX sy smets evah un m suore snomead taht p e fr o mr d ay- ot -day .seitivitca

    .3 ereH ew kool ta eht rp co sse erutcurts fo d snomea dna woh ot etirw a d ea m .no

    .4 ecniS a da nome seod on t evah a nillortnoc g t mre i ,lan ew ne de ot see woh a nomead per nac per o tr e r ror itidnoc o sn nehw nihtemos g go se orw ng.

    .6 1 .3 eaD m no ahC r ca et ir ts ics

    .1 We kool ta emos nommoc sy ets m snomead na d woh ht ey aler te ot ht e stpecnoc of ssecorp g ,spuor nillortnoc g ,slanimret dna .snoisses

    .2 ehT sp dnammoc stnirp t eh sutats of va suoir orp c sesse ni ht e sy .mets W e lliw ex etuce : sp - jxa u redn DSB XINU

    .3 T eh -a noitpo wohs s eht sutats fo rp o essec s nwo ed by srehto , dna -x swohs secorp ses taht od www.vtucs.com on t vah e a co nillortn g .lanimret T eh -j noitpo lpsid ays t eh boj - detaler :noitamrofni eht noisses I ,D orp c sse g puor ID, nillortnoc g ,lanimret a dn lanimret ssecorp g puor I .D

    Dept.of CS&E,SJBIT

    egaP 95 XINU METSYS GNIMMARGORP SC01 26 .4 rednU Syst me V desab sys ,smet a ralimis mmoc a dn si sp - cjfe .

    .5 ehT tuptuo morf sp skool ekil

    PPID PID PGID DIS YTT PT GID DIU NAMMOC D 0 1 0 0 ? -1 0 ini t 1 2 1 1 ? -1 0 [ ]dtnevek 1 3 1 1 ? -1 0 [ ]dmpak 0 5 1 1 ? -1 0 [ ]dpawsk 0 6 1 1 ? -1 0 [ fdb ]hsul 0 7 1 1 ? -1 0 [ ]detadpuk 1 9001 9001 9001 ? -1 23 pamtrop 1 8401 8401 8401 ? -1 0 sy ls ogd -m 0 x dteni - elifdip 1 5331 5331 5331 ? -1 0 /nur/rav/ x ip.dteni d 1 3041 1 1 ? -1 0 [ ]dsfn 1 5041 1 1 ? -1 0 [ ]dkcol 5041 6041 1 1 ? -1 0 [ ]doicpr 1 581 3 3581 3581 ? -1 0 norc d 1 2812 2812 2812 ? -1 0 dspuc/nibs/rsu/

    .6 ehT s y mets rp o sessec ed dnep no eht itarepo ng sy mets .noitatnemelpmi nA yt ih ng tiw h a pa tner rp o ssec ID of 0 si lausu ly a rek n le pr sseco rats t de as rap t fo eht system partstoob udecorp r .e (An ex noitpec to iht s is in ,ti ecnis it is a resu - vel el nammoc d detrats by eht rek n le ta b too ).emit

    .7 lenreK rp o sessec are ps e laic dna gen lare ly ex tsi rof eht eritne il f emite fo t eh sy mets . hT ey nur htiw urepus s re elivirp g se dna ah ve on c nillortno g lanimret dna n o dnammoc .enil

    .8 ssecorP 1 si lausu ly ,tini si a syst me nomead re elbisnops ,rof noma g ot reh niht gs, nitrats g sy mets ivres c se cificeps ot suoirav ur n .slevel esehT ivres c se era lausu ly d nwo rieht fo pleh eht htiw detnemelpmi htiw eht pleh fo rieht nwo d a .snome www.vtucs.com .9 nO L uni x, eht vek DTne nomead sedivorp rp o ssec etnoc xt rof ninnur g udehcs l de .lenrek eht ni snoitcnuf ni eht .lenrek

    Dept.of CS&E,SJBIT

    egaP 96 XINU METSYS GNIMMARGORP SC01 26 .01 ehT dmpak nomead rp o sediv troppus rof eht decnavda op w re nam a tnemeg utaef res suoirav htiw elbaliava htiw suoirav co retupm sy .smets

    .11 ehT pawsk d da nome si osla nwonk sa ht e page tuo ead .nom It troppus s eht autriv l omem ry bus sy mets by w nitir g rid ty p ag se ot ksid wols ly revo mit e.

    .21 ehT L uni x lenrek hsulf es dehcac atad ot ksid nisu g owt lanoitidda da me o :sn sulfdb h .detadpuk dna .detadpuk

    .31 ehT reppamtrop da ome n, ,pamtrop sedivorp eht ecivres fo ippam ng CPR tomeR( e )llaC erudecorP )llaC prog mar srebmun ot krowten trop .srebmun

    .41 ehT sy ls ogd d nomea is elbaliava ot any progr ma ot ol g sy mets sem s sega rof na T .rotarepo T he ssem ag se may be detnirp no a noc s elo ecived dna osla ttirw en ot a .elif

    .51 T eh dteni nomead (x )dteni snetsil no eht sy ts em's krowten etni r af c se f ro gnimocni rof stseuqer rof v suoira ten w kro vres e .sr

    .61 ehT ,dsfn ,dkcol dna doicpr snomead edivorp su tropp rof eht krowteN eliF Sy ets m N( F )S .

    .71 ehT norc d nomea ( dnorc ) ex setuce sdnammoc ta s deificep d seta na d .semit uoremuN s sy mets noitartsinimda ta sks era deldnah by h va ing rp o smarg ex detuce regul ra ly by .norc

    .81 ehT dspuc d a nome si a tnirp ;reloops ti seldnah tnirp stseuqer no eht sy ts e .m

    .91 ehT lenrek snomead ra e detrats tuohtiw a nillortnoc g .lanimret ehT cal k fo a nillortnoc g te lanimr ni t eh esu r- level d snomea is baborp ly ht e r tluse fo t eh da snome nivah g dellac .distes

    .02 llA eht resu -l leve d mea o sn ra e orp c sse g puor lea sred na d noisses ael d sre dna are ht e no ly p secor s se ni ieht r p r sseco g uor p na d .noisses F ani lly, eton t h ta eht par tne fo som t d eseht fo eseht d a snome si eht tini ssecorp .

    .6 1 .4 oC d gni R u el s

    .1 emoS cisab selur ot doc ing a d nomea p r tneve u n detnaw retni a snoitc orf m ineppah ng.

    .2 We etats eseht selur dna t neh wohs a uf n ,noitc ad e ,ezinom taht stnemelpmi .meht

    a. ehT tsrif niht g ot od si ac ll ksamu ot tes eht elif edom cr noitae ksam ot .0 ehT elif www.vtucs.comedom rc e noita ksam taht si detirehni dluoc eb tes to ed ny rec t nia .snoissimrep

    b. llaC krof dna evah t he p a tner e x .ti sihT seod eves r la niht g .s

    Dept.of CS&E,SJBIT

    egaP 97 XINU METSYS GNIMMARGORP SC01 26 x F ,tsri fi eht nomead saw detrats sa a elpmis llehs ,dnammoc nivah g eht pa ner t s eht sekam etanimret sekam eht s h lle kniht taht eht dnammoc si .enod x ,dnoceS eht dlihc hni e stir eht orp c sse g puor ID fo eht pa tner tub g ste a wen ssecorp I ,D so we are gu tnara e de taht the dlihc is ton a p or c sse g uor p el a red . f etisiuqererp a si sihT si a etisiuqererp f or eht llac ot distes taht si enod en x .t c. llaC distes ot etaerc a en w .noisses T eerh spets co .ruc ehT rp o ssec x semoceb a s noisse edael r fo a wen s ,noisse x semoceb eht rp o ssec gro pu redael of a n ew orp ec ss g uor p x sah on oc nillortn g t e .lanimr

    d. nahC ge eht cu tnerr row k ni g rid e otc ry ot eht toor otcerid ry. The cu tnerr w gnikro otcerid ry detirehni orf m eht tnerap dluoc eb no a detnuom elif sy mets . ecniS snomead lamron ly ex si t litnu eht sy mets si er b ,detoo fi ht e da nome ts ays on a elif detnuom elif sy ,mets aht t elif sy mets c tonna eb u n .detnuom

    e. edeennU d elif ed s tpirc o sr dluohs eb .desolc T sih stneverp eht d mea on morf nidloh g nepo a ny d ircse p srot taht ti m ay ah ve hni e detir morf sti tnerap .

    f. emoS snomead epo n lif e rotpircsed s ,0 ,1 dna 2 to llun/ved/ os taht any arbil ry senituor taht try ot r ae d morf dradnats tupni ro etirw ot dradnats tuptuo or dradnats er ror lliw vah e on .tceffe ecniS eht da nome si ton detaicossa htiw a t ,ecived lanimret ,ecived t h ere si erehwon rof tuptuo ot eb lpsid ay ;de on r si ereht any hw re e ot er c evie tupni morf na evitcaretni us .re Ev ne fi eht nomead w sa rats t de f mor an evitcaretni ,noisses eht nomead snur ni eht ,dnuorgkcab dna eht ol g ni noisses ac n etanimret tuohtiw af tcef ing ht e .nomead If hto er u sres log ni no eht s ema t re lanim ,ecived ew dluow n't wa tn tuptuo morf ht e da nome gniwohs pu on eht et ,lanimr dluow sresu eht dna eht sresu dluow n't e x tcep rieht tupni ot eb r ae d by eht d nomea .

    axE m lp e

    .3 ehT noitcnuf b wole c na eb ellac d morf a rp o rg am taht stnaw ot ezilaitini flesti sa a nomead .

    i# edulcn h.oidts< > h.dtsinu< edulcni# h.dtsinu< > < edulcni# < sy ols g. >h h.ltncf< edulcni# h.ltncf< > < edulcni# < sy uoser/s r .ec h>

    inomead diov inomead z tsnoc(e c h ra dmc* ) { tni ,i ,0df ,1df ;2df www.vtucs.comt_dip dip ; tcurts timilr lr ; tcurts is ga noitc ;as

    Dept.of CS&E,SJBIT

    egaP 98 XINU METSYS GNIMMARGORP SC01 26 */ raelC elif c r noitae .ksam /* )0(ksamu ;

    */ teG am x mumi un m reb fo elif d .srotpircse * / fi (timilrteg( R IL MI _T IFON LE, )lr& < )0 { :s%"(ftnirp ac n't get elif timil ", ;)dmc ex )1(ti ; }

    */ B emoce a noisses l e reda ot esol illortnoc ng T .YT /* fi dip(( = f o ))(kr < )0 { :s%"(ftnirp ac n't f ro k", )dmc ; ex )1(ti ; } esle fi dip( =! 0) */ tnerap /* ex )0(ti ; ;)(distes

    */ erusnE erutuf o p ne s now 't olla c eta illortnoc ng .sYTT * / ldnah_as.as er = SIG_ ;NGI is g pme ty tes (& _as.as m ;)ksa lf_as.as ags = 0 ; fi is( ga (noitc SI PUHG , & ,as UN LL) < 0) { orrep r("si :noitcag c an't ig eron SIG ;)"PUH ex )1(ti ; } fi dip(( = f o ))(kr < )0 { :s%"(ftnirp ac n't f ro k", )dmc ; ex )1(ti ; } esle fi dip( =! 0) */ ap r tne /* ex )0(ti ; */ nahC ge eht ruc r tne nikrow g id r otce ry ot eht toor os * ew ow n't erp v tne elif sy smets f mor ieb ng u n .detnuom /* fi ridhc( ("/") < 0) { orrep r idhc"( :r c na 't ahc nge id r otce ry ot /"); ex )1(ti ; } */ esolC lla nepo elif .srotpircsed * / fi am_milr.lr( x == RL MI _INFINIT )Y am_milr.lr x = 4201 ; rof www.vtucs.comi( = ;0 i < milr.lr _ am x; )++i )i(esolc ; */ hcattA elif sed c srotpir ,0 ,1 dna 2 ot .llun/ved/ /* 0df = nepo (" lun/ved/ l ," DR_O W )R ;

    Dept.of CS&E,SJBIT

    egaP 99 XINU METSYS GNIMMARGORP SC01 26 1df = )0(pud ; 2df = )0(pud ; */ I ilaitin ze eht ol g lif e. /* ,dmc(golnepo L _GO C ,SNO LO MEAD_G O )N ; fi 0df( =! 0 || 1df =! 1 || 2df =! )2 { sy ls og(L GO _ ,RRE " enu x detcep if el d pircse t sro d% d% % d", ,0df ,1df )2df ; ex )1(ti ; } }

    .4 If eht d a inome ze noitcnuf si dellac morf a niam p margor taht neht g seo ot ,peels ew c nac c h kce eht sutats fo t he nomead htiw eht sp c o :dnamm

    $ tuo.a/. $ sp -axj PPID PID PGID SID TTY PT G DI UID NAMMOC D 1 6433 5433 5433 ? -1 105 tuo.a/.

    .6 1 .5 rE r ro Lo gg ni g

    .1 enO elborp m a d nomea sah si woh ot h eldna re r ro ssem ag se . It nac ton s pmi ly irw et dnats ot dnats dra e r ,ror ecnis ti dluohs on t evah a ortnoc l nil g .lanimret

    .2 ehT B DS sy ols g f ilica ty si ni 2.4 B DS dna m tso sy smets devired morf DSB troppus sy ls og.

    .3 ehT sy ls og noitcnuf si dedulcni sa na XSI ex noisnet ni eht niS g el UNIX S noitacificep .

    .4 ehT B DS sy ls og fa ic til y si desu by tsom ad e snom . Figure woleb setartsulli sti erutcurts .

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 01 0 XINU METSYS GNIMMARGORP SC01 26 .5 erehT era ht r ee ways ot areneg te ol g m sse ag se :

    .a lenreK senituor c na c lla eht gol .noitcnuf Th ese m sse ag se nac be r dae b y na y user snepo taht ssecorp taht snepo dna r e sda eht lk/ved/ og d .ecive .b tsoM resu orp c sesse (dae )snom llac eht sy ls og uf n noitc ot gen are te log em s .segas ssem eht sesuac sihT sesuac eht ssem a eg ot eb tnes ot eht U NIX d niamo tad ag mar cos k te ol/ved/ g. .c A resu orp c sse no siht ho ,ts ro no emos to h re tsoh taht si nnoc e detc ot siht tsoh b y a PCT /IP n ,krowte ac n dnes log ssem a seg ot DU P trop .415 toN e taht ht e sy ls og noitcnuf reven eneg r ta es eseht PDU tad ag mar s: ht ey uqer i er ex ticilp krowten nimmargorp g by t he orp c sse eneg r nita g eht l og m e egass .

    .6 lamroN ly, eht sy ls ogd d a nome sdaer lla eerht f ro sm fo ol g ssem a .seg

    .7 nO trats - ,pu siht mead on sdaer a ifnoc gu noitar ,elif lausu ly e/ t /c sy ls og.c ,fno cihw h hw senimreted hw e er fid fe er tn sessalc fo ssem a seg a re ot eb .tnes

    .8 F ro ex ,elpma tnegru em s segas c na eb s tne ot eht sy mets rotartsinimda fi( gol g de ni ) osnoc eht no detnirp dna detnirp no eht osnoc l ,e ehw r sae w inra ngs m ay eb deggol ot a elif .

    .9 ruO fretni a ec ot siht f a ilic ty si uorht gh t he sy ls og f .noitcnu

    < edulcni# < sy ols g. >h olnepo diov olnepo g( tsnoc rahc * tnedi , tni noitpo , tni ilicaf ty ;) diov sy tni(gols iroirp ty, c tsno rahc * rof m ta , ;)... olesolc diov olesolc g )diov( ; oltes tni oltes g tni(ksam ksam p ir ;)

    .01 nillaC g lnepo og si .lanoitpo If it's ton c ,della eht fi tsr emit sy ls og si c ,della olnepo g is lacitamotua dellac lacitamotua ly.

    .11 nillaC g olesolc g si osla lanoitpo — ti uj st sesolc t eh rotpircsed taht saw be ni g desu ot eht htiw etacinummoc htiw eht sy ols gd nomead .

    .21 nillaC g lnepo og stel su iceps fy na tnedi taht si dedda ot ea hc log sem s .ega sihT si lamron ly eht n ema fo ht e margorp ( c ,nor ,dteni te c .).

    .31 ehT noitpo a rg tnemu si a ksamtib iceps fying v ira o su .snoitpo

    .41 hT e elbaliava snoitpo are sa :swollof

    oitpo n noitpircseD If eht log ssem a eg can t' eb tnes ot sy ls ogd via eht UNIX iamod n LO www.vtucs.comSNOC_G tad ag ,mar eht sem as ge i s nettirw ot eht elosnoc i n .daets nepO eht UNIX niamod tad agr ma tekcos ot t eh sy ls ogd mead no LO DN_G EL YA etaidemmi ly; nod 't w tia litnu eht tsrif assem ge si gol g .de roN m la ly, ht e

    Dept.of CS&E,SJBIT

    egaP 01 1 XINU METSYS GNIMMARGORP SC01 26 oitpo n noitpircseD ssem tsrif eht litnu denepo ton si tekcos si ton denepo litnu eht tsrif ssem age si l o .degg oD ton tiaw rof dlihc sessecorp taht mig th ah ve neeb cre deta ni ht e ssecorp of gol ging the ssem ag .e sihT erp v tne s stcilfnoc tiw h LO ON_G AW IT snoitacilppa taht hctac SI CG HL ,D nis ce eht ap noitacilp im g th vah e t deveirter t he lihc d's sutats by eht emit taht sy ols g sllac .tiaw leD ay eht op ne fo the co noitcenn ot eht sy ls ogd nomead litnu eht srif t LO DO_G EL YA deggol si egassem si deggol . W etir eht gol ssem age ot dradnats rre or ni dda i noit ot nidnes g ti ot LO P_G RORRE sy ls og .d U( n elbaliava no ).siraloS Log the rp o ssec ID tiw h cae h ssem a .eg sihT si i dednetn of r da snome LO _G PID taht krof a dlihc secorp s ot eldnah ffid e tner r qe u stse sa( pmoc a der to sa hcus ,snomead hcus sa sy ls o ,dg taht reven c lla )krof .

    .51 ehT f a ilic ty a rgum tne of r olnepo g si sekat no t he f niwollo g .seulav

    f tilica y noitpircseD

    LO TUA_G H irohtua z noita orp gr :sma ol g ,ni ,us g te ty, .. .

    LO PHTUA_G RIV emas sa L GO _ ,HTUA b ut gol g de ot elif htiw r detcirtse snoissimrep

    LO NORC_G C nor dna a t

    LO OMEAD_G N sy mets d a :snome ,dteni ,detuor ...

    LO _G FTP eht F PT nomead ( dptf )

    LO REK_G N segassem gen detare by t he enrek l

    LOG_L CO AL0 R devrese f or lacol su e

    LOG_L CO AL1 R devrese f or lacol su e

    LOG_L CO AL2 R devrese for lacol su e

    LOG_L CO AL3 R devrese f or lacol su e

    LOG_L CO AL4 R devrese f or lacol su e LOG_L COwww.vtucs.comAL5 R devrese f or lacol su e LOG_L CO AL6 R devrese f or lacol su e

    Dept.of CS&E,SJBIT

    egaP 01 2

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 f tilica y noitpircseD

    LOG_L CO AL7 R devrese f or lacol su e

    LOG_LPR enil retnirp syst :me ,dpl ,cpl ...

    LO M_G A LI eht liam sy ts em

    LO EN_G WS eht tenesU wten o kr wen s sy ets m

    LO YS_G SL GO eht sy ls ogd d a nome flesti

    LO RESU_G segassem morf hto er esu r sessecorp ed( f tlua )

    LO PCUU_G eht PCUU sy ets m

    .61 ehT nosaer rof eht caf i il ty ra g tnemu si ot tel eht ifnoc gur noita elif iceps fy th ta segassem morf ffid e ner t seitilicaf era ot eb deldnah tnereffid ly. If ew nod 't llac olnepo g, or fi ew llac ti htiw a fa ilic ty of ,0 we c na llits iceps fy ht e fa tilic y as pa tr fo iroirp eht iroirp ty arg tnemu ot syslog.

    .71 ehT sy ls og si c della ot g e etaren a ol g m sse ag .e

    .81 ehT iroirp ty arg tnemu is a noitanibmoc fo ht e fa ilic ty detsil oba ve dna a dn a el v le , esehT .woleb detsil .woleb esehT evel ls era ro d dere by p iroir ty, morf ih gh tse ot .tsewol

    level noitpircseD LO REME_G G eme rgency ( sy mets si )elbasunu h( ig tseh iroirp ty)

    LO _G AL RE T oitidnoc n taht tsum eb if x de etaidemmi ly LO C_G RIT lacitirc noitidnoc e( .g ,. h dra ived ce e r ror )

    LO RRE_G rorre noitidnoc

    LO _G W RA NING inraw ng noitidnoc

    LO ON_G TICE ,lamron tub is g tnacifin c oitidno n

    LOG_INFO lanoitamrofni ssem age

    LO D_G EBUG ubed g m sse age tsewol( p iroir ty)

    .91 ehT www.vtucs.comtamrof arg tnemu na d any iniamer ng arg nemu ts era dessap ot eht irpsv n ft noitcnuf ittamrof rof ittamrof ng.

    Dept.of CS&E,SJBIT

    egaP 01 3 XINU METSYS GNIMMARGORP SC01 26 .02 Any oc ruc r ne ce fo eht owt ahc r sretca m% ni eht tamrof are tsrif lper ca de htiw eht sem rorre sem as ge irts ng ( ts er rorr ) roc r nidnopse g ot t he eulav fo onrre .

    .12 ehT oltes g ksam noitcnuf nac eb desu ot tes eht log iroirp ty ksam rof eht pro .ssec sihT p eht snruter noitcnuf snruter eht p r ve i suo .ksam

    .22 W neh eht ol g irp o ir ty m ksa si ,tes ssem ag se ra e ton gol g de sselnu th rie p iroir ty si tes ni eht gol iroirp ty .ksam etoN aht t stpmetta ot s te eht gol iroirp ty ksam ot 0 lliw vah e ffe on ffe e tc .

    .32 ehT gol ger rp ogr ma si osla dedivorp by am ny sys smet sa a way ot dnes log ssem a seg ot eht sy gols f ilica ty. sihT reggol dnammoc si tni e dedn of r a llehs sc tpir ru ninn g on en evitcaretni ly taht ne sde ot gen are te ol g m sse ag se .

    axE mp el

    .42 In a ( hy itehtop c )la enil p r retni reloops ,nomead you im g th tnuocne er eht s e cneuq e

    olnepo g(" pl d", L _GO P ,DI L GO _L )RP ; sy ls og(L GO _ ,RRE " po en rorre rof :s% % m", lif e )eman ;

    .52 ehT tsrif c lla stes eht di e tn nirts g ot eht rp o marg ,eman ficeps i se taht eht ssecorp ID wla dluohs wla ays be detnirp , dna stes eht ed f tlua icaf lity ot eht enil retnirp syst .me

    .62 ehT llac ot sy ls og sp fice i se na e r ror noitidnoc dna a ssem age irts ng.

    .72 If ew h da ton dellac open ol g, eht s e dnoc llac luoc d ah ev b een

    sy ls og(L GO _ RRE | L _GO L ,RP "op ne e r ror f or % :s m% ", manelif e);

    ,ereH ew ps e ic fy eht iroirp ty ra g tnemu sa a co noitanibm fo a level dna a ilicaf ty. .82 In noitidda ot sy ols g, am ny ftalp o smr edivorp a rav i tna taht seldnah bairav el arg tnemu .stsil

    < edulcni# < sy ols g. >h adts< edulcni# adts< rg. >h

    v diov v sy tni(gols iroirp ty, tsnoc rahc * fo tamr , l_av i ts gra ;)

    .92 tsoM sy ls ogd snoitatnemelpmi lliw eueuq ssem ages rof a trohs .emit If a acilpud et a egassem a r sevir irud ng t sih ,emit eht sy ls og d ea m no lliw ton etirw ti t o eht ol g.

    .03 I tsn e www.vtucs.com,da eht da nome lliw tnirp tuo a assem ge si ralim ot " tsal ssem age r detaepe N .semit "

    Dept.of CS&E,SJBIT

    egaP 01 4 XINU METSYS GNIMMARGORP SC01 26 .6 1 .6 iS gn el -I sn t na ce eaD m no s

    .1 emoS snomead era detnemelpmi os taht no ly a s ni g el oc py fo eht da me on dluohs be ninnur g ta a emit rof rp o rep epo r .noita

    .2 ehT nomead mig th en ed ex evisulc ssecca ot a ed v ,eci rof ex .elpma In eht c esa fo ht e norc d ,nomea if elpitlum secnatsni w re e innur ng, cae h oc py mig th try ot st tra a nis g el po deludehcs po e ,noitar ser u nitl g ni etacilpud epo r snoita dna baborp ly na rre o .r

    .3 If ht e d nomea ne sde ot ca c sse a d ,ecive the ed v eci vird er lliw semitemos erp v tne oc eht fo snepo elpitlum snepo fo eht oc r nidnopser g d ecive on de in ved/ .

    .4 sihT stcirtser us ot no e oc py of eht d nomea ur n nin g ta a .emit If no us ch cived e si oh ,elbaliava oh w ,reve we n dee ot od eht krow o u esr l .sev

    .5 ehT elif - na d re droc -lock ni g me msinahc ivorp d se eht sisab for one way ot erusne th ta no ly eno oc py fo a d ea m no si ninnur g.

    .6 If e hca d nomea rc e seta a elif na d alp c se a etirw l kco no ht e ritne e ,elif o ln y one cus h wolla eb lliw kcol etirw kcol lliw eb wolla ed ot eb rc e .deta

    .7 evisseccuS stpmetta ot rc e eta etirw kcol s lliw ,liaf ivres ng sa an in noitacid ot c evisseccus c o seip fo eht nomead taht rehtona sni t ecna si la r ae dy innur ng.

    .8 F eli dna r droce l o nikc g p sedivor a noc v tneine lautum -ex noisulc .msinahcem

    .9 If the nomead sniatbo a etirw - kcol no na eritne ,elif eht kcol lliw eb evomer d lacitamotua ly fi eht d ea nom exit .s sihT si ifilpm es evocer ry, ivomer ng ht e deen rof su eht morf pu naelc ot naelc pu morf eht p er v suoi ecnatsni fo eht d a .nome

    axE mp el

    .01 ehT noitcnuf nwohs leb ow rtsulli seta eht esu fo fi el dna re droc ikcol ng ot erusne aht t no ly eno oc py fo a d ea m no si ninnur g.

    .11 hcaE oc py fo eht mead on lliw try ot aerc te a elif dna etirw sti ssecorp ID ni ti . ihT s itnedi ot srotartsinimda wolla lliw wolla srotartsinimda ot itnedi fy eht rp o ssec e isa ly.

    .21 If eht elif si la r ae dy col k ,de eht elifkcol uf n noitc lliw liaf htiw onrre tes ot SECCAE ro GAE AIN, so we uter rn ,1 itacidni ng taht the da nome si rla eady ninnur g. siwrehtO ,e acnurt ew acnurt te eht ,elif w etir ruo orp c sse ID ot ,ti a nd nruter 0 .

    .31 www.vtucs.comitacnurT ng ht e elif p er ev stn atad f mor ht e iverp o su nomead ppa e ira ng as fi ti seilppa tnerruc eht ot eht tnerruc d nomea . h.dtsinu< edulcni# h.dtsinu< > >h.bildts< edulcni# >h.bildts<

    Dept.of CS&E,SJBIT

    egaP 01 5 XINU METSYS GNIMMARGORP SC01 26 h.ltncf< edulcni# h.ltncf< > < edulcni# < sy ols g. >h irts< edulcni# irts< ng h. > e< edulcni# e< r h.onr > h.oidts< edulcni# h.oidts< > < edulcni# < sy h.tats/s >

    enifed# L CO K IF LE " v/ a "dip.nomead/nur/r enifed# L OMKCO DE S( _I SUR R|S_IW SU R|S_IR RG P|S_IRO HT )

    ex nret tni ;)tni(elifkcol

    aerla tni aerla dy innur_ ng iov( d) { tni ;df rahc fub [ 61 ];

    df = nepo (L KCO FILE, DR_O WR|O ,TAERC_ L MKCO O )ED ; fi df( < )0 { sy ls og(L GO _ ,RRE "can't nepo :s% % s", LO IFKC L ,E rts e orr r e( r )onr ); ex )1(ti ; } fi f(elifkcol( d) < )0 { fi onrre( == E SECCA || e r onr == GAE AI )N { )df(esolc ; )1(nruter ; } sy ls og(L GO _ ,RRE "can't kcol :s% % s", LO KC IF L ,E rts e orr r e( r )onr ); ex )1(ti ; } tacnurtf e ,df( )0 ; ,fub(ftnirps " dl% ", l( ong) ))(dipteg ; ,df(etirw ,fub rts l b(ne u )1+)f ; )0(nruter ; }

    .6 1 .7 eaD m no oC vn tne i no s

    .1 lareveS nommoc noc v snoitne era dewollof by dae snom ni eht U NIX Sy ts e .m

    x If eht da nome sesu a kcol ,elif eht elif si u laus ly st dero ni nur/rav/ . ,etoN revewoh , taht eht nomead mig th deen urepus s re p snoissimre to aerc te a elif her .e The man e fo www.vtucs.comeht elif si lausu ly an em dip. , rehw e eman si t eh eman of eht d omea n ro eht .ecivres F ro ex elpma , eht eman fo eht norc omead n's kcol elif is dip.dnorc/nur/rav/ .

    Dept.of CS&E,SJBIT

    egaP 01 6 XINU METSYS GNIMMARGORP SC01 26 x If eht da nome stroppus ifnoc gur noita ,snoitpo ht ey are lausu ly derots ni cte/ . hT e ifnoc gu noitar elif si n dema eman . fnoc , wh ere an em si eht eman of eht da nome or eht man e fo the se ecivr . F ro ex ,elpma eht fnoc igu noitar of r eht sy ls ogd ad nome is /cte/ sy ls og fnoc. . x snomeaD c na eb ts a detr f mor eht dnammoc ,enil b tu ht ey ra e su u la ly ts a tr ed morf eno fo eht sy mets ilaitini z oita n stpircs ( *cr/cte/ ro */d.tini/cte/ .) If eht nomead dluohs eb detratser tua o lacitam ly wh ne ti ex ,sti ew nac ra range rof tini ot tratser ti a edulcni ew fi ew edulcni a pser a nw e tn ry f or ti ni battini/cte/ . x If a dae nom sah a noc fig noitaru ,elif eht d ea m no sdaer ti nehw ti ats r ,st ub t lausu ly ow n't kool ta ti .niaga If na tartsinimda or ahc n seg eht oc nfig taru i ,no eht nomead dluow deen ot be deppots dna tser a detr ot tnuocca rof eht fnoc i noitarug ahcng .se oT diova ,siht emos snomead lliw ca hct SI PUHG dna re er ad rieht ifnoc gu noitar selif nehw ht ey re eviec eht is gn .la ecniS ht ey aren't taicossa ed tiw h slanimret dna era rehtie noisses sredael tuohtiw nillortnoc g slanimret ro srebmem fo denahpro p ssecor gr ,spuo snomead evah no nosaer ot ex tcep ot iecer ev SIGH PU . ,suhT ht ey nac efas ly uer se .ti

    .6 18. lC i eStne r rev edoM l

    .1 A nommoc esu rof a ad e nom ssecorp si sa a s e vr er .ssecorp

    .2 We nac llac ht e sy ols gd ssecorp a s e evr r taht h sa segassem nes t ot ti by u s re rp o essec s nisu )stneilc( nisu g a U NIX d niamo tad ag mar cos k te .

    .3 In eneg r ,la a se evr r si a ssecorp taht w stia rof a tneilc ot tcatnoc ,ti qer u nitse g mos e ty ep fo s ivre c .e

    .4 ehT ivres ce ieb ng ivorp d de by t he sy ls ogd s vre er si eht gol ging fo na rre or egassem .

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 01 7

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 TINU – 7 PRETNI R ECO SS C CINUMMO A OIT N .1.7 I tn r cudo t oi n

    .1 We evah nees eht ssecorp lortnoc sevitimirp dna was woh ot vni o ek lpitlum e .sessecorp

    .2 ehT no ly way rof th ese sessecorp to ex ahc nge i noitamrofn si by issap ng nepo elif s a ssorca a krof ro na ex ce or rht uo gh t he elif sy mets .

    .3 We liw l won ebircsed rehto seuqinhcet rof orp ces ses ot etacinummoc htiw hcae :rehto I ,CP ro etni r- orp c sse c o .noitacinumm

    .4 In eht p ,tsa UNIX Syst me I CP saw a pegdoh odge of suoirav pa p caor h ,se wef of ew hcihw ew re elbatrop rca o ss lla U NIX sy mets .snoitatnemelpmi

    .5 uorhT gh eht OP SIX dna ehT epO n puorG rof( me lr y O/X p )ne nats d idra z noita ffe o ,str ereffid tub ,devorpmi sah noitautis eht noitautis sah ,devorpmi tub ereffid n sec llits e xi .ts

    .6 elbaT 1.7 irammus z se eht suoirav smrof fo I CP .

    onS . IPC pyt e .1 flah - elpud x sepip .2 FI OF s .3 lluf - elpud x sepip .4 deman lluf - elpud x sepip .5 egassem euq u se .6 erohpameS s .7 derahs omem ry .8 stekcoS 9 MAERTS S

    .7 ehT tsrif neves smrof fo I CP ni elbaT 1.7 era lausu ly cirtser t de ot IPC neewteb www.vtucs.comsessecorp no eht s ema h o .ts

    .8 ehT lanif t ow swor —so stekc dna SMAERTS — era eht no ly owt taht ra e eneg r la ly rof detroppus rof I CP wteb e ne secorp s se no ffid e tner .stsoh

    Dept.of CS&E,SJBIT

    egaP 01 8

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 piP .2.7 piP se

    .1 sepiP era eht tsedlo mrof fo UNIX S y mets I CP dna era dedivorp b y lla UNIX sy smets . oitatimil owt evah sepiP evah owt oitatimil n .s

    .a ) lacirotsiH ly, ht ey h eva b nee flah elpud x ,.e.i( ad ta swolf ni no ly eno id er )noitc . emoS sy smets won orp v edi lluf - elpud x ,sepip but rof am x mumi libatrop ity, we aht emussa reven dluohs reven emussa aht t siht si eht .esac

    ).b sepiP nac eb desu no ly teb w nee rp o sessec t tah evah a nommoc a ecn .rots lamroN ly, a epip si rc ae det by a orp c ,sse taht ssecorp sllac krof , dna ht e epip is t neewteb desu neewteb t he ap r tne dna eht dlihc .

    .2 H fla - elpud x sepip era t eh tsom nommoc ly u s de of rm fo I .CP .3 evE ry emit y uo type a neuqes ce fo sdnammoc ni a enilepip rof eht ehs ll ot ex etuce , llehs eht llehs cre seta a es p ara te rp o ssec rof ea hc moc m dna na d sknil eht s t adna rd tuptuo o f tupni dradnats eht ot eno ot eht dradnats tupni fo eht en xt nisu g a epip .

    .4 A epip si rc e deta by c nilla g eht epip noitcnuf .

    h.dtsinu< edulcni# h.dtsinu< > sedelif tni(epip tni tni(epip sedelif [2]); nruteR :s 0 fi ,KO -1 no e orr r

    .5 owT elif ed s srotpirc are denruter orht ugh eht lif e sed arg :tnemu elif d se [0] si nepo of r idaer ng, dna sedelif [1] si nepo rof w nitir g.

    .6 ehT tuptuo fo sedelif [1] is eht tupni rof sedelif [0].

    .7 owT w ays ot erutcip a h a fl - elpud x epip ra e nwohs ni if gure .1.7

    www.vtucs.com F erugi .7 1: T wo w sya to eiv w a ah lf-du xelp p pi e

    Dept.of CS&E,SJBIT

    egaP 01 9

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .8 ehT tfel flah fo eht if gure 1.7 swohs eht wt o sdne fo eht epip detcennoc in a nis g el .ssecorp

    .9 ehT rig th ah lf of eht figu er 1.7 isahpme z se taht the tad a ni eht ip pe wolf s uorht gh ht e lenrek .

    .01 ehT tatsf noitcnuf ruter ns a elif ty ep fo FI OF rof eht elif rotpircsed fo tie h re dne fo a .epip We nac tset rof a epip htiw eht S _ISFI OF orcam .

    .11 A epip ni a nis g el p or c sse si en xt ot .sselesu

    .21 lamroN ly, eht rp o ssec th ta sllac epip th ne c slla for ,k cr itae ng an I CP ahc n len morf ht e iv ro dlihc eht ot tnerap ot eht dlihc ro iv ce .asrev

    .31 W tah sneppah retfa t he f kro sdneped no hcihw d ri noitce fo atad wolf ew w .tna

    .41 F ro a pip e orf m eht par tne ot eht ,dlihc ht e ap r tne sesolc the r ae d dne fo eht ip ep df( [0] ,) dna eht ihc dl sesolc eht etirw dne df( [1] .)

    .51 Figu er 2.7 swohs eht er s nitlu g ra rang tneme fo ed .srotpircs

    F erugi .7 2: P epi f or m p tnera ot dlihc

    .61 F ro a pip e orf m eht dlihc ot eht p tnera , eht p ra e tn sesolc df [1], dna ht e dlihc esolc s df [0].

    .71 W neh www.vtucs.comeno e dn fo a epip is ,desolc eht niwollof g t ow selur ppa ly.

    .1 If ew daer morf a epip w esoh etirw dne h sa neeb ,desolc re da snruter 0 ot i tacidn e elif fo dne na dne fo elif tfa er lla ht e atad sah b e r ne e .da

    Dept.of CS&E,SJBIT

    egaP 11 0

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    .2 If we etirw ot a epip w esoh re da dne h sa been ,desolc eht sig lan SIGPI EP is gen are t .de If ew rehtie ig on re eht is gn la ro tac ch ti dna nruter morf eht is g an l etirw ,reldnah etirw snruter -1 htiw onrre tes ot E PI EP . .81 W neh ew era nitirw g to a epip ro( FI ,)OF ht e tnatsnoc PI _EP BUF seificeps ht e enrek l's epip ub f ref is z .e

    axE mp el

    .91 orP gr ma 1.7 wohs s eht edoc ot rc e eta a pip e be neewt a pa tner dna sti c dlih dna to epip eht nwod atad dnes atad nwod eht epip .

    h.dtsinu< edulcni# h.dtsinu< > h.oidts< edulcni# h.oidts< > >h.bildts< edulcni# >h.bildts<

    )diov(niam tni )diov(niam { tni n ; tni df [ ]2 ; t_dip dip ; rahc enil [ AM XLIN ]E ;

    fi )df(epip( < 0 ) orrep r(" ip pe e r or r"); fi dip(( = f o ))(kr < )0 { orrep r krof"( e orr r"); } esle fi dip( > )0 { */ tnerap /* df(esolc [0] ;) df(etirw [1], " olleh lrow d\n", )21 ; } esle { c */ h dli * / df(esolc [1] ;) n = r e df(da [0], ,enil AM XLI )EN ; TUODTS(etirw _ IF LEN ,O ,enil )n ; } ex )0(ti ; }

    P or gram 1.7 : dneS atad f or m tnerap ot dlihc revo a epip

    .02 In rP o marg 1.7 , ew llac ed daer dna etirw rid e tc ly no eht epip .srotpircsed

    .12 W tah www.vtucs.comsi erom nitseretni g si ot etacilpud eht ip pe srotpircsed otno dradnats tupni ro .tuptuo dradnats .tuptuo

    Dept.of CS&E,SJBIT

    egaP 11 1

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .22 ,netfO ht e dlihc eht n ur ns emos ehto r rp o ,marg a dn taht rp o marg nac rehtie r ae d orf m ew taht epip eht( tupni dradnats sti dradnats tupni eht( epip taht ew c aer t )de ro wr eti ot sti dradnats tuptuo eht( )epip .

    axE mp el

    .32 llaceR eht if ve uf n snoitc TE LL _ AW IT, TELL TNERAP_ , ET LL C_ HILD, AW I TNERAP_T , dna WAI C_T HILD.

    .42 orP gr ma edoc 2.7 swohs na noitatnemelpmi fo ht e snoitcnuf nisu g sepip .

    h.dtsinu< edulcni# h.dtsinu< > h.oidts< edulcni# h.oidts< > cni# edul >h.bildts<

    1dfp tni citats tni 1dfp [2], dfp 2[2]; diov AW_LLET IT )diov( { fi dfp(epip( 1) < 0 || ip p )2dfp(e < 0 ) orrep r(" ip pe e r or r"); } diov _LLET P TNERA t_dip( )dip { fi p(etirw( f 2d [1], "c", )1 =! 1 ) orrep r etirw"( e orr r"); } diov _TIAW PA TNER ( )diov { rahc c ; fi aer( d 1dfp( [0], & ,c 1) =! 1 ) orrep r r"( e da e r or r"); fi c( =! 'p') { (ftnirp " AW I AP_T R :TNE rrocni e tc tad a"); ex )1(ti ; } } diov HC_LLET I DL t_dip( )dip { fi p(etirw( f 1d [1], "p", )1 =! 1 ) ep orr r etirw"( e orr r"); } diov DLIHC_TIAW )diov( { www.vtucs.comrahc c ; fi aer( d 2dfp( [0], & ,c 1) =! 1 ) orrep r r"( e da e r or r");

    Dept.of CS&E,SJBIT

    egaP 11 2

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 fi c( =! 'c') ftnirp (" AW I C_T HIL :D cni o rr e tc tad a"); ex )1(ti ; } }

    P or gram 2.7 : senituoR ot tel a tnerap dna c dlih ezinorhcnys

    .52 We etaerc owt ip p se feb o er eht krof , sa nwohs ni p margor 2.7 .

    F erugi .7 3: gnisU t wo p sepi f ro tnerap — dlihc s noitazinorhcny

    .62 ehT tnerap setirw eht c ah tcar er "p" a ssorc eht pot epip nehw TELL C_ H DLI si ,dellac eht dna eht dlihc etirw s eht c carah t re "c" a ssorc ht e b o mott epip nehw TELL TNERAP_ si .dellac

    .72 ehT roc r idnopse ng AW xx_TI x snoitcnuf od a lb o nikc g r dae rof eht is ng el rahc a retc .

    .82 etoN taht cae h epip h sa na ex art r ae d ,re hw i hc d nseo 't .rettam Th ta ,si in noitidda ot eht dlihc idaer ng morf p 1df [0], eht tnerap osla h sa siht dne fo eht pot pi ep nepo rof idaer ng. sihT seod on t a f tcef ,su ecnis eht par tne nseod 't t ry ot r dae f mor siht .epip

    7 .3. p nepo dna cp sol e tcnuF i no s

    .1 ecniS a nommoc tarepo i no si ot etaerc a epip ot rehtona orp c ,sse ot rehtie re da ti s tuptuo ro dnes it tupni , eht dradnats I O/ arbil ry sedivorp eht nepop a dn solcp e .snoitcnuf

    .2 esehT owt uf n snoitc eldnah lla eht rid ty w o kr aht t ew ah ev b nee iod ng ruo s :sevle

    x C nitaer g a pip e x F kro ing a dlihc x C sol ni g eht desunu sdne fo t eh pip e x Ex tuce ni g a llehs ot nur t eh nammoc d x A dn nitiaw g rof eht oc m dnam ot etanimret . www.vtucs.com .3 ehT otorp typ se fo eseht f snoitcnu era :

    h.oidts< edulcni# h.oidts< >

    Dept.of CS&E,SJBIT

    egaP 11 3

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    IF LE op* p tsnoc(ne c h ra nirtsdmc* g, tsnoc c h ra * ty ep ;) fi retniop elif :snruteR elif retniop fi O ,K N ULL no e orr r (esolcp tni (esolcp IF LE * pf ); :snruteR noitanimret sutats fo nirtsdmc g, or 1 no orre r .4 ehT noitcnuf nepop od es a krof dna ex ce ot etucexe eht irtsdmc ng, and snruter a dradnats I O/ elif tniop e .r .5 If arg tnemu ty ep si "r", eht elif retniop si detcennoc ot eht radnats d tuptuo of nirtsdmc g ( if gu er 4.7 )

    F erugi .7 4: tluseR o f fp = nepop (cm gnirtsd , "r" )

    .6 If ty ep si "w", the elif retniop si nnoc e detc ot eht radnats d tupni fo c nirtsdm g, sa if ni nwohs ni if gure 5.7 .

    F erugi .7 5. tluseR o f fp = c(nepop m ,gnirtsd " w )" .7 ehT solcp e uf n tc noi cl seso eht nats d ra d I O/ s ,maert w stia of r eht co dnamm ot dna ,etanimret dna r snrute ht e noitanimret sutats fo eht .llehs

    .8 If eht sh lle tonnac be ex ,detuce ht e noitanimret s sutat enruter d by esolcp si sa fi ht e e dah llehs dah e x detuce e x .)721(ti

    .9 ehT nirtsdmc g si ex tuce ed by eht B ruo ne ,llehs sa ni

    hs -c irtsdmc ng

    .01 sihT snaem taht eht llehs ex sdnap any fo sti laiceps hc a car t sre ni nirtsdmc g. sihT s ot su swolla su ot s ay, f or e ax ,elpm

    pf = nepop (" sl .* c", "r ;)" www.vtucs.com ro

    pf = nepop ( dmc" 2 >&1", "r");

    Dept.of CS&E,SJBIT

    egaP 11 4

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 axE mp :el I mp el men tat i no fo nepop dna esolcp oitcnuF sn

    .11 orP gr ma edoc 3.7 swohs eht noitatnemelpmi fo nepop dna esolcp .

    h.dtsinu< edulcni# h.dtsinu< > h.oidts< edulcni# h.oidts< > >h.bildts< edulcni# >h.bildts< e< edulcni# e< r h.onr > h.ltncf< edulcni# h.ltncf< > < edulcni# < sy h.tiaw/s >

    rra ot retnioP */ retnioP ot rra ay olla c deta ta nur - .emit * / N = dipdlihc* t_dip citats t_dip dipdlihc* = N ULL; am tni citats tni am x df ;

    IF LE * op p tsnoc(ne c h ra nirtsdmc* g, tsnoc c h ra * ty )ep { tni i ; tni dfp [ ]2 ; t_dip dip ; IF LE pf* ; */ no ly wolla "r" ro "w" * / fi (( type[0] =! ' r' & & type[0] =! 'w') || type[1] != )0 { onrre = E I VN AL; */ deriuqer by OP SIX * / (nruter UN LL); }

    fi dipdlihc( == N ULL) { */ tsrif emit uorht gh /* */ etacolla z deore o tu rra ay f or dlihc sdip /* am x df = sy nocs f O_CS_( XAM_NEP ;) fi dipdlihc(( = c am(colla x ,df is z )))t_dip(foe == N ULL) (nruter UN LL); } fi fp(epip( d) < 0 ) (nruter UN LL ;) */ e onrr tes by epip () /*

    fi dip(( = f o ))(kr < )0 { (nruter UN LL ;) */ e onrr tes by rof k )( */ } esle fi dip( == 0) { */ dlihc /* fi *( type == 'r') { dfp(esolc [0] ;) fi dfp( [1] =! IF_TUODTS LE )ON { www.vtucs.com dfp(2pud [1], S _TUODT FIL NE O ;) dfp(esolc [1] ;) } } esle {

    Dept.of CS&E,SJBIT

    egaP 11 5

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 dfp(esolc [1] ;) fi dfp( [0] =! DTS IN IF_ LE )ON { dfp(2pud [0], STDI _N FIL NE O ;) dfp(esolc [0] ;) } } */ esolc lla pircsed t sro ni [dipdlihc ] * / rof i( = ;0 i < am xfd; ++i ) fi dipdlihc( [i] > 0) )i(esolc ;

    ex (lce " hs/nib/ ", "sh ," "-c", nirtsdmc g, hc( ar * ) ;)0 e_ x )721(ti ; } */ tnerap ...seunitnoc */ fi *( type == 'r') { dfp(esolc [1] ;) fi pf(( = (nepodf p df [0], type )) == N ULL) (nruter UN LL); } esle { dfp(esolc [0] ;) fi pf(( = (nepodf p df [1], type )) == N ULL) (nruter UN LL); } dipdlihc [ )pf(onelif ] = ;dip */ rebmemer dlihc dip rof siht df /* f(nruter p ;) }

    tni IF(esolcp LE * pf ) { tni ,df ;tats t_dip dip ;

    fi dipdlihc( == N ULL) { onrre = E I VN AL; (nruter -1 ;) */ )(nepop sah n reve b nee llac ed /* }

    df = onelif ( )pf ; fi dip(( = dipdlihc [ df ]) == )0 { e onrr = E I VN AL; www.vtucs.com(nruter -1 ;) */ pf saw n't denepo by op p ne () /* }

    dipdlihc [ df ] = 0 ;

    Dept.of CS&E,SJBIT

    egaP 11 6

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 fi esolcf( ( )pf == E OF) (nruter -1);

    elihw ,dip(diptiaw( &s ,tat )0 < 0 ) fi onrre( =! EI RTN ) (nruter -1 ;) */ rre or rehto naht EIN RT orf m )(diptiaw /*

    ;)tats(nruter */ r nrute dlihc 's noitanimret sutats /* } P or gram ehT3.7 nepop dna esolcp noitcnuf s .4.7 oC -pro ec ss se

    .1 A UNIX syst me retlif si a orp gr ma taht sdaer morf dradnats tupni dna setirw to .tuptuo dradnats .tuptuo

    .2 F etli sr are lamron ly co detcenn nil e ra ly in hs e ll .senilepip A retlif b semoce a oc - orp c sse nehw eht sa em margorp g ne e setar t eh etlif r's tupni dna aer ds eht retlif 's .tuptuo

    .3 ehT nroK sh lle sedivorp oc - orp c .sesse The Bourne ,llehs eht B nruo e-ag ia n ,llehs dna eht C llehs nod 't edivorp a w ay ot noc n tce orp c se s se ot g te h re sa oc - rp o sec s .se

    .4 A oc - rp o ssec lamron ly ru sn ni eht cab kg dnuor rf om a ,llehs dna sti adnats rd tupni dna era tuptuo dradnats tuptuo era noc n detce ot htona er rp ogr ma nisu g a .epip

    .5 Co- sessecorp era osla ufesu l morf a C rp o marg .

    .6 W saereh nepop giv se su a eno -way ip pe ot eht s dradnat tupni ro morf the radnats d tuptuo fo ehtona r orp c ,sse htiw a co- orp c ,sse we h eva owt one-way sepip to eht ehto r dnats sti ot eno :ssecorp eno ot sti dnats a dr tupni dna eno morf sti dradnats .tuptuo

    .7 We tnaw ot etirw ot sti dradnats ,tupni tel ti epo r eta no eht ,atad dna neht er da morf sti .tuptuo dradnats .tuptuo axE mp el

    .8 Let's kool ta oc -p secor es s htiw na ex .elpma ehT ssecorp cre seta owt pip e :s eno si eht dradnats tupni fo eht oc - ,ssecorp dna eht rehto si eht dradnats tuptuo fo eht oc - orp c .sse Figu er 7.7 swohs siht a rr tnemegna .

    www.vtucs.com

    F erugi .7.7 gnivirD a oc - ssecorp yb w gnitir sti dradnats ni p tu dna aer d gni sti uptuo dradnats uptuo t

    Dept.of CS&E,SJBIT

    egaP 11 7

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .9 ehT rp og mar 4.7 si a elpmis oc - ssecorp taht re sda owt srebmun morf sti dradnats ,tupni setupmoc rieht su ,m dna setirw eht mus to sti s dradnat .tuptuo We elipmoc iht s l dna margorp dna l e eva eht ex elbatuce ni eht elif 2dda .

    .eupa" edulcni# .eupa" h" i tn )diov(niam { tni ,n ,1tni 2tni ; rahc enil [ AM XLIN ]E ;

    elihw n(( = aer d TS( D IF_NI LE ,ON ,enil AM XLIN ))E > )0 { enil [n] = ;0 */ n llu etanimret /* fi nacss( f ,enil( %" d d% ", & ,1tni & )2tni == 2 ) { ,enil(ftnirps %" d\n", 1tni + ;)2tni n = )enil(nelrts ; fi DTS(etirw( UO IF_T LEN ,O nil ,e )n != n ) _rre sys("w etir orre r"); } esle { fi DTS(etirw( UO IF_T LEN ,O " ni v dila a rgs\n", )31 != 31 ) _rre sys("w etir orre r"); } } ex )0(ti ; } P or gram .4.7 S im elp f retli ot t dda wo un m reb s

    ehT rp og mar 5.7 ovni k se eht 2dda oc -p or c sse retfa r idae ng owt nu srebm morf sti ulav ehT .tupni dradnats .tupni ehT ulav e morf eht oc -p ssecor si w nettir ot sti dradnats .tuptuo

    .eupa" edulcni# .eupa" h"

    is diov citats diov is g ;)tni(epip_ */ ruo is g lan dnah l re /*

    tni )diov(niam { tni ,n 1df [2], df 2[2]; t_dip dip ; rahc enil [ AM XLIN ]E ;

    fi is( gn (la SIGPI ,EP s ig )epip_ == SIG_ )RRE _rre sys("sig lan e orr r"); www.vtucs.com fi df(epip( 1) < 0 || pip e )2df( < )0 _rre sys(" epip orre r ;)"

    Dept.of CS&E,SJBIT

    egaP 11 8

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 fi dip(( = f o ))(kr < )0 { _rre sys("fo kr e r or r"); } esle fi dip( > )0 { */ tnerap /* 1df(esolc [0] ;) 2df(esolc [1] ;) elihw ( fg ,enil(ste MAXLI ,EN )nidts != N ULL) { n = )enil(nelrts ; fi etirw( ( 1df [1], l i en , )n =! )n _rre sys("w etir rorre ot pip e"); fi n(( = r ae d 2df( [0], ,enil AM X IL NE )) < 0) _rre sys("r dae e rorr f mor ;)"epip fi n( == 0) { m_rre sg(" lihc d desolc )"epip ; kaerb ; } enil [n] = ;0 */ n llu etanimret /* fi ,enil(stupf( )tuodts == E OF) _rre sys(" stupf orre r"); } fi ef( r )nidts(ror ) _rre sys("f steg re r ro no nidts "); ex )0(ti ; } le es { */ dlihc /* 1df(esolc [1] ;) 2df(esolc [0] ;) fi 1df( [0] =! TS DIN IF_ LEN )O { fi 1df(2pud( [0], STDI _N FIL NE O) =! TS DIN IF_ LE ON ) _rre sys(" 2pud rorre ot )"nidts ; lc 1df(eso [0] ;) } fi 2df( [1] =! IF_TUODTS LE )ON { fi 2df(2pud( [1], S _TUODT FIL NE O) =! S _TUODT FIL NE )O _rre sys(" 2pud rorre ot )"tuodts ; 2df(esolc [1] ;) } fi e( x (lce "./ dda 2", 2dda" ", hc( ar )0)* < 0 ) _rre sys("ex lce err ro "); } ex )0(ti ; } diov citats diov is g tni(epip_ is g on ) { (ftnirp "Swww.vtucs.comIGPI EP cau hg t\ ;)"n ex )1(ti ; } P or gram .5.7 rgorP am ot evird eht 2dda f retli

    Dept.of CS&E,SJBIT

    egaP 11 9

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .01 ,ereH ew c aer te owt ip p ,se htiw eht ap r tne dna t eh dlihc nisolc g the ne ds ht ey od n't .deen

    .11 We evah ot esu wt o pip e :s eno rof ht e radnats d tupni fo eht co- orp c sse na d eno of r sti .tuptuo dradnats .tuptuo

    .21 ehT dlihc neht sllac ud p2 ot evom eht epip sed c srotpir otno sti dradnats tupni na d ofeb ,tuptuo dradnats ,tuptuo ofeb re c nilla g e x lce .

    .31 If we lipmoc e na d nur the rp ogr ma 5.7 , ti skrow sa ex detcep . F tru h omre r ,e fi ew lik l eht 2dda oc - rp o ssec ihw le eht rp o marg .7 5 si iaw t ni g for uo r tupni dna ht en retne wt o ,srebmun eht sig an l nah d rel si ekovni d ehw n eht margorp w setir ot ht e pi ep taht h sa no daer e .r

    FIF .5.7 FIF sO

    .1 FI sOF a re semitemos ac l del deman .sepip

    .2 sepiP nac eb desu no ly neewteb er l deta orp ces ses nehw a nommoc an rotsec sah aerc t de eht .epip

    .3 W hti F FI ,sO ewoh v ,re u detalern rp o sessec nac e x ahc nge d ata .

    .4 We was reilrae taht a IF FO si a type fo .elif One fo eht idocne ngs fo eht edom_ts eht fo rebmem fo eht tats curts t eru setacidni taht a elif si a F I .OF

    .5 We nac tset rof siht htiw eht S_ISF FI O m orca .

    .6 gnitaerC a F IFO si ralimis ot c itaer ng a elif . I dn ee ,d eht htap n ema for a FI OF e x stsi ni lif eht lif e sy mets .

    < edulcni# < sy h.tats/s >

    * rahc tsnoc(ofifkm tni tsnoc(ofifkm rahc * ap ,emanht t_edom )edom ; e no 1 ,KO fi 0 :snruteR 0 fi ,KO 1 no e r ror

    .7 ehT ificeps c noita fo eht edom arg tnemu rof eht ofifkm noitcnuf si eht emas sa rof ht e .noitcnuf nepo .noitcnuf

    .8 ehT elur s of r eht us re a dn puorg wo n ihsre p of eht en w FIFO are ht e s ema as ew debircsed ilrae er.

    .9 ecnO wwww.vtucs.come evah u s de ifkm fo ot etaerc a FI ,OF ew o p ne ti nisu g .nepo

    .01 Ind ,dee eht lamron elif O/I snoitcnuf ,esolc( read, ,etirw ,knilnu ).cte lla krow htiw FI sOF .

    Dept.of CS&E,SJBIT

    egaP 21 0

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .11 W neh ew nepo a FI ,OF t eh nikcolbnon g lf ag O( _ BNON LOC )K a ff e stc w tah sneppah .

    x In the lamron esac _O( N BNO L CO K ton ificeps e ,)d na epo n rof aer d- no ly kcolb s litnu emos rehto rp o ssec snepo eht FI OF rof nitirw g. ralimiS ly, an epo n for etirw - no ly skcolb litnu emos rehto orp c sse snepo eht IF FO rof re nida g. x If ON_O NBL KCO si ,deificeps na nepo for read- no ly r snrute letaidemmi y. But na nepo for tirw e- no ly r snrute -1 htiw e onrr tes ot NE XIO fi on p or c sse sah eht FI OF nepo f or r e ida ng.

    .21 sA htiw a ,epip fi ew etirw ot a F FI O taht on orp c sse sah nepo rof re nida g, eht is g an l SIGPI EP si neg e .detar

    .31 W neh eht tsal retirw of r a FI OF sesolc eht FIFO, na dne fo elif si eneg ar det rof eht daer er fo eht FI OF .

    .41 It si nommoc ot h va e elpitlum sretirw for a g vi en FI OF . sihT me sna aht t we vah e to row ry tuoba cimota tirw es fi ew od on t tnaw eht setirw morf elpitlum rp o sessec ot eb .devaelretni

    .51 sA htiw ,sepip eht tnatsnoc PI UB_EP F ps e eific s eht am x mi um tnuoma fo atad taht eb nac eb w nettir lacimota ly ot a F I OF .

    .61 erehT era owt u s se rof IF F sO .

    .1 FI sOF era desu b y llehs sdnammoc ot ssap atad morf eno llehs enilepip to ehtona r itaerc tuohtiw itaerc ng mretni e etaid aropmet ry selif .

    .2 FI sOF era desu sa ner dez suov tniop s ni cl tnei - revres ilppa c snoita ot p ssa atad eht neewteb eht stneilc dna t eh vres e sr .

    axE mp :el gnisU sOFIF ot etacilpuD tuptuO tS aer ms

    .71 FI sOF nac be desu ot d u etacilp na tuptuo maerts in a seires fo s h lle mmoc a .sdn

    .81 sihT stneverp nitirw g the atad ot na demretni i ta e ksid elif ralimis( ot su ing sepip to ksid etaidemretni diova etaidemretni ksid f .)seli

    .91 B tu ehw r sae sepip nac be desu no ly rof nil e ra co snoitcenn neewteb rp oce ,sess a FIFO ti os ,eman a sah a ,eman os ti c na eb u des rof enilnon ar nnoc ect .snoi

    .02 redisnoC a orp c ude re taht sdeen ot rp o ssec a deretlif tupni rts e ma eciwt . Fig eru 7 8. arra siht swohs siht arra ngem .tne www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 21 1

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    F erugi .8.7 orP c erude t tah sessecorp a f deretli tupni aerts m tw eci

    .12 W hti a FI OF dna eht UNIX rp ogr ma eet ,)1( ew nac a hsilpmocc iht s udecorp er tuohtiw nisu g a opmet rary f .eli T( he tee prog mar seipoc sti dnats a dr tupni ot htob sti moc sti no deman elif eht ot dna tuptuo dradnats tuptuo dna ot eht elif deman no sti moc m dna .enil )

    km ofif ofif 1 orp g3 < 1ofif & orp g1 < elifni | eet fif o1 | rp og2 .22 We etaerc eht FI OF na d neht trats orp g3 ni eht b ca kg ,dnuor re ida ng orf m eht F FI O. We neht trats orp g1 and esu eet ot dnes sti i tupn ot htob eht FI OF dna rp og2.

    Figu er 9.7 swohs eht pro ec ss a r ar ngem .tne F erugi .9.7 gnisU a FI OF dna eet ot dnes a rts eam ot t wo fid f tnere essecorp s

    axE mp neilCel t revreS itacinummoC on gnisU a OFIF

    .32 rehtonA esu f or F FI sO i s ot dnes atad wteb e ne a c tneil dna a res v .re

    .42 If ew evah a se revr aht t si detcatnoc by un rem o su ,stneilc hcae tneilc can etirw ti s tseuqer ot a llew - nwonk FI OF taht eht revres crea .set (By "w lle - wonk n" w e naem taht eht fo emanhtap eht emanhtap fo eht FIFO si nwonk ot lla eht stneilc taht deen ot tcatnoc t eh vres e ).r

    .52 Figu er www.vtucs.com01.7 swohs siht a r ar ng .tneme

    Dept.of CS&E,SJBIT

    egaP 21 2

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    F erugi .01.7 stneilC gnidnes stseuqer ot a vres er gnisu a FIFO

    .62 ecniS ereht are elpitlum sretirw rof eht FI ,OF ht e stseuqer tnes by eht stneilc ot eht evres r een d ot eb ssel t ah n PI EP _B FU byt se ni is z .e sihT erp v stne any tni re gnivael fo eht tneilc etirw s.

    .72 ehT melborp ni isu ng FIF sO of r siht ty ep of ilc e tn - revres oitacinummoc n si woh to b seilper dnes seilper b a kc morf t he vres er ot e a hc .tneilc

    .82 A nis g el FI OF can't eb ,desu sa eht stneilc dluow reven wonk nehw ot daer rieht v esnopser v e susr snopser es rof rehto .stneilc

    .92 enO noitulos is rof hcae tneilc ot dnes ti s ssecorp ID htiw eht .tseuqer ehT revres eht n aerc t se a euqinu FI OF rof hcae ,tneilc nisu g a ap t emanh desab no eht tneilc 's secorp s ID.

    .03 F ro ex ,elpma eht revres nac rc e eta a FI OF htiw eht an em XXXXX.1vres/pmt/ , ehw er XXXXX si r decalpe htiw eht tneilc 's p ssecor ID.

    .13 Figu er 11.7 swohs siht a r ar ng tneme . www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 21 3

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    F erugi .11.7 vrestneilC er c omm noitacinu gnisu F IFOs

    .23 sihT arra ng tneme wo ,skr uohtla gh ti si sopmi is elb rof eht revres ot et ll rehtehw a sarc tneilc sarc h .se

    .33 sihT sesuac the tneilc -s cificep FI sOF to eb left ni eht lif e syst .me hT e vres er sla o tsum hctac SIGPI EP , is n ec it's elbissop for a ilc e tn ot dnes a tseuqer na d etanimret erofeb r idae ng eht r ,esnopse nivael g eht tneilc - ificeps c FI OF htiw eno retirw ht( e evres r) dna on r dae e .r

    .43 W hti eht arra ng tneme sh nwo ni Fig eru 11.7 , fi the res v re snepo sti w lle - nwonk FIFO daer - no ly nis( ce ti no ly r dae s morf )ti ea hc emit eht rebmun fo stneilc goes morf 1 ot ,0 eht se evr r lliw r dae an dne of lif e no ht e FI OF . oT pr tneve the se evr r fr mo gnivah ot eldnah siht c ,esa a co nomm kcirt si tsuj ot ha ev eht s vre er epo n sti w lle - nwonk FI OF rof aer d .etirw

    ISX .6.7 ISX - nepO/X etsyS m nI t re f :eca IPC

    .1 ehT rht ee ty ep s of IPC taht are dellac XSI I CP a er sem as ge qu seue , mes a ,serohp a dn omem derahs omem ry.

    itnedI f srei www.vtucs.com dna K sye

    .2 hcaE I CP erutcurts em( s egas ,eueuq s ohpame r ,e ro derahs mem ory segm )tne ni ht e r si lenrek si r e ef r der ot by a non -neg evita tni eger edi n reifit .

    Dept.of CS&E,SJBIT

    egaP 21 4

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    .3 oT dnes ro hctef a egassem ot ro morf a egassem uq ,eue rof ex ,elpma lla ew deen rof reifitnedi eht si wonk si eht reifitnedi rof eht .eueuq

    .4 ekilnU elif ,srotpircsed CPI sreifitnedi era ton llams etni g .sre I ,deedn w neh a g evi n I CP erutcurts si rc e deta a dn neht ,devomer eht reifitnedi detaicossa htiw taht rutcurts e launitnoc ly ni cre sesa nu t li ti caer h se eht mi um evitisop eulav for an i ,regetn dna sparw neht sparw a dnuor ot 0 .

    .5 ehT reifitnedi si na retni n la eman rof na I CP ejbo c .t

    .6 nitarepooC g p or c sesse n dee na ex lanret gniman emehcs ot eb elba ot r edne z suov nisu g eht emas I CP jbo ce .t

    .7 F ro siht ,esoprup na I CP tcejbo si detaicossa htiw a key taht a stc sa na e x et r lan eman .

    .8 W reveneh na I CP tcurts u er si nieb g cr detae (by ac nill g gsm g te , es mg te , ro mhs g te ,) a key tsum eb s p .deifice

    .9 ehT atad type fo siht ek y si the evitimirp sy ts em atad ty ep key t_ , hw i hc si netfo sa denifed sa a nol g tni e reg ni eht redaeh h .

    .01 sihT k ey si noc v detre ni to na reifitnedi by eht ker .len

    .11 erehT era v suoira ways rof a tneilc dna a serv re ot ner dez suov ta eht emas IPC erutcurts .

    .a ehT vres er c na cr ae et a n we I CP erutcurts by ps ce ifying a key fo I P_CP RI ETAV dna erots eht denruter di e reifitn erehwemos s( u hc sa a )elif rof eht tneilc ot .niatbo ehT tnavdasid a eg ot siht euqinhcet si taht elif sy mets snoitarepo era qer u deri of r vres eht vres er ot w etir eht ni te reg i d reifitne ot a ,elif a dn neht of r eht stneilc ot veirter e retal reifitnedi siht reifitnedi retal .

    .b ehT tneilc na d eht se vr er ac n agr ee no a key by inifed ng eht key ni a c ommo n redaeh , for ex .elpma The res ver neht rc e seta a n we I CP rts u erutc sp ice fy ni g iht s key. The rp melbo htiw siht hcaorppa si taht ti 's elbissop rof eht key ot la r ae dy be detaicossa htiw na I CP ,erutcurts ni hcihw c esa t eh teg noitcnuf (msgg te , mes g te , ro mhs g te ) snruter na .rorre The res v re tsum eldnah siht ,rorre led e nit g ht e ex nitsi g I CP ,erutcurts and t ry ot c aer te ti ag nia .

    .c ehT neilc t dna the se evr r ac n agree no a htap n ema na d jorp e tc ID ht( e rp o tcej ID si a ahc r tca er ulav e teb w nee 0 na d )552 na d llac t eh noitcnuf kotf ot noc ev tr eseht owt www.vtucs.com seulav otni a key. T sih key si neht desu ni pets .2 ehT no ly s ivre ce p dedivor by kotf si a way fo eneg r nita g a key morf a nhtap a em dna tcejorp ID

    < edulcni# < sy h.cpi/s >

    Dept.of CS&E,SJBIT

    egaP 21 5

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    key t_ otf k tsnoc( hc ar p* a ,ht tni )di ; k :snruteR k ey fi ,KO ( key )t_ -1 no rre ro

    .21 ehT htap arg tnemu tsum fer er ot na ex si t ni g .elif nO ly eht rewol 8 stib fo di era esu d nehw g ne e itar ng eht k ey.

    .31 ehT key cre deta by otf k si lausu ly rof m de by ta nik g pa str fo eht ed_ts v dna oni_ts sdleif ni eht tats utcurts re roc r idnopse ng ot eht g nevi emanhtap dna moc b nini g meht tcejorp eht htiw eht tcejorp I .D

    .41 If owt semanhtap r fe er ot owt tnereffid ,selif ht en kotf lausu ly ter u snr owt ereffid tn keys rof eht owt p .semanhta

    .51 vewoH e ,r eb c esua htob i- edon srebmun dna keys era netfo ots r de ni nol g tni ege ,sr ereht nac be noitamrofni ssol nitaerc g a key. sihT snaem taht owt tnereffid ap emanht s selif tnereffid ot tnereffid selif nac ge en etar eht as me k ey fi eht s ema tcejorp ID si desu .

    .61 ehT rht ee teg uf n snoitc ( gsm g ,te s ,tegme na d hs mg te ) lla h va e owt ralimis arg :stnemu k a k ey dna na tni eg re lf ag.

    .71 A wen I CP rts u erutc si c etaer d lamron( ly, b y a se revr ) if htie er key si IPC P_ RI TAV E ro key si ton ruc r tne ly as detaicos htiw na I CP ts r erutcu fo ht e lucitrap ar type dna eht I TAERC_CP tib fo lf ag is .deificeps

    .81 oT re ef r cne e an ex nitsi g ueuq e lamron( ly od ne by a ,)tneilc key tsum eq lau eht key taht saw deificeps hw en eht eueuq saw taerc e ,d dna I TAERC_CP m tsu ton be deificeps .

    .91 etoN taht ti 's en v re ssop i elb ot iceps fy I P_CP RIV ETA ot er f ere n ec na ex nitsi g eueuq , k laiceps siht ecnis siht laiceps k ey av l eu wla ays cre seta a n ew .eueuq

    .02 oT fer e ner ce na ex nitsi g eueuq taht saw rc e eta d htiw a key fo I P_CP RI ,ETAV we tsum wonk eht aicossa et d reifitnedi na d neht su e taht reifitnedi ni eht to eh r I CP llac s m sa hcus( sa m sg dns dna m s ,)vcrg by issap ng eht teg f u .noitcn

    .12 If we naw t ot cr tae e a wen I CP utcurts r ,e kam ing su er taht ew od n't re eref n ec an ex nitsi g eno htiw eht emas ,reifitnedi ew tsum iceps fy a lf ag iw th htob ht e I TAERC_CP dna I _CP EXCL stib .tes ioD ng siht sesuac na er ror nruter of EE XIST fi eht I CP utcurts re la r ae dy ex .stsi

    P re m noissi rutcurtS e www.vtucs.com .22 XSI I CP cossa i seta na ip mrep_c utcurts re htiw e a hc I CP tcurts u .er

    Dept.of CS&E,SJBIT

    egaP 21 6

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .32 sihT erutcurts senifed the snoissimrep dna enwo r dna sedulcni ta tsael ht e gniwollof :srebmem

    tcurts mrep_cpi { t_diu ;diu */ renwo 's ffe e evitc resu di * / g t_di g ;di */ enwo r's ffe e evitc g puor di * / t_diu ;diuc */ otaerc r s' ffe e evitc resu di * / g t_di cg ;di */ rc e ota r s' ffe e evitc g puor di * / t_edom ;edom */ cca e ss sedom /* . . . ;}

    .42 hcaE noitatnemelpmi ni c sedul lanoitidda ebmem r .s eeS no yo ru system etelpmoc eht rof eht etelpmoc d .noitinife

    .52 llA eht sdleif era ilaitini z de nehw eht I CP utcurts re si rc e .deta

    .62 Lat ,re we nac idom fy t eh diu , g di , na d edom f sdlei by illac ng msg ltc , ltcmes , or ltcmhs .

    .72 oT ahc nge eseht lav u ,se eht nillac g orp c sse tsum eb rehtie eht rotaerc fo eht IPC s erutcurt ro eht us p sure re .

    .82 nahC ging eseht sdleif si ralimis ot nillac g nwohc or domhc rof a elif .

    .92 ehT seulav ni eht edom f i dle era sa nwohs woleb .

    ts _m edo m ksa gninaeM S_I RSUR resu -r ae d S_IW RSU resu - tirw e S_I SUX R resu -ex tuce e S_I PRGR g uor p-read S_IW PRG g uor p- tirw e S_I RGX P g uor p-ex tuce e S_I TOR H rehto -read www.vtucs.comS_IW TO H rehto - tirw e S_I OX HT rehto -ex tuce e

    Dept.of CS&E,SJBIT

    egaP 21 7

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .03 B wole a er eht is x snoissimrep rof hcae mrof fo IP .C

    P re m noissi tiB resu -r ae d 0040 resu - etirw etla( )r 0020 g uor p-read 0400 g uor p- etirw ( retla ) 0 020 rehto -read 4000 rehto - etirw etla( )r 2000

    noC f noitarugi iL m sti

    .13 llA eerht smrof fo XSI IPC evah tliub - ni stimil ht at ew m ay nuocne t .re

    .23 tsoM fo eseht stimil nac eb ahc n deg by r e fnoc igur ni g eht k e .lenr

    dasiD dna segatnavdA dna dasiD v segatna

    .33 A latnemadnuf melborp htiw XSI I CP si taht eht I CP serutcurts are sy ts em ediw dna a evah ton od ton evah a r fe e ner ce c .tnuo

    .43 F ro ex ,elpma fi we rc e eta a ssem age euq u ,e lp ca e emos m sse ages no ht e ,eueuq dna ssem eht ,etanimret neht ,etanimret eht ssem age q u eue dna sti stnetnoc era ton eled t .de

    .53 hT ey niamer ni the sys et m litnu lacificeps ly re da ro deteled by os me orp c sse illac ng sm g cr v or ltcgsm , b y so enoem ex ituce ng ht e cpi rm ,dnammoc or b y ht e sys met b gnie .detoober

    .63 rehtonA melborp htiw SX I I CP si taht seht e I CP serutcurts a er ton wonk n by n ema s in eht elif sy .mets

    .73 We ac n't a c ssec meht na d idom fy rieht orp p seitre .

    .83 tsomlA a doz ne wen sys met sllac ( sm g teg , pomes , tamhs , dna os no ) erew dedda to eht troppus ot lenrek eht lenrek ot troppus eht se I CP jbo e .stc

    .93 We ac n't see eht I CP bo j stce htiw na sl nammoc d, ew can't re evom meht htiw eht mr ew dna ,dnammoc dna ew ac n't c egnah rieht p e snoissimr htiw eht domhc ammoc n .d www.vtucs.com .04 I tsn e ,da owt wen mmoc a sdn scpi )1( dna pi c mr 1( ) erew dedda .

    Dept.of CS&E,SJBIT

    egaP 21 8

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .14 ecniS eseht smrof fo IPC nod 't esu elif ,srotpircsed ew ac n't esu eht elpitlum x de I O/ ( snoitcnuf ( celes t dna llop ) htiw .meht

    .24 sihT sekam ti redrah ot esu erom naht eno fo eseht I CP serutcurts ta a emit ro ot su e any of eseht I CP utcurts r se htiw elif ro ived ce I O/ .

    .34 rehtO da v tna ag se for me egass seueuq ra e taht ht ey're bailer l ,e wolf ortnoc l ;del rocer d iro ,detne dna c na eb p or c desse ni rehto naht tsrif -i ,n tsrif - tuo .redro

    .44 ehT niwollof g apmoc r se emos fo eht f e seruta fo t h ese suoirav f o smr fo I .CP

    F ol w egasseM sepyt IPC pyt e ?sselnoitcennoC ?elbaileR sdroceR ? ?lortnoc ro seitiroirp ? euq egassem euq ues on y se y se y se y se MAERTS S on y se y se y se y se UNIX niamod on y se y se on on ekcos maerts ekcos t UNIX niamod y se y se on y se on tad ag mar cos ket FI sOF non( - on y se y se on on )SMAERTS

    eueuQ egasseM .7.7 egasseM eueuQ s

    .1 A egassem eueuq si a li dekn tsil fo assem g se derots nihtiw eht lenrek dna deifitnedi by a m sse age q u eue nedi t .reifi

    .2 We lliw llac eht gassem e eueuq tsuj a eueuq dna sti reifitnedi a euq ue ID.

    .3 A wen euq ue si rc e deta or na e x nitsi g eueuq o p ne ed by m sgg .te

    .4 weN ssem a seg a re edda d ot eht dne fo a euq ue by sm g .dns

    .5 evE ry sem as ge h sa a po evitis nol g tni e reg type f ,dlei a on n-neg vita e el n ,htg dna ht e lautca atad by set c( o err s nidnop g ot eht nel g ,)ht a ll fo hcihw era eificeps d ot sm g dns ssem eht nehw eht ssem a eg si da d de ot a .eueuq

    .6 sseM ag se a er f dehcte from a eueuq by m sg .vcr .7 We od www.vtucs.com ton evah ot ctef h eht ssem ag se ni a tsrif - ,ni tsrif - tuo .redro I sn tea ,d ew ac n ssem hctef ssem a seg desab no rieht ty ep dleif .

    .8 hcaE euq ue sah eht llof o niw g sd_diqsm erutcurts detaicossa htiw :ti

    Dept.of CS&E,SJBIT

    egaP 21 9

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    { sd_diqsm tcurts sd_diqsm { tcurts mrep_cpi sm g ;mrep_ sm g t_munq sm g ;munq_ */ # fo ssem ag se no euq ue /* sm g t_nel sm g q_ by ;set */ am x # fo by set no q eu eu /* t_dip sm g ;dipsl_ */ dip fo tsal sm g )(dns * / t_dip sm g ;diprl_ */ dip fo tsal sm g vcr () */ t_emit sm g ;emits_ */ tsal - sm g )(dns emit * / t_emit sm g ;emitr_ */ tsal - sm g cr v )( emit * / t_emit sm g ;emitc_ */ tsal - ahc nge emit * / . . . ;}

    .9 sihT erutcurts senifed the ruc r tne tats su fo eht .eueuq ehT srebmem hs o nw era eht seno denifed by eht niS g el UNIX noitacificepS . I snoitatnemelpm edulcni lanoitidda derevoc ton sdleif ton derevoc by t he dradnats .

    .01 ehT tsrif noitcnuf lamron ly dellac si gsm g te ot rehtie nepo na ex nitsi g eueuq ro rc e ta e wen a wen euq ue.

    < edulcni# < sy sm/s g. >h

    sm tni sm g k(teg ey t_ k ey, ni t )galf ; eueuq egassem :snruteR egassem eueuq ID fi ,KO 1 no e orr r

    .11 We evah la r ae dy se ne the selur for vnoc e nitr g t eh key otni na reifitnedi and essucsid d a rehtehw a n we q u eue si c detaer or na e x nitsi g uq e eu si fer e er n .dec

    .21 W neh a wen euq ue si cr ,detae eht niwollof g me srebm fo eht sd_diqsm erutcurts era laitini iz .de

    x ehT mrep_cpi utcurts re si laitini iz .de ehT edom rebmem fo siht rutcurts e si tes ot roc eht roc r nidnopse g p noissimre stib fo alf g.

    x sm g ,munq_ sm g ,dipsl_ sm g_ ,diprl sm g ,emits_ a dn sm g emitr_ a re lla tes to .0

    x sm g emitc_ si tes ot eht c tnerru emit .

    x sm g q_ by set si tes ot eht sys met .timil

    .31 nO www.vtucs.com,sseccus msgg te r snrute eht non -neg evita q eu eu I .D sihT eulav si eht n desu htiw rht rehto eht rehto rht ee ssem age q eueu snoitcnuf .

    .41 T eh ltcgsm noitcnuf rep f smro suoirav epo r snoita no a .eueuq

    Dept.of CS&E,SJBIT

    egaP 31 0

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    < edulcni# < sy sm/s g. >h

    sm tni sm g tni(ltc ,diqsm tni ,dmc tcurts sd_diqsm fub* ;) ,KO fi 0 :snruteR 0 fi ,KO -1 no e orr r

    .51 ehT dmc arg tnemu sp ce i seif eht dnammoc ot be emrofrep d no ht e ueuq e deificeps by .diqsm

    F cte h eht sd_diqsm ts r erutcu rof siht qu ,eue s nirot g ti ni the tcurts ru e I ATS_CP T ot detniop ot by fub . oC py eht iwollof ng eif l sd morf eht erutcurts p detnio ot by buf ot eht sd_diqsm erutcurts detaicossa htiw iht s :eueuq sm g .mrep_ u di , sm g mrep_ .g ,di msg ep_ r ,edom.m dna sm g q_ byte .s sihT dnammoc nac eb I TES_CP ex detuce no ly by a orp c sse esohw fe f evitce user ID qe u sla c.mrep_gsm u di ro sm g_p diu.mre or by a rp o ssec htiw repus u res livirp eg se . nO ly the resurepus nac cni r ae se eht eulav fo m sg q_ by set . evomeR eht sem as ge uq e eu orf m eht sy mets dna na y d ata llits no the euq eu . sihT lavomer si idemmi a .et Any rehto p secor s llits nisu g eht sem as ge queue lliw g te na er ror fo EID MR no sti next tpmetta ed noitarepo no eht euq u .e I R_CP MID sihT dnammoc nac eb ex detuce no ly by a p cor e ss esohw evitceffe resu DI slauqe sm g_p diuc.mre or sm g p_ e diu.mr ro by a ssecorp htiw pus e sur er elivirp g se .

    .61 ataD si decalp otno a m e egass eueuq by illac ng sm g dns .

    < edulcni# < sy sm/s g. >h

    sm tni sm g tni(dns ,diqsm tsnoc diov ,rtp* is z t_e nbyt se , tni galf ;) ,KO fi 0 :snruteR 0 fi ,KO -1 no e orr r

    .71 sA ew denoitnem ea eilr r, hcae ssem a eg si desopmoc fo a evitisop nol g i regetn type ,dleif a non -ne evitag el ng ht n( by et s ,) dna eht ca t lau atad by set ( roc r pse o nidn g ot eht nel g .)ht

    .81 sseM ag se a er la ways lp a dec ta eht dne fo eht uq e .eu

    .91 ehT rtp ra g tnemu tniop s ot a ol ng tni eger taht c sniatno eht evitisop etni ger ssem a eg ty ,ep dna ti si etaidemmi ly f dewollo by ht e ssem a eg .atad hT( e er si on m egasse ad ta i f nby set si ).0 www.vtucs.com .02 If eht al r tseg ssem age ew dnes si 215 by ,set we ac n enifed t eh iwollof ng ts r erutcu :

    Dept.of CS&E,SJBIT

    egaP 31 1

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 tcurts my em sg { nol g mty ;ep */ evitisop assem ge ty ep /* rahc etm xt[ 15 2]; */ egassem ,atad fo leng ht n by set * / ;}

    .12 ehT rtp ra gum tne si eht n a retniop ot a my em sg .erutcurts ehT ssem age type c na be desu by t he r e reviec ot fe hct ssem ag se ni na ro d re rehto naht tsrif ,ni tsrif o .tu

    .22 A lf ag lav ue fo I N_CP AWO IT nac be ficeps i de . sihT si ralimis ot eht gnikcolbnon I O/ lf ag rof elif I .O/

    .32 If eht m sse age ueuq e si ,lluf iceps fying I CP _ ON AW IT c sesua msgsnd ot ruter n etaidemmi ly htiw na e rr or fo GAE AI .N

    .42 If I ON_CP AW IT si ton ,deificeps ew a er dekcolb litnu ereht si moor rof the ,egassem eht eueuq si devomer morf eht sy ,mets ro a langis si uac g th dna eht is g lan eldnah r .snruter

    .52 In eht se dnoc ac s ,e na er ror fo EI MRD is nruter ed (" reifitnedi r evome d"); ni eht sal t eht ,esac eht rre or ruter n de si EI .RTN

    .62 etoN woh ungra lufec ly t eh lavomer fo a ssem age eueuq si .deldnah ecniS a er f ere nce tnuoc si ton eniatniam d htiw ea hc ssem a eg uq e ,eu eht lavomer of a qu eue pmis ly gen are t se e r sror no eht next eueuq noitarepo by p r sesseco llits nisu g eht q u .eue

    .72 W neh sm g dns snruter lufsseccus ly, eht sd_diqsm erutcurts aicossa ted htiw ht e egassem euq ue si tadpu ed ot etacidni eht p secor s ID taht am de eht llac ( sm g )dipsl_ , eht emit taht eht llac was edam sm( g ,)emits_ and taht eno erom egassem si no ht e m( eueuq m( sg )munq_ .

    .82 sseM ag se a er r deveirte fr mo a eueuq by m sg vcr .

    < edulcni# < sy sm/s g. >h

    iss z t_e sm g tni(vcr ,diqsm diov ,rtp* is z t_e n by set , nol g ty ,ep tni lf ag);

    is :snruteR is ze fo atad noitrop fo ssem age fi ,KO -1 no orre r

    .92 ehT rtp ra g tnemu stniop ot a ol ng tni eger hw( re e eht ssem a eg ty ep of t eh ruter n de )derots si egassem si )derots dewollof by a atad b u ff er rof t he lautca sem as ge .atad

    .03 nby set ps e seific eht is ez fo eht atad ub f .ref If t eh ruter n de ssem age si regral naht nby set www.vtucs.coma nd eht N_GSM O RORRE tib ni alf g si ,tes eht ssem age si nurt c eta d.

    .13 ehT type a rgum tne stel su iceps fy hcihw sem as ge ew tnaw .

    Dept.of CS&E,SJBIT

    egaP 31 2

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 ty ep == 0 ehT tsrif ssem age no t he eueuq si ruter n de . ty ep > 0 ehT tsrif ssem age no t he eueuq esohw m sse age ty ep slauqe ty ep si ter u enr d. ehT tsrif ssem age no the eueuq esohw m sse age ty ep si eht tsewol eulav el ss aht n ty ep < 0 etulosba eht ot lauqe ro lauqe ot eht etulosba v eula fo ty ep si ter u denr .

    .23 A non z ore type si desu ot daer eht sem as g se ni na redro rehto t h na tsrif ,ni f sri t .tuo

    .33 F ro ex ,elpma eht ty ep co dlu eb a iroirp ty eulav if eht noitacilppa ssa ig sn seitiroirp to eht .segassem rehtonA esu fo siht dleif si to noc t nia eht ssecorp ID fo eht tneilc fi a nis g el ssem a eg eueuq si nieb g desu by elpitlum stneilc dna a nis g el es r rev sa( nol g as ssecorp a ssecorp ID stif ni a ol ng tni ege )r .

    .43 We nac iceps fy a f al g eulav fo I _CP NO AW IT ot ekam eht noitarepo no nikcolbn g, gnisuac msg cr v ot ruter n -1 htiw e onrr s te ot EN GSMO fi a m sse age fo t eh ficeps ied ty ep si ton baliava l .e

    .53 If I _CP NO AW IT is ton ,deificeps eht epo r noita skcolb litnu a egassem fo ht e deificeps type si baliava l ,e eht qu ue e si r devome f mor eht sy mets (-1 is er t denru tiw h onrre tes ot EI ,)MRD or a is gn la si ac ug th dna eht is g lan h reldna ruter ns isuac( ng sm g vcr ot nruter 1 htiw e onrr tes ot EI )RTN .

    .63 W neh sm g vcr ccus e ,sde eht lenrek setadpu eht sd_diqsm erutcurts detaicossa htiw eht egassem qu eue ot idni ac et eht c ella r's p or c sse DI m( sg ,)diprl_ ht e emit fo ht e lac l sm( g ,)emitr_ dna taht o ne ssel ssem age si no eht q eueu m( sg )munq_ .

    eS .8.7 eS m hpa or se

    .1 A ohpames re si ton a of rm fo I .CP A s ohpame re is a nuoc t re u s de ot p edivor a secc s ot derahs a derahs d ata jbo e tc rof elpitlum sessecorp .

    .2 oT niatbo a derahs uoser r ,ec a rp o ssec n e sde ot od eht niwollof g:

    .a ) tseT eht ohpames re taht c slortno eht ser ruo ce.

    ).b If eht v eula of eht s ame p eroh si ,evitisop ht e orp c sse ac n esu ht e r ruose ce. In siht esac , eht rp o ssec dec er m stne eht es m rohpa e ulav e by ,1 idni c gnita taht ti h sa esu d uoser eht fo tinu eno tinu fo eht uoser r ec .

    .c ) ,esiwrehtO fi eht eulav fo eht erohpames si ,0 eht rp sseco go se ot peels litnu ht e erohpames v eula si rg e reta naht .0 W neh eht rp co sse sekaw ,pu ti ter u snr ot pets .1 www.vtucs.com .3 W neh a orp c sse si enod htiw a erahs d oser u cr e taht si dellortnoc by a sem ,erohpa ht e erohpames eulav si rcni e detnem by .1 If any to h re secorp s se era ,peelsa nitiaw g of r t ,erohpames eht ,erohpames t hey a re a denekaw .

    Dept.of CS&E,SJBIT

    egaP 31 3

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .4 oT tnemelpmi hpames o ser co rr e tc ly, eht tset fo a s ohpame er 's lav ue na d ht e erced m nitne g of siht av l eu tsum eb na cimota op .noitare For siht re ,nosa serohpames ron era ron m la ly tnemelpmi ed edisni eht lenrek .

    .5 A nommoc mrof of se erohpam si c della a ib nary hpames o .er It tnoc r slo a nis gle ruoser c ,e dna sti eulav si laitini iz de ot .1

    .6 In gen lare , ewoh v ,re a s rohpame e c na be ilaitini z de ot any vitisop e lav u ,e htiw ht e itacidni eulav itacidni ng woh m na y stinu fo ht e hs a der res ecruo a er elbaliava f or s h nira g.

    .7 XSI hpames o ser a ,er u etanutrofn ly, erom oc m detacilp naht .siht rhT ee utaef r se cennu siht ot etubirtnoc ot siht cennu e ass ry noitacilpmoc .

    .a ) A erohpames si ton mis ply a nis g el on n-neg evita .eulav I ,daetsn ew h eva ot nifed e a es ohpam re sa a tes of eno ro om re pames h ero .seulav W neh we c etaer a ,erohpames we ps e ic fy eht rebmun fo v seula ni ht e .tes

    ).b ehT cr noitae fo a ames p eroh es( m )teg si epedni n tned fo sti ilaitini z noita ( )ltcmes . sihT si a f lata ,walf nis ce we c tonna lacimota ly aerc te a en w hpames ore tes na d laitini ize lla eht seulav ni eht .tes

    .c ) ecniS lla smrof fo XSI CPI niamer ni ex ecnetsi neve nehw on orp c sse si nisu g ,meht ew vah e ot row ry tuoba a rp ogr ma taht setanimret tuohtiw ler eas ni g ht e serohpames ti sah been detacolla . ehT odnu fe eruta taht ew d ebircse l reta si .siht eldnah ot desoppus ot eldnah .siht

    .8 ehT rek n le sniatniam a s e sd_dim erutcurts rof e ca h erohpames tes :

    { sd_dimes tcurts sd_dimes { tcurts mrep_cpi ;mrep_mes isnu g den trohs ;smesn_mes */ # fo serohpames ni tes /* t_emit ;emito_mes */ tsal - )(pomes emit /* t_emit ;emitc_mes */ tsal - ahc nge emit * / . . . ;}

    .9 ehT niS g el UNIX cepS i noitacif senifed eht fi sdle ,nwohs tub nemelpmi t snoita ac n bmem lanoitidda enifed lanoitidda bmem e sr ni ht e sd_dimes erutcurts .

    .01 hcaE hpames o er si r pe r detnese by na ona nymo su erutcurts iniatnoc ng ta tsael eht www.vtucs.comniwollof g bmem e :sr

    { tcurts {

    Dept.of CS&E,SJBIT

    egaP 31 4

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 isnu g den trohs ;lavmes */ erohpames lav u ,e wla ays >= /* 0 /* t_dip ;dipmes */ dip rof tsal arepo noit */ isnu g den trohs ;tncnmes */ # sessecorp a nitiaw g ruc>lavmes v la /* isnu g den trohs mes z ;tnc */ # sessecorp a nitiaw g s 0==lavme * / . . . ;}

    .11 ehT elbat woleb stsil eht s y mets stimil taht tceffa s erohpame s .ste

    eulav lacipyT eulav s rcseD noitpi Fr DSBee xuniL caM SO X siraloS 1.2.5 22.4.2 3.01 9 am ehT am x mumi eulav fo a ny ames p roh e 767,23 767,23 767,23 767,23 am ehT am x mumi eulav fo a ny 483,61 767,23 483,61 483,61 rohpames e's tsujda - no -ex ti eulav am ehT am x mumi rebmun fo ohpames er 01 821 183,78 01 ,stes sy diwmets e am ehT am x mumi rebmun fo ,serohpames 06 000,23 183,78 06 sy diwmets e am ehT am x mumi rebmun fo serohpames 06 052 183,78 52 ohpames rep ohpames re es t am ehT am x mumi rebmun fo odnu 03 000,23 183,78 03 ,serutcurts sy diwmets e am ehT am x mumi rebmun fo odnu seirtne 01 23 01 01 utcurts odnu rep odnu utcurts res am ehT am x mumi rebmun fo snoitarepo 001 23 001 01 pomes rep pomes c lla

    .21 ehT tsrif noitcnuf ot llac si mes g te ot niatbo a es m erohpa I .D

    < edulcni# < sy h.mes/s >

    mes tni www.vtucs.commes g (te key t_ k ey, tni ,smesn tni alf g); nruteR :s erohpames ID i f ,KO -1 no e r or r

    Dept.of CS&E,SJBIT

    egaP 31 5

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 .31 We evah la r ae dy se ne the selur for vnoc e nitr g t eh key otni na reifitnedi and essucsid d a rehtehw a n we tes si c er a det ro na e x nitsi g tes si r e eref n .dec

    .41 W neh a en w tes si rc ae ,det eht iwollof ng em m sreb of eht sd_dimes str erutcu are laitini iz .de

    x ehT mrep_cpi utcurts re si laitini iz .de ehT edom rebmem fo siht rutcurts e si tes ot roc eht roc r nidnopse g p noissimre stib fo alf g.

    x emito_mes si tes ot 0 .

    x emitc_mes si tes ot eht tnerruc emit .

    x smesn_mes si tes ot .smesn

    .51 ehT rebmun o f s ohpame r se ni eht tes si .smesn

    .61 If a wen tes si nieb g rc e deta (typi lac ly ni eht es r ,)rev ew tsum iceps fy ns .sme If ew era r fe e er n nic g na e x itsi gn tes (a ,)tneilc we c na s p ice fy smesn sa 0 .

    .71 ehT ltcmes noitcnuf si eht ctac h lla rof v a suoir s e erohpam po er .snoita

    < edulcni# < sy h.mes/s >

    tni ,dimes tni(ltcmes tni tni(ltcmes ,dimes tni s ,munme tni ,dmc ... */ noinu numes a rg ;)/*

    .81 ehT htruof arg tnemu is ,lanoitpo idneped ng on eht dnammoc r seuqe t ,de dna fi fo si ,tneserp si fo ty ep numes , a noinu fo suoirav oc m dnam - cificeps arg tnemu s:

    u noin numes { tni ;lav */ rof VTES AL * / tcurts sd_dimes ;fub* */ rof I TATS_CP dna IP TES_C * / isnu g den trohs rra* ay; */ rof TEG ALL dna TES A LL * / ;}

    .91 etoN taht eht lanoitpo a r tnemug si eht lautca ,noinu ton a retniop ot eht .noinu

    .02 ehT dmc arg tnemu ceps i seif eno fo eht gniwollof net sdnammoc ot eb demrofrep no deificeps tes eht tes deificeps by s .dime

    .12 ehT evif sdnammoc ht at refer ot eno pa alucitr r erohpames eulav use munmes ot iceps fy eno bmem er fo eht .tes ehT eulav fo es munm si neewteb 0 na d smesn -1, www.vtucs.com.evisulcni

    F hcte eht sd_dimes erutcurts rof siht ,tes nirots g ti ni eht erutcurts detniop ot I ATS_CP T by ra g fub. .

    Dept.of CS&E,SJBIT

    egaP 31 6

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 F hcte eht sd_dimes erutcurts rof siht ,tes nirots g ti ni eht erutcurts detniop ot I ATS_CP T by ra g fub. . teS eht ,diu.mrep_mes s mrep_me .g ,di dna edom.mrep_mes sdleif morf eht erutcurts detniop ot by arg fub. ni the sd_dimes ts r erutcu ssa o detaic htiw ht is I TES_CP .tes sihT dnammoc nac be ex detuce no ly by a rp o ssec esohw e ff e evitc su er ID slauqe uc.mrep_mes id ro diu.mrep_mes ro by a orp c sse htiw esurepus r elivirp g se . evomeR eht s rohpame e tes morf ht e sy .mets Th si mer lavo si taidemmi e. Any hto er orp c sse llits nisu g eht hpames o er lliw g te na er ror fo EI MRD on I R_CP MID sti txen detpmetta noitarepo no eht rohpames e. sihT dnammoc nac eb ex detuce no ly by a rp co sse esohw fe f evitce su re ID slauqe c.mrep_mes uid ro diu.mrep_mes ro diu.mrep_mes ro by a ssecorp htiw urepus s re p r elivi g se . VTEG AL nruteR eht eulav fo s lavme rof eht bmem er nmes u .m teS eht eulav fo lavmes rof eht rebmem .munmes ehT eulav si deificeps by VTES AL arg lav. . TEG PID nruteR eht eulav fo s dipme rof eht rebmem s .munme NCNTEG T nruteR eht eulav fo s tncnme rof eht bmem er mes n .mu TEG ZC TN nruteR eht eulav fo s me z tnc rof eht bmem er mes n .mu F hcte lla eht rohpames e seulav ni eht .tes ehT se seulav are derots ni t eh TEG A LL rra ay detniop ot by arg. ra ray. TES ALL teS lla eht erohpames v seula i n eht tes ot eht ulav es detniop ot by a rg. ra ray.

    .22 F ro lla eht G TE co sdnamm rehto naht G TE ALL, eht uf n noitc snruter ht e idnopserroc ng v .eula F ro eht iniamer ng nammoc d ,s eht nruter eulav si 0 .

    .32 ehT noitcnuf pomes ta o lacim ly p e smrofr na ra ar y fo o p snoitare o n a s erohpame tes .

    < edulcni# < sy h.mes/s >

    rts ,dimes tni(pomes tni tni(pomes ,dimes rts u tc fubmes apomes rray ][ ,siz t_e )spon ;

    ,KO fi 0 :snruteR 0 fi ,KO -1 no e orr r

    .42 ehT rrapomes ay ra g tnemu si a iop n ret ot an rra ay of erohpames snoitarepo , erper s detne by fubmes st serutcur :

    www.vtucs.comtcurts bmes fu { isnu g den trohs ;mun_mes */ rebmem # ni tes ,0( ,1 ,... smesn - )1 /* trohs ;po_mes */ noitarepo n( e ,evitag 0 , ro )evitisop /*

    Dept.of CS&E,SJBIT

    egaP 31 7

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 trohs lf_mes g; */ I ON_CP AW I ,T DNU_MES O /* ;}

    .52 ehT spon arg tnemu ps eci seif eht rebmun o f o p are t snoi )stnemele( ni eht a arr y.

    .62 ehT epo r noita no ea hc rebmem fo ht e tes si ps e deific by eht roc r nopse d ni g po_mes .eulav

    .72 sihT eulav nac be n eg ita v ,e ,0 ro .evitisop

    .a ) ehT tseisae c esa si nehw po_mes si evitisop . sihT esac roc r dnopse s ot eht inruter ng fo uoser r sec by ht e orp c .sse hT e va eul fo po_mes si edda d ot ht e rohpames e's .eulav If the odnu alf g si deificeps , po_mes si sla o detcartbus morf rohpames eht rohpames e's tnemtsujda eulav rof siht orp c .sse

    ).b If po_mes si n eg ,evita we tnaw ot niatbo uoser rces taht eht erohpames .slortnoc If the rohpames e's lav ue si gre reta naht ro lauqe to eht etulosba eulav fo po_mes eht( r ruose c se a er liava a ,)elb ht e etulosba v eula fo po_mes si tbus r etca d morf ht e rohpames e's v .eula sihT gua tnar e se taht eht r nitluse g eulav rof ht e s ame p eroh si gr tae er naht ro lauqe to .0 If eht odnu lf ag si ,deificeps eht etulosba v eula fo po_mes si osla dedda ot eht ohpames er 's mtsujda e tn eulav rof siht orp c .sse

    If eht hpames ore's lav eu si ssel naht eht etulosba eulav fo po_mes t( he re ecruos s ra e ton a v ,)elbalia eht niwollof g snoitidnoc ppa ly.

    .a If I ON_CP AW IT si eps c ,deifi pomes snruter tiw h na rre or fo EAGAIN. .b If I ON_CP AW IT si ton ,deificeps eht s tncnme av l eu rof siht hpames o er is detnemercni ecnis( eht rellac si tuoba ot go to ,)peels dna eht ac ill ng tnu dednepsus si ssecorp si dednepsus tnu il eno fo eht iwollof ng o c sruc . .i ehT ohpames er 's ulav e semoceb gre reta aht n ro lauqe ot eht etulosba eulav of mes _ po ,.e.i( emos hto er rp o ssec sah ler e esa d emos ruoser c .)se ehT v eula fo tncnmes for siht erohpames is erced m detne nis( ce eht nillac g p ssecor si od ne nitiaw g ,) dna ht e etulosba eulav fo po_mes si detcartbus morf eht se rohpam e's eulav . If eht odnu f al g si iceps f ,dei eht etulosba ulav e of po_mes si osla hpames eht ot dedda ot eht hpames ore's tnemtsujda eulav rof iht s ssecorp . .ii ehT mes ohpa re si devomer morf eht syst .me In siht ,esac ht e na snruter noitcnuf snruter na rre or fo EI MRD . iii . A is gn la si ac ug th by t eh orp c ,sse na d eht sig an l h reldna .snruter In siht ,esac eht v eula fo es tncnm rof siht ohpames re si ced r etneme d ecnis( eht nillac g rp o ec ss si no nol g re itiaw ng ,) dna eht noitcnuf www.vtucs.comsnruter na e rorr of EINTR.

    .c ) If o_mes p si ,0 siht m snae taht the c gnilla pr sseco w stna ot w tia un lit ht e rohpames e's v eula oceb m se .0

    Dept.of CS&E,SJBIT

    egaP 31 8

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 If eht hpames ore's eulav is tnerruc ly ,0 eht uf n noitc snruter etaidemmi ly. If eht pames hore's eulav is non z ,ore eht niwollof g snoitidnoc ppa ly.

    .a If I ON_CP AW IT si eps c ,deifi nruter si edam htiw na rre or fo EAGAIN. .b If I ON_CP AW IT si ton ,deificeps eht mes z tnc eulav rof siht erohpames is detnemercni ecnis( eht rellac si tuoba ot go to ,)peels na d eht illac ng tnu dednepsus si ssecorp si dednepsus tnu il eno fo eht iwollof ng o c sruc . .i ehT ohpames er 's eulav b semoce .0 ehT lav ue fo mes z tnc rof iht s erohpames si de emerc n det ecnis( eht c nilla g ssecorp si nod e nitiaw g). .ii ehT ohpames re si devomer morf eht syst .me In siht sac ,e ht e na snruter noitcnuf snruter na rre or fo EI MRD . iii . A is gn la si ac ug th by t eh orp c ,sse na d eht sig an l h reldna .snruter In siht ,esac eht eulav fo mes z tnc rof siht ohpames re si tnemerced de ecnis( eht nillac g rp o ec ss si on nol g re itiaw ng ,) dna eht noitcnuf na snruter na e rorr of EINTR.

    .82 ehT pomes uf n noitc epo r seta lacimota ly; ti seod e rehti lla eht op snoitare in eht array meht fo enon ro enon fo meht . eS m erohpa sujdA tm ne t no tixe

    .92 It si a melborp fi a rp o ssec setanimret elihw ti sah uoser r sec etacolla d uorht gh a .erohpames

    .03 W eveneh r ew ceps ify t eh ODNU_MES lf ag f ro a erohpames epo r noita dna ew etacolla r ruose c se a( se po_m eulav ssel naht 0), eht lenrek r srebmeme woh am ny ruoser c se ew detacolla rf mo taht ralucitrap ames p eroh eht( etulosba eulav fo po_mes .)

    .13 W neh eht orp c sse mret i tan ,se ehtie r iratnulov ly ro iratnulovni ly, the ek r len hc e skc eht rehtehw eht p or c sse sah na y idnatstuo ng hpames ro e stnemtsujda ,dna fi ,os seilppa eht serroc eht ot tnemtsujda ot eht serroc p nidno g hpames o er .

    .23 If ew tes eht eulav fo a erohpames isu ng ltcmes , htiw rehtie eht ES VT AL ro TES A LL mtsujda eht ,sdnammoc eht mtsujda e tn eulav rof taht hpames o er ni lla orp c sesse si tes ot .0

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 31 9

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 TINU - 8 WTEN ORK PI :C S O TEKC S

    coS k te pircseD to sr

    o A tekcos si na tcartsba i no o f a moc m noitacinu tniopdne . o oT aerc te a tekcos we c na m eka a llac eht f ollo w gni fu noitcn .

    o ehT tekcos c omm acinu t noi od m snia

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 41 0

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 nisserddA g • etyB gniredrO

    • etyB redro f ro t tse talp forms

    tcnuF i sno to c no vert eb twe ne en twork b ety redro & rP o ec ss ro b y et redro

    www.vtucs.com

    erddA ss roF m ta s

    Dept.of CS&E,SJBIT

    egaP 41 1

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    • tcurts ddakcos r { imaf_as ly t_ as _ imaf ly; */ sserdda imaf ly /* rahc _as d ata ][ ; */ elbairav - el ng ht dda r sse /* . . . ;}

    • tcurts ddakcos r { imaf_as ly t_ as _ imaf ly; */ sserdda imaf ly /* rahc _as d ata [ 41 ]; */ elbairav - el ng ht rdda e ss /* ;} dda_ni tcurts dda_ni r { t_rdda_ni ;rdda_s */ I 4vP dda r sse /* ;}

    tcurts i_rddakcos n { imaf_as ly t_ _nis f ima ly; */ sserdda imaf ly /* t_trop_ni ;trop_nis */ trop rebmun /* tcurts rdda_ni ;rdda_nis */ I 4vP dda r sse /* ;}

    dda_6ni tcurts dda_6ni r { t_8tniu rdda_6s [ ;]61 */ I 6vP dda r sse /* };

    ni_rddakcos tcurts ni_rddakcos 6 { imaf_as ly t_ _6nis f ima ly; */ sserdda imaf ly * / t_trop_ni ;trop_6nis */ trop rebmun /* t_23tniu iwolf_6nis n ;of */ ciffart ssalc dna f l wo ofni /* tcurts rdda_6ni dda_6nis r; */ I 6vP dda r sse /* t_23tniu ;di_epocs_6nis */ tes fo afretni c se rof epocs * / ;}

    www.vtucs.com

    p oT p rint t eh da erd ss in uH m na u n ed rsta dn ba le rof m

    Dept.of CS&E,SJBIT

    egaP 41 2

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    sserddA L ukoo p

    • ehT stsoh nwonk by a gi nev retupmoc sy mets

    tnetsoh tcurts tnetsoh { rahc _h* n ;ema */ eman fo tsoh /* rahc h** _ ;sesaila */ retniop ot etanretla tsoh eman a rray * / tni rdda_h ty ;ep */ sserdda ty ep * / tni nel_h g ;ht */ nel g ht ni by set fo a sserdd /* rahc h** _ ;tsil_rdda */ retniop ot rra ay of ten w kro serdda s se /* . . . ;} www.vtucs.com

    ten work an m se a nd num sreb iw th a sim ali r tes fo ni afret c se

    Dept.of CS&E,SJBIT

    egaP 41 3

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    tneten tcurts tneten { rahc _n* n ;ema */ krowten eman * / rahc n** _ ;sesaila */ etanretla n krowte an em rra ay tniop er /* tni rdda_n ty ;ep / * sserdda ty ep * / t_23tniu ;ten_n / * krowten rebmun * / ;} oT m pa wteb e ne p or ot oc l an m se a nd num eb rs

    www.vtucs.com

    tneotorp tcurts tneotorp {

    Dept.of CS&E,SJBIT

    egaP 41 4

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 rahc _p* n ;ema */ locotorp eman * / rahc p** _ ;sesaila */ retniop ot etanretla p locotor eman a rray * / tni ;otorp_p */ locotorp rebmun /* . . . ;}

    paM oT paM be neewt Service an me ot port un m reb dna v eci ev rsa

    tnevres tcurts tnevres { rahc an_s* m ;e */ ecivres n ema * / rahc aila_s** s ;se */ retniop ot etanretla s ivre ce eman a rr ay * / tni ;trop_s */ trop rebmun * / rahc ;otorp_s* */ eman fo locotorp * / . . . ;} oT m pa orf m a oh st name dna a es r iv ce n ma e ot na da rd e ss na d eciv ev r as

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 41 5

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26

    ofnirdda tcurts ofnirdda { tni alf_ia g ;s */ imotsuc ze roivaheb /* tni imaf_ia ly; */ sserdda imaf ly * / tni kcos_ia ty ;ep */ tekcos type /* tni ;locotorp_ia */ locotorp * / t_nelkcos da_ia d ;nelr */ nel g ht ni by et s fo sserdda * / tcurts rddakcos * _ia a ;rdd */ sserdda * / rahc * nac_ia o ;emann */ inonac c la n a em fo tsoh /* tcurts ofnirdda _ia* nex ;t */ n ext ni l tsi * / . ;} lF a sg f ro dda r ni fo s t rutcur e

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 41 6

    GNIMMARGORP METSYS XINU METSYS GNIMMARGORP SC01 26 oT aH n eld the re r ro eM ssa eg s

    h.bdten< edulcni# h.bdten< > tsnoc rahc * rrerts_iag o tni(r rre o )r ;

    oT c no v stre na da d er ss ni to a oh ts an me dna a es vr eci n ema

    ssA o ic ita ng rddA e ss es w hti S co k ste

    www.vtucs.com

    Dept.of CS&E,SJBIT

    egaP 41 7