The execv API
The execv(3) API's signature is:
int execv(const char *path, char *const argv[]);
As can be seen, the first parameter is the pathname of the successor process. The second parameter is, similar to the environment list above, a two-dimensional array of strings (each of them NULL-terminated) holding all the arguments to pass to the successor, starting from argv[0]. Think about it, it's identical to what we, C programmers, are so used to; this is the signature of the main() function in C:
int main(int argc, char *argv[]);
argc, of course, is the number of parameters received, including the program name itself (held in argv[0]), and argv is a pointer to a two-dimensional array of strings (each of them NULL-terminated) holding all ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access