CSC209H1 Lecture Notes - C Dynamic Memory Allocation, C String Handling, System Call

55 views1 pages
24 Apr 2013
School
Course
Professor

Document Summary

Ex. build a simple shell showexec. c: the exec system call replaces the program being run by a process by a different one; i. e. replace a process"s memory contents. The new program starts executing from the beginning: on success, exec never returns, on failure, exec returns -1, ex. Program x program y int i = 5; printf(hellon, i); printf(%dn, i); exec(y); printf(%dn, i); // reach here = something wrong. 5: after exec new process inherits from calling process: Just different instructions: 6 versions of exec execl(char *path, char *arg0, , (char *)null); execv(char *path, char *argv[]); Suffix: v for vector, l for list. Ways to pass in arguments for the executable. L list out all the arguments. V pass in an array of arguments. Last element of the argv array has to be null to indicate the end for both l or v options.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents