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

📄 allman2.ps

📁 Unix操作系统minix 2.0源码
💻 PS
📖 第 1 页 / 共 5 页
字号:
2376 V1080(the)S1228(lock)S1426(is)S1518(released)S1874(\(see)S2062(further)S10 B2362(fcntl)S10 R2559(\(2\)\).)S2544 V1080(A)S1180(close)S1414(of)S1525(all)S1653(of)S1764(a)S1836(process's)S2238(descriptors)S2707(is)S2801(automatic)S3225(on)S10 I3352(exit)S10 R3506(,)S3558(but)S3713(since)S3947(there)S4177(is)S4272(a)S4345(limit)S4563(on)S4691(the)S4842(number)S5177(of)S2664 V1080(active)S1346(descriptors)S1813(per)S1967(process,)S10 B2319(close)S10 R2551(is)S(necessary)392 2643 A3060(for)S3203(programs)S3608(that)S3784(deal)S3977(with)S4181(many)S4429(descriptors.)S2832 V1080(When)S1345(a)S1416(process)S1744(forks)S1977(\(see)S10 B2166(fork)S10 R2351(\(2\)\),)S2554(all)S2681(descriptors)S3149(for)S3293(the)S3442(new)S3636(child)S3863(process)S4191(reference)S4594(the)S4743(same)S4976(objects)S2952 V1080(as)S1191(they)S1391(did)S1546(in)S1650(the)S1799(parent)S2077(before)S2361(the)S2510(fork.)S2754(If)S2848(a)S2919(new)S3113(process)S3441(is)S3534(then)S3733(to)S3837(be)S3958(run)S4118(using)S10 B4361(execve)S10 R4641(\(2\),)S4810(the)S4959(process)S3072 V1080(would)S1365(normally)S1762(inherit)S2059(these)S2300(descriptors.)S2826(Most)S3066(of)S3185(the)S3343(descriptors)S3820(can)S3995(be)S4125(rearranged)S4592(with)S10 B(dup2)218 4806 A10 R5024(\(2\))S5177(or)S3192 V1080(deleted)S1398(with)S10 B1603(close)S10 R1836(before)S2120(the)S10 B2269(execve)S10 R2575(is)S2668(attempted,)S3116(but)S3270(if)S3358(some)S3596(of)S3706(these)S3939(descriptors)S(will)157 4407 A(still)151 4590 A4767(be)S4888(needed)S5199(if)S3312 V1080(the)S10 B1228(execve)S10 R1533(fails,)S1757(it)S1838(is)S(necessary)392 1930 A2347(to)S2451(arrange)S2780(for)S2924(them)S3151(to)S3255(be)S3376(closed)S3659(if)S3747(the)S10 B3896(execve)S10 R(succeeds.)383 4202 A4636(For)S4802(this)S4973(reason,)S3432 V1080(the)S1232(call)S(``fcntl\(d,)362 1407 A1798(F_SETFD,)S10 I(\257ags)189 2267 A10 R(\)'')102 2456 A2587(is)S2683(provided,)S3094(that)S3274(can)S3443(be)S3567(used)S3780(to)S3887(mark)S4123(a)S4197(descriptor)S4629("close)S4906(on)S5035(exec")S3552 V1080(by)S(setting)268 1205 A1498(the)S10 B1646(FD_CLOEXEC)S10 R2354(\257ag:)S3720 V1440(fcntl\(d,)S1759(F_SETFD,)S2224(fcntl\(d,)S2543(F_GETFD\))S3034(|)S3079(FD_CLOEXEC\);)S3888 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)S4008 V10 R(Upon)223 1080 A(successful)414 1330 A1771(completion,)S2275(a)S2347(value)S2592(of)S2703(0)S2780(is)S2874(returned.)S3287(Otherwise,)S3754(a)S3826(value)S4071(of)S10 R-14182(-)S10 R4239(1)S4316(is)S4411(returned)S4775(and)S4948(the)S5099(glo-)S4128 V1080(bal)S1228(integer)S1533(variable)S10 B(errno)241 1883 A10 R2149(is)S2241(set)S2378(to)S2481(indicate)S2825(the)S2973(error.)S4296 V9 R720(E)S722(ER)S780(RR)S842(RO)S904(OR)S972(RS)S1034(S)S4416 V10 B1080(Close)S10 R(will)157 1340 A1522(fail)S1682(if:)S4584 V1080([EBADF])S10 I1830(D)S10 R1928(is)S2020(not)S2173(an)S2293(active)S2559(descriptor.)S4752 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S4872 V10 B1080(open)S10 R1287(\(2\),)S10 B1455(pipe)S10 R1640(\(2\),)S10 B1808(execve)S10 R2088(\(2\),)S10 B2256(fcntl)S10 R2453(\(2\).)S7903 V720(Page)S941(1)S2669(\()S2711(May)S2920(22,)S(1986)200 3070 A3278(\))S4455(September)S4911(17,)S(1996)200 5061 A8143 VEP%%Page: 1 10BP/slant 0 def/height 0 def480 V10 R720(CREAT)S1059(\()S1101(2)S1159(\))S2696(Eighth)S(Edition)296 2989 A4788(CREAT)S5127(\()S5169(2)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(creat)S10 R-11302(-)S10 R1384(create)S1651(a)S1721(new)S1914(\256le)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(<sys/types.h>)S1488 V1080(#include)S1482(<fcntl.h>)S1728 V1080(int)S(creat\(const)477 1236 A1751(char)S1985(*)S10 I2035(name)S10 B2253(,)S2316(mode_t)S10 I2673(mode)S10 B2891(\))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(This)S1295(interface)S1702(is)S1794(made)S2054(obsolete)S2426(by)S2557(open\(2\),)S2932(it)S3019(is)S3111(equivalent)S3584(to)S2184 V10 R1440(open\()S10 I1669(name)S10 R1887(,)S1937(O_WRONLY)S2528(|)S2573(O_CREAT)S3052(|)S3097(O_TRUNC,)S10 I3612(mode)S10 R3830(\))S2352 V10 B1080(Creat)S10 R1359(creates)S1672(a)S1750(new)S1951(\256le)S2113(or)S2230(prepares)S2605(to)S2716(rewrite)S3036(an)S3164(existing)S3515(\256le)S3677(called)S10 I3951(name)S10 R4177(,)S4235(given)S4491(as)S4608(the)S4764(address)S5099(of)S5216(a)S2472 V1080(null-terminated)S1739(string.)S2056(If)S2161(the)S2321(\256le)S2487(did)S2652(not)S2817(exist,)S3069(it)S3162(is)S3266(given)S3526(mode)S10 I3786(mode)S10 R4012(,)S4074(as)S4195(modi\256ed)S4589(by)S4726(the)S4886(process's)S2592 V1080(mode)S1328(mask)S1565(\(see)S10 B1753(umask)S10 R2038(\(2\)\).)S2265(Also)S2480(see)S10 B2634(chmod)S10 R2925(\(2\))S3068(for)S3211(the)S3359(construction)S3881(of)S3990(the)S10 I4138(mode)S10 R4381(argument.)S2760 V1080(If)S1173(the)S1321(\256le)S1475(did)S1628(exist,)S1868(its)S1988(mode)S2236(and)S2406(owner)S2683(remain)S2988(unchanged)S3448(but)S3601(it)S3682(is)S3774(truncated)S4174(to)S4277(0)S4352(length.)S2928 V1080(The)S1262(\256le)S1416(is)S1508(also)S1695(opened)S2010(for)S(writing,)316 2153 A2494(and)S2664(its)S2784(\256le)S2938(descriptor)S3366(is)S3458(returned.)S3096 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S3216 V10 R1080(The)S10 I1268(mode)S10 R1517(given)S1771(is)S1869(arbitrary;)S2276(it)S2363(need)S2585(not)S2745(allow)S(writing.)316 3001 A3374(This)S3585(feature)S3898(has)S4064(been)S4286(used)S4502(in)S4612(the)S4767(past)S4961(by)S5093(pro-)S3336 V1080(grams)S1356(to)S1464(construct)S1862(a)S1936(simple,)S2258(exclusive)S2667(locking)S2997(mechanism.)S3534(It)S3625(is)S(replaced)342 3721 A4092(by)S4221(the)S4373(O_EXCL)S4789(open)S5013(mode,)S3456 V1080(or)S1189(the)S1337(advisory)S1708(locking)S2034(of)S2143(the)S10 B2291(fcntl)S10 R2488(\(2\))S(facility.)311 2631 A3624 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)S3744 V10 R1080(The)S1269(value)S10 R-11519(-)S10 R1576(1)S1658(is)S1757(returned)S2125(if)S2219(an)S2346(error)S2575(occurs.)S2920(Otherwise,)S3392(the)S3547(call)S3725(returns)S4038(a)S(non-negative)525 4116 A4674(descriptor)S5110(that)S3864 V1080(only)S1283(permits)S(writing.)316 1610 A4032 V9 R720(E)S722(ER)S780(RR)S842(RO)S904(OR)S972(RS)S1034(S)S4152 V10 I1080(Creat)S10 R(will)157 1334 A1516(fail)S1676(and)S1846(the)S1994(\256le)S(will)157 2148 A2330(not)S2483(be)S2603(created)S2920(or)S3029(truncated)S3429(if)S3516(one)S3686(of)S3795(the)S3943(following)S4359(occur:)S4320 V1080([ENOTDIR])S1830(A)S(component)446 1928 A2399(of)S2508(the)S2656(path)S2854(pre\256x)S3114(is)S3206(not)S3359(a)S3429(directory.)S4488 V([ENAMETOOLONG])916 1080 A4608 V1830(The)S2012(path)S2210(name)S(exceeds)319 2453 A2797(PATH_MAX)S3371(characters.)S4776 V1080([ENOENT])S1830(The)S2012(named)S2305(\256le)S2459(does)S2668(not)S2821(exist.)S4944 V1080([ELOOP])S1830(Too)S2033(many)S2297(symbolic)S2706(links)S2942(were)S(encountered)492 3180 A3713(in)S3833(translating)S4300(the)S4465(pathname.)S4948(\(Minix-)S5064 V1830(vmd\))S5232 V1080([EACCES])S1830(Search)S2130(permission)S2596(is)S2688(denied)S2981(for)S3124(a)S(component)446 3194 A3665(of)S3774(the)S3922(path)S4120(pre\256x.)S5400 V1080([EACCES])S1830(The)S2012(\256le)S2166(does)S2375(not)S2528(exist)S2743(and)S2913(the)S3061(directory)S3450(in)S3553(which)S3824(it)S3905(is)S3997(to)S4100(be)S4220(created)S4537(is)S4629(not)S4782(writable.)S5568 V1080([EACCES])S1830(The)S2012(\256le)S2166(exists,)S2445(but)S2598(it)S2679(is)S2771(unwritable.)S5736 V1080([EISDIR])S1830(The)S2012(\256le)S2166(is)S2258(a)S2328(directory.)S5904 V1080([EMFILE])S1830(There)S2091(are)S2240(already)S2562(too)S2715(many)S2963(\256les)S3156(open.)S6072 V1080([ENFILE])S1830(The)S2012(system)S2316(\256le)S2470(table)S2691(is)S2783(full.)S6240 V1080([ENOSPC])S1830(The)S2016(directory)S2409(in)S2516(which)S2791(the)S2943(entry)S3179(for)S3326(the)S3478(new)S3675(\256le)S3833(is)S3929(being)S(placed)263 4182 A(cannot)268 4475 A4773(be)S4898(extended)S6360 V(because)319 1830 A2174(there)S2401(is)S2493(no)S(space)224 2618 A2867(left)S3027(on)S3152(the)S3300(\256le)S3454(system)S3758(containing)S4207(the)S4355(directory.)S6528 V1080([ENOSPC])S1830(There)S2091(are)S2240(no)S2365(free)S(inodes)262 2548 A2835(on)S2960(the)S3108(\256le)S3262(system)S3566(on)S3691(which)S3962(the)S4110(\256le)S4264(is)S4356(being)S4604(created.)S6696 V1080([EROFS])S1830(The)S2012(named)S2305(\256le)S2459(resides)S2764(on)S2889(a)S2959(read-only)S3370(\256le)S3524(system.)S6864 V1080([ENXIO])S1830(The)S2012(\256le)S2166(is)S2258(a)S2328(character)S2724(special)S3029(or)S3139(block)S3388(special)S3694(\256le,)S3874(and)S4045(the)S4194(associated)S4634(device)S4923(does)S5133(not)S6984 V1830(exist.)S7152 V1080([EIO])S1830(An)S1978(I/O)S2138(error)S2360(occurred)S2738(while)S2987(making)S3313(the)S3461(directory)S3850(entry)S4082(or)S4191(allocating)S4613(the)S(inode.)248 4761 A7320 V1080([EFAULT])S10 I1830(Name)S10 R2090(points)S2360(outside)S2675(the)S2823(process's)S3223(allocated)S3612(address)S(space.)249 3939 A7903 V720(Page)S941(1)S2669(\()S2711(May)S2920(22,)S(1986)200 3070 A3278(\))S4455(September)S4911(17,)S(1996)200 5061 A8143 VEP%%Page: 2 11BP/slant 0 def/height 0 def480 V10 R720(CREAT)S1059(\()S1101(2)S1159(\))S2696(Eighth)S(Edition)296 2989 A4788(CREAT)S5127(\()S5169(2)S5227(\))S960 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S1080 V10 B1080(open)S10 R1287(\(2\),)S10 B1455(write)S10 R1680(\(2\),)S10 B1848(close)S10 R2055(\(2\),)S10 B2223(chmod)S10 R2514(\(2\),)S10 B2682(umask)S10 R2967(\(2\).)S7903 V720(September)S1176(17,)S(1996)200 1326 A2669(\()S2711(May)S2920(13,)S(1986)200 3070 A3278(\))S4990(Page)S5211(2)S8143 VEP%%Page: 1 12BP/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)S

⌨️ 快捷键说明

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