Update German translation
[glib.git] / glib / glib-unix.h
blob55469439d6431653131e31fac6c48e9bba888114
1 /* glib-unix.h - Unix specific integration
2 * Copyright (C) 2011 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 #ifndef __G_UNIX_H__
19 #define __G_UNIX_H__
21 /* We need to include the UNIX headers needed to use the APIs below,
22 * but we also take this opportunity to include a wide selection of
23 * other UNIX headers. If one of the headers below is broken on some
24 * system, work around it here (or better, fix the system or tell
25 * people to use a better one).
27 #include <unistd.h>
28 #include <errno.h>
29 #include <sys/wait.h>
30 #include <stdlib.h>
31 #include <fcntl.h>
33 #include <glib.h>
35 #ifndef G_OS_UNIX
36 #error "This header may only be used on UNIX"
37 #endif
39 G_BEGIN_DECLS
41 /**
42 * G_UNIX_ERROR:
44 * Error domain for API in the g_unix_ namespace. Note that there is no
45 * exported enumeration mapping %errno. Instead, all functions ensure that
46 * %errno is relevant. The code for all #G_UNIX_ERROR is always 0, and the
47 * error message is always generated via g_strerror().
49 * It is expected that most code will not look at %errno from these APIs.
50 * Important cases where one would want to differentiate between errors are
51 * already covered by existing cross-platform GLib API, such as e.g. #GFile
52 * wrapping `ENOENT`. However, it is provided for completeness, at least.
54 #define G_UNIX_ERROR (g_unix_error_quark())
56 GLIB_AVAILABLE_IN_2_30
57 GQuark g_unix_error_quark (void);
59 GLIB_AVAILABLE_IN_2_30
60 gboolean g_unix_open_pipe (gint *fds,
61 gint flags,
62 GError **error);
64 GLIB_AVAILABLE_IN_2_30
65 gboolean g_unix_set_fd_nonblocking (gint fd,
66 gboolean nonblock,
67 GError **error);
69 GLIB_AVAILABLE_IN_2_30
70 GSource *g_unix_signal_source_new (gint signum);
72 GLIB_AVAILABLE_IN_2_30
73 guint g_unix_signal_add_full (gint priority,
74 gint signum,
75 GSourceFunc handler,
76 gpointer user_data,
77 GDestroyNotify notify);
79 GLIB_AVAILABLE_IN_2_30
80 guint g_unix_signal_add (gint signum,
81 GSourceFunc handler,
82 gpointer user_data);
84 /**
85 * GUnixFDSourceFunc:
86 * @fd: the fd that triggered the event
87 * @condition: the IO conditions reported on @fd
88 * @user_data: user data passed to g_unix_fd_add()
90 * The type of functions to be called when a UNIX fd watch source
91 * triggers.
93 * Returns: %FALSE if the source should be removed
94 **/
95 typedef gboolean (*GUnixFDSourceFunc) (gint fd,
96 GIOCondition condition,
97 gpointer user_data);
99 GLIB_AVAILABLE_IN_2_36
100 GSource *g_unix_fd_source_new (gint fd,
101 GIOCondition condition);
103 GLIB_AVAILABLE_IN_2_36
104 guint g_unix_fd_add_full (gint priority,
105 gint fd,
106 GIOCondition condition,
107 GUnixFDSourceFunc function,
108 gpointer user_data,
109 GDestroyNotify notify);
111 GLIB_AVAILABLE_IN_2_36
112 guint g_unix_fd_add (gint fd,
113 GIOCondition condition,
114 GUnixFDSourceFunc function,
115 gpointer user_data);
117 G_END_DECLS
119 #endif /* __G_UNIX_H__ */