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

📄 execl.3

📁 Unix操作系统minix 2.0源码
💻 3
📖 第 1 页 / 共 2 页
字号:
3770(argument)S4175(functions.)S4624(This)S4828(means)S5110(that)S3960 V1080(the)S1234(type)S1438(of)S1553(the)S1708(arguments)S(beyond)295 2159 A10 I2486(arg0)S10 R2707(is)S2806(not)S2966(checked.)S3378(So)S3516(the)S3671(null)S3859(pointer)S4176(requires)S4533(an)S4660(explicit)S4994(cast)S5183(to)S4080 V1080(type)S10 B1278(\(char)S1533(*\))S10 R1642(if)S1729(not)S1882(of)S1991(that)S2167(type)S2365(already.\))S4248 V1080(The)S10 B1270(execv)S10 R1538(version)S1867(is)S1967(useful)S2246(when)S2497(the)S2653(number)S2993(of)S3110(arguments)S3562(is)S(unknown)373 3662 A4069(in)S4181(advance;)S4573(the)S4730(arguments)S5183(to)S4368 V10 B1080(execv)S10 R1342(are)S1493(the)S1643(name)S1888(of)S1999(the)S2149(\256le)S2305(to)S2410(be)S2532(executed)S2917(and)S3089(a)S3161(vector)S3440(of)S3550(strings)S3844(containing)S4294(the)S4443(arguments.)S4938(The)S5121(last)S4488 V1080(argument)S1485(string)S1739(must)S1959(be)S2079(followed)S2462(by)S2587(a)S2657(null)S2838(pointer.)S4656 V1080(When)S1345(a)S1415(C)S1507(program)S1873(is)S1965(executed,)S2373(it)S2454(is)S2546(called)S2812(as)S2921(follows:)S4824 V10 B1440(int)S1583(main\(int)S10 I1978(argc)S10 B2162(,)S2212(char)S2433(*const)S10 I2732(argv)S10 B2916([],)S3034(char)S3255(*const)S10 I3554(envp)S10 B([]\);)136 3744 A5064 V1440(exit\(main\()S10 I1883(argc)S10 B2067(,)S10 I2117(argv)S10 B2301(,)S10 I2351(envp)S10 B(\)\);)102 2541 A5232 V10 R1080(where)S10 I1363(argc)S10 R1583(is)S1686(the)S1845(argument)S(count)223 2261 A2521(and)S10 I2703(argv)S10 R2924(is)S3028(an)S3160(array)S3405(of)S3526(character)S3934(pointers)S4295(to)S4410(the)S4570(arguments)S5026(them-)S5352 V1080(selves.)S1409(As)S1554(indicated,)S10 I1981(argc)S10 R2198(is)S(conventionally)597 2298 A2928(at)S3034(least)S3252(one)S3430(and)S3608(the)S3764(\256rst)S3954(member)S4317(of)S4434(the)S4589(array)S4829(points)S5106(to)S5216(a)S5472 V1080(string)S1334(containing)S1783(the)S1931(name)S2174(of)S2283(the)S2431(\256le.)S5640 V10 I1080(Argv)S10 R1301(is)S1393(directly)S1726(usable)S2008(in)S2111(another)S10 B2438(execv)S10 R(because)319 2698 A10 I3042(argv)S10 R3234([)S10 I3268(argc)S10 R3460(])S3519(is)S3611(0.)S5808 V10 I1080(Envp)S10 R1315(is)S1410(a)S1483(pointer)S1796(to)S1902(an)S2025(array)S2261(of)S2373(strings)S2669(that)S(constitute)391 2848 A3267(the)S10 I3418(environment)S10 R3949(of)S4061(the)S4212(process.)S4593(Each)S4824(string)S5082(con-)S5928 V1080(sists)S1280(of)S1391(a)S1463(name,)S1733(an)S1854(=,)S1962(and)S2133(a)S2204(null-terminated)S2851(value.)S3145(The)S3328(array)S3562(of)S3672(pointers)S4022(is)S4115(terminated)S4572(by)S4698(a)S4769(null)S4951(pointer.)S6048 V1080(The)S1264(shell)S10 B1481(sh)S10 R1576(\(1\))S1721(passes)S2005(an)S2127(environment)S2662(entry)S2896(for)S(each)185 3041 A3254(global)S3533(shell)S3751(variable)S4104(de\256ned)S4428(when)S4674(the)S4825(program)S5194(is)S6168 V1080(called.)S1400(See)S10 B1575(environ)S10 R1905(\(7\))S2052(for)S2199(some)S(conventionally)597 2440 A3066(used)S3279(names.)S3614(The)S3799(C)S3894(run-time)S4269(start-off)S4623(routine)S(places)252 4936 A5216(a)S6288 V(copy)195 1080 A1307(of)S10 I1423(envp)S10 R1645(in)S1755(the)S1910(global)S2193(cell)S10 B2371(environ)S10 R2701(,)S2758(which)S3036(is)S3135(used)S3351(by)S10 B3483(execv)S10 R3750(and)S10 B3927(execl)S10 R4172(to)S4282(pass)S4487(the)S4642(environment)S5183(to)S6408 V1080(any)S(subprograms)519 1250 A1794(executed)S2177(by)S2302(the)S2450(current)S2761(program.)S6576 V10 B1080(Execlp)S10 R1407(and)S10 B1588(execvp)S10 R1915(are)S2075(called)S2352(with)S2567(the)S2726(same)S2969(arguments)S3424(as)S10 B3544(execl)S10 R3793(and)S10 B3974(execv)S10 R4209(,)S4270(but)S(duplicate)369 4434 A4839(the)S4998(shell's)S6696 V1080(actions)S1392(in)S1497(searching)S1910(for)S2055(an)S2177(executable)S2635(\256le)S2791(in)S2896(a)S2968(list)S3117(of)S3227(directories.)S3729(The)S3912(directory)S4302(list)S4451(is)S4544(obtained)S4916(from)S5138(the)S6816 V1080(environment)S1619(variable)S10 B1975(PATH)S10 R2255(.)S2336(Under)S2619(standard)S2991(Minix,)S3292(if)S3385(a)S3461(\256le)S3622(is)S(found)234 3721 A3987(that)S4170(is)S4269(executable,)S4757(but)S4917(does)S5133(not)S6936 V1080(have)S1303(the)S1459(proper)S1754(executable)S2217(header)S2518(then)S2723(it)S2811(is)S2910(assumed)S3288(to)S3398(be)S3525(a)S3602(shell)S3824(script.)S10 B4130(Execlp)S10 R4453(and)S10 B4630(execvp)S10 R4953(execute)S7056 V10 B1080(/bin/sh)S10 R1400(to)S1507(interpret)S1878(the)S2030(script.)S2333(Under)S2614(Minix-vmd)S3100(this)S3274(does)S3487(not)S3644(happen,)S3988(a)S4062(script)S4315(must)S4540(begin)S4793(with)S10 B5002(#!)S10 R5116(and)S7176 V1080(the)S1228(full)S1393(path)S1591(name)S1834(of)S1943(the)S2091(interpreter)S2537(if)S2624(it)S2705(is)S2797(to)S2900(be)S3020(an)S3140(executable)S3596(script.)S7344 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S7464 V10 B1080(execve)S10 R1360(\(2\),)S10 B1528(fork)S10 R1713(\(2\),)S10 B1881(environ)S10 R2211(\(7\),)S10 B2379(sh)S10 R2474(\(1\).)S7903 V720(Page)S941(1)S2654(\()S2696(April)S2934(25,)S(1986)200 3084 A3292(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 2 2BP/slant 0 def/height 0 def480 V10 R720(EXECL)S1054(\()S1096(3)S1154(\))S2696(Eighth)S(Edition)296 2989 A4793(EXECL)S5127(\()S5169(3)S5227(\))S960 V9 R720(D)S722(DI)S790(IA)S823(AG)S891(GN)S959(NO)S1027(OS)S1095(ST)S1147(TI)S1205(IC)S1238(CS)S1300(S)S1080 V10 R1080(If)S1182(the)S1339(\256le)S(cannot)268 1502 A1804(be)S(found,)259 1933 A2226(if)S2322(it)S2412(is)S2513(not)S2675(executable,)S3166(if)S3263(it)S3354(does)S3573(not)S3736(start)S3945(with)S4159(a)S4239(valid)S4475(magic)S4756(number)S5098(\(see)S1200 V10 B1080(a.out)S10 R1295(\(5\)\),)S1502(if)S1594(maximum)S2031(memory)S2396(is)S(exceeded,)400 2493 A2923(or)S3037(if)S3129(the)S3282(arguments)S3731(require)S4047(too)S4205(much)S(space,)249 4458 A4737(a)S4812(return)S5082(con-)S1320 V(stitutes)285 1080 A1392(the)S(diagnostic;)441 1542 A2010(the)S2160(return)S2428(value)S2673(is)S10 R-12767(-)S10 R2824(1)S2901(and)S10 B(errno)241 3073 A10 R3341(is)S3435(set)S3574(as)S3685(for)S10 B3830(execve)S10 R4110(.)S4187(Even)S4421(for)S4566(the)S4716(super-user,)S5188(at)S1440 V1080(least)S1290(one)S1460(of)S1569(the)S1717(execute-permission)S2525(bits)S2695(must)S2915(be)S3035(set)S3172(for)S3315(a)S3385(\256le)S3539(to)S3642(be)S3762(executed.)S7903 V720(September)S1176(13,)S(1996)200 1326 A2654(\()S2696(April)S2934(25,)S(1986)200 3084 A3292(\))S4990(Page)S5211(2)S8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 2

⌨️ 快捷键说明

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