Para obter o ID do processo
julien@ubuntu:~/c/shell$ cat pid.c
#include <stdio.h>
#include <unistd.h>
/**
* main - PID
*
* Return: Always 0.
*/
int main(void)
{
pid_t my_pid;
my_pid = getpid();
printf("%u\n", my_pid);
return (0);
}
julien@ubuntu:~/c/shell$ gcc -Wall -Werror -pedantic pid.c -o mypid && ./mypid
3237
julien@ubuntu:~/c/shell$ ./mypid
3238
julien@ubuntu:~/c/shell$ ./mypid
3239
julien@ubuntu:~/c/shell$
Onyekachukwu Nweke