⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipe.2

📁 操作系统设计与实现源码
💻 2
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:05:49 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def    [psize 0 cheight slant sin slant cos div mul cheight 0 0]    makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig {	/SavedState save def	userdict maxlength dict begin	currentpoint transform	DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap		setlinewidth setmatrix	itransform moveto	/ury exch def	/urx exch def	/lly exch def	/llx exch def	/y exch 72 mul resolution div def	/x exch 72 mul resolution div def		currentpoint /cy exch def /cx exch def	/sx x urx llx sub div def	/sy y ury lly sub div def	sx sy scale	cx sx div llx sub	cy sy div ury sub translate		/DefFigCTM matrix currentmatrix def	/initmatrix {		DefFigCTM setmatrix	} def	/defaultmatrix {		DefFigCTM exch copy	} def	/initgraphics {		DocumentInitState setmiterlimit setgray setdash 			setlinejoin setlinecap setlinewidth setmatrix		DefFigCTM setmatrix	} def	/showpage {		initgraphics	} def}bind  def/clipFig {	currentpoint 6 2 roll	newpath 4 copy	4 2 roll moveto	6 -1 roll exch lineto	exch lineto	exch lineto	closepath clip	newpath	moveto}bind  def/doclip { llx lly urx ury clipFig } def/endFig {	end SavedState restore}bind  def/globalstart {	fontnum psize slant height resolution currentpoint 	pagesave restore gsave }bind  def/globalend {	grestore moveto	/resolution exch def /height exch def	/slant exch def /psize exch def /fontnum exch def	F	/pagesave save def}bind  def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne   { exch newdict 3 1 roll put }   { pop pop } % Ignore FID   ifelse} forallnewdict begin/Encoding  tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval  cvn load  def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(PIPE)S936(\()S978(2)S1036(\))S2696(Eighth)S(Edition)296 2989 A4911(PIPE)S5127(\()S5169(2)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(pipe)S10 R-11278(-)S10 R1360(create)S1627(an)S1747(interprocess)S2259(communication)S2909(channel)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(#include)S1482(<unistd.h>)S1608 V1080(int)S1236(pipe\(int)S10 I1611(\256ldes)S10 B1823([2]\))S1776 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S1896 V10 R1080(The)S10 B1263(pipe)S10 R1474(system)S1779(call)S1951(creates)S2258(an)S2379(I/O)S2541(mechanism)S3026(called)S3294(a)S3366(pipe.)S3616(The)S3800(\256le)S3956(descriptors)S4425(returned)S4788(can)S4955(be)S5077(used)S2016 V1080(in)S1188(read)S1392(and)S1566(write)S1803(operations.)S2301(When)S2570(the)S2722(pipe)S2924(is)S(written)286 3020 A3335(using)S3581(the)S3733(descriptor)S10 I4165(\256ldes)S10 R4385([1])S4532(up)S4661(to)S4768(PIPE_MAX)S2136 V1080(bytes)S1317(of)S1426(data)S1620(are)S1770(buffered)S2138(before)S2422(the)S(writing)291 2571 A2888(process)S3216(is)S3309(suspended.)S3803(A)S3902(read)S4102(using)S4345(the)S4494(descriptor)S10 I4923(\256ldes)S10 R5143([0])S2256 V(will)157 1080 A1262(pick)S1460(up)S1585(the)S1733(data.)S2424 V1080(PIPE_MAX)S1598(equals)S(7168)200 1880 A(under)229 2105 A2359(Minix,)S2654(but)S2807(note)S3005(that)S3181(most)S3401(systems)S3744(use)S(4096.)225 3903 A2592 V1080(It)S1167(is)S1259(assumed)S1630(that)S1806(after)S2017(the)S2165(pipe)S2363(has)S2522(been)S2737(set)S2874(up,)S3025(two)S3202(\(or)S3346(more\))S(cooperating)475 3613 A4114(processes)S4526(\(created)S4878(by)S5004(subse-)S2712 V1080(quent)S10 B1328(fork)S10 R1538(calls\))S(will)157 1782 A1964(pass)S2162(data)S(through)312 2355 A2692(the)S2840(pipe)S3038(with)S10 B3242(read)S10 R3463(and)S10 B3633(write)S10 R3883(calls.)S2880 V1080(The)S1262(shell)S1477(has)S1636(a)S1706(syntax)S1993(to)S2096(set)S2233(up)S2358(a)S2428(linear)S2683(array)S2916(of)S3025(processes)S(connected)408 3436 A3869(by)S3994(pipes.)S3048 V1080(Read)S1324(calls)S1546(on)S1683(an)S1815(empty)S2103(pipe)S2313(\(no)S2485(buffered)S2865(data\))S3105(with)S3322(only)S3538(one)S3721(end)S3904(\(all)S4077(write)S4323(\256le)S4490(descriptors)S4970(closed\))S3168 V1080(returns)S1385(an)S1505(end-of-\256le.)S3336 V1080(The)S1262(signal)S1527(SIGPIPE)S1923(is)S2015(generated)S2432(if)S2519(a)S2589(write)S2822(on)S2947(a)S3017(pipe)S3215(with)S3419(only)S3622(one)S3792(end)S3962(is)S4054(attempted.)S3504 V9 R720(R)S722(RE)S784(ET)S842(TU)S900(UR)S968(RN)S1030(N)S1121(V)S1123(VA)S1191(AL)S1259(LU)S1317(UE)S1385(E)S3624 V10 R1080(The)S1262(function)S1622(value)S1865(zero)S2064(is)S2156(returned)S2517(if)S2604(the)S2752(pipe)S2950(was)S3132(created;)S10 R-13477(-)S10 R3534(1)S3609(if)S3696(an)S3816(error)S4038(occurred.)S3792 V9 R720(E)S722(ER)S780(RR)S842(RO)S904(OR)S972(RS)S1034(S)S3912 V10 R1080(The)S10 B1262(pipe)S10 R1472(call)S(will)157 1643 A1825(fail)S1985(if:)S4080 V1080([EMFILE])S1830(Too)S2017(many)S2265(descriptors)S2732(are)S2881(active.)S4248 V1080([ENFILE])S1830(The)S2012(system)S2316(\256le)S2470(table)S2691(is)S2783(full.)S4416 V1080([ENOSPC])S1830(The)S2012(pipe)S2210(\256le)S2364(system)S2668(\(usually)S3017(the)S3165(root)S3352(\256le)S3506(system\))S3844(has)S4003(no)S4128(free)S(inodes.)287 4311 A4584 V1080([EFAULT])S1830(The)S10 I2012(\256ldes)S10 R2249(buffer)S2521(is)S2613(in)S2716(an)S2836(invalid)S3140(area)S3334(of)S3443(the)S3591(process's)S3991(address)S(space.)249 4318 A4752 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S4872 V10 B1080(sh)S10 R1175(\(1\),)S10 B1343(read)S10 R1539(\(2\),)S10 B1707(write)S10 R1932(\(2\),)S10 B2100(fork)S10 R2285(\(2\).)S5040 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S5160 V10 R1080(Writes)S1374(may)S1572(return)S1838(ENOSPC)S2250(errors)S2511(if)S2598(no)S2723(pipe)S2921(data)S3114(can)S3279(be)S3399(buffered,)S(because)319 3791 A4135(the)S4283(pipe)S4481(\256le)S4635(system)S4939(is)S5031(full.)S5328 V9 R720(B)S722(BU)S784(UG)S852(GS)S920(S)S5448 V10 R(Should)284 1080 A1390(more)S1623(than)S1822(PIPE_MAX)S2341(bytes)S2579(be)S(necessary)392 2700 A3118(in)S3222(any)S3393(pipe)S(among)273 3592 A3891(a)S(loop)178 3962 A4166(of)S4276(processes,)S4714(deadlock)S(will)157 5104 A5568 V1080(occur.)S7903 V720(Page)S941(1)S2616(\()S(August)290 2658 A2973(26,)S(1985)200 3123 A3331(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -