什么是窦性心律不齐| 九月底是什么星座| 长期口臭吃什么药| 除湿气吃什么| 彩超跟b超有什么区别| 贫血什么意思| 风湿免疫科是看什么病的| 低血糖挂什么科| 蕃秀什么意思| 什么时候是排卵期| 早泄吃什么药见效| 拉尿有泡泡是什么原因| 眼睛疼吃什么药| 肠胃炎发烧吃什么药| 1.4什么星座| 电光性眼炎用什么眼药水| 精神出轨是什么意思| 男人脚肿是什么病的前兆| aigner是什么牌子| 不什么不什么| 梦见长白头发是什么意思| 什么是网球肘| 8月15日是什么星座| 胆巴是什么| 十二月二十三是什么星座| cpr是什么意思| 少白头是什么原因| 白牡丹是什么茶| vc什么意思| 公积金取出来有什么影响| 大嘴巴是什么意思| 右下眼皮跳是什么原因| 吃什么补血快效果好| 睾丸疼是什么原因| 停休是什么意思| 花儿为什么那么红| 调戏什么意思| 1964年属什么的| 5月21日是什么星座| 为什么一喝阿胶睡眠就好了| 星期三左眼皮跳是什么预兆| 鼻窦炎吃什么药好得快| 利普刀是什么手术| 吃了布洛芬不能吃什么| 绝非偶然是什么意思| 口干口苦吃什么药| 尿的酸碱度能说明什么| 血糖高能吃什么| 腿上起水泡是什么原因| 大拇指发抖是什么原因| 下野是什么意思| 慈禧为什么要毒死光绪| 什么动物没尾巴| 1977年出生是什么命| 胃不好吃什么水果好| 硬发质适合什么发型| 5岁属什么生肖| 背厚是什么原因造成的| 尿道炎吃什么药最好| 血热吃什么药效果好| 女人嘴唇发紫是什么病| 白蛋白低有什么症状| 肌肉萎缩有什么症状| 吃蜂蜜不能吃什么食物| 什么是白脉病| 肠痉挛是什么症状| 什么首阔步| 变蛋吃多了有什么危害| 花胶是什么| 什么食物含有维生素b| 肠道菌群失调有什么症状| 黄芪的读音是什么| 忤逆是什么意思| 京ag6是什么意思| 梦见吃葡萄是什么意思| 送男生什么生日礼物好| 长命百岁是什么意思| 胆囊壁毛糙吃什么药效果好| 2010年属什么生肖| 喜气洋洋是什么意思| 儿童查微量元素挂什么科| 一天两包烟会导致什么后果| rfc是什么意思| 口水臭什么原因| 港股通是什么| 尿急憋不住尿是什么原因| 老花镜什么品牌好| 2007属什么| 1935年是什么生肖| 嵌顿是什么意思| 感觉是什么意思| 红斑狼疮吃什么药| 降压药什么时候吃| 天秤座和什么星座最不配| 乐观是什么意思| 花枝是什么食材| 胃炎是什么原因引起的| 什么是孽缘| 6月五行属什么| 梦见捡钱是什么预兆| 依非韦伦片治什么病的| 回盲瓣呈唇形什么意思| 指甲长出来是白色的什么原因| 嘴臭是什么原因引起的| 心脏房颤吃什么药好| 寂寞的近义词是什么| 靖国神社是什么| 冲浪是什么意思| 吃什么能降甘油三酯| k3是什么| 乌岽单丛是什么茶| 前胸后背疼是什么原因| 跳大神是什么意思| 保税区是什么意思| 为什么拉屎是黑色的| 小兔子吃什么| 每天早上起床头晕是什么原因| 生加一笔是什么字| 狗咬人后狗为什么会死| 羁什么意思| 心慌是什么原因引起的| 活性炭是什么东西| 总是犯困是什么原因| 脸发红发痒是什么原因| 身上长小肉揪是什么原因| 黄五行属性是什么| 额头冒痘是什么原因| 黄芪什么功效| fcm是什么意思| 喉咙干是什么病的前兆| 五合是什么意思| 什么是皮疹| q12h医学上是什么意思| 林俊杰的粉丝叫什么| 反应性细胞改变炎症是什么意思| 高育良什么级别| 什么时候放开二胎政策| 交叉感染是什么意思| 得了幽门螺杆菌是什么症状| 冠脉cta主要检查什么| 就不告诉你就不告诉你是什么儿歌| a7是什么意思| 怀孕一个月有什么症状| 肠胃不好吃什么药效果好| 同性恋是什么意思| 吃大虾不能吃什么| 经常熬夜吃什么好| 吃什么补肾壮阳最快| 拔罐拔出水是什么原因| 双侧乳腺腺病是什么意思| 尿潜血是什么意思| 三轮体空什么意思| 骨髓不造血是什么病| 喉咙痛咳嗽吃什么药| 舌头溃疡吃什么药| btc是什么意思| 吃什么食物补气血| 提拉米苏是什么意思| 灌肠是什么| ABA是什么植物激素| 男命正印代表什么| 放疗跟化疗有什么区别| 脂溢性皮炎用什么洗发水| 昆字五行属什么| 4月25号什么星座| 白子是什么| 洗涤剂是什么| 欺骗餐是什么意思| 什么火灾不能用水扑灭| px什么意思| 梦见耗子是什么预兆| 胃疼什么原因| 为什么白带是黄绿色的| 胃胀吃什么药效果好| 甲鱼和什么一起炖最好| 云南属于什么地区| 雷贝拉唑钠肠溶片什么时候吃| 纯净水是什么水| 喝酒不能吃什么东西| 日本豆腐是什么做的| 什么是早谢泄图片| 眼屎多吃什么药效果好| 怀孕做梦梦到蛇是什么意思| 六月初五是什么日子| 什么是感觉| 霉菌性阴道炎是什么引起的| 经期适合喝什么汤| 大便一粒粒是什么原因| 为什么爱出汗| 膀胱过度活动症吃什么药| 3个火念什么| a21和以纯什么关系| 柿子像什么| 9月13号是什么星座| 锰酸钾是什么颜色| 孩子白细胞高是什么原因| 什么是脂肪| aigle是什么牌子| 质子治疗是什么意思| 8月15日什么星座| 虾皮有什么营养价值| 偏头疼吃什么药好| 正骨是什么意思| 为什么体检要空腹| 什么症状吃柏子养心丸| 茶壶里煮饺子的歇后语是什么| 一个三点水一个除念什么| 肺结节是什么原因| 舌头根发麻是什么原因| 蜂蜜加白醋有什么功效| 榅桲是什么水果| 老蜜蜡什么颜色最好| 11月30是什么星座| 睾丸疼吃什么药| 寓言故事有什么特点| 胃一阵一阵的疼是什么原因| 什么叫资本运作| 浪琴手表什么档次| 万能血型是什么血型| 天蝎座的幸运色是什么| 什么是双氧水| 什么东西晚上才生出尾巴| 循环系统包括什么| 半夜12点是什么时辰| 玩手机头疼是什么原因| 人乳头瘤病毒56型阳性是什么意思| 机不可失的下一句是什么| 小舅子是什么意思| 子宫内膜厚有什么影响| lgg什么意思| 不care是什么意思| 雄字五行属什么| 喉头水肿吃什么药| 男生早上为什么会晨勃| 神经内科和神经外科有什么区别| 印度人为什么不吃猪肉| 降钙素原是什么意思| 踩指压板有什么好处| 松露是什么| 导管室是干什么的| 三点水加个真念什么| 泌尿感染吃什么药| 扁平足是什么样子图片| 肝胆不好有什么症状有哪些表现| 转氨酶高是什么引起的| 肝胆相照是什么生肖| 开车压到蛇有什么说法| 直径是什么意思| 蒙氏教育是什么| 梦见吃排骨是什么意思| 佛珠断了有什么预兆| 河豚是什么| z世代是什么意思| 梦见亲人是什么意思| 眼睛吹风就流泪是什么原因| 米糊是什么| 心脏超声检查是什么| 淡定从容是什么意思| 天目湖白茶属于什么茶| 一节黑一节白是什么蛇| 168红包代表什么意思| 人为什么要读书| 便宜的反义词是什么| 今年天热的原因是什么| 百度

