blob: da92ec617811cab8a9a53ec41711db20d17018fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <stdio.h> // printf, perror
#include <unistd.h> // getpid, getppid, execlp
#include <sys/types.h> // pid_t
int main(int argc, char* argv[]) {
pid_t pid = getpid();
pid_t parent = getppid();
printf("%d %d\n", pid, parent);
if (execlp("ps", "ps", (char*)NULL) < 0) {
perror("execlp");
return 1;
}
}
|