/src/glib/gio/gfiledescriptorbased.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* GIO - GLib Input, Output and Streaming Library |
2 | | * |
3 | | * Copyright (C) 2010 Christian Kellner |
4 | | * |
5 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
6 | | * |
7 | | * This library is free software; you can redistribute it and/or |
8 | | * modify it under the terms of the GNU Lesser General Public |
9 | | * License as published by the Free Software Foundation; either |
10 | | * version 2.1 of the License, or (at your option) any later version. |
11 | | * |
12 | | * This library is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | | * Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General |
18 | | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
19 | | * |
20 | | * Author: Christian Kellner <gicmo@gnome.org> |
21 | | */ |
22 | | |
23 | | #include "config.h" |
24 | | #include "gfiledescriptorbased.h" |
25 | | #include "glibintl.h" |
26 | | |
27 | | |
28 | | /** |
29 | | * SECTION:gfiledescriptorbased |
30 | | * @short_description: Interface for file descriptor based IO |
31 | | * @include: gio/gfiledescriptorbased.h |
32 | | * @see_also: #GInputStream, #GOutputStream |
33 | | * |
34 | | * #GFileDescriptorBased is implemented by streams (implementations of |
35 | | * #GInputStream or #GOutputStream) that are based on file descriptors. |
36 | | * |
37 | | * Note that `<gio/gfiledescriptorbased.h>` belongs to the UNIX-specific |
38 | | * GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config |
39 | | * file when using it. |
40 | | * |
41 | | * Since: 2.24 |
42 | | * |
43 | | **/ |
44 | | |
45 | | typedef GFileDescriptorBasedIface GFileDescriptorBasedInterface; |
46 | | G_DEFINE_INTERFACE (GFileDescriptorBased, g_file_descriptor_based, G_TYPE_OBJECT) |
47 | | |
48 | | static void |
49 | | g_file_descriptor_based_default_init (GFileDescriptorBasedInterface *iface) |
50 | 0 | { |
51 | 0 | } |
52 | | |
53 | | /** |
54 | | * g_file_descriptor_based_get_fd: |
55 | | * @fd_based: a #GFileDescriptorBased. |
56 | | * |
57 | | * Gets the underlying file descriptor. |
58 | | * |
59 | | * Returns: The file descriptor |
60 | | * |
61 | | * Since: 2.24 |
62 | | **/ |
63 | | int |
64 | | g_file_descriptor_based_get_fd (GFileDescriptorBased *fd_based) |
65 | 0 | { |
66 | 0 | GFileDescriptorBasedIface *iface; |
67 | |
|
68 | 0 | g_return_val_if_fail (G_IS_FILE_DESCRIPTOR_BASED (fd_based), 0); |
69 | | |
70 | 0 | iface = G_FILE_DESCRIPTOR_BASED_GET_IFACE (fd_based); |
71 | |
|
72 | 0 | return (* iface->get_fd) (fd_based); |
73 | 0 | } |