1#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
6#![allow(
7 clippy::approx_constant,
8 clippy::type_complexity,
9 clippy::unreadable_literal,
10 clippy::upper_case_acronyms
11)]
12#![cfg_attr(docsrs, feature(doc_cfg))]
13
14use glib_sys as glib;
15
16mod manual;
17
18pub use manual::*;
19
20#[allow(unused_imports)]
21use libc::{FILE, intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t};
22#[cfg(unix)]
23#[allow(unused_imports)]
24use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
25#[allow(unused_imports)]
26use std::ffi::{
27 c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
28};
29
30#[allow(unused_imports)]
31use glib::{GType, gboolean, gconstpointer, gpointer};
32
33pub type GUnixPipeEnd = c_int;
35pub const G_UNIX_PIPE_END_READ: GUnixPipeEnd = 0;
36pub const G_UNIX_PIPE_END_WRITE: GUnixPipeEnd = 1;
37
38pub type GUnixFDSourceFunc =
40 Option<unsafe extern "C" fn(c_int, glib::GIOCondition, gpointer) -> gboolean>;
41
42#[derive(Copy, Clone)]
44#[repr(C)]
45pub struct GUnixPipe {
46 pub fds: [c_int; 2],
47}
48
49impl ::std::fmt::Debug for GUnixPipe {
50 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
51 f.debug_struct(&format!("GUnixPipe @ {self:p}"))
52 .field("fds", &self.fds)
53 .finish()
54 }
55}
56
57unsafe extern "C" {
58
59 #[cfg(feature = "v2_80")]
63 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
64 pub fn g_closefrom(lowfd: c_int) -> c_int;
65 pub fn g_unix_error_quark() -> glib::GQuark;
66 pub fn g_unix_fd_add(
67 fd: c_int,
68 condition: glib::GIOCondition,
69 function: GUnixFDSourceFunc,
70 user_data: gpointer,
71 ) -> c_uint;
72 pub fn g_unix_fd_add_full(
73 priority: c_int,
74 fd: c_int,
75 condition: glib::GIOCondition,
76 function: GUnixFDSourceFunc,
77 user_data: gpointer,
78 notify: glib::GDestroyNotify,
79 ) -> c_uint;
80 #[cfg(feature = "v2_88")]
81 #[cfg_attr(docsrs, doc(cfg(feature = "v2_88")))]
82 pub fn g_unix_fd_query_path(fd: c_int, error: *mut *mut glib::GError) -> *mut c_char;
83 pub fn g_unix_fd_source_new(fd: c_int, condition: glib::GIOCondition) -> *mut glib::GSource;
84 #[cfg(feature = "v2_80")]
85 #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
86 pub fn g_fdwalk_set_cloexec(lowfd: c_int) -> c_int;
87 #[cfg(feature = "v2_64")]
88 #[cfg_attr(docsrs, doc(cfg(feature = "v2_64")))]
89 pub fn g_unix_get_passwd_entry(
90 user_name: *const c_char,
91 error: *mut *mut glib::GError,
92 ) -> *mut passwd;
93 pub fn g_unix_set_fd_nonblocking(
94 fd: c_int,
95 nonblock: gboolean,
96 error: *mut *mut glib::GError,
97 ) -> gboolean;
98 pub fn g_unix_signal_add(
99 signum: c_int,
100 handler: glib::GSourceFunc,
101 user_data: gpointer,
102 ) -> c_uint;
103 pub fn g_unix_signal_add_full(
104 priority: c_int,
105 signum: c_int,
106 handler: glib::GSourceFunc,
107 user_data: gpointer,
108 notify: glib::GDestroyNotify,
109 ) -> c_uint;
110 pub fn g_unix_signal_source_new(signum: c_int) -> *mut glib::GSource;
111
112}