广西千年农具节焕发新生机 助力乡村振兴

(Redirected from Exec (operating system))
百度 客体包括三个方面,即自愿参与公共事务治理,理性表达,合理监督的权利;对公共决策产生实质影响的权利;获得及时反馈的权利。

In computing, exec is a functionality of an operating system that runs an executable file in the context of an already existing process, replacing the previous executable. This act is also referred to as an overlay. It is especially important in Unix-like systems, although it also exists elsewhere. As no new process is created, the process identifier (PID) does not change, but the machine code, data, heap, and stack of the process are replaced by those of the new program.

The exec call or some variant is available for many programming languages including compiled languages and some scripting languages. In command interpreters, the exec built-in command replaces the shell process with the specified program.[1]

Nomenclature

edit

Interfaces to exec and its implementations vary. Depending on programming language it may be accessible via one or more functions, and depending on operating system it may be represented with one or more actual system calls. For this reason, exec is sometimes described as a collection of functions.

In C, there is no single, plain exec function.

High-level programming languages usually provide one call named exec.[citation needed]

In POSIX systems, other Unix-like systems, and other multitasking systems

edit

C language prototypes

edit

The POSIX standard declares a family of exec functions in the unistd.h header file. The same functions are declared in process.h for DOS (see below), OS/2, and Microsoft Windows.

