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

📄 dup.2

📁 操作系统设计与实现源码
💻 2
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:05:38 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(DUP)S930(\()S972(2)S1030(\))S2696(Eighth)S(Edition)296 2989 A4917(DUP)S5127(\()S5169(2)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R(dup,)175 1080 A(dup2)200 1280 A10 R-11505(-)S10 R(duplicate)369 1587 A1981(a)S2051(descriptor)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)S(dup\(int)320 1236 A10 I1594(oldd)S10 B1772(\))S1728 V1080(int)S(dup2\(int)370 1236 A10 I1644(oldd)S10 B1822(,)S1885(int)S10 I2041(newd)S10 B2253(\))S1896 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)S2016 V10 B1080(Dup)S10 R(duplicates)408 1294 A1731(an)S1856(existing)S2204(descriptor.)S2687(The)S2874(argument)S10 I3284(oldd)S10 R3492(is)S3589(a)S3664(small)S(non-negative)525 3912 A4467(integer)S4777(index)S5030(in)S5138(the)S2136 V1080(per-process)S1573(descriptor)S2004(table.)S2278(The)S2463(value)S2709(must)S2932(be)S3055(less)S3234(than)S3435(OPEN_MAX,)S4037(the)S4188(size)S4373(of)S4485(the)S4636(table.)S4909(The)S5093(new)S2256 V1080(descriptor)S1530(returned)S1913(by)S2060(the)S2230(call,)S2448(let's)S2669(name)S2934(it)S10 I3037(newd,)S10 R3321(is)S3436(the)S3607(lowest)S3918(numbered)S4368(descriptor)S4819(that)S5018(is)S5133(not)S2376 V1080(currently)S1469(in)S1572(use)S1731(by)S1856(the)S2004(process.)S2544 V1080(The)S1263(object)S1535(referenced)S1988(by)S2114(the)S2263(descriptor)S2692(does)S2902(not)S(distinguish)440 3056 A3522(between)S3884(references)S4326(using)S10 I4569(oldd)S10 R4773(and)S10 I4944(newd)S10 R5183(in)S2664 V1080(any)S1251(way.)S1495(Thus)S1722(if)S10 I1810(newd)S10 R2048(and)S10 I2219(oldd)S10 R2422(are)S(duplicate)369 2571 A2965(references)S3406(to)S3509(an)S3629(open)S3849(\256le,)S10 B4028(read)S10 R4224(\(2\),)S10 B4392(write)S10 R4617(\(2\))S4760(and)S10 B4930(lseek)S10 R5143(\(2\))S2784 V1080(calls)S1295(all)S1426(move)S1679(a)S1754(single)S2024(pointer)S2339(into)S2525(the)S2678(\256le,)S2862(and)S3037(append)S3357(mode,)S(non-blocking)535 3635 A4201(I/O)S4367(and)S(asynchronous)552 4543 A5126(I/O)S2904 V1080(options)S1417(are)S1583(shared)S1888(between)S2266(the)S2431(references.)S2938(If)S3047(a)S3133(separate)S3505(pointer)S3831(into)S4028(the)S4192(\256le)S4362(is)S4470(desired,)S4827(a)S4913(different)S3024 V1080(object)S1357(reference)S1765(to)S1874(the)S2028(\256le)S2188(must)S2414(be)S2540(obtained)S2918(by)S3050(issuing)S3366(an)S(additional)402 3493 A10 B3927(open)S10 R4134(\(2\))S4284(call.)S4512(The)S4701(close-on-exec)S3144 V1080(\257ag)S1256(on)S1381(the)S1529(new)S1722(\256le)S1876(descriptor)S2304(is)S2396(unset.)S3312 V1080(In)S1189(the)S(second)279 1337 A1641(form)S1862(of)S1971(the)S2119(call,)S2315(the)S2463(value)S2706(of)S10 I2815(newd)S10 R3052(desired)S3368(is)S3460(speci\256ed.)S3893(If)S3986(this)S4156(descriptor)S4584(is)S4676(already)S4998(in)S5102(use,)S3432 V1080(the)S1229(descriptor)S1658(is)S1751(\256rst)S1934(deallocated)S2419(as)S2529(if)S2617(a)S10 B2688(close)S10 R2895(\(2\))S3039(call)S3211(had)S3382(been)S(done)195 3598 A3819(\256rst.)S10 I4052(Newd)S10 R4307(is)S4400(not)S4554(closed)S4836(if)S4923(it)S5004(equals)S3552 V10 I1080(oldd)S10 R1266(.)S3720 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)S3840 V10 R1080(The)S1275(value)S10 R-11531(-)S10 R1588(1)S1676(is)S1781(returned)S2155(if)S2255(an)S2388(error)S2623(occurs)S2924(in)S3040(either)S3308(call.)S3542(The)S3737(external)S4100(variable)S10 B(errno)241 4463 A10 R4742(indicates)S5138(the)S3960 V1080(cause)S1329(of)S1438(the)S1586(error.)S4128 V9 R720(E)S722(ER)S780(RR)S842(RO)S904(OR)S972(RS)S1034(S)S4248 V10 B1080(Dup)S10 R1290(and)S10 B(dup2)218 1460 A10 R1703(fail)S1863(if:)S4416 V1080([EBADF])S10 I1830(Oldd)S10 R2056(or)S10 I2165(newd)S10 R2402(is)S2494(not)S2647(a)S2717(valid)S2943(active)S3209(descriptor)S4584 V1080([EMFILE])S1830(Too)S2017(many)S2265(descriptors)S2732(are)S2881(active.)S4752 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S4872 V10 B1080(Dup)S10 R1290(and)S10 B(dup2)218 1460 A10 R1703(are)S1852(now)S2050(implemented)S2600(using)S2842(the)S10 B2990(F_DUPFD)S10 R3470(function)S3830(of)S10 B3939(fcntl)S10 R4136(\(2\),)S(although)351 4304 A4680(the)S4828(old)S4982(system)S4992 V1080(call)S(interfaces)393 1251 A(still)151 1669 A1845(exist)S2060(to)S(support)301 2163 A2489(old)S2642(programs.)S5160 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S5280 V10 B1080(open)S10 R1287(\(2\),)S10 B1455(close)S10 R1662(\(2\),)S10 B1830(fcntl)S10 R2027(\(2\),)S10 B2195(pipe)S10 R2380(\(2\).)S7903 V720(Page)S941(1)S2669(\()S2711(May)S2920(13,)S(1986)200 3070 A3278(\))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 + -