Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- int main(int argc, char ** argv) {
- // int i = 0;
- // pid_t parent_pid;
- // pid_t child_pid;
- int procNum = atoi(argv[1]);
- if(argc == 1) { //ew. argc < 2
- printf("Please insert at least one option.\n");
- return 0;
- }
- char * i_procNum; //system wiedenski, jak odsiecz; czastki zmiennych
- char * pc_procNum; //pointer char
- asprintf(&pc_procNum, "%d", (procNum - 1));
- //cos tu powinno byc, ale kurwa nie wim co
- for(int i = 0; i < procNum; i++) {
- pid_t child_pid = fork();
- if(child_pid == 0) {
- char * c_temp[32];
- if(argv[2] == NULL) {
- printf ("Numer PID procesu macierzystego wynosi %d\n", (int) getppid());
- }
- else {
- }
- }
- }
- for(int i = 0; i < procNum; i++) {
- wait(0); //jak zorbic dobrego wait'a
- }
- //i co teraz??
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement