[PATCH xserver 2/3] os: Allow requests to preseve client input buffers for a longer time.

Rami Ylimäki rami.ylimaki at vincit.fi
Mon Oct 3 05:16:26 PDT 2011


Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
 include/os.h    |    2 ++
 os/connection.c |    7 +++++++
 os/io.c         |   15 +++++++++++++++
 os/osdep.h      |    4 ++++
 4 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/os.h b/include/os.h
index fda0181..2bb27ca 100644
--- a/include/os.h
+++ b/include/os.h
@@ -158,6 +158,8 @@ extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/);
 
 extern _X_EXPORT void AttendClient(ClientPtr /*client*/);
 
+extern _X_EXPORT void ReserveClientInput(ClientPtr /*client*/);
+
 extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/);
 
 extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/);
diff --git a/os/connection.c b/os/connection.c
index b339f4e..94d627a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1206,6 +1206,13 @@ AttendClient (ClientPtr client)
     }
 }
 
+void
+ReserveClientInput(ClientPtr client)
+{
+    OsCommPtr oc = (OsCommPtr)client->osPrivate;
+    ReserveOsInput(oc);
+}
+
 /* make client impervious to grabs; assume only executing client calls this */
 
 void
diff --git a/os/io.c b/os/io.c
index 6bfddfc..ddc605a 100644
--- a/os/io.c
+++ b/os/io.c
@@ -1093,6 +1093,21 @@ AllocateOutputBuffer(void)
     return oco;
 }
 
+/**
+ * Indicate that an input buffer can't be shared. This is needed by
+ * requests that must to access the input buffer even after the
+ * request handler has returned.
+ *
+ * @param[in] oc connection information
+ */
+void ReserveOsInput(OsCommPtr oc)
+{
+    /* Check whether the input buffer has been already marked to be
+     * shared.  If so, revert the earlier decision. */
+    if (AvailableInput == oc)
+        AvailableInput = NULL;
+}
+
 void
 FreeOsBuffers(OsCommPtr oc)
 {
diff --git a/os/osdep.h b/os/osdep.h
index 087e36d..81c44a8 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -182,6 +182,10 @@ extern int FlushClient(
     int /*extraCount*/
 );
 
+extern void ReserveOsInput(
+    OsCommPtr /*oc*/
+);
+
 extern void FreeOsBuffers(
     OsCommPtr /*oc*/
 );
-- 
1.7.1



More information about the xorg-devel mailing list