int execl(char const *path, char const *arg0, ...);
int execle(char const *path, char const *arg0, ..., char const *envp[]);
int execlp(char const *file, char const *arg0, ...);
int execv(char const *path, char const *argv[]);
int execve(char const *path, char const *argv[], char const *envp[]);
int execvp(char const *file, char const *argv[]);
int execvpe(const char *file, char *const argv[], char *const envp[]);
int fexecve(int fd, char *const argv[], char *const envp[]);

Some implementations provide these functions named with a leading underscore (e.g. _execl).[2]

The base of each is exec, followed by one or more letters:

  • eEnvironment variables are passed as an array of pointers to null-terminated strings of form name=value. The final element of the array must be a null pointer.[3]
  • lCommand-line arguments are passed as individual pointers to null-terminated strings. The last argument must be a null pointer.
  • p – Uses the PATH environment variable to find the file named in the file argument to be executed.
  • v – Command-line arguments are passed as an array of pointers to null-terminated strings. The final element of the array must be a null pointer.[3]
  • f (prefix) – A file descriptor is passed instead. The file descriptor must be opened with O_RDONLY or O_PATH and the caller must have permission to execute its file.[4]

In functions where no environment variables can be passed (execl, execlp, execv, execvp), the new process image inherits the current environment variables.

First command-line argument

edit

The first argument arg0 is often the name of the executable file and may be the same value as the path argument. However, this is purely convention and there is no guarantee of this behavior, nor is it standardized. For instance, in Java, the first argument is not the path to the executable, but instead the first argument for the program.[5]

Effects

edit

A file descriptor open when an exec call is made remains open in the new process image, unless fcntl was called with FD_CLOEXEC or opened with O_CLOEXEC (the latter was introduced in POSIX.1-2001). This aspect is used to specify the standard streams of the new program.

A successful overlay destroys the previous memory address space of the process. All of its memory areas that were not shared are reclaimed by the operating system. Consequently, all its data that were not passed to the new program, or otherwise saved, are lost.

Return value

edit

A successful call replaces the current process image, so it cannot return anything to the program that made the call. Processes do have an exit status, but that value is collected by the parent process.

If the call fails, the return value is always -1, and errno is set to an appropriate value.[6]

In DOS

edit

