GUnixInputStream

GUnixInputStream — Streaming input operations for UNIX file descriptors

Synopsis

#include <gio/gunixinputstream.h>

struct              GUnixInputStream;
GInputStream *      g_unix_input_stream_new             (gint fd,
                                                         gboolean close_fd);
void                g_unix_input_stream_set_close_fd    (GUnixInputStream *stream,
                                                         gboolean close_fd);
gboolean            g_unix_input_stream_get_close_fd    (GUnixInputStream *stream);
gint                g_unix_input_stream_get_fd          (GUnixInputStream *stream);

Object Hierarchy

  GObject
   +----GInputStream
         +----GUnixInputStream

Implemented Interfaces

GUnixInputStream implements GPollableInputStream.

Properties

  "close-fd"                 gboolean              : Read / Write
  "fd"                       gint                  : Read / Write / Construct Only

Description

GUnixInputStream implements GInputStream for reading from a UNIX file descriptor, including asynchronous operations. The file descriptor must be selectable, so it doesn't work with opened files.

Note that <gio/gunixinputstream.h> belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file when using it.

Details

struct GUnixInputStream

struct GUnixInputStream;

Implements GInputStream for reading from selectable unix file descriptors


g_unix_input_stream_new ()

GInputStream *      g_unix_input_stream_new             (gint fd,
                                                         gboolean close_fd);

Creates a new GUnixInputStream for the given fd.

If close_fd is TRUE, the file descriptor will be closed when the stream is closed.

fd :

a UNIX file descriptor

close_fd :

TRUE to close the file descriptor when done

Returns :

a new GUnixInputStream

g_unix_input_stream_set_close_fd ()

void                g_unix_input_stream_set_close_fd    (GUnixInputStream *stream,
                                                         gboolean close_fd);

Sets whether the file descriptor of stream shall be closed when the stream is closed.

stream :

a GUnixInputStream

close_fd :

TRUE to close the file descriptor when done

Since 2.20


g_unix_input_stream_get_close_fd ()

gboolean            g_unix_input_stream_get_close_fd    (GUnixInputStream *stream);

Returns whether the file descriptor of stream will be closed when the stream is closed.

stream :

a GUnixInputStream

Returns :

TRUE if the file descriptor is closed when done

Since 2.20


g_unix_input_stream_get_fd ()

gint                g_unix_input_stream_get_fd          (GUnixInputStream *stream);

Return the UNIX file descriptor that the stream reads from.

stream :

a GUnixInputStream

Returns :

The file descriptor of stream

Since 2.20

Property Details

The "close-fd" property

  "close-fd"                 gboolean              : Read / Write

Whether to close the file descriptor when the stream is closed.

Default value: TRUE

Since 2.20


The "fd" property

  "fd"                       gint                  : Read / Write / Construct Only

The file descriptor that the stream reads from.

Default value: -1

Since 2.20

See Also

GInputStream