From 8938562563541f855e567662c6e13e0949413ec5 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Mon, 27 Mar 2006 01:19:09 +0000
Subject: [PATCH] Add logic table comment for sopen().  Eventually, that's how
 it *should* work.

---
 src/xpdev/filewrap.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c
index 6d642a992b..6efd714345 100644
--- a/src/xpdev/filewrap.c
+++ b/src/xpdev/filewrap.c
@@ -144,6 +144,34 @@ int DLLCALL unlock(int fd, long pos, long len)
 }
 
 /* Opens a file in specified sharing (file-locking) mode */
+/*
+ * This is how it *SHOULD* work:
+ * Values of DOS 2-6.22 file sharing behavior: 
+ *          | Second and subsequent Opens 
+ * First    |Compat Deny   Deny   Deny   Deny 
+ * Open     |       All    Write  Read   None 
+ *          |R W RW R W RW R W RW R W RW R W RW
+ * - - - - -| - - - - - - - - - - - - - - - - -
+ * Compat R |Y Y Y  N N N  1 N N  N N N  1 N N
+ *        W |Y Y Y  N N N  N N N  N N N  N N N
+ *        RW|Y Y Y  N N N  N N N  N N N  N N N
+ * - - - - -|
+ * Deny   R |C C C  N N N  N N N  N N N  N N N
+ * All    W |C C C  N N N  N N N  N N N  N N N
+ *        RW|C C C  N N N  N N N  N N N  N N N
+ * - - - - -|
+ * Deny   R |2 C C  N N N  Y N N  N N N  Y N N
+ * Write  W |C C C  N N N  N N N  Y N N  Y N N
+ *        RW|C C C  N N N  N N N  N N N  Y N N
+ * - - - - -| 
+ * Deny   R |C C C  N N N  N Y N  N N N  N Y N
+ * Read   W |C C C  N N N  N N N  N Y N  N Y N
+ *        RW|C C C  N N N  N N N  N N N  N Y N
+ * - - - - -| 
+ * Deny   R |2 C C  N N N  Y Y Y  N N N  Y Y Y
+ * None   W |C C C  N N N  N N N  Y Y Y  Y Y Y
+ *        RW|C C C  N N N  N N N  N N N  Y Y Y
+ */
 #if !defined(__QNX__)
 int DLLCALL sopen(const char *fn, int access, int share, ...)
 {
-- 
GitLab