DOS is not a multitasking operating system, but replacing the previous executable image is essential due to harsh primary memory limitations and lack of virtual memory. The same API is used for overlaying programs in DOS and it has effects similar to ones on POSIX systems.

MS-DOS exec functions always load the new program into memory as if the "maximum allocation" in the program's executable file header is set to default value of 0xFFFF. The EXEHDR utility can be used to change the maximum allocation field of a program. However, if this is done and the program is invoked with one of the exec functions, the program might behave differently from a program invoked directly from the operating-system command line or with one of the spawn functions (see below).

In shells

edit

Many Unix shells also offer a builtin exec command that replaces the shell process with the specified program.[1][7] Wrapper scripts often use this command to run a program (either directly or through an interpreter or virtual machine) after setting environment variables or other configuration. By using exec, the resources used by the shell program do not need to stay in use after the program is started.[8]

The command can also perform a redirection. In some shells, it is possible to use it for redirection only, without making an actual overlay.

In other systems

edit

OS/360 and successors include a system call XCTL (transfer control) that performs a similar function to exec.[9]

Versus spawning

edit

The traditional Unix system does not have the functionality to create a new process running a new executable program in one step. Other systems may use spawn as the main tool for running executables. Its result is equivalent to the fork–exec sequence of Unix-like systems. POSIX supports the posix_spawn routines as an optional extension.[10]

See also

edit

References

edit
  1. ^ a b exec – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
  2. ^ Whitney, Tyler. "_exec, _wexec Functions". learn.microsoft.com. Retrieved 2025-08-05.
  3. ^ a b execve – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
  4. ^ fexecve – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
  5. ^ "Java - Your Application Launcher - Dev.java". Dev.java: The Destination for Java Developers. Retrieved 2025-08-05.
  6. ^ execve – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
  7. ^ Sharma, Sagar (2025-08-05). "Using exec Command in Bash Shell Scripts [4 Examples]". Linux Handbook. Retrieved 2025-08-05.
  8. ^ "Shell Wrappers". Linux Documentation Project. 2025-08-05. Retrieved 2025-08-05.
  9. ^ "XCTL". www.ibm.com. Retrieved 2025-08-05.
  10. ^ posix_spawn – System Interfaces Reference, The Single UNIX Specification, Version 5 from The Open Group
什么的游泳 无国界医生是什么意思 文殊菩萨是管什么的 阿司匹林治什么病 农历六月初七是什么星座
网拍是什么意思 黑镜讲的是什么 鲛人是什么意思 像什么一样 胰腺炎有什么症状
1946年中国发生了什么 男人蛋蛋疼是什么原因 发冷发热是什么原因 醪糟是什么东西 闫和阎有什么区别
祭坛是什么意思 为什么手脚老是出汗 肾阳虚有什么症状男性 心肌酶高吃什么药 爬金字塔为什么会死
精神什么满hcv7jop5ns2r.cn 累赘是什么意思hcv8jop7ns6r.cn 肾在什么位置cj623037.com 心疼是什么原因hcv8jop8ns5r.cn 1954年出生属什么hcv8jop7ns5r.cn
血糖高能吃什么蔬菜hcv7jop9ns2r.cn lin是什么意思imcecn.com 最新奥特曼叫什么hcv8jop3ns5r.cn 体检挂什么科hcv9jop4ns4r.cn 阿米巴病是什么病hcv7jop4ns5r.cn
身上无力是什么原因hcv7jop9ns0r.cn 吃什么盐比较好有利于健康hcv9jop6ns0r.cn 文化内涵是什么意思hcv9jop1ns8r.cn 胆囊是干什么用的hcv8jop6ns9r.cn 淋巴细胞百分比高是什么意思hcv7jop6ns0r.cn
劳宫穴在什么位置hcv8jop5ns3r.cn 什么叫二氧化碳hcv8jop0ns3r.cn 气罐和火罐有什么区别hcv8jop5ns1r.cn 家里为什么会有蜈蚣hcv9jop5ns1r.cn 大连机场叫什么名字aiwuzhiyu.com
百度