What would be the output of the following code segment, if the current working directory contains the following files and directories: .bashrc, .profile, .private, test.c, main.c, courses, personal. (5 marks)
main()
{
pid_t childpid;
childpid = fork();
if (childpid == -1) {
printf(“fork failed.\n”);
exit(1);
}
if (childpid == 0) {
if (execlp (“/bin/ls”, “ls ./”, NULL) < 0) {
printf(“exec failed.\n”);
exit(1);
}
}
}
operating systems
Page 1 of 1|
|

New Topic/Question
Reply



MultiQuote


|