// syscall2.cpp
// Glenn G. Chappell
// 23 Jan 2012
//
// For CS 321 Spring 2012
// System calls demo #2
// Fork example

#include <unistd.h>
// Used: write, fork, pid_t
// Also has sleep (commented out)
#include <cstdlib>
using std::size_t;
#include <iostream>
using std::cout;
using std::endl;


int main()
{
    size_t dummy;  // For ignored return values

    dummy = write(1, "BEFORE\n", 7);  // 1 = stdout

    pid_t p = fork();

    dummy = write(1, "AFTER\n", 6);
    cout << "p = " << p << endl;

    //sleep(60);
    // IF NOT RUNNING UNDER NETRUN:
    // Uncomment the above "sleep" line, run the resulting program in
    // the background (in most *ix shells, add "&" to the end of the
    // command line), and then list the processes.

    return 0;
}

