glib_unix_sys/
lib.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#![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#[cfg(unix)]
21#[allow(unused_imports)]
22use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
23#[allow(unused_imports)]
24use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
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::{gboolean, gconstpointer, gpointer, GType};
32
33// Enums
34pub type GUnixPipeEnd = c_int;
35pub const G_UNIX_PIPE_END_READ: GUnixPipeEnd = 0;
36pub const G_UNIX_PIPE_END_WRITE: GUnixPipeEnd = 1;
37
38// Callbacks
39pub type GUnixFDSourceFunc =
40    Option<unsafe extern "C" fn(c_int, glib::GIOCondition, gpointer) -> gboolean>;
41
42// Records
43#[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
57extern "C" {
58
59    //=========================================================================
60    // GUnixPipe
61    //=========================================================================
62    #[cfg(feature = "v2_80")]
63    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
64    pub fn g_unix_pipe_clear(self_: *mut GUnixPipe);
65    #[cfg(feature = "v2_80")]
66    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
67    pub fn g_unix_pipe_close(
68        self_: *mut GUnixPipe,
69        end: GUnixPipeEnd,
70        error: *mut *mut glib::GError,
71    ) -> gboolean;
72    #[cfg(feature = "v2_80")]
73    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
74    pub fn g_unix_pipe_get(self_: *mut GUnixPipe, end: GUnixPipeEnd) -> c_int;
75    #[cfg(feature = "v2_80")]
76    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
77    pub fn g_unix_pipe_open(
78        self_: *mut GUnixPipe,
79        flags: c_int,
80        error: *mut *mut glib::GError,
81    ) -> gboolean;
82    #[cfg(feature = "v2_80")]
83    #[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
84    pub fn g_unix_pipe_steal(self_: *mut GUnixPipe, end: GUnixPipeEnd) -> c_int;
85
86    //=========================================================================
87    // Other functions
88    //=========================================================================
89    pub fn g_closefrom(lowfd: c_int) -> c_int;
90    pub fn g_unix_error_quark() -> glib::GQuark;
91    pub fn g_unix_fd_add(
92        fd: c_int,
93        condition: glib::GIOCondition,
94        function: glib::GUnixFDSourceFunc,
95        user_data: gpointer,
96    ) -> c_uint;
97    pub fn g_unix_fd_add_full(
98        priority: c_int,
99        fd: c_int,
100        condition: glib::GIOCondition,
101        function: glib::GUnixFDSourceFunc,
102        user_data: gpointer,
103        notify: glib::GDestroyNotify,
104    ) -> c_uint;
105    pub fn g_unix_fd_query_path(fd: c_int, error: *mut *mut glib::GError) -> *mut c_char;
106    pub fn g_unix_fd_source_new(fd: c_int, condition: glib::GIOCondition) -> *mut glib::GSource;
107    pub fn g_fdwalk_set_cloexec(lowfd: c_int) -> c_int;
108    pub fn g_unix_get_passwd_entry(
109        user_name: *const c_char,
110        error: *mut *mut glib::GError,
111    ) -> *mut passwd;
112    pub fn g_unix_set_fd_nonblocking(
113        fd: c_int,
114        nonblock: gboolean,
115        error: *mut *mut glib::GError,
116    ) -> gboolean;
117    pub fn g_unix_signal_add(
118        signum: c_int,
119        handler: glib::GSourceFunc,
120        user_data: gpointer,
121    ) -> c_uint;
122    pub fn g_unix_signal_add_full(
123        priority: c_int,
124        signum: c_int,
125        handler: glib::GSourceFunc,
126        user_data: gpointer,
127        notify: glib::GDestroyNotify,
128    ) -> c_uint;
129    pub fn g_unix_signal_source_new(signum: c_int) -> *mut glib::GSource;
130
131}