Objectives
We would like to :
  -  Understand the basics of the 
open call.
 
Notes
   -  
int open(const char *pathname, int flags, ...  /* mode_t mode */ );
   
       -  Needs fcntl.h
       
 -  This takes a path to the file we wish to open
       
 -  It then takes at least one, but as many flags as you need to provide3
       
           -  Normally these are bitwise ored together (|), and only one is given
           
 -  See demo1.cpp
           
 -  But we can give as many as we want.
           
 -  See demo2.cpp
           
 -  If the file is opened with the flag O_CREAT, or O_TMPFILE
           
               -  The  file will be created.
               
 -  The file is owned by the process owner
               
 -  The group is either the process group id, or the file group owner if the group setgid bit is set.
               
 -  The mode argument must be supplied
               
 -  If the mode argument is not supplied, the next values on the stack will be used. (IE THE ARGUMENT IS EXPECTED)
               
 -  More on this when we discuss O_CREAT
           
 
            -  But this is done is demo1.cpp
           
 -  The return value is 
           
               -  A non negative integer on success
               
 -  -1 on error, and errno is set.
           
 
        
        -  The path argument
       
           -  This can be absolute, relative but not ~
           
 -  See demo3.cpp.
           
              -  This is a primitive version of cat.
           
 
        
    
    -  Open flags
   
       -  Must include exactly one of the following
       
           -  O_RDONLY
           
 -  O_WRONLY
           
 -  O_RDWR
       
 
        -  Read and write are obvious, let's delay RW for a bit.
       
 -  If you add O_CREAT as a flag
       
           -  If the file does not exist, it will be created.
       
 
        -  When creating a file, the last argument, as we said is the mode.
       
           -  These are permissions
           
 -   S_I*
           
                -  RWXU, RWXG, RWXO
                
 -  RUSR, WUSR, XUSR and for GRP and OTH
                
 -  SUID, SGID, SVTX  for setuid user, group and sticky
           
 
            -  Again, demo1
           
 -  But setting the setuid bit might be a problem , or even ignored
           
 -  See demo5