X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=listati%2Ffork_test.c;fp=listati%2Ffork_test.c;h=3ca965f46aabbedc3f2dc42fd94cec9749c62c03;hb=4aa6c51696d2b11c572eccd37238db1691785573;hp=0000000000000000000000000000000000000000;hpb=fd4e2fd24a218ef56953fd5a58d0b3c0bee8acb7;p=gapil.git diff --git a/listati/fork_test.c b/listati/fork_test.c new file mode 100644 index 0000000..3ca965f --- /dev/null +++ b/listati/fork_test.c @@ -0,0 +1,44 @@ +#include /* error definitions and routines */ +#include /* C standard library */ +#include /* unix standard library */ +#include /* standard I/O library */ +#include /* string functions */ + +/* Help printing routine */ +void usage(void); + +int main(int argc, char *argv[]) +{ +/* + * Variables definition + */ + int nchild, i; + pid_t pid; + int wait_child = 0; + int wait_parent = 0; + int wait_end = 0; + ... /* handling options */ + nchild = atoi(argv[optind]); + printf("Test for forking %d child\n", nchild); + /* loop to fork children */ + for (i=0; i