Describe the syntax of the `execl()` function. What do each of the parameters represent, and why is the first argument conventionally the name of the program?
Here's how execl system call's syntax looks like:-
int execl(const char* path,const char* arg0,...,const char* argn,(char*)0);
The path argument contains the path of the program.
arg0....argn: These are the arguments that are passed to the executable. The first argument 'arg0' is conventionally the name of the program. as it is the same as the path supplied, for e.g. if we run ls using execl it would be as: execl("/bin/ls","ls","-l",(char*)0); here we have already specified the path, but we need to include ls as the first argument, otherwise it won't run.
The (char*)0, specifies null, it terminates the list of arguments.