Windows has an option to open a file with exclusive access rights. Unix doesn\'t.
In order to ensure exclusive access to some file or device, it is common practice
You should probably be using flock(), as in
fd = open(filename, O_RDWR | O_CREAT, 0666); // open or create lockfile //check open success... rc = flock(fd, LOCK_EX | LOCK_NB); // grab exclusive lock, fail if can't obtain. if (rc) { // fail }