Hello!
I need to find 3 ways and explain the advantages and disadvantages of them..
The first that I used is kill like that:
Code:
#include"stdio.h"
#include<signal.h>
#include<unistd.h>
#include<errno.h>
#include<stdlib.h>
int main(int argc, char **argv ){
long a = strtol(argv[1], NULL, 10);
kill( a, 0);
int b= errno;
if(errno == 3){
printf("Process %s does not exist \n",argv[1]);
}
else if(errno == 1){
printf("Process %s exists but we have no permission \n",argv[1]);
}
else{
printf("Process %s exists \n",argv[1]);
}
}
I did this with kill but I have no idea how to find 2 more and explain the advantages and disadvantages
Please help!!