#include <iostream>
using namespace std;

#include <sys/types.h> 
#include <unistd.h> 
#include <signal.h> 

/* getpid() is a system call declared in unistd.h.  It returns */
/* a value of type pid_t.  This pid_t is a special type for process ids. */
/* It's equivalent to int. */

int main(void) 
{ 
	pid_t mypid;
	uid_t myuid;
	
	for (int i = 0;  i < 3;  i++) 
	{
		mypid = getpid();
		cout << "I am process " << mypid << endl;
		cout << "My parent is process " << getppid() << endl;
		myuid = getuid();
		cout << "The owner of this process has uid " 
			<< myuid << endl;
		//kill(mypid, SIGINT);
		/* sleep is a system call or library function that suspends
		   this process for the indicated number of seconds */
		sleep(1);
	}

	return 0;
}

