[gmime] Added get/set_owner() methods for GMimeStreamMmap



commit fb6b58ce26dd0f6b3217ffacaf87f83de35f6bd5
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Sat Dec 16 15:59:25 2017 -0500

    Added get/set_owner() methods for GMimeStreamMmap

 gmime/gmime-stream-mmap.c |   41 +++++++++++++++++++++++++++++++++++++++++
 gmime/gmime-stream-mmap.h |    3 +++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/gmime/gmime-stream-mmap.c b/gmime/gmime-stream-mmap.c
index e99ae18..8272d57 100644
--- a/gmime/gmime-stream-mmap.c
+++ b/gmime/gmime-stream-mmap.c
@@ -440,3 +440,44 @@ g_mime_stream_mmap_new_with_bounds (int fd, int prot, int flags, gint64 start, g
        return NULL;
 #endif /* HAVE_MMAP */
 }
+
+
+/**
+ * g_mime_stream_mmap_get_owner:
+ * @stream: a #GMimeStreamFs
+ *
+ * Gets whether or not @stream owns the backend file descriptor.
+ *
+ * Returns: %TRUE if @stream owns the backend file descriptor or %FALSE
+ * otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+g_mime_stream_mmap_get_owner (GMimeStreamMmap *stream)
+{
+       g_return_val_if_fail (GMIME_IS_STREAM_MMAP (stream), FALSE);
+       
+       return stream->owner;
+}
+
+
+/**
+ * g_mime_stream_mmap_set_owner:
+ * @stream: a #GMimeStreamMmap
+ * @owner: %TRUE if this stream should own the file descriptor or %FALSE otherwise
+ *
+ * Sets whether or not @stream owns the backend file descriptor.
+ *
+ * Note: @owner should be %TRUE if the stream should close() the
+ * backend file descriptor when destroyed or %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+void
+g_mime_stream_mmap_set_owner (GMimeStreamMmap *stream, gboolean owner)
+{
+       g_return_if_fail (GMIME_IS_STREAM_MMAP (stream));
+       
+       stream->owner = owner;
+}
diff --git a/gmime/gmime-stream-mmap.h b/gmime/gmime-stream-mmap.h
index 2cacae4..4613713 100644
--- a/gmime/gmime-stream-mmap.h
+++ b/gmime/gmime-stream-mmap.h
@@ -69,6 +69,9 @@ GType g_mime_stream_mmap_get_type (void);
 GMimeStream *g_mime_stream_mmap_new (int fd, int prot, int flags);
 GMimeStream *g_mime_stream_mmap_new_with_bounds (int fd, int prot, int flags, gint64 start, gint64 end);
 
+gboolean g_mime_stream_mmap_get_owner (GMimeStreamMmap *stream);
+void g_mime_stream_mmap_set_owner (GMimeStreamMmap *stream, gboolean owner);
+
 G_END_DECLS
 
 #endif /* __GMIME_STREAM_MMAP_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]