Skip to main content

glib_unix/auto/
functions.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
5use crate::ffi;
6use glib::translate::*;
7
8/// Close every file descriptor equal to or greater than @lowfd.
9///
10/// Typically @lowfd will be 3, to leave standard input, standard output
11/// and standard error open.
12///
13/// This is the same as Linux `close_range (lowfd, ~0U, 0)`,
14/// but portable to other OSs and to older versions of Linux.
15/// Equivalently, it is the same as BSD `closefrom (lowfd)`, but portable,
16/// and async-signal-safe on all OSs.
17///
18/// This function is async-signal safe, making it safe to call from a
19/// signal handler or a `callback::GLib::SpawnChildSetupFunc, as long as @lowfd is
20/// non-negative.
21/// See [`signal(7)`](man:signal(7)) and
22/// [`signal-safety(7)`](man:signal-safety(7)) for more details.
23/// ## `lowfd`
24/// Minimum fd to close, which must be non-negative
25///
26/// # Returns
27///
28/// 0 on success, -1 with errno set on error
29#[cfg(feature = "v2_80")]
30#[cfg_attr(docsrs, doc(cfg(feature = "v2_80")))]
31#[doc(alias = "g_closefrom")]
32pub unsafe fn closefrom(lowfd: i32) -> i32 {
33    unsafe { ffi::g_closefrom(lowfd) }
34}
35
36#[doc(alias = "g_unix_error_quark")]
37pub fn error_quark() -> glib::Quark {
38    unsafe { from_glib(ffi::g_unix_error_quark()) }
39}
40
41//#[cfg(feature = "v2_64")]
42//#[cfg_attr(docsrs, doc(cfg(feature = "v2_64")))]
43//#[doc(alias = "g_unix_get_passwd_entry")]
44//#[doc(alias = "get_passwd_entry")]
45//pub fn passwd_entry(user_name: &str) -> Result</*Unimplemented*/Option<Basic: Pointer>, glib::Error> {
46//    unsafe { TODO: call ffi:g_unix_get_passwd_entry() }
47//}