Last change
on this file since 4 was 2, checked in by Mattia Monga, 14 years ago |
Importazione sorgenti
|
File size:
383 bytes
|
Rev | Line | |
---|
[2] | 1 | #include <unistd.h>
|
---|
| 2 | #include <stdio.h>
|
---|
| 3 | #include <stdlib.h>
|
---|
| 4 |
|
---|
| 5 | int main(){
|
---|
| 6 | int x = fork();
|
---|
| 7 | if (x < 0){
|
---|
| 8 | perror("Errore nella fork:");
|
---|
| 9 | exit(1);
|
---|
| 10 | } else {
|
---|
| 11 | if (x != 0){
|
---|
| 12 | printf("Processo padre\n");
|
---|
| 13 | } else {
|
---|
| 14 | char* argv[] = {"/bin/ls", "/usr", 0};
|
---|
| 15 | execv("/bin/ls",argv );
|
---|
| 16 | perror("Errore nella exec:");
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
| 19 | return 0